comparison CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/lib/python3.8/site-packages/pysam/libchtslib.c @ 69:33d812a61356

planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author jpayne
date Tue, 18 Mar 2025 17:55:14 -0400
parents
children
comparison
equal deleted inserted replaced
67:0e9998148a16 69:33d812a61356
1 /* Generated by Cython 3.0.11 */
2
3 /* BEGIN: Cython Metadata
4 {
5 "distutils": {
6 "define_macros": [
7 [
8 "BUILDING_WHEEL",
9 null
10 ]
11 ],
12 "depends": [
13 "/project/htslib/htslib/bgzf.h",
14 "/project/htslib/htslib/cram.h",
15 "/project/htslib/htslib/faidx.h",
16 "/project/htslib/htslib/hfile.h",
17 "/project/htslib/htslib/hts.h",
18 "/project/htslib/htslib/kstring.h",
19 "/project/htslib/htslib/sam.h",
20 "/project/htslib/htslib/tbx.h",
21 "/project/htslib/htslib/vcf.h",
22 "/project/htslib/htslib/vcfutils.h",
23 "/project/pysam/htslib_util.h"
24 ],
25 "extra_compile_args": [
26 "-Wno-unused",
27 "-Wno-strict-prototypes",
28 "-Wno-sign-compare",
29 "-Wno-error=declaration-after-statement"
30 ],
31 "extra_link_args": [
32 "-Wl,-rpath,$ORIGIN"
33 ],
34 "extra_objects": [
35 "htslib/kfunc.o",
36 "htslib/kstring.o",
37 "htslib/bcf_sr_sort.o",
38 "htslib/bgzf.o",
39 "htslib/errmod.o",
40 "htslib/faidx.o",
41 "htslib/header.o",
42 "htslib/hfile.o",
43 "htslib/hts.o",
44 "htslib/hts_expr.o",
45 "htslib/hts_os.o",
46 "htslib/md5.o",
47 "htslib/multipart.o",
48 "htslib/probaln.o",
49 "htslib/realn.o",
50 "htslib/regidx.o",
51 "htslib/region.o",
52 "htslib/sam.o",
53 "htslib/sam_mods.o",
54 "htslib/simd.o",
55 "htslib/synced_bcf_reader.o",
56 "htslib/vcf_sweep.o",
57 "htslib/tbx.o",
58 "htslib/textutils.o",
59 "htslib/thread_pool.o",
60 "htslib/vcf.o",
61 "htslib/vcfutils.o",
62 "htslib/cram/cram_codecs.o",
63 "htslib/cram/cram_decode.o",
64 "htslib/cram/cram_encode.o",
65 "htslib/cram/cram_external.o",
66 "htslib/cram/cram_index.o",
67 "htslib/cram/cram_io.o",
68 "htslib/cram/cram_stats.o",
69 "htslib/cram/mFILE.o",
70 "htslib/cram/open_trace_file.o",
71 "htslib/cram/pooled_alloc.o",
72 "htslib/cram/string_alloc.o",
73 "htslib/htscodecs/htscodecs/arith_dynamic.o",
74 "htslib/htscodecs/htscodecs/fqzcomp_qual.o",
75 "htslib/htscodecs/htscodecs/htscodecs.o",
76 "htslib/htscodecs/htscodecs/pack.o",
77 "htslib/htscodecs/htscodecs/rANS_static4x16pr.o",
78 "htslib/htscodecs/htscodecs/rANS_static32x16pr_avx2.o",
79 "htslib/htscodecs/htscodecs/rANS_static32x16pr_avx512.o",
80 "htslib/htscodecs/htscodecs/rANS_static32x16pr_sse4.o",
81 "htslib/htscodecs/htscodecs/rANS_static32x16pr_neon.o",
82 "htslib/htscodecs/htscodecs/rANS_static32x16pr.o",
83 "htslib/htscodecs/htscodecs/rANS_static.o",
84 "htslib/htscodecs/htscodecs/rle.o",
85 "htslib/htscodecs/htscodecs/tokenise_name3.o",
86 "htslib/htscodecs/htscodecs/utils.o",
87 "htslib/hfile_libcurl.o",
88 "htslib/hfile_gcs.o",
89 "htslib/hfile_s3.o",
90 "htslib/hfile_s3_write.o"
91 ],
92 "include_dirs": [
93 "pysam",
94 "/project/pysam",
95 "/project/htslib",
96 "/project/samtools",
97 "/project/samtools/lz4",
98 "/project/bcftools",
99 "/project"
100 ],
101 "language": "c",
102 "libraries": [
103 "z",
104 "lzma",
105 "bz2",
106 "z",
107 "m",
108 "curl",
109 "crypto"
110 ],
111 "library_dirs": [
112 "/project/pysam",
113 "/project",
114 "build/lib.linux-x86_64-cpython-37/pysam"
115 ],
116 "name": "pysam.libchtslib",
117 "sources": [
118 "pysam/libchtslib.pyx",
119 "pysam/htslib_util.c"
120 ]
121 },
122 "module_name": "pysam.libchtslib"
123 }
124 END: Cython Metadata */
125
126 #ifndef PY_SSIZE_T_CLEAN
127 #define PY_SSIZE_T_CLEAN
128 #endif /* PY_SSIZE_T_CLEAN */
129 #if defined(CYTHON_LIMITED_API) && 0
130 #ifndef Py_LIMITED_API
131 #if CYTHON_LIMITED_API+0 > 0x03030000
132 #define Py_LIMITED_API CYTHON_LIMITED_API
133 #else
134 #define Py_LIMITED_API 0x03030000
135 #endif
136 #endif
137 #endif
138
139 #include "Python.h"
140
141 #if PY_MAJOR_VERSION >= 3
142 #define __Pyx_PyFloat_FromString(obj) PyFloat_FromString(obj)
143 #else
144 #define __Pyx_PyFloat_FromString(obj) PyFloat_FromString(obj, NULL)
145 #endif
146
147
148 #if PY_MAJOR_VERSION <= 2
149 #define PyDict_GetItemWithError _PyDict_GetItemWithError
150 #endif
151
152
153 #if (PY_VERSION_HEX < 0x030700b1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030600)) && !defined(PyContextVar_Get)
154 #define PyContextVar_Get(var, d, v) ((d) ? ((void)(var), Py_INCREF(d), (v)[0] = (d), 0) : ((v)[0] = NULL, 0) )
155 #endif
156
157 #ifndef Py_PYTHON_H
158 #error Python headers needed to compile C extensions, please install development version of Python.
159 #elif PY_VERSION_HEX < 0x02070000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
160 #error Cython requires Python 2.7+ or Python 3.3+.
161 #else
162 #if defined(CYTHON_LIMITED_API) && CYTHON_LIMITED_API
163 #define __PYX_EXTRA_ABI_MODULE_NAME "limited"
164 #else
165 #define __PYX_EXTRA_ABI_MODULE_NAME ""
166 #endif
167 #define CYTHON_ABI "3_0_11" __PYX_EXTRA_ABI_MODULE_NAME
168 #define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI
169 #define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "."
170 #define CYTHON_HEX_VERSION 0x03000BF0
171 #define CYTHON_FUTURE_DIVISION 1
172 #include <stddef.h>
173 #ifndef offsetof
174 #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
175 #endif
176 #if !defined(_WIN32) && !defined(WIN32) && !defined(MS_WINDOWS)
177 #ifndef __stdcall
178 #define __stdcall
179 #endif
180 #ifndef __cdecl
181 #define __cdecl
182 #endif
183 #ifndef __fastcall
184 #define __fastcall
185 #endif
186 #endif
187 #ifndef DL_IMPORT
188 #define DL_IMPORT(t) t
189 #endif
190 #ifndef DL_EXPORT
191 #define DL_EXPORT(t) t
192 #endif
193 #define __PYX_COMMA ,
194 #ifndef HAVE_LONG_LONG
195 #define HAVE_LONG_LONG
196 #endif
197 #ifndef PY_LONG_LONG
198 #define PY_LONG_LONG LONG_LONG
199 #endif
200 #ifndef Py_HUGE_VAL
201 #define Py_HUGE_VAL HUGE_VAL
202 #endif
203 #define __PYX_LIMITED_VERSION_HEX PY_VERSION_HEX
204 #if defined(GRAALVM_PYTHON)
205 /* For very preliminary testing purposes. Most variables are set the same as PyPy.
206 The existence of this section does not imply that anything works or is even tested */
207 #define CYTHON_COMPILING_IN_PYPY 0
208 #define CYTHON_COMPILING_IN_CPYTHON 0
209 #define CYTHON_COMPILING_IN_LIMITED_API 0
210 #define CYTHON_COMPILING_IN_GRAAL 1
211 #define CYTHON_COMPILING_IN_NOGIL 0
212 #undef CYTHON_USE_TYPE_SLOTS
213 #define CYTHON_USE_TYPE_SLOTS 0
214 #undef CYTHON_USE_TYPE_SPECS
215 #define CYTHON_USE_TYPE_SPECS 0
216 #undef CYTHON_USE_PYTYPE_LOOKUP
217 #define CYTHON_USE_PYTYPE_LOOKUP 0
218 #if PY_VERSION_HEX < 0x03050000
219 #undef CYTHON_USE_ASYNC_SLOTS
220 #define CYTHON_USE_ASYNC_SLOTS 0
221 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
222 #define CYTHON_USE_ASYNC_SLOTS 1
223 #endif
224 #undef CYTHON_USE_PYLIST_INTERNALS
225 #define CYTHON_USE_PYLIST_INTERNALS 0
226 #undef CYTHON_USE_UNICODE_INTERNALS
227 #define CYTHON_USE_UNICODE_INTERNALS 0
228 #undef CYTHON_USE_UNICODE_WRITER
229 #define CYTHON_USE_UNICODE_WRITER 0
230 #undef CYTHON_USE_PYLONG_INTERNALS
231 #define CYTHON_USE_PYLONG_INTERNALS 0
232 #undef CYTHON_AVOID_BORROWED_REFS
233 #define CYTHON_AVOID_BORROWED_REFS 1
234 #undef CYTHON_ASSUME_SAFE_MACROS
235 #define CYTHON_ASSUME_SAFE_MACROS 0
236 #undef CYTHON_UNPACK_METHODS
237 #define CYTHON_UNPACK_METHODS 0
238 #undef CYTHON_FAST_THREAD_STATE
239 #define CYTHON_FAST_THREAD_STATE 0
240 #undef CYTHON_FAST_GIL
241 #define CYTHON_FAST_GIL 0
242 #undef CYTHON_METH_FASTCALL
243 #define CYTHON_METH_FASTCALL 0
244 #undef CYTHON_FAST_PYCALL
245 #define CYTHON_FAST_PYCALL 0
246 #ifndef CYTHON_PEP487_INIT_SUBCLASS
247 #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3)
248 #endif
249 #undef CYTHON_PEP489_MULTI_PHASE_INIT
250 #define CYTHON_PEP489_MULTI_PHASE_INIT 1
251 #undef CYTHON_USE_MODULE_STATE
252 #define CYTHON_USE_MODULE_STATE 0
253 #undef CYTHON_USE_TP_FINALIZE
254 #define CYTHON_USE_TP_FINALIZE 0
255 #undef CYTHON_USE_DICT_VERSIONS
256 #define CYTHON_USE_DICT_VERSIONS 0
257 #undef CYTHON_USE_EXC_INFO_STACK
258 #define CYTHON_USE_EXC_INFO_STACK 0
259 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
260 #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
261 #endif
262 #undef CYTHON_USE_FREELISTS
263 #define CYTHON_USE_FREELISTS 0
264 #elif defined(PYPY_VERSION)
265 #define CYTHON_COMPILING_IN_PYPY 1
266 #define CYTHON_COMPILING_IN_CPYTHON 0
267 #define CYTHON_COMPILING_IN_LIMITED_API 0
268 #define CYTHON_COMPILING_IN_GRAAL 0
269 #define CYTHON_COMPILING_IN_NOGIL 0
270 #undef CYTHON_USE_TYPE_SLOTS
271 #define CYTHON_USE_TYPE_SLOTS 0
272 #ifndef CYTHON_USE_TYPE_SPECS
273 #define CYTHON_USE_TYPE_SPECS 0
274 #endif
275 #undef CYTHON_USE_PYTYPE_LOOKUP
276 #define CYTHON_USE_PYTYPE_LOOKUP 0
277 #if PY_VERSION_HEX < 0x03050000
278 #undef CYTHON_USE_ASYNC_SLOTS
279 #define CYTHON_USE_ASYNC_SLOTS 0
280 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
281 #define CYTHON_USE_ASYNC_SLOTS 1
282 #endif
283 #undef CYTHON_USE_PYLIST_INTERNALS
284 #define CYTHON_USE_PYLIST_INTERNALS 0
285 #undef CYTHON_USE_UNICODE_INTERNALS
286 #define CYTHON_USE_UNICODE_INTERNALS 0
287 #undef CYTHON_USE_UNICODE_WRITER
288 #define CYTHON_USE_UNICODE_WRITER 0
289 #undef CYTHON_USE_PYLONG_INTERNALS
290 #define CYTHON_USE_PYLONG_INTERNALS 0
291 #undef CYTHON_AVOID_BORROWED_REFS
292 #define CYTHON_AVOID_BORROWED_REFS 1
293 #undef CYTHON_ASSUME_SAFE_MACROS
294 #define CYTHON_ASSUME_SAFE_MACROS 0
295 #undef CYTHON_UNPACK_METHODS
296 #define CYTHON_UNPACK_METHODS 0
297 #undef CYTHON_FAST_THREAD_STATE
298 #define CYTHON_FAST_THREAD_STATE 0
299 #undef CYTHON_FAST_GIL
300 #define CYTHON_FAST_GIL 0
301 #undef CYTHON_METH_FASTCALL
302 #define CYTHON_METH_FASTCALL 0
303 #undef CYTHON_FAST_PYCALL
304 #define CYTHON_FAST_PYCALL 0
305 #ifndef CYTHON_PEP487_INIT_SUBCLASS
306 #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3)
307 #endif
308 #if PY_VERSION_HEX < 0x03090000
309 #undef CYTHON_PEP489_MULTI_PHASE_INIT
310 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
311 #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT)
312 #define CYTHON_PEP489_MULTI_PHASE_INIT 1
313 #endif
314 #undef CYTHON_USE_MODULE_STATE
315 #define CYTHON_USE_MODULE_STATE 0
316 #undef CYTHON_USE_TP_FINALIZE
317 #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1 && PYPY_VERSION_NUM >= 0x07030C00)
318 #undef CYTHON_USE_DICT_VERSIONS
319 #define CYTHON_USE_DICT_VERSIONS 0
320 #undef CYTHON_USE_EXC_INFO_STACK
321 #define CYTHON_USE_EXC_INFO_STACK 0
322 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
323 #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
324 #endif
325 #undef CYTHON_USE_FREELISTS
326 #define CYTHON_USE_FREELISTS 0
327 #elif defined(CYTHON_LIMITED_API)
328 #ifdef Py_LIMITED_API
329 #undef __PYX_LIMITED_VERSION_HEX
330 #define __PYX_LIMITED_VERSION_HEX Py_LIMITED_API
331 #endif
332 #define CYTHON_COMPILING_IN_PYPY 0
333 #define CYTHON_COMPILING_IN_CPYTHON 0
334 #define CYTHON_COMPILING_IN_LIMITED_API 1
335 #define CYTHON_COMPILING_IN_GRAAL 0
336 #define CYTHON_COMPILING_IN_NOGIL 0
337 #undef CYTHON_CLINE_IN_TRACEBACK
338 #define CYTHON_CLINE_IN_TRACEBACK 0
339 #undef CYTHON_USE_TYPE_SLOTS
340 #define CYTHON_USE_TYPE_SLOTS 0
341 #undef CYTHON_USE_TYPE_SPECS
342 #define CYTHON_USE_TYPE_SPECS 1
343 #undef CYTHON_USE_PYTYPE_LOOKUP
344 #define CYTHON_USE_PYTYPE_LOOKUP 0
345 #undef CYTHON_USE_ASYNC_SLOTS
346 #define CYTHON_USE_ASYNC_SLOTS 0
347 #undef CYTHON_USE_PYLIST_INTERNALS
348 #define CYTHON_USE_PYLIST_INTERNALS 0
349 #undef CYTHON_USE_UNICODE_INTERNALS
350 #define CYTHON_USE_UNICODE_INTERNALS 0
351 #ifndef CYTHON_USE_UNICODE_WRITER
352 #define CYTHON_USE_UNICODE_WRITER 0
353 #endif
354 #undef CYTHON_USE_PYLONG_INTERNALS
355 #define CYTHON_USE_PYLONG_INTERNALS 0
356 #ifndef CYTHON_AVOID_BORROWED_REFS
357 #define CYTHON_AVOID_BORROWED_REFS 0
358 #endif
359 #undef CYTHON_ASSUME_SAFE_MACROS
360 #define CYTHON_ASSUME_SAFE_MACROS 0
361 #undef CYTHON_UNPACK_METHODS
362 #define CYTHON_UNPACK_METHODS 0
363 #undef CYTHON_FAST_THREAD_STATE
364 #define CYTHON_FAST_THREAD_STATE 0
365 #undef CYTHON_FAST_GIL
366 #define CYTHON_FAST_GIL 0
367 #undef CYTHON_METH_FASTCALL
368 #define CYTHON_METH_FASTCALL 0
369 #undef CYTHON_FAST_PYCALL
370 #define CYTHON_FAST_PYCALL 0
371 #ifndef CYTHON_PEP487_INIT_SUBCLASS
372 #define CYTHON_PEP487_INIT_SUBCLASS 1
373 #endif
374 #undef CYTHON_PEP489_MULTI_PHASE_INIT
375 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
376 #undef CYTHON_USE_MODULE_STATE
377 #define CYTHON_USE_MODULE_STATE 1
378 #ifndef CYTHON_USE_TP_FINALIZE
379 #define CYTHON_USE_TP_FINALIZE 0
380 #endif
381 #undef CYTHON_USE_DICT_VERSIONS
382 #define CYTHON_USE_DICT_VERSIONS 0
383 #undef CYTHON_USE_EXC_INFO_STACK
384 #define CYTHON_USE_EXC_INFO_STACK 0
385 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
386 #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
387 #endif
388 #undef CYTHON_USE_FREELISTS
389 #define CYTHON_USE_FREELISTS 0
390 #elif defined(Py_GIL_DISABLED) || defined(Py_NOGIL)
391 #define CYTHON_COMPILING_IN_PYPY 0
392 #define CYTHON_COMPILING_IN_CPYTHON 0
393 #define CYTHON_COMPILING_IN_LIMITED_API 0
394 #define CYTHON_COMPILING_IN_GRAAL 0
395 #define CYTHON_COMPILING_IN_NOGIL 1
396 #ifndef CYTHON_USE_TYPE_SLOTS
397 #define CYTHON_USE_TYPE_SLOTS 1
398 #endif
399 #ifndef CYTHON_USE_TYPE_SPECS
400 #define CYTHON_USE_TYPE_SPECS 0
401 #endif
402 #undef CYTHON_USE_PYTYPE_LOOKUP
403 #define CYTHON_USE_PYTYPE_LOOKUP 0
404 #ifndef CYTHON_USE_ASYNC_SLOTS
405 #define CYTHON_USE_ASYNC_SLOTS 1
406 #endif
407 #ifndef CYTHON_USE_PYLONG_INTERNALS
408 #define CYTHON_USE_PYLONG_INTERNALS 0
409 #endif
410 #undef CYTHON_USE_PYLIST_INTERNALS
411 #define CYTHON_USE_PYLIST_INTERNALS 0
412 #ifndef CYTHON_USE_UNICODE_INTERNALS
413 #define CYTHON_USE_UNICODE_INTERNALS 1
414 #endif
415 #undef CYTHON_USE_UNICODE_WRITER
416 #define CYTHON_USE_UNICODE_WRITER 0
417 #ifndef CYTHON_AVOID_BORROWED_REFS
418 #define CYTHON_AVOID_BORROWED_REFS 0
419 #endif
420 #ifndef CYTHON_ASSUME_SAFE_MACROS
421 #define CYTHON_ASSUME_SAFE_MACROS 1
422 #endif
423 #ifndef CYTHON_UNPACK_METHODS
424 #define CYTHON_UNPACK_METHODS 1
425 #endif
426 #undef CYTHON_FAST_THREAD_STATE
427 #define CYTHON_FAST_THREAD_STATE 0
428 #undef CYTHON_FAST_GIL
429 #define CYTHON_FAST_GIL 0
430 #ifndef CYTHON_METH_FASTCALL
431 #define CYTHON_METH_FASTCALL 1
432 #endif
433 #undef CYTHON_FAST_PYCALL
434 #define CYTHON_FAST_PYCALL 0
435 #ifndef CYTHON_PEP487_INIT_SUBCLASS
436 #define CYTHON_PEP487_INIT_SUBCLASS 1
437 #endif
438 #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
439 #define CYTHON_PEP489_MULTI_PHASE_INIT 1
440 #endif
441 #ifndef CYTHON_USE_MODULE_STATE
442 #define CYTHON_USE_MODULE_STATE 0
443 #endif
444 #ifndef CYTHON_USE_TP_FINALIZE
445 #define CYTHON_USE_TP_FINALIZE 1
446 #endif
447 #undef CYTHON_USE_DICT_VERSIONS
448 #define CYTHON_USE_DICT_VERSIONS 0
449 #undef CYTHON_USE_EXC_INFO_STACK
450 #define CYTHON_USE_EXC_INFO_STACK 0
451 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
452 #define CYTHON_UPDATE_DESCRIPTOR_DOC 1
453 #endif
454 #ifndef CYTHON_USE_FREELISTS
455 #define CYTHON_USE_FREELISTS 0
456 #endif
457 #else
458 #define CYTHON_COMPILING_IN_PYPY 0
459 #define CYTHON_COMPILING_IN_CPYTHON 1
460 #define CYTHON_COMPILING_IN_LIMITED_API 0
461 #define CYTHON_COMPILING_IN_GRAAL 0
462 #define CYTHON_COMPILING_IN_NOGIL 0
463 #ifndef CYTHON_USE_TYPE_SLOTS
464 #define CYTHON_USE_TYPE_SLOTS 1
465 #endif
466 #ifndef CYTHON_USE_TYPE_SPECS
467 #define CYTHON_USE_TYPE_SPECS 0
468 #endif
469 #ifndef CYTHON_USE_PYTYPE_LOOKUP
470 #define CYTHON_USE_PYTYPE_LOOKUP 1
471 #endif
472 #if PY_MAJOR_VERSION < 3
473 #undef CYTHON_USE_ASYNC_SLOTS
474 #define CYTHON_USE_ASYNC_SLOTS 0
475 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
476 #define CYTHON_USE_ASYNC_SLOTS 1
477 #endif
478 #ifndef CYTHON_USE_PYLONG_INTERNALS
479 #define CYTHON_USE_PYLONG_INTERNALS 1
480 #endif
481 #ifndef CYTHON_USE_PYLIST_INTERNALS
482 #define CYTHON_USE_PYLIST_INTERNALS 1
483 #endif
484 #ifndef CYTHON_USE_UNICODE_INTERNALS
485 #define CYTHON_USE_UNICODE_INTERNALS 1
486 #endif
487 #if PY_VERSION_HEX < 0x030300F0 || PY_VERSION_HEX >= 0x030B00A2
488 #undef CYTHON_USE_UNICODE_WRITER
489 #define CYTHON_USE_UNICODE_WRITER 0
490 #elif !defined(CYTHON_USE_UNICODE_WRITER)
491 #define CYTHON_USE_UNICODE_WRITER 1
492 #endif
493 #ifndef CYTHON_AVOID_BORROWED_REFS
494 #define CYTHON_AVOID_BORROWED_REFS 0
495 #endif
496 #ifndef CYTHON_ASSUME_SAFE_MACROS
497 #define CYTHON_ASSUME_SAFE_MACROS 1
498 #endif
499 #ifndef CYTHON_UNPACK_METHODS
500 #define CYTHON_UNPACK_METHODS 1
501 #endif
502 #ifndef CYTHON_FAST_THREAD_STATE
503 #define CYTHON_FAST_THREAD_STATE 1
504 #endif
505 #ifndef CYTHON_FAST_GIL
506 #define CYTHON_FAST_GIL (PY_MAJOR_VERSION < 3 || PY_VERSION_HEX >= 0x03060000 && PY_VERSION_HEX < 0x030C00A6)
507 #endif
508 #ifndef CYTHON_METH_FASTCALL
509 #define CYTHON_METH_FASTCALL (PY_VERSION_HEX >= 0x030700A1)
510 #endif
511 #ifndef CYTHON_FAST_PYCALL
512 #define CYTHON_FAST_PYCALL 1
513 #endif
514 #ifndef CYTHON_PEP487_INIT_SUBCLASS
515 #define CYTHON_PEP487_INIT_SUBCLASS 1
516 #endif
517 #if PY_VERSION_HEX < 0x03050000
518 #undef CYTHON_PEP489_MULTI_PHASE_INIT
519 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
520 #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT)
521 #define CYTHON_PEP489_MULTI_PHASE_INIT 1
522 #endif
523 #ifndef CYTHON_USE_MODULE_STATE
524 #define CYTHON_USE_MODULE_STATE 0
525 #endif
526 #if PY_VERSION_HEX < 0x030400a1
527 #undef CYTHON_USE_TP_FINALIZE
528 #define CYTHON_USE_TP_FINALIZE 0
529 #elif !defined(CYTHON_USE_TP_FINALIZE)
530 #define CYTHON_USE_TP_FINALIZE 1
531 #endif
532 #if PY_VERSION_HEX < 0x030600B1
533 #undef CYTHON_USE_DICT_VERSIONS
534 #define CYTHON_USE_DICT_VERSIONS 0
535 #elif !defined(CYTHON_USE_DICT_VERSIONS)
536 #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX < 0x030C00A5)
537 #endif
538 #if PY_VERSION_HEX < 0x030700A3
539 #undef CYTHON_USE_EXC_INFO_STACK
540 #define CYTHON_USE_EXC_INFO_STACK 0
541 #elif !defined(CYTHON_USE_EXC_INFO_STACK)
542 #define CYTHON_USE_EXC_INFO_STACK 1
543 #endif
544 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
545 #define CYTHON_UPDATE_DESCRIPTOR_DOC 1
546 #endif
547 #ifndef CYTHON_USE_FREELISTS
548 #define CYTHON_USE_FREELISTS 1
549 #endif
550 #endif
551 #if !defined(CYTHON_FAST_PYCCALL)
552 #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
553 #endif
554 #if !defined(CYTHON_VECTORCALL)
555 #define CYTHON_VECTORCALL (CYTHON_FAST_PYCCALL && PY_VERSION_HEX >= 0x030800B1)
556 #endif
557 #define CYTHON_BACKPORT_VECTORCALL (CYTHON_METH_FASTCALL && PY_VERSION_HEX < 0x030800B1)
558 #if CYTHON_USE_PYLONG_INTERNALS
559 #if PY_MAJOR_VERSION < 3
560 #include "longintrepr.h"
561 #endif
562 #undef SHIFT
563 #undef BASE
564 #undef MASK
565 #ifdef SIZEOF_VOID_P
566 enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
567 #endif
568 #endif
569 #ifndef __has_attribute
570 #define __has_attribute(x) 0
571 #endif
572 #ifndef __has_cpp_attribute
573 #define __has_cpp_attribute(x) 0
574 #endif
575 #ifndef CYTHON_RESTRICT
576 #if defined(__GNUC__)
577 #define CYTHON_RESTRICT __restrict__
578 #elif defined(_MSC_VER) && _MSC_VER >= 1400
579 #define CYTHON_RESTRICT __restrict
580 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
581 #define CYTHON_RESTRICT restrict
582 #else
583 #define CYTHON_RESTRICT
584 #endif
585 #endif
586 #ifndef CYTHON_UNUSED
587 #if defined(__cplusplus)
588 /* for clang __has_cpp_attribute(maybe_unused) is true even before C++17
589 * but leads to warnings with -pedantic, since it is a C++17 feature */
590 #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
591 #if __has_cpp_attribute(maybe_unused)
592 #define CYTHON_UNUSED [[maybe_unused]]
593 #endif
594 #endif
595 #endif
596 #endif
597 #ifndef CYTHON_UNUSED
598 # if defined(__GNUC__)
599 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
600 # define CYTHON_UNUSED __attribute__ ((__unused__))
601 # else
602 # define CYTHON_UNUSED
603 # endif
604 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
605 # define CYTHON_UNUSED __attribute__ ((__unused__))
606 # else
607 # define CYTHON_UNUSED
608 # endif
609 #endif
610 #ifndef CYTHON_UNUSED_VAR
611 # if defined(__cplusplus)
612 template<class T> void CYTHON_UNUSED_VAR( const T& ) { }
613 # else
614 # define CYTHON_UNUSED_VAR(x) (void)(x)
615 # endif
616 #endif
617 #ifndef CYTHON_MAYBE_UNUSED_VAR
618 #define CYTHON_MAYBE_UNUSED_VAR(x) CYTHON_UNUSED_VAR(x)
619 #endif
620 #ifndef CYTHON_NCP_UNUSED
621 # if CYTHON_COMPILING_IN_CPYTHON
622 # define CYTHON_NCP_UNUSED
623 # else
624 # define CYTHON_NCP_UNUSED CYTHON_UNUSED
625 # endif
626 #endif
627 #ifndef CYTHON_USE_CPP_STD_MOVE
628 #if defined(__cplusplus) && (\
629 __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600))
630 #define CYTHON_USE_CPP_STD_MOVE 1
631 #else
632 #define CYTHON_USE_CPP_STD_MOVE 0
633 #endif
634 #endif
635 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
636 #ifdef _MSC_VER
637 #ifndef _MSC_STDINT_H_
638 #if _MSC_VER < 1300
639 typedef unsigned char uint8_t;
640 typedef unsigned short uint16_t;
641 typedef unsigned int uint32_t;
642 #else
643 typedef unsigned __int8 uint8_t;
644 typedef unsigned __int16 uint16_t;
645 typedef unsigned __int32 uint32_t;
646 #endif
647 #endif
648 #if _MSC_VER < 1300
649 #ifdef _WIN64
650 typedef unsigned long long __pyx_uintptr_t;
651 #else
652 typedef unsigned int __pyx_uintptr_t;
653 #endif
654 #else
655 #ifdef _WIN64
656 typedef unsigned __int64 __pyx_uintptr_t;
657 #else
658 typedef unsigned __int32 __pyx_uintptr_t;
659 #endif
660 #endif
661 #else
662 #include <stdint.h>
663 typedef uintptr_t __pyx_uintptr_t;
664 #endif
665 #ifndef CYTHON_FALLTHROUGH
666 #if defined(__cplusplus)
667 /* for clang __has_cpp_attribute(fallthrough) is true even before C++17
668 * but leads to warnings with -pedantic, since it is a C++17 feature */
669 #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
670 #if __has_cpp_attribute(fallthrough)
671 #define CYTHON_FALLTHROUGH [[fallthrough]]
672 #endif
673 #endif
674 #ifndef CYTHON_FALLTHROUGH
675 #if __has_cpp_attribute(clang::fallthrough)
676 #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
677 #elif __has_cpp_attribute(gnu::fallthrough)
678 #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
679 #endif
680 #endif
681 #endif
682 #ifndef CYTHON_FALLTHROUGH
683 #if __has_attribute(fallthrough)
684 #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
685 #else
686 #define CYTHON_FALLTHROUGH
687 #endif
688 #endif
689 #if defined(__clang__) && defined(__apple_build_version__)
690 #if __apple_build_version__ < 7000000
691 #undef CYTHON_FALLTHROUGH
692 #define CYTHON_FALLTHROUGH
693 #endif
694 #endif
695 #endif
696 #ifdef __cplusplus
697 template <typename T>
698 struct __PYX_IS_UNSIGNED_IMPL {static const bool value = T(0) < T(-1);};
699 #define __PYX_IS_UNSIGNED(type) (__PYX_IS_UNSIGNED_IMPL<type>::value)
700 #else
701 #define __PYX_IS_UNSIGNED(type) (((type)-1) > 0)
702 #endif
703 #if CYTHON_COMPILING_IN_PYPY == 1
704 #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x030A0000)
705 #else
706 #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000)
707 #endif
708 #define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer))
709
710 #ifndef CYTHON_INLINE
711 #if defined(__clang__)
712 #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
713 #elif defined(__GNUC__)
714 #define CYTHON_INLINE __inline__
715 #elif defined(_MSC_VER)
716 #define CYTHON_INLINE __inline
717 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
718 #define CYTHON_INLINE inline
719 #else
720 #define CYTHON_INLINE
721 #endif
722 #endif
723
724 #define __PYX_BUILD_PY_SSIZE_T "n"
725 #define CYTHON_FORMAT_SSIZE_T "z"
726 #if PY_MAJOR_VERSION < 3
727 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
728 #define __Pyx_DefaultClassType PyClass_Type
729 #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
730 PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
731 #else
732 #define __Pyx_BUILTIN_MODULE_NAME "builtins"
733 #define __Pyx_DefaultClassType PyType_Type
734 #if CYTHON_COMPILING_IN_LIMITED_API
735 static CYTHON_INLINE PyObject* __Pyx_PyCode_New(int a, int p, int k, int l, int s, int f,
736 PyObject *code, PyObject *c, PyObject* n, PyObject *v,
737 PyObject *fv, PyObject *cell, PyObject* fn,
738 PyObject *name, int fline, PyObject *lnos) {
739 PyObject *exception_table = NULL;
740 PyObject *types_module=NULL, *code_type=NULL, *result=NULL;
741 #if __PYX_LIMITED_VERSION_HEX < 0x030B0000
742 PyObject *version_info;
743 PyObject *py_minor_version = NULL;
744 #endif
745 long minor_version = 0;
746 PyObject *type, *value, *traceback;
747 PyErr_Fetch(&type, &value, &traceback);
748 #if __PYX_LIMITED_VERSION_HEX >= 0x030B0000
749 minor_version = 11;
750 #else
751 if (!(version_info = PySys_GetObject("version_info"))) goto end;
752 if (!(py_minor_version = PySequence_GetItem(version_info, 1))) goto end;
753 minor_version = PyLong_AsLong(py_minor_version);
754 Py_DECREF(py_minor_version);
755 if (minor_version == -1 && PyErr_Occurred()) goto end;
756 #endif
757 if (!(types_module = PyImport_ImportModule("types"))) goto end;
758 if (!(code_type = PyObject_GetAttrString(types_module, "CodeType"))) goto end;
759 if (minor_version <= 7) {
760 (void)p;
761 result = PyObject_CallFunction(code_type, "iiiiiOOOOOOiOO", a, k, l, s, f, code,
762 c, n, v, fn, name, fline, lnos, fv, cell);
763 } else if (minor_version <= 10) {
764 result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOiOO", a,p, k, l, s, f, code,
765 c, n, v, fn, name, fline, lnos, fv, cell);
766 } else {
767 if (!(exception_table = PyBytes_FromStringAndSize(NULL, 0))) goto end;
768 result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOOiOO", a,p, k, l, s, f, code,
769 c, n, v, fn, name, name, fline, lnos, exception_table, fv, cell);
770 }
771 end:
772 Py_XDECREF(code_type);
773 Py_XDECREF(exception_table);
774 Py_XDECREF(types_module);
775 if (type) {
776 PyErr_Restore(type, value, traceback);
777 }
778 return result;
779 }
780 #ifndef CO_OPTIMIZED
781 #define CO_OPTIMIZED 0x0001
782 #endif
783 #ifndef CO_NEWLOCALS
784 #define CO_NEWLOCALS 0x0002
785 #endif
786 #ifndef CO_VARARGS
787 #define CO_VARARGS 0x0004
788 #endif
789 #ifndef CO_VARKEYWORDS
790 #define CO_VARKEYWORDS 0x0008
791 #endif
792 #ifndef CO_ASYNC_GENERATOR
793 #define CO_ASYNC_GENERATOR 0x0200
794 #endif
795 #ifndef CO_GENERATOR
796 #define CO_GENERATOR 0x0020
797 #endif
798 #ifndef CO_COROUTINE
799 #define CO_COROUTINE 0x0080
800 #endif
801 #elif PY_VERSION_HEX >= 0x030B0000
802 static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int p, int k, int l, int s, int f,
803 PyObject *code, PyObject *c, PyObject* n, PyObject *v,
804 PyObject *fv, PyObject *cell, PyObject* fn,
805 PyObject *name, int fline, PyObject *lnos) {
806 PyCodeObject *result;
807 PyObject *empty_bytes = PyBytes_FromStringAndSize("", 0);
808 if (!empty_bytes) return NULL;
809 result =
810 #if PY_VERSION_HEX >= 0x030C0000
811 PyUnstable_Code_NewWithPosOnlyArgs
812 #else
813 PyCode_NewWithPosOnlyArgs
814 #endif
815 (a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, name, fline, lnos, empty_bytes);
816 Py_DECREF(empty_bytes);
817 return result;
818 }
819 #elif PY_VERSION_HEX >= 0x030800B2 && !CYTHON_COMPILING_IN_PYPY
820 #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
821 PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
822 #else
823 #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
824 PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
825 #endif
826 #endif
827 #if PY_VERSION_HEX >= 0x030900A4 || defined(Py_IS_TYPE)
828 #define __Pyx_IS_TYPE(ob, type) Py_IS_TYPE(ob, type)
829 #else
830 #define __Pyx_IS_TYPE(ob, type) (((const PyObject*)ob)->ob_type == (type))
831 #endif
832 #if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_Is)
833 #define __Pyx_Py_Is(x, y) Py_Is(x, y)
834 #else
835 #define __Pyx_Py_Is(x, y) ((x) == (y))
836 #endif
837 #if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsNone)
838 #define __Pyx_Py_IsNone(ob) Py_IsNone(ob)
839 #else
840 #define __Pyx_Py_IsNone(ob) __Pyx_Py_Is((ob), Py_None)
841 #endif
842 #if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsTrue)
843 #define __Pyx_Py_IsTrue(ob) Py_IsTrue(ob)
844 #else
845 #define __Pyx_Py_IsTrue(ob) __Pyx_Py_Is((ob), Py_True)
846 #endif
847 #if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsFalse)
848 #define __Pyx_Py_IsFalse(ob) Py_IsFalse(ob)
849 #else
850 #define __Pyx_Py_IsFalse(ob) __Pyx_Py_Is((ob), Py_False)
851 #endif
852 #define __Pyx_NoneAsNull(obj) (__Pyx_Py_IsNone(obj) ? NULL : (obj))
853 #if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY
854 #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o)
855 #else
856 #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o)
857 #endif
858 #ifndef CO_COROUTINE
859 #define CO_COROUTINE 0x80
860 #endif
861 #ifndef CO_ASYNC_GENERATOR
862 #define CO_ASYNC_GENERATOR 0x200
863 #endif
864 #ifndef Py_TPFLAGS_CHECKTYPES
865 #define Py_TPFLAGS_CHECKTYPES 0
866 #endif
867 #ifndef Py_TPFLAGS_HAVE_INDEX
868 #define Py_TPFLAGS_HAVE_INDEX 0
869 #endif
870 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
871 #define Py_TPFLAGS_HAVE_NEWBUFFER 0
872 #endif
873 #ifndef Py_TPFLAGS_HAVE_FINALIZE
874 #define Py_TPFLAGS_HAVE_FINALIZE 0
875 #endif
876 #ifndef Py_TPFLAGS_SEQUENCE
877 #define Py_TPFLAGS_SEQUENCE 0
878 #endif
879 #ifndef Py_TPFLAGS_MAPPING
880 #define Py_TPFLAGS_MAPPING 0
881 #endif
882 #ifndef METH_STACKLESS
883 #define METH_STACKLESS 0
884 #endif
885 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
886 #ifndef METH_FASTCALL
887 #define METH_FASTCALL 0x80
888 #endif
889 typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
890 typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
891 Py_ssize_t nargs, PyObject *kwnames);
892 #else
893 #if PY_VERSION_HEX >= 0x030d00A4
894 # define __Pyx_PyCFunctionFast PyCFunctionFast
895 # define __Pyx_PyCFunctionFastWithKeywords PyCFunctionFastWithKeywords
896 #else
897 # define __Pyx_PyCFunctionFast _PyCFunctionFast
898 # define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
899 #endif
900 #endif
901 #if CYTHON_METH_FASTCALL
902 #define __Pyx_METH_FASTCALL METH_FASTCALL
903 #define __Pyx_PyCFunction_FastCall __Pyx_PyCFunctionFast
904 #define __Pyx_PyCFunction_FastCallWithKeywords __Pyx_PyCFunctionFastWithKeywords
905 #else
906 #define __Pyx_METH_FASTCALL METH_VARARGS
907 #define __Pyx_PyCFunction_FastCall PyCFunction
908 #define __Pyx_PyCFunction_FastCallWithKeywords PyCFunctionWithKeywords
909 #endif
910 #if CYTHON_VECTORCALL
911 #define __pyx_vectorcallfunc vectorcallfunc
912 #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET PY_VECTORCALL_ARGUMENTS_OFFSET
913 #define __Pyx_PyVectorcall_NARGS(n) PyVectorcall_NARGS((size_t)(n))
914 #elif CYTHON_BACKPORT_VECTORCALL
915 typedef PyObject *(*__pyx_vectorcallfunc)(PyObject *callable, PyObject *const *args,
916 size_t nargsf, PyObject *kwnames);
917 #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET ((size_t)1 << (8 * sizeof(size_t) - 1))
918 #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(((size_t)(n)) & ~__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET))
919 #else
920 #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET 0
921 #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(n))
922 #endif
923 #if PY_MAJOR_VERSION >= 0x030900B1
924 #define __Pyx_PyCFunction_CheckExact(func) PyCFunction_CheckExact(func)
925 #else
926 #define __Pyx_PyCFunction_CheckExact(func) PyCFunction_Check(func)
927 #endif
928 #define __Pyx_CyOrPyCFunction_Check(func) PyCFunction_Check(func)
929 #if CYTHON_COMPILING_IN_CPYTHON
930 #define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) (((PyCFunctionObject*)(func))->m_ml->ml_meth)
931 #elif !CYTHON_COMPILING_IN_LIMITED_API
932 #define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) PyCFunction_GET_FUNCTION(func)
933 #endif
934 #if CYTHON_COMPILING_IN_CPYTHON
935 #define __Pyx_CyOrPyCFunction_GET_FLAGS(func) (((PyCFunctionObject*)(func))->m_ml->ml_flags)
936 static CYTHON_INLINE PyObject* __Pyx_CyOrPyCFunction_GET_SELF(PyObject *func) {
937 return (__Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_STATIC) ? NULL : ((PyCFunctionObject*)func)->m_self;
938 }
939 #endif
940 static CYTHON_INLINE int __Pyx__IsSameCFunction(PyObject *func, void *cfunc) {
941 #if CYTHON_COMPILING_IN_LIMITED_API
942 return PyCFunction_Check(func) && PyCFunction_GetFunction(func) == (PyCFunction) cfunc;
943 #else
944 return PyCFunction_Check(func) && PyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc;
945 #endif
946 }
947 #define __Pyx_IsSameCFunction(func, cfunc) __Pyx__IsSameCFunction(func, cfunc)
948 #if __PYX_LIMITED_VERSION_HEX < 0x030900B1
949 #define __Pyx_PyType_FromModuleAndSpec(m, s, b) ((void)m, PyType_FromSpecWithBases(s, b))
950 typedef PyObject *(*__Pyx_PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *, size_t, PyObject *);
951 #else
952 #define __Pyx_PyType_FromModuleAndSpec(m, s, b) PyType_FromModuleAndSpec(m, s, b)
953 #define __Pyx_PyCMethod PyCMethod
954 #endif
955 #ifndef METH_METHOD
956 #define METH_METHOD 0x200
957 #endif
958 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
959 #define PyObject_Malloc(s) PyMem_Malloc(s)
960 #define PyObject_Free(p) PyMem_Free(p)
961 #define PyObject_Realloc(p) PyMem_Realloc(p)
962 #endif
963 #if CYTHON_COMPILING_IN_LIMITED_API
964 #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
965 #define __Pyx_PyFrame_SetLineNumber(frame, lineno)
966 #else
967 #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
968 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
969 #endif
970 #if CYTHON_COMPILING_IN_LIMITED_API
971 #define __Pyx_PyThreadState_Current PyThreadState_Get()
972 #elif !CYTHON_FAST_THREAD_STATE
973 #define __Pyx_PyThreadState_Current PyThreadState_GET()
974 #elif PY_VERSION_HEX >= 0x030d00A1
975 #define __Pyx_PyThreadState_Current PyThreadState_GetUnchecked()
976 #elif PY_VERSION_HEX >= 0x03060000
977 #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
978 #elif PY_VERSION_HEX >= 0x03000000
979 #define __Pyx_PyThreadState_Current PyThreadState_GET()
980 #else
981 #define __Pyx_PyThreadState_Current _PyThreadState_Current
982 #endif
983 #if CYTHON_COMPILING_IN_LIMITED_API
984 static CYTHON_INLINE void *__Pyx_PyModule_GetState(PyObject *op)
985 {
986 void *result;
987 result = PyModule_GetState(op);
988 if (!result)
989 Py_FatalError("Couldn't find the module state");
990 return result;
991 }
992 #endif
993 #define __Pyx_PyObject_GetSlot(obj, name, func_ctype) __Pyx_PyType_GetSlot(Py_TYPE(obj), name, func_ctype)
994 #if CYTHON_COMPILING_IN_LIMITED_API
995 #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((func_ctype) PyType_GetSlot((type), Py_##name))
996 #else
997 #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((type)->name)
998 #endif
999 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
1000 #include "pythread.h"
1001 #define Py_tss_NEEDS_INIT 0
1002 typedef int Py_tss_t;
1003 static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
1004 *key = PyThread_create_key();
1005 return 0;
1006 }
1007 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
1008 Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
1009 *key = Py_tss_NEEDS_INIT;
1010 return key;
1011 }
1012 static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
1013 PyObject_Free(key);
1014 }
1015 static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
1016 return *key != Py_tss_NEEDS_INIT;
1017 }
1018 static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
1019 PyThread_delete_key(*key);
1020 *key = Py_tss_NEEDS_INIT;
1021 }
1022 static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
1023 return PyThread_set_key_value(*key, value);
1024 }
1025 static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
1026 return PyThread_get_key_value(*key);
1027 }
1028 #endif
1029 #if PY_MAJOR_VERSION < 3
1030 #if CYTHON_COMPILING_IN_PYPY
1031 #if PYPY_VERSION_NUM < 0x07030600
1032 #if defined(__cplusplus) && __cplusplus >= 201402L
1033 [[deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")]]
1034 #elif defined(__GNUC__) || defined(__clang__)
1035 __attribute__ ((__deprecated__("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")))
1036 #elif defined(_MSC_VER)
1037 __declspec(deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6"))
1038 #endif
1039 static CYTHON_INLINE int PyGILState_Check(void) {
1040 return 0;
1041 }
1042 #else // PYPY_VERSION_NUM < 0x07030600
1043 #endif // PYPY_VERSION_NUM < 0x07030600
1044 #else
1045 static CYTHON_INLINE int PyGILState_Check(void) {
1046 PyThreadState * tstate = _PyThreadState_Current;
1047 return tstate && (tstate == PyGILState_GetThisThreadState());
1048 }
1049 #endif
1050 #endif
1051 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000 || defined(_PyDict_NewPresized)
1052 #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
1053 #else
1054 #define __Pyx_PyDict_NewPresized(n) PyDict_New()
1055 #endif
1056 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
1057 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
1058 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
1059 #else
1060 #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
1061 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
1062 #endif
1063 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX > 0x030600B4 && PY_VERSION_HEX < 0x030d0000 && CYTHON_USE_UNICODE_INTERNALS
1064 #define __Pyx_PyDict_GetItemStrWithError(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
1065 static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStr(PyObject *dict, PyObject *name) {
1066 PyObject *res = __Pyx_PyDict_GetItemStrWithError(dict, name);
1067 if (res == NULL) PyErr_Clear();
1068 return res;
1069 }
1070 #elif PY_MAJOR_VERSION >= 3 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000)
1071 #define __Pyx_PyDict_GetItemStrWithError PyDict_GetItemWithError
1072 #define __Pyx_PyDict_GetItemStr PyDict_GetItem
1073 #else
1074 static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, PyObject *name) {
1075 #if CYTHON_COMPILING_IN_PYPY
1076 return PyDict_GetItem(dict, name);
1077 #else
1078 PyDictEntry *ep;
1079 PyDictObject *mp = (PyDictObject*) dict;
1080 long hash = ((PyStringObject *) name)->ob_shash;
1081 assert(hash != -1);
1082 ep = (mp->ma_lookup)(mp, name, hash);
1083 if (ep == NULL) {
1084 return NULL;
1085 }
1086 return ep->me_value;
1087 #endif
1088 }
1089 #define __Pyx_PyDict_GetItemStr PyDict_GetItem
1090 #endif
1091 #if CYTHON_USE_TYPE_SLOTS
1092 #define __Pyx_PyType_GetFlags(tp) (((PyTypeObject *)tp)->tp_flags)
1093 #define __Pyx_PyType_HasFeature(type, feature) ((__Pyx_PyType_GetFlags(type) & (feature)) != 0)
1094 #define __Pyx_PyObject_GetIterNextFunc(obj) (Py_TYPE(obj)->tp_iternext)
1095 #else
1096 #define __Pyx_PyType_GetFlags(tp) (PyType_GetFlags((PyTypeObject *)tp))
1097 #define __Pyx_PyType_HasFeature(type, feature) PyType_HasFeature(type, feature)
1098 #define __Pyx_PyObject_GetIterNextFunc(obj) PyIter_Next
1099 #endif
1100 #if CYTHON_COMPILING_IN_LIMITED_API
1101 #define __Pyx_SetItemOnTypeDict(tp, k, v) PyObject_GenericSetAttr((PyObject*)tp, k, v)
1102 #else
1103 #define __Pyx_SetItemOnTypeDict(tp, k, v) PyDict_SetItem(tp->tp_dict, k, v)
1104 #endif
1105 #if CYTHON_USE_TYPE_SPECS && PY_VERSION_HEX >= 0x03080000
1106 #define __Pyx_PyHeapTypeObject_GC_Del(obj) {\
1107 PyTypeObject *type = Py_TYPE((PyObject*)obj);\
1108 assert(__Pyx_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE));\
1109 PyObject_GC_Del(obj);\
1110 Py_DECREF(type);\
1111 }
1112 #else
1113 #define __Pyx_PyHeapTypeObject_GC_Del(obj) PyObject_GC_Del(obj)
1114 #endif
1115 #if CYTHON_COMPILING_IN_LIMITED_API
1116 #define CYTHON_PEP393_ENABLED 1
1117 #define __Pyx_PyUnicode_READY(op) (0)
1118 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GetLength(u)
1119 #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_ReadChar(u, i)
1120 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((void)u, 1114111U)
1121 #define __Pyx_PyUnicode_KIND(u) ((void)u, (0))
1122 #define __Pyx_PyUnicode_DATA(u) ((void*)u)
1123 #define __Pyx_PyUnicode_READ(k, d, i) ((void)k, PyUnicode_ReadChar((PyObject*)(d), i))
1124 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GetLength(u))
1125 #elif PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
1126 #define CYTHON_PEP393_ENABLED 1
1127 #if PY_VERSION_HEX >= 0x030C0000
1128 #define __Pyx_PyUnicode_READY(op) (0)
1129 #else
1130 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
1131 0 : _PyUnicode_Ready((PyObject *)(op)))
1132 #endif
1133 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
1134 #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
1135 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
1136 #define __Pyx_PyUnicode_KIND(u) ((int)PyUnicode_KIND(u))
1137 #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
1138 #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
1139 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, (Py_UCS4) ch)
1140 #if PY_VERSION_HEX >= 0x030C0000
1141 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u))
1142 #else
1143 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000
1144 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length))
1145 #else
1146 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
1147 #endif
1148 #endif
1149 #else
1150 #define CYTHON_PEP393_ENABLED 0
1151 #define PyUnicode_1BYTE_KIND 1
1152 #define PyUnicode_2BYTE_KIND 2
1153 #define PyUnicode_4BYTE_KIND 4
1154 #define __Pyx_PyUnicode_READY(op) (0)
1155 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
1156 #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
1157 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535U : 1114111U)
1158 #define __Pyx_PyUnicode_KIND(u) ((int)sizeof(Py_UNICODE))
1159 #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
1160 #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
1161 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = (Py_UNICODE) ch)
1162 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
1163 #endif
1164 #if CYTHON_COMPILING_IN_PYPY
1165 #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
1166 #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
1167 #else
1168 #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
1169 #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
1170 PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
1171 #endif
1172 #if CYTHON_COMPILING_IN_PYPY
1173 #if !defined(PyUnicode_DecodeUnicodeEscape)
1174 #define PyUnicode_DecodeUnicodeEscape(s, size, errors) PyUnicode_Decode(s, size, "unicode_escape", errors)
1175 #endif
1176 #if !defined(PyUnicode_Contains) || (PY_MAJOR_VERSION == 2 && PYPY_VERSION_NUM < 0x07030500)
1177 #undef PyUnicode_Contains
1178 #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
1179 #endif
1180 #if !defined(PyByteArray_Check)
1181 #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
1182 #endif
1183 #if !defined(PyObject_Format)
1184 #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
1185 #endif
1186 #endif
1187 #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))
1188 #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
1189 #if PY_MAJOR_VERSION >= 3
1190 #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
1191 #else
1192 #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
1193 #endif
1194 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
1195 #define PyObject_ASCII(o) PyObject_Repr(o)
1196 #endif
1197 #if PY_MAJOR_VERSION >= 3
1198 #define PyBaseString_Type PyUnicode_Type
1199 #define PyStringObject PyUnicodeObject
1200 #define PyString_Type PyUnicode_Type
1201 #define PyString_Check PyUnicode_Check
1202 #define PyString_CheckExact PyUnicode_CheckExact
1203 #ifndef PyObject_Unicode
1204 #define PyObject_Unicode PyObject_Str
1205 #endif
1206 #endif
1207 #if PY_MAJOR_VERSION >= 3
1208 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
1209 #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
1210 #else
1211 #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
1212 #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
1213 #endif
1214 #if CYTHON_COMPILING_IN_CPYTHON
1215 #define __Pyx_PySequence_ListKeepNew(obj)\
1216 (likely(PyList_CheckExact(obj) && Py_REFCNT(obj) == 1) ? __Pyx_NewRef(obj) : PySequence_List(obj))
1217 #else
1218 #define __Pyx_PySequence_ListKeepNew(obj) PySequence_List(obj)
1219 #endif
1220 #ifndef PySet_CheckExact
1221 #define PySet_CheckExact(obj) __Pyx_IS_TYPE(obj, &PySet_Type)
1222 #endif
1223 #if PY_VERSION_HEX >= 0x030900A4
1224 #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
1225 #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
1226 #else
1227 #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
1228 #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
1229 #endif
1230 #if CYTHON_ASSUME_SAFE_MACROS
1231 #define __Pyx_PySequence_ITEM(o, i) PySequence_ITEM(o, i)
1232 #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
1233 #define __Pyx_PyTuple_SET_ITEM(o, i, v) (PyTuple_SET_ITEM(o, i, v), (0))
1234 #define __Pyx_PyList_SET_ITEM(o, i, v) (PyList_SET_ITEM(o, i, v), (0))
1235 #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_GET_SIZE(o)
1236 #define __Pyx_PyList_GET_SIZE(o) PyList_GET_SIZE(o)
1237 #define __Pyx_PySet_GET_SIZE(o) PySet_GET_SIZE(o)
1238 #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_GET_SIZE(o)
1239 #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_GET_SIZE(o)
1240 #else
1241 #define __Pyx_PySequence_ITEM(o, i) PySequence_GetItem(o, i)
1242 #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
1243 #define __Pyx_PyTuple_SET_ITEM(o, i, v) PyTuple_SetItem(o, i, v)
1244 #define __Pyx_PyList_SET_ITEM(o, i, v) PyList_SetItem(o, i, v)
1245 #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_Size(o)
1246 #define __Pyx_PyList_GET_SIZE(o) PyList_Size(o)
1247 #define __Pyx_PySet_GET_SIZE(o) PySet_Size(o)
1248 #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_Size(o)
1249 #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_Size(o)
1250 #endif
1251 #if __PYX_LIMITED_VERSION_HEX >= 0x030d00A1
1252 #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name)
1253 #else
1254 static CYTHON_INLINE PyObject *__Pyx_PyImport_AddModuleRef(const char *name) {
1255 PyObject *module = PyImport_AddModule(name);
1256 Py_XINCREF(module);
1257 return module;
1258 }
1259 #endif
1260 #if PY_MAJOR_VERSION >= 3
1261 #define PyIntObject PyLongObject
1262 #define PyInt_Type PyLong_Type
1263 #define PyInt_Check(op) PyLong_Check(op)
1264 #define PyInt_CheckExact(op) PyLong_CheckExact(op)
1265 #define __Pyx_Py3Int_Check(op) PyLong_Check(op)
1266 #define __Pyx_Py3Int_CheckExact(op) PyLong_CheckExact(op)
1267 #define PyInt_FromString PyLong_FromString
1268 #define PyInt_FromUnicode PyLong_FromUnicode
1269 #define PyInt_FromLong PyLong_FromLong
1270 #define PyInt_FromSize_t PyLong_FromSize_t
1271 #define PyInt_FromSsize_t PyLong_FromSsize_t
1272 #define PyInt_AsLong PyLong_AsLong
1273 #define PyInt_AS_LONG PyLong_AS_LONG
1274 #define PyInt_AsSsize_t PyLong_AsSsize_t
1275 #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
1276 #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
1277 #define PyNumber_Int PyNumber_Long
1278 #else
1279 #define __Pyx_Py3Int_Check(op) (PyLong_Check(op) || PyInt_Check(op))
1280 #define __Pyx_Py3Int_CheckExact(op) (PyLong_CheckExact(op) || PyInt_CheckExact(op))
1281 #endif
1282 #if PY_MAJOR_VERSION >= 3
1283 #define PyBoolObject PyLongObject
1284 #endif
1285 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
1286 #ifndef PyUnicode_InternFromString
1287 #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
1288 #endif
1289 #endif
1290 #if PY_VERSION_HEX < 0x030200A4
1291 typedef long Py_hash_t;
1292 #define __Pyx_PyInt_FromHash_t PyInt_FromLong
1293 #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsHash_t
1294 #else
1295 #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
1296 #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t
1297 #endif
1298 #if CYTHON_USE_ASYNC_SLOTS
1299 #if PY_VERSION_HEX >= 0x030500B1
1300 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
1301 #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
1302 #else
1303 #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
1304 #endif
1305 #else
1306 #define __Pyx_PyType_AsAsync(obj) NULL
1307 #endif
1308 #ifndef __Pyx_PyAsyncMethodsStruct
1309 typedef struct {
1310 unaryfunc am_await;
1311 unaryfunc am_aiter;
1312 unaryfunc am_anext;
1313 } __Pyx_PyAsyncMethodsStruct;
1314 #endif
1315
1316 #if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)
1317 #if !defined(_USE_MATH_DEFINES)
1318 #define _USE_MATH_DEFINES
1319 #endif
1320 #endif
1321 #include <math.h>
1322 #ifdef NAN
1323 #define __PYX_NAN() ((float) NAN)
1324 #else
1325 static CYTHON_INLINE float __PYX_NAN() {
1326 float value;
1327 memset(&value, 0xFF, sizeof(value));
1328 return value;
1329 }
1330 #endif
1331 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
1332 #define __Pyx_truncl trunc
1333 #else
1334 #define __Pyx_truncl truncl
1335 #endif
1336
1337 #define __PYX_MARK_ERR_POS(f_index, lineno) \
1338 { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
1339 #define __PYX_ERR(f_index, lineno, Ln_error) \
1340 { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }
1341
1342 #ifdef CYTHON_EXTERN_C
1343 #undef __PYX_EXTERN_C
1344 #define __PYX_EXTERN_C CYTHON_EXTERN_C
1345 #elif defined(__PYX_EXTERN_C)
1346 #ifdef _MSC_VER
1347 #pragma message ("Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.")
1348 #else
1349 #warning Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.
1350 #endif
1351 #else
1352 #ifdef __cplusplus
1353 #define __PYX_EXTERN_C extern "C"
1354 #else
1355 #define __PYX_EXTERN_C extern
1356 #endif
1357 #endif
1358
1359 #define __PYX_HAVE__pysam__libchtslib
1360 #define __PYX_HAVE_API__pysam__libchtslib
1361 /* Early includes */
1362 #include <stdint.h>
1363 #include <string.h>
1364 #include <stdlib.h>
1365 #include <stdio.h>
1366 #include <sys/types.h>
1367 #include "stdarg.h"
1368 #include "htslib/kstring.h"
1369 #include "htslib_util.h"
1370 #include "htslib/hfile.h"
1371 #include "htslib/bgzf.h"
1372 #include "htslib/hts.h"
1373 #include "htslib/sam.h"
1374 #include "htslib/faidx.h"
1375 #include "htslib/tbx.h"
1376 #include "htslib/vcf.h"
1377 #include "htslib/vcfutils.h"
1378 #include "htslib/cram.h"
1379 #include <unistd.h>
1380 #include <errno.h>
1381 #include <stddef.h>
1382 #include "pythread.h"
1383
1384 #if CYTHON_COMPILING_IN_PYPY
1385 #ifdef _MSC_VER
1386 #pragma message ("This module uses CPython specific internals of 'array.array', which are not available in PyPy.")
1387 #else
1388 #warning This module uses CPython specific internals of 'array.array', which are not available in PyPy.
1389 #endif
1390 #endif
1391
1392 #ifdef _OPENMP
1393 #include <omp.h>
1394 #endif /* _OPENMP */
1395
1396 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
1397 #define CYTHON_WITHOUT_ASSERTIONS
1398 #endif
1399
1400 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
1401 const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
1402
1403 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
1404 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
1405 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
1406 #define __PYX_DEFAULT_STRING_ENCODING ""
1407 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
1408 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
1409 #define __Pyx_uchar_cast(c) ((unsigned char)c)
1410 #define __Pyx_long_cast(x) ((long)x)
1411 #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
1412 (sizeof(type) < sizeof(Py_ssize_t)) ||\
1413 (sizeof(type) > sizeof(Py_ssize_t) &&\
1414 likely(v < (type)PY_SSIZE_T_MAX ||\
1415 v == (type)PY_SSIZE_T_MAX) &&\
1416 (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
1417 v == (type)PY_SSIZE_T_MIN))) ||\
1418 (sizeof(type) == sizeof(Py_ssize_t) &&\
1419 (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
1420 v == (type)PY_SSIZE_T_MAX))) )
1421 static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
1422 return (size_t) i < (size_t) limit;
1423 }
1424 #if defined (__cplusplus) && __cplusplus >= 201103L
1425 #include <cstdlib>
1426 #define __Pyx_sst_abs(value) std::abs(value)
1427 #elif SIZEOF_INT >= SIZEOF_SIZE_T
1428 #define __Pyx_sst_abs(value) abs(value)
1429 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
1430 #define __Pyx_sst_abs(value) labs(value)
1431 #elif defined (_MSC_VER)
1432 #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
1433 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
1434 #define __Pyx_sst_abs(value) llabs(value)
1435 #elif defined (__GNUC__)
1436 #define __Pyx_sst_abs(value) __builtin_llabs(value)
1437 #else
1438 #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
1439 #endif
1440 static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s);
1441 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
1442 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
1443 static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char*);
1444 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
1445 #define __Pyx_PyBytes_FromString PyBytes_FromString
1446 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
1447 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
1448 #if PY_MAJOR_VERSION < 3
1449 #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
1450 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
1451 #else
1452 #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
1453 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
1454 #endif
1455 #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
1456 #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
1457 #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
1458 #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
1459 #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
1460 #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
1461 #define __Pyx_PyObject_AsWritableString(s) ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
1462 #define __Pyx_PyObject_AsWritableSString(s) ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
1463 #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
1464 #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
1465 #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
1466 #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
1467 #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
1468 #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
1469 #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
1470 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
1471 #define __Pyx_PyUnicode_FromOrdinal(o) PyUnicode_FromOrdinal((int)o)
1472 #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
1473 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
1474 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
1475 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
1476 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
1477 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
1478 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
1479 #define __Pyx_PySequence_Tuple(obj)\
1480 (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
1481 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
1482 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
1483 static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*);
1484 #if CYTHON_ASSUME_SAFE_MACROS
1485 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
1486 #else
1487 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
1488 #endif
1489 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
1490 #if PY_MAJOR_VERSION >= 3
1491 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
1492 #else
1493 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
1494 #endif
1495 #if CYTHON_USE_PYLONG_INTERNALS
1496 #if PY_VERSION_HEX >= 0x030C00A7
1497 #ifndef _PyLong_SIGN_MASK
1498 #define _PyLong_SIGN_MASK 3
1499 #endif
1500 #ifndef _PyLong_NON_SIZE_BITS
1501 #define _PyLong_NON_SIZE_BITS 3
1502 #endif
1503 #define __Pyx_PyLong_Sign(x) (((PyLongObject*)x)->long_value.lv_tag & _PyLong_SIGN_MASK)
1504 #define __Pyx_PyLong_IsNeg(x) ((__Pyx_PyLong_Sign(x) & 2) != 0)
1505 #define __Pyx_PyLong_IsNonNeg(x) (!__Pyx_PyLong_IsNeg(x))
1506 #define __Pyx_PyLong_IsZero(x) (__Pyx_PyLong_Sign(x) & 1)
1507 #define __Pyx_PyLong_IsPos(x) (__Pyx_PyLong_Sign(x) == 0)
1508 #define __Pyx_PyLong_CompactValueUnsigned(x) (__Pyx_PyLong_Digits(x)[0])
1509 #define __Pyx_PyLong_DigitCount(x) ((Py_ssize_t) (((PyLongObject*)x)->long_value.lv_tag >> _PyLong_NON_SIZE_BITS))
1510 #define __Pyx_PyLong_SignedDigitCount(x)\
1511 ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * __Pyx_PyLong_DigitCount(x))
1512 #if defined(PyUnstable_Long_IsCompact) && defined(PyUnstable_Long_CompactValue)
1513 #define __Pyx_PyLong_IsCompact(x) PyUnstable_Long_IsCompact((PyLongObject*) x)
1514 #define __Pyx_PyLong_CompactValue(x) PyUnstable_Long_CompactValue((PyLongObject*) x)
1515 #else
1516 #define __Pyx_PyLong_IsCompact(x) (((PyLongObject*)x)->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS))
1517 #define __Pyx_PyLong_CompactValue(x) ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0])
1518 #endif
1519 typedef Py_ssize_t __Pyx_compact_pylong;
1520 typedef size_t __Pyx_compact_upylong;
1521 #else
1522 #define __Pyx_PyLong_IsNeg(x) (Py_SIZE(x) < 0)
1523 #define __Pyx_PyLong_IsNonNeg(x) (Py_SIZE(x) >= 0)
1524 #define __Pyx_PyLong_IsZero(x) (Py_SIZE(x) == 0)
1525 #define __Pyx_PyLong_IsPos(x) (Py_SIZE(x) > 0)
1526 #define __Pyx_PyLong_CompactValueUnsigned(x) ((Py_SIZE(x) == 0) ? 0 : __Pyx_PyLong_Digits(x)[0])
1527 #define __Pyx_PyLong_DigitCount(x) __Pyx_sst_abs(Py_SIZE(x))
1528 #define __Pyx_PyLong_SignedDigitCount(x) Py_SIZE(x)
1529 #define __Pyx_PyLong_IsCompact(x) (Py_SIZE(x) == 0 || Py_SIZE(x) == 1 || Py_SIZE(x) == -1)
1530 #define __Pyx_PyLong_CompactValue(x)\
1531 ((Py_SIZE(x) == 0) ? (sdigit) 0 : ((Py_SIZE(x) < 0) ? -(sdigit)__Pyx_PyLong_Digits(x)[0] : (sdigit)__Pyx_PyLong_Digits(x)[0]))
1532 typedef sdigit __Pyx_compact_pylong;
1533 typedef digit __Pyx_compact_upylong;
1534 #endif
1535 #if PY_VERSION_HEX >= 0x030C00A5
1536 #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->long_value.ob_digit)
1537 #else
1538 #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->ob_digit)
1539 #endif
1540 #endif
1541 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
1542 #include <string.h>
1543 static int __Pyx_sys_getdefaultencoding_not_ascii;
1544 static int __Pyx_init_sys_getdefaultencoding_params(void) {
1545 PyObject* sys;
1546 PyObject* default_encoding = NULL;
1547 PyObject* ascii_chars_u = NULL;
1548 PyObject* ascii_chars_b = NULL;
1549 const char* default_encoding_c;
1550 sys = PyImport_ImportModule("sys");
1551 if (!sys) goto bad;
1552 default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
1553 Py_DECREF(sys);
1554 if (!default_encoding) goto bad;
1555 default_encoding_c = PyBytes_AsString(default_encoding);
1556 if (!default_encoding_c) goto bad;
1557 if (strcmp(default_encoding_c, "ascii") == 0) {
1558 __Pyx_sys_getdefaultencoding_not_ascii = 0;
1559 } else {
1560 char ascii_chars[128];
1561 int c;
1562 for (c = 0; c < 128; c++) {
1563 ascii_chars[c] = (char) c;
1564 }
1565 __Pyx_sys_getdefaultencoding_not_ascii = 1;
1566 ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
1567 if (!ascii_chars_u) goto bad;
1568 ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
1569 if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
1570 PyErr_Format(
1571 PyExc_ValueError,
1572 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
1573 default_encoding_c);
1574 goto bad;
1575 }
1576 Py_DECREF(ascii_chars_u);
1577 Py_DECREF(ascii_chars_b);
1578 }
1579 Py_DECREF(default_encoding);
1580 return 0;
1581 bad:
1582 Py_XDECREF(default_encoding);
1583 Py_XDECREF(ascii_chars_u);
1584 Py_XDECREF(ascii_chars_b);
1585 return -1;
1586 }
1587 #endif
1588 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
1589 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
1590 #else
1591 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
1592 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
1593 #include <string.h>
1594 static char* __PYX_DEFAULT_STRING_ENCODING;
1595 static int __Pyx_init_sys_getdefaultencoding_params(void) {
1596 PyObject* sys;
1597 PyObject* default_encoding = NULL;
1598 char* default_encoding_c;
1599 sys = PyImport_ImportModule("sys");
1600 if (!sys) goto bad;
1601 default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
1602 Py_DECREF(sys);
1603 if (!default_encoding) goto bad;
1604 default_encoding_c = PyBytes_AsString(default_encoding);
1605 if (!default_encoding_c) goto bad;
1606 __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
1607 if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
1608 strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
1609 Py_DECREF(default_encoding);
1610 return 0;
1611 bad:
1612 Py_XDECREF(default_encoding);
1613 return -1;
1614 }
1615 #endif
1616 #endif
1617
1618
1619 /* Test for GCC > 2.95 */
1620 #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
1621 #define likely(x) __builtin_expect(!!(x), 1)
1622 #define unlikely(x) __builtin_expect(!!(x), 0)
1623 #else /* !__GNUC__ or GCC < 2.95 */
1624 #define likely(x) (x)
1625 #define unlikely(x) (x)
1626 #endif /* __GNUC__ */
1627 static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
1628
1629 #if !CYTHON_USE_MODULE_STATE
1630 static PyObject *__pyx_m = NULL;
1631 #endif
1632 static int __pyx_lineno;
1633 static int __pyx_clineno = 0;
1634 static const char * __pyx_cfilenm = __FILE__;
1635 static const char *__pyx_filename;
1636
1637 /* #### Code section: filename_table ### */
1638
1639 static const char *__pyx_f[] = {
1640 "pysam/libchtslib.pyx",
1641 "<stringsource>",
1642 "contextvars.pxd",
1643 "array.pxd",
1644 "pysam/libchtslib.pxd",
1645 "type.pxd",
1646 "bool.pxd",
1647 "complex.pxd",
1648 };
1649 /* #### Code section: utility_code_proto_before_types ### */
1650 /* ForceInitThreads.proto */
1651 #ifndef __PYX_FORCE_INIT_THREADS
1652 #define __PYX_FORCE_INIT_THREADS 0
1653 #endif
1654
1655 /* NoFastGil.proto */
1656 #define __Pyx_PyGILState_Ensure PyGILState_Ensure
1657 #define __Pyx_PyGILState_Release PyGILState_Release
1658 #define __Pyx_FastGIL_Remember()
1659 #define __Pyx_FastGIL_Forget()
1660 #define __Pyx_FastGilFuncInit()
1661
1662 /* #### Code section: numeric_typedefs ### */
1663 /* #### Code section: complex_type_declarations ### */
1664 /* #### Code section: type_declarations ### */
1665
1666 /*--- Type declarations ---*/
1667 #ifndef _ARRAYARRAY_H
1668 struct arrayobject;
1669 typedef struct arrayobject arrayobject;
1670 #endif
1671 struct __pyx_obj_5pysam_10libchtslib_HTSFile;
1672 struct __pyx_obj_5pysam_10libchtslib_HFile;
1673 struct __pyx_opt_args_7cpython_11contextvars_get_value;
1674 struct __pyx_opt_args_7cpython_11contextvars_get_value_no_default;
1675
1676 /* "cpython/contextvars.pxd":112
1677 *
1678 *
1679 * cdef inline object get_value(var, default_value=None): # <<<<<<<<<<<<<<
1680 * """Return a new reference to the value of the context variable,
1681 * or the default value of the context variable,
1682 */
1683 struct __pyx_opt_args_7cpython_11contextvars_get_value {
1684 int __pyx_n;
1685 PyObject *default_value;
1686 };
1687
1688 /* "cpython/contextvars.pxd":129
1689 *
1690 *
1691 * cdef inline object get_value_no_default(var, default_value=None): # <<<<<<<<<<<<<<
1692 * """Return a new reference to the value of the context variable,
1693 * or the provided default value if no such value was found.
1694 */
1695 struct __pyx_opt_args_7cpython_11contextvars_get_value_no_default {
1696 int __pyx_n;
1697 PyObject *default_value;
1698 };
1699 struct __pyx_opt_args_5pysam_9libcutils_parse_region;
1700 struct __pyx_opt_args_5pysam_9libcutils_qualitystring_to_array;
1701 struct __pyx_opt_args_5pysam_9libcutils_array_to_qualitystring;
1702 struct __pyx_opt_args_5pysam_9libcutils_qualities_to_qualitystring;
1703 struct __pyx_opt_args_5pysam_9libcutils_charptr_to_str;
1704 struct __pyx_opt_args_5pysam_9libcutils_charptr_to_bytes;
1705 struct __pyx_opt_args_5pysam_9libcutils_charptr_to_str_w_len;
1706 struct __pyx_opt_args_5pysam_9libcutils_force_str;
1707 struct __pyx_opt_args_5pysam_9libcutils_force_bytes;
1708 struct __pyx_opt_args_5pysam_9libcutils_decode_bytes;
1709
1710 /* "pysam/libcutils.pxd":8
1711 * from cpython cimport array as c_array
1712 *
1713 * cpdef parse_region(contig=*, start=*, stop=*, region=*, reference=*, end=*) # <<<<<<<<<<<<<<
1714 *
1715 * cdef int libc_whence_from_io(int whence)
1716 */
1717 struct __pyx_opt_args_5pysam_9libcutils_parse_region {
1718 int __pyx_n;
1719 PyObject *contig;
1720 PyObject *start;
1721 PyObject *stop;
1722 PyObject *region;
1723 PyObject *reference;
1724 PyObject *end;
1725 };
1726
1727 /* "pysam/libcutils.pxd":15
1728 * # Utility functions for quality string conversions
1729 *
1730 * cpdef c_array.array qualitystring_to_array(input_str, int offset=*) # <<<<<<<<<<<<<<
1731 * cpdef array_to_qualitystring(c_array.array arr, int offset=*)
1732 * cpdef qualities_to_qualitystring(qualities, int offset=*)
1733 */
1734 struct __pyx_opt_args_5pysam_9libcutils_qualitystring_to_array {
1735 int __pyx_n;
1736 int offset;
1737 };
1738
1739 /* "pysam/libcutils.pxd":16
1740 *
1741 * cpdef c_array.array qualitystring_to_array(input_str, int offset=*)
1742 * cpdef array_to_qualitystring(c_array.array arr, int offset=*) # <<<<<<<<<<<<<<
1743 * cpdef qualities_to_qualitystring(qualities, int offset=*)
1744 *
1745 */
1746 struct __pyx_opt_args_5pysam_9libcutils_array_to_qualitystring {
1747 int __pyx_n;
1748 int offset;
1749 };
1750
1751 /* "pysam/libcutils.pxd":17
1752 * cpdef c_array.array qualitystring_to_array(input_str, int offset=*)
1753 * cpdef array_to_qualitystring(c_array.array arr, int offset=*)
1754 * cpdef qualities_to_qualitystring(qualities, int offset=*) # <<<<<<<<<<<<<<
1755 *
1756 * ########################################################################
1757 */
1758 struct __pyx_opt_args_5pysam_9libcutils_qualities_to_qualitystring {
1759 int __pyx_n;
1760 int offset;
1761 };
1762
1763 /* "pysam/libcutils.pxd":29
1764 * ## Python 3 compatibility functions
1765 * ########################################################################
1766 * cdef charptr_to_str(const char *s, encoding=*, errors=*) # <<<<<<<<<<<<<<
1767 * cdef bytes charptr_to_bytes(const char *s, encoding=*, errors=*)
1768 * cdef charptr_to_str_w_len(const char* s, size_t n, encoding=*, errors=*)
1769 */
1770 struct __pyx_opt_args_5pysam_9libcutils_charptr_to_str {
1771 int __pyx_n;
1772 PyObject *encoding;
1773 PyObject *errors;
1774 };
1775
1776 /* "pysam/libcutils.pxd":30
1777 * ########################################################################
1778 * cdef charptr_to_str(const char *s, encoding=*, errors=*)
1779 * cdef bytes charptr_to_bytes(const char *s, encoding=*, errors=*) # <<<<<<<<<<<<<<
1780 * cdef charptr_to_str_w_len(const char* s, size_t n, encoding=*, errors=*)
1781 * cdef force_str(object s, encoding=*, errors=*)
1782 */
1783 struct __pyx_opt_args_5pysam_9libcutils_charptr_to_bytes {
1784 int __pyx_n;
1785 PyObject *encoding;
1786 PyObject *errors;
1787 };
1788
1789 /* "pysam/libcutils.pxd":31
1790 * cdef charptr_to_str(const char *s, encoding=*, errors=*)
1791 * cdef bytes charptr_to_bytes(const char *s, encoding=*, errors=*)
1792 * cdef charptr_to_str_w_len(const char* s, size_t n, encoding=*, errors=*) # <<<<<<<<<<<<<<
1793 * cdef force_str(object s, encoding=*, errors=*)
1794 * cdef bytes force_bytes(object s, encoding=*, errors=*)
1795 */
1796 struct __pyx_opt_args_5pysam_9libcutils_charptr_to_str_w_len {
1797 int __pyx_n;
1798 PyObject *encoding;
1799 PyObject *errors;
1800 };
1801
1802 /* "pysam/libcutils.pxd":32
1803 * cdef bytes charptr_to_bytes(const char *s, encoding=*, errors=*)
1804 * cdef charptr_to_str_w_len(const char* s, size_t n, encoding=*, errors=*)
1805 * cdef force_str(object s, encoding=*, errors=*) # <<<<<<<<<<<<<<
1806 * cdef bytes force_bytes(object s, encoding=*, errors=*)
1807 * cdef decode_bytes(bytes s, encoding=*, errors=*)
1808 */
1809 struct __pyx_opt_args_5pysam_9libcutils_force_str {
1810 int __pyx_n;
1811 PyObject *encoding;
1812 PyObject *errors;
1813 };
1814
1815 /* "pysam/libcutils.pxd":33
1816 * cdef charptr_to_str_w_len(const char* s, size_t n, encoding=*, errors=*)
1817 * cdef force_str(object s, encoding=*, errors=*)
1818 * cdef bytes force_bytes(object s, encoding=*, errors=*) # <<<<<<<<<<<<<<
1819 * cdef decode_bytes(bytes s, encoding=*, errors=*)
1820 * cdef bytes encode_filename(object filename)
1821 */
1822 struct __pyx_opt_args_5pysam_9libcutils_force_bytes {
1823 int __pyx_n;
1824 PyObject *encoding;
1825 PyObject *errors;
1826 };
1827
1828 /* "pysam/libcutils.pxd":34
1829 * cdef force_str(object s, encoding=*, errors=*)
1830 * cdef bytes force_bytes(object s, encoding=*, errors=*)
1831 * cdef decode_bytes(bytes s, encoding=*, errors=*) # <<<<<<<<<<<<<<
1832 * cdef bytes encode_filename(object filename)
1833 * cdef from_string_and_size(const char *s, size_t length)
1834 */
1835 struct __pyx_opt_args_5pysam_9libcutils_decode_bytes {
1836 int __pyx_n;
1837 PyObject *encoding;
1838 PyObject *errors;
1839 };
1840 struct __pyx_opt_args_5pysam_10libchtslib_5HFile__open;
1841
1842 /* "pysam/libchtslib.pyx":81
1843 * return self.fp == NULL
1844 *
1845 * cdef _open(self, name, mode, closefd=True): # <<<<<<<<<<<<<<
1846 * self.name = name
1847 * self.mode = mode
1848 */
1849 struct __pyx_opt_args_5pysam_10libchtslib_5HFile__open {
1850 int __pyx_n;
1851 PyObject *closefd;
1852 };
1853
1854 /* "pysam/libchtslib.pxd":2706
1855 *
1856 *
1857 * cdef class HTSFile(object): # <<<<<<<<<<<<<<
1858 * cdef htsFile *htsfile # pointer to htsFile structure
1859 * cdef int64_t start_offset # BGZF offset of first record
1860 */
1861 struct __pyx_obj_5pysam_10libchtslib_HTSFile {
1862 PyObject_HEAD
1863 struct __pyx_vtabstruct_5pysam_10libchtslib_HTSFile *__pyx_vtab;
1864 htsFile *htsfile;
1865 int64_t start_offset;
1866 PyObject *filename;
1867 PyObject *mode;
1868 PyObject *threads;
1869 PyObject *index_filename;
1870 int is_stream;
1871 int is_remote;
1872 int duplicate_filehandle;
1873 };
1874
1875
1876 /* "pysam/libchtslib.pyx":67
1877 * ########################################################################
1878 *
1879 * cdef class HFile(object): # <<<<<<<<<<<<<<
1880 * cdef hFILE *fp
1881 * cdef readonly object name, mode
1882 */
1883 struct __pyx_obj_5pysam_10libchtslib_HFile {
1884 PyObject_HEAD
1885 struct __pyx_vtabstruct_5pysam_10libchtslib_HFile *__pyx_vtab;
1886 hFILE *fp;
1887 PyObject *name;
1888 PyObject *mode;
1889 };
1890
1891
1892
1893 /* "pysam/libchtslib.pyx":321
1894 * ########################################################################
1895 *
1896 * cdef class HTSFile(object): # <<<<<<<<<<<<<<
1897 * """
1898 * Base class for HTS file types
1899 */
1900
1901 struct __pyx_vtabstruct_5pysam_10libchtslib_HTSFile {
1902 htsFile *(*_open_htsfile)(struct __pyx_obj_5pysam_10libchtslib_HTSFile *);
1903 };
1904 static struct __pyx_vtabstruct_5pysam_10libchtslib_HTSFile *__pyx_vtabptr_5pysam_10libchtslib_HTSFile;
1905
1906
1907 /* "pysam/libchtslib.pyx":67
1908 * ########################################################################
1909 *
1910 * cdef class HFile(object): # <<<<<<<<<<<<<<
1911 * cdef hFILE *fp
1912 * cdef readonly object name, mode
1913 */
1914
1915 struct __pyx_vtabstruct_5pysam_10libchtslib_HFile {
1916 PyObject *(*_open)(struct __pyx_obj_5pysam_10libchtslib_HFile *, PyObject *, PyObject *, struct __pyx_opt_args_5pysam_10libchtslib_5HFile__open *__pyx_optional_args);
1917 };
1918 static struct __pyx_vtabstruct_5pysam_10libchtslib_HFile *__pyx_vtabptr_5pysam_10libchtslib_HFile;
1919 /* #### Code section: utility_code_proto ### */
1920
1921 /* --- Runtime support code (head) --- */
1922 /* Refnanny.proto */
1923 #ifndef CYTHON_REFNANNY
1924 #define CYTHON_REFNANNY 0
1925 #endif
1926 #if CYTHON_REFNANNY
1927 typedef struct {
1928 void (*INCREF)(void*, PyObject*, Py_ssize_t);
1929 void (*DECREF)(void*, PyObject*, Py_ssize_t);
1930 void (*GOTREF)(void*, PyObject*, Py_ssize_t);
1931 void (*GIVEREF)(void*, PyObject*, Py_ssize_t);
1932 void* (*SetupContext)(const char*, Py_ssize_t, const char*);
1933 void (*FinishContext)(void**);
1934 } __Pyx_RefNannyAPIStruct;
1935 static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
1936 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
1937 #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
1938 #ifdef WITH_THREAD
1939 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1940 if (acquire_gil) {\
1941 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1942 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\
1943 PyGILState_Release(__pyx_gilstate_save);\
1944 } else {\
1945 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\
1946 }
1947 #define __Pyx_RefNannyFinishContextNogil() {\
1948 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1949 __Pyx_RefNannyFinishContext();\
1950 PyGILState_Release(__pyx_gilstate_save);\
1951 }
1952 #else
1953 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1954 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__))
1955 #define __Pyx_RefNannyFinishContextNogil() __Pyx_RefNannyFinishContext()
1956 #endif
1957 #define __Pyx_RefNannyFinishContextNogil() {\
1958 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1959 __Pyx_RefNannyFinishContext();\
1960 PyGILState_Release(__pyx_gilstate_save);\
1961 }
1962 #define __Pyx_RefNannyFinishContext()\
1963 __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
1964 #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
1965 #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
1966 #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
1967 #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
1968 #define __Pyx_XINCREF(r) do { if((r) == NULL); else {__Pyx_INCREF(r); }} while(0)
1969 #define __Pyx_XDECREF(r) do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0)
1970 #define __Pyx_XGOTREF(r) do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0)
1971 #define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0)
1972 #else
1973 #define __Pyx_RefNannyDeclarations
1974 #define __Pyx_RefNannySetupContext(name, acquire_gil)
1975 #define __Pyx_RefNannyFinishContextNogil()
1976 #define __Pyx_RefNannyFinishContext()
1977 #define __Pyx_INCREF(r) Py_INCREF(r)
1978 #define __Pyx_DECREF(r) Py_DECREF(r)
1979 #define __Pyx_GOTREF(r)
1980 #define __Pyx_GIVEREF(r)
1981 #define __Pyx_XINCREF(r) Py_XINCREF(r)
1982 #define __Pyx_XDECREF(r) Py_XDECREF(r)
1983 #define __Pyx_XGOTREF(r)
1984 #define __Pyx_XGIVEREF(r)
1985 #endif
1986 #define __Pyx_Py_XDECREF_SET(r, v) do {\
1987 PyObject *tmp = (PyObject *) r;\
1988 r = v; Py_XDECREF(tmp);\
1989 } while (0)
1990 #define __Pyx_XDECREF_SET(r, v) do {\
1991 PyObject *tmp = (PyObject *) r;\
1992 r = v; __Pyx_XDECREF(tmp);\
1993 } while (0)
1994 #define __Pyx_DECREF_SET(r, v) do {\
1995 PyObject *tmp = (PyObject *) r;\
1996 r = v; __Pyx_DECREF(tmp);\
1997 } while (0)
1998 #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1999 #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
2000
2001 /* PyErrExceptionMatches.proto */
2002 #if CYTHON_FAST_THREAD_STATE
2003 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
2004 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
2005 #else
2006 #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
2007 #endif
2008
2009 /* PyThreadStateGet.proto */
2010 #if CYTHON_FAST_THREAD_STATE
2011 #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
2012 #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
2013 #if PY_VERSION_HEX >= 0x030C00A6
2014 #define __Pyx_PyErr_Occurred() (__pyx_tstate->current_exception != NULL)
2015 #define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->current_exception ? (PyObject*) Py_TYPE(__pyx_tstate->current_exception) : (PyObject*) NULL)
2016 #else
2017 #define __Pyx_PyErr_Occurred() (__pyx_tstate->curexc_type != NULL)
2018 #define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->curexc_type)
2019 #endif
2020 #else
2021 #define __Pyx_PyThreadState_declare
2022 #define __Pyx_PyThreadState_assign
2023 #define __Pyx_PyErr_Occurred() (PyErr_Occurred() != NULL)
2024 #define __Pyx_PyErr_CurrentExceptionType() PyErr_Occurred()
2025 #endif
2026
2027 /* PyErrFetchRestore.proto */
2028 #if CYTHON_FAST_THREAD_STATE
2029 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
2030 #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
2031 #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
2032 #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
2033 #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
2034 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
2035 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
2036 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A6
2037 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
2038 #else
2039 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
2040 #endif
2041 #else
2042 #define __Pyx_PyErr_Clear() PyErr_Clear()
2043 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
2044 #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
2045 #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
2046 #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
2047 #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
2048 #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
2049 #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
2050 #endif
2051
2052 /* PyObjectGetAttrStr.proto */
2053 #if CYTHON_USE_TYPE_SLOTS
2054 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
2055 #else
2056 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
2057 #endif
2058
2059 /* PyObjectGetAttrStrNoError.proto */
2060 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);
2061
2062 /* GetBuiltinName.proto */
2063 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
2064
2065 /* TupleAndListFromArray.proto */
2066 #if CYTHON_COMPILING_IN_CPYTHON
2067 static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n);
2068 static CYTHON_INLINE PyObject* __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n);
2069 #endif
2070
2071 /* IncludeStringH.proto */
2072 #include <string.h>
2073
2074 /* BytesEquals.proto */
2075 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);
2076
2077 /* UnicodeEquals.proto */
2078 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);
2079
2080 /* fastcall.proto */
2081 #if CYTHON_AVOID_BORROWED_REFS
2082 #define __Pyx_Arg_VARARGS(args, i) PySequence_GetItem(args, i)
2083 #elif CYTHON_ASSUME_SAFE_MACROS
2084 #define __Pyx_Arg_VARARGS(args, i) PyTuple_GET_ITEM(args, i)
2085 #else
2086 #define __Pyx_Arg_VARARGS(args, i) PyTuple_GetItem(args, i)
2087 #endif
2088 #if CYTHON_AVOID_BORROWED_REFS
2089 #define __Pyx_Arg_NewRef_VARARGS(arg) __Pyx_NewRef(arg)
2090 #define __Pyx_Arg_XDECREF_VARARGS(arg) Py_XDECREF(arg)
2091 #else
2092 #define __Pyx_Arg_NewRef_VARARGS(arg) arg
2093 #define __Pyx_Arg_XDECREF_VARARGS(arg)
2094 #endif
2095 #define __Pyx_NumKwargs_VARARGS(kwds) PyDict_Size(kwds)
2096 #define __Pyx_KwValues_VARARGS(args, nargs) NULL
2097 #define __Pyx_GetKwValue_VARARGS(kw, kwvalues, s) __Pyx_PyDict_GetItemStrWithError(kw, s)
2098 #define __Pyx_KwargsAsDict_VARARGS(kw, kwvalues) PyDict_Copy(kw)
2099 #if CYTHON_METH_FASTCALL
2100 #define __Pyx_Arg_FASTCALL(args, i) args[i]
2101 #define __Pyx_NumKwargs_FASTCALL(kwds) PyTuple_GET_SIZE(kwds)
2102 #define __Pyx_KwValues_FASTCALL(args, nargs) ((args) + (nargs))
2103 static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s);
2104 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000
2105 CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues);
2106 #else
2107 #define __Pyx_KwargsAsDict_FASTCALL(kw, kwvalues) _PyStack_AsDict(kwvalues, kw)
2108 #endif
2109 #define __Pyx_Arg_NewRef_FASTCALL(arg) arg /* no-op, __Pyx_Arg_FASTCALL is direct and this needs
2110 to have the same reference counting */
2111 #define __Pyx_Arg_XDECREF_FASTCALL(arg)
2112 #else
2113 #define __Pyx_Arg_FASTCALL __Pyx_Arg_VARARGS
2114 #define __Pyx_NumKwargs_FASTCALL __Pyx_NumKwargs_VARARGS
2115 #define __Pyx_KwValues_FASTCALL __Pyx_KwValues_VARARGS
2116 #define __Pyx_GetKwValue_FASTCALL __Pyx_GetKwValue_VARARGS
2117 #define __Pyx_KwargsAsDict_FASTCALL __Pyx_KwargsAsDict_VARARGS
2118 #define __Pyx_Arg_NewRef_FASTCALL(arg) __Pyx_Arg_NewRef_VARARGS(arg)
2119 #define __Pyx_Arg_XDECREF_FASTCALL(arg) __Pyx_Arg_XDECREF_VARARGS(arg)
2120 #endif
2121 #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
2122 #define __Pyx_ArgsSlice_VARARGS(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_VARARGS(args, start), stop - start)
2123 #define __Pyx_ArgsSlice_FASTCALL(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_FASTCALL(args, start), stop - start)
2124 #else
2125 #define __Pyx_ArgsSlice_VARARGS(args, start, stop) PyTuple_GetSlice(args, start, stop)
2126 #define __Pyx_ArgsSlice_FASTCALL(args, start, stop) PyTuple_GetSlice(args, start, stop)
2127 #endif
2128
2129 /* Profile.proto */
2130 #ifndef CYTHON_PROFILE
2131 #if CYTHON_COMPILING_IN_LIMITED_API || CYTHON_COMPILING_IN_PYPY
2132 #define CYTHON_PROFILE 0
2133 #else
2134 #define CYTHON_PROFILE 1
2135 #endif
2136 #endif
2137 #ifndef CYTHON_TRACE_NOGIL
2138 #define CYTHON_TRACE_NOGIL 0
2139 #else
2140 #if CYTHON_TRACE_NOGIL && !defined(CYTHON_TRACE)
2141 #define CYTHON_TRACE 1
2142 #endif
2143 #endif
2144 #ifndef CYTHON_TRACE
2145 #define CYTHON_TRACE 0
2146 #endif
2147 #if CYTHON_TRACE
2148 #undef CYTHON_PROFILE_REUSE_FRAME
2149 #endif
2150 #ifndef CYTHON_PROFILE_REUSE_FRAME
2151 #define CYTHON_PROFILE_REUSE_FRAME 0
2152 #endif
2153 #if CYTHON_PROFILE || CYTHON_TRACE
2154 #include "compile.h"
2155 #include "frameobject.h"
2156 #include "traceback.h"
2157 #if PY_VERSION_HEX >= 0x030b00a6
2158 #ifndef Py_BUILD_CORE
2159 #define Py_BUILD_CORE 1
2160 #endif
2161 #include "internal/pycore_frame.h"
2162 #endif
2163 #if CYTHON_PROFILE_REUSE_FRAME
2164 #define CYTHON_FRAME_MODIFIER static
2165 #define CYTHON_FRAME_DEL(frame)
2166 #else
2167 #define CYTHON_FRAME_MODIFIER
2168 #define CYTHON_FRAME_DEL(frame) Py_CLEAR(frame)
2169 #endif
2170 #define __Pyx_TraceDeclarations\
2171 static PyCodeObject *__pyx_frame_code = NULL;\
2172 CYTHON_FRAME_MODIFIER PyFrameObject *__pyx_frame = NULL;\
2173 int __Pyx_use_tracing = 0;
2174 #define __Pyx_TraceFrameInit(codeobj)\
2175 if (codeobj) __pyx_frame_code = (PyCodeObject*) codeobj;
2176 #if PY_VERSION_HEX >= 0x030b00a2
2177 #if PY_VERSION_HEX >= 0x030C00b1
2178 #define __Pyx_IsTracing(tstate, check_tracing, check_funcs)\
2179 ((!(check_tracing) || !(tstate)->tracing) &&\
2180 (!(check_funcs) || (tstate)->c_profilefunc || (CYTHON_TRACE && (tstate)->c_tracefunc)))
2181 #else
2182 #define __Pyx_IsTracing(tstate, check_tracing, check_funcs)\
2183 (unlikely((tstate)->cframe->use_tracing) &&\
2184 (!(check_tracing) || !(tstate)->tracing) &&\
2185 (!(check_funcs) || (tstate)->c_profilefunc || (CYTHON_TRACE && (tstate)->c_tracefunc)))
2186 #endif
2187 #define __Pyx_EnterTracing(tstate) PyThreadState_EnterTracing(tstate)
2188 #define __Pyx_LeaveTracing(tstate) PyThreadState_LeaveTracing(tstate)
2189 #elif PY_VERSION_HEX >= 0x030a00b1
2190 #define __Pyx_IsTracing(tstate, check_tracing, check_funcs)\
2191 (unlikely((tstate)->cframe->use_tracing) &&\
2192 (!(check_tracing) || !(tstate)->tracing) &&\
2193 (!(check_funcs) || (tstate)->c_profilefunc || (CYTHON_TRACE && (tstate)->c_tracefunc)))
2194 #define __Pyx_EnterTracing(tstate)\
2195 do { tstate->tracing++; tstate->cframe->use_tracing = 0; } while (0)
2196 #define __Pyx_LeaveTracing(tstate)\
2197 do {\
2198 tstate->tracing--;\
2199 tstate->cframe->use_tracing = ((CYTHON_TRACE && tstate->c_tracefunc != NULL)\
2200 || tstate->c_profilefunc != NULL);\
2201 } while (0)
2202 #else
2203 #define __Pyx_IsTracing(tstate, check_tracing, check_funcs)\
2204 (unlikely((tstate)->use_tracing) &&\
2205 (!(check_tracing) || !(tstate)->tracing) &&\
2206 (!(check_funcs) || (tstate)->c_profilefunc || (CYTHON_TRACE && (tstate)->c_tracefunc)))
2207 #define __Pyx_EnterTracing(tstate)\
2208 do { tstate->tracing++; tstate->use_tracing = 0; } while (0)
2209 #define __Pyx_LeaveTracing(tstate)\
2210 do {\
2211 tstate->tracing--;\
2212 tstate->use_tracing = ((CYTHON_TRACE && tstate->c_tracefunc != NULL)\
2213 || tstate->c_profilefunc != NULL);\
2214 } while (0)
2215 #endif
2216 #ifdef WITH_THREAD
2217 #define __Pyx_TraceCall(funcname, srcfile, firstlineno, nogil, goto_error)\
2218 if (nogil) {\
2219 if (CYTHON_TRACE_NOGIL) {\
2220 PyThreadState *tstate;\
2221 PyGILState_STATE state = PyGILState_Ensure();\
2222 tstate = __Pyx_PyThreadState_Current;\
2223 if (__Pyx_IsTracing(tstate, 1, 1)) {\
2224 __Pyx_use_tracing = __Pyx_TraceSetupAndCall(&__pyx_frame_code, &__pyx_frame, tstate, funcname, srcfile, firstlineno);\
2225 }\
2226 PyGILState_Release(state);\
2227 if (unlikely(__Pyx_use_tracing < 0)) goto_error;\
2228 }\
2229 } else {\
2230 PyThreadState* tstate = PyThreadState_GET();\
2231 if (__Pyx_IsTracing(tstate, 1, 1)) {\
2232 __Pyx_use_tracing = __Pyx_TraceSetupAndCall(&__pyx_frame_code, &__pyx_frame, tstate, funcname, srcfile, firstlineno);\
2233 if (unlikely(__Pyx_use_tracing < 0)) goto_error;\
2234 }\
2235 }
2236 #else
2237 #define __Pyx_TraceCall(funcname, srcfile, firstlineno, nogil, goto_error)\
2238 { PyThreadState* tstate = PyThreadState_GET();\
2239 if (__Pyx_IsTracing(tstate, 1, 1)) {\
2240 __Pyx_use_tracing = __Pyx_TraceSetupAndCall(&__pyx_frame_code, &__pyx_frame, tstate, funcname, srcfile, firstlineno);\
2241 if (unlikely(__Pyx_use_tracing < 0)) goto_error;\
2242 }\
2243 }
2244 #endif
2245 #define __Pyx_TraceException()\
2246 if (likely(!__Pyx_use_tracing)); else {\
2247 PyThreadState* tstate = __Pyx_PyThreadState_Current;\
2248 if (__Pyx_IsTracing(tstate, 0, 1)) {\
2249 __Pyx_EnterTracing(tstate);\
2250 PyObject *exc_info = __Pyx_GetExceptionTuple(tstate);\
2251 if (exc_info) {\
2252 if (CYTHON_TRACE && tstate->c_tracefunc)\
2253 tstate->c_tracefunc(\
2254 tstate->c_traceobj, __pyx_frame, PyTrace_EXCEPTION, exc_info);\
2255 tstate->c_profilefunc(\
2256 tstate->c_profileobj, __pyx_frame, PyTrace_EXCEPTION, exc_info);\
2257 Py_DECREF(exc_info);\
2258 }\
2259 __Pyx_LeaveTracing(tstate);\
2260 }\
2261 }
2262 static void __Pyx_call_return_trace_func(PyThreadState *tstate, PyFrameObject *frame, PyObject *result) {
2263 PyObject *type, *value, *traceback;
2264 __Pyx_ErrFetchInState(tstate, &type, &value, &traceback);
2265 __Pyx_EnterTracing(tstate);
2266 if (CYTHON_TRACE && tstate->c_tracefunc)
2267 tstate->c_tracefunc(tstate->c_traceobj, frame, PyTrace_RETURN, result);
2268 if (tstate->c_profilefunc)
2269 tstate->c_profilefunc(tstate->c_profileobj, frame, PyTrace_RETURN, result);
2270 CYTHON_FRAME_DEL(frame);
2271 __Pyx_LeaveTracing(tstate);
2272 __Pyx_ErrRestoreInState(tstate, type, value, traceback);
2273 }
2274 #ifdef WITH_THREAD
2275 #define __Pyx_TraceReturn(result, nogil)\
2276 if (likely(!__Pyx_use_tracing)); else {\
2277 if (nogil) {\
2278 if (CYTHON_TRACE_NOGIL) {\
2279 PyThreadState *tstate;\
2280 PyGILState_STATE state = PyGILState_Ensure();\
2281 tstate = __Pyx_PyThreadState_Current;\
2282 if (__Pyx_IsTracing(tstate, 0, 0)) {\
2283 __Pyx_call_return_trace_func(tstate, __pyx_frame, (PyObject*)result);\
2284 }\
2285 PyGILState_Release(state);\
2286 }\
2287 } else {\
2288 PyThreadState* tstate = __Pyx_PyThreadState_Current;\
2289 if (__Pyx_IsTracing(tstate, 0, 0)) {\
2290 __Pyx_call_return_trace_func(tstate, __pyx_frame, (PyObject*)result);\
2291 }\
2292 }\
2293 }
2294 #else
2295 #define __Pyx_TraceReturn(result, nogil)\
2296 if (likely(!__Pyx_use_tracing)); else {\
2297 PyThreadState* tstate = __Pyx_PyThreadState_Current;\
2298 if (__Pyx_IsTracing(tstate, 0, 0)) {\
2299 __Pyx_call_return_trace_func(tstate, __pyx_frame, (PyObject*)result);\
2300 }\
2301 }
2302 #endif
2303 static PyCodeObject *__Pyx_createFrameCodeObject(const char *funcname, const char *srcfile, int firstlineno);
2304 static int __Pyx_TraceSetupAndCall(PyCodeObject** code, PyFrameObject** frame, PyThreadState* tstate, const char *funcname, const char *srcfile, int firstlineno);
2305 #else
2306 #define __Pyx_TraceDeclarations
2307 #define __Pyx_TraceFrameInit(codeobj)
2308 #define __Pyx_TraceCall(funcname, srcfile, firstlineno, nogil, goto_error) if ((1)); else goto_error;
2309 #define __Pyx_TraceException()
2310 #define __Pyx_TraceReturn(result, nogil)
2311 #endif
2312 #if CYTHON_TRACE
2313 static int __Pyx_call_line_trace_func(PyThreadState *tstate, PyFrameObject *frame, int lineno) {
2314 int ret;
2315 PyObject *type, *value, *traceback;
2316 __Pyx_ErrFetchInState(tstate, &type, &value, &traceback);
2317 __Pyx_PyFrame_SetLineNumber(frame, lineno);
2318 __Pyx_EnterTracing(tstate);
2319 ret = tstate->c_tracefunc(tstate->c_traceobj, frame, PyTrace_LINE, NULL);
2320 __Pyx_LeaveTracing(tstate);
2321 if (likely(!ret)) {
2322 __Pyx_ErrRestoreInState(tstate, type, value, traceback);
2323 } else {
2324 Py_XDECREF(type);
2325 Py_XDECREF(value);
2326 Py_XDECREF(traceback);
2327 }
2328 return ret;
2329 }
2330 #ifdef WITH_THREAD
2331 #define __Pyx_TraceLine(lineno, nogil, goto_error)\
2332 if (likely(!__Pyx_use_tracing)); else {\
2333 if (nogil) {\
2334 if (CYTHON_TRACE_NOGIL) {\
2335 int ret = 0;\
2336 PyThreadState *tstate;\
2337 PyGILState_STATE state = __Pyx_PyGILState_Ensure();\
2338 tstate = __Pyx_PyThreadState_Current;\
2339 if (__Pyx_IsTracing(tstate, 0, 0) && tstate->c_tracefunc && __pyx_frame->f_trace) {\
2340 ret = __Pyx_call_line_trace_func(tstate, __pyx_frame, lineno);\
2341 }\
2342 __Pyx_PyGILState_Release(state);\
2343 if (unlikely(ret)) goto_error;\
2344 }\
2345 } else {\
2346 PyThreadState* tstate = __Pyx_PyThreadState_Current;\
2347 if (__Pyx_IsTracing(tstate, 0, 0) && tstate->c_tracefunc && __pyx_frame->f_trace) {\
2348 int ret = __Pyx_call_line_trace_func(tstate, __pyx_frame, lineno);\
2349 if (unlikely(ret)) goto_error;\
2350 }\
2351 }\
2352 }
2353 #else
2354 #define __Pyx_TraceLine(lineno, nogil, goto_error)\
2355 if (likely(!__Pyx_use_tracing)); else {\
2356 PyThreadState* tstate = __Pyx_PyThreadState_Current;\
2357 if (__Pyx_IsTracing(tstate, 0, 0) && tstate->c_tracefunc && __pyx_frame->f_trace) {\
2358 int ret = __Pyx_call_line_trace_func(tstate, __pyx_frame, lineno);\
2359 if (unlikely(ret)) goto_error;\
2360 }\
2361 }
2362 #endif
2363 #else
2364 #define __Pyx_TraceLine(lineno, nogil, goto_error) if ((1)); else goto_error;
2365 #endif
2366
2367 /* RaiseDoubleKeywords.proto */
2368 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
2369
2370 /* ParseKeywords.proto */
2371 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject *const *kwvalues,
2372 PyObject **argnames[],
2373 PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,
2374 const char* function_name);
2375
2376 /* RaiseArgTupleInvalid.proto */
2377 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
2378 Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
2379
2380 /* PyFunctionFastCall.proto */
2381 #if CYTHON_FAST_PYCALL
2382 #if !CYTHON_VECTORCALL
2383 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
2384 __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
2385 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
2386 #endif
2387 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
2388 (sizeof(char [1 - 2*!(cond)]) - 1)
2389 #ifndef Py_MEMBER_SIZE
2390 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
2391 #endif
2392 #if !CYTHON_VECTORCALL
2393 #if PY_VERSION_HEX >= 0x03080000
2394 #include "frameobject.h"
2395 #if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API
2396 #ifndef Py_BUILD_CORE
2397 #define Py_BUILD_CORE 1
2398 #endif
2399 #include "internal/pycore_frame.h"
2400 #endif
2401 #define __Pxy_PyFrame_Initialize_Offsets()
2402 #define __Pyx_PyFrame_GetLocalsplus(frame) ((frame)->f_localsplus)
2403 #else
2404 static size_t __pyx_pyframe_localsplus_offset = 0;
2405 #include "frameobject.h"
2406 #define __Pxy_PyFrame_Initialize_Offsets()\
2407 ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
2408 (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
2409 #define __Pyx_PyFrame_GetLocalsplus(frame)\
2410 (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
2411 #endif
2412 #endif
2413 #endif
2414
2415 /* PyObjectCall.proto */
2416 #if CYTHON_COMPILING_IN_CPYTHON
2417 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
2418 #else
2419 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
2420 #endif
2421
2422 /* PyObjectCallMethO.proto */
2423 #if CYTHON_COMPILING_IN_CPYTHON
2424 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
2425 #endif
2426
2427 /* PyObjectFastCall.proto */
2428 #define __Pyx_PyObject_FastCall(func, args, nargs) __Pyx_PyObject_FastCallDict(func, args, (size_t)(nargs), NULL)
2429 static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs);
2430
2431 /* WriteUnraisableException.proto */
2432 static void __Pyx_WriteUnraisable(const char *name, int clineno,
2433 int lineno, const char *filename,
2434 int full_traceback, int nogil);
2435
2436 /* RaiseException.proto */
2437 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
2438
2439 /* KeywordStringCheck.proto */
2440 static int __Pyx_CheckKeywordStrings(PyObject *kw, const char* function_name, int kw_allowed);
2441
2442 /* PySequenceContains.proto */
2443 static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) {
2444 int result = PySequence_Contains(seq, item);
2445 return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
2446 }
2447
2448 /* ListAppend.proto */
2449 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
2450 static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
2451 PyListObject* L = (PyListObject*) list;
2452 Py_ssize_t len = Py_SIZE(list);
2453 if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
2454 Py_INCREF(x);
2455 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000
2456 L->ob_item[len] = x;
2457 #else
2458 PyList_SET_ITEM(list, len, x);
2459 #endif
2460 __Pyx_SET_SIZE(list, len + 1);
2461 return 0;
2462 }
2463 return PyList_Append(list, x);
2464 }
2465 #else
2466 #define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
2467 #endif
2468
2469 /* PyObjectCall2Args.proto */
2470 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
2471
2472 /* PyObjectCallOneArg.proto */
2473 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
2474
2475 /* PyObjectGetMethod.proto */
2476 static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method);
2477
2478 /* PyObjectCallMethod1.proto */
2479 static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg);
2480
2481 /* StringJoin.proto */
2482 #if PY_MAJOR_VERSION < 3
2483 #define __Pyx_PyString_Join __Pyx_PyBytes_Join
2484 #define __Pyx_PyBaseString_Join(s, v) (PyUnicode_CheckExact(s) ? PyUnicode_Join(s, v) : __Pyx_PyBytes_Join(s, v))
2485 #else
2486 #define __Pyx_PyString_Join PyUnicode_Join
2487 #define __Pyx_PyBaseString_Join PyUnicode_Join
2488 #endif
2489 static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values);
2490
2491 /* PyObjectCallNoArg.proto */
2492 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
2493
2494 /* ArgTypeTest.proto */
2495 #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
2496 ((likely(__Pyx_IS_TYPE(obj, type) | (none_allowed && (obj == Py_None)))) ? 1 :\
2497 __Pyx__ArgTypeTest(obj, type, name, exact))
2498 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);
2499
2500 /* PyObjectSetAttrStr.proto */
2501 #if CYTHON_USE_TYPE_SLOTS
2502 #define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o, n, NULL)
2503 static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value);
2504 #else
2505 #define __Pyx_PyObject_DelAttrStr(o,n) PyObject_DelAttr(o,n)
2506 #define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
2507 #endif
2508
2509 /* PyObjectFormatSimple.proto */
2510 #if CYTHON_COMPILING_IN_PYPY
2511 #define __Pyx_PyObject_FormatSimple(s, f) (\
2512 likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\
2513 PyObject_Format(s, f))
2514 #elif PY_MAJOR_VERSION < 3
2515 #define __Pyx_PyObject_FormatSimple(s, f) (\
2516 likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\
2517 likely(PyString_CheckExact(s)) ? PyUnicode_FromEncodedObject(s, NULL, "strict") :\
2518 PyObject_Format(s, f))
2519 #elif CYTHON_USE_TYPE_SLOTS
2520 #define __Pyx_PyObject_FormatSimple(s, f) (\
2521 likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\
2522 likely(PyLong_CheckExact(s)) ? PyLong_Type.tp_repr(s) :\
2523 likely(PyFloat_CheckExact(s)) ? PyFloat_Type.tp_repr(s) :\
2524 PyObject_Format(s, f))
2525 #else
2526 #define __Pyx_PyObject_FormatSimple(s, f) (\
2527 likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\
2528 PyObject_Format(s, f))
2529 #endif
2530
2531 /* JoinPyUnicode.proto */
2532 static PyObject* __Pyx_PyUnicode_Join(PyObject* value_tuple, Py_ssize_t value_count, Py_ssize_t result_ulength,
2533 Py_UCS4 max_char);
2534
2535 /* PyDictVersioning.proto */
2536 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
2537 #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
2538 #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
2539 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
2540 (version_var) = __PYX_GET_DICT_VERSION(dict);\
2541 (cache_var) = (value);
2542 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
2543 static PY_UINT64_T __pyx_dict_version = 0;\
2544 static PyObject *__pyx_dict_cached_value = NULL;\
2545 if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
2546 (VAR) = __pyx_dict_cached_value;\
2547 } else {\
2548 (VAR) = __pyx_dict_cached_value = (LOOKUP);\
2549 __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
2550 }\
2551 }
2552 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
2553 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
2554 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
2555 #else
2556 #define __PYX_GET_DICT_VERSION(dict) (0)
2557 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
2558 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
2559 #endif
2560
2561 /* GetModuleGlobalName.proto */
2562 #if CYTHON_USE_DICT_VERSIONS
2563 #define __Pyx_GetModuleGlobalName(var, name) do {\
2564 static PY_UINT64_T __pyx_dict_version = 0;\
2565 static PyObject *__pyx_dict_cached_value = NULL;\
2566 (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
2567 (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
2568 __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
2569 } while(0)
2570 #define __Pyx_GetModuleGlobalNameUncached(var, name) do {\
2571 PY_UINT64_T __pyx_dict_version;\
2572 PyObject *__pyx_dict_cached_value;\
2573 (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
2574 } while(0)
2575 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
2576 #else
2577 #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name)
2578 #define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name)
2579 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
2580 #endif
2581
2582 /* GetItemInt.proto */
2583 #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
2584 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
2585 __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
2586 (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
2587 __Pyx_GetItemInt_Generic(o, to_py_func(i))))
2588 #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
2589 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
2590 __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
2591 (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
2592 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
2593 int wraparound, int boundscheck);
2594 #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
2595 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
2596 __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
2597 (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
2598 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
2599 int wraparound, int boundscheck);
2600 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
2601 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
2602 int is_list, int wraparound, int boundscheck);
2603
2604 /* ObjectGetItem.proto */
2605 #if CYTHON_USE_TYPE_SLOTS
2606 static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key);
2607 #else
2608 #define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key)
2609 #endif
2610
2611 /* GetException.proto */
2612 #if CYTHON_FAST_THREAD_STATE
2613 #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
2614 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
2615 #else
2616 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
2617 #endif
2618
2619 /* SwapException.proto */
2620 #if CYTHON_FAST_THREAD_STATE
2621 #define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
2622 static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
2623 #else
2624 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
2625 #endif
2626
2627 /* GetTopmostException.proto */
2628 #if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE
2629 static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
2630 #endif
2631
2632 /* SaveResetException.proto */
2633 #if CYTHON_FAST_THREAD_STATE
2634 #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
2635 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
2636 #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
2637 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
2638 #else
2639 #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
2640 #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
2641 #endif
2642
2643 /* PyIntBinop.proto */
2644 #if !CYTHON_COMPILING_IN_PYPY
2645 static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
2646 #else
2647 #define __Pyx_PyInt_SubtractObjC(op1, op2, intval, inplace, zerodivision_check)\
2648 (inplace ? PyNumber_InPlaceSubtract(op1, op2) : PyNumber_Subtract(op1, op2))
2649 #endif
2650
2651 /* PyObject_Unicode.proto */
2652 #if PY_MAJOR_VERSION >= 3
2653 #define __Pyx_PyObject_Unicode(obj)\
2654 (likely(PyUnicode_CheckExact(obj)) ? __Pyx_NewRef(obj) : PyObject_Str(obj))
2655 #else
2656 #define __Pyx_PyObject_Unicode(obj)\
2657 (likely(PyUnicode_CheckExact(obj)) ? __Pyx_NewRef(obj) : PyObject_Unicode(obj))
2658 #endif
2659
2660 /* RaiseTooManyValuesToUnpack.proto */
2661 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
2662
2663 /* RaiseNeedMoreValuesToUnpack.proto */
2664 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
2665
2666 /* IterFinish.proto */
2667 static CYTHON_INLINE int __Pyx_IterFinish(void);
2668
2669 /* UnpackItemEndCheck.proto */
2670 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);
2671
2672 /* PyIntCompare.proto */
2673 static CYTHON_INLINE PyObject* __Pyx_PyInt_NeObjC(PyObject *op1, PyObject *op2, long intval, long inplace);
2674
2675 /* IncludeStructmemberH.proto */
2676 #include <structmember.h>
2677
2678 /* FixUpExtensionType.proto */
2679 #if CYTHON_USE_TYPE_SPECS
2680 static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type);
2681 #endif
2682
2683 /* PyObjectCallMethod0.proto */
2684 static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name);
2685
2686 /* ValidateBasesTuple.proto */
2687 #if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS
2688 static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases);
2689 #endif
2690
2691 /* PyType_Ready.proto */
2692 CYTHON_UNUSED static int __Pyx_PyType_Ready(PyTypeObject *t);
2693
2694 /* PyObject_GenericGetAttrNoDict.proto */
2695 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
2696 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
2697 #else
2698 #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
2699 #endif
2700
2701 /* PyObject_GenericGetAttr.proto */
2702 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
2703 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
2704 #else
2705 #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
2706 #endif
2707
2708 /* SetVTable.proto */
2709 static int __Pyx_SetVtable(PyTypeObject* typeptr , void* vtable);
2710
2711 /* GetVTable.proto */
2712 static void* __Pyx_GetVtable(PyTypeObject *type);
2713
2714 /* MergeVTables.proto */
2715 #if !CYTHON_COMPILING_IN_LIMITED_API
2716 static int __Pyx_MergeVtables(PyTypeObject *type);
2717 #endif
2718
2719 /* SetupReduce.proto */
2720 #if !CYTHON_COMPILING_IN_LIMITED_API
2721 static int __Pyx_setup_reduce(PyObject* type_obj);
2722 #endif
2723
2724 /* TypeImport.proto */
2725 #ifndef __PYX_HAVE_RT_ImportType_proto_3_0_11
2726 #define __PYX_HAVE_RT_ImportType_proto_3_0_11
2727 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
2728 #include <stdalign.h>
2729 #endif
2730 #if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || __cplusplus >= 201103L
2731 #define __PYX_GET_STRUCT_ALIGNMENT_3_0_11(s) alignof(s)
2732 #else
2733 #define __PYX_GET_STRUCT_ALIGNMENT_3_0_11(s) sizeof(void*)
2734 #endif
2735 enum __Pyx_ImportType_CheckSize_3_0_11 {
2736 __Pyx_ImportType_CheckSize_Error_3_0_11 = 0,
2737 __Pyx_ImportType_CheckSize_Warn_3_0_11 = 1,
2738 __Pyx_ImportType_CheckSize_Ignore_3_0_11 = 2
2739 };
2740 static PyTypeObject *__Pyx_ImportType_3_0_11(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_11 check_size);
2741 #endif
2742
2743 /* Import.proto */
2744 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
2745
2746 /* ImportDottedModule.proto */
2747 static PyObject *__Pyx_ImportDottedModule(PyObject *name, PyObject *parts_tuple);
2748 #if PY_MAJOR_VERSION >= 3
2749 static PyObject *__Pyx_ImportDottedModule_WalkParts(PyObject *module, PyObject *name, PyObject *parts_tuple);
2750 #endif
2751
2752 /* ImportFrom.proto */
2753 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
2754
2755 /* FetchSharedCythonModule.proto */
2756 static PyObject *__Pyx_FetchSharedCythonABIModule(void);
2757
2758 /* FetchCommonType.proto */
2759 #if !CYTHON_USE_TYPE_SPECS
2760 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);
2761 #else
2762 static PyTypeObject* __Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases);
2763 #endif
2764
2765 /* PyMethodNew.proto */
2766 #if CYTHON_COMPILING_IN_LIMITED_API
2767 static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) {
2768 PyObject *typesModule=NULL, *methodType=NULL, *result=NULL;
2769 CYTHON_UNUSED_VAR(typ);
2770 if (!self)
2771 return __Pyx_NewRef(func);
2772 typesModule = PyImport_ImportModule("types");
2773 if (!typesModule) return NULL;
2774 methodType = PyObject_GetAttrString(typesModule, "MethodType");
2775 Py_DECREF(typesModule);
2776 if (!methodType) return NULL;
2777 result = PyObject_CallFunctionObjArgs(methodType, func, self, NULL);
2778 Py_DECREF(methodType);
2779 return result;
2780 }
2781 #elif PY_MAJOR_VERSION >= 3
2782 static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) {
2783 CYTHON_UNUSED_VAR(typ);
2784 if (!self)
2785 return __Pyx_NewRef(func);
2786 return PyMethod_New(func, self);
2787 }
2788 #else
2789 #define __Pyx_PyMethod_New PyMethod_New
2790 #endif
2791
2792 /* PyVectorcallFastCallDict.proto */
2793 #if CYTHON_METH_FASTCALL
2794 static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw);
2795 #endif
2796
2797 /* CythonFunctionShared.proto */
2798 #define __Pyx_CyFunction_USED
2799 #define __Pyx_CYFUNCTION_STATICMETHOD 0x01
2800 #define __Pyx_CYFUNCTION_CLASSMETHOD 0x02
2801 #define __Pyx_CYFUNCTION_CCLASS 0x04
2802 #define __Pyx_CYFUNCTION_COROUTINE 0x08
2803 #define __Pyx_CyFunction_GetClosure(f)\
2804 (((__pyx_CyFunctionObject *) (f))->func_closure)
2805 #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
2806 #define __Pyx_CyFunction_GetClassObj(f)\
2807 (((__pyx_CyFunctionObject *) (f))->func_classobj)
2808 #else
2809 #define __Pyx_CyFunction_GetClassObj(f)\
2810 ((PyObject*) ((PyCMethodObject *) (f))->mm_class)
2811 #endif
2812 #define __Pyx_CyFunction_SetClassObj(f, classobj)\
2813 __Pyx__CyFunction_SetClassObj((__pyx_CyFunctionObject *) (f), (classobj))
2814 #define __Pyx_CyFunction_Defaults(type, f)\
2815 ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
2816 #define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
2817 ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
2818 typedef struct {
2819 #if CYTHON_COMPILING_IN_LIMITED_API
2820 PyObject_HEAD
2821 PyObject *func;
2822 #elif PY_VERSION_HEX < 0x030900B1
2823 PyCFunctionObject func;
2824 #else
2825 PyCMethodObject func;
2826 #endif
2827 #if CYTHON_BACKPORT_VECTORCALL
2828 __pyx_vectorcallfunc func_vectorcall;
2829 #endif
2830 #if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API
2831 PyObject *func_weakreflist;
2832 #endif
2833 PyObject *func_dict;
2834 PyObject *func_name;
2835 PyObject *func_qualname;
2836 PyObject *func_doc;
2837 PyObject *func_globals;
2838 PyObject *func_code;
2839 PyObject *func_closure;
2840 #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
2841 PyObject *func_classobj;
2842 #endif
2843 void *defaults;
2844 int defaults_pyobjects;
2845 size_t defaults_size;
2846 int flags;
2847 PyObject *defaults_tuple;
2848 PyObject *defaults_kwdict;
2849 PyObject *(*defaults_getter)(PyObject *);
2850 PyObject *func_annotations;
2851 PyObject *func_is_coroutine;
2852 } __pyx_CyFunctionObject;
2853 #undef __Pyx_CyOrPyCFunction_Check
2854 #define __Pyx_CyFunction_Check(obj) __Pyx_TypeCheck(obj, __pyx_CyFunctionType)
2855 #define __Pyx_CyOrPyCFunction_Check(obj) __Pyx_TypeCheck2(obj, __pyx_CyFunctionType, &PyCFunction_Type)
2856 #define __Pyx_CyFunction_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_CyFunctionType)
2857 static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void *cfunc);
2858 #undef __Pyx_IsSameCFunction
2859 #define __Pyx_IsSameCFunction(func, cfunc) __Pyx__IsSameCyOrCFunction(func, cfunc)
2860 static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml,
2861 int flags, PyObject* qualname,
2862 PyObject *closure,
2863 PyObject *module, PyObject *globals,
2864 PyObject* code);
2865 static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj);
2866 static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
2867 size_t size,
2868 int pyobjects);
2869 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
2870 PyObject *tuple);
2871 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
2872 PyObject *dict);
2873 static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
2874 PyObject *dict);
2875 static int __pyx_CyFunction_init(PyObject *module);
2876 #if CYTHON_METH_FASTCALL
2877 static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
2878 static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
2879 static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
2880 static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
2881 #if CYTHON_BACKPORT_VECTORCALL
2882 #define __Pyx_CyFunction_func_vectorcall(f) (((__pyx_CyFunctionObject*)f)->func_vectorcall)
2883 #else
2884 #define __Pyx_CyFunction_func_vectorcall(f) (((PyCFunctionObject*)f)->vectorcall)
2885 #endif
2886 #endif
2887
2888 /* CythonFunction.proto */
2889 static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml,
2890 int flags, PyObject* qualname,
2891 PyObject *closure,
2892 PyObject *module, PyObject *globals,
2893 PyObject* code);
2894
2895 /* Py3UpdateBases.proto */
2896 static PyObject* __Pyx_PEP560_update_bases(PyObject *bases);
2897
2898 /* CalculateMetaclass.proto */
2899 static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases);
2900
2901 /* SetNameInClass.proto */
2902 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && PY_VERSION_HEX < 0x030d0000
2903 #define __Pyx_SetNameInClass(ns, name, value)\
2904 (likely(PyDict_CheckExact(ns)) ? _PyDict_SetItem_KnownHash(ns, name, value, ((PyASCIIObject *) name)->hash) : PyObject_SetItem(ns, name, value))
2905 #elif CYTHON_COMPILING_IN_CPYTHON
2906 #define __Pyx_SetNameInClass(ns, name, value)\
2907 (likely(PyDict_CheckExact(ns)) ? PyDict_SetItem(ns, name, value) : PyObject_SetItem(ns, name, value))
2908 #else
2909 #define __Pyx_SetNameInClass(ns, name, value) PyObject_SetItem(ns, name, value)
2910 #endif
2911
2912 /* PyObjectLookupSpecial.proto */
2913 #if CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
2914 #define __Pyx_PyObject_LookupSpecialNoError(obj, attr_name) __Pyx__PyObject_LookupSpecial(obj, attr_name, 0)
2915 #define __Pyx_PyObject_LookupSpecial(obj, attr_name) __Pyx__PyObject_LookupSpecial(obj, attr_name, 1)
2916 static CYTHON_INLINE PyObject* __Pyx__PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name, int with_error);
2917 #else
2918 #define __Pyx_PyObject_LookupSpecialNoError(o,n) __Pyx_PyObject_GetAttrStrNoError(o,n)
2919 #define __Pyx_PyObject_LookupSpecial(o,n) __Pyx_PyObject_GetAttrStr(o,n)
2920 #endif
2921
2922 /* Py3ClassCreate.proto */
2923 static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname,
2924 PyObject *mkw, PyObject *modname, PyObject *doc);
2925 static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict,
2926 PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass);
2927
2928 /* CLineInTraceback.proto */
2929 #ifdef CYTHON_CLINE_IN_TRACEBACK
2930 #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
2931 #else
2932 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
2933 #endif
2934
2935 /* CodeObjectCache.proto */
2936 #if !CYTHON_COMPILING_IN_LIMITED_API
2937 typedef struct {
2938 PyCodeObject* code_object;
2939 int code_line;
2940 } __Pyx_CodeObjectCacheEntry;
2941 struct __Pyx_CodeObjectCache {
2942 int count;
2943 int max_count;
2944 __Pyx_CodeObjectCacheEntry* entries;
2945 };
2946 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
2947 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
2948 static PyCodeObject *__pyx_find_code_object(int code_line);
2949 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
2950 #endif
2951
2952 /* AddTraceback.proto */
2953 static void __Pyx_AddTraceback(const char *funcname, int c_line,
2954 int py_line, const char *filename);
2955
2956 /* GCCDiagnostics.proto */
2957 #if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
2958 #define __Pyx_HAS_GCC_DIAGNOSTIC
2959 #endif
2960
2961 /* ArrayAPI.proto */
2962 #ifndef _ARRAYARRAY_H
2963 #define _ARRAYARRAY_H
2964 typedef struct arraydescr {
2965 int typecode;
2966 int itemsize;
2967 PyObject * (*getitem)(struct arrayobject *, Py_ssize_t);
2968 int (*setitem)(struct arrayobject *, Py_ssize_t, PyObject *);
2969 #if PY_MAJOR_VERSION >= 3
2970 char *formats;
2971 #endif
2972 } arraydescr;
2973 struct arrayobject {
2974 PyObject_HEAD
2975 Py_ssize_t ob_size;
2976 union {
2977 char *ob_item;
2978 float *as_floats;
2979 double *as_doubles;
2980 int *as_ints;
2981 unsigned int *as_uints;
2982 unsigned char *as_uchars;
2983 signed char *as_schars;
2984 char *as_chars;
2985 unsigned long *as_ulongs;
2986 long *as_longs;
2987 #if PY_MAJOR_VERSION >= 3
2988 unsigned long long *as_ulonglongs;
2989 long long *as_longlongs;
2990 #endif
2991 short *as_shorts;
2992 unsigned short *as_ushorts;
2993 Py_UNICODE *as_pyunicodes;
2994 void *as_voidptr;
2995 } data;
2996 Py_ssize_t allocated;
2997 struct arraydescr *ob_descr;
2998 PyObject *weakreflist;
2999 #if PY_MAJOR_VERSION >= 3
3000 int ob_exports;
3001 #endif
3002 };
3003 #ifndef NO_NEWARRAY_INLINE
3004 static CYTHON_INLINE PyObject * newarrayobject(PyTypeObject *type, Py_ssize_t size,
3005 struct arraydescr *descr) {
3006 arrayobject *op;
3007 size_t nbytes;
3008 if (size < 0) {
3009 PyErr_BadInternalCall();
3010 return NULL;
3011 }
3012 nbytes = size * descr->itemsize;
3013 if (nbytes / descr->itemsize != (size_t)size) {
3014 return PyErr_NoMemory();
3015 }
3016 op = (arrayobject *) type->tp_alloc(type, 0);
3017 if (op == NULL) {
3018 return NULL;
3019 }
3020 op->ob_descr = descr;
3021 op->allocated = size;
3022 op->weakreflist = NULL;
3023 __Pyx_SET_SIZE(op, size);
3024 if (size <= 0) {
3025 op->data.ob_item = NULL;
3026 }
3027 else {
3028 op->data.ob_item = PyMem_NEW(char, nbytes);
3029 if (op->data.ob_item == NULL) {
3030 Py_DECREF(op);
3031 return PyErr_NoMemory();
3032 }
3033 }
3034 return (PyObject *) op;
3035 }
3036 #else
3037 PyObject* newarrayobject(PyTypeObject *type, Py_ssize_t size,
3038 struct arraydescr *descr);
3039 #endif
3040 static CYTHON_INLINE int resize(arrayobject *self, Py_ssize_t n) {
3041 void *items = (void*) self->data.ob_item;
3042 PyMem_Resize(items, char, (size_t)(n * self->ob_descr->itemsize));
3043 if (items == NULL) {
3044 PyErr_NoMemory();
3045 return -1;
3046 }
3047 self->data.ob_item = (char*) items;
3048 __Pyx_SET_SIZE(self, n);
3049 self->allocated = n;
3050 return 0;
3051 }
3052 static CYTHON_INLINE int resize_smart(arrayobject *self, Py_ssize_t n) {
3053 void *items = (void*) self->data.ob_item;
3054 Py_ssize_t newsize;
3055 if (n < self->allocated && n*4 > self->allocated) {
3056 __Pyx_SET_SIZE(self, n);
3057 return 0;
3058 }
3059 newsize = n + (n / 2) + 1;
3060 if (newsize <= n) {
3061 PyErr_NoMemory();
3062 return -1;
3063 }
3064 PyMem_Resize(items, char, (size_t)(newsize * self->ob_descr->itemsize));
3065 if (items == NULL) {
3066 PyErr_NoMemory();
3067 return -1;
3068 }
3069 self->data.ob_item = (char*) items;
3070 __Pyx_SET_SIZE(self, n);
3071 self->allocated = newsize;
3072 return 0;
3073 }
3074 #endif
3075
3076 /* CIntFromPy.proto */
3077 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
3078
3079 /* CIntToPy.proto */
3080 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
3081
3082 /* CIntFromPy.proto */
3083 static CYTHON_INLINE uint64_t __Pyx_PyInt_As_uint64_t(PyObject *);
3084
3085 /* CIntToPy.proto */
3086 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_off_t(off_t value);
3087
3088 /* CIntToPy.proto */
3089 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__htsFormatCategory(enum htsFormatCategory value);
3090
3091 /* CIntToPy.proto */
3092 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__htsExactFormat(enum htsExactFormat value);
3093
3094 /* CIntToPy.proto */
3095 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_short(short value);
3096
3097 /* CIntToPy.proto */
3098 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__htsCompression(enum htsCompression value);
3099
3100 /* CIntToPy.proto */
3101 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int64_t(int64_t value);
3102
3103 /* CIntFromPy.proto */
3104 static CYTHON_INLINE int32_t __Pyx_PyInt_As_int32_t(PyObject *);
3105
3106 /* CIntToPy.proto */
3107 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
3108
3109 /* CIntToPy.proto */
3110 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int32_t(int32_t value);
3111
3112 /* FormatTypeName.proto */
3113 #if CYTHON_COMPILING_IN_LIMITED_API
3114 typedef PyObject *__Pyx_TypeName;
3115 #define __Pyx_FMT_TYPENAME "%U"
3116 static __Pyx_TypeName __Pyx_PyType_GetName(PyTypeObject* tp);
3117 #define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj)
3118 #else
3119 typedef const char *__Pyx_TypeName;
3120 #define __Pyx_FMT_TYPENAME "%.200s"
3121 #define __Pyx_PyType_GetName(tp) ((tp)->tp_name)
3122 #define __Pyx_DECREF_TypeName(obj)
3123 #endif
3124
3125 /* CIntFromPy.proto */
3126 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
3127
3128 /* FastTypeChecks.proto */
3129 #if CYTHON_COMPILING_IN_CPYTHON
3130 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
3131 #define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2)
3132 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
3133 static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b);
3134 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
3135 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
3136 #else
3137 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
3138 #define __Pyx_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2))
3139 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
3140 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
3141 #endif
3142 #define __Pyx_PyErr_ExceptionMatches2(err1, err2) __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_CurrentExceptionType(), err1, err2)
3143 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
3144
3145 /* CheckBinaryVersion.proto */
3146 static unsigned long __Pyx_get_runtime_version(void);
3147 static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer);
3148
3149 /* FunctionImport.proto */
3150 static int __Pyx_ImportFunction_3_0_11(PyObject *module, const char *funcname, void (**f)(void), const char *sig);
3151
3152 /* InitStrings.proto */
3153 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
3154
3155 /* #### Code section: module_declarations ### */
3156 static CYTHON_INLINE double __pyx_f_7cpython_7complex_7complex_4real_real(PyComplexObject *__pyx_v_self); /* proto*/
3157 static CYTHON_INLINE double __pyx_f_7cpython_7complex_7complex_4imag_imag(PyComplexObject *__pyx_v_self); /* proto*/
3158 static PyObject *__pyx_f_5pysam_10libchtslib_5HFile__open(struct __pyx_obj_5pysam_10libchtslib_HFile *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_mode, struct __pyx_opt_args_5pysam_10libchtslib_5HFile__open *__pyx_optional_args); /* proto*/
3159 static htsFile *__pyx_f_5pysam_10libchtslib_7HTSFile__open_htsfile(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self); /* proto*/
3160
3161 /* Module declarations from "libc.stdint" */
3162
3163 /* Module declarations from "libc.string" */
3164
3165 /* Module declarations from "libc.stdlib" */
3166
3167 /* Module declarations from "libc.stdio" */
3168
3169 /* Module declarations from "posix.types" */
3170
3171 /* Module declarations from "posix.unistd" */
3172
3173 /* Module declarations from "libc.errno" */
3174
3175 /* Module declarations from "cpython.version" */
3176
3177 /* Module declarations from "__builtin__" */
3178
3179 /* Module declarations from "cpython.type" */
3180
3181 /* Module declarations from "cpython.object" */
3182
3183 /* Module declarations from "cpython.ref" */
3184
3185 /* Module declarations from "cpython.exc" */
3186
3187 /* Module declarations from "cpython.module" */
3188
3189 /* Module declarations from "cpython.mem" */
3190
3191 /* Module declarations from "cpython.tuple" */
3192
3193 /* Module declarations from "cpython.list" */
3194
3195 /* Module declarations from "cpython.sequence" */
3196
3197 /* Module declarations from "cpython.mapping" */
3198
3199 /* Module declarations from "cpython.iterator" */
3200
3201 /* Module declarations from "cpython.number" */
3202
3203 /* Module declarations from "cpython.int" */
3204
3205 /* Module declarations from "__builtin__" */
3206
3207 /* Module declarations from "cpython.bool" */
3208
3209 /* Module declarations from "cpython.long" */
3210
3211 /* Module declarations from "cpython.float" */
3212
3213 /* Module declarations from "__builtin__" */
3214
3215 /* Module declarations from "cpython.complex" */
3216
3217 /* Module declarations from "cpython.string" */
3218
3219 /* Module declarations from "libc.stddef" */
3220
3221 /* Module declarations from "cpython.unicode" */
3222
3223 /* Module declarations from "cpython.pyport" */
3224
3225 /* Module declarations from "cpython.dict" */
3226
3227 /* Module declarations from "cpython.instance" */
3228
3229 /* Module declarations from "cpython.function" */
3230
3231 /* Module declarations from "cpython.method" */
3232
3233 /* Module declarations from "cpython.weakref" */
3234
3235 /* Module declarations from "cpython.getargs" */
3236
3237 /* Module declarations from "cpython.pythread" */
3238
3239 /* Module declarations from "cpython.pystate" */
3240
3241 /* Module declarations from "cpython.cobject" */
3242
3243 /* Module declarations from "cpython.oldbuffer" */
3244
3245 /* Module declarations from "cpython.set" */
3246
3247 /* Module declarations from "cpython.buffer" */
3248
3249 /* Module declarations from "cpython.bytes" */
3250
3251 /* Module declarations from "cpython.pycapsule" */
3252
3253 /* Module declarations from "cpython.contextvars" */
3254
3255 /* Module declarations from "cpython" */
3256
3257 /* Module declarations from "cython" */
3258
3259 /* Module declarations from "array" */
3260
3261 /* Module declarations from "cpython.array" */
3262 static CYTHON_INLINE int __pyx_f_7cpython_5array_extend_buffer(arrayobject *, char *, Py_ssize_t); /*proto*/
3263
3264 /* Module declarations from "pysam.libcutils" */
3265 static int (*__pyx_f_5pysam_9libcutils_libc_whence_from_io)(int); /*proto*/
3266 static PyObject *(*__pyx_f_5pysam_9libcutils_charptr_to_str)(char const *, struct __pyx_opt_args_5pysam_9libcutils_charptr_to_str *__pyx_optional_args); /*proto*/
3267 static PyObject *(*__pyx_f_5pysam_9libcutils_charptr_to_str_w_len)(char const *, size_t, struct __pyx_opt_args_5pysam_9libcutils_charptr_to_str_w_len *__pyx_optional_args); /*proto*/
3268 static PyObject *(*__pyx_f_5pysam_9libcutils_force_str)(PyObject *, struct __pyx_opt_args_5pysam_9libcutils_force_str *__pyx_optional_args); /*proto*/
3269 static PyObject *(*__pyx_f_5pysam_9libcutils_force_bytes)(PyObject *, struct __pyx_opt_args_5pysam_9libcutils_force_bytes *__pyx_optional_args); /*proto*/
3270 static PyObject *(*__pyx_f_5pysam_9libcutils_encode_filename)(PyObject *); /*proto*/
3271 static PyObject *(*__pyx_f_5pysam_9libcutils_from_string_and_size)(char const *, size_t); /*proto*/
3272
3273 /* Module declarations from "pysam.libchtslib" */
3274 static int __pyx_v_5pysam_10libchtslib_MAX_POS;
3275 static PyObject *__pyx_v_5pysam_10libchtslib_FORMAT_CATEGORIES = 0;
3276 static PyObject *__pyx_v_5pysam_10libchtslib_FORMATS = 0;
3277 static PyObject *__pyx_v_5pysam_10libchtslib_COMPRESSION = 0;
3278 static PyObject *__pyx_f_5pysam_10libchtslib_set_verbosity(int, int __pyx_skip_dispatch); /*proto*/
3279 static PyObject *__pyx_f_5pysam_10libchtslib_get_verbosity(int __pyx_skip_dispatch); /*proto*/
3280 /* #### Code section: typeinfo ### */
3281 /* #### Code section: before_global_var ### */
3282 #define __Pyx_MODULE_NAME "pysam.libchtslib"
3283 extern int __pyx_module_is_main_pysam__libchtslib;
3284 int __pyx_module_is_main_pysam__libchtslib = 0;
3285
3286 /* Implementation of "pysam.libchtslib" */
3287 /* #### Code section: global_var ### */
3288 static PyObject *__pyx_builtin_object;
3289 static PyObject *__pyx_builtin_IOError;
3290 static PyObject *__pyx_builtin_AttributeError;
3291 static PyObject *__pyx_builtin_StopIteration;
3292 static PyObject *__pyx_builtin_NotImplementedError;
3293 static PyObject *__pyx_builtin_TypeError;
3294 static PyObject *__pyx_builtin_OSError;
3295 static PyObject *__pyx_builtin_ValueError;
3296 static PyObject *__pyx_builtin_RuntimeError;
3297 static PyObject *__pyx_builtin_OverflowError;
3298 static PyObject *__pyx_builtin_IndexError;
3299 static PyObject *__pyx_builtin_MemoryError;
3300 /* #### Code section: string_decls ### */
3301 static const char __pyx_k_b[] = "b";
3302 static const char __pyx_k_c[] = "c";
3303 static const char __pyx_k_r[] = "r";
3304 static const char __pyx_k_w[] = "w";
3305 static const char __pyx_k_eq[] = "__eq__";
3306 static const char __pyx_k_fd[] = "<fd:{}>";
3307 static const char __pyx_k_fp[] = "fp";
3308 static const char __pyx_k_gc[] = "gc";
3309 static const char __pyx_k_io[] = "io";
3310 static const char __pyx_k_mv[] = "mv";
3311 static const char __pyx_k_ne[] = "__ne__";
3312 static const char __pyx_k_os[] = "os";
3313 static const char __pyx_k_re[] = "re";
3314 static const char __pyx_k_tb[] = "tb";
3315 static const char __pyx_k_BAI[] = "BAI";
3316 static const char __pyx_k_BAM[] = "BAM";
3317 static const char __pyx_k_BCF[] = "BCF";
3318 static const char __pyx_k_BED[] = "BED";
3319 static const char __pyx_k_CSI[] = "CSI";
3320 static const char __pyx_k_GZI[] = "GZI";
3321 static const char __pyx_k_SAM[] = "SAM";
3322 static const char __pyx_k_TBI[] = "TBI";
3323 static const char __pyx_k_VCF[] = "VCF";
3324 static const char __pyx_k__13[] = "";
3325 static const char __pyx_k__55[] = ":";
3326 static const char __pyx_k__56[] = "-";
3327 static const char __pyx_k__58[] = "*";
3328 static const char __pyx_k__59[] = ".";
3329 static const char __pyx_k__97[] = "?";
3330 static const char __pyx_k_all[] = "__all__";
3331 static const char __pyx_k_buf[] = "buf";
3332 static const char __pyx_k_doc[] = "__doc__";
3333 static const char __pyx_k_end[] = "end";
3334 static const char __pyx_k_got[] = "got";
3335 static const char __pyx_k_msg[] = "msg";
3336 static const char __pyx_k_off[] = "off";
3337 static const char __pyx_k_ret[] = "ret";
3338 static const char __pyx_k_tid[] = "tid";
3339 static const char __pyx_k_BGZF[] = "BGZF";
3340 static const char __pyx_k_CRAI[] = "CRAI";
3341 static const char __pyx_k_CRAM[] = "CRAM";
3342 static const char __pyx_k_GZIP[] = "GZIP";
3343 static const char __pyx_k_NONE[] = "NONE";
3344 static const char __pyx_k_bool[] = "__bool__";
3345 static const char __pyx_k_call[] = "__call__";
3346 static const char __pyx_k_dict[] = "__dict__";
3347 static const char __pyx_k_exit[] = "__exit__";
3348 static const char __pyx_k_init[] = "__init__";
3349 static const char __pyx_k_join[] = "join";
3350 static const char __pyx_k_line[] = "line";
3351 static const char __pyx_k_main[] = "__main__";
3352 static const char __pyx_k_mode[] = "mode";
3353 static const char __pyx_k_name[] = "name";
3354 static const char __pyx_k_opts[] = "opts";
3355 static const char __pyx_k_part[] = "part";
3356 static const char __pyx_k_read[] = "read";
3357 static const char __pyx_k_rtid[] = "rtid";
3358 static const char __pyx_k_rval[] = "rval";
3359 static const char __pyx_k_seek[] = "seek";
3360 static const char __pyx_k_self[] = "self";
3361 static const char __pyx_k_size[] = "size";
3362 static const char __pyx_k_spec[] = "__spec__";
3363 static const char __pyx_k_stop[] = "stop";
3364 static const char __pyx_k_tell[] = "tell";
3365 static const char __pyx_k_test[] = "__test__";
3366 static const char __pyx_k_type[] = "type";
3367 static const char __pyx_k_warn[] = "warn";
3368 static const char __pyx_k_CTrue[] = "CTrue";
3369 static const char __pyx_k_HFile[] = "HFile";
3370 static const char __pyx_k_INDEX[] = "INDEX";
3371 static const char __pyx_k_bgzfp[] = "bgzfp";
3372 static const char __pyx_k_close[] = "close";
3373 static const char __pyx_k_coord[] = "coord";
3374 static const char __pyx_k_cpart[] = "cpart";
3375 static const char __pyx_k_enter[] = "__enter__";
3376 static const char __pyx_k_flush[] = "flush";
3377 static const char __pyx_k_lines[] = "lines";
3378 static const char __pyx_k_other[] = "other";
3379 static const char __pyx_k_parts[] = "parts";
3380 static const char __pyx_k_reset[] = "reset";
3381 static const char __pyx_k_rstop[] = "rstop";
3382 static const char __pyx_k_split[] = "split";
3383 static const char __pyx_k_start[] = "start";
3384 static const char __pyx_k_super[] = "super";
3385 static const char __pyx_k_value[] = "value";
3386 static const char __pyx_k_write[] = "write";
3387 static const char __pyx_k_CFalse[] = "CFalse";
3388 static const char __pyx_k_CUSTOM[] = "CUSTOM";
3389 static const char __pyx_k_contig[] = "contig";
3390 static const char __pyx_k_enable[] = "enable";
3391 static const char __pyx_k_failed[] = " failed";
3392 static const char __pyx_k_fileno[] = "fileno";
3393 static const char __pyx_k_format[] = "format";
3394 static const char __pyx_k_import[] = "__import__";
3395 static const char __pyx_k_isatty[] = "isatty";
3396 static const char __pyx_k_module[] = "__module__";
3397 static const char __pyx_k_name_2[] = "__name__";
3398 static const char __pyx_k_object[] = "object";
3399 static const char __pyx_k_offset[] = "offset";
3400 static const char __pyx_k_reduce[] = "__reduce__";
3401 static const char __pyx_k_region[] = "region";
3402 static const char __pyx_k_rstart[] = "rstart";
3403 static const char __pyx_k_whence[] = "whence";
3404 static const char __pyx_k_HTSFile[] = "HTSFile";
3405 static const char __pyx_k_IOError[] = "IOError";
3406 static const char __pyx_k_OSError[] = "OSError";
3407 static const char __pyx_k_REGIONS[] = "REGIONS";
3408 static const char __pyx_k_UNKNOWN[] = "UNKNOWN";
3409 static const char __pyx_k_closefd[] = "closefd";
3410 static const char __pyx_k_disable[] = "disable";
3411 static const char __pyx_k_get_tid[] = "get_tid";
3412 static const char __pyx_k_is_open[] = "is_open";
3413 static const char __pyx_k_nonzero[] = "__nonzero__";
3414 static const char __pyx_k_prepare[] = "__prepare__";
3415 static const char __pyx_k_readall[] = "readall";
3416 static const char __pyx_k_replace[] = "replace";
3417 static const char __pyx_k_Flushing[] = "Flushing ";
3418 static const char __pyx_k_SEEK_SET[] = "SEEK_SET";
3419 static const char __pyx_k_VARIANTS[] = "VARIANTS";
3420 static const char __pyx_k_exc_type[] = "exc_type";
3421 static const char __pyx_k_getstate[] = "__getstate__";
3422 static const char __pyx_k_qualname[] = "__qualname__";
3423 static const char __pyx_k_readable[] = "readable";
3424 static const char __pyx_k_readinto[] = "readinto";
3425 static const char __pyx_k_readline[] = "readline";
3426 static const char __pyx_k_seekable[] = "seekable";
3427 static const char __pyx_k_set_name[] = "__set_name__";
3428 static const char __pyx_k_setstate[] = "__setstate__";
3429 static const char __pyx_k_truncate[] = "truncate";
3430 static const char __pyx_k_warnings[] = "warnings";
3431 static const char __pyx_k_writable[] = "writable";
3432 static const char __pyx_k_TypeError[] = "TypeError";
3433 static const char __pyx_k_exc_value[] = "exc_value";
3434 static const char __pyx_k_isenabled[] = "isenabled";
3435 static const char __pyx_k_metaclass[] = "__metaclass__";
3436 static const char __pyx_k_pyx_state[] = "__pyx_state";
3437 static const char __pyx_k_readlines[] = "readlines";
3438 static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
3439 static const char __pyx_k_reference[] = "reference";
3440 static const char __pyx_k_traceback[] = "traceback";
3441 static const char __pyx_k_verbosity[] = "verbosity";
3442 static const char __pyx_k_ALIGNMENTS[] = "ALIGNMENTS";
3443 static const char __pyx_k_HFile_read[] = "HFile.read";
3444 static const char __pyx_k_HFile_seek[] = "HFile.seek";
3445 static const char __pyx_k_HFile_tell[] = "HFile.tell";
3446 static const char __pyx_k_IndexError[] = "IndexError";
3447 static const char __pyx_k_ValueError[] = "ValueError";
3448 static const char __pyx_k_bytes_read[] = "bytes_read";
3449 static const char __pyx_k_chunk_size[] = "chunk_size";
3450 static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
3451 static const char __pyx_k_writelines[] = "writelines";
3452 static const char __pyx_k_HFile_close[] = "HFile.close";
3453 static const char __pyx_k_HFile_flush[] = "HFile.flush";
3454 static const char __pyx_k_HFile_write[] = "HFile.write";
3455 static const char __pyx_k_MemoryError[] = "MemoryError";
3456 static const char __pyx_k_TEXT_FORMAT[] = "TEXT_FORMAT";
3457 static const char __pyx_k_invalid_tid[] = "invalid tid";
3458 static const char __pyx_k_mro_entries[] = "__mro_entries__";
3459 static const char __pyx_k_HFile___exit[] = "HFile.__exit__";
3460 static const char __pyx_k_HFile_fileno[] = "HFile.fileno";
3461 static const char __pyx_k_HFile_isatty[] = "HFile.isatty";
3462 static const char __pyx_k_HTSFile_seek[] = "HTSFile.seek";
3463 static const char __pyx_k_HTSFile_tell[] = "HTSFile.tell";
3464 static const char __pyx_k_RuntimeError[] = "RuntimeError";
3465 static const char __pyx_k_initializing[] = "_initializing";
3466 static const char __pyx_k_is_coroutine[] = "_is_coroutine";
3467 static const char __pyx_k_is_valid_tid[] = "is_valid_tid";
3468 static const char __pyx_k_parse_region[] = "parse_region";
3469 static const char __pyx_k_stringsource[] = "<stringsource>";
3470 static const char __pyx_k_BINARY_FORMAT[] = "BINARY_FORMAT";
3471 static const char __pyx_k_CallableValue[] = "CallableValue";
3472 static const char __pyx_k_HFile___enter[] = "HFile.__enter__";
3473 static const char __pyx_k_HFile_readall[] = "HFile.readall";
3474 static const char __pyx_k_HTSFile_close[] = "HTSFile.close";
3475 static const char __pyx_k_HTSFile_flush[] = "HTSFile.flush";
3476 static const char __pyx_k_HTSFile_reset[] = "HTSFile.reset";
3477 static const char __pyx_k_OverflowError[] = "OverflowError";
3478 static const char __pyx_k_StopIteration[] = "StopIteration";
3479 static const char __pyx_k_class_getitem[] = "__class_getitem__";
3480 static const char __pyx_k_format_option[] = "format_option";
3481 static const char __pyx_k_get_verbosity[] = "get_verbosity";
3482 static const char __pyx_k_init_subclass[] = "__init_subclass__";
3483 static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
3484 static const char __pyx_k_set_verbosity[] = "set_verbosity";
3485 static const char __pyx_k_AttributeError[] = "AttributeError";
3486 static const char __pyx_k_HFile_readable[] = "HFile.readable";
3487 static const char __pyx_k_HFile_readinto[] = "HFile.readinto";
3488 static const char __pyx_k_HFile_readline[] = "HFile.readline";
3489 static const char __pyx_k_HFile_seekable[] = "HFile.seekable";
3490 static const char __pyx_k_HFile_truncate[] = "HFile.truncate";
3491 static const char __pyx_k_HFile_writable[] = "HFile.writable";
3492 static const char __pyx_k_HTSFile___exit[] = "HTSFile.__exit__";
3493 static const char __pyx_k_format_options[] = "format_options";
3494 static const char __pyx_k_HFile_readlines[] = "HFile.readlines";
3495 static const char __pyx_k_HTSFile___enter[] = "HTSFile.__enter__";
3496 static const char __pyx_k_HTSFile_get_tid[] = "HTSFile.get_tid";
3497 static const char __pyx_k_add_hts_options[] = "add_hts_options";
3498 static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
3499 static const char __pyx_k_HFile_writelines[] = "HFile.writelines";
3500 static const char __pyx_k_check_truncation[] = "check_truncation";
3501 static const char __pyx_k_invalid_contig_s[] = "invalid contig `%s`";
3502 static const char __pyx_k_pysam_libchtslib[] = "pysam.libchtslib";
3503 static const char __pyx_k_ignore_truncation[] = "ignore_truncation";
3504 static const char __pyx_k_CallableValue___eq[] = "CallableValue.__eq__";
3505 static const char __pyx_k_CallableValue___ne[] = "CallableValue.__ne__";
3506 static const char __pyx_k_asyncio_coroutines[] = "asyncio.coroutines";
3507 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
3508 static const char __pyx_k_get_reference_name[] = "get_reference_name";
3509 static const char __pyx_k_Cannot_create_hfile[] = "Cannot create hfile";
3510 static const char __pyx_k_NotImplementedError[] = "NotImplementedError";
3511 static const char __pyx_k_stop_out_of_range_i[] = "stop out of range (%i)";
3512 static const char __pyx_k_CallableValue___bool[] = "CallableValue.__bool__";
3513 static const char __pyx_k_CallableValue___call[] = "CallableValue.__call__";
3514 static const char __pyx_k_CallableValue___init[] = "CallableValue.__init__";
3515 static const char __pyx_k_HTSFile_is_valid_tid[] = "HTSFile.is_valid_tid";
3516 static const char __pyx_k_HTSFile_parse_region[] = "HTSFile.parse_region";
3517 static const char __pyx_k_failed_to_open_HFile[] = "failed to open HFile";
3518 static const char __pyx_k_failed_to_read_HFile[] = "failed to read HFile";
3519 static const char __pyx_k_fileno_not_available[] = "fileno not available";
3520 static const char __pyx_k_pysam_libchtslib_pyx[] = "pysam/libchtslib.pyx";
3521 static const char __pyx_k_seek_failed_on_HFile[] = "seek failed on HFile";
3522 static const char __pyx_k_start_out_of_range_i[] = "start out of range (%i)";
3523 static const char __pyx_k_tell_failed_on_HFile[] = "tell failed on HFile";
3524 static const char __pyx_k_HFile___reduce_cython[] = "HFile.__reduce_cython__";
3525 static const char __pyx_k_failed_to_close_HFile[] = "failed to close HFile";
3526 static const char __pyx_k_failed_to_flush_HFile[] = "failed to flush HFile";
3527 static const char __pyx_k_write_failed_on_HFile[] = "write failed on HFile";
3528 static const char __pyx_k_CallableValue___nonzero[] = "CallableValue.__nonzero__";
3529 static const char __pyx_k_HFile___setstate_cython[] = "HFile.__setstate_cython__";
3530 static const char __pyx_k_HTSFile___reduce_cython[] = "HTSFile.__reduce_cython__";
3531 static const char __pyx_k_HTSFile_add_hts_options[] = "HTSFile.add_hts_options";
3532 static const char __pyx_k_is_valid_reference_name[] = "is_valid_reference_name";
3533 static const char __pyx_k_HTSFile_check_truncation[] = "HTSFile.check_truncation";
3534 static const char __pyx_k_HTSFile___setstate_cython[] = "HTSFile.__setstate_cython__";
3535 static const char __pyx_k_operation_on_closed_HFile[] = "operation on closed HFile";
3536 static const char __pyx_k_HTSFile_get_reference_name[] = "HTSFile.get_reference_name";
3537 static const char __pyx_k_I_O_operation_on_closed_file[] = "I/O operation on closed file";
3538 static const char __pyx_k_error_checking_for_EOF_marker[] = "error checking for EOF marker";
3539 static const char __pyx_k_seek_not_available_in_streams[] = "seek not available in streams";
3540 static const char __pyx_k_tell_not_available_in_streams[] = "tell not available in streams";
3541 static const char __pyx_k_HTSFile_is_valid_reference_name[] = "HTSFile.is_valid_reference_name";
3542 static const char __pyx_k_Invalid_format_option_specified[] = "Invalid format option ({}) specified";
3543 static const char __pyx_k_contig_and_reference_should_not[] = "contig and reference should not both be specified";
3544 static const char __pyx_k_stop_and_end_should_not_both_be[] = "stop and end should not both be specified";
3545 static const char __pyx_k_An_error_occurred_while_applying[] = "An error occurred while applying the requested format options";
3546 static const char __pyx_k_invalid_coordinates_start_i_stop[] = "invalid coordinates: start (%i) > stop (%i)";
3547 static const char __pyx_k_metadata_not_available_on_closed[] = "metadata not available on closed file";
3548 static const char __pyx_k_no_BGZF_EOF_marker_file_may_be_t[] = "no BGZF EOF marker; file may be truncated";
3549 static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__";
3550 static const char __pyx_k_seek_not_implemented_in_files_co[] = "seek not implemented in files compressed by method {}";
3551 static const char __pyx_k_self_fp_cannot_be_converted_to_a[] = "self.fp cannot be converted to a Python object for pickling";
3552 /* #### Code section: decls ### */
3553 static int __pyx_pf_7cpython_5array_5array___getbuffer__(arrayobject *__pyx_v_self, Py_buffer *__pyx_v_info, CYTHON_UNUSED int __pyx_v_flags); /* proto */
3554 static void __pyx_pf_7cpython_5array_5array_2__releasebuffer__(CYTHON_UNUSED arrayobject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */
3555 static PyObject *__pyx_pf_5pysam_10libchtslib_set_verbosity(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_verbosity); /* proto */
3556 static PyObject *__pyx_pf_5pysam_10libchtslib_2get_verbosity(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
3557 static int __pyx_pf_5pysam_10libchtslib_5HFile___init__(struct __pyx_obj_5pysam_10libchtslib_HFile *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_mode, CYTHON_UNUSED PyObject *__pyx_v_closefd); /* proto */
3558 static void __pyx_pf_5pysam_10libchtslib_5HFile_2__dealloc__(struct __pyx_obj_5pysam_10libchtslib_HFile *__pyx_v_self); /* proto */
3559 static PyObject *__pyx_pf_5pysam_10libchtslib_5HFile_6closed___get__(struct __pyx_obj_5pysam_10libchtslib_HFile *__pyx_v_self); /* proto */
3560 static PyObject *__pyx_pf_5pysam_10libchtslib_5HFile_4close(struct __pyx_obj_5pysam_10libchtslib_HFile *__pyx_v_self); /* proto */
3561 static PyObject *__pyx_pf_5pysam_10libchtslib_5HFile_6fileno(struct __pyx_obj_5pysam_10libchtslib_HFile *__pyx_v_self); /* proto */
3562 static PyObject *__pyx_pf_5pysam_10libchtslib_5HFile_8__enter__(struct __pyx_obj_5pysam_10libchtslib_HFile *__pyx_v_self); /* proto */
3563 static PyObject *__pyx_pf_5pysam_10libchtslib_5HFile_10__exit__(struct __pyx_obj_5pysam_10libchtslib_HFile *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_type, CYTHON_UNUSED PyObject *__pyx_v_value, CYTHON_UNUSED PyObject *__pyx_v_tb); /* proto */
3564 static PyObject *__pyx_pf_5pysam_10libchtslib_5HFile_12__iter__(struct __pyx_obj_5pysam_10libchtslib_HFile *__pyx_v_self); /* proto */
3565 static PyObject *__pyx_pf_5pysam_10libchtslib_5HFile_14__next__(struct __pyx_obj_5pysam_10libchtslib_HFile *__pyx_v_self); /* proto */
3566 static PyObject *__pyx_pf_5pysam_10libchtslib_5HFile_16flush(struct __pyx_obj_5pysam_10libchtslib_HFile *__pyx_v_self); /* proto */
3567 static PyObject *__pyx_pf_5pysam_10libchtslib_5HFile_18isatty(struct __pyx_obj_5pysam_10libchtslib_HFile *__pyx_v_self); /* proto */
3568 static PyObject *__pyx_pf_5pysam_10libchtslib_5HFile_20readable(struct __pyx_obj_5pysam_10libchtslib_HFile *__pyx_v_self); /* proto */
3569 static PyObject *__pyx_pf_5pysam_10libchtslib_5HFile_22read(struct __pyx_obj_5pysam_10libchtslib_HFile *__pyx_v_self, Py_ssize_t __pyx_v_size); /* proto */
3570 static PyObject *__pyx_pf_5pysam_10libchtslib_5HFile_24readall(struct __pyx_obj_5pysam_10libchtslib_HFile *__pyx_v_self); /* proto */
3571 static PyObject *__pyx_pf_5pysam_10libchtslib_5HFile_26readinto(struct __pyx_obj_5pysam_10libchtslib_HFile *__pyx_v_self, PyObject *__pyx_v_buf); /* proto */
3572 static PyObject *__pyx_pf_5pysam_10libchtslib_5HFile_28readline(struct __pyx_obj_5pysam_10libchtslib_HFile *__pyx_v_self, Py_ssize_t __pyx_v_size); /* proto */
3573 static PyObject *__pyx_pf_5pysam_10libchtslib_5HFile_30readlines(struct __pyx_obj_5pysam_10libchtslib_HFile *__pyx_v_self); /* proto */
3574 static PyObject *__pyx_pf_5pysam_10libchtslib_5HFile_32seek(struct __pyx_obj_5pysam_10libchtslib_HFile *__pyx_v_self, Py_ssize_t __pyx_v_offset, int __pyx_v_whence); /* proto */
3575 static PyObject *__pyx_pf_5pysam_10libchtslib_5HFile_34tell(struct __pyx_obj_5pysam_10libchtslib_HFile *__pyx_v_self); /* proto */
3576 static PyObject *__pyx_pf_5pysam_10libchtslib_5HFile_36seekable(struct __pyx_obj_5pysam_10libchtslib_HFile *__pyx_v_self); /* proto */
3577 static PyObject *__pyx_pf_5pysam_10libchtslib_5HFile_38truncate(CYTHON_UNUSED struct __pyx_obj_5pysam_10libchtslib_HFile *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_size); /* proto */
3578 static PyObject *__pyx_pf_5pysam_10libchtslib_5HFile_40writable(struct __pyx_obj_5pysam_10libchtslib_HFile *__pyx_v_self); /* proto */
3579 static PyObject *__pyx_pf_5pysam_10libchtslib_5HFile_42write(struct __pyx_obj_5pysam_10libchtslib_HFile *__pyx_v_self, PyObject *__pyx_v_b); /* proto */
3580 static PyObject *__pyx_pf_5pysam_10libchtslib_5HFile_44writelines(struct __pyx_obj_5pysam_10libchtslib_HFile *__pyx_v_self, PyObject *__pyx_v_lines); /* proto */
3581 static PyObject *__pyx_pf_5pysam_10libchtslib_5HFile_4name___get__(struct __pyx_obj_5pysam_10libchtslib_HFile *__pyx_v_self); /* proto */
3582 static PyObject *__pyx_pf_5pysam_10libchtslib_5HFile_4mode___get__(struct __pyx_obj_5pysam_10libchtslib_HFile *__pyx_v_self); /* proto */
3583 static PyObject *__pyx_pf_5pysam_10libchtslib_5HFile_46__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5pysam_10libchtslib_HFile *__pyx_v_self); /* proto */
3584 static PyObject *__pyx_pf_5pysam_10libchtslib_5HFile_48__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5pysam_10libchtslib_HFile *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
3585 static PyObject *__pyx_pf_5pysam_10libchtslib_13CallableValue___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
3586 static PyObject *__pyx_pf_5pysam_10libchtslib_13CallableValue_2__call__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
3587 static PyObject *__pyx_pf_5pysam_10libchtslib_13CallableValue_4__bool__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
3588 static PyObject *__pyx_pf_5pysam_10libchtslib_13CallableValue_6__nonzero__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
3589 static PyObject *__pyx_pf_5pysam_10libchtslib_13CallableValue_8__eq__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
3590 static PyObject *__pyx_pf_5pysam_10libchtslib_13CallableValue_10__ne__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other); /* proto */
3591 static int __pyx_pf_5pysam_10libchtslib_7HTSFile___cinit__(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs); /* proto */
3592 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_2close(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self); /* proto */
3593 static void __pyx_pf_5pysam_10libchtslib_7HTSFile_4__dealloc__(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self); /* proto */
3594 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_6flush(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self); /* proto */
3595 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_8check_truncation(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self, PyObject *__pyx_v_ignore_truncation); /* proto */
3596 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_10__enter__(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self); /* proto */
3597 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_12__exit__(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exc_type, CYTHON_UNUSED PyObject *__pyx_v_exc_value, CYTHON_UNUSED PyObject *__pyx_v_traceback); /* proto */
3598 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_8category___get__(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self); /* proto */
3599 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_6format___get__(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self); /* proto */
3600 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_7version___get__(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self); /* proto */
3601 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_11compression___get__(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self); /* proto */
3602 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_11description___get__(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self); /* proto */
3603 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_7is_open___get__(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self); /* proto */
3604 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_9is_closed___get__(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self); /* proto */
3605 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_6closed___get__(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self); /* proto */
3606 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_8is_write___get__(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self); /* proto */
3607 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_7is_read___get__(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self); /* proto */
3608 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_6is_sam___get__(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self); /* proto */
3609 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_6is_bam___get__(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self); /* proto */
3610 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_7is_cram___get__(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self); /* proto */
3611 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_6is_vcf___get__(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self); /* proto */
3612 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_6is_bcf___get__(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self); /* proto */
3613 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_14reset(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self); /* proto */
3614 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_16seek(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self, uint64_t __pyx_v_offset, int __pyx_v_whence); /* proto */
3615 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_18tell(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self); /* proto */
3616 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_20add_hts_options(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self, PyObject *__pyx_v_format_options); /* proto */
3617 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_22parse_region(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self, PyObject *__pyx_v_contig, PyObject *__pyx_v_start, PyObject *__pyx_v_stop, PyObject *__pyx_v_region, PyObject *__pyx_v_tid, PyObject *__pyx_v_reference, PyObject *__pyx_v_end); /* proto */
3618 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_24is_valid_tid(CYTHON_UNUSED struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_tid); /* proto */
3619 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_26is_valid_reference_name(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self, PyObject *__pyx_v_contig); /* proto */
3620 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_28get_tid(CYTHON_UNUSED struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_contig); /* proto */
3621 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_30get_reference_name(CYTHON_UNUSED struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_tid); /* proto */
3622 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_8filename___get__(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self); /* proto */
3623 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_4mode___get__(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self); /* proto */
3624 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_7threads___get__(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self); /* proto */
3625 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_14index_filename___get__(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self); /* proto */
3626 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_9is_stream___get__(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self); /* proto */
3627 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_9is_remote___get__(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self); /* proto */
3628 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_20duplicate_filehandle___get__(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self); /* proto */
3629 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_32__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self); /* proto */
3630 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_34__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
3631 static PyObject *__pyx_tp_new_5pysam_10libchtslib_HTSFile(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
3632 static PyObject *__pyx_tp_new_5pysam_10libchtslib_HFile(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
3633 /* #### Code section: late_includes ### */
3634 /* #### Code section: module_state ### */
3635 typedef struct {
3636 PyObject *__pyx_d;
3637 PyObject *__pyx_b;
3638 PyObject *__pyx_cython_runtime;
3639 PyObject *__pyx_empty_tuple;
3640 PyObject *__pyx_empty_bytes;
3641 PyObject *__pyx_empty_unicode;
3642 #ifdef __Pyx_CyFunction_USED
3643 PyTypeObject *__pyx_CyFunctionType;
3644 #endif
3645 #ifdef __Pyx_FusedFunction_USED
3646 PyTypeObject *__pyx_FusedFunctionType;
3647 #endif
3648 #ifdef __Pyx_Generator_USED
3649 PyTypeObject *__pyx_GeneratorType;
3650 #endif
3651 #ifdef __Pyx_IterableCoroutine_USED
3652 PyTypeObject *__pyx_IterableCoroutineType;
3653 #endif
3654 #ifdef __Pyx_Coroutine_USED
3655 PyTypeObject *__pyx_CoroutineAwaitType;
3656 #endif
3657 #ifdef __Pyx_Coroutine_USED
3658 PyTypeObject *__pyx_CoroutineType;
3659 #endif
3660 #if CYTHON_USE_MODULE_STATE
3661 #endif
3662 #if CYTHON_USE_MODULE_STATE
3663 #endif
3664 #if CYTHON_USE_MODULE_STATE
3665 #endif
3666 #if CYTHON_USE_MODULE_STATE
3667 #endif
3668 #if CYTHON_USE_MODULE_STATE
3669 #endif
3670 #if CYTHON_USE_MODULE_STATE
3671 #endif
3672 #if CYTHON_USE_MODULE_STATE
3673 #endif
3674 #if CYTHON_USE_MODULE_STATE
3675 #endif
3676 #if CYTHON_USE_MODULE_STATE
3677 #endif
3678 #if CYTHON_USE_MODULE_STATE
3679 #endif
3680 PyTypeObject *__pyx_ptype_7cpython_4type_type;
3681 #if CYTHON_USE_MODULE_STATE
3682 #endif
3683 #if CYTHON_USE_MODULE_STATE
3684 #endif
3685 #if CYTHON_USE_MODULE_STATE
3686 #endif
3687 #if CYTHON_USE_MODULE_STATE
3688 #endif
3689 #if CYTHON_USE_MODULE_STATE
3690 #endif
3691 #if CYTHON_USE_MODULE_STATE
3692 #endif
3693 #if CYTHON_USE_MODULE_STATE
3694 #endif
3695 #if CYTHON_USE_MODULE_STATE
3696 #endif
3697 #if CYTHON_USE_MODULE_STATE
3698 #endif
3699 #if CYTHON_USE_MODULE_STATE
3700 #endif
3701 #if CYTHON_USE_MODULE_STATE
3702 #endif
3703 #if CYTHON_USE_MODULE_STATE
3704 #endif
3705 #if CYTHON_USE_MODULE_STATE
3706 #endif
3707 #if CYTHON_USE_MODULE_STATE
3708 #endif
3709 PyTypeObject *__pyx_ptype_7cpython_4bool_bool;
3710 #if CYTHON_USE_MODULE_STATE
3711 #endif
3712 #if CYTHON_USE_MODULE_STATE
3713 #endif
3714 #if CYTHON_USE_MODULE_STATE
3715 #endif
3716 #if CYTHON_USE_MODULE_STATE
3717 #endif
3718 PyTypeObject *__pyx_ptype_7cpython_7complex_complex;
3719 #if CYTHON_USE_MODULE_STATE
3720 #endif
3721 #if CYTHON_USE_MODULE_STATE
3722 #endif
3723 #if CYTHON_USE_MODULE_STATE
3724 #endif
3725 #if CYTHON_USE_MODULE_STATE
3726 #endif
3727 #if CYTHON_USE_MODULE_STATE
3728 #endif
3729 #if CYTHON_USE_MODULE_STATE
3730 #endif
3731 #if CYTHON_USE_MODULE_STATE
3732 #endif
3733 #if CYTHON_USE_MODULE_STATE
3734 #endif
3735 #if CYTHON_USE_MODULE_STATE
3736 #endif
3737 #if CYTHON_USE_MODULE_STATE
3738 #endif
3739 #if CYTHON_USE_MODULE_STATE
3740 #endif
3741 #if CYTHON_USE_MODULE_STATE
3742 #endif
3743 #if CYTHON_USE_MODULE_STATE
3744 #endif
3745 #if CYTHON_USE_MODULE_STATE
3746 #endif
3747 #if CYTHON_USE_MODULE_STATE
3748 #endif
3749 #if CYTHON_USE_MODULE_STATE
3750 #endif
3751 #if CYTHON_USE_MODULE_STATE
3752 #endif
3753 #if CYTHON_USE_MODULE_STATE
3754 #endif
3755 #if CYTHON_USE_MODULE_STATE
3756 #endif
3757 #if CYTHON_USE_MODULE_STATE
3758 #endif
3759 #if CYTHON_USE_MODULE_STATE
3760 #endif
3761 #if CYTHON_USE_MODULE_STATE
3762 #endif
3763 #if CYTHON_USE_MODULE_STATE
3764 #endif
3765 PyTypeObject *__pyx_ptype_7cpython_5array_array;
3766 #if CYTHON_USE_MODULE_STATE
3767 #endif
3768 #if CYTHON_USE_MODULE_STATE
3769 PyObject *__pyx_type_5pysam_10libchtslib_HTSFile;
3770 PyObject *__pyx_type_5pysam_10libchtslib_HFile;
3771 #endif
3772 PyTypeObject *__pyx_ptype_5pysam_10libchtslib_HTSFile;
3773 PyTypeObject *__pyx_ptype_5pysam_10libchtslib_HFile;
3774 PyObject *__pyx_n_u_ALIGNMENTS;
3775 PyObject *__pyx_kp_u_An_error_occurred_while_applying;
3776 PyObject *__pyx_n_s_AttributeError;
3777 PyObject *__pyx_n_u_BAI;
3778 PyObject *__pyx_n_u_BAM;
3779 PyObject *__pyx_n_u_BCF;
3780 PyObject *__pyx_n_u_BED;
3781 PyObject *__pyx_n_u_BGZF;
3782 PyObject *__pyx_n_u_BINARY_FORMAT;
3783 PyObject *__pyx_n_s_CFalse;
3784 PyObject *__pyx_n_u_CRAI;
3785 PyObject *__pyx_n_u_CRAM;
3786 PyObject *__pyx_n_u_CSI;
3787 PyObject *__pyx_n_s_CTrue;
3788 PyObject *__pyx_n_u_CUSTOM;
3789 PyObject *__pyx_n_s_CallableValue;
3790 PyObject *__pyx_n_s_CallableValue___bool;
3791 PyObject *__pyx_n_s_CallableValue___call;
3792 PyObject *__pyx_n_s_CallableValue___eq;
3793 PyObject *__pyx_n_s_CallableValue___init;
3794 PyObject *__pyx_n_s_CallableValue___ne;
3795 PyObject *__pyx_n_s_CallableValue___nonzero;
3796 PyObject *__pyx_kp_u_Cannot_create_hfile;
3797 PyObject *__pyx_kp_u_Flushing;
3798 PyObject *__pyx_n_u_GZI;
3799 PyObject *__pyx_n_u_GZIP;
3800 PyObject *__pyx_n_s_HFile;
3801 PyObject *__pyx_n_u_HFile;
3802 PyObject *__pyx_n_s_HFile___enter;
3803 PyObject *__pyx_n_s_HFile___exit;
3804 PyObject *__pyx_n_s_HFile___reduce_cython;
3805 PyObject *__pyx_n_s_HFile___setstate_cython;
3806 PyObject *__pyx_n_s_HFile_close;
3807 PyObject *__pyx_n_s_HFile_fileno;
3808 PyObject *__pyx_n_s_HFile_flush;
3809 PyObject *__pyx_n_s_HFile_isatty;
3810 PyObject *__pyx_n_s_HFile_read;
3811 PyObject *__pyx_n_s_HFile_readable;
3812 PyObject *__pyx_n_s_HFile_readall;
3813 PyObject *__pyx_n_s_HFile_readinto;
3814 PyObject *__pyx_n_s_HFile_readline;
3815 PyObject *__pyx_n_s_HFile_readlines;
3816 PyObject *__pyx_n_s_HFile_seek;
3817 PyObject *__pyx_n_s_HFile_seekable;
3818 PyObject *__pyx_n_s_HFile_tell;
3819 PyObject *__pyx_n_s_HFile_truncate;
3820 PyObject *__pyx_n_s_HFile_writable;
3821 PyObject *__pyx_n_s_HFile_write;
3822 PyObject *__pyx_n_s_HFile_writelines;
3823 PyObject *__pyx_n_s_HTSFile;
3824 PyObject *__pyx_n_u_HTSFile;
3825 PyObject *__pyx_n_s_HTSFile___enter;
3826 PyObject *__pyx_n_s_HTSFile___exit;
3827 PyObject *__pyx_n_s_HTSFile___reduce_cython;
3828 PyObject *__pyx_n_s_HTSFile___setstate_cython;
3829 PyObject *__pyx_n_s_HTSFile_add_hts_options;
3830 PyObject *__pyx_n_s_HTSFile_check_truncation;
3831 PyObject *__pyx_n_s_HTSFile_close;
3832 PyObject *__pyx_n_s_HTSFile_flush;
3833 PyObject *__pyx_n_s_HTSFile_get_reference_name;
3834 PyObject *__pyx_n_s_HTSFile_get_tid;
3835 PyObject *__pyx_n_s_HTSFile_is_valid_reference_name;
3836 PyObject *__pyx_n_s_HTSFile_is_valid_tid;
3837 PyObject *__pyx_n_s_HTSFile_parse_region;
3838 PyObject *__pyx_n_s_HTSFile_reset;
3839 PyObject *__pyx_n_s_HTSFile_seek;
3840 PyObject *__pyx_n_s_HTSFile_tell;
3841 PyObject *__pyx_n_u_INDEX;
3842 PyObject *__pyx_n_s_IOError;
3843 PyObject *__pyx_kp_u_I_O_operation_on_closed_file;
3844 PyObject *__pyx_n_s_IndexError;
3845 PyObject *__pyx_kp_u_Invalid_format_option_specified;
3846 PyObject *__pyx_n_s_MemoryError;
3847 PyObject *__pyx_n_u_NONE;
3848 PyObject *__pyx_n_s_NotImplementedError;
3849 PyObject *__pyx_n_s_OSError;
3850 PyObject *__pyx_n_s_OverflowError;
3851 PyObject *__pyx_n_u_REGIONS;
3852 PyObject *__pyx_n_s_RuntimeError;
3853 PyObject *__pyx_n_u_SAM;
3854 PyObject *__pyx_n_s_SEEK_SET;
3855 PyObject *__pyx_n_s_StopIteration;
3856 PyObject *__pyx_n_u_TBI;
3857 PyObject *__pyx_n_u_TEXT_FORMAT;
3858 PyObject *__pyx_n_s_TypeError;
3859 PyObject *__pyx_n_u_UNKNOWN;
3860 PyObject *__pyx_n_u_VARIANTS;
3861 PyObject *__pyx_n_u_VCF;
3862 PyObject *__pyx_n_s_ValueError;
3863 PyObject *__pyx_kp_b__13;
3864 PyObject *__pyx_kp_u__55;
3865 PyObject *__pyx_kp_u__56;
3866 PyObject *__pyx_n_s__58;
3867 PyObject *__pyx_kp_u__58;
3868 PyObject *__pyx_kp_u__59;
3869 PyObject *__pyx_n_s__97;
3870 PyObject *__pyx_n_s_add_hts_options;
3871 PyObject *__pyx_n_s_all;
3872 PyObject *__pyx_n_s_asyncio_coroutines;
3873 PyObject *__pyx_n_b_b;
3874 PyObject *__pyx_n_s_b;
3875 PyObject *__pyx_n_s_bgzfp;
3876 PyObject *__pyx_n_s_bool;
3877 PyObject *__pyx_n_s_buf;
3878 PyObject *__pyx_n_s_bytes_read;
3879 PyObject *__pyx_n_b_c;
3880 PyObject *__pyx_n_s_call;
3881 PyObject *__pyx_n_s_check_truncation;
3882 PyObject *__pyx_n_s_chunk_size;
3883 PyObject *__pyx_n_s_class_getitem;
3884 PyObject *__pyx_n_s_cline_in_traceback;
3885 PyObject *__pyx_n_s_close;
3886 PyObject *__pyx_n_s_closefd;
3887 PyObject *__pyx_n_s_contig;
3888 PyObject *__pyx_kp_u_contig_and_reference_should_not;
3889 PyObject *__pyx_n_s_coord;
3890 PyObject *__pyx_n_s_cpart;
3891 PyObject *__pyx_n_s_dict;
3892 PyObject *__pyx_kp_u_disable;
3893 PyObject *__pyx_n_s_doc;
3894 PyObject *__pyx_kp_u_enable;
3895 PyObject *__pyx_n_s_end;
3896 PyObject *__pyx_n_s_enter;
3897 PyObject *__pyx_n_s_eq;
3898 PyObject *__pyx_kp_u_error_checking_for_EOF_marker;
3899 PyObject *__pyx_n_s_exc_type;
3900 PyObject *__pyx_n_s_exc_value;
3901 PyObject *__pyx_n_s_exit;
3902 PyObject *__pyx_kp_u_failed;
3903 PyObject *__pyx_kp_u_failed_to_close_HFile;
3904 PyObject *__pyx_kp_u_failed_to_flush_HFile;
3905 PyObject *__pyx_kp_u_failed_to_open_HFile;
3906 PyObject *__pyx_kp_u_failed_to_read_HFile;
3907 PyObject *__pyx_kp_u_fd;
3908 PyObject *__pyx_n_s_fileno;
3909 PyObject *__pyx_kp_u_fileno_not_available;
3910 PyObject *__pyx_n_s_flush;
3911 PyObject *__pyx_n_s_format;
3912 PyObject *__pyx_n_s_format_option;
3913 PyObject *__pyx_n_s_format_options;
3914 PyObject *__pyx_n_s_fp;
3915 PyObject *__pyx_kp_u_gc;
3916 PyObject *__pyx_n_s_get_reference_name;
3917 PyObject *__pyx_n_s_get_tid;
3918 PyObject *__pyx_n_s_get_verbosity;
3919 PyObject *__pyx_n_u_get_verbosity;
3920 PyObject *__pyx_n_s_getstate;
3921 PyObject *__pyx_n_s_got;
3922 PyObject *__pyx_n_s_ignore_truncation;
3923 PyObject *__pyx_n_s_import;
3924 PyObject *__pyx_n_s_init;
3925 PyObject *__pyx_n_s_init_subclass;
3926 PyObject *__pyx_n_s_initializing;
3927 PyObject *__pyx_kp_u_invalid_contig_s;
3928 PyObject *__pyx_kp_u_invalid_coordinates_start_i_stop;
3929 PyObject *__pyx_kp_u_invalid_tid;
3930 PyObject *__pyx_n_s_io;
3931 PyObject *__pyx_n_s_is_coroutine;
3932 PyObject *__pyx_n_s_is_open;
3933 PyObject *__pyx_n_s_is_valid_reference_name;
3934 PyObject *__pyx_n_s_is_valid_tid;
3935 PyObject *__pyx_n_s_isatty;
3936 PyObject *__pyx_kp_u_isenabled;
3937 PyObject *__pyx_n_s_join;
3938 PyObject *__pyx_n_s_line;
3939 PyObject *__pyx_n_s_lines;
3940 PyObject *__pyx_n_s_main;
3941 PyObject *__pyx_n_s_metaclass;
3942 PyObject *__pyx_kp_u_metadata_not_available_on_closed;
3943 PyObject *__pyx_n_s_mode;
3944 PyObject *__pyx_n_s_module;
3945 PyObject *__pyx_n_s_mro_entries;
3946 PyObject *__pyx_n_s_msg;
3947 PyObject *__pyx_n_s_mv;
3948 PyObject *__pyx_n_s_name;
3949 PyObject *__pyx_n_s_name_2;
3950 PyObject *__pyx_n_s_ne;
3951 PyObject *__pyx_kp_u_no_BGZF_EOF_marker_file_may_be_t;
3952 PyObject *__pyx_kp_s_no_default___reduce___due_to_non;
3953 PyObject *__pyx_n_s_nonzero;
3954 PyObject *__pyx_n_s_object;
3955 PyObject *__pyx_n_s_off;
3956 PyObject *__pyx_n_s_offset;
3957 PyObject *__pyx_kp_u_operation_on_closed_HFile;
3958 PyObject *__pyx_n_s_opts;
3959 PyObject *__pyx_n_s_os;
3960 PyObject *__pyx_n_s_other;
3961 PyObject *__pyx_n_s_parse_region;
3962 PyObject *__pyx_n_s_part;
3963 PyObject *__pyx_n_s_parts;
3964 PyObject *__pyx_n_s_prepare;
3965 PyObject *__pyx_n_s_pysam_libchtslib;
3966 PyObject *__pyx_kp_s_pysam_libchtslib_pyx;
3967 PyObject *__pyx_n_s_pyx_state;
3968 PyObject *__pyx_n_s_pyx_vtable;
3969 PyObject *__pyx_n_s_qualname;
3970 PyObject *__pyx_n_u_r;
3971 PyObject *__pyx_n_s_re;
3972 PyObject *__pyx_n_s_read;
3973 PyObject *__pyx_n_s_readable;
3974 PyObject *__pyx_n_s_readall;
3975 PyObject *__pyx_n_s_readinto;
3976 PyObject *__pyx_n_s_readline;
3977 PyObject *__pyx_n_s_readlines;
3978 PyObject *__pyx_n_s_reduce;
3979 PyObject *__pyx_n_s_reduce_cython;
3980 PyObject *__pyx_n_s_reduce_ex;
3981 PyObject *__pyx_n_s_reference;
3982 PyObject *__pyx_n_s_region;
3983 PyObject *__pyx_n_s_replace;
3984 PyObject *__pyx_n_s_reset;
3985 PyObject *__pyx_n_s_ret;
3986 PyObject *__pyx_n_s_rstart;
3987 PyObject *__pyx_n_s_rstop;
3988 PyObject *__pyx_n_s_rtid;
3989 PyObject *__pyx_n_s_rval;
3990 PyObject *__pyx_n_s_seek;
3991 PyObject *__pyx_kp_u_seek_failed_on_HFile;
3992 PyObject *__pyx_kp_u_seek_not_available_in_streams;
3993 PyObject *__pyx_kp_u_seek_not_implemented_in_files_co;
3994 PyObject *__pyx_n_s_seekable;
3995 PyObject *__pyx_n_s_self;
3996 PyObject *__pyx_kp_s_self_fp_cannot_be_converted_to_a;
3997 PyObject *__pyx_n_s_set_name;
3998 PyObject *__pyx_n_s_set_verbosity;
3999 PyObject *__pyx_n_u_set_verbosity;
4000 PyObject *__pyx_n_s_setstate;
4001 PyObject *__pyx_n_s_setstate_cython;
4002 PyObject *__pyx_n_s_size;
4003 PyObject *__pyx_n_s_spec;
4004 PyObject *__pyx_n_s_split;
4005 PyObject *__pyx_n_s_start;
4006 PyObject *__pyx_kp_u_start_out_of_range_i;
4007 PyObject *__pyx_n_s_stop;
4008 PyObject *__pyx_kp_u_stop_and_end_should_not_both_be;
4009 PyObject *__pyx_kp_u_stop_out_of_range_i;
4010 PyObject *__pyx_kp_s_stringsource;
4011 PyObject *__pyx_n_s_super;
4012 PyObject *__pyx_n_s_tb;
4013 PyObject *__pyx_n_s_tell;
4014 PyObject *__pyx_kp_u_tell_failed_on_HFile;
4015 PyObject *__pyx_kp_u_tell_not_available_in_streams;
4016 PyObject *__pyx_n_s_test;
4017 PyObject *__pyx_n_s_tid;
4018 PyObject *__pyx_n_s_traceback;
4019 PyObject *__pyx_n_s_truncate;
4020 PyObject *__pyx_n_s_type;
4021 PyObject *__pyx_n_s_value;
4022 PyObject *__pyx_n_s_verbosity;
4023 PyObject *__pyx_n_u_w;
4024 PyObject *__pyx_n_s_warn;
4025 PyObject *__pyx_n_s_warnings;
4026 PyObject *__pyx_n_s_whence;
4027 PyObject *__pyx_n_s_writable;
4028 PyObject *__pyx_n_s_write;
4029 PyObject *__pyx_kp_u_write_failed_on_HFile;
4030 PyObject *__pyx_n_s_writelines;
4031 PyObject *__pyx_int_0;
4032 PyObject *__pyx_int_1;
4033 PyObject *__pyx_int_neg_1;
4034 int __pyx_k__18;
4035 int __pyx_k__41;
4036 PyObject *__pyx_codeobj_;
4037 PyObject *__pyx_tuple__5;
4038 PyObject *__pyx_tuple__6;
4039 PyObject *__pyx_tuple__39;
4040 PyObject *__pyx_tuple__43;
4041 PyObject *__pyx_tuple__44;
4042 PyObject *__pyx_tuple__46;
4043 PyObject *__pyx_tuple__47;
4044 PyObject *__pyx_tuple__48;
4045 PyObject *__pyx_tuple__49;
4046 PyObject *__pyx_tuple__51;
4047 PyObject *__pyx_tuple__53;
4048 PyObject *__pyx_tuple__54;
4049 PyObject *__pyx_tuple__57;
4050 PyObject *__pyx_tuple__66;
4051 PyObject *__pyx_tuple__67;
4052 PyObject *__pyx_tuple__68;
4053 PyObject *__pyx_tuple__69;
4054 PyObject *__pyx_tuple__70;
4055 PyObject *__pyx_tuple__71;
4056 PyObject *__pyx_tuple__72;
4057 PyObject *__pyx_tuple__73;
4058 PyObject *__pyx_tuple__74;
4059 PyObject *__pyx_tuple__75;
4060 PyObject *__pyx_tuple__76;
4061 PyObject *__pyx_tuple__77;
4062 PyObject *__pyx_tuple__78;
4063 PyObject *__pyx_tuple__79;
4064 PyObject *__pyx_tuple__80;
4065 PyObject *__pyx_tuple__81;
4066 PyObject *__pyx_tuple__82;
4067 PyObject *__pyx_tuple__83;
4068 PyObject *__pyx_tuple__84;
4069 PyObject *__pyx_tuple__85;
4070 PyObject *__pyx_tuple__86;
4071 PyObject *__pyx_tuple__87;
4072 PyObject *__pyx_tuple__88;
4073 PyObject *__pyx_tuple__89;
4074 PyObject *__pyx_tuple__90;
4075 PyObject *__pyx_tuple__91;
4076 PyObject *__pyx_tuple__92;
4077 PyObject *__pyx_tuple__93;
4078 PyObject *__pyx_tuple__94;
4079 PyObject *__pyx_tuple__95;
4080 PyObject *__pyx_tuple__96;
4081 PyObject *__pyx_codeobj__2;
4082 PyObject *__pyx_codeobj__3;
4083 PyObject *__pyx_codeobj__4;
4084 PyObject *__pyx_codeobj__7;
4085 PyObject *__pyx_codeobj__8;
4086 PyObject *__pyx_codeobj__9;
4087 PyObject *__pyx_codeobj__10;
4088 PyObject *__pyx_codeobj__11;
4089 PyObject *__pyx_codeobj__12;
4090 PyObject *__pyx_codeobj__14;
4091 PyObject *__pyx_codeobj__15;
4092 PyObject *__pyx_codeobj__16;
4093 PyObject *__pyx_codeobj__17;
4094 PyObject *__pyx_codeobj__19;
4095 PyObject *__pyx_codeobj__20;
4096 PyObject *__pyx_codeobj__21;
4097 PyObject *__pyx_codeobj__22;
4098 PyObject *__pyx_codeobj__23;
4099 PyObject *__pyx_codeobj__24;
4100 PyObject *__pyx_codeobj__25;
4101 PyObject *__pyx_codeobj__26;
4102 PyObject *__pyx_codeobj__27;
4103 PyObject *__pyx_codeobj__28;
4104 PyObject *__pyx_codeobj__29;
4105 PyObject *__pyx_codeobj__30;
4106 PyObject *__pyx_codeobj__31;
4107 PyObject *__pyx_codeobj__32;
4108 PyObject *__pyx_codeobj__33;
4109 PyObject *__pyx_codeobj__34;
4110 PyObject *__pyx_codeobj__35;
4111 PyObject *__pyx_codeobj__36;
4112 PyObject *__pyx_codeobj__37;
4113 PyObject *__pyx_codeobj__38;
4114 PyObject *__pyx_codeobj__40;
4115 PyObject *__pyx_codeobj__42;
4116 PyObject *__pyx_codeobj__45;
4117 PyObject *__pyx_codeobj__50;
4118 PyObject *__pyx_codeobj__52;
4119 PyObject *__pyx_codeobj__60;
4120 PyObject *__pyx_codeobj__61;
4121 PyObject *__pyx_codeobj__62;
4122 PyObject *__pyx_codeobj__63;
4123 PyObject *__pyx_codeobj__64;
4124 PyObject *__pyx_codeobj__65;
4125 } __pyx_mstate;
4126
4127 #if CYTHON_USE_MODULE_STATE
4128 #ifdef __cplusplus
4129 namespace {
4130 extern struct PyModuleDef __pyx_moduledef;
4131 } /* anonymous namespace */
4132 #else
4133 static struct PyModuleDef __pyx_moduledef;
4134 #endif
4135
4136 #define __pyx_mstate(o) ((__pyx_mstate *)__Pyx_PyModule_GetState(o))
4137
4138 #define __pyx_mstate_global (__pyx_mstate(PyState_FindModule(&__pyx_moduledef)))
4139
4140 #define __pyx_m (PyState_FindModule(&__pyx_moduledef))
4141 #else
4142 static __pyx_mstate __pyx_mstate_global_static =
4143 #ifdef __cplusplus
4144 {};
4145 #else
4146 {0};
4147 #endif
4148 static __pyx_mstate *__pyx_mstate_global = &__pyx_mstate_global_static;
4149 #endif
4150 /* #### Code section: module_state_clear ### */
4151 #if CYTHON_USE_MODULE_STATE
4152 static int __pyx_m_clear(PyObject *m) {
4153 __pyx_mstate *clear_module_state = __pyx_mstate(m);
4154 if (!clear_module_state) return 0;
4155 Py_CLEAR(clear_module_state->__pyx_d);
4156 Py_CLEAR(clear_module_state->__pyx_b);
4157 Py_CLEAR(clear_module_state->__pyx_cython_runtime);
4158 Py_CLEAR(clear_module_state->__pyx_empty_tuple);
4159 Py_CLEAR(clear_module_state->__pyx_empty_bytes);
4160 Py_CLEAR(clear_module_state->__pyx_empty_unicode);
4161 #ifdef __Pyx_CyFunction_USED
4162 Py_CLEAR(clear_module_state->__pyx_CyFunctionType);
4163 #endif
4164 #ifdef __Pyx_FusedFunction_USED
4165 Py_CLEAR(clear_module_state->__pyx_FusedFunctionType);
4166 #endif
4167 Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_4type_type);
4168 Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_4bool_bool);
4169 Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_7complex_complex);
4170 Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_5array_array);
4171 Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_10libchtslib_HTSFile);
4172 Py_CLEAR(clear_module_state->__pyx_type_5pysam_10libchtslib_HTSFile);
4173 Py_CLEAR(clear_module_state->__pyx_ptype_5pysam_10libchtslib_HFile);
4174 Py_CLEAR(clear_module_state->__pyx_type_5pysam_10libchtslib_HFile);
4175 Py_CLEAR(clear_module_state->__pyx_n_u_ALIGNMENTS);
4176 Py_CLEAR(clear_module_state->__pyx_kp_u_An_error_occurred_while_applying);
4177 Py_CLEAR(clear_module_state->__pyx_n_s_AttributeError);
4178 Py_CLEAR(clear_module_state->__pyx_n_u_BAI);
4179 Py_CLEAR(clear_module_state->__pyx_n_u_BAM);
4180 Py_CLEAR(clear_module_state->__pyx_n_u_BCF);
4181 Py_CLEAR(clear_module_state->__pyx_n_u_BED);
4182 Py_CLEAR(clear_module_state->__pyx_n_u_BGZF);
4183 Py_CLEAR(clear_module_state->__pyx_n_u_BINARY_FORMAT);
4184 Py_CLEAR(clear_module_state->__pyx_n_s_CFalse);
4185 Py_CLEAR(clear_module_state->__pyx_n_u_CRAI);
4186 Py_CLEAR(clear_module_state->__pyx_n_u_CRAM);
4187 Py_CLEAR(clear_module_state->__pyx_n_u_CSI);
4188 Py_CLEAR(clear_module_state->__pyx_n_s_CTrue);
4189 Py_CLEAR(clear_module_state->__pyx_n_u_CUSTOM);
4190 Py_CLEAR(clear_module_state->__pyx_n_s_CallableValue);
4191 Py_CLEAR(clear_module_state->__pyx_n_s_CallableValue___bool);
4192 Py_CLEAR(clear_module_state->__pyx_n_s_CallableValue___call);
4193 Py_CLEAR(clear_module_state->__pyx_n_s_CallableValue___eq);
4194 Py_CLEAR(clear_module_state->__pyx_n_s_CallableValue___init);
4195 Py_CLEAR(clear_module_state->__pyx_n_s_CallableValue___ne);
4196 Py_CLEAR(clear_module_state->__pyx_n_s_CallableValue___nonzero);
4197 Py_CLEAR(clear_module_state->__pyx_kp_u_Cannot_create_hfile);
4198 Py_CLEAR(clear_module_state->__pyx_kp_u_Flushing);
4199 Py_CLEAR(clear_module_state->__pyx_n_u_GZI);
4200 Py_CLEAR(clear_module_state->__pyx_n_u_GZIP);
4201 Py_CLEAR(clear_module_state->__pyx_n_s_HFile);
4202 Py_CLEAR(clear_module_state->__pyx_n_u_HFile);
4203 Py_CLEAR(clear_module_state->__pyx_n_s_HFile___enter);
4204 Py_CLEAR(clear_module_state->__pyx_n_s_HFile___exit);
4205 Py_CLEAR(clear_module_state->__pyx_n_s_HFile___reduce_cython);
4206 Py_CLEAR(clear_module_state->__pyx_n_s_HFile___setstate_cython);
4207 Py_CLEAR(clear_module_state->__pyx_n_s_HFile_close);
4208 Py_CLEAR(clear_module_state->__pyx_n_s_HFile_fileno);
4209 Py_CLEAR(clear_module_state->__pyx_n_s_HFile_flush);
4210 Py_CLEAR(clear_module_state->__pyx_n_s_HFile_isatty);
4211 Py_CLEAR(clear_module_state->__pyx_n_s_HFile_read);
4212 Py_CLEAR(clear_module_state->__pyx_n_s_HFile_readable);
4213 Py_CLEAR(clear_module_state->__pyx_n_s_HFile_readall);
4214 Py_CLEAR(clear_module_state->__pyx_n_s_HFile_readinto);
4215 Py_CLEAR(clear_module_state->__pyx_n_s_HFile_readline);
4216 Py_CLEAR(clear_module_state->__pyx_n_s_HFile_readlines);
4217 Py_CLEAR(clear_module_state->__pyx_n_s_HFile_seek);
4218 Py_CLEAR(clear_module_state->__pyx_n_s_HFile_seekable);
4219 Py_CLEAR(clear_module_state->__pyx_n_s_HFile_tell);
4220 Py_CLEAR(clear_module_state->__pyx_n_s_HFile_truncate);
4221 Py_CLEAR(clear_module_state->__pyx_n_s_HFile_writable);
4222 Py_CLEAR(clear_module_state->__pyx_n_s_HFile_write);
4223 Py_CLEAR(clear_module_state->__pyx_n_s_HFile_writelines);
4224 Py_CLEAR(clear_module_state->__pyx_n_s_HTSFile);
4225 Py_CLEAR(clear_module_state->__pyx_n_u_HTSFile);
4226 Py_CLEAR(clear_module_state->__pyx_n_s_HTSFile___enter);
4227 Py_CLEAR(clear_module_state->__pyx_n_s_HTSFile___exit);
4228 Py_CLEAR(clear_module_state->__pyx_n_s_HTSFile___reduce_cython);
4229 Py_CLEAR(clear_module_state->__pyx_n_s_HTSFile___setstate_cython);
4230 Py_CLEAR(clear_module_state->__pyx_n_s_HTSFile_add_hts_options);
4231 Py_CLEAR(clear_module_state->__pyx_n_s_HTSFile_check_truncation);
4232 Py_CLEAR(clear_module_state->__pyx_n_s_HTSFile_close);
4233 Py_CLEAR(clear_module_state->__pyx_n_s_HTSFile_flush);
4234 Py_CLEAR(clear_module_state->__pyx_n_s_HTSFile_get_reference_name);
4235 Py_CLEAR(clear_module_state->__pyx_n_s_HTSFile_get_tid);
4236 Py_CLEAR(clear_module_state->__pyx_n_s_HTSFile_is_valid_reference_name);
4237 Py_CLEAR(clear_module_state->__pyx_n_s_HTSFile_is_valid_tid);
4238 Py_CLEAR(clear_module_state->__pyx_n_s_HTSFile_parse_region);
4239 Py_CLEAR(clear_module_state->__pyx_n_s_HTSFile_reset);
4240 Py_CLEAR(clear_module_state->__pyx_n_s_HTSFile_seek);
4241 Py_CLEAR(clear_module_state->__pyx_n_s_HTSFile_tell);
4242 Py_CLEAR(clear_module_state->__pyx_n_u_INDEX);
4243 Py_CLEAR(clear_module_state->__pyx_n_s_IOError);
4244 Py_CLEAR(clear_module_state->__pyx_kp_u_I_O_operation_on_closed_file);
4245 Py_CLEAR(clear_module_state->__pyx_n_s_IndexError);
4246 Py_CLEAR(clear_module_state->__pyx_kp_u_Invalid_format_option_specified);
4247 Py_CLEAR(clear_module_state->__pyx_n_s_MemoryError);
4248 Py_CLEAR(clear_module_state->__pyx_n_u_NONE);
4249 Py_CLEAR(clear_module_state->__pyx_n_s_NotImplementedError);
4250 Py_CLEAR(clear_module_state->__pyx_n_s_OSError);
4251 Py_CLEAR(clear_module_state->__pyx_n_s_OverflowError);
4252 Py_CLEAR(clear_module_state->__pyx_n_u_REGIONS);
4253 Py_CLEAR(clear_module_state->__pyx_n_s_RuntimeError);
4254 Py_CLEAR(clear_module_state->__pyx_n_u_SAM);
4255 Py_CLEAR(clear_module_state->__pyx_n_s_SEEK_SET);
4256 Py_CLEAR(clear_module_state->__pyx_n_s_StopIteration);
4257 Py_CLEAR(clear_module_state->__pyx_n_u_TBI);
4258 Py_CLEAR(clear_module_state->__pyx_n_u_TEXT_FORMAT);
4259 Py_CLEAR(clear_module_state->__pyx_n_s_TypeError);
4260 Py_CLEAR(clear_module_state->__pyx_n_u_UNKNOWN);
4261 Py_CLEAR(clear_module_state->__pyx_n_u_VARIANTS);
4262 Py_CLEAR(clear_module_state->__pyx_n_u_VCF);
4263 Py_CLEAR(clear_module_state->__pyx_n_s_ValueError);
4264 Py_CLEAR(clear_module_state->__pyx_kp_b__13);
4265 Py_CLEAR(clear_module_state->__pyx_kp_u__55);
4266 Py_CLEAR(clear_module_state->__pyx_kp_u__56);
4267 Py_CLEAR(clear_module_state->__pyx_n_s__58);
4268 Py_CLEAR(clear_module_state->__pyx_kp_u__58);
4269 Py_CLEAR(clear_module_state->__pyx_kp_u__59);
4270 Py_CLEAR(clear_module_state->__pyx_n_s__97);
4271 Py_CLEAR(clear_module_state->__pyx_n_s_add_hts_options);
4272 Py_CLEAR(clear_module_state->__pyx_n_s_all);
4273 Py_CLEAR(clear_module_state->__pyx_n_s_asyncio_coroutines);
4274 Py_CLEAR(clear_module_state->__pyx_n_b_b);
4275 Py_CLEAR(clear_module_state->__pyx_n_s_b);
4276 Py_CLEAR(clear_module_state->__pyx_n_s_bgzfp);
4277 Py_CLEAR(clear_module_state->__pyx_n_s_bool);
4278 Py_CLEAR(clear_module_state->__pyx_n_s_buf);
4279 Py_CLEAR(clear_module_state->__pyx_n_s_bytes_read);
4280 Py_CLEAR(clear_module_state->__pyx_n_b_c);
4281 Py_CLEAR(clear_module_state->__pyx_n_s_call);
4282 Py_CLEAR(clear_module_state->__pyx_n_s_check_truncation);
4283 Py_CLEAR(clear_module_state->__pyx_n_s_chunk_size);
4284 Py_CLEAR(clear_module_state->__pyx_n_s_class_getitem);
4285 Py_CLEAR(clear_module_state->__pyx_n_s_cline_in_traceback);
4286 Py_CLEAR(clear_module_state->__pyx_n_s_close);
4287 Py_CLEAR(clear_module_state->__pyx_n_s_closefd);
4288 Py_CLEAR(clear_module_state->__pyx_n_s_contig);
4289 Py_CLEAR(clear_module_state->__pyx_kp_u_contig_and_reference_should_not);
4290 Py_CLEAR(clear_module_state->__pyx_n_s_coord);
4291 Py_CLEAR(clear_module_state->__pyx_n_s_cpart);
4292 Py_CLEAR(clear_module_state->__pyx_n_s_dict);
4293 Py_CLEAR(clear_module_state->__pyx_kp_u_disable);
4294 Py_CLEAR(clear_module_state->__pyx_n_s_doc);
4295 Py_CLEAR(clear_module_state->__pyx_kp_u_enable);
4296 Py_CLEAR(clear_module_state->__pyx_n_s_end);
4297 Py_CLEAR(clear_module_state->__pyx_n_s_enter);
4298 Py_CLEAR(clear_module_state->__pyx_n_s_eq);
4299 Py_CLEAR(clear_module_state->__pyx_kp_u_error_checking_for_EOF_marker);
4300 Py_CLEAR(clear_module_state->__pyx_n_s_exc_type);
4301 Py_CLEAR(clear_module_state->__pyx_n_s_exc_value);
4302 Py_CLEAR(clear_module_state->__pyx_n_s_exit);
4303 Py_CLEAR(clear_module_state->__pyx_kp_u_failed);
4304 Py_CLEAR(clear_module_state->__pyx_kp_u_failed_to_close_HFile);
4305 Py_CLEAR(clear_module_state->__pyx_kp_u_failed_to_flush_HFile);
4306 Py_CLEAR(clear_module_state->__pyx_kp_u_failed_to_open_HFile);
4307 Py_CLEAR(clear_module_state->__pyx_kp_u_failed_to_read_HFile);
4308 Py_CLEAR(clear_module_state->__pyx_kp_u_fd);
4309 Py_CLEAR(clear_module_state->__pyx_n_s_fileno);
4310 Py_CLEAR(clear_module_state->__pyx_kp_u_fileno_not_available);
4311 Py_CLEAR(clear_module_state->__pyx_n_s_flush);
4312 Py_CLEAR(clear_module_state->__pyx_n_s_format);
4313 Py_CLEAR(clear_module_state->__pyx_n_s_format_option);
4314 Py_CLEAR(clear_module_state->__pyx_n_s_format_options);
4315 Py_CLEAR(clear_module_state->__pyx_n_s_fp);
4316 Py_CLEAR(clear_module_state->__pyx_kp_u_gc);
4317 Py_CLEAR(clear_module_state->__pyx_n_s_get_reference_name);
4318 Py_CLEAR(clear_module_state->__pyx_n_s_get_tid);
4319 Py_CLEAR(clear_module_state->__pyx_n_s_get_verbosity);
4320 Py_CLEAR(clear_module_state->__pyx_n_u_get_verbosity);
4321 Py_CLEAR(clear_module_state->__pyx_n_s_getstate);
4322 Py_CLEAR(clear_module_state->__pyx_n_s_got);
4323 Py_CLEAR(clear_module_state->__pyx_n_s_ignore_truncation);
4324 Py_CLEAR(clear_module_state->__pyx_n_s_import);
4325 Py_CLEAR(clear_module_state->__pyx_n_s_init);
4326 Py_CLEAR(clear_module_state->__pyx_n_s_init_subclass);
4327 Py_CLEAR(clear_module_state->__pyx_n_s_initializing);
4328 Py_CLEAR(clear_module_state->__pyx_kp_u_invalid_contig_s);
4329 Py_CLEAR(clear_module_state->__pyx_kp_u_invalid_coordinates_start_i_stop);
4330 Py_CLEAR(clear_module_state->__pyx_kp_u_invalid_tid);
4331 Py_CLEAR(clear_module_state->__pyx_n_s_io);
4332 Py_CLEAR(clear_module_state->__pyx_n_s_is_coroutine);
4333 Py_CLEAR(clear_module_state->__pyx_n_s_is_open);
4334 Py_CLEAR(clear_module_state->__pyx_n_s_is_valid_reference_name);
4335 Py_CLEAR(clear_module_state->__pyx_n_s_is_valid_tid);
4336 Py_CLEAR(clear_module_state->__pyx_n_s_isatty);
4337 Py_CLEAR(clear_module_state->__pyx_kp_u_isenabled);
4338 Py_CLEAR(clear_module_state->__pyx_n_s_join);
4339 Py_CLEAR(clear_module_state->__pyx_n_s_line);
4340 Py_CLEAR(clear_module_state->__pyx_n_s_lines);
4341 Py_CLEAR(clear_module_state->__pyx_n_s_main);
4342 Py_CLEAR(clear_module_state->__pyx_n_s_metaclass);
4343 Py_CLEAR(clear_module_state->__pyx_kp_u_metadata_not_available_on_closed);
4344 Py_CLEAR(clear_module_state->__pyx_n_s_mode);
4345 Py_CLEAR(clear_module_state->__pyx_n_s_module);
4346 Py_CLEAR(clear_module_state->__pyx_n_s_mro_entries);
4347 Py_CLEAR(clear_module_state->__pyx_n_s_msg);
4348 Py_CLEAR(clear_module_state->__pyx_n_s_mv);
4349 Py_CLEAR(clear_module_state->__pyx_n_s_name);
4350 Py_CLEAR(clear_module_state->__pyx_n_s_name_2);
4351 Py_CLEAR(clear_module_state->__pyx_n_s_ne);
4352 Py_CLEAR(clear_module_state->__pyx_kp_u_no_BGZF_EOF_marker_file_may_be_t);
4353 Py_CLEAR(clear_module_state->__pyx_kp_s_no_default___reduce___due_to_non);
4354 Py_CLEAR(clear_module_state->__pyx_n_s_nonzero);
4355 Py_CLEAR(clear_module_state->__pyx_n_s_object);
4356 Py_CLEAR(clear_module_state->__pyx_n_s_off);
4357 Py_CLEAR(clear_module_state->__pyx_n_s_offset);
4358 Py_CLEAR(clear_module_state->__pyx_kp_u_operation_on_closed_HFile);
4359 Py_CLEAR(clear_module_state->__pyx_n_s_opts);
4360 Py_CLEAR(clear_module_state->__pyx_n_s_os);
4361 Py_CLEAR(clear_module_state->__pyx_n_s_other);
4362 Py_CLEAR(clear_module_state->__pyx_n_s_parse_region);
4363 Py_CLEAR(clear_module_state->__pyx_n_s_part);
4364 Py_CLEAR(clear_module_state->__pyx_n_s_parts);
4365 Py_CLEAR(clear_module_state->__pyx_n_s_prepare);
4366 Py_CLEAR(clear_module_state->__pyx_n_s_pysam_libchtslib);
4367 Py_CLEAR(clear_module_state->__pyx_kp_s_pysam_libchtslib_pyx);
4368 Py_CLEAR(clear_module_state->__pyx_n_s_pyx_state);
4369 Py_CLEAR(clear_module_state->__pyx_n_s_pyx_vtable);
4370 Py_CLEAR(clear_module_state->__pyx_n_s_qualname);
4371 Py_CLEAR(clear_module_state->__pyx_n_u_r);
4372 Py_CLEAR(clear_module_state->__pyx_n_s_re);
4373 Py_CLEAR(clear_module_state->__pyx_n_s_read);
4374 Py_CLEAR(clear_module_state->__pyx_n_s_readable);
4375 Py_CLEAR(clear_module_state->__pyx_n_s_readall);
4376 Py_CLEAR(clear_module_state->__pyx_n_s_readinto);
4377 Py_CLEAR(clear_module_state->__pyx_n_s_readline);
4378 Py_CLEAR(clear_module_state->__pyx_n_s_readlines);
4379 Py_CLEAR(clear_module_state->__pyx_n_s_reduce);
4380 Py_CLEAR(clear_module_state->__pyx_n_s_reduce_cython);
4381 Py_CLEAR(clear_module_state->__pyx_n_s_reduce_ex);
4382 Py_CLEAR(clear_module_state->__pyx_n_s_reference);
4383 Py_CLEAR(clear_module_state->__pyx_n_s_region);
4384 Py_CLEAR(clear_module_state->__pyx_n_s_replace);
4385 Py_CLEAR(clear_module_state->__pyx_n_s_reset);
4386 Py_CLEAR(clear_module_state->__pyx_n_s_ret);
4387 Py_CLEAR(clear_module_state->__pyx_n_s_rstart);
4388 Py_CLEAR(clear_module_state->__pyx_n_s_rstop);
4389 Py_CLEAR(clear_module_state->__pyx_n_s_rtid);
4390 Py_CLEAR(clear_module_state->__pyx_n_s_rval);
4391 Py_CLEAR(clear_module_state->__pyx_n_s_seek);
4392 Py_CLEAR(clear_module_state->__pyx_kp_u_seek_failed_on_HFile);
4393 Py_CLEAR(clear_module_state->__pyx_kp_u_seek_not_available_in_streams);
4394 Py_CLEAR(clear_module_state->__pyx_kp_u_seek_not_implemented_in_files_co);
4395 Py_CLEAR(clear_module_state->__pyx_n_s_seekable);
4396 Py_CLEAR(clear_module_state->__pyx_n_s_self);
4397 Py_CLEAR(clear_module_state->__pyx_kp_s_self_fp_cannot_be_converted_to_a);
4398 Py_CLEAR(clear_module_state->__pyx_n_s_set_name);
4399 Py_CLEAR(clear_module_state->__pyx_n_s_set_verbosity);
4400 Py_CLEAR(clear_module_state->__pyx_n_u_set_verbosity);
4401 Py_CLEAR(clear_module_state->__pyx_n_s_setstate);
4402 Py_CLEAR(clear_module_state->__pyx_n_s_setstate_cython);
4403 Py_CLEAR(clear_module_state->__pyx_n_s_size);
4404 Py_CLEAR(clear_module_state->__pyx_n_s_spec);
4405 Py_CLEAR(clear_module_state->__pyx_n_s_split);
4406 Py_CLEAR(clear_module_state->__pyx_n_s_start);
4407 Py_CLEAR(clear_module_state->__pyx_kp_u_start_out_of_range_i);
4408 Py_CLEAR(clear_module_state->__pyx_n_s_stop);
4409 Py_CLEAR(clear_module_state->__pyx_kp_u_stop_and_end_should_not_both_be);
4410 Py_CLEAR(clear_module_state->__pyx_kp_u_stop_out_of_range_i);
4411 Py_CLEAR(clear_module_state->__pyx_kp_s_stringsource);
4412 Py_CLEAR(clear_module_state->__pyx_n_s_super);
4413 Py_CLEAR(clear_module_state->__pyx_n_s_tb);
4414 Py_CLEAR(clear_module_state->__pyx_n_s_tell);
4415 Py_CLEAR(clear_module_state->__pyx_kp_u_tell_failed_on_HFile);
4416 Py_CLEAR(clear_module_state->__pyx_kp_u_tell_not_available_in_streams);
4417 Py_CLEAR(clear_module_state->__pyx_n_s_test);
4418 Py_CLEAR(clear_module_state->__pyx_n_s_tid);
4419 Py_CLEAR(clear_module_state->__pyx_n_s_traceback);
4420 Py_CLEAR(clear_module_state->__pyx_n_s_truncate);
4421 Py_CLEAR(clear_module_state->__pyx_n_s_type);
4422 Py_CLEAR(clear_module_state->__pyx_n_s_value);
4423 Py_CLEAR(clear_module_state->__pyx_n_s_verbosity);
4424 Py_CLEAR(clear_module_state->__pyx_n_u_w);
4425 Py_CLEAR(clear_module_state->__pyx_n_s_warn);
4426 Py_CLEAR(clear_module_state->__pyx_n_s_warnings);
4427 Py_CLEAR(clear_module_state->__pyx_n_s_whence);
4428 Py_CLEAR(clear_module_state->__pyx_n_s_writable);
4429 Py_CLEAR(clear_module_state->__pyx_n_s_write);
4430 Py_CLEAR(clear_module_state->__pyx_kp_u_write_failed_on_HFile);
4431 Py_CLEAR(clear_module_state->__pyx_n_s_writelines);
4432 Py_CLEAR(clear_module_state->__pyx_int_0);
4433 Py_CLEAR(clear_module_state->__pyx_int_1);
4434 Py_CLEAR(clear_module_state->__pyx_int_neg_1);
4435 Py_CLEAR(clear_module_state->__pyx_codeobj_);
4436 Py_CLEAR(clear_module_state->__pyx_tuple__5);
4437 Py_CLEAR(clear_module_state->__pyx_tuple__6);
4438 Py_CLEAR(clear_module_state->__pyx_tuple__39);
4439 Py_CLEAR(clear_module_state->__pyx_tuple__43);
4440 Py_CLEAR(clear_module_state->__pyx_tuple__44);
4441 Py_CLEAR(clear_module_state->__pyx_tuple__46);
4442 Py_CLEAR(clear_module_state->__pyx_tuple__47);
4443 Py_CLEAR(clear_module_state->__pyx_tuple__48);
4444 Py_CLEAR(clear_module_state->__pyx_tuple__49);
4445 Py_CLEAR(clear_module_state->__pyx_tuple__51);
4446 Py_CLEAR(clear_module_state->__pyx_tuple__53);
4447 Py_CLEAR(clear_module_state->__pyx_tuple__54);
4448 Py_CLEAR(clear_module_state->__pyx_tuple__57);
4449 Py_CLEAR(clear_module_state->__pyx_tuple__66);
4450 Py_CLEAR(clear_module_state->__pyx_tuple__67);
4451 Py_CLEAR(clear_module_state->__pyx_tuple__68);
4452 Py_CLEAR(clear_module_state->__pyx_tuple__69);
4453 Py_CLEAR(clear_module_state->__pyx_tuple__70);
4454 Py_CLEAR(clear_module_state->__pyx_tuple__71);
4455 Py_CLEAR(clear_module_state->__pyx_tuple__72);
4456 Py_CLEAR(clear_module_state->__pyx_tuple__73);
4457 Py_CLEAR(clear_module_state->__pyx_tuple__74);
4458 Py_CLEAR(clear_module_state->__pyx_tuple__75);
4459 Py_CLEAR(clear_module_state->__pyx_tuple__76);
4460 Py_CLEAR(clear_module_state->__pyx_tuple__77);
4461 Py_CLEAR(clear_module_state->__pyx_tuple__78);
4462 Py_CLEAR(clear_module_state->__pyx_tuple__79);
4463 Py_CLEAR(clear_module_state->__pyx_tuple__80);
4464 Py_CLEAR(clear_module_state->__pyx_tuple__81);
4465 Py_CLEAR(clear_module_state->__pyx_tuple__82);
4466 Py_CLEAR(clear_module_state->__pyx_tuple__83);
4467 Py_CLEAR(clear_module_state->__pyx_tuple__84);
4468 Py_CLEAR(clear_module_state->__pyx_tuple__85);
4469 Py_CLEAR(clear_module_state->__pyx_tuple__86);
4470 Py_CLEAR(clear_module_state->__pyx_tuple__87);
4471 Py_CLEAR(clear_module_state->__pyx_tuple__88);
4472 Py_CLEAR(clear_module_state->__pyx_tuple__89);
4473 Py_CLEAR(clear_module_state->__pyx_tuple__90);
4474 Py_CLEAR(clear_module_state->__pyx_tuple__91);
4475 Py_CLEAR(clear_module_state->__pyx_tuple__92);
4476 Py_CLEAR(clear_module_state->__pyx_tuple__93);
4477 Py_CLEAR(clear_module_state->__pyx_tuple__94);
4478 Py_CLEAR(clear_module_state->__pyx_tuple__95);
4479 Py_CLEAR(clear_module_state->__pyx_tuple__96);
4480 Py_CLEAR(clear_module_state->__pyx_codeobj__2);
4481 Py_CLEAR(clear_module_state->__pyx_codeobj__3);
4482 Py_CLEAR(clear_module_state->__pyx_codeobj__4);
4483 Py_CLEAR(clear_module_state->__pyx_codeobj__7);
4484 Py_CLEAR(clear_module_state->__pyx_codeobj__8);
4485 Py_CLEAR(clear_module_state->__pyx_codeobj__9);
4486 Py_CLEAR(clear_module_state->__pyx_codeobj__10);
4487 Py_CLEAR(clear_module_state->__pyx_codeobj__11);
4488 Py_CLEAR(clear_module_state->__pyx_codeobj__12);
4489 Py_CLEAR(clear_module_state->__pyx_codeobj__14);
4490 Py_CLEAR(clear_module_state->__pyx_codeobj__15);
4491 Py_CLEAR(clear_module_state->__pyx_codeobj__16);
4492 Py_CLEAR(clear_module_state->__pyx_codeobj__17);
4493 Py_CLEAR(clear_module_state->__pyx_codeobj__19);
4494 Py_CLEAR(clear_module_state->__pyx_codeobj__20);
4495 Py_CLEAR(clear_module_state->__pyx_codeobj__21);
4496 Py_CLEAR(clear_module_state->__pyx_codeobj__22);
4497 Py_CLEAR(clear_module_state->__pyx_codeobj__23);
4498 Py_CLEAR(clear_module_state->__pyx_codeobj__24);
4499 Py_CLEAR(clear_module_state->__pyx_codeobj__25);
4500 Py_CLEAR(clear_module_state->__pyx_codeobj__26);
4501 Py_CLEAR(clear_module_state->__pyx_codeobj__27);
4502 Py_CLEAR(clear_module_state->__pyx_codeobj__28);
4503 Py_CLEAR(clear_module_state->__pyx_codeobj__29);
4504 Py_CLEAR(clear_module_state->__pyx_codeobj__30);
4505 Py_CLEAR(clear_module_state->__pyx_codeobj__31);
4506 Py_CLEAR(clear_module_state->__pyx_codeobj__32);
4507 Py_CLEAR(clear_module_state->__pyx_codeobj__33);
4508 Py_CLEAR(clear_module_state->__pyx_codeobj__34);
4509 Py_CLEAR(clear_module_state->__pyx_codeobj__35);
4510 Py_CLEAR(clear_module_state->__pyx_codeobj__36);
4511 Py_CLEAR(clear_module_state->__pyx_codeobj__37);
4512 Py_CLEAR(clear_module_state->__pyx_codeobj__38);
4513 Py_CLEAR(clear_module_state->__pyx_codeobj__40);
4514 Py_CLEAR(clear_module_state->__pyx_codeobj__42);
4515 Py_CLEAR(clear_module_state->__pyx_codeobj__45);
4516 Py_CLEAR(clear_module_state->__pyx_codeobj__50);
4517 Py_CLEAR(clear_module_state->__pyx_codeobj__52);
4518 Py_CLEAR(clear_module_state->__pyx_codeobj__60);
4519 Py_CLEAR(clear_module_state->__pyx_codeobj__61);
4520 Py_CLEAR(clear_module_state->__pyx_codeobj__62);
4521 Py_CLEAR(clear_module_state->__pyx_codeobj__63);
4522 Py_CLEAR(clear_module_state->__pyx_codeobj__64);
4523 Py_CLEAR(clear_module_state->__pyx_codeobj__65);
4524 return 0;
4525 }
4526 #endif
4527 /* #### Code section: module_state_traverse ### */
4528 #if CYTHON_USE_MODULE_STATE
4529 static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) {
4530 __pyx_mstate *traverse_module_state = __pyx_mstate(m);
4531 if (!traverse_module_state) return 0;
4532 Py_VISIT(traverse_module_state->__pyx_d);
4533 Py_VISIT(traverse_module_state->__pyx_b);
4534 Py_VISIT(traverse_module_state->__pyx_cython_runtime);
4535 Py_VISIT(traverse_module_state->__pyx_empty_tuple);
4536 Py_VISIT(traverse_module_state->__pyx_empty_bytes);
4537 Py_VISIT(traverse_module_state->__pyx_empty_unicode);
4538 #ifdef __Pyx_CyFunction_USED
4539 Py_VISIT(traverse_module_state->__pyx_CyFunctionType);
4540 #endif
4541 #ifdef __Pyx_FusedFunction_USED
4542 Py_VISIT(traverse_module_state->__pyx_FusedFunctionType);
4543 #endif
4544 Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_4type_type);
4545 Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_4bool_bool);
4546 Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_7complex_complex);
4547 Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_5array_array);
4548 Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_10libchtslib_HTSFile);
4549 Py_VISIT(traverse_module_state->__pyx_type_5pysam_10libchtslib_HTSFile);
4550 Py_VISIT(traverse_module_state->__pyx_ptype_5pysam_10libchtslib_HFile);
4551 Py_VISIT(traverse_module_state->__pyx_type_5pysam_10libchtslib_HFile);
4552 Py_VISIT(traverse_module_state->__pyx_n_u_ALIGNMENTS);
4553 Py_VISIT(traverse_module_state->__pyx_kp_u_An_error_occurred_while_applying);
4554 Py_VISIT(traverse_module_state->__pyx_n_s_AttributeError);
4555 Py_VISIT(traverse_module_state->__pyx_n_u_BAI);
4556 Py_VISIT(traverse_module_state->__pyx_n_u_BAM);
4557 Py_VISIT(traverse_module_state->__pyx_n_u_BCF);
4558 Py_VISIT(traverse_module_state->__pyx_n_u_BED);
4559 Py_VISIT(traverse_module_state->__pyx_n_u_BGZF);
4560 Py_VISIT(traverse_module_state->__pyx_n_u_BINARY_FORMAT);
4561 Py_VISIT(traverse_module_state->__pyx_n_s_CFalse);
4562 Py_VISIT(traverse_module_state->__pyx_n_u_CRAI);
4563 Py_VISIT(traverse_module_state->__pyx_n_u_CRAM);
4564 Py_VISIT(traverse_module_state->__pyx_n_u_CSI);
4565 Py_VISIT(traverse_module_state->__pyx_n_s_CTrue);
4566 Py_VISIT(traverse_module_state->__pyx_n_u_CUSTOM);
4567 Py_VISIT(traverse_module_state->__pyx_n_s_CallableValue);
4568 Py_VISIT(traverse_module_state->__pyx_n_s_CallableValue___bool);
4569 Py_VISIT(traverse_module_state->__pyx_n_s_CallableValue___call);
4570 Py_VISIT(traverse_module_state->__pyx_n_s_CallableValue___eq);
4571 Py_VISIT(traverse_module_state->__pyx_n_s_CallableValue___init);
4572 Py_VISIT(traverse_module_state->__pyx_n_s_CallableValue___ne);
4573 Py_VISIT(traverse_module_state->__pyx_n_s_CallableValue___nonzero);
4574 Py_VISIT(traverse_module_state->__pyx_kp_u_Cannot_create_hfile);
4575 Py_VISIT(traverse_module_state->__pyx_kp_u_Flushing);
4576 Py_VISIT(traverse_module_state->__pyx_n_u_GZI);
4577 Py_VISIT(traverse_module_state->__pyx_n_u_GZIP);
4578 Py_VISIT(traverse_module_state->__pyx_n_s_HFile);
4579 Py_VISIT(traverse_module_state->__pyx_n_u_HFile);
4580 Py_VISIT(traverse_module_state->__pyx_n_s_HFile___enter);
4581 Py_VISIT(traverse_module_state->__pyx_n_s_HFile___exit);
4582 Py_VISIT(traverse_module_state->__pyx_n_s_HFile___reduce_cython);
4583 Py_VISIT(traverse_module_state->__pyx_n_s_HFile___setstate_cython);
4584 Py_VISIT(traverse_module_state->__pyx_n_s_HFile_close);
4585 Py_VISIT(traverse_module_state->__pyx_n_s_HFile_fileno);
4586 Py_VISIT(traverse_module_state->__pyx_n_s_HFile_flush);
4587 Py_VISIT(traverse_module_state->__pyx_n_s_HFile_isatty);
4588 Py_VISIT(traverse_module_state->__pyx_n_s_HFile_read);
4589 Py_VISIT(traverse_module_state->__pyx_n_s_HFile_readable);
4590 Py_VISIT(traverse_module_state->__pyx_n_s_HFile_readall);
4591 Py_VISIT(traverse_module_state->__pyx_n_s_HFile_readinto);
4592 Py_VISIT(traverse_module_state->__pyx_n_s_HFile_readline);
4593 Py_VISIT(traverse_module_state->__pyx_n_s_HFile_readlines);
4594 Py_VISIT(traverse_module_state->__pyx_n_s_HFile_seek);
4595 Py_VISIT(traverse_module_state->__pyx_n_s_HFile_seekable);
4596 Py_VISIT(traverse_module_state->__pyx_n_s_HFile_tell);
4597 Py_VISIT(traverse_module_state->__pyx_n_s_HFile_truncate);
4598 Py_VISIT(traverse_module_state->__pyx_n_s_HFile_writable);
4599 Py_VISIT(traverse_module_state->__pyx_n_s_HFile_write);
4600 Py_VISIT(traverse_module_state->__pyx_n_s_HFile_writelines);
4601 Py_VISIT(traverse_module_state->__pyx_n_s_HTSFile);
4602 Py_VISIT(traverse_module_state->__pyx_n_u_HTSFile);
4603 Py_VISIT(traverse_module_state->__pyx_n_s_HTSFile___enter);
4604 Py_VISIT(traverse_module_state->__pyx_n_s_HTSFile___exit);
4605 Py_VISIT(traverse_module_state->__pyx_n_s_HTSFile___reduce_cython);
4606 Py_VISIT(traverse_module_state->__pyx_n_s_HTSFile___setstate_cython);
4607 Py_VISIT(traverse_module_state->__pyx_n_s_HTSFile_add_hts_options);
4608 Py_VISIT(traverse_module_state->__pyx_n_s_HTSFile_check_truncation);
4609 Py_VISIT(traverse_module_state->__pyx_n_s_HTSFile_close);
4610 Py_VISIT(traverse_module_state->__pyx_n_s_HTSFile_flush);
4611 Py_VISIT(traverse_module_state->__pyx_n_s_HTSFile_get_reference_name);
4612 Py_VISIT(traverse_module_state->__pyx_n_s_HTSFile_get_tid);
4613 Py_VISIT(traverse_module_state->__pyx_n_s_HTSFile_is_valid_reference_name);
4614 Py_VISIT(traverse_module_state->__pyx_n_s_HTSFile_is_valid_tid);
4615 Py_VISIT(traverse_module_state->__pyx_n_s_HTSFile_parse_region);
4616 Py_VISIT(traverse_module_state->__pyx_n_s_HTSFile_reset);
4617 Py_VISIT(traverse_module_state->__pyx_n_s_HTSFile_seek);
4618 Py_VISIT(traverse_module_state->__pyx_n_s_HTSFile_tell);
4619 Py_VISIT(traverse_module_state->__pyx_n_u_INDEX);
4620 Py_VISIT(traverse_module_state->__pyx_n_s_IOError);
4621 Py_VISIT(traverse_module_state->__pyx_kp_u_I_O_operation_on_closed_file);
4622 Py_VISIT(traverse_module_state->__pyx_n_s_IndexError);
4623 Py_VISIT(traverse_module_state->__pyx_kp_u_Invalid_format_option_specified);
4624 Py_VISIT(traverse_module_state->__pyx_n_s_MemoryError);
4625 Py_VISIT(traverse_module_state->__pyx_n_u_NONE);
4626 Py_VISIT(traverse_module_state->__pyx_n_s_NotImplementedError);
4627 Py_VISIT(traverse_module_state->__pyx_n_s_OSError);
4628 Py_VISIT(traverse_module_state->__pyx_n_s_OverflowError);
4629 Py_VISIT(traverse_module_state->__pyx_n_u_REGIONS);
4630 Py_VISIT(traverse_module_state->__pyx_n_s_RuntimeError);
4631 Py_VISIT(traverse_module_state->__pyx_n_u_SAM);
4632 Py_VISIT(traverse_module_state->__pyx_n_s_SEEK_SET);
4633 Py_VISIT(traverse_module_state->__pyx_n_s_StopIteration);
4634 Py_VISIT(traverse_module_state->__pyx_n_u_TBI);
4635 Py_VISIT(traverse_module_state->__pyx_n_u_TEXT_FORMAT);
4636 Py_VISIT(traverse_module_state->__pyx_n_s_TypeError);
4637 Py_VISIT(traverse_module_state->__pyx_n_u_UNKNOWN);
4638 Py_VISIT(traverse_module_state->__pyx_n_u_VARIANTS);
4639 Py_VISIT(traverse_module_state->__pyx_n_u_VCF);
4640 Py_VISIT(traverse_module_state->__pyx_n_s_ValueError);
4641 Py_VISIT(traverse_module_state->__pyx_kp_b__13);
4642 Py_VISIT(traverse_module_state->__pyx_kp_u__55);
4643 Py_VISIT(traverse_module_state->__pyx_kp_u__56);
4644 Py_VISIT(traverse_module_state->__pyx_n_s__58);
4645 Py_VISIT(traverse_module_state->__pyx_kp_u__58);
4646 Py_VISIT(traverse_module_state->__pyx_kp_u__59);
4647 Py_VISIT(traverse_module_state->__pyx_n_s__97);
4648 Py_VISIT(traverse_module_state->__pyx_n_s_add_hts_options);
4649 Py_VISIT(traverse_module_state->__pyx_n_s_all);
4650 Py_VISIT(traverse_module_state->__pyx_n_s_asyncio_coroutines);
4651 Py_VISIT(traverse_module_state->__pyx_n_b_b);
4652 Py_VISIT(traverse_module_state->__pyx_n_s_b);
4653 Py_VISIT(traverse_module_state->__pyx_n_s_bgzfp);
4654 Py_VISIT(traverse_module_state->__pyx_n_s_bool);
4655 Py_VISIT(traverse_module_state->__pyx_n_s_buf);
4656 Py_VISIT(traverse_module_state->__pyx_n_s_bytes_read);
4657 Py_VISIT(traverse_module_state->__pyx_n_b_c);
4658 Py_VISIT(traverse_module_state->__pyx_n_s_call);
4659 Py_VISIT(traverse_module_state->__pyx_n_s_check_truncation);
4660 Py_VISIT(traverse_module_state->__pyx_n_s_chunk_size);
4661 Py_VISIT(traverse_module_state->__pyx_n_s_class_getitem);
4662 Py_VISIT(traverse_module_state->__pyx_n_s_cline_in_traceback);
4663 Py_VISIT(traverse_module_state->__pyx_n_s_close);
4664 Py_VISIT(traverse_module_state->__pyx_n_s_closefd);
4665 Py_VISIT(traverse_module_state->__pyx_n_s_contig);
4666 Py_VISIT(traverse_module_state->__pyx_kp_u_contig_and_reference_should_not);
4667 Py_VISIT(traverse_module_state->__pyx_n_s_coord);
4668 Py_VISIT(traverse_module_state->__pyx_n_s_cpart);
4669 Py_VISIT(traverse_module_state->__pyx_n_s_dict);
4670 Py_VISIT(traverse_module_state->__pyx_kp_u_disable);
4671 Py_VISIT(traverse_module_state->__pyx_n_s_doc);
4672 Py_VISIT(traverse_module_state->__pyx_kp_u_enable);
4673 Py_VISIT(traverse_module_state->__pyx_n_s_end);
4674 Py_VISIT(traverse_module_state->__pyx_n_s_enter);
4675 Py_VISIT(traverse_module_state->__pyx_n_s_eq);
4676 Py_VISIT(traverse_module_state->__pyx_kp_u_error_checking_for_EOF_marker);
4677 Py_VISIT(traverse_module_state->__pyx_n_s_exc_type);
4678 Py_VISIT(traverse_module_state->__pyx_n_s_exc_value);
4679 Py_VISIT(traverse_module_state->__pyx_n_s_exit);
4680 Py_VISIT(traverse_module_state->__pyx_kp_u_failed);
4681 Py_VISIT(traverse_module_state->__pyx_kp_u_failed_to_close_HFile);
4682 Py_VISIT(traverse_module_state->__pyx_kp_u_failed_to_flush_HFile);
4683 Py_VISIT(traverse_module_state->__pyx_kp_u_failed_to_open_HFile);
4684 Py_VISIT(traverse_module_state->__pyx_kp_u_failed_to_read_HFile);
4685 Py_VISIT(traverse_module_state->__pyx_kp_u_fd);
4686 Py_VISIT(traverse_module_state->__pyx_n_s_fileno);
4687 Py_VISIT(traverse_module_state->__pyx_kp_u_fileno_not_available);
4688 Py_VISIT(traverse_module_state->__pyx_n_s_flush);
4689 Py_VISIT(traverse_module_state->__pyx_n_s_format);
4690 Py_VISIT(traverse_module_state->__pyx_n_s_format_option);
4691 Py_VISIT(traverse_module_state->__pyx_n_s_format_options);
4692 Py_VISIT(traverse_module_state->__pyx_n_s_fp);
4693 Py_VISIT(traverse_module_state->__pyx_kp_u_gc);
4694 Py_VISIT(traverse_module_state->__pyx_n_s_get_reference_name);
4695 Py_VISIT(traverse_module_state->__pyx_n_s_get_tid);
4696 Py_VISIT(traverse_module_state->__pyx_n_s_get_verbosity);
4697 Py_VISIT(traverse_module_state->__pyx_n_u_get_verbosity);
4698 Py_VISIT(traverse_module_state->__pyx_n_s_getstate);
4699 Py_VISIT(traverse_module_state->__pyx_n_s_got);
4700 Py_VISIT(traverse_module_state->__pyx_n_s_ignore_truncation);
4701 Py_VISIT(traverse_module_state->__pyx_n_s_import);
4702 Py_VISIT(traverse_module_state->__pyx_n_s_init);
4703 Py_VISIT(traverse_module_state->__pyx_n_s_init_subclass);
4704 Py_VISIT(traverse_module_state->__pyx_n_s_initializing);
4705 Py_VISIT(traverse_module_state->__pyx_kp_u_invalid_contig_s);
4706 Py_VISIT(traverse_module_state->__pyx_kp_u_invalid_coordinates_start_i_stop);
4707 Py_VISIT(traverse_module_state->__pyx_kp_u_invalid_tid);
4708 Py_VISIT(traverse_module_state->__pyx_n_s_io);
4709 Py_VISIT(traverse_module_state->__pyx_n_s_is_coroutine);
4710 Py_VISIT(traverse_module_state->__pyx_n_s_is_open);
4711 Py_VISIT(traverse_module_state->__pyx_n_s_is_valid_reference_name);
4712 Py_VISIT(traverse_module_state->__pyx_n_s_is_valid_tid);
4713 Py_VISIT(traverse_module_state->__pyx_n_s_isatty);
4714 Py_VISIT(traverse_module_state->__pyx_kp_u_isenabled);
4715 Py_VISIT(traverse_module_state->__pyx_n_s_join);
4716 Py_VISIT(traverse_module_state->__pyx_n_s_line);
4717 Py_VISIT(traverse_module_state->__pyx_n_s_lines);
4718 Py_VISIT(traverse_module_state->__pyx_n_s_main);
4719 Py_VISIT(traverse_module_state->__pyx_n_s_metaclass);
4720 Py_VISIT(traverse_module_state->__pyx_kp_u_metadata_not_available_on_closed);
4721 Py_VISIT(traverse_module_state->__pyx_n_s_mode);
4722 Py_VISIT(traverse_module_state->__pyx_n_s_module);
4723 Py_VISIT(traverse_module_state->__pyx_n_s_mro_entries);
4724 Py_VISIT(traverse_module_state->__pyx_n_s_msg);
4725 Py_VISIT(traverse_module_state->__pyx_n_s_mv);
4726 Py_VISIT(traverse_module_state->__pyx_n_s_name);
4727 Py_VISIT(traverse_module_state->__pyx_n_s_name_2);
4728 Py_VISIT(traverse_module_state->__pyx_n_s_ne);
4729 Py_VISIT(traverse_module_state->__pyx_kp_u_no_BGZF_EOF_marker_file_may_be_t);
4730 Py_VISIT(traverse_module_state->__pyx_kp_s_no_default___reduce___due_to_non);
4731 Py_VISIT(traverse_module_state->__pyx_n_s_nonzero);
4732 Py_VISIT(traverse_module_state->__pyx_n_s_object);
4733 Py_VISIT(traverse_module_state->__pyx_n_s_off);
4734 Py_VISIT(traverse_module_state->__pyx_n_s_offset);
4735 Py_VISIT(traverse_module_state->__pyx_kp_u_operation_on_closed_HFile);
4736 Py_VISIT(traverse_module_state->__pyx_n_s_opts);
4737 Py_VISIT(traverse_module_state->__pyx_n_s_os);
4738 Py_VISIT(traverse_module_state->__pyx_n_s_other);
4739 Py_VISIT(traverse_module_state->__pyx_n_s_parse_region);
4740 Py_VISIT(traverse_module_state->__pyx_n_s_part);
4741 Py_VISIT(traverse_module_state->__pyx_n_s_parts);
4742 Py_VISIT(traverse_module_state->__pyx_n_s_prepare);
4743 Py_VISIT(traverse_module_state->__pyx_n_s_pysam_libchtslib);
4744 Py_VISIT(traverse_module_state->__pyx_kp_s_pysam_libchtslib_pyx);
4745 Py_VISIT(traverse_module_state->__pyx_n_s_pyx_state);
4746 Py_VISIT(traverse_module_state->__pyx_n_s_pyx_vtable);
4747 Py_VISIT(traverse_module_state->__pyx_n_s_qualname);
4748 Py_VISIT(traverse_module_state->__pyx_n_u_r);
4749 Py_VISIT(traverse_module_state->__pyx_n_s_re);
4750 Py_VISIT(traverse_module_state->__pyx_n_s_read);
4751 Py_VISIT(traverse_module_state->__pyx_n_s_readable);
4752 Py_VISIT(traverse_module_state->__pyx_n_s_readall);
4753 Py_VISIT(traverse_module_state->__pyx_n_s_readinto);
4754 Py_VISIT(traverse_module_state->__pyx_n_s_readline);
4755 Py_VISIT(traverse_module_state->__pyx_n_s_readlines);
4756 Py_VISIT(traverse_module_state->__pyx_n_s_reduce);
4757 Py_VISIT(traverse_module_state->__pyx_n_s_reduce_cython);
4758 Py_VISIT(traverse_module_state->__pyx_n_s_reduce_ex);
4759 Py_VISIT(traverse_module_state->__pyx_n_s_reference);
4760 Py_VISIT(traverse_module_state->__pyx_n_s_region);
4761 Py_VISIT(traverse_module_state->__pyx_n_s_replace);
4762 Py_VISIT(traverse_module_state->__pyx_n_s_reset);
4763 Py_VISIT(traverse_module_state->__pyx_n_s_ret);
4764 Py_VISIT(traverse_module_state->__pyx_n_s_rstart);
4765 Py_VISIT(traverse_module_state->__pyx_n_s_rstop);
4766 Py_VISIT(traverse_module_state->__pyx_n_s_rtid);
4767 Py_VISIT(traverse_module_state->__pyx_n_s_rval);
4768 Py_VISIT(traverse_module_state->__pyx_n_s_seek);
4769 Py_VISIT(traverse_module_state->__pyx_kp_u_seek_failed_on_HFile);
4770 Py_VISIT(traverse_module_state->__pyx_kp_u_seek_not_available_in_streams);
4771 Py_VISIT(traverse_module_state->__pyx_kp_u_seek_not_implemented_in_files_co);
4772 Py_VISIT(traverse_module_state->__pyx_n_s_seekable);
4773 Py_VISIT(traverse_module_state->__pyx_n_s_self);
4774 Py_VISIT(traverse_module_state->__pyx_kp_s_self_fp_cannot_be_converted_to_a);
4775 Py_VISIT(traverse_module_state->__pyx_n_s_set_name);
4776 Py_VISIT(traverse_module_state->__pyx_n_s_set_verbosity);
4777 Py_VISIT(traverse_module_state->__pyx_n_u_set_verbosity);
4778 Py_VISIT(traverse_module_state->__pyx_n_s_setstate);
4779 Py_VISIT(traverse_module_state->__pyx_n_s_setstate_cython);
4780 Py_VISIT(traverse_module_state->__pyx_n_s_size);
4781 Py_VISIT(traverse_module_state->__pyx_n_s_spec);
4782 Py_VISIT(traverse_module_state->__pyx_n_s_split);
4783 Py_VISIT(traverse_module_state->__pyx_n_s_start);
4784 Py_VISIT(traverse_module_state->__pyx_kp_u_start_out_of_range_i);
4785 Py_VISIT(traverse_module_state->__pyx_n_s_stop);
4786 Py_VISIT(traverse_module_state->__pyx_kp_u_stop_and_end_should_not_both_be);
4787 Py_VISIT(traverse_module_state->__pyx_kp_u_stop_out_of_range_i);
4788 Py_VISIT(traverse_module_state->__pyx_kp_s_stringsource);
4789 Py_VISIT(traverse_module_state->__pyx_n_s_super);
4790 Py_VISIT(traverse_module_state->__pyx_n_s_tb);
4791 Py_VISIT(traverse_module_state->__pyx_n_s_tell);
4792 Py_VISIT(traverse_module_state->__pyx_kp_u_tell_failed_on_HFile);
4793 Py_VISIT(traverse_module_state->__pyx_kp_u_tell_not_available_in_streams);
4794 Py_VISIT(traverse_module_state->__pyx_n_s_test);
4795 Py_VISIT(traverse_module_state->__pyx_n_s_tid);
4796 Py_VISIT(traverse_module_state->__pyx_n_s_traceback);
4797 Py_VISIT(traverse_module_state->__pyx_n_s_truncate);
4798 Py_VISIT(traverse_module_state->__pyx_n_s_type);
4799 Py_VISIT(traverse_module_state->__pyx_n_s_value);
4800 Py_VISIT(traverse_module_state->__pyx_n_s_verbosity);
4801 Py_VISIT(traverse_module_state->__pyx_n_u_w);
4802 Py_VISIT(traverse_module_state->__pyx_n_s_warn);
4803 Py_VISIT(traverse_module_state->__pyx_n_s_warnings);
4804 Py_VISIT(traverse_module_state->__pyx_n_s_whence);
4805 Py_VISIT(traverse_module_state->__pyx_n_s_writable);
4806 Py_VISIT(traverse_module_state->__pyx_n_s_write);
4807 Py_VISIT(traverse_module_state->__pyx_kp_u_write_failed_on_HFile);
4808 Py_VISIT(traverse_module_state->__pyx_n_s_writelines);
4809 Py_VISIT(traverse_module_state->__pyx_int_0);
4810 Py_VISIT(traverse_module_state->__pyx_int_1);
4811 Py_VISIT(traverse_module_state->__pyx_int_neg_1);
4812 Py_VISIT(traverse_module_state->__pyx_codeobj_);
4813 Py_VISIT(traverse_module_state->__pyx_tuple__5);
4814 Py_VISIT(traverse_module_state->__pyx_tuple__6);
4815 Py_VISIT(traverse_module_state->__pyx_tuple__39);
4816 Py_VISIT(traverse_module_state->__pyx_tuple__43);
4817 Py_VISIT(traverse_module_state->__pyx_tuple__44);
4818 Py_VISIT(traverse_module_state->__pyx_tuple__46);
4819 Py_VISIT(traverse_module_state->__pyx_tuple__47);
4820 Py_VISIT(traverse_module_state->__pyx_tuple__48);
4821 Py_VISIT(traverse_module_state->__pyx_tuple__49);
4822 Py_VISIT(traverse_module_state->__pyx_tuple__51);
4823 Py_VISIT(traverse_module_state->__pyx_tuple__53);
4824 Py_VISIT(traverse_module_state->__pyx_tuple__54);
4825 Py_VISIT(traverse_module_state->__pyx_tuple__57);
4826 Py_VISIT(traverse_module_state->__pyx_tuple__66);
4827 Py_VISIT(traverse_module_state->__pyx_tuple__67);
4828 Py_VISIT(traverse_module_state->__pyx_tuple__68);
4829 Py_VISIT(traverse_module_state->__pyx_tuple__69);
4830 Py_VISIT(traverse_module_state->__pyx_tuple__70);
4831 Py_VISIT(traverse_module_state->__pyx_tuple__71);
4832 Py_VISIT(traverse_module_state->__pyx_tuple__72);
4833 Py_VISIT(traverse_module_state->__pyx_tuple__73);
4834 Py_VISIT(traverse_module_state->__pyx_tuple__74);
4835 Py_VISIT(traverse_module_state->__pyx_tuple__75);
4836 Py_VISIT(traverse_module_state->__pyx_tuple__76);
4837 Py_VISIT(traverse_module_state->__pyx_tuple__77);
4838 Py_VISIT(traverse_module_state->__pyx_tuple__78);
4839 Py_VISIT(traverse_module_state->__pyx_tuple__79);
4840 Py_VISIT(traverse_module_state->__pyx_tuple__80);
4841 Py_VISIT(traverse_module_state->__pyx_tuple__81);
4842 Py_VISIT(traverse_module_state->__pyx_tuple__82);
4843 Py_VISIT(traverse_module_state->__pyx_tuple__83);
4844 Py_VISIT(traverse_module_state->__pyx_tuple__84);
4845 Py_VISIT(traverse_module_state->__pyx_tuple__85);
4846 Py_VISIT(traverse_module_state->__pyx_tuple__86);
4847 Py_VISIT(traverse_module_state->__pyx_tuple__87);
4848 Py_VISIT(traverse_module_state->__pyx_tuple__88);
4849 Py_VISIT(traverse_module_state->__pyx_tuple__89);
4850 Py_VISIT(traverse_module_state->__pyx_tuple__90);
4851 Py_VISIT(traverse_module_state->__pyx_tuple__91);
4852 Py_VISIT(traverse_module_state->__pyx_tuple__92);
4853 Py_VISIT(traverse_module_state->__pyx_tuple__93);
4854 Py_VISIT(traverse_module_state->__pyx_tuple__94);
4855 Py_VISIT(traverse_module_state->__pyx_tuple__95);
4856 Py_VISIT(traverse_module_state->__pyx_tuple__96);
4857 Py_VISIT(traverse_module_state->__pyx_codeobj__2);
4858 Py_VISIT(traverse_module_state->__pyx_codeobj__3);
4859 Py_VISIT(traverse_module_state->__pyx_codeobj__4);
4860 Py_VISIT(traverse_module_state->__pyx_codeobj__7);
4861 Py_VISIT(traverse_module_state->__pyx_codeobj__8);
4862 Py_VISIT(traverse_module_state->__pyx_codeobj__9);
4863 Py_VISIT(traverse_module_state->__pyx_codeobj__10);
4864 Py_VISIT(traverse_module_state->__pyx_codeobj__11);
4865 Py_VISIT(traverse_module_state->__pyx_codeobj__12);
4866 Py_VISIT(traverse_module_state->__pyx_codeobj__14);
4867 Py_VISIT(traverse_module_state->__pyx_codeobj__15);
4868 Py_VISIT(traverse_module_state->__pyx_codeobj__16);
4869 Py_VISIT(traverse_module_state->__pyx_codeobj__17);
4870 Py_VISIT(traverse_module_state->__pyx_codeobj__19);
4871 Py_VISIT(traverse_module_state->__pyx_codeobj__20);
4872 Py_VISIT(traverse_module_state->__pyx_codeobj__21);
4873 Py_VISIT(traverse_module_state->__pyx_codeobj__22);
4874 Py_VISIT(traverse_module_state->__pyx_codeobj__23);
4875 Py_VISIT(traverse_module_state->__pyx_codeobj__24);
4876 Py_VISIT(traverse_module_state->__pyx_codeobj__25);
4877 Py_VISIT(traverse_module_state->__pyx_codeobj__26);
4878 Py_VISIT(traverse_module_state->__pyx_codeobj__27);
4879 Py_VISIT(traverse_module_state->__pyx_codeobj__28);
4880 Py_VISIT(traverse_module_state->__pyx_codeobj__29);
4881 Py_VISIT(traverse_module_state->__pyx_codeobj__30);
4882 Py_VISIT(traverse_module_state->__pyx_codeobj__31);
4883 Py_VISIT(traverse_module_state->__pyx_codeobj__32);
4884 Py_VISIT(traverse_module_state->__pyx_codeobj__33);
4885 Py_VISIT(traverse_module_state->__pyx_codeobj__34);
4886 Py_VISIT(traverse_module_state->__pyx_codeobj__35);
4887 Py_VISIT(traverse_module_state->__pyx_codeobj__36);
4888 Py_VISIT(traverse_module_state->__pyx_codeobj__37);
4889 Py_VISIT(traverse_module_state->__pyx_codeobj__38);
4890 Py_VISIT(traverse_module_state->__pyx_codeobj__40);
4891 Py_VISIT(traverse_module_state->__pyx_codeobj__42);
4892 Py_VISIT(traverse_module_state->__pyx_codeobj__45);
4893 Py_VISIT(traverse_module_state->__pyx_codeobj__50);
4894 Py_VISIT(traverse_module_state->__pyx_codeobj__52);
4895 Py_VISIT(traverse_module_state->__pyx_codeobj__60);
4896 Py_VISIT(traverse_module_state->__pyx_codeobj__61);
4897 Py_VISIT(traverse_module_state->__pyx_codeobj__62);
4898 Py_VISIT(traverse_module_state->__pyx_codeobj__63);
4899 Py_VISIT(traverse_module_state->__pyx_codeobj__64);
4900 Py_VISIT(traverse_module_state->__pyx_codeobj__65);
4901 return 0;
4902 }
4903 #endif
4904 /* #### Code section: module_state_defines ### */
4905 #define __pyx_d __pyx_mstate_global->__pyx_d
4906 #define __pyx_b __pyx_mstate_global->__pyx_b
4907 #define __pyx_cython_runtime __pyx_mstate_global->__pyx_cython_runtime
4908 #define __pyx_empty_tuple __pyx_mstate_global->__pyx_empty_tuple
4909 #define __pyx_empty_bytes __pyx_mstate_global->__pyx_empty_bytes
4910 #define __pyx_empty_unicode __pyx_mstate_global->__pyx_empty_unicode
4911 #ifdef __Pyx_CyFunction_USED
4912 #define __pyx_CyFunctionType __pyx_mstate_global->__pyx_CyFunctionType
4913 #endif
4914 #ifdef __Pyx_FusedFunction_USED
4915 #define __pyx_FusedFunctionType __pyx_mstate_global->__pyx_FusedFunctionType
4916 #endif
4917 #ifdef __Pyx_Generator_USED
4918 #define __pyx_GeneratorType __pyx_mstate_global->__pyx_GeneratorType
4919 #endif
4920 #ifdef __Pyx_IterableCoroutine_USED
4921 #define __pyx_IterableCoroutineType __pyx_mstate_global->__pyx_IterableCoroutineType
4922 #endif
4923 #ifdef __Pyx_Coroutine_USED
4924 #define __pyx_CoroutineAwaitType __pyx_mstate_global->__pyx_CoroutineAwaitType
4925 #endif
4926 #ifdef __Pyx_Coroutine_USED
4927 #define __pyx_CoroutineType __pyx_mstate_global->__pyx_CoroutineType
4928 #endif
4929 #if CYTHON_USE_MODULE_STATE
4930 #endif
4931 #if CYTHON_USE_MODULE_STATE
4932 #endif
4933 #if CYTHON_USE_MODULE_STATE
4934 #endif
4935 #if CYTHON_USE_MODULE_STATE
4936 #endif
4937 #if CYTHON_USE_MODULE_STATE
4938 #endif
4939 #if CYTHON_USE_MODULE_STATE
4940 #endif
4941 #if CYTHON_USE_MODULE_STATE
4942 #endif
4943 #if CYTHON_USE_MODULE_STATE
4944 #endif
4945 #if CYTHON_USE_MODULE_STATE
4946 #endif
4947 #if CYTHON_USE_MODULE_STATE
4948 #endif
4949 #define __pyx_ptype_7cpython_4type_type __pyx_mstate_global->__pyx_ptype_7cpython_4type_type
4950 #if CYTHON_USE_MODULE_STATE
4951 #endif
4952 #if CYTHON_USE_MODULE_STATE
4953 #endif
4954 #if CYTHON_USE_MODULE_STATE
4955 #endif
4956 #if CYTHON_USE_MODULE_STATE
4957 #endif
4958 #if CYTHON_USE_MODULE_STATE
4959 #endif
4960 #if CYTHON_USE_MODULE_STATE
4961 #endif
4962 #if CYTHON_USE_MODULE_STATE
4963 #endif
4964 #if CYTHON_USE_MODULE_STATE
4965 #endif
4966 #if CYTHON_USE_MODULE_STATE
4967 #endif
4968 #if CYTHON_USE_MODULE_STATE
4969 #endif
4970 #if CYTHON_USE_MODULE_STATE
4971 #endif
4972 #if CYTHON_USE_MODULE_STATE
4973 #endif
4974 #if CYTHON_USE_MODULE_STATE
4975 #endif
4976 #if CYTHON_USE_MODULE_STATE
4977 #endif
4978 #define __pyx_ptype_7cpython_4bool_bool __pyx_mstate_global->__pyx_ptype_7cpython_4bool_bool
4979 #if CYTHON_USE_MODULE_STATE
4980 #endif
4981 #if CYTHON_USE_MODULE_STATE
4982 #endif
4983 #if CYTHON_USE_MODULE_STATE
4984 #endif
4985 #if CYTHON_USE_MODULE_STATE
4986 #endif
4987 #define __pyx_ptype_7cpython_7complex_complex __pyx_mstate_global->__pyx_ptype_7cpython_7complex_complex
4988 #if CYTHON_USE_MODULE_STATE
4989 #endif
4990 #if CYTHON_USE_MODULE_STATE
4991 #endif
4992 #if CYTHON_USE_MODULE_STATE
4993 #endif
4994 #if CYTHON_USE_MODULE_STATE
4995 #endif
4996 #if CYTHON_USE_MODULE_STATE
4997 #endif
4998 #if CYTHON_USE_MODULE_STATE
4999 #endif
5000 #if CYTHON_USE_MODULE_STATE
5001 #endif
5002 #if CYTHON_USE_MODULE_STATE
5003 #endif
5004 #if CYTHON_USE_MODULE_STATE
5005 #endif
5006 #if CYTHON_USE_MODULE_STATE
5007 #endif
5008 #if CYTHON_USE_MODULE_STATE
5009 #endif
5010 #if CYTHON_USE_MODULE_STATE
5011 #endif
5012 #if CYTHON_USE_MODULE_STATE
5013 #endif
5014 #if CYTHON_USE_MODULE_STATE
5015 #endif
5016 #if CYTHON_USE_MODULE_STATE
5017 #endif
5018 #if CYTHON_USE_MODULE_STATE
5019 #endif
5020 #if CYTHON_USE_MODULE_STATE
5021 #endif
5022 #if CYTHON_USE_MODULE_STATE
5023 #endif
5024 #if CYTHON_USE_MODULE_STATE
5025 #endif
5026 #if CYTHON_USE_MODULE_STATE
5027 #endif
5028 #if CYTHON_USE_MODULE_STATE
5029 #endif
5030 #if CYTHON_USE_MODULE_STATE
5031 #endif
5032 #if CYTHON_USE_MODULE_STATE
5033 #endif
5034 #define __pyx_ptype_7cpython_5array_array __pyx_mstate_global->__pyx_ptype_7cpython_5array_array
5035 #if CYTHON_USE_MODULE_STATE
5036 #endif
5037 #if CYTHON_USE_MODULE_STATE
5038 #define __pyx_type_5pysam_10libchtslib_HTSFile __pyx_mstate_global->__pyx_type_5pysam_10libchtslib_HTSFile
5039 #define __pyx_type_5pysam_10libchtslib_HFile __pyx_mstate_global->__pyx_type_5pysam_10libchtslib_HFile
5040 #endif
5041 #define __pyx_ptype_5pysam_10libchtslib_HTSFile __pyx_mstate_global->__pyx_ptype_5pysam_10libchtslib_HTSFile
5042 #define __pyx_ptype_5pysam_10libchtslib_HFile __pyx_mstate_global->__pyx_ptype_5pysam_10libchtslib_HFile
5043 #define __pyx_n_u_ALIGNMENTS __pyx_mstate_global->__pyx_n_u_ALIGNMENTS
5044 #define __pyx_kp_u_An_error_occurred_while_applying __pyx_mstate_global->__pyx_kp_u_An_error_occurred_while_applying
5045 #define __pyx_n_s_AttributeError __pyx_mstate_global->__pyx_n_s_AttributeError
5046 #define __pyx_n_u_BAI __pyx_mstate_global->__pyx_n_u_BAI
5047 #define __pyx_n_u_BAM __pyx_mstate_global->__pyx_n_u_BAM
5048 #define __pyx_n_u_BCF __pyx_mstate_global->__pyx_n_u_BCF
5049 #define __pyx_n_u_BED __pyx_mstate_global->__pyx_n_u_BED
5050 #define __pyx_n_u_BGZF __pyx_mstate_global->__pyx_n_u_BGZF
5051 #define __pyx_n_u_BINARY_FORMAT __pyx_mstate_global->__pyx_n_u_BINARY_FORMAT
5052 #define __pyx_n_s_CFalse __pyx_mstate_global->__pyx_n_s_CFalse
5053 #define __pyx_n_u_CRAI __pyx_mstate_global->__pyx_n_u_CRAI
5054 #define __pyx_n_u_CRAM __pyx_mstate_global->__pyx_n_u_CRAM
5055 #define __pyx_n_u_CSI __pyx_mstate_global->__pyx_n_u_CSI
5056 #define __pyx_n_s_CTrue __pyx_mstate_global->__pyx_n_s_CTrue
5057 #define __pyx_n_u_CUSTOM __pyx_mstate_global->__pyx_n_u_CUSTOM
5058 #define __pyx_n_s_CallableValue __pyx_mstate_global->__pyx_n_s_CallableValue
5059 #define __pyx_n_s_CallableValue___bool __pyx_mstate_global->__pyx_n_s_CallableValue___bool
5060 #define __pyx_n_s_CallableValue___call __pyx_mstate_global->__pyx_n_s_CallableValue___call
5061 #define __pyx_n_s_CallableValue___eq __pyx_mstate_global->__pyx_n_s_CallableValue___eq
5062 #define __pyx_n_s_CallableValue___init __pyx_mstate_global->__pyx_n_s_CallableValue___init
5063 #define __pyx_n_s_CallableValue___ne __pyx_mstate_global->__pyx_n_s_CallableValue___ne
5064 #define __pyx_n_s_CallableValue___nonzero __pyx_mstate_global->__pyx_n_s_CallableValue___nonzero
5065 #define __pyx_kp_u_Cannot_create_hfile __pyx_mstate_global->__pyx_kp_u_Cannot_create_hfile
5066 #define __pyx_kp_u_Flushing __pyx_mstate_global->__pyx_kp_u_Flushing
5067 #define __pyx_n_u_GZI __pyx_mstate_global->__pyx_n_u_GZI
5068 #define __pyx_n_u_GZIP __pyx_mstate_global->__pyx_n_u_GZIP
5069 #define __pyx_n_s_HFile __pyx_mstate_global->__pyx_n_s_HFile
5070 #define __pyx_n_u_HFile __pyx_mstate_global->__pyx_n_u_HFile
5071 #define __pyx_n_s_HFile___enter __pyx_mstate_global->__pyx_n_s_HFile___enter
5072 #define __pyx_n_s_HFile___exit __pyx_mstate_global->__pyx_n_s_HFile___exit
5073 #define __pyx_n_s_HFile___reduce_cython __pyx_mstate_global->__pyx_n_s_HFile___reduce_cython
5074 #define __pyx_n_s_HFile___setstate_cython __pyx_mstate_global->__pyx_n_s_HFile___setstate_cython
5075 #define __pyx_n_s_HFile_close __pyx_mstate_global->__pyx_n_s_HFile_close
5076 #define __pyx_n_s_HFile_fileno __pyx_mstate_global->__pyx_n_s_HFile_fileno
5077 #define __pyx_n_s_HFile_flush __pyx_mstate_global->__pyx_n_s_HFile_flush
5078 #define __pyx_n_s_HFile_isatty __pyx_mstate_global->__pyx_n_s_HFile_isatty
5079 #define __pyx_n_s_HFile_read __pyx_mstate_global->__pyx_n_s_HFile_read
5080 #define __pyx_n_s_HFile_readable __pyx_mstate_global->__pyx_n_s_HFile_readable
5081 #define __pyx_n_s_HFile_readall __pyx_mstate_global->__pyx_n_s_HFile_readall
5082 #define __pyx_n_s_HFile_readinto __pyx_mstate_global->__pyx_n_s_HFile_readinto
5083 #define __pyx_n_s_HFile_readline __pyx_mstate_global->__pyx_n_s_HFile_readline
5084 #define __pyx_n_s_HFile_readlines __pyx_mstate_global->__pyx_n_s_HFile_readlines
5085 #define __pyx_n_s_HFile_seek __pyx_mstate_global->__pyx_n_s_HFile_seek
5086 #define __pyx_n_s_HFile_seekable __pyx_mstate_global->__pyx_n_s_HFile_seekable
5087 #define __pyx_n_s_HFile_tell __pyx_mstate_global->__pyx_n_s_HFile_tell
5088 #define __pyx_n_s_HFile_truncate __pyx_mstate_global->__pyx_n_s_HFile_truncate
5089 #define __pyx_n_s_HFile_writable __pyx_mstate_global->__pyx_n_s_HFile_writable
5090 #define __pyx_n_s_HFile_write __pyx_mstate_global->__pyx_n_s_HFile_write
5091 #define __pyx_n_s_HFile_writelines __pyx_mstate_global->__pyx_n_s_HFile_writelines
5092 #define __pyx_n_s_HTSFile __pyx_mstate_global->__pyx_n_s_HTSFile
5093 #define __pyx_n_u_HTSFile __pyx_mstate_global->__pyx_n_u_HTSFile
5094 #define __pyx_n_s_HTSFile___enter __pyx_mstate_global->__pyx_n_s_HTSFile___enter
5095 #define __pyx_n_s_HTSFile___exit __pyx_mstate_global->__pyx_n_s_HTSFile___exit
5096 #define __pyx_n_s_HTSFile___reduce_cython __pyx_mstate_global->__pyx_n_s_HTSFile___reduce_cython
5097 #define __pyx_n_s_HTSFile___setstate_cython __pyx_mstate_global->__pyx_n_s_HTSFile___setstate_cython
5098 #define __pyx_n_s_HTSFile_add_hts_options __pyx_mstate_global->__pyx_n_s_HTSFile_add_hts_options
5099 #define __pyx_n_s_HTSFile_check_truncation __pyx_mstate_global->__pyx_n_s_HTSFile_check_truncation
5100 #define __pyx_n_s_HTSFile_close __pyx_mstate_global->__pyx_n_s_HTSFile_close
5101 #define __pyx_n_s_HTSFile_flush __pyx_mstate_global->__pyx_n_s_HTSFile_flush
5102 #define __pyx_n_s_HTSFile_get_reference_name __pyx_mstate_global->__pyx_n_s_HTSFile_get_reference_name
5103 #define __pyx_n_s_HTSFile_get_tid __pyx_mstate_global->__pyx_n_s_HTSFile_get_tid
5104 #define __pyx_n_s_HTSFile_is_valid_reference_name __pyx_mstate_global->__pyx_n_s_HTSFile_is_valid_reference_name
5105 #define __pyx_n_s_HTSFile_is_valid_tid __pyx_mstate_global->__pyx_n_s_HTSFile_is_valid_tid
5106 #define __pyx_n_s_HTSFile_parse_region __pyx_mstate_global->__pyx_n_s_HTSFile_parse_region
5107 #define __pyx_n_s_HTSFile_reset __pyx_mstate_global->__pyx_n_s_HTSFile_reset
5108 #define __pyx_n_s_HTSFile_seek __pyx_mstate_global->__pyx_n_s_HTSFile_seek
5109 #define __pyx_n_s_HTSFile_tell __pyx_mstate_global->__pyx_n_s_HTSFile_tell
5110 #define __pyx_n_u_INDEX __pyx_mstate_global->__pyx_n_u_INDEX
5111 #define __pyx_n_s_IOError __pyx_mstate_global->__pyx_n_s_IOError
5112 #define __pyx_kp_u_I_O_operation_on_closed_file __pyx_mstate_global->__pyx_kp_u_I_O_operation_on_closed_file
5113 #define __pyx_n_s_IndexError __pyx_mstate_global->__pyx_n_s_IndexError
5114 #define __pyx_kp_u_Invalid_format_option_specified __pyx_mstate_global->__pyx_kp_u_Invalid_format_option_specified
5115 #define __pyx_n_s_MemoryError __pyx_mstate_global->__pyx_n_s_MemoryError
5116 #define __pyx_n_u_NONE __pyx_mstate_global->__pyx_n_u_NONE
5117 #define __pyx_n_s_NotImplementedError __pyx_mstate_global->__pyx_n_s_NotImplementedError
5118 #define __pyx_n_s_OSError __pyx_mstate_global->__pyx_n_s_OSError
5119 #define __pyx_n_s_OverflowError __pyx_mstate_global->__pyx_n_s_OverflowError
5120 #define __pyx_n_u_REGIONS __pyx_mstate_global->__pyx_n_u_REGIONS
5121 #define __pyx_n_s_RuntimeError __pyx_mstate_global->__pyx_n_s_RuntimeError
5122 #define __pyx_n_u_SAM __pyx_mstate_global->__pyx_n_u_SAM
5123 #define __pyx_n_s_SEEK_SET __pyx_mstate_global->__pyx_n_s_SEEK_SET
5124 #define __pyx_n_s_StopIteration __pyx_mstate_global->__pyx_n_s_StopIteration
5125 #define __pyx_n_u_TBI __pyx_mstate_global->__pyx_n_u_TBI
5126 #define __pyx_n_u_TEXT_FORMAT __pyx_mstate_global->__pyx_n_u_TEXT_FORMAT
5127 #define __pyx_n_s_TypeError __pyx_mstate_global->__pyx_n_s_TypeError
5128 #define __pyx_n_u_UNKNOWN __pyx_mstate_global->__pyx_n_u_UNKNOWN
5129 #define __pyx_n_u_VARIANTS __pyx_mstate_global->__pyx_n_u_VARIANTS
5130 #define __pyx_n_u_VCF __pyx_mstate_global->__pyx_n_u_VCF
5131 #define __pyx_n_s_ValueError __pyx_mstate_global->__pyx_n_s_ValueError
5132 #define __pyx_kp_b__13 __pyx_mstate_global->__pyx_kp_b__13
5133 #define __pyx_kp_u__55 __pyx_mstate_global->__pyx_kp_u__55
5134 #define __pyx_kp_u__56 __pyx_mstate_global->__pyx_kp_u__56
5135 #define __pyx_n_s__58 __pyx_mstate_global->__pyx_n_s__58
5136 #define __pyx_kp_u__58 __pyx_mstate_global->__pyx_kp_u__58
5137 #define __pyx_kp_u__59 __pyx_mstate_global->__pyx_kp_u__59
5138 #define __pyx_n_s__97 __pyx_mstate_global->__pyx_n_s__97
5139 #define __pyx_n_s_add_hts_options __pyx_mstate_global->__pyx_n_s_add_hts_options
5140 #define __pyx_n_s_all __pyx_mstate_global->__pyx_n_s_all
5141 #define __pyx_n_s_asyncio_coroutines __pyx_mstate_global->__pyx_n_s_asyncio_coroutines
5142 #define __pyx_n_b_b __pyx_mstate_global->__pyx_n_b_b
5143 #define __pyx_n_s_b __pyx_mstate_global->__pyx_n_s_b
5144 #define __pyx_n_s_bgzfp __pyx_mstate_global->__pyx_n_s_bgzfp
5145 #define __pyx_n_s_bool __pyx_mstate_global->__pyx_n_s_bool
5146 #define __pyx_n_s_buf __pyx_mstate_global->__pyx_n_s_buf
5147 #define __pyx_n_s_bytes_read __pyx_mstate_global->__pyx_n_s_bytes_read
5148 #define __pyx_n_b_c __pyx_mstate_global->__pyx_n_b_c
5149 #define __pyx_n_s_call __pyx_mstate_global->__pyx_n_s_call
5150 #define __pyx_n_s_check_truncation __pyx_mstate_global->__pyx_n_s_check_truncation
5151 #define __pyx_n_s_chunk_size __pyx_mstate_global->__pyx_n_s_chunk_size
5152 #define __pyx_n_s_class_getitem __pyx_mstate_global->__pyx_n_s_class_getitem
5153 #define __pyx_n_s_cline_in_traceback __pyx_mstate_global->__pyx_n_s_cline_in_traceback
5154 #define __pyx_n_s_close __pyx_mstate_global->__pyx_n_s_close
5155 #define __pyx_n_s_closefd __pyx_mstate_global->__pyx_n_s_closefd
5156 #define __pyx_n_s_contig __pyx_mstate_global->__pyx_n_s_contig
5157 #define __pyx_kp_u_contig_and_reference_should_not __pyx_mstate_global->__pyx_kp_u_contig_and_reference_should_not
5158 #define __pyx_n_s_coord __pyx_mstate_global->__pyx_n_s_coord
5159 #define __pyx_n_s_cpart __pyx_mstate_global->__pyx_n_s_cpart
5160 #define __pyx_n_s_dict __pyx_mstate_global->__pyx_n_s_dict
5161 #define __pyx_kp_u_disable __pyx_mstate_global->__pyx_kp_u_disable
5162 #define __pyx_n_s_doc __pyx_mstate_global->__pyx_n_s_doc
5163 #define __pyx_kp_u_enable __pyx_mstate_global->__pyx_kp_u_enable
5164 #define __pyx_n_s_end __pyx_mstate_global->__pyx_n_s_end
5165 #define __pyx_n_s_enter __pyx_mstate_global->__pyx_n_s_enter
5166 #define __pyx_n_s_eq __pyx_mstate_global->__pyx_n_s_eq
5167 #define __pyx_kp_u_error_checking_for_EOF_marker __pyx_mstate_global->__pyx_kp_u_error_checking_for_EOF_marker
5168 #define __pyx_n_s_exc_type __pyx_mstate_global->__pyx_n_s_exc_type
5169 #define __pyx_n_s_exc_value __pyx_mstate_global->__pyx_n_s_exc_value
5170 #define __pyx_n_s_exit __pyx_mstate_global->__pyx_n_s_exit
5171 #define __pyx_kp_u_failed __pyx_mstate_global->__pyx_kp_u_failed
5172 #define __pyx_kp_u_failed_to_close_HFile __pyx_mstate_global->__pyx_kp_u_failed_to_close_HFile
5173 #define __pyx_kp_u_failed_to_flush_HFile __pyx_mstate_global->__pyx_kp_u_failed_to_flush_HFile
5174 #define __pyx_kp_u_failed_to_open_HFile __pyx_mstate_global->__pyx_kp_u_failed_to_open_HFile
5175 #define __pyx_kp_u_failed_to_read_HFile __pyx_mstate_global->__pyx_kp_u_failed_to_read_HFile
5176 #define __pyx_kp_u_fd __pyx_mstate_global->__pyx_kp_u_fd
5177 #define __pyx_n_s_fileno __pyx_mstate_global->__pyx_n_s_fileno
5178 #define __pyx_kp_u_fileno_not_available __pyx_mstate_global->__pyx_kp_u_fileno_not_available
5179 #define __pyx_n_s_flush __pyx_mstate_global->__pyx_n_s_flush
5180 #define __pyx_n_s_format __pyx_mstate_global->__pyx_n_s_format
5181 #define __pyx_n_s_format_option __pyx_mstate_global->__pyx_n_s_format_option
5182 #define __pyx_n_s_format_options __pyx_mstate_global->__pyx_n_s_format_options
5183 #define __pyx_n_s_fp __pyx_mstate_global->__pyx_n_s_fp
5184 #define __pyx_kp_u_gc __pyx_mstate_global->__pyx_kp_u_gc
5185 #define __pyx_n_s_get_reference_name __pyx_mstate_global->__pyx_n_s_get_reference_name
5186 #define __pyx_n_s_get_tid __pyx_mstate_global->__pyx_n_s_get_tid
5187 #define __pyx_n_s_get_verbosity __pyx_mstate_global->__pyx_n_s_get_verbosity
5188 #define __pyx_n_u_get_verbosity __pyx_mstate_global->__pyx_n_u_get_verbosity
5189 #define __pyx_n_s_getstate __pyx_mstate_global->__pyx_n_s_getstate
5190 #define __pyx_n_s_got __pyx_mstate_global->__pyx_n_s_got
5191 #define __pyx_n_s_ignore_truncation __pyx_mstate_global->__pyx_n_s_ignore_truncation
5192 #define __pyx_n_s_import __pyx_mstate_global->__pyx_n_s_import
5193 #define __pyx_n_s_init __pyx_mstate_global->__pyx_n_s_init
5194 #define __pyx_n_s_init_subclass __pyx_mstate_global->__pyx_n_s_init_subclass
5195 #define __pyx_n_s_initializing __pyx_mstate_global->__pyx_n_s_initializing
5196 #define __pyx_kp_u_invalid_contig_s __pyx_mstate_global->__pyx_kp_u_invalid_contig_s
5197 #define __pyx_kp_u_invalid_coordinates_start_i_stop __pyx_mstate_global->__pyx_kp_u_invalid_coordinates_start_i_stop
5198 #define __pyx_kp_u_invalid_tid __pyx_mstate_global->__pyx_kp_u_invalid_tid
5199 #define __pyx_n_s_io __pyx_mstate_global->__pyx_n_s_io
5200 #define __pyx_n_s_is_coroutine __pyx_mstate_global->__pyx_n_s_is_coroutine
5201 #define __pyx_n_s_is_open __pyx_mstate_global->__pyx_n_s_is_open
5202 #define __pyx_n_s_is_valid_reference_name __pyx_mstate_global->__pyx_n_s_is_valid_reference_name
5203 #define __pyx_n_s_is_valid_tid __pyx_mstate_global->__pyx_n_s_is_valid_tid
5204 #define __pyx_n_s_isatty __pyx_mstate_global->__pyx_n_s_isatty
5205 #define __pyx_kp_u_isenabled __pyx_mstate_global->__pyx_kp_u_isenabled
5206 #define __pyx_n_s_join __pyx_mstate_global->__pyx_n_s_join
5207 #define __pyx_n_s_line __pyx_mstate_global->__pyx_n_s_line
5208 #define __pyx_n_s_lines __pyx_mstate_global->__pyx_n_s_lines
5209 #define __pyx_n_s_main __pyx_mstate_global->__pyx_n_s_main
5210 #define __pyx_n_s_metaclass __pyx_mstate_global->__pyx_n_s_metaclass
5211 #define __pyx_kp_u_metadata_not_available_on_closed __pyx_mstate_global->__pyx_kp_u_metadata_not_available_on_closed
5212 #define __pyx_n_s_mode __pyx_mstate_global->__pyx_n_s_mode
5213 #define __pyx_n_s_module __pyx_mstate_global->__pyx_n_s_module
5214 #define __pyx_n_s_mro_entries __pyx_mstate_global->__pyx_n_s_mro_entries
5215 #define __pyx_n_s_msg __pyx_mstate_global->__pyx_n_s_msg
5216 #define __pyx_n_s_mv __pyx_mstate_global->__pyx_n_s_mv
5217 #define __pyx_n_s_name __pyx_mstate_global->__pyx_n_s_name
5218 #define __pyx_n_s_name_2 __pyx_mstate_global->__pyx_n_s_name_2
5219 #define __pyx_n_s_ne __pyx_mstate_global->__pyx_n_s_ne
5220 #define __pyx_kp_u_no_BGZF_EOF_marker_file_may_be_t __pyx_mstate_global->__pyx_kp_u_no_BGZF_EOF_marker_file_may_be_t
5221 #define __pyx_kp_s_no_default___reduce___due_to_non __pyx_mstate_global->__pyx_kp_s_no_default___reduce___due_to_non
5222 #define __pyx_n_s_nonzero __pyx_mstate_global->__pyx_n_s_nonzero
5223 #define __pyx_n_s_object __pyx_mstate_global->__pyx_n_s_object
5224 #define __pyx_n_s_off __pyx_mstate_global->__pyx_n_s_off
5225 #define __pyx_n_s_offset __pyx_mstate_global->__pyx_n_s_offset
5226 #define __pyx_kp_u_operation_on_closed_HFile __pyx_mstate_global->__pyx_kp_u_operation_on_closed_HFile
5227 #define __pyx_n_s_opts __pyx_mstate_global->__pyx_n_s_opts
5228 #define __pyx_n_s_os __pyx_mstate_global->__pyx_n_s_os
5229 #define __pyx_n_s_other __pyx_mstate_global->__pyx_n_s_other
5230 #define __pyx_n_s_parse_region __pyx_mstate_global->__pyx_n_s_parse_region
5231 #define __pyx_n_s_part __pyx_mstate_global->__pyx_n_s_part
5232 #define __pyx_n_s_parts __pyx_mstate_global->__pyx_n_s_parts
5233 #define __pyx_n_s_prepare __pyx_mstate_global->__pyx_n_s_prepare
5234 #define __pyx_n_s_pysam_libchtslib __pyx_mstate_global->__pyx_n_s_pysam_libchtslib
5235 #define __pyx_kp_s_pysam_libchtslib_pyx __pyx_mstate_global->__pyx_kp_s_pysam_libchtslib_pyx
5236 #define __pyx_n_s_pyx_state __pyx_mstate_global->__pyx_n_s_pyx_state
5237 #define __pyx_n_s_pyx_vtable __pyx_mstate_global->__pyx_n_s_pyx_vtable
5238 #define __pyx_n_s_qualname __pyx_mstate_global->__pyx_n_s_qualname
5239 #define __pyx_n_u_r __pyx_mstate_global->__pyx_n_u_r
5240 #define __pyx_n_s_re __pyx_mstate_global->__pyx_n_s_re
5241 #define __pyx_n_s_read __pyx_mstate_global->__pyx_n_s_read
5242 #define __pyx_n_s_readable __pyx_mstate_global->__pyx_n_s_readable
5243 #define __pyx_n_s_readall __pyx_mstate_global->__pyx_n_s_readall
5244 #define __pyx_n_s_readinto __pyx_mstate_global->__pyx_n_s_readinto
5245 #define __pyx_n_s_readline __pyx_mstate_global->__pyx_n_s_readline
5246 #define __pyx_n_s_readlines __pyx_mstate_global->__pyx_n_s_readlines
5247 #define __pyx_n_s_reduce __pyx_mstate_global->__pyx_n_s_reduce
5248 #define __pyx_n_s_reduce_cython __pyx_mstate_global->__pyx_n_s_reduce_cython
5249 #define __pyx_n_s_reduce_ex __pyx_mstate_global->__pyx_n_s_reduce_ex
5250 #define __pyx_n_s_reference __pyx_mstate_global->__pyx_n_s_reference
5251 #define __pyx_n_s_region __pyx_mstate_global->__pyx_n_s_region
5252 #define __pyx_n_s_replace __pyx_mstate_global->__pyx_n_s_replace
5253 #define __pyx_n_s_reset __pyx_mstate_global->__pyx_n_s_reset
5254 #define __pyx_n_s_ret __pyx_mstate_global->__pyx_n_s_ret
5255 #define __pyx_n_s_rstart __pyx_mstate_global->__pyx_n_s_rstart
5256 #define __pyx_n_s_rstop __pyx_mstate_global->__pyx_n_s_rstop
5257 #define __pyx_n_s_rtid __pyx_mstate_global->__pyx_n_s_rtid
5258 #define __pyx_n_s_rval __pyx_mstate_global->__pyx_n_s_rval
5259 #define __pyx_n_s_seek __pyx_mstate_global->__pyx_n_s_seek
5260 #define __pyx_kp_u_seek_failed_on_HFile __pyx_mstate_global->__pyx_kp_u_seek_failed_on_HFile
5261 #define __pyx_kp_u_seek_not_available_in_streams __pyx_mstate_global->__pyx_kp_u_seek_not_available_in_streams
5262 #define __pyx_kp_u_seek_not_implemented_in_files_co __pyx_mstate_global->__pyx_kp_u_seek_not_implemented_in_files_co
5263 #define __pyx_n_s_seekable __pyx_mstate_global->__pyx_n_s_seekable
5264 #define __pyx_n_s_self __pyx_mstate_global->__pyx_n_s_self
5265 #define __pyx_kp_s_self_fp_cannot_be_converted_to_a __pyx_mstate_global->__pyx_kp_s_self_fp_cannot_be_converted_to_a
5266 #define __pyx_n_s_set_name __pyx_mstate_global->__pyx_n_s_set_name
5267 #define __pyx_n_s_set_verbosity __pyx_mstate_global->__pyx_n_s_set_verbosity
5268 #define __pyx_n_u_set_verbosity __pyx_mstate_global->__pyx_n_u_set_verbosity
5269 #define __pyx_n_s_setstate __pyx_mstate_global->__pyx_n_s_setstate
5270 #define __pyx_n_s_setstate_cython __pyx_mstate_global->__pyx_n_s_setstate_cython
5271 #define __pyx_n_s_size __pyx_mstate_global->__pyx_n_s_size
5272 #define __pyx_n_s_spec __pyx_mstate_global->__pyx_n_s_spec
5273 #define __pyx_n_s_split __pyx_mstate_global->__pyx_n_s_split
5274 #define __pyx_n_s_start __pyx_mstate_global->__pyx_n_s_start
5275 #define __pyx_kp_u_start_out_of_range_i __pyx_mstate_global->__pyx_kp_u_start_out_of_range_i
5276 #define __pyx_n_s_stop __pyx_mstate_global->__pyx_n_s_stop
5277 #define __pyx_kp_u_stop_and_end_should_not_both_be __pyx_mstate_global->__pyx_kp_u_stop_and_end_should_not_both_be
5278 #define __pyx_kp_u_stop_out_of_range_i __pyx_mstate_global->__pyx_kp_u_stop_out_of_range_i
5279 #define __pyx_kp_s_stringsource __pyx_mstate_global->__pyx_kp_s_stringsource
5280 #define __pyx_n_s_super __pyx_mstate_global->__pyx_n_s_super
5281 #define __pyx_n_s_tb __pyx_mstate_global->__pyx_n_s_tb
5282 #define __pyx_n_s_tell __pyx_mstate_global->__pyx_n_s_tell
5283 #define __pyx_kp_u_tell_failed_on_HFile __pyx_mstate_global->__pyx_kp_u_tell_failed_on_HFile
5284 #define __pyx_kp_u_tell_not_available_in_streams __pyx_mstate_global->__pyx_kp_u_tell_not_available_in_streams
5285 #define __pyx_n_s_test __pyx_mstate_global->__pyx_n_s_test
5286 #define __pyx_n_s_tid __pyx_mstate_global->__pyx_n_s_tid
5287 #define __pyx_n_s_traceback __pyx_mstate_global->__pyx_n_s_traceback
5288 #define __pyx_n_s_truncate __pyx_mstate_global->__pyx_n_s_truncate
5289 #define __pyx_n_s_type __pyx_mstate_global->__pyx_n_s_type
5290 #define __pyx_n_s_value __pyx_mstate_global->__pyx_n_s_value
5291 #define __pyx_n_s_verbosity __pyx_mstate_global->__pyx_n_s_verbosity
5292 #define __pyx_n_u_w __pyx_mstate_global->__pyx_n_u_w
5293 #define __pyx_n_s_warn __pyx_mstate_global->__pyx_n_s_warn
5294 #define __pyx_n_s_warnings __pyx_mstate_global->__pyx_n_s_warnings
5295 #define __pyx_n_s_whence __pyx_mstate_global->__pyx_n_s_whence
5296 #define __pyx_n_s_writable __pyx_mstate_global->__pyx_n_s_writable
5297 #define __pyx_n_s_write __pyx_mstate_global->__pyx_n_s_write
5298 #define __pyx_kp_u_write_failed_on_HFile __pyx_mstate_global->__pyx_kp_u_write_failed_on_HFile
5299 #define __pyx_n_s_writelines __pyx_mstate_global->__pyx_n_s_writelines
5300 #define __pyx_int_0 __pyx_mstate_global->__pyx_int_0
5301 #define __pyx_int_1 __pyx_mstate_global->__pyx_int_1
5302 #define __pyx_int_neg_1 __pyx_mstate_global->__pyx_int_neg_1
5303 #define __pyx_k__18 __pyx_mstate_global->__pyx_k__18
5304 #define __pyx_k__41 __pyx_mstate_global->__pyx_k__41
5305 #define __pyx_codeobj_ __pyx_mstate_global->__pyx_codeobj_
5306 #define __pyx_tuple__5 __pyx_mstate_global->__pyx_tuple__5
5307 #define __pyx_tuple__6 __pyx_mstate_global->__pyx_tuple__6
5308 #define __pyx_tuple__39 __pyx_mstate_global->__pyx_tuple__39
5309 #define __pyx_tuple__43 __pyx_mstate_global->__pyx_tuple__43
5310 #define __pyx_tuple__44 __pyx_mstate_global->__pyx_tuple__44
5311 #define __pyx_tuple__46 __pyx_mstate_global->__pyx_tuple__46
5312 #define __pyx_tuple__47 __pyx_mstate_global->__pyx_tuple__47
5313 #define __pyx_tuple__48 __pyx_mstate_global->__pyx_tuple__48
5314 #define __pyx_tuple__49 __pyx_mstate_global->__pyx_tuple__49
5315 #define __pyx_tuple__51 __pyx_mstate_global->__pyx_tuple__51
5316 #define __pyx_tuple__53 __pyx_mstate_global->__pyx_tuple__53
5317 #define __pyx_tuple__54 __pyx_mstate_global->__pyx_tuple__54
5318 #define __pyx_tuple__57 __pyx_mstate_global->__pyx_tuple__57
5319 #define __pyx_tuple__66 __pyx_mstate_global->__pyx_tuple__66
5320 #define __pyx_tuple__67 __pyx_mstate_global->__pyx_tuple__67
5321 #define __pyx_tuple__68 __pyx_mstate_global->__pyx_tuple__68
5322 #define __pyx_tuple__69 __pyx_mstate_global->__pyx_tuple__69
5323 #define __pyx_tuple__70 __pyx_mstate_global->__pyx_tuple__70
5324 #define __pyx_tuple__71 __pyx_mstate_global->__pyx_tuple__71
5325 #define __pyx_tuple__72 __pyx_mstate_global->__pyx_tuple__72
5326 #define __pyx_tuple__73 __pyx_mstate_global->__pyx_tuple__73
5327 #define __pyx_tuple__74 __pyx_mstate_global->__pyx_tuple__74
5328 #define __pyx_tuple__75 __pyx_mstate_global->__pyx_tuple__75
5329 #define __pyx_tuple__76 __pyx_mstate_global->__pyx_tuple__76
5330 #define __pyx_tuple__77 __pyx_mstate_global->__pyx_tuple__77
5331 #define __pyx_tuple__78 __pyx_mstate_global->__pyx_tuple__78
5332 #define __pyx_tuple__79 __pyx_mstate_global->__pyx_tuple__79
5333 #define __pyx_tuple__80 __pyx_mstate_global->__pyx_tuple__80
5334 #define __pyx_tuple__81 __pyx_mstate_global->__pyx_tuple__81
5335 #define __pyx_tuple__82 __pyx_mstate_global->__pyx_tuple__82
5336 #define __pyx_tuple__83 __pyx_mstate_global->__pyx_tuple__83
5337 #define __pyx_tuple__84 __pyx_mstate_global->__pyx_tuple__84
5338 #define __pyx_tuple__85 __pyx_mstate_global->__pyx_tuple__85
5339 #define __pyx_tuple__86 __pyx_mstate_global->__pyx_tuple__86
5340 #define __pyx_tuple__87 __pyx_mstate_global->__pyx_tuple__87
5341 #define __pyx_tuple__88 __pyx_mstate_global->__pyx_tuple__88
5342 #define __pyx_tuple__89 __pyx_mstate_global->__pyx_tuple__89
5343 #define __pyx_tuple__90 __pyx_mstate_global->__pyx_tuple__90
5344 #define __pyx_tuple__91 __pyx_mstate_global->__pyx_tuple__91
5345 #define __pyx_tuple__92 __pyx_mstate_global->__pyx_tuple__92
5346 #define __pyx_tuple__93 __pyx_mstate_global->__pyx_tuple__93
5347 #define __pyx_tuple__94 __pyx_mstate_global->__pyx_tuple__94
5348 #define __pyx_tuple__95 __pyx_mstate_global->__pyx_tuple__95
5349 #define __pyx_tuple__96 __pyx_mstate_global->__pyx_tuple__96
5350 #define __pyx_codeobj__2 __pyx_mstate_global->__pyx_codeobj__2
5351 #define __pyx_codeobj__3 __pyx_mstate_global->__pyx_codeobj__3
5352 #define __pyx_codeobj__4 __pyx_mstate_global->__pyx_codeobj__4
5353 #define __pyx_codeobj__7 __pyx_mstate_global->__pyx_codeobj__7
5354 #define __pyx_codeobj__8 __pyx_mstate_global->__pyx_codeobj__8
5355 #define __pyx_codeobj__9 __pyx_mstate_global->__pyx_codeobj__9
5356 #define __pyx_codeobj__10 __pyx_mstate_global->__pyx_codeobj__10
5357 #define __pyx_codeobj__11 __pyx_mstate_global->__pyx_codeobj__11
5358 #define __pyx_codeobj__12 __pyx_mstate_global->__pyx_codeobj__12
5359 #define __pyx_codeobj__14 __pyx_mstate_global->__pyx_codeobj__14
5360 #define __pyx_codeobj__15 __pyx_mstate_global->__pyx_codeobj__15
5361 #define __pyx_codeobj__16 __pyx_mstate_global->__pyx_codeobj__16
5362 #define __pyx_codeobj__17 __pyx_mstate_global->__pyx_codeobj__17
5363 #define __pyx_codeobj__19 __pyx_mstate_global->__pyx_codeobj__19
5364 #define __pyx_codeobj__20 __pyx_mstate_global->__pyx_codeobj__20
5365 #define __pyx_codeobj__21 __pyx_mstate_global->__pyx_codeobj__21
5366 #define __pyx_codeobj__22 __pyx_mstate_global->__pyx_codeobj__22
5367 #define __pyx_codeobj__23 __pyx_mstate_global->__pyx_codeobj__23
5368 #define __pyx_codeobj__24 __pyx_mstate_global->__pyx_codeobj__24
5369 #define __pyx_codeobj__25 __pyx_mstate_global->__pyx_codeobj__25
5370 #define __pyx_codeobj__26 __pyx_mstate_global->__pyx_codeobj__26
5371 #define __pyx_codeobj__27 __pyx_mstate_global->__pyx_codeobj__27
5372 #define __pyx_codeobj__28 __pyx_mstate_global->__pyx_codeobj__28
5373 #define __pyx_codeobj__29 __pyx_mstate_global->__pyx_codeobj__29
5374 #define __pyx_codeobj__30 __pyx_mstate_global->__pyx_codeobj__30
5375 #define __pyx_codeobj__31 __pyx_mstate_global->__pyx_codeobj__31
5376 #define __pyx_codeobj__32 __pyx_mstate_global->__pyx_codeobj__32
5377 #define __pyx_codeobj__33 __pyx_mstate_global->__pyx_codeobj__33
5378 #define __pyx_codeobj__34 __pyx_mstate_global->__pyx_codeobj__34
5379 #define __pyx_codeobj__35 __pyx_mstate_global->__pyx_codeobj__35
5380 #define __pyx_codeobj__36 __pyx_mstate_global->__pyx_codeobj__36
5381 #define __pyx_codeobj__37 __pyx_mstate_global->__pyx_codeobj__37
5382 #define __pyx_codeobj__38 __pyx_mstate_global->__pyx_codeobj__38
5383 #define __pyx_codeobj__40 __pyx_mstate_global->__pyx_codeobj__40
5384 #define __pyx_codeobj__42 __pyx_mstate_global->__pyx_codeobj__42
5385 #define __pyx_codeobj__45 __pyx_mstate_global->__pyx_codeobj__45
5386 #define __pyx_codeobj__50 __pyx_mstate_global->__pyx_codeobj__50
5387 #define __pyx_codeobj__52 __pyx_mstate_global->__pyx_codeobj__52
5388 #define __pyx_codeobj__60 __pyx_mstate_global->__pyx_codeobj__60
5389 #define __pyx_codeobj__61 __pyx_mstate_global->__pyx_codeobj__61
5390 #define __pyx_codeobj__62 __pyx_mstate_global->__pyx_codeobj__62
5391 #define __pyx_codeobj__63 __pyx_mstate_global->__pyx_codeobj__63
5392 #define __pyx_codeobj__64 __pyx_mstate_global->__pyx_codeobj__64
5393 #define __pyx_codeobj__65 __pyx_mstate_global->__pyx_codeobj__65
5394 /* #### Code section: module_code ### */
5395
5396 /* "cpython/complex.pxd":19
5397 *
5398 * @property
5399 * cdef inline double real(self) noexcept: # <<<<<<<<<<<<<<
5400 * return self.cval.real
5401 *
5402 */
5403
5404 static CYTHON_INLINE double __pyx_f_7cpython_7complex_7complex_4real_real(PyComplexObject *__pyx_v_self) {
5405 double __pyx_r;
5406
5407 /* "cpython/complex.pxd":20
5408 * @property
5409 * cdef inline double real(self) noexcept:
5410 * return self.cval.real # <<<<<<<<<<<<<<
5411 *
5412 * @property
5413 */
5414 __pyx_r = __pyx_v_self->cval.real;
5415 goto __pyx_L0;
5416
5417 /* "cpython/complex.pxd":19
5418 *
5419 * @property
5420 * cdef inline double real(self) noexcept: # <<<<<<<<<<<<<<
5421 * return self.cval.real
5422 *
5423 */
5424
5425 /* function exit code */
5426 __pyx_L0:;
5427 return __pyx_r;
5428 }
5429
5430 /* "cpython/complex.pxd":23
5431 *
5432 * @property
5433 * cdef inline double imag(self) noexcept: # <<<<<<<<<<<<<<
5434 * return self.cval.imag
5435 *
5436 */
5437
5438 static CYTHON_INLINE double __pyx_f_7cpython_7complex_7complex_4imag_imag(PyComplexObject *__pyx_v_self) {
5439 double __pyx_r;
5440
5441 /* "cpython/complex.pxd":24
5442 * @property
5443 * cdef inline double imag(self) noexcept:
5444 * return self.cval.imag # <<<<<<<<<<<<<<
5445 *
5446 * # PyTypeObject PyComplex_Type
5447 */
5448 __pyx_r = __pyx_v_self->cval.imag;
5449 goto __pyx_L0;
5450
5451 /* "cpython/complex.pxd":23
5452 *
5453 * @property
5454 * cdef inline double imag(self) noexcept: # <<<<<<<<<<<<<<
5455 * return self.cval.imag
5456 *
5457 */
5458
5459 /* function exit code */
5460 __pyx_L0:;
5461 return __pyx_r;
5462 }
5463
5464 /* "cpython/contextvars.pxd":112
5465 *
5466 *
5467 * cdef inline object get_value(var, default_value=None): # <<<<<<<<<<<<<<
5468 * """Return a new reference to the value of the context variable,
5469 * or the default value of the context variable,
5470 */
5471
5472 static CYTHON_INLINE PyObject *__pyx_f_7cpython_11contextvars_get_value(PyObject *__pyx_v_var, struct __pyx_opt_args_7cpython_11contextvars_get_value *__pyx_optional_args) {
5473 PyObject *__pyx_v_default_value = ((PyObject *)Py_None);
5474 PyObject *__pyx_v_value;
5475 PyObject *__pyx_v_pyvalue = NULL;
5476 PyObject *__pyx_r = NULL;
5477 __Pyx_RefNannyDeclarations
5478 int __pyx_t_1;
5479 int __pyx_t_2;
5480 PyObject *__pyx_t_3 = NULL;
5481 int __pyx_lineno = 0;
5482 const char *__pyx_filename = NULL;
5483 int __pyx_clineno = 0;
5484 __Pyx_RefNannySetupContext("get_value", 1);
5485 if (__pyx_optional_args) {
5486 if (__pyx_optional_args->__pyx_n > 0) {
5487 __pyx_v_default_value = __pyx_optional_args->default_value;
5488 }
5489 }
5490
5491 /* "cpython/contextvars.pxd":117
5492 * or None if no such value or default was found.
5493 * """
5494 * cdef PyObject *value = NULL # <<<<<<<<<<<<<<
5495 * PyContextVar_Get(var, NULL, &value)
5496 * if value is NULL:
5497 */
5498 __pyx_v_value = NULL;
5499
5500 /* "cpython/contextvars.pxd":118
5501 * """
5502 * cdef PyObject *value = NULL
5503 * PyContextVar_Get(var, NULL, &value) # <<<<<<<<<<<<<<
5504 * if value is NULL:
5505 * # context variable does not have a default
5506 */
5507 __pyx_t_1 = PyContextVar_Get(__pyx_v_var, NULL, (&__pyx_v_value)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(2, 118, __pyx_L1_error)
5508
5509 /* "cpython/contextvars.pxd":119
5510 * cdef PyObject *value = NULL
5511 * PyContextVar_Get(var, NULL, &value)
5512 * if value is NULL: # <<<<<<<<<<<<<<
5513 * # context variable does not have a default
5514 * pyvalue = default_value
5515 */
5516 __pyx_t_2 = (__pyx_v_value == NULL);
5517 if (__pyx_t_2) {
5518
5519 /* "cpython/contextvars.pxd":121
5520 * if value is NULL:
5521 * # context variable does not have a default
5522 * pyvalue = default_value # <<<<<<<<<<<<<<
5523 * else:
5524 * # value or default value of context variable
5525 */
5526 __Pyx_INCREF(__pyx_v_default_value);
5527 __pyx_v_pyvalue = __pyx_v_default_value;
5528
5529 /* "cpython/contextvars.pxd":119
5530 * cdef PyObject *value = NULL
5531 * PyContextVar_Get(var, NULL, &value)
5532 * if value is NULL: # <<<<<<<<<<<<<<
5533 * # context variable does not have a default
5534 * pyvalue = default_value
5535 */
5536 goto __pyx_L3;
5537 }
5538
5539 /* "cpython/contextvars.pxd":124
5540 * else:
5541 * # value or default value of context variable
5542 * pyvalue = <object>value # <<<<<<<<<<<<<<
5543 * Py_XDECREF(value) # PyContextVar_Get() returned an owned reference as 'PyObject*'
5544 * return pyvalue
5545 */
5546 /*else*/ {
5547 __pyx_t_3 = ((PyObject *)__pyx_v_value);
5548 __Pyx_INCREF(__pyx_t_3);
5549 __pyx_v_pyvalue = __pyx_t_3;
5550 __pyx_t_3 = 0;
5551
5552 /* "cpython/contextvars.pxd":125
5553 * # value or default value of context variable
5554 * pyvalue = <object>value
5555 * Py_XDECREF(value) # PyContextVar_Get() returned an owned reference as 'PyObject*' # <<<<<<<<<<<<<<
5556 * return pyvalue
5557 *
5558 */
5559 Py_XDECREF(__pyx_v_value);
5560 }
5561 __pyx_L3:;
5562
5563 /* "cpython/contextvars.pxd":126
5564 * pyvalue = <object>value
5565 * Py_XDECREF(value) # PyContextVar_Get() returned an owned reference as 'PyObject*'
5566 * return pyvalue # <<<<<<<<<<<<<<
5567 *
5568 *
5569 */
5570 __Pyx_XDECREF(__pyx_r);
5571 __Pyx_INCREF(__pyx_v_pyvalue);
5572 __pyx_r = __pyx_v_pyvalue;
5573 goto __pyx_L0;
5574
5575 /* "cpython/contextvars.pxd":112
5576 *
5577 *
5578 * cdef inline object get_value(var, default_value=None): # <<<<<<<<<<<<<<
5579 * """Return a new reference to the value of the context variable,
5580 * or the default value of the context variable,
5581 */
5582
5583 /* function exit code */
5584 __pyx_L1_error:;
5585 __Pyx_XDECREF(__pyx_t_3);
5586 __Pyx_AddTraceback("cpython.contextvars.get_value", __pyx_clineno, __pyx_lineno, __pyx_filename);
5587 __pyx_r = 0;
5588 __pyx_L0:;
5589 __Pyx_XDECREF(__pyx_v_pyvalue);
5590 __Pyx_XGIVEREF(__pyx_r);
5591 __Pyx_RefNannyFinishContext();
5592 return __pyx_r;
5593 }
5594
5595 /* "cpython/contextvars.pxd":129
5596 *
5597 *
5598 * cdef inline object get_value_no_default(var, default_value=None): # <<<<<<<<<<<<<<
5599 * """Return a new reference to the value of the context variable,
5600 * or the provided default value if no such value was found.
5601 */
5602
5603 static CYTHON_INLINE PyObject *__pyx_f_7cpython_11contextvars_get_value_no_default(PyObject *__pyx_v_var, struct __pyx_opt_args_7cpython_11contextvars_get_value_no_default *__pyx_optional_args) {
5604 PyObject *__pyx_v_default_value = ((PyObject *)Py_None);
5605 PyObject *__pyx_v_value;
5606 PyObject *__pyx_v_pyvalue = NULL;
5607 PyObject *__pyx_r = NULL;
5608 __Pyx_RefNannyDeclarations
5609 int __pyx_t_1;
5610 PyObject *__pyx_t_2 = NULL;
5611 int __pyx_lineno = 0;
5612 const char *__pyx_filename = NULL;
5613 int __pyx_clineno = 0;
5614 __Pyx_RefNannySetupContext("get_value_no_default", 1);
5615 if (__pyx_optional_args) {
5616 if (__pyx_optional_args->__pyx_n > 0) {
5617 __pyx_v_default_value = __pyx_optional_args->default_value;
5618 }
5619 }
5620
5621 /* "cpython/contextvars.pxd":135
5622 * Ignores the default value of the context variable, if any.
5623 * """
5624 * cdef PyObject *value = NULL # <<<<<<<<<<<<<<
5625 * PyContextVar_Get(var, <PyObject*>default_value, &value)
5626 * # value of context variable or 'default_value'
5627 */
5628 __pyx_v_value = NULL;
5629
5630 /* "cpython/contextvars.pxd":136
5631 * """
5632 * cdef PyObject *value = NULL
5633 * PyContextVar_Get(var, <PyObject*>default_value, &value) # <<<<<<<<<<<<<<
5634 * # value of context variable or 'default_value'
5635 * pyvalue = <object>value
5636 */
5637 __pyx_t_1 = PyContextVar_Get(__pyx_v_var, ((PyObject *)__pyx_v_default_value), (&__pyx_v_value)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(2, 136, __pyx_L1_error)
5638
5639 /* "cpython/contextvars.pxd":138
5640 * PyContextVar_Get(var, <PyObject*>default_value, &value)
5641 * # value of context variable or 'default_value'
5642 * pyvalue = <object>value # <<<<<<<<<<<<<<
5643 * Py_XDECREF(value) # PyContextVar_Get() returned an owned reference as 'PyObject*'
5644 * return pyvalue
5645 */
5646 __pyx_t_2 = ((PyObject *)__pyx_v_value);
5647 __Pyx_INCREF(__pyx_t_2);
5648 __pyx_v_pyvalue = __pyx_t_2;
5649 __pyx_t_2 = 0;
5650
5651 /* "cpython/contextvars.pxd":139
5652 * # value of context variable or 'default_value'
5653 * pyvalue = <object>value
5654 * Py_XDECREF(value) # PyContextVar_Get() returned an owned reference as 'PyObject*' # <<<<<<<<<<<<<<
5655 * return pyvalue
5656 */
5657 Py_XDECREF(__pyx_v_value);
5658
5659 /* "cpython/contextvars.pxd":140
5660 * pyvalue = <object>value
5661 * Py_XDECREF(value) # PyContextVar_Get() returned an owned reference as 'PyObject*'
5662 * return pyvalue # <<<<<<<<<<<<<<
5663 */
5664 __Pyx_XDECREF(__pyx_r);
5665 __Pyx_INCREF(__pyx_v_pyvalue);
5666 __pyx_r = __pyx_v_pyvalue;
5667 goto __pyx_L0;
5668
5669 /* "cpython/contextvars.pxd":129
5670 *
5671 *
5672 * cdef inline object get_value_no_default(var, default_value=None): # <<<<<<<<<<<<<<
5673 * """Return a new reference to the value of the context variable,
5674 * or the provided default value if no such value was found.
5675 */
5676
5677 /* function exit code */
5678 __pyx_L1_error:;
5679 __Pyx_XDECREF(__pyx_t_2);
5680 __Pyx_AddTraceback("cpython.contextvars.get_value_no_default", __pyx_clineno, __pyx_lineno, __pyx_filename);
5681 __pyx_r = 0;
5682 __pyx_L0:;
5683 __Pyx_XDECREF(__pyx_v_pyvalue);
5684 __Pyx_XGIVEREF(__pyx_r);
5685 __Pyx_RefNannyFinishContext();
5686 return __pyx_r;
5687 }
5688
5689 /* "array.pxd":104
5690 * __data_union data
5691 *
5692 * def __getbuffer__(self, Py_buffer* info, int flags): # <<<<<<<<<<<<<<
5693 * # This implementation of getbuffer is geared towards Cython
5694 * # requirements, and does not yet fulfill the PEP.
5695 */
5696
5697 /* Python wrapper */
5698 CYTHON_UNUSED static int __pyx_pw_7cpython_5array_5array_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
5699 CYTHON_UNUSED static int __pyx_pw_7cpython_5array_5array_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
5700 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
5701 int __pyx_r;
5702 __Pyx_RefNannyDeclarations
5703 __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
5704 __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
5705 __pyx_r = __pyx_pf_7cpython_5array_5array___getbuffer__(((arrayobject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));
5706
5707 /* function exit code */
5708 __Pyx_RefNannyFinishContext();
5709 return __pyx_r;
5710 }
5711
5712 static int __pyx_pf_7cpython_5array_5array___getbuffer__(arrayobject *__pyx_v_self, Py_buffer *__pyx_v_info, CYTHON_UNUSED int __pyx_v_flags) {
5713 PyObject *__pyx_v_item_count = NULL;
5714 int __pyx_r;
5715 __Pyx_RefNannyDeclarations
5716 PyObject *__pyx_t_1 = NULL;
5717 char *__pyx_t_2;
5718 int __pyx_t_3;
5719 PyObject *__pyx_t_4 = NULL;
5720 Py_ssize_t __pyx_t_5;
5721 int __pyx_t_6;
5722 char __pyx_t_7;
5723 int __pyx_lineno = 0;
5724 const char *__pyx_filename = NULL;
5725 int __pyx_clineno = 0;
5726 if (unlikely(__pyx_v_info == NULL)) {
5727 PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
5728 return -1;
5729 }
5730 __Pyx_RefNannySetupContext("__getbuffer__", 0);
5731 __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
5732 __Pyx_GIVEREF(__pyx_v_info->obj);
5733
5734 /* "array.pxd":109
5735 * # In particular strided access is always provided regardless
5736 * # of flags
5737 * item_count = Py_SIZE(self) # <<<<<<<<<<<<<<
5738 *
5739 * info.suboffsets = NULL
5740 */
5741 __pyx_t_1 = PyInt_FromSsize_t(Py_SIZE(((PyObject *)__pyx_v_self))); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 109, __pyx_L1_error)
5742 __Pyx_GOTREF(__pyx_t_1);
5743 __pyx_v_item_count = __pyx_t_1;
5744 __pyx_t_1 = 0;
5745
5746 /* "array.pxd":111
5747 * item_count = Py_SIZE(self)
5748 *
5749 * info.suboffsets = NULL # <<<<<<<<<<<<<<
5750 * info.buf = self.data.as_chars
5751 * info.readonly = 0
5752 */
5753 __pyx_v_info->suboffsets = NULL;
5754
5755 /* "array.pxd":112
5756 *
5757 * info.suboffsets = NULL
5758 * info.buf = self.data.as_chars # <<<<<<<<<<<<<<
5759 * info.readonly = 0
5760 * info.ndim = 1
5761 */
5762 __pyx_t_2 = __pyx_v_self->data.as_chars;
5763 __pyx_v_info->buf = __pyx_t_2;
5764
5765 /* "array.pxd":113
5766 * info.suboffsets = NULL
5767 * info.buf = self.data.as_chars
5768 * info.readonly = 0 # <<<<<<<<<<<<<<
5769 * info.ndim = 1
5770 * info.itemsize = self.ob_descr.itemsize # e.g. sizeof(float)
5771 */
5772 __pyx_v_info->readonly = 0;
5773
5774 /* "array.pxd":114
5775 * info.buf = self.data.as_chars
5776 * info.readonly = 0
5777 * info.ndim = 1 # <<<<<<<<<<<<<<
5778 * info.itemsize = self.ob_descr.itemsize # e.g. sizeof(float)
5779 * info.len = info.itemsize * item_count
5780 */
5781 __pyx_v_info->ndim = 1;
5782
5783 /* "array.pxd":115
5784 * info.readonly = 0
5785 * info.ndim = 1
5786 * info.itemsize = self.ob_descr.itemsize # e.g. sizeof(float) # <<<<<<<<<<<<<<
5787 * info.len = info.itemsize * item_count
5788 *
5789 */
5790 __pyx_t_3 = __pyx_v_self->ob_descr->itemsize;
5791 __pyx_v_info->itemsize = __pyx_t_3;
5792
5793 /* "array.pxd":116
5794 * info.ndim = 1
5795 * info.itemsize = self.ob_descr.itemsize # e.g. sizeof(float)
5796 * info.len = info.itemsize * item_count # <<<<<<<<<<<<<<
5797 *
5798 * info.shape = <Py_ssize_t*> PyObject_Malloc(sizeof(Py_ssize_t) + 2)
5799 */
5800 __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_info->itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 116, __pyx_L1_error)
5801 __Pyx_GOTREF(__pyx_t_1);
5802 __pyx_t_4 = PyNumber_Multiply(__pyx_t_1, __pyx_v_item_count); if (unlikely(!__pyx_t_4)) __PYX_ERR(3, 116, __pyx_L1_error)
5803 __Pyx_GOTREF(__pyx_t_4);
5804 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5805 __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_4); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(3, 116, __pyx_L1_error)
5806 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5807 __pyx_v_info->len = __pyx_t_5;
5808
5809 /* "array.pxd":118
5810 * info.len = info.itemsize * item_count
5811 *
5812 * info.shape = <Py_ssize_t*> PyObject_Malloc(sizeof(Py_ssize_t) + 2) # <<<<<<<<<<<<<<
5813 * if not info.shape:
5814 * raise MemoryError()
5815 */
5816 __pyx_v_info->shape = ((Py_ssize_t *)PyObject_Malloc(((sizeof(Py_ssize_t)) + 2)));
5817
5818 /* "array.pxd":119
5819 *
5820 * info.shape = <Py_ssize_t*> PyObject_Malloc(sizeof(Py_ssize_t) + 2)
5821 * if not info.shape: # <<<<<<<<<<<<<<
5822 * raise MemoryError()
5823 * info.shape[0] = item_count # constant regardless of resizing
5824 */
5825 __pyx_t_6 = (!(__pyx_v_info->shape != 0));
5826 if (unlikely(__pyx_t_6)) {
5827
5828 /* "array.pxd":120
5829 * info.shape = <Py_ssize_t*> PyObject_Malloc(sizeof(Py_ssize_t) + 2)
5830 * if not info.shape:
5831 * raise MemoryError() # <<<<<<<<<<<<<<
5832 * info.shape[0] = item_count # constant regardless of resizing
5833 * info.strides = &info.itemsize
5834 */
5835 PyErr_NoMemory(); __PYX_ERR(3, 120, __pyx_L1_error)
5836
5837 /* "array.pxd":119
5838 *
5839 * info.shape = <Py_ssize_t*> PyObject_Malloc(sizeof(Py_ssize_t) + 2)
5840 * if not info.shape: # <<<<<<<<<<<<<<
5841 * raise MemoryError()
5842 * info.shape[0] = item_count # constant regardless of resizing
5843 */
5844 }
5845
5846 /* "array.pxd":121
5847 * if not info.shape:
5848 * raise MemoryError()
5849 * info.shape[0] = item_count # constant regardless of resizing # <<<<<<<<<<<<<<
5850 * info.strides = &info.itemsize
5851 *
5852 */
5853 __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_v_item_count); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(3, 121, __pyx_L1_error)
5854 (__pyx_v_info->shape[0]) = __pyx_t_5;
5855
5856 /* "array.pxd":122
5857 * raise MemoryError()
5858 * info.shape[0] = item_count # constant regardless of resizing
5859 * info.strides = &info.itemsize # <<<<<<<<<<<<<<
5860 *
5861 * info.format = <char*> (info.shape + 1)
5862 */
5863 __pyx_v_info->strides = (&__pyx_v_info->itemsize);
5864
5865 /* "array.pxd":124
5866 * info.strides = &info.itemsize
5867 *
5868 * info.format = <char*> (info.shape + 1) # <<<<<<<<<<<<<<
5869 * info.format[0] = self.ob_descr.typecode
5870 * info.format[1] = 0
5871 */
5872 __pyx_v_info->format = ((char *)(__pyx_v_info->shape + 1));
5873
5874 /* "array.pxd":125
5875 *
5876 * info.format = <char*> (info.shape + 1)
5877 * info.format[0] = self.ob_descr.typecode # <<<<<<<<<<<<<<
5878 * info.format[1] = 0
5879 * info.obj = self
5880 */
5881 __pyx_t_7 = __pyx_v_self->ob_descr->typecode;
5882 (__pyx_v_info->format[0]) = __pyx_t_7;
5883
5884 /* "array.pxd":126
5885 * info.format = <char*> (info.shape + 1)
5886 * info.format[0] = self.ob_descr.typecode
5887 * info.format[1] = 0 # <<<<<<<<<<<<<<
5888 * info.obj = self
5889 *
5890 */
5891 (__pyx_v_info->format[1]) = 0;
5892
5893 /* "array.pxd":127
5894 * info.format[0] = self.ob_descr.typecode
5895 * info.format[1] = 0
5896 * info.obj = self # <<<<<<<<<<<<<<
5897 *
5898 * def __releasebuffer__(self, Py_buffer* info):
5899 */
5900 __Pyx_INCREF((PyObject *)__pyx_v_self);
5901 __Pyx_GIVEREF((PyObject *)__pyx_v_self);
5902 __Pyx_GOTREF(__pyx_v_info->obj);
5903 __Pyx_DECREF(__pyx_v_info->obj);
5904 __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
5905
5906 /* "array.pxd":104
5907 * __data_union data
5908 *
5909 * def __getbuffer__(self, Py_buffer* info, int flags): # <<<<<<<<<<<<<<
5910 * # This implementation of getbuffer is geared towards Cython
5911 * # requirements, and does not yet fulfill the PEP.
5912 */
5913
5914 /* function exit code */
5915 __pyx_r = 0;
5916 goto __pyx_L0;
5917 __pyx_L1_error:;
5918 __Pyx_XDECREF(__pyx_t_1);
5919 __Pyx_XDECREF(__pyx_t_4);
5920 __Pyx_AddTraceback("cpython.array.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5921 __pyx_r = -1;
5922 if (__pyx_v_info->obj != NULL) {
5923 __Pyx_GOTREF(__pyx_v_info->obj);
5924 __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
5925 }
5926 goto __pyx_L2;
5927 __pyx_L0:;
5928 if (__pyx_v_info->obj == Py_None) {
5929 __Pyx_GOTREF(__pyx_v_info->obj);
5930 __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
5931 }
5932 __pyx_L2:;
5933 __Pyx_XDECREF(__pyx_v_item_count);
5934 __Pyx_RefNannyFinishContext();
5935 return __pyx_r;
5936 }
5937
5938 /* "array.pxd":129
5939 * info.obj = self
5940 *
5941 * def __releasebuffer__(self, Py_buffer* info): # <<<<<<<<<<<<<<
5942 * PyObject_Free(info.shape)
5943 *
5944 */
5945
5946 /* Python wrapper */
5947 CYTHON_UNUSED static void __pyx_pw_7cpython_5array_5array_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
5948 CYTHON_UNUSED static void __pyx_pw_7cpython_5array_5array_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
5949 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
5950 __Pyx_RefNannyDeclarations
5951 __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0);
5952 __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
5953 __pyx_pf_7cpython_5array_5array_2__releasebuffer__(((arrayobject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info));
5954
5955 /* function exit code */
5956 __Pyx_RefNannyFinishContext();
5957 }
5958
5959 static void __pyx_pf_7cpython_5array_5array_2__releasebuffer__(CYTHON_UNUSED arrayobject *__pyx_v_self, Py_buffer *__pyx_v_info) {
5960
5961 /* "array.pxd":130
5962 *
5963 * def __releasebuffer__(self, Py_buffer* info):
5964 * PyObject_Free(info.shape) # <<<<<<<<<<<<<<
5965 *
5966 * array newarrayobject(PyTypeObject* type, Py_ssize_t size, arraydescr *descr)
5967 */
5968 PyObject_Free(__pyx_v_info->shape);
5969
5970 /* "array.pxd":129
5971 * info.obj = self
5972 *
5973 * def __releasebuffer__(self, Py_buffer* info): # <<<<<<<<<<<<<<
5974 * PyObject_Free(info.shape)
5975 *
5976 */
5977
5978 /* function exit code */
5979 }
5980
5981 /* "array.pxd":141
5982 *
5983 *
5984 * cdef inline array clone(array template, Py_ssize_t length, bint zero): # <<<<<<<<<<<<<<
5985 * """ fast creation of a new array, given a template array.
5986 * type will be same as template.
5987 */
5988
5989 static CYTHON_INLINE arrayobject *__pyx_f_7cpython_5array_clone(arrayobject *__pyx_v_template, Py_ssize_t __pyx_v_length, int __pyx_v_zero) {
5990 arrayobject *__pyx_v_op = 0;
5991 arrayobject *__pyx_r = NULL;
5992 __Pyx_RefNannyDeclarations
5993 PyObject *__pyx_t_1 = NULL;
5994 int __pyx_t_2;
5995 int __pyx_t_3;
5996 int __pyx_lineno = 0;
5997 const char *__pyx_filename = NULL;
5998 int __pyx_clineno = 0;
5999 __Pyx_RefNannySetupContext("clone", 1);
6000
6001 /* "array.pxd":145
6002 * type will be same as template.
6003 * if zero is true, new array will be initialized with zeroes."""
6004 * cdef array op = newarrayobject(Py_TYPE(template), length, template.ob_descr) # <<<<<<<<<<<<<<
6005 * if zero and op is not None:
6006 * memset(op.data.as_chars, 0, length * op.ob_descr.itemsize)
6007 */
6008 __pyx_t_1 = ((PyObject *)newarrayobject(Py_TYPE(((PyObject *)__pyx_v_template)), __pyx_v_length, __pyx_v_template->ob_descr)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 145, __pyx_L1_error)
6009 __Pyx_GOTREF(__pyx_t_1);
6010 __pyx_v_op = ((arrayobject *)__pyx_t_1);
6011 __pyx_t_1 = 0;
6012
6013 /* "array.pxd":146
6014 * if zero is true, new array will be initialized with zeroes."""
6015 * cdef array op = newarrayobject(Py_TYPE(template), length, template.ob_descr)
6016 * if zero and op is not None: # <<<<<<<<<<<<<<
6017 * memset(op.data.as_chars, 0, length * op.ob_descr.itemsize)
6018 * return op
6019 */
6020 if (__pyx_v_zero) {
6021 } else {
6022 __pyx_t_2 = __pyx_v_zero;
6023 goto __pyx_L4_bool_binop_done;
6024 }
6025 __pyx_t_3 = (((PyObject *)__pyx_v_op) != Py_None);
6026 __pyx_t_2 = __pyx_t_3;
6027 __pyx_L4_bool_binop_done:;
6028 if (__pyx_t_2) {
6029
6030 /* "array.pxd":147
6031 * cdef array op = newarrayobject(Py_TYPE(template), length, template.ob_descr)
6032 * if zero and op is not None:
6033 * memset(op.data.as_chars, 0, length * op.ob_descr.itemsize) # <<<<<<<<<<<<<<
6034 * return op
6035 *
6036 */
6037 (void)(memset(__pyx_v_op->data.as_chars, 0, (__pyx_v_length * __pyx_v_op->ob_descr->itemsize)));
6038
6039 /* "array.pxd":146
6040 * if zero is true, new array will be initialized with zeroes."""
6041 * cdef array op = newarrayobject(Py_TYPE(template), length, template.ob_descr)
6042 * if zero and op is not None: # <<<<<<<<<<<<<<
6043 * memset(op.data.as_chars, 0, length * op.ob_descr.itemsize)
6044 * return op
6045 */
6046 }
6047
6048 /* "array.pxd":148
6049 * if zero and op is not None:
6050 * memset(op.data.as_chars, 0, length * op.ob_descr.itemsize)
6051 * return op # <<<<<<<<<<<<<<
6052 *
6053 * cdef inline array copy(array self):
6054 */
6055 __Pyx_XDECREF((PyObject *)__pyx_r);
6056 __Pyx_INCREF((PyObject *)__pyx_v_op);
6057 __pyx_r = __pyx_v_op;
6058 goto __pyx_L0;
6059
6060 /* "array.pxd":141
6061 *
6062 *
6063 * cdef inline array clone(array template, Py_ssize_t length, bint zero): # <<<<<<<<<<<<<<
6064 * """ fast creation of a new array, given a template array.
6065 * type will be same as template.
6066 */
6067
6068 /* function exit code */
6069 __pyx_L1_error:;
6070 __Pyx_XDECREF(__pyx_t_1);
6071 __Pyx_AddTraceback("cpython.array.clone", __pyx_clineno, __pyx_lineno, __pyx_filename);
6072 __pyx_r = 0;
6073 __pyx_L0:;
6074 __Pyx_XDECREF((PyObject *)__pyx_v_op);
6075 __Pyx_XGIVEREF((PyObject *)__pyx_r);
6076 __Pyx_RefNannyFinishContext();
6077 return __pyx_r;
6078 }
6079
6080 /* "array.pxd":150
6081 * return op
6082 *
6083 * cdef inline array copy(array self): # <<<<<<<<<<<<<<
6084 * """ make a copy of an array. """
6085 * cdef array op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr)
6086 */
6087
6088 static CYTHON_INLINE arrayobject *__pyx_f_7cpython_5array_copy(arrayobject *__pyx_v_self) {
6089 arrayobject *__pyx_v_op = 0;
6090 arrayobject *__pyx_r = NULL;
6091 __Pyx_RefNannyDeclarations
6092 PyObject *__pyx_t_1 = NULL;
6093 int __pyx_lineno = 0;
6094 const char *__pyx_filename = NULL;
6095 int __pyx_clineno = 0;
6096 __Pyx_RefNannySetupContext("copy", 1);
6097
6098 /* "array.pxd":152
6099 * cdef inline array copy(array self):
6100 * """ make a copy of an array. """
6101 * cdef array op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr) # <<<<<<<<<<<<<<
6102 * memcpy(op.data.as_chars, self.data.as_chars, Py_SIZE(op) * op.ob_descr.itemsize)
6103 * return op
6104 */
6105 __pyx_t_1 = ((PyObject *)newarrayobject(Py_TYPE(((PyObject *)__pyx_v_self)), Py_SIZE(((PyObject *)__pyx_v_self)), __pyx_v_self->ob_descr)); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 152, __pyx_L1_error)
6106 __Pyx_GOTREF(__pyx_t_1);
6107 __pyx_v_op = ((arrayobject *)__pyx_t_1);
6108 __pyx_t_1 = 0;
6109
6110 /* "array.pxd":153
6111 * """ make a copy of an array. """
6112 * cdef array op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr)
6113 * memcpy(op.data.as_chars, self.data.as_chars, Py_SIZE(op) * op.ob_descr.itemsize) # <<<<<<<<<<<<<<
6114 * return op
6115 *
6116 */
6117 (void)(memcpy(__pyx_v_op->data.as_chars, __pyx_v_self->data.as_chars, (Py_SIZE(((PyObject *)__pyx_v_op)) * __pyx_v_op->ob_descr->itemsize)));
6118
6119 /* "array.pxd":154
6120 * cdef array op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr)
6121 * memcpy(op.data.as_chars, self.data.as_chars, Py_SIZE(op) * op.ob_descr.itemsize)
6122 * return op # <<<<<<<<<<<<<<
6123 *
6124 * cdef inline int extend_buffer(array self, char* stuff, Py_ssize_t n) except -1:
6125 */
6126 __Pyx_XDECREF((PyObject *)__pyx_r);
6127 __Pyx_INCREF((PyObject *)__pyx_v_op);
6128 __pyx_r = __pyx_v_op;
6129 goto __pyx_L0;
6130
6131 /* "array.pxd":150
6132 * return op
6133 *
6134 * cdef inline array copy(array self): # <<<<<<<<<<<<<<
6135 * """ make a copy of an array. """
6136 * cdef array op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr)
6137 */
6138
6139 /* function exit code */
6140 __pyx_L1_error:;
6141 __Pyx_XDECREF(__pyx_t_1);
6142 __Pyx_AddTraceback("cpython.array.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
6143 __pyx_r = 0;
6144 __pyx_L0:;
6145 __Pyx_XDECREF((PyObject *)__pyx_v_op);
6146 __Pyx_XGIVEREF((PyObject *)__pyx_r);
6147 __Pyx_RefNannyFinishContext();
6148 return __pyx_r;
6149 }
6150
6151 /* "array.pxd":156
6152 * return op
6153 *
6154 * cdef inline int extend_buffer(array self, char* stuff, Py_ssize_t n) except -1: # <<<<<<<<<<<<<<
6155 * """ efficient appending of new stuff of same type
6156 * (e.g. of same array type)
6157 */
6158
6159 static CYTHON_INLINE int __pyx_f_7cpython_5array_extend_buffer(arrayobject *__pyx_v_self, char *__pyx_v_stuff, Py_ssize_t __pyx_v_n) {
6160 Py_ssize_t __pyx_v_itemsize;
6161 Py_ssize_t __pyx_v_origsize;
6162 int __pyx_r;
6163 int __pyx_t_1;
6164 int __pyx_lineno = 0;
6165 const char *__pyx_filename = NULL;
6166 int __pyx_clineno = 0;
6167
6168 /* "array.pxd":160
6169 * (e.g. of same array type)
6170 * n: number of elements (not number of bytes!) """
6171 * cdef Py_ssize_t itemsize = self.ob_descr.itemsize # <<<<<<<<<<<<<<
6172 * cdef Py_ssize_t origsize = Py_SIZE(self)
6173 * resize_smart(self, origsize + n)
6174 */
6175 __pyx_t_1 = __pyx_v_self->ob_descr->itemsize;
6176 __pyx_v_itemsize = __pyx_t_1;
6177
6178 /* "array.pxd":161
6179 * n: number of elements (not number of bytes!) """
6180 * cdef Py_ssize_t itemsize = self.ob_descr.itemsize
6181 * cdef Py_ssize_t origsize = Py_SIZE(self) # <<<<<<<<<<<<<<
6182 * resize_smart(self, origsize + n)
6183 * memcpy(self.data.as_chars + origsize * itemsize, stuff, n * itemsize)
6184 */
6185 __pyx_v_origsize = Py_SIZE(((PyObject *)__pyx_v_self));
6186
6187 /* "array.pxd":162
6188 * cdef Py_ssize_t itemsize = self.ob_descr.itemsize
6189 * cdef Py_ssize_t origsize = Py_SIZE(self)
6190 * resize_smart(self, origsize + n) # <<<<<<<<<<<<<<
6191 * memcpy(self.data.as_chars + origsize * itemsize, stuff, n * itemsize)
6192 * return 0
6193 */
6194 __pyx_t_1 = resize_smart(__pyx_v_self, (__pyx_v_origsize + __pyx_v_n)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(3, 162, __pyx_L1_error)
6195
6196 /* "array.pxd":163
6197 * cdef Py_ssize_t origsize = Py_SIZE(self)
6198 * resize_smart(self, origsize + n)
6199 * memcpy(self.data.as_chars + origsize * itemsize, stuff, n * itemsize) # <<<<<<<<<<<<<<
6200 * return 0
6201 *
6202 */
6203 (void)(memcpy((__pyx_v_self->data.as_chars + (__pyx_v_origsize * __pyx_v_itemsize)), __pyx_v_stuff, (__pyx_v_n * __pyx_v_itemsize)));
6204
6205 /* "array.pxd":164
6206 * resize_smart(self, origsize + n)
6207 * memcpy(self.data.as_chars + origsize * itemsize, stuff, n * itemsize)
6208 * return 0 # <<<<<<<<<<<<<<
6209 *
6210 * cdef inline int extend(array self, array other) except -1:
6211 */
6212 __pyx_r = 0;
6213 goto __pyx_L0;
6214
6215 /* "array.pxd":156
6216 * return op
6217 *
6218 * cdef inline int extend_buffer(array self, char* stuff, Py_ssize_t n) except -1: # <<<<<<<<<<<<<<
6219 * """ efficient appending of new stuff of same type
6220 * (e.g. of same array type)
6221 */
6222
6223 /* function exit code */
6224 __pyx_L1_error:;
6225 __Pyx_AddTraceback("cpython.array.extend_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename);
6226 __pyx_r = -1;
6227 __pyx_L0:;
6228 return __pyx_r;
6229 }
6230
6231 /* "array.pxd":166
6232 * return 0
6233 *
6234 * cdef inline int extend(array self, array other) except -1: # <<<<<<<<<<<<<<
6235 * """ extend array with data from another array; types must match. """
6236 * if self.ob_descr.typecode != other.ob_descr.typecode:
6237 */
6238
6239 static CYTHON_INLINE int __pyx_f_7cpython_5array_extend(arrayobject *__pyx_v_self, arrayobject *__pyx_v_other) {
6240 int __pyx_r;
6241 int __pyx_t_1;
6242 int __pyx_t_2;
6243 int __pyx_lineno = 0;
6244 const char *__pyx_filename = NULL;
6245 int __pyx_clineno = 0;
6246
6247 /* "array.pxd":168
6248 * cdef inline int extend(array self, array other) except -1:
6249 * """ extend array with data from another array; types must match. """
6250 * if self.ob_descr.typecode != other.ob_descr.typecode: # <<<<<<<<<<<<<<
6251 * PyErr_BadArgument()
6252 * return extend_buffer(self, other.data.as_chars, Py_SIZE(other))
6253 */
6254 __pyx_t_1 = (__pyx_v_self->ob_descr->typecode != __pyx_v_other->ob_descr->typecode);
6255 if (__pyx_t_1) {
6256
6257 /* "array.pxd":169
6258 * """ extend array with data from another array; types must match. """
6259 * if self.ob_descr.typecode != other.ob_descr.typecode:
6260 * PyErr_BadArgument() # <<<<<<<<<<<<<<
6261 * return extend_buffer(self, other.data.as_chars, Py_SIZE(other))
6262 *
6263 */
6264 __pyx_t_2 = PyErr_BadArgument(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(3, 169, __pyx_L1_error)
6265
6266 /* "array.pxd":168
6267 * cdef inline int extend(array self, array other) except -1:
6268 * """ extend array with data from another array; types must match. """
6269 * if self.ob_descr.typecode != other.ob_descr.typecode: # <<<<<<<<<<<<<<
6270 * PyErr_BadArgument()
6271 * return extend_buffer(self, other.data.as_chars, Py_SIZE(other))
6272 */
6273 }
6274
6275 /* "array.pxd":170
6276 * if self.ob_descr.typecode != other.ob_descr.typecode:
6277 * PyErr_BadArgument()
6278 * return extend_buffer(self, other.data.as_chars, Py_SIZE(other)) # <<<<<<<<<<<<<<
6279 *
6280 * cdef inline void zero(array self) noexcept:
6281 */
6282 __pyx_t_2 = __pyx_f_7cpython_5array_extend_buffer(__pyx_v_self, __pyx_v_other->data.as_chars, Py_SIZE(((PyObject *)__pyx_v_other))); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(3, 170, __pyx_L1_error)
6283 __pyx_r = __pyx_t_2;
6284 goto __pyx_L0;
6285
6286 /* "array.pxd":166
6287 * return 0
6288 *
6289 * cdef inline int extend(array self, array other) except -1: # <<<<<<<<<<<<<<
6290 * """ extend array with data from another array; types must match. """
6291 * if self.ob_descr.typecode != other.ob_descr.typecode:
6292 */
6293
6294 /* function exit code */
6295 __pyx_L1_error:;
6296 __Pyx_AddTraceback("cpython.array.extend", __pyx_clineno, __pyx_lineno, __pyx_filename);
6297 __pyx_r = -1;
6298 __pyx_L0:;
6299 return __pyx_r;
6300 }
6301
6302 /* "array.pxd":172
6303 * return extend_buffer(self, other.data.as_chars, Py_SIZE(other))
6304 *
6305 * cdef inline void zero(array self) noexcept: # <<<<<<<<<<<<<<
6306 * """ set all elements of array to zero. """
6307 * memset(self.data.as_chars, 0, Py_SIZE(self) * self.ob_descr.itemsize)
6308 */
6309
6310 static CYTHON_INLINE void __pyx_f_7cpython_5array_zero(arrayobject *__pyx_v_self) {
6311
6312 /* "array.pxd":174
6313 * cdef inline void zero(array self) noexcept:
6314 * """ set all elements of array to zero. """
6315 * memset(self.data.as_chars, 0, Py_SIZE(self) * self.ob_descr.itemsize) # <<<<<<<<<<<<<<
6316 */
6317 (void)(memset(__pyx_v_self->data.as_chars, 0, (Py_SIZE(((PyObject *)__pyx_v_self)) * __pyx_v_self->ob_descr->itemsize)));
6318
6319 /* "array.pxd":172
6320 * return extend_buffer(self, other.data.as_chars, Py_SIZE(other))
6321 *
6322 * cdef inline void zero(array self) noexcept: # <<<<<<<<<<<<<<
6323 * """ set all elements of array to zero. """
6324 * memset(self.data.as_chars, 0, Py_SIZE(self) * self.ob_descr.itemsize)
6325 */
6326
6327 /* function exit code */
6328 }
6329
6330 /* "pysam/libchtslib.pyx":53
6331 *
6332 *
6333 * cpdef set_verbosity(int verbosity): # <<<<<<<<<<<<<<
6334 * """Set htslib's hts_verbose global variable to the specified value."""
6335 * return hts_set_verbosity(verbosity)
6336 */
6337
6338 static PyObject *__pyx_pw_5pysam_10libchtslib_1set_verbosity(PyObject *__pyx_self,
6339 #if CYTHON_METH_FASTCALL
6340 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
6341 #else
6342 PyObject *__pyx_args, PyObject *__pyx_kwds
6343 #endif
6344 ); /*proto*/
6345 static PyObject *__pyx_f_5pysam_10libchtslib_set_verbosity(int __pyx_v_verbosity, CYTHON_UNUSED int __pyx_skip_dispatch) {
6346 PyObject *__pyx_r = NULL;
6347 __Pyx_TraceDeclarations
6348 __Pyx_RefNannyDeclarations
6349 PyObject *__pyx_t_1 = NULL;
6350 int __pyx_lineno = 0;
6351 const char *__pyx_filename = NULL;
6352 int __pyx_clineno = 0;
6353 __Pyx_TraceFrameInit(__pyx_codeobj_)
6354 __Pyx_RefNannySetupContext("set_verbosity", 1);
6355 __Pyx_TraceCall("set_verbosity", __pyx_f[0], 53, 0, __PYX_ERR(0, 53, __pyx_L1_error));
6356
6357 /* "pysam/libchtslib.pyx":55
6358 * cpdef set_verbosity(int verbosity):
6359 * """Set htslib's hts_verbose global variable to the specified value."""
6360 * return hts_set_verbosity(verbosity) # <<<<<<<<<<<<<<
6361 *
6362 * cpdef get_verbosity():
6363 */
6364 __Pyx_XDECREF(__pyx_r);
6365 __pyx_t_1 = __Pyx_PyInt_From_int(hts_set_verbosity(__pyx_v_verbosity)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 55, __pyx_L1_error)
6366 __Pyx_GOTREF(__pyx_t_1);
6367 __pyx_r = __pyx_t_1;
6368 __pyx_t_1 = 0;
6369 goto __pyx_L0;
6370
6371 /* "pysam/libchtslib.pyx":53
6372 *
6373 *
6374 * cpdef set_verbosity(int verbosity): # <<<<<<<<<<<<<<
6375 * """Set htslib's hts_verbose global variable to the specified value."""
6376 * return hts_set_verbosity(verbosity)
6377 */
6378
6379 /* function exit code */
6380 __pyx_L1_error:;
6381 __Pyx_XDECREF(__pyx_t_1);
6382 __Pyx_AddTraceback("pysam.libchtslib.set_verbosity", __pyx_clineno, __pyx_lineno, __pyx_filename);
6383 __pyx_r = 0;
6384 __pyx_L0:;
6385 __Pyx_XGIVEREF(__pyx_r);
6386 __Pyx_TraceReturn(__pyx_r, 0);
6387 __Pyx_RefNannyFinishContext();
6388 return __pyx_r;
6389 }
6390
6391 /* Python wrapper */
6392 static PyObject *__pyx_pw_5pysam_10libchtslib_1set_verbosity(PyObject *__pyx_self,
6393 #if CYTHON_METH_FASTCALL
6394 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
6395 #else
6396 PyObject *__pyx_args, PyObject *__pyx_kwds
6397 #endif
6398 ); /*proto*/
6399 PyDoc_STRVAR(__pyx_doc_5pysam_10libchtslib_set_verbosity, "set_verbosity(int verbosity)\nSet htslib's hts_verbose global variable to the specified value.");
6400 static PyMethodDef __pyx_mdef_5pysam_10libchtslib_1set_verbosity = {"set_verbosity", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_1set_verbosity, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_set_verbosity};
6401 static PyObject *__pyx_pw_5pysam_10libchtslib_1set_verbosity(PyObject *__pyx_self,
6402 #if CYTHON_METH_FASTCALL
6403 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
6404 #else
6405 PyObject *__pyx_args, PyObject *__pyx_kwds
6406 #endif
6407 ) {
6408 int __pyx_v_verbosity;
6409 #if !CYTHON_METH_FASTCALL
6410 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
6411 #endif
6412 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
6413 PyObject* values[1] = {0};
6414 int __pyx_lineno = 0;
6415 const char *__pyx_filename = NULL;
6416 int __pyx_clineno = 0;
6417 PyObject *__pyx_r = 0;
6418 __Pyx_RefNannyDeclarations
6419 __Pyx_RefNannySetupContext("set_verbosity (wrapper)", 0);
6420 #if !CYTHON_METH_FASTCALL
6421 #if CYTHON_ASSUME_SAFE_MACROS
6422 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
6423 #else
6424 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
6425 #endif
6426 #endif
6427 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
6428 {
6429 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_verbosity,0};
6430 if (__pyx_kwds) {
6431 Py_ssize_t kw_args;
6432 switch (__pyx_nargs) {
6433 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
6434 CYTHON_FALLTHROUGH;
6435 case 0: break;
6436 default: goto __pyx_L5_argtuple_error;
6437 }
6438 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
6439 switch (__pyx_nargs) {
6440 case 0:
6441 if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_verbosity)) != 0)) {
6442 (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
6443 kw_args--;
6444 }
6445 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 53, __pyx_L3_error)
6446 else goto __pyx_L5_argtuple_error;
6447 }
6448 if (unlikely(kw_args > 0)) {
6449 const Py_ssize_t kwd_pos_args = __pyx_nargs;
6450 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "set_verbosity") < 0)) __PYX_ERR(0, 53, __pyx_L3_error)
6451 }
6452 } else if (unlikely(__pyx_nargs != 1)) {
6453 goto __pyx_L5_argtuple_error;
6454 } else {
6455 values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
6456 }
6457 __pyx_v_verbosity = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_verbosity == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 53, __pyx_L3_error)
6458 }
6459 goto __pyx_L6_skip;
6460 __pyx_L5_argtuple_error:;
6461 __Pyx_RaiseArgtupleInvalid("set_verbosity", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 53, __pyx_L3_error)
6462 __pyx_L6_skip:;
6463 goto __pyx_L4_argument_unpacking_done;
6464 __pyx_L3_error:;
6465 {
6466 Py_ssize_t __pyx_temp;
6467 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
6468 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
6469 }
6470 }
6471 __Pyx_AddTraceback("pysam.libchtslib.set_verbosity", __pyx_clineno, __pyx_lineno, __pyx_filename);
6472 __Pyx_RefNannyFinishContext();
6473 return NULL;
6474 __pyx_L4_argument_unpacking_done:;
6475 __pyx_r = __pyx_pf_5pysam_10libchtslib_set_verbosity(__pyx_self, __pyx_v_verbosity);
6476
6477 /* function exit code */
6478 {
6479 Py_ssize_t __pyx_temp;
6480 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
6481 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
6482 }
6483 }
6484 __Pyx_RefNannyFinishContext();
6485 return __pyx_r;
6486 }
6487
6488 static PyObject *__pyx_pf_5pysam_10libchtslib_set_verbosity(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_verbosity) {
6489 PyObject *__pyx_r = NULL;
6490 __Pyx_TraceDeclarations
6491 __Pyx_RefNannyDeclarations
6492 PyObject *__pyx_t_1 = NULL;
6493 int __pyx_lineno = 0;
6494 const char *__pyx_filename = NULL;
6495 int __pyx_clineno = 0;
6496 __Pyx_TraceFrameInit(__pyx_codeobj_)
6497 __Pyx_RefNannySetupContext("set_verbosity", 1);
6498 __Pyx_TraceCall("set_verbosity (wrapper)", __pyx_f[0], 53, 0, __PYX_ERR(0, 53, __pyx_L1_error));
6499 __Pyx_XDECREF(__pyx_r);
6500 __pyx_t_1 = __pyx_f_5pysam_10libchtslib_set_verbosity(__pyx_v_verbosity, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 53, __pyx_L1_error)
6501 __Pyx_GOTREF(__pyx_t_1);
6502 __pyx_r = __pyx_t_1;
6503 __pyx_t_1 = 0;
6504 goto __pyx_L0;
6505
6506 /* function exit code */
6507 __pyx_L1_error:;
6508 __Pyx_XDECREF(__pyx_t_1);
6509 __Pyx_AddTraceback("pysam.libchtslib.set_verbosity", __pyx_clineno, __pyx_lineno, __pyx_filename);
6510 __pyx_r = NULL;
6511 __pyx_L0:;
6512 __Pyx_XGIVEREF(__pyx_r);
6513 __Pyx_TraceReturn(__pyx_r, 0);
6514 __Pyx_RefNannyFinishContext();
6515 return __pyx_r;
6516 }
6517
6518 /* "pysam/libchtslib.pyx":57
6519 * return hts_set_verbosity(verbosity)
6520 *
6521 * cpdef get_verbosity(): # <<<<<<<<<<<<<<
6522 * """Return the value of htslib's hts_verbose global variable."""
6523 * return hts_get_verbosity()
6524 */
6525
6526 static PyObject *__pyx_pw_5pysam_10libchtslib_3get_verbosity(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
6527 static PyObject *__pyx_f_5pysam_10libchtslib_get_verbosity(CYTHON_UNUSED int __pyx_skip_dispatch) {
6528 PyObject *__pyx_r = NULL;
6529 __Pyx_TraceDeclarations
6530 __Pyx_RefNannyDeclarations
6531 PyObject *__pyx_t_1 = NULL;
6532 int __pyx_lineno = 0;
6533 const char *__pyx_filename = NULL;
6534 int __pyx_clineno = 0;
6535 __Pyx_TraceFrameInit(__pyx_codeobj__2)
6536 __Pyx_RefNannySetupContext("get_verbosity", 1);
6537 __Pyx_TraceCall("get_verbosity", __pyx_f[0], 57, 0, __PYX_ERR(0, 57, __pyx_L1_error));
6538
6539 /* "pysam/libchtslib.pyx":59
6540 * cpdef get_verbosity():
6541 * """Return the value of htslib's hts_verbose global variable."""
6542 * return hts_get_verbosity() # <<<<<<<<<<<<<<
6543 *
6544 *
6545 */
6546 __Pyx_XDECREF(__pyx_r);
6547 __pyx_t_1 = __Pyx_PyInt_From_int(hts_get_verbosity()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 59, __pyx_L1_error)
6548 __Pyx_GOTREF(__pyx_t_1);
6549 __pyx_r = __pyx_t_1;
6550 __pyx_t_1 = 0;
6551 goto __pyx_L0;
6552
6553 /* "pysam/libchtslib.pyx":57
6554 * return hts_set_verbosity(verbosity)
6555 *
6556 * cpdef get_verbosity(): # <<<<<<<<<<<<<<
6557 * """Return the value of htslib's hts_verbose global variable."""
6558 * return hts_get_verbosity()
6559 */
6560
6561 /* function exit code */
6562 __pyx_L1_error:;
6563 __Pyx_XDECREF(__pyx_t_1);
6564 __Pyx_AddTraceback("pysam.libchtslib.get_verbosity", __pyx_clineno, __pyx_lineno, __pyx_filename);
6565 __pyx_r = 0;
6566 __pyx_L0:;
6567 __Pyx_XGIVEREF(__pyx_r);
6568 __Pyx_TraceReturn(__pyx_r, 0);
6569 __Pyx_RefNannyFinishContext();
6570 return __pyx_r;
6571 }
6572
6573 /* Python wrapper */
6574 static PyObject *__pyx_pw_5pysam_10libchtslib_3get_verbosity(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
6575 PyDoc_STRVAR(__pyx_doc_5pysam_10libchtslib_2get_verbosity, "get_verbosity()\nReturn the value of htslib's hts_verbose global variable.");
6576 static PyMethodDef __pyx_mdef_5pysam_10libchtslib_3get_verbosity = {"get_verbosity", (PyCFunction)__pyx_pw_5pysam_10libchtslib_3get_verbosity, METH_NOARGS, __pyx_doc_5pysam_10libchtslib_2get_verbosity};
6577 static PyObject *__pyx_pw_5pysam_10libchtslib_3get_verbosity(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
6578 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
6579 PyObject *__pyx_r = 0;
6580 __Pyx_RefNannyDeclarations
6581 __Pyx_RefNannySetupContext("get_verbosity (wrapper)", 0);
6582 __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
6583 __pyx_r = __pyx_pf_5pysam_10libchtslib_2get_verbosity(__pyx_self);
6584
6585 /* function exit code */
6586 __Pyx_RefNannyFinishContext();
6587 return __pyx_r;
6588 }
6589
6590 static PyObject *__pyx_pf_5pysam_10libchtslib_2get_verbosity(CYTHON_UNUSED PyObject *__pyx_self) {
6591 PyObject *__pyx_r = NULL;
6592 __Pyx_TraceDeclarations
6593 __Pyx_RefNannyDeclarations
6594 PyObject *__pyx_t_1 = NULL;
6595 int __pyx_lineno = 0;
6596 const char *__pyx_filename = NULL;
6597 int __pyx_clineno = 0;
6598 __Pyx_TraceFrameInit(__pyx_codeobj__2)
6599 __Pyx_RefNannySetupContext("get_verbosity", 1);
6600 __Pyx_TraceCall("get_verbosity (wrapper)", __pyx_f[0], 57, 0, __PYX_ERR(0, 57, __pyx_L1_error));
6601 __Pyx_XDECREF(__pyx_r);
6602 __pyx_t_1 = __pyx_f_5pysam_10libchtslib_get_verbosity(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 57, __pyx_L1_error)
6603 __Pyx_GOTREF(__pyx_t_1);
6604 __pyx_r = __pyx_t_1;
6605 __pyx_t_1 = 0;
6606 goto __pyx_L0;
6607
6608 /* function exit code */
6609 __pyx_L1_error:;
6610 __Pyx_XDECREF(__pyx_t_1);
6611 __Pyx_AddTraceback("pysam.libchtslib.get_verbosity", __pyx_clineno, __pyx_lineno, __pyx_filename);
6612 __pyx_r = NULL;
6613 __pyx_L0:;
6614 __Pyx_XGIVEREF(__pyx_r);
6615 __Pyx_TraceReturn(__pyx_r, 0);
6616 __Pyx_RefNannyFinishContext();
6617 return __pyx_r;
6618 }
6619
6620 /* "pysam/libchtslib.pyx":71
6621 * cdef readonly object name, mode
6622 *
6623 * def __init__(self, name, mode='r', closefd=True): # <<<<<<<<<<<<<<
6624 * self._open(name, mode, closefd=True)
6625 *
6626 */
6627
6628 /* Python wrapper */
6629 static int __pyx_pw_5pysam_10libchtslib_5HFile_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
6630 static int __pyx_pw_5pysam_10libchtslib_5HFile_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
6631 PyObject *__pyx_v_name = 0;
6632 PyObject *__pyx_v_mode = 0;
6633 CYTHON_UNUSED PyObject *__pyx_v_closefd = 0;
6634 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
6635 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
6636 PyObject* values[3] = {0,0,0};
6637 int __pyx_lineno = 0;
6638 const char *__pyx_filename = NULL;
6639 int __pyx_clineno = 0;
6640 int __pyx_r;
6641 __Pyx_RefNannyDeclarations
6642 __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
6643 #if CYTHON_ASSUME_SAFE_MACROS
6644 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
6645 #else
6646 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
6647 #endif
6648 __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
6649 {
6650 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,&__pyx_n_s_mode,&__pyx_n_s_closefd,0};
6651 values[1] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)__pyx_n_u_r));
6652 values[2] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)Py_True));
6653 if (__pyx_kwds) {
6654 Py_ssize_t kw_args;
6655 switch (__pyx_nargs) {
6656 case 3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2);
6657 CYTHON_FALLTHROUGH;
6658 case 2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
6659 CYTHON_FALLTHROUGH;
6660 case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
6661 CYTHON_FALLTHROUGH;
6662 case 0: break;
6663 default: goto __pyx_L5_argtuple_error;
6664 }
6665 kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
6666 switch (__pyx_nargs) {
6667 case 0:
6668 if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_name)) != 0)) {
6669 (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
6670 kw_args--;
6671 }
6672 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 71, __pyx_L3_error)
6673 else goto __pyx_L5_argtuple_error;
6674 CYTHON_FALLTHROUGH;
6675 case 1:
6676 if (kw_args > 0) {
6677 PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_mode);
6678 if (value) { values[1] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
6679 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 71, __pyx_L3_error)
6680 }
6681 CYTHON_FALLTHROUGH;
6682 case 2:
6683 if (kw_args > 0) {
6684 PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_closefd);
6685 if (value) { values[2] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
6686 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 71, __pyx_L3_error)
6687 }
6688 }
6689 if (unlikely(kw_args > 0)) {
6690 const Py_ssize_t kwd_pos_args = __pyx_nargs;
6691 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(0, 71, __pyx_L3_error)
6692 }
6693 } else {
6694 switch (__pyx_nargs) {
6695 case 3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2);
6696 CYTHON_FALLTHROUGH;
6697 case 2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
6698 CYTHON_FALLTHROUGH;
6699 case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
6700 break;
6701 default: goto __pyx_L5_argtuple_error;
6702 }
6703 }
6704 __pyx_v_name = values[0];
6705 __pyx_v_mode = values[1];
6706 __pyx_v_closefd = values[2];
6707 }
6708 goto __pyx_L6_skip;
6709 __pyx_L5_argtuple_error:;
6710 __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 3, __pyx_nargs); __PYX_ERR(0, 71, __pyx_L3_error)
6711 __pyx_L6_skip:;
6712 goto __pyx_L4_argument_unpacking_done;
6713 __pyx_L3_error:;
6714 {
6715 Py_ssize_t __pyx_temp;
6716 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
6717 __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
6718 }
6719 }
6720 __Pyx_AddTraceback("pysam.libchtslib.HFile.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6721 __Pyx_RefNannyFinishContext();
6722 return -1;
6723 __pyx_L4_argument_unpacking_done:;
6724 __pyx_r = __pyx_pf_5pysam_10libchtslib_5HFile___init__(((struct __pyx_obj_5pysam_10libchtslib_HFile *)__pyx_v_self), __pyx_v_name, __pyx_v_mode, __pyx_v_closefd);
6725
6726 /* function exit code */
6727 {
6728 Py_ssize_t __pyx_temp;
6729 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
6730 __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
6731 }
6732 }
6733 __Pyx_RefNannyFinishContext();
6734 return __pyx_r;
6735 }
6736
6737 static int __pyx_pf_5pysam_10libchtslib_5HFile___init__(struct __pyx_obj_5pysam_10libchtslib_HFile *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_mode, CYTHON_UNUSED PyObject *__pyx_v_closefd) {
6738 int __pyx_r;
6739 __Pyx_TraceDeclarations
6740 __Pyx_RefNannyDeclarations
6741 PyObject *__pyx_t_1 = NULL;
6742 struct __pyx_opt_args_5pysam_10libchtslib_5HFile__open __pyx_t_2;
6743 int __pyx_lineno = 0;
6744 const char *__pyx_filename = NULL;
6745 int __pyx_clineno = 0;
6746 __Pyx_RefNannySetupContext("__init__", 1);
6747 __Pyx_TraceCall("__init__", __pyx_f[0], 71, 0, __PYX_ERR(0, 71, __pyx_L1_error));
6748
6749 /* "pysam/libchtslib.pyx":72
6750 *
6751 * def __init__(self, name, mode='r', closefd=True):
6752 * self._open(name, mode, closefd=True) # <<<<<<<<<<<<<<
6753 *
6754 * def __dealloc__(self):
6755 */
6756 __pyx_t_2.__pyx_n = 1;
6757 __pyx_t_2.closefd = Py_True;
6758 __pyx_t_1 = ((struct __pyx_vtabstruct_5pysam_10libchtslib_HFile *)__pyx_v_self->__pyx_vtab)->_open(__pyx_v_self, __pyx_v_name, __pyx_v_mode, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 72, __pyx_L1_error)
6759 __Pyx_GOTREF(__pyx_t_1);
6760 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6761
6762 /* "pysam/libchtslib.pyx":71
6763 * cdef readonly object name, mode
6764 *
6765 * def __init__(self, name, mode='r', closefd=True): # <<<<<<<<<<<<<<
6766 * self._open(name, mode, closefd=True)
6767 *
6768 */
6769
6770 /* function exit code */
6771 __pyx_r = 0;
6772 goto __pyx_L0;
6773 __pyx_L1_error:;
6774 __Pyx_XDECREF(__pyx_t_1);
6775 __Pyx_AddTraceback("pysam.libchtslib.HFile.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6776 __pyx_r = -1;
6777 __pyx_L0:;
6778 __Pyx_TraceReturn(Py_None, 0);
6779 __Pyx_RefNannyFinishContext();
6780 return __pyx_r;
6781 }
6782
6783 /* "pysam/libchtslib.pyx":74
6784 * self._open(name, mode, closefd=True)
6785 *
6786 * def __dealloc__(self): # <<<<<<<<<<<<<<
6787 * self.close()
6788 *
6789 */
6790
6791 /* Python wrapper */
6792 static void __pyx_pw_5pysam_10libchtslib_5HFile_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
6793 static void __pyx_pw_5pysam_10libchtslib_5HFile_3__dealloc__(PyObject *__pyx_v_self) {
6794 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
6795 __Pyx_RefNannyDeclarations
6796 __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
6797 __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
6798 __pyx_pf_5pysam_10libchtslib_5HFile_2__dealloc__(((struct __pyx_obj_5pysam_10libchtslib_HFile *)__pyx_v_self));
6799
6800 /* function exit code */
6801 __Pyx_RefNannyFinishContext();
6802 }
6803
6804 static void __pyx_pf_5pysam_10libchtslib_5HFile_2__dealloc__(struct __pyx_obj_5pysam_10libchtslib_HFile *__pyx_v_self) {
6805 __Pyx_TraceDeclarations
6806 __Pyx_RefNannyDeclarations
6807 PyObject *__pyx_t_1 = NULL;
6808 PyObject *__pyx_t_2 = NULL;
6809 PyObject *__pyx_t_3 = NULL;
6810 unsigned int __pyx_t_4;
6811 int __pyx_lineno = 0;
6812 const char *__pyx_filename = NULL;
6813 int __pyx_clineno = 0;
6814 __Pyx_RefNannySetupContext("__dealloc__", 1);
6815 __Pyx_TraceCall("__dealloc__", __pyx_f[0], 74, 0, __PYX_ERR(0, 74, __pyx_L1_error));
6816
6817 /* "pysam/libchtslib.pyx":75
6818 *
6819 * def __dealloc__(self):
6820 * self.close() # <<<<<<<<<<<<<<
6821 *
6822 * @property
6823 */
6824 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_close); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 75, __pyx_L1_error)
6825 __Pyx_GOTREF(__pyx_t_2);
6826 __pyx_t_3 = NULL;
6827 __pyx_t_4 = 0;
6828 #if CYTHON_UNPACK_METHODS
6829 if (likely(PyMethod_Check(__pyx_t_2))) {
6830 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
6831 if (likely(__pyx_t_3)) {
6832 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
6833 __Pyx_INCREF(__pyx_t_3);
6834 __Pyx_INCREF(function);
6835 __Pyx_DECREF_SET(__pyx_t_2, function);
6836 __pyx_t_4 = 1;
6837 }
6838 }
6839 #endif
6840 {
6841 PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
6842 __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
6843 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
6844 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 75, __pyx_L1_error)
6845 __Pyx_GOTREF(__pyx_t_1);
6846 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6847 }
6848 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6849
6850 /* "pysam/libchtslib.pyx":74
6851 * self._open(name, mode, closefd=True)
6852 *
6853 * def __dealloc__(self): # <<<<<<<<<<<<<<
6854 * self.close()
6855 *
6856 */
6857
6858 /* function exit code */
6859 goto __pyx_L0;
6860 __pyx_L1_error:;
6861 __Pyx_XDECREF(__pyx_t_1);
6862 __Pyx_XDECREF(__pyx_t_2);
6863 __Pyx_XDECREF(__pyx_t_3);
6864 __Pyx_WriteUnraisable("pysam.libchtslib.HFile.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
6865 __pyx_L0:;
6866 __Pyx_TraceReturn(Py_None, 0);
6867 __Pyx_RefNannyFinishContext();
6868 }
6869
6870 /* "pysam/libchtslib.pyx":77
6871 * self.close()
6872 *
6873 * @property # <<<<<<<<<<<<<<
6874 * def closed(self):
6875 * return self.fp == NULL
6876 */
6877
6878 /* Python wrapper */
6879 static PyObject *__pyx_pw_5pysam_10libchtslib_5HFile_6closed_1__get__(PyObject *__pyx_v_self); /*proto*/
6880 static PyObject *__pyx_pw_5pysam_10libchtslib_5HFile_6closed_1__get__(PyObject *__pyx_v_self) {
6881 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
6882 PyObject *__pyx_r = 0;
6883 __Pyx_RefNannyDeclarations
6884 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
6885 __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
6886 __pyx_r = __pyx_pf_5pysam_10libchtslib_5HFile_6closed___get__(((struct __pyx_obj_5pysam_10libchtslib_HFile *)__pyx_v_self));
6887
6888 /* function exit code */
6889 __Pyx_RefNannyFinishContext();
6890 return __pyx_r;
6891 }
6892
6893 static PyObject *__pyx_pf_5pysam_10libchtslib_5HFile_6closed___get__(struct __pyx_obj_5pysam_10libchtslib_HFile *__pyx_v_self) {
6894 PyObject *__pyx_r = NULL;
6895 __Pyx_TraceDeclarations
6896 __Pyx_RefNannyDeclarations
6897 PyObject *__pyx_t_1 = NULL;
6898 int __pyx_lineno = 0;
6899 const char *__pyx_filename = NULL;
6900 int __pyx_clineno = 0;
6901 __Pyx_RefNannySetupContext("__get__", 1);
6902 __Pyx_TraceCall("__get__", __pyx_f[0], 77, 0, __PYX_ERR(0, 77, __pyx_L1_error));
6903
6904 /* "pysam/libchtslib.pyx":79
6905 * @property
6906 * def closed(self):
6907 * return self.fp == NULL # <<<<<<<<<<<<<<
6908 *
6909 * cdef _open(self, name, mode, closefd=True):
6910 */
6911 __Pyx_XDECREF(__pyx_r);
6912 __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_self->fp == NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 79, __pyx_L1_error)
6913 __Pyx_GOTREF(__pyx_t_1);
6914 __pyx_r = __pyx_t_1;
6915 __pyx_t_1 = 0;
6916 goto __pyx_L0;
6917
6918 /* "pysam/libchtslib.pyx":77
6919 * self.close()
6920 *
6921 * @property # <<<<<<<<<<<<<<
6922 * def closed(self):
6923 * return self.fp == NULL
6924 */
6925
6926 /* function exit code */
6927 __pyx_L1_error:;
6928 __Pyx_XDECREF(__pyx_t_1);
6929 __Pyx_AddTraceback("pysam.libchtslib.HFile.closed.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6930 __pyx_r = NULL;
6931 __pyx_L0:;
6932 __Pyx_XGIVEREF(__pyx_r);
6933 __Pyx_TraceReturn(__pyx_r, 0);
6934 __Pyx_RefNannyFinishContext();
6935 return __pyx_r;
6936 }
6937
6938 /* "pysam/libchtslib.pyx":81
6939 * return self.fp == NULL
6940 *
6941 * cdef _open(self, name, mode, closefd=True): # <<<<<<<<<<<<<<
6942 * self.name = name
6943 * self.mode = mode
6944 */
6945
6946 static PyObject *__pyx_f_5pysam_10libchtslib_5HFile__open(struct __pyx_obj_5pysam_10libchtslib_HFile *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_mode, struct __pyx_opt_args_5pysam_10libchtslib_5HFile__open *__pyx_optional_args) {
6947 PyObject *__pyx_r = NULL;
6948 __Pyx_TraceDeclarations
6949 __Pyx_RefNannyDeclarations
6950 PyObject *__pyx_t_1 = NULL;
6951 int __pyx_t_2;
6952 int __pyx_t_3;
6953 char const *__pyx_t_4;
6954 char const *__pyx_t_5;
6955 char const *__pyx_t_6;
6956 PyObject *__pyx_t_7 = NULL;
6957 int __pyx_lineno = 0;
6958 const char *__pyx_filename = NULL;
6959 int __pyx_clineno = 0;
6960 __Pyx_RefNannySetupContext("_open", 0);
6961 __Pyx_TraceCall("_open", __pyx_f[0], 81, 0, __PYX_ERR(0, 81, __pyx_L1_error));
6962 if (__pyx_optional_args) {
6963 }
6964 __Pyx_INCREF(__pyx_v_name);
6965 __Pyx_INCREF(__pyx_v_mode);
6966
6967 /* "pysam/libchtslib.pyx":82
6968 *
6969 * cdef _open(self, name, mode, closefd=True):
6970 * self.name = name # <<<<<<<<<<<<<<
6971 * self.mode = mode
6972 *
6973 */
6974 __Pyx_INCREF(__pyx_v_name);
6975 __Pyx_GIVEREF(__pyx_v_name);
6976 __Pyx_GOTREF(__pyx_v_self->name);
6977 __Pyx_DECREF(__pyx_v_self->name);
6978 __pyx_v_self->name = __pyx_v_name;
6979
6980 /* "pysam/libchtslib.pyx":83
6981 * cdef _open(self, name, mode, closefd=True):
6982 * self.name = name
6983 * self.mode = mode # <<<<<<<<<<<<<<
6984 *
6985 * mode = force_bytes(mode)
6986 */
6987 __Pyx_INCREF(__pyx_v_mode);
6988 __Pyx_GIVEREF(__pyx_v_mode);
6989 __Pyx_GOTREF(__pyx_v_self->mode);
6990 __Pyx_DECREF(__pyx_v_self->mode);
6991 __pyx_v_self->mode = __pyx_v_mode;
6992
6993 /* "pysam/libchtslib.pyx":85
6994 * self.mode = mode
6995 *
6996 * mode = force_bytes(mode) # <<<<<<<<<<<<<<
6997 *
6998 * if isinstance(name, int):
6999 */
7000 __pyx_t_1 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_v_mode, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 85, __pyx_L1_error)
7001 __Pyx_GOTREF(__pyx_t_1);
7002 __Pyx_DECREF_SET(__pyx_v_mode, __pyx_t_1);
7003 __pyx_t_1 = 0;
7004
7005 /* "pysam/libchtslib.pyx":87
7006 * mode = force_bytes(mode)
7007 *
7008 * if isinstance(name, int): # <<<<<<<<<<<<<<
7009 * if self.fp != NULL:
7010 * name = dup(name)
7011 */
7012 __pyx_t_2 = PyInt_Check(__pyx_v_name);
7013 if (__pyx_t_2) {
7014
7015 /* "pysam/libchtslib.pyx":88
7016 *
7017 * if isinstance(name, int):
7018 * if self.fp != NULL: # <<<<<<<<<<<<<<
7019 * name = dup(name)
7020 * self.fp = hdopen(name, mode)
7021 */
7022 __pyx_t_2 = (__pyx_v_self->fp != NULL);
7023 if (__pyx_t_2) {
7024
7025 /* "pysam/libchtslib.pyx":89
7026 * if isinstance(name, int):
7027 * if self.fp != NULL:
7028 * name = dup(name) # <<<<<<<<<<<<<<
7029 * self.fp = hdopen(name, mode)
7030 * else:
7031 */
7032 __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_v_name); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 89, __pyx_L1_error)
7033 __pyx_t_1 = __Pyx_PyInt_From_int(dup(__pyx_t_3)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 89, __pyx_L1_error)
7034 __Pyx_GOTREF(__pyx_t_1);
7035 __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_1);
7036 __pyx_t_1 = 0;
7037
7038 /* "pysam/libchtslib.pyx":88
7039 *
7040 * if isinstance(name, int):
7041 * if self.fp != NULL: # <<<<<<<<<<<<<<
7042 * name = dup(name)
7043 * self.fp = hdopen(name, mode)
7044 */
7045 }
7046
7047 /* "pysam/libchtslib.pyx":90
7048 * if self.fp != NULL:
7049 * name = dup(name)
7050 * self.fp = hdopen(name, mode) # <<<<<<<<<<<<<<
7051 * else:
7052 * name = encode_filename(name)
7053 */
7054 __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_v_name); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 90, __pyx_L1_error)
7055 __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_v_mode); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 90, __pyx_L1_error)
7056 __pyx_v_self->fp = hdopen(__pyx_t_3, __pyx_t_4);
7057
7058 /* "pysam/libchtslib.pyx":87
7059 * mode = force_bytes(mode)
7060 *
7061 * if isinstance(name, int): # <<<<<<<<<<<<<<
7062 * if self.fp != NULL:
7063 * name = dup(name)
7064 */
7065 goto __pyx_L3;
7066 }
7067
7068 /* "pysam/libchtslib.pyx":92
7069 * self.fp = hdopen(name, mode)
7070 * else:
7071 * name = encode_filename(name) # <<<<<<<<<<<<<<
7072 * self.fp = hopen(name, mode)
7073 *
7074 */
7075 /*else*/ {
7076 __pyx_t_1 = __pyx_f_5pysam_9libcutils_encode_filename(__pyx_v_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 92, __pyx_L1_error)
7077 __Pyx_GOTREF(__pyx_t_1);
7078 __Pyx_DECREF_SET(__pyx_v_name, __pyx_t_1);
7079 __pyx_t_1 = 0;
7080
7081 /* "pysam/libchtslib.pyx":93
7082 * else:
7083 * name = encode_filename(name)
7084 * self.fp = hopen(name, mode) # <<<<<<<<<<<<<<
7085 *
7086 * if not self.fp:
7087 */
7088 __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_v_name); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 93, __pyx_L1_error)
7089 __pyx_t_6 = __Pyx_PyObject_AsString(__pyx_v_mode); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 93, __pyx_L1_error)
7090 __pyx_v_self->fp = hopen(__pyx_t_5, __pyx_t_6);
7091 }
7092 __pyx_L3:;
7093
7094 /* "pysam/libchtslib.pyx":95
7095 * self.fp = hopen(name, mode)
7096 *
7097 * if not self.fp: # <<<<<<<<<<<<<<
7098 * raise IOError(errno, 'failed to open HFile', self.name)
7099 *
7100 */
7101 __pyx_t_2 = (!(__pyx_v_self->fp != 0));
7102 if (unlikely(__pyx_t_2)) {
7103
7104 /* "pysam/libchtslib.pyx":96
7105 *
7106 * if not self.fp:
7107 * raise IOError(errno, 'failed to open HFile', self.name) # <<<<<<<<<<<<<<
7108 *
7109 * def close(self):
7110 */
7111 __pyx_t_1 = __Pyx_PyInt_From_int(errno); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 96, __pyx_L1_error)
7112 __Pyx_GOTREF(__pyx_t_1);
7113 __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 96, __pyx_L1_error)
7114 __Pyx_GOTREF(__pyx_t_7);
7115 __Pyx_GIVEREF(__pyx_t_1);
7116 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1)) __PYX_ERR(0, 96, __pyx_L1_error);
7117 __Pyx_INCREF(__pyx_kp_u_failed_to_open_HFile);
7118 __Pyx_GIVEREF(__pyx_kp_u_failed_to_open_HFile);
7119 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_kp_u_failed_to_open_HFile)) __PYX_ERR(0, 96, __pyx_L1_error);
7120 __Pyx_INCREF(__pyx_v_self->name);
7121 __Pyx_GIVEREF(__pyx_v_self->name);
7122 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_v_self->name)) __PYX_ERR(0, 96, __pyx_L1_error);
7123 __pyx_t_1 = 0;
7124 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 96, __pyx_L1_error)
7125 __Pyx_GOTREF(__pyx_t_1);
7126 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7127 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
7128 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7129 __PYX_ERR(0, 96, __pyx_L1_error)
7130
7131 /* "pysam/libchtslib.pyx":95
7132 * self.fp = hopen(name, mode)
7133 *
7134 * if not self.fp: # <<<<<<<<<<<<<<
7135 * raise IOError(errno, 'failed to open HFile', self.name)
7136 *
7137 */
7138 }
7139
7140 /* "pysam/libchtslib.pyx":81
7141 * return self.fp == NULL
7142 *
7143 * cdef _open(self, name, mode, closefd=True): # <<<<<<<<<<<<<<
7144 * self.name = name
7145 * self.mode = mode
7146 */
7147
7148 /* function exit code */
7149 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7150 goto __pyx_L0;
7151 __pyx_L1_error:;
7152 __Pyx_XDECREF(__pyx_t_1);
7153 __Pyx_XDECREF(__pyx_t_7);
7154 __Pyx_AddTraceback("pysam.libchtslib.HFile._open", __pyx_clineno, __pyx_lineno, __pyx_filename);
7155 __pyx_r = 0;
7156 __pyx_L0:;
7157 __Pyx_XDECREF(__pyx_v_name);
7158 __Pyx_XDECREF(__pyx_v_mode);
7159 __Pyx_XGIVEREF(__pyx_r);
7160 __Pyx_TraceReturn(__pyx_r, 0);
7161 __Pyx_RefNannyFinishContext();
7162 return __pyx_r;
7163 }
7164
7165 /* "pysam/libchtslib.pyx":98
7166 * raise IOError(errno, 'failed to open HFile', self.name)
7167 *
7168 * def close(self): # <<<<<<<<<<<<<<
7169 * if self.fp == NULL:
7170 * return
7171 */
7172
7173 /* Python wrapper */
7174 static PyObject *__pyx_pw_5pysam_10libchtslib_5HFile_5close(PyObject *__pyx_v_self,
7175 #if CYTHON_METH_FASTCALL
7176 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
7177 #else
7178 PyObject *__pyx_args, PyObject *__pyx_kwds
7179 #endif
7180 ); /*proto*/
7181 PyDoc_STRVAR(__pyx_doc_5pysam_10libchtslib_5HFile_4close, "HFile.close(self)");
7182 static PyMethodDef __pyx_mdef_5pysam_10libchtslib_5HFile_5close = {"close", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_5HFile_5close, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_5HFile_4close};
7183 static PyObject *__pyx_pw_5pysam_10libchtslib_5HFile_5close(PyObject *__pyx_v_self,
7184 #if CYTHON_METH_FASTCALL
7185 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
7186 #else
7187 PyObject *__pyx_args, PyObject *__pyx_kwds
7188 #endif
7189 ) {
7190 #if !CYTHON_METH_FASTCALL
7191 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
7192 #endif
7193 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
7194 PyObject *__pyx_r = 0;
7195 __Pyx_RefNannyDeclarations
7196 __Pyx_RefNannySetupContext("close (wrapper)", 0);
7197 #if !CYTHON_METH_FASTCALL
7198 #if CYTHON_ASSUME_SAFE_MACROS
7199 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
7200 #else
7201 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
7202 #endif
7203 #endif
7204 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
7205 if (unlikely(__pyx_nargs > 0)) {
7206 __Pyx_RaiseArgtupleInvalid("close", 1, 0, 0, __pyx_nargs); return NULL;}
7207 if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "close", 0))) return NULL;
7208 __pyx_r = __pyx_pf_5pysam_10libchtslib_5HFile_4close(((struct __pyx_obj_5pysam_10libchtslib_HFile *)__pyx_v_self));
7209
7210 /* function exit code */
7211 __Pyx_RefNannyFinishContext();
7212 return __pyx_r;
7213 }
7214
7215 static PyObject *__pyx_pf_5pysam_10libchtslib_5HFile_4close(struct __pyx_obj_5pysam_10libchtslib_HFile *__pyx_v_self) {
7216 hFILE *__pyx_v_fp;
7217 PyObject *__pyx_r = NULL;
7218 __Pyx_TraceDeclarations
7219 __Pyx_RefNannyDeclarations
7220 int __pyx_t_1;
7221 hFILE *__pyx_t_2;
7222 PyObject *__pyx_t_3 = NULL;
7223 PyObject *__pyx_t_4 = NULL;
7224 int __pyx_lineno = 0;
7225 const char *__pyx_filename = NULL;
7226 int __pyx_clineno = 0;
7227 __Pyx_TraceFrameInit(__pyx_codeobj__3)
7228 __Pyx_RefNannySetupContext("close", 1);
7229 __Pyx_TraceCall("close", __pyx_f[0], 98, 0, __PYX_ERR(0, 98, __pyx_L1_error));
7230
7231 /* "pysam/libchtslib.pyx":99
7232 *
7233 * def close(self):
7234 * if self.fp == NULL: # <<<<<<<<<<<<<<
7235 * return
7236 *
7237 */
7238 __pyx_t_1 = (__pyx_v_self->fp == NULL);
7239 if (__pyx_t_1) {
7240
7241 /* "pysam/libchtslib.pyx":100
7242 * def close(self):
7243 * if self.fp == NULL:
7244 * return # <<<<<<<<<<<<<<
7245 *
7246 * cdef hFILE *fp = self.fp
7247 */
7248 __Pyx_XDECREF(__pyx_r);
7249 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7250 goto __pyx_L0;
7251
7252 /* "pysam/libchtslib.pyx":99
7253 *
7254 * def close(self):
7255 * if self.fp == NULL: # <<<<<<<<<<<<<<
7256 * return
7257 *
7258 */
7259 }
7260
7261 /* "pysam/libchtslib.pyx":102
7262 * return
7263 *
7264 * cdef hFILE *fp = self.fp # <<<<<<<<<<<<<<
7265 * self.fp = NULL
7266 *
7267 */
7268 __pyx_t_2 = __pyx_v_self->fp;
7269 __pyx_v_fp = __pyx_t_2;
7270
7271 /* "pysam/libchtslib.pyx":103
7272 *
7273 * cdef hFILE *fp = self.fp
7274 * self.fp = NULL # <<<<<<<<<<<<<<
7275 *
7276 * if hclose(fp) != 0:
7277 */
7278 __pyx_v_self->fp = NULL;
7279
7280 /* "pysam/libchtslib.pyx":105
7281 * self.fp = NULL
7282 *
7283 * if hclose(fp) != 0: # <<<<<<<<<<<<<<
7284 * raise IOError(errno, 'failed to close HFile', self.name)
7285 *
7286 */
7287 __pyx_t_1 = (hclose(__pyx_v_fp) != 0);
7288 if (unlikely(__pyx_t_1)) {
7289
7290 /* "pysam/libchtslib.pyx":106
7291 *
7292 * if hclose(fp) != 0:
7293 * raise IOError(errno, 'failed to close HFile', self.name) # <<<<<<<<<<<<<<
7294 *
7295 * def fileno(self):
7296 */
7297 __pyx_t_3 = __Pyx_PyInt_From_int(errno); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 106, __pyx_L1_error)
7298 __Pyx_GOTREF(__pyx_t_3);
7299 __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 106, __pyx_L1_error)
7300 __Pyx_GOTREF(__pyx_t_4);
7301 __Pyx_GIVEREF(__pyx_t_3);
7302 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3)) __PYX_ERR(0, 106, __pyx_L1_error);
7303 __Pyx_INCREF(__pyx_kp_u_failed_to_close_HFile);
7304 __Pyx_GIVEREF(__pyx_kp_u_failed_to_close_HFile);
7305 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_kp_u_failed_to_close_HFile)) __PYX_ERR(0, 106, __pyx_L1_error);
7306 __Pyx_INCREF(__pyx_v_self->name);
7307 __Pyx_GIVEREF(__pyx_v_self->name);
7308 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_self->name)) __PYX_ERR(0, 106, __pyx_L1_error);
7309 __pyx_t_3 = 0;
7310 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 106, __pyx_L1_error)
7311 __Pyx_GOTREF(__pyx_t_3);
7312 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7313 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
7314 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7315 __PYX_ERR(0, 106, __pyx_L1_error)
7316
7317 /* "pysam/libchtslib.pyx":105
7318 * self.fp = NULL
7319 *
7320 * if hclose(fp) != 0: # <<<<<<<<<<<<<<
7321 * raise IOError(errno, 'failed to close HFile', self.name)
7322 *
7323 */
7324 }
7325
7326 /* "pysam/libchtslib.pyx":98
7327 * raise IOError(errno, 'failed to open HFile', self.name)
7328 *
7329 * def close(self): # <<<<<<<<<<<<<<
7330 * if self.fp == NULL:
7331 * return
7332 */
7333
7334 /* function exit code */
7335 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7336 goto __pyx_L0;
7337 __pyx_L1_error:;
7338 __Pyx_XDECREF(__pyx_t_3);
7339 __Pyx_XDECREF(__pyx_t_4);
7340 __Pyx_AddTraceback("pysam.libchtslib.HFile.close", __pyx_clineno, __pyx_lineno, __pyx_filename);
7341 __pyx_r = NULL;
7342 __pyx_L0:;
7343 __Pyx_XGIVEREF(__pyx_r);
7344 __Pyx_TraceReturn(__pyx_r, 0);
7345 __Pyx_RefNannyFinishContext();
7346 return __pyx_r;
7347 }
7348
7349 /* "pysam/libchtslib.pyx":108
7350 * raise IOError(errno, 'failed to close HFile', self.name)
7351 *
7352 * def fileno(self): # <<<<<<<<<<<<<<
7353 * if self.fp == NULL:
7354 * raise IOError('operation on closed HFile')
7355 */
7356
7357 /* Python wrapper */
7358 static PyObject *__pyx_pw_5pysam_10libchtslib_5HFile_7fileno(PyObject *__pyx_v_self,
7359 #if CYTHON_METH_FASTCALL
7360 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
7361 #else
7362 PyObject *__pyx_args, PyObject *__pyx_kwds
7363 #endif
7364 ); /*proto*/
7365 PyDoc_STRVAR(__pyx_doc_5pysam_10libchtslib_5HFile_6fileno, "HFile.fileno(self)");
7366 static PyMethodDef __pyx_mdef_5pysam_10libchtslib_5HFile_7fileno = {"fileno", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_5HFile_7fileno, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_5HFile_6fileno};
7367 static PyObject *__pyx_pw_5pysam_10libchtslib_5HFile_7fileno(PyObject *__pyx_v_self,
7368 #if CYTHON_METH_FASTCALL
7369 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
7370 #else
7371 PyObject *__pyx_args, PyObject *__pyx_kwds
7372 #endif
7373 ) {
7374 #if !CYTHON_METH_FASTCALL
7375 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
7376 #endif
7377 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
7378 PyObject *__pyx_r = 0;
7379 __Pyx_RefNannyDeclarations
7380 __Pyx_RefNannySetupContext("fileno (wrapper)", 0);
7381 #if !CYTHON_METH_FASTCALL
7382 #if CYTHON_ASSUME_SAFE_MACROS
7383 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
7384 #else
7385 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
7386 #endif
7387 #endif
7388 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
7389 if (unlikely(__pyx_nargs > 0)) {
7390 __Pyx_RaiseArgtupleInvalid("fileno", 1, 0, 0, __pyx_nargs); return NULL;}
7391 if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "fileno", 0))) return NULL;
7392 __pyx_r = __pyx_pf_5pysam_10libchtslib_5HFile_6fileno(((struct __pyx_obj_5pysam_10libchtslib_HFile *)__pyx_v_self));
7393
7394 /* function exit code */
7395 __Pyx_RefNannyFinishContext();
7396 return __pyx_r;
7397 }
7398
7399 static PyObject *__pyx_pf_5pysam_10libchtslib_5HFile_6fileno(struct __pyx_obj_5pysam_10libchtslib_HFile *__pyx_v_self) {
7400 PyObject *__pyx_r = NULL;
7401 __Pyx_TraceDeclarations
7402 __Pyx_RefNannyDeclarations
7403 int __pyx_t_1;
7404 PyObject *__pyx_t_2 = NULL;
7405 int __pyx_lineno = 0;
7406 const char *__pyx_filename = NULL;
7407 int __pyx_clineno = 0;
7408 __Pyx_TraceFrameInit(__pyx_codeobj__4)
7409 __Pyx_RefNannySetupContext("fileno", 1);
7410 __Pyx_TraceCall("fileno", __pyx_f[0], 108, 0, __PYX_ERR(0, 108, __pyx_L1_error));
7411
7412 /* "pysam/libchtslib.pyx":109
7413 *
7414 * def fileno(self):
7415 * if self.fp == NULL: # <<<<<<<<<<<<<<
7416 * raise IOError('operation on closed HFile')
7417 * if isinstance(self.name, int):
7418 */
7419 __pyx_t_1 = (__pyx_v_self->fp == NULL);
7420 if (unlikely(__pyx_t_1)) {
7421
7422 /* "pysam/libchtslib.pyx":110
7423 * def fileno(self):
7424 * if self.fp == NULL:
7425 * raise IOError('operation on closed HFile') # <<<<<<<<<<<<<<
7426 * if isinstance(self.name, int):
7427 * return self.name
7428 */
7429 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 110, __pyx_L1_error)
7430 __Pyx_GOTREF(__pyx_t_2);
7431 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
7432 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7433 __PYX_ERR(0, 110, __pyx_L1_error)
7434
7435 /* "pysam/libchtslib.pyx":109
7436 *
7437 * def fileno(self):
7438 * if self.fp == NULL: # <<<<<<<<<<<<<<
7439 * raise IOError('operation on closed HFile')
7440 * if isinstance(self.name, int):
7441 */
7442 }
7443
7444 /* "pysam/libchtslib.pyx":111
7445 * if self.fp == NULL:
7446 * raise IOError('operation on closed HFile')
7447 * if isinstance(self.name, int): # <<<<<<<<<<<<<<
7448 * return self.name
7449 * else:
7450 */
7451 __pyx_t_2 = __pyx_v_self->name;
7452 __Pyx_INCREF(__pyx_t_2);
7453 __pyx_t_1 = PyInt_Check(__pyx_t_2);
7454 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7455 if (likely(__pyx_t_1)) {
7456
7457 /* "pysam/libchtslib.pyx":112
7458 * raise IOError('operation on closed HFile')
7459 * if isinstance(self.name, int):
7460 * return self.name # <<<<<<<<<<<<<<
7461 * else:
7462 * raise AttributeError('fileno not available')
7463 */
7464 __Pyx_XDECREF(__pyx_r);
7465 __Pyx_INCREF(__pyx_v_self->name);
7466 __pyx_r = __pyx_v_self->name;
7467 goto __pyx_L0;
7468
7469 /* "pysam/libchtslib.pyx":111
7470 * if self.fp == NULL:
7471 * raise IOError('operation on closed HFile')
7472 * if isinstance(self.name, int): # <<<<<<<<<<<<<<
7473 * return self.name
7474 * else:
7475 */
7476 }
7477
7478 /* "pysam/libchtslib.pyx":114
7479 * return self.name
7480 * else:
7481 * raise AttributeError('fileno not available') # <<<<<<<<<<<<<<
7482 *
7483 * def __enter__(self):
7484 */
7485 /*else*/ {
7486 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_AttributeError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 114, __pyx_L1_error)
7487 __Pyx_GOTREF(__pyx_t_2);
7488 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
7489 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7490 __PYX_ERR(0, 114, __pyx_L1_error)
7491 }
7492
7493 /* "pysam/libchtslib.pyx":108
7494 * raise IOError(errno, 'failed to close HFile', self.name)
7495 *
7496 * def fileno(self): # <<<<<<<<<<<<<<
7497 * if self.fp == NULL:
7498 * raise IOError('operation on closed HFile')
7499 */
7500
7501 /* function exit code */
7502 __pyx_L1_error:;
7503 __Pyx_XDECREF(__pyx_t_2);
7504 __Pyx_AddTraceback("pysam.libchtslib.HFile.fileno", __pyx_clineno, __pyx_lineno, __pyx_filename);
7505 __pyx_r = NULL;
7506 __pyx_L0:;
7507 __Pyx_XGIVEREF(__pyx_r);
7508 __Pyx_TraceReturn(__pyx_r, 0);
7509 __Pyx_RefNannyFinishContext();
7510 return __pyx_r;
7511 }
7512
7513 /* "pysam/libchtslib.pyx":116
7514 * raise AttributeError('fileno not available')
7515 *
7516 * def __enter__(self): # <<<<<<<<<<<<<<
7517 * return self
7518 *
7519 */
7520
7521 /* Python wrapper */
7522 static PyObject *__pyx_pw_5pysam_10libchtslib_5HFile_9__enter__(PyObject *__pyx_v_self,
7523 #if CYTHON_METH_FASTCALL
7524 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
7525 #else
7526 PyObject *__pyx_args, PyObject *__pyx_kwds
7527 #endif
7528 ); /*proto*/
7529 PyDoc_STRVAR(__pyx_doc_5pysam_10libchtslib_5HFile_8__enter__, "HFile.__enter__(self)");
7530 static PyMethodDef __pyx_mdef_5pysam_10libchtslib_5HFile_9__enter__ = {"__enter__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_5HFile_9__enter__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_5HFile_8__enter__};
7531 static PyObject *__pyx_pw_5pysam_10libchtslib_5HFile_9__enter__(PyObject *__pyx_v_self,
7532 #if CYTHON_METH_FASTCALL
7533 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
7534 #else
7535 PyObject *__pyx_args, PyObject *__pyx_kwds
7536 #endif
7537 ) {
7538 #if !CYTHON_METH_FASTCALL
7539 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
7540 #endif
7541 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
7542 PyObject *__pyx_r = 0;
7543 __Pyx_RefNannyDeclarations
7544 __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0);
7545 #if !CYTHON_METH_FASTCALL
7546 #if CYTHON_ASSUME_SAFE_MACROS
7547 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
7548 #else
7549 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
7550 #endif
7551 #endif
7552 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
7553 if (unlikely(__pyx_nargs > 0)) {
7554 __Pyx_RaiseArgtupleInvalid("__enter__", 1, 0, 0, __pyx_nargs); return NULL;}
7555 if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__enter__", 0))) return NULL;
7556 __pyx_r = __pyx_pf_5pysam_10libchtslib_5HFile_8__enter__(((struct __pyx_obj_5pysam_10libchtslib_HFile *)__pyx_v_self));
7557
7558 /* function exit code */
7559 __Pyx_RefNannyFinishContext();
7560 return __pyx_r;
7561 }
7562
7563 static PyObject *__pyx_pf_5pysam_10libchtslib_5HFile_8__enter__(struct __pyx_obj_5pysam_10libchtslib_HFile *__pyx_v_self) {
7564 PyObject *__pyx_r = NULL;
7565 __Pyx_TraceDeclarations
7566 __Pyx_RefNannyDeclarations
7567 int __pyx_lineno = 0;
7568 const char *__pyx_filename = NULL;
7569 int __pyx_clineno = 0;
7570 __Pyx_TraceFrameInit(__pyx_codeobj__7)
7571 __Pyx_RefNannySetupContext("__enter__", 1);
7572 __Pyx_TraceCall("__enter__", __pyx_f[0], 116, 0, __PYX_ERR(0, 116, __pyx_L1_error));
7573
7574 /* "pysam/libchtslib.pyx":117
7575 *
7576 * def __enter__(self):
7577 * return self # <<<<<<<<<<<<<<
7578 *
7579 * def __exit__(self, type, value, tb):
7580 */
7581 __Pyx_XDECREF(__pyx_r);
7582 __Pyx_INCREF((PyObject *)__pyx_v_self);
7583 __pyx_r = ((PyObject *)__pyx_v_self);
7584 goto __pyx_L0;
7585
7586 /* "pysam/libchtslib.pyx":116
7587 * raise AttributeError('fileno not available')
7588 *
7589 * def __enter__(self): # <<<<<<<<<<<<<<
7590 * return self
7591 *
7592 */
7593
7594 /* function exit code */
7595 __pyx_L1_error:;
7596 __Pyx_AddTraceback("pysam.libchtslib.HFile.__enter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7597 __pyx_r = NULL;
7598 __pyx_L0:;
7599 __Pyx_XGIVEREF(__pyx_r);
7600 __Pyx_TraceReturn(__pyx_r, 0);
7601 __Pyx_RefNannyFinishContext();
7602 return __pyx_r;
7603 }
7604
7605 /* "pysam/libchtslib.pyx":119
7606 * return self
7607 *
7608 * def __exit__(self, type, value, tb): # <<<<<<<<<<<<<<
7609 * self.close()
7610 *
7611 */
7612
7613 /* Python wrapper */
7614 static PyObject *__pyx_pw_5pysam_10libchtslib_5HFile_11__exit__(PyObject *__pyx_v_self,
7615 #if CYTHON_METH_FASTCALL
7616 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
7617 #else
7618 PyObject *__pyx_args, PyObject *__pyx_kwds
7619 #endif
7620 ); /*proto*/
7621 PyDoc_STRVAR(__pyx_doc_5pysam_10libchtslib_5HFile_10__exit__, "HFile.__exit__(self, type, value, tb)");
7622 static PyMethodDef __pyx_mdef_5pysam_10libchtslib_5HFile_11__exit__ = {"__exit__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_5HFile_11__exit__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_5HFile_10__exit__};
7623 static PyObject *__pyx_pw_5pysam_10libchtslib_5HFile_11__exit__(PyObject *__pyx_v_self,
7624 #if CYTHON_METH_FASTCALL
7625 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
7626 #else
7627 PyObject *__pyx_args, PyObject *__pyx_kwds
7628 #endif
7629 ) {
7630 CYTHON_UNUSED PyObject *__pyx_v_type = 0;
7631 CYTHON_UNUSED PyObject *__pyx_v_value = 0;
7632 CYTHON_UNUSED PyObject *__pyx_v_tb = 0;
7633 #if !CYTHON_METH_FASTCALL
7634 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
7635 #endif
7636 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
7637 PyObject* values[3] = {0,0,0};
7638 int __pyx_lineno = 0;
7639 const char *__pyx_filename = NULL;
7640 int __pyx_clineno = 0;
7641 PyObject *__pyx_r = 0;
7642 __Pyx_RefNannyDeclarations
7643 __Pyx_RefNannySetupContext("__exit__ (wrapper)", 0);
7644 #if !CYTHON_METH_FASTCALL
7645 #if CYTHON_ASSUME_SAFE_MACROS
7646 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
7647 #else
7648 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
7649 #endif
7650 #endif
7651 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
7652 {
7653 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_type,&__pyx_n_s_value,&__pyx_n_s_tb,0};
7654 if (__pyx_kwds) {
7655 Py_ssize_t kw_args;
7656 switch (__pyx_nargs) {
7657 case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
7658 CYTHON_FALLTHROUGH;
7659 case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
7660 CYTHON_FALLTHROUGH;
7661 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
7662 CYTHON_FALLTHROUGH;
7663 case 0: break;
7664 default: goto __pyx_L5_argtuple_error;
7665 }
7666 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
7667 switch (__pyx_nargs) {
7668 case 0:
7669 if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_type)) != 0)) {
7670 (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
7671 kw_args--;
7672 }
7673 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 119, __pyx_L3_error)
7674 else goto __pyx_L5_argtuple_error;
7675 CYTHON_FALLTHROUGH;
7676 case 1:
7677 if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_value)) != 0)) {
7678 (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
7679 kw_args--;
7680 }
7681 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 119, __pyx_L3_error)
7682 else {
7683 __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 1); __PYX_ERR(0, 119, __pyx_L3_error)
7684 }
7685 CYTHON_FALLTHROUGH;
7686 case 2:
7687 if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tb)) != 0)) {
7688 (void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
7689 kw_args--;
7690 }
7691 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 119, __pyx_L3_error)
7692 else {
7693 __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 2); __PYX_ERR(0, 119, __pyx_L3_error)
7694 }
7695 }
7696 if (unlikely(kw_args > 0)) {
7697 const Py_ssize_t kwd_pos_args = __pyx_nargs;
7698 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__exit__") < 0)) __PYX_ERR(0, 119, __pyx_L3_error)
7699 }
7700 } else if (unlikely(__pyx_nargs != 3)) {
7701 goto __pyx_L5_argtuple_error;
7702 } else {
7703 values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
7704 values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
7705 values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
7706 }
7707 __pyx_v_type = values[0];
7708 __pyx_v_value = values[1];
7709 __pyx_v_tb = values[2];
7710 }
7711 goto __pyx_L6_skip;
7712 __pyx_L5_argtuple_error:;
7713 __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 119, __pyx_L3_error)
7714 __pyx_L6_skip:;
7715 goto __pyx_L4_argument_unpacking_done;
7716 __pyx_L3_error:;
7717 {
7718 Py_ssize_t __pyx_temp;
7719 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
7720 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
7721 }
7722 }
7723 __Pyx_AddTraceback("pysam.libchtslib.HFile.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7724 __Pyx_RefNannyFinishContext();
7725 return NULL;
7726 __pyx_L4_argument_unpacking_done:;
7727 __pyx_r = __pyx_pf_5pysam_10libchtslib_5HFile_10__exit__(((struct __pyx_obj_5pysam_10libchtslib_HFile *)__pyx_v_self), __pyx_v_type, __pyx_v_value, __pyx_v_tb);
7728
7729 /* function exit code */
7730 {
7731 Py_ssize_t __pyx_temp;
7732 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
7733 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
7734 }
7735 }
7736 __Pyx_RefNannyFinishContext();
7737 return __pyx_r;
7738 }
7739
7740 static PyObject *__pyx_pf_5pysam_10libchtslib_5HFile_10__exit__(struct __pyx_obj_5pysam_10libchtslib_HFile *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_type, CYTHON_UNUSED PyObject *__pyx_v_value, CYTHON_UNUSED PyObject *__pyx_v_tb) {
7741 PyObject *__pyx_r = NULL;
7742 __Pyx_TraceDeclarations
7743 __Pyx_RefNannyDeclarations
7744 PyObject *__pyx_t_1 = NULL;
7745 PyObject *__pyx_t_2 = NULL;
7746 PyObject *__pyx_t_3 = NULL;
7747 unsigned int __pyx_t_4;
7748 int __pyx_lineno = 0;
7749 const char *__pyx_filename = NULL;
7750 int __pyx_clineno = 0;
7751 __Pyx_TraceFrameInit(__pyx_codeobj__8)
7752 __Pyx_RefNannySetupContext("__exit__", 1);
7753 __Pyx_TraceCall("__exit__", __pyx_f[0], 119, 0, __PYX_ERR(0, 119, __pyx_L1_error));
7754
7755 /* "pysam/libchtslib.pyx":120
7756 *
7757 * def __exit__(self, type, value, tb):
7758 * self.close() # <<<<<<<<<<<<<<
7759 *
7760 * def __iter__(self):
7761 */
7762 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_close); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 120, __pyx_L1_error)
7763 __Pyx_GOTREF(__pyx_t_2);
7764 __pyx_t_3 = NULL;
7765 __pyx_t_4 = 0;
7766 #if CYTHON_UNPACK_METHODS
7767 if (likely(PyMethod_Check(__pyx_t_2))) {
7768 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
7769 if (likely(__pyx_t_3)) {
7770 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
7771 __Pyx_INCREF(__pyx_t_3);
7772 __Pyx_INCREF(function);
7773 __Pyx_DECREF_SET(__pyx_t_2, function);
7774 __pyx_t_4 = 1;
7775 }
7776 }
7777 #endif
7778 {
7779 PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
7780 __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
7781 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
7782 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 120, __pyx_L1_error)
7783 __Pyx_GOTREF(__pyx_t_1);
7784 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7785 }
7786 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7787
7788 /* "pysam/libchtslib.pyx":119
7789 * return self
7790 *
7791 * def __exit__(self, type, value, tb): # <<<<<<<<<<<<<<
7792 * self.close()
7793 *
7794 */
7795
7796 /* function exit code */
7797 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7798 goto __pyx_L0;
7799 __pyx_L1_error:;
7800 __Pyx_XDECREF(__pyx_t_1);
7801 __Pyx_XDECREF(__pyx_t_2);
7802 __Pyx_XDECREF(__pyx_t_3);
7803 __Pyx_AddTraceback("pysam.libchtslib.HFile.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7804 __pyx_r = NULL;
7805 __pyx_L0:;
7806 __Pyx_XGIVEREF(__pyx_r);
7807 __Pyx_TraceReturn(__pyx_r, 0);
7808 __Pyx_RefNannyFinishContext();
7809 return __pyx_r;
7810 }
7811
7812 /* "pysam/libchtslib.pyx":122
7813 * self.close()
7814 *
7815 * def __iter__(self): # <<<<<<<<<<<<<<
7816 * return self
7817 *
7818 */
7819
7820 /* Python wrapper */
7821 static PyObject *__pyx_pw_5pysam_10libchtslib_5HFile_13__iter__(PyObject *__pyx_v_self); /*proto*/
7822 static PyObject *__pyx_pw_5pysam_10libchtslib_5HFile_13__iter__(PyObject *__pyx_v_self) {
7823 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
7824 PyObject *__pyx_r = 0;
7825 __Pyx_RefNannyDeclarations
7826 __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
7827 __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
7828 __pyx_r = __pyx_pf_5pysam_10libchtslib_5HFile_12__iter__(((struct __pyx_obj_5pysam_10libchtslib_HFile *)__pyx_v_self));
7829
7830 /* function exit code */
7831 __Pyx_RefNannyFinishContext();
7832 return __pyx_r;
7833 }
7834
7835 static PyObject *__pyx_pf_5pysam_10libchtslib_5HFile_12__iter__(struct __pyx_obj_5pysam_10libchtslib_HFile *__pyx_v_self) {
7836 PyObject *__pyx_r = NULL;
7837 __Pyx_TraceDeclarations
7838 __Pyx_RefNannyDeclarations
7839 int __pyx_lineno = 0;
7840 const char *__pyx_filename = NULL;
7841 int __pyx_clineno = 0;
7842 __Pyx_RefNannySetupContext("__iter__", 1);
7843 __Pyx_TraceCall("__iter__", __pyx_f[0], 122, 0, __PYX_ERR(0, 122, __pyx_L1_error));
7844
7845 /* "pysam/libchtslib.pyx":123
7846 *
7847 * def __iter__(self):
7848 * return self # <<<<<<<<<<<<<<
7849 *
7850 * def __next__(self):
7851 */
7852 __Pyx_XDECREF(__pyx_r);
7853 __Pyx_INCREF((PyObject *)__pyx_v_self);
7854 __pyx_r = ((PyObject *)__pyx_v_self);
7855 goto __pyx_L0;
7856
7857 /* "pysam/libchtslib.pyx":122
7858 * self.close()
7859 *
7860 * def __iter__(self): # <<<<<<<<<<<<<<
7861 * return self
7862 *
7863 */
7864
7865 /* function exit code */
7866 __pyx_L1_error:;
7867 __Pyx_AddTraceback("pysam.libchtslib.HFile.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7868 __pyx_r = NULL;
7869 __pyx_L0:;
7870 __Pyx_XGIVEREF(__pyx_r);
7871 __Pyx_TraceReturn(__pyx_r, 0);
7872 __Pyx_RefNannyFinishContext();
7873 return __pyx_r;
7874 }
7875
7876 /* "pysam/libchtslib.pyx":125
7877 * return self
7878 *
7879 * def __next__(self): # <<<<<<<<<<<<<<
7880 * line = self.readline()
7881 * if not line:
7882 */
7883
7884 /* Python wrapper */
7885 static PyObject *__pyx_pw_5pysam_10libchtslib_5HFile_15__next__(PyObject *__pyx_v_self); /*proto*/
7886 static PyObject *__pyx_pw_5pysam_10libchtslib_5HFile_15__next__(PyObject *__pyx_v_self) {
7887 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
7888 PyObject *__pyx_r = 0;
7889 __Pyx_RefNannyDeclarations
7890 __Pyx_RefNannySetupContext("__next__ (wrapper)", 0);
7891 __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
7892 __pyx_r = __pyx_pf_5pysam_10libchtslib_5HFile_14__next__(((struct __pyx_obj_5pysam_10libchtslib_HFile *)__pyx_v_self));
7893
7894 /* function exit code */
7895 __Pyx_RefNannyFinishContext();
7896 return __pyx_r;
7897 }
7898
7899 static PyObject *__pyx_pf_5pysam_10libchtslib_5HFile_14__next__(struct __pyx_obj_5pysam_10libchtslib_HFile *__pyx_v_self) {
7900 PyObject *__pyx_v_line = NULL;
7901 PyObject *__pyx_r = NULL;
7902 __Pyx_TraceDeclarations
7903 __Pyx_RefNannyDeclarations
7904 int __pyx_error_without_exception = 0; /* StopIteration */
7905 PyObject *__pyx_t_1 = NULL;
7906 PyObject *__pyx_t_2 = NULL;
7907 PyObject *__pyx_t_3 = NULL;
7908 unsigned int __pyx_t_4;
7909 int __pyx_t_5;
7910 int __pyx_t_6;
7911 int __pyx_lineno = 0;
7912 const char *__pyx_filename = NULL;
7913 int __pyx_clineno = 0;
7914 __Pyx_RefNannySetupContext("__next__", 1);
7915 __Pyx_TraceCall("__next__", __pyx_f[0], 125, 0, __PYX_ERR(0, 125, __pyx_L1_error));
7916
7917 /* "pysam/libchtslib.pyx":126
7918 *
7919 * def __next__(self):
7920 * line = self.readline() # <<<<<<<<<<<<<<
7921 * if not line:
7922 * raise StopIteration()
7923 */
7924 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_readline); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 126, __pyx_L1_error)
7925 __Pyx_GOTREF(__pyx_t_2);
7926 __pyx_t_3 = NULL;
7927 __pyx_t_4 = 0;
7928 #if CYTHON_UNPACK_METHODS
7929 if (likely(PyMethod_Check(__pyx_t_2))) {
7930 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
7931 if (likely(__pyx_t_3)) {
7932 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
7933 __Pyx_INCREF(__pyx_t_3);
7934 __Pyx_INCREF(function);
7935 __Pyx_DECREF_SET(__pyx_t_2, function);
7936 __pyx_t_4 = 1;
7937 }
7938 }
7939 #endif
7940 {
7941 PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
7942 __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
7943 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
7944 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 126, __pyx_L1_error)
7945 __Pyx_GOTREF(__pyx_t_1);
7946 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7947 }
7948 __pyx_v_line = __pyx_t_1;
7949 __pyx_t_1 = 0;
7950
7951 /* "pysam/libchtslib.pyx":127
7952 * def __next__(self):
7953 * line = self.readline()
7954 * if not line: # <<<<<<<<<<<<<<
7955 * raise StopIteration()
7956 * return line
7957 */
7958 __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_line); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 127, __pyx_L1_error)
7959 __pyx_t_6 = (!__pyx_t_5);
7960 if (unlikely(__pyx_t_6)) {
7961
7962 /* "pysam/libchtslib.pyx":128
7963 * line = self.readline()
7964 * if not line:
7965 * raise StopIteration() # <<<<<<<<<<<<<<
7966 * return line
7967 *
7968 */
7969 __pyx_error_without_exception = 1;
7970 goto __pyx_L1_error;;
7971
7972 /* "pysam/libchtslib.pyx":127
7973 * def __next__(self):
7974 * line = self.readline()
7975 * if not line: # <<<<<<<<<<<<<<
7976 * raise StopIteration()
7977 * return line
7978 */
7979 }
7980
7981 /* "pysam/libchtslib.pyx":129
7982 * if not line:
7983 * raise StopIteration()
7984 * return line # <<<<<<<<<<<<<<
7985 *
7986 * def flush(self):
7987 */
7988 __Pyx_XDECREF(__pyx_r);
7989 __Pyx_INCREF(__pyx_v_line);
7990 __pyx_r = __pyx_v_line;
7991 goto __pyx_L0;
7992
7993 /* "pysam/libchtslib.pyx":125
7994 * return self
7995 *
7996 * def __next__(self): # <<<<<<<<<<<<<<
7997 * line = self.readline()
7998 * if not line:
7999 */
8000
8001 /* function exit code */
8002 __pyx_L1_error:;
8003 __Pyx_XDECREF(__pyx_t_1);
8004 __Pyx_XDECREF(__pyx_t_2);
8005 __Pyx_XDECREF(__pyx_t_3);
8006 if (!__pyx_error_without_exception) {
8007 __Pyx_AddTraceback("pysam.libchtslib.HFile.__next__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8008 }
8009 __pyx_r = NULL;
8010 __pyx_L0:;
8011 __Pyx_XDECREF(__pyx_v_line);
8012 __Pyx_XGIVEREF(__pyx_r);
8013 __Pyx_TraceReturn(__pyx_r, 0);
8014 __Pyx_RefNannyFinishContext();
8015 return __pyx_r;
8016 }
8017
8018 /* "pysam/libchtslib.pyx":131
8019 * return line
8020 *
8021 * def flush(self): # <<<<<<<<<<<<<<
8022 * if self.fp == NULL:
8023 * raise IOError('operation on closed HFile')
8024 */
8025
8026 /* Python wrapper */
8027 static PyObject *__pyx_pw_5pysam_10libchtslib_5HFile_17flush(PyObject *__pyx_v_self,
8028 #if CYTHON_METH_FASTCALL
8029 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
8030 #else
8031 PyObject *__pyx_args, PyObject *__pyx_kwds
8032 #endif
8033 ); /*proto*/
8034 PyDoc_STRVAR(__pyx_doc_5pysam_10libchtslib_5HFile_16flush, "HFile.flush(self)");
8035 static PyMethodDef __pyx_mdef_5pysam_10libchtslib_5HFile_17flush = {"flush", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_5HFile_17flush, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_5HFile_16flush};
8036 static PyObject *__pyx_pw_5pysam_10libchtslib_5HFile_17flush(PyObject *__pyx_v_self,
8037 #if CYTHON_METH_FASTCALL
8038 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
8039 #else
8040 PyObject *__pyx_args, PyObject *__pyx_kwds
8041 #endif
8042 ) {
8043 #if !CYTHON_METH_FASTCALL
8044 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
8045 #endif
8046 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
8047 PyObject *__pyx_r = 0;
8048 __Pyx_RefNannyDeclarations
8049 __Pyx_RefNannySetupContext("flush (wrapper)", 0);
8050 #if !CYTHON_METH_FASTCALL
8051 #if CYTHON_ASSUME_SAFE_MACROS
8052 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
8053 #else
8054 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
8055 #endif
8056 #endif
8057 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
8058 if (unlikely(__pyx_nargs > 0)) {
8059 __Pyx_RaiseArgtupleInvalid("flush", 1, 0, 0, __pyx_nargs); return NULL;}
8060 if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "flush", 0))) return NULL;
8061 __pyx_r = __pyx_pf_5pysam_10libchtslib_5HFile_16flush(((struct __pyx_obj_5pysam_10libchtslib_HFile *)__pyx_v_self));
8062
8063 /* function exit code */
8064 __Pyx_RefNannyFinishContext();
8065 return __pyx_r;
8066 }
8067
8068 static PyObject *__pyx_pf_5pysam_10libchtslib_5HFile_16flush(struct __pyx_obj_5pysam_10libchtslib_HFile *__pyx_v_self) {
8069 PyObject *__pyx_r = NULL;
8070 __Pyx_TraceDeclarations
8071 __Pyx_RefNannyDeclarations
8072 int __pyx_t_1;
8073 PyObject *__pyx_t_2 = NULL;
8074 PyObject *__pyx_t_3 = NULL;
8075 int __pyx_lineno = 0;
8076 const char *__pyx_filename = NULL;
8077 int __pyx_clineno = 0;
8078 __Pyx_TraceFrameInit(__pyx_codeobj__9)
8079 __Pyx_RefNannySetupContext("flush", 1);
8080 __Pyx_TraceCall("flush", __pyx_f[0], 131, 0, __PYX_ERR(0, 131, __pyx_L1_error));
8081
8082 /* "pysam/libchtslib.pyx":132
8083 *
8084 * def flush(self):
8085 * if self.fp == NULL: # <<<<<<<<<<<<<<
8086 * raise IOError('operation on closed HFile')
8087 * if hflush(self.fp) != 0:
8088 */
8089 __pyx_t_1 = (__pyx_v_self->fp == NULL);
8090 if (unlikely(__pyx_t_1)) {
8091
8092 /* "pysam/libchtslib.pyx":133
8093 * def flush(self):
8094 * if self.fp == NULL:
8095 * raise IOError('operation on closed HFile') # <<<<<<<<<<<<<<
8096 * if hflush(self.fp) != 0:
8097 * raise IOError(herrno(self.fp), 'failed to flush HFile', self.name)
8098 */
8099 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 133, __pyx_L1_error)
8100 __Pyx_GOTREF(__pyx_t_2);
8101 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
8102 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8103 __PYX_ERR(0, 133, __pyx_L1_error)
8104
8105 /* "pysam/libchtslib.pyx":132
8106 *
8107 * def flush(self):
8108 * if self.fp == NULL: # <<<<<<<<<<<<<<
8109 * raise IOError('operation on closed HFile')
8110 * if hflush(self.fp) != 0:
8111 */
8112 }
8113
8114 /* "pysam/libchtslib.pyx":134
8115 * if self.fp == NULL:
8116 * raise IOError('operation on closed HFile')
8117 * if hflush(self.fp) != 0: # <<<<<<<<<<<<<<
8118 * raise IOError(herrno(self.fp), 'failed to flush HFile', self.name)
8119 *
8120 */
8121 __pyx_t_1 = (hflush(__pyx_v_self->fp) != 0);
8122 if (unlikely(__pyx_t_1)) {
8123
8124 /* "pysam/libchtslib.pyx":135
8125 * raise IOError('operation on closed HFile')
8126 * if hflush(self.fp) != 0:
8127 * raise IOError(herrno(self.fp), 'failed to flush HFile', self.name) # <<<<<<<<<<<<<<
8128 *
8129 * def isatty(self):
8130 */
8131 __pyx_t_2 = __Pyx_PyInt_From_int(herrno(__pyx_v_self->fp)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 135, __pyx_L1_error)
8132 __Pyx_GOTREF(__pyx_t_2);
8133 __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 135, __pyx_L1_error)
8134 __Pyx_GOTREF(__pyx_t_3);
8135 __Pyx_GIVEREF(__pyx_t_2);
8136 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2)) __PYX_ERR(0, 135, __pyx_L1_error);
8137 __Pyx_INCREF(__pyx_kp_u_failed_to_flush_HFile);
8138 __Pyx_GIVEREF(__pyx_kp_u_failed_to_flush_HFile);
8139 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_kp_u_failed_to_flush_HFile)) __PYX_ERR(0, 135, __pyx_L1_error);
8140 __Pyx_INCREF(__pyx_v_self->name);
8141 __Pyx_GIVEREF(__pyx_v_self->name);
8142 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_self->name)) __PYX_ERR(0, 135, __pyx_L1_error);
8143 __pyx_t_2 = 0;
8144 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 135, __pyx_L1_error)
8145 __Pyx_GOTREF(__pyx_t_2);
8146 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8147 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
8148 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8149 __PYX_ERR(0, 135, __pyx_L1_error)
8150
8151 /* "pysam/libchtslib.pyx":134
8152 * if self.fp == NULL:
8153 * raise IOError('operation on closed HFile')
8154 * if hflush(self.fp) != 0: # <<<<<<<<<<<<<<
8155 * raise IOError(herrno(self.fp), 'failed to flush HFile', self.name)
8156 *
8157 */
8158 }
8159
8160 /* "pysam/libchtslib.pyx":131
8161 * return line
8162 *
8163 * def flush(self): # <<<<<<<<<<<<<<
8164 * if self.fp == NULL:
8165 * raise IOError('operation on closed HFile')
8166 */
8167
8168 /* function exit code */
8169 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
8170 goto __pyx_L0;
8171 __pyx_L1_error:;
8172 __Pyx_XDECREF(__pyx_t_2);
8173 __Pyx_XDECREF(__pyx_t_3);
8174 __Pyx_AddTraceback("pysam.libchtslib.HFile.flush", __pyx_clineno, __pyx_lineno, __pyx_filename);
8175 __pyx_r = NULL;
8176 __pyx_L0:;
8177 __Pyx_XGIVEREF(__pyx_r);
8178 __Pyx_TraceReturn(__pyx_r, 0);
8179 __Pyx_RefNannyFinishContext();
8180 return __pyx_r;
8181 }
8182
8183 /* "pysam/libchtslib.pyx":137
8184 * raise IOError(herrno(self.fp), 'failed to flush HFile', self.name)
8185 *
8186 * def isatty(self): # <<<<<<<<<<<<<<
8187 * if self.fp == NULL:
8188 * raise IOError('operation on closed HFile')
8189 */
8190
8191 /* Python wrapper */
8192 static PyObject *__pyx_pw_5pysam_10libchtslib_5HFile_19isatty(PyObject *__pyx_v_self,
8193 #if CYTHON_METH_FASTCALL
8194 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
8195 #else
8196 PyObject *__pyx_args, PyObject *__pyx_kwds
8197 #endif
8198 ); /*proto*/
8199 PyDoc_STRVAR(__pyx_doc_5pysam_10libchtslib_5HFile_18isatty, "HFile.isatty(self)");
8200 static PyMethodDef __pyx_mdef_5pysam_10libchtslib_5HFile_19isatty = {"isatty", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_5HFile_19isatty, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_5HFile_18isatty};
8201 static PyObject *__pyx_pw_5pysam_10libchtslib_5HFile_19isatty(PyObject *__pyx_v_self,
8202 #if CYTHON_METH_FASTCALL
8203 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
8204 #else
8205 PyObject *__pyx_args, PyObject *__pyx_kwds
8206 #endif
8207 ) {
8208 #if !CYTHON_METH_FASTCALL
8209 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
8210 #endif
8211 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
8212 PyObject *__pyx_r = 0;
8213 __Pyx_RefNannyDeclarations
8214 __Pyx_RefNannySetupContext("isatty (wrapper)", 0);
8215 #if !CYTHON_METH_FASTCALL
8216 #if CYTHON_ASSUME_SAFE_MACROS
8217 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
8218 #else
8219 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
8220 #endif
8221 #endif
8222 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
8223 if (unlikely(__pyx_nargs > 0)) {
8224 __Pyx_RaiseArgtupleInvalid("isatty", 1, 0, 0, __pyx_nargs); return NULL;}
8225 if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "isatty", 0))) return NULL;
8226 __pyx_r = __pyx_pf_5pysam_10libchtslib_5HFile_18isatty(((struct __pyx_obj_5pysam_10libchtslib_HFile *)__pyx_v_self));
8227
8228 /* function exit code */
8229 __Pyx_RefNannyFinishContext();
8230 return __pyx_r;
8231 }
8232
8233 static PyObject *__pyx_pf_5pysam_10libchtslib_5HFile_18isatty(struct __pyx_obj_5pysam_10libchtslib_HFile *__pyx_v_self) {
8234 PyObject *__pyx_r = NULL;
8235 __Pyx_TraceDeclarations
8236 __Pyx_RefNannyDeclarations
8237 int __pyx_t_1;
8238 PyObject *__pyx_t_2 = NULL;
8239 int __pyx_lineno = 0;
8240 const char *__pyx_filename = NULL;
8241 int __pyx_clineno = 0;
8242 __Pyx_TraceFrameInit(__pyx_codeobj__10)
8243 __Pyx_RefNannySetupContext("isatty", 1);
8244 __Pyx_TraceCall("isatty", __pyx_f[0], 137, 0, __PYX_ERR(0, 137, __pyx_L1_error));
8245
8246 /* "pysam/libchtslib.pyx":138
8247 *
8248 * def isatty(self):
8249 * if self.fp == NULL: # <<<<<<<<<<<<<<
8250 * raise IOError('operation on closed HFile')
8251 * return False
8252 */
8253 __pyx_t_1 = (__pyx_v_self->fp == NULL);
8254 if (unlikely(__pyx_t_1)) {
8255
8256 /* "pysam/libchtslib.pyx":139
8257 * def isatty(self):
8258 * if self.fp == NULL:
8259 * raise IOError('operation on closed HFile') # <<<<<<<<<<<<<<
8260 * return False
8261 *
8262 */
8263 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 139, __pyx_L1_error)
8264 __Pyx_GOTREF(__pyx_t_2);
8265 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
8266 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8267 __PYX_ERR(0, 139, __pyx_L1_error)
8268
8269 /* "pysam/libchtslib.pyx":138
8270 *
8271 * def isatty(self):
8272 * if self.fp == NULL: # <<<<<<<<<<<<<<
8273 * raise IOError('operation on closed HFile')
8274 * return False
8275 */
8276 }
8277
8278 /* "pysam/libchtslib.pyx":140
8279 * if self.fp == NULL:
8280 * raise IOError('operation on closed HFile')
8281 * return False # <<<<<<<<<<<<<<
8282 *
8283 * def readable(self):
8284 */
8285 __Pyx_XDECREF(__pyx_r);
8286 __Pyx_INCREF(Py_False);
8287 __pyx_r = Py_False;
8288 goto __pyx_L0;
8289
8290 /* "pysam/libchtslib.pyx":137
8291 * raise IOError(herrno(self.fp), 'failed to flush HFile', self.name)
8292 *
8293 * def isatty(self): # <<<<<<<<<<<<<<
8294 * if self.fp == NULL:
8295 * raise IOError('operation on closed HFile')
8296 */
8297
8298 /* function exit code */
8299 __pyx_L1_error:;
8300 __Pyx_XDECREF(__pyx_t_2);
8301 __Pyx_AddTraceback("pysam.libchtslib.HFile.isatty", __pyx_clineno, __pyx_lineno, __pyx_filename);
8302 __pyx_r = NULL;
8303 __pyx_L0:;
8304 __Pyx_XGIVEREF(__pyx_r);
8305 __Pyx_TraceReturn(__pyx_r, 0);
8306 __Pyx_RefNannyFinishContext();
8307 return __pyx_r;
8308 }
8309
8310 /* "pysam/libchtslib.pyx":142
8311 * return False
8312 *
8313 * def readable(self): # <<<<<<<<<<<<<<
8314 * return self.fp != NULL and 'r' in self.mode
8315 *
8316 */
8317
8318 /* Python wrapper */
8319 static PyObject *__pyx_pw_5pysam_10libchtslib_5HFile_21readable(PyObject *__pyx_v_self,
8320 #if CYTHON_METH_FASTCALL
8321 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
8322 #else
8323 PyObject *__pyx_args, PyObject *__pyx_kwds
8324 #endif
8325 ); /*proto*/
8326 PyDoc_STRVAR(__pyx_doc_5pysam_10libchtslib_5HFile_20readable, "HFile.readable(self)");
8327 static PyMethodDef __pyx_mdef_5pysam_10libchtslib_5HFile_21readable = {"readable", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_5HFile_21readable, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_5HFile_20readable};
8328 static PyObject *__pyx_pw_5pysam_10libchtslib_5HFile_21readable(PyObject *__pyx_v_self,
8329 #if CYTHON_METH_FASTCALL
8330 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
8331 #else
8332 PyObject *__pyx_args, PyObject *__pyx_kwds
8333 #endif
8334 ) {
8335 #if !CYTHON_METH_FASTCALL
8336 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
8337 #endif
8338 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
8339 PyObject *__pyx_r = 0;
8340 __Pyx_RefNannyDeclarations
8341 __Pyx_RefNannySetupContext("readable (wrapper)", 0);
8342 #if !CYTHON_METH_FASTCALL
8343 #if CYTHON_ASSUME_SAFE_MACROS
8344 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
8345 #else
8346 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
8347 #endif
8348 #endif
8349 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
8350 if (unlikely(__pyx_nargs > 0)) {
8351 __Pyx_RaiseArgtupleInvalid("readable", 1, 0, 0, __pyx_nargs); return NULL;}
8352 if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "readable", 0))) return NULL;
8353 __pyx_r = __pyx_pf_5pysam_10libchtslib_5HFile_20readable(((struct __pyx_obj_5pysam_10libchtslib_HFile *)__pyx_v_self));
8354
8355 /* function exit code */
8356 __Pyx_RefNannyFinishContext();
8357 return __pyx_r;
8358 }
8359
8360 static PyObject *__pyx_pf_5pysam_10libchtslib_5HFile_20readable(struct __pyx_obj_5pysam_10libchtslib_HFile *__pyx_v_self) {
8361 PyObject *__pyx_r = NULL;
8362 __Pyx_TraceDeclarations
8363 __Pyx_RefNannyDeclarations
8364 PyObject *__pyx_t_1 = NULL;
8365 int __pyx_t_2;
8366 PyObject *__pyx_t_3 = NULL;
8367 int __pyx_lineno = 0;
8368 const char *__pyx_filename = NULL;
8369 int __pyx_clineno = 0;
8370 __Pyx_TraceFrameInit(__pyx_codeobj__11)
8371 __Pyx_RefNannySetupContext("readable", 1);
8372 __Pyx_TraceCall("readable", __pyx_f[0], 142, 0, __PYX_ERR(0, 142, __pyx_L1_error));
8373
8374 /* "pysam/libchtslib.pyx":143
8375 *
8376 * def readable(self):
8377 * return self.fp != NULL and 'r' in self.mode # <<<<<<<<<<<<<<
8378 *
8379 * def read(self, Py_ssize_t size=-1):
8380 */
8381 __Pyx_XDECREF(__pyx_r);
8382 __pyx_t_2 = (__pyx_v_self->fp != NULL);
8383 if (__pyx_t_2) {
8384 } else {
8385 __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 143, __pyx_L1_error)
8386 __Pyx_GOTREF(__pyx_t_3);
8387 __pyx_t_1 = __pyx_t_3;
8388 __pyx_t_3 = 0;
8389 goto __pyx_L3_bool_binop_done;
8390 }
8391 __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_n_u_r, __pyx_v_self->mode, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 143, __pyx_L1_error)
8392 __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 143, __pyx_L1_error)
8393 __Pyx_GOTREF(__pyx_t_3);
8394 __pyx_t_1 = __pyx_t_3;
8395 __pyx_t_3 = 0;
8396 __pyx_L3_bool_binop_done:;
8397 __pyx_r = __pyx_t_1;
8398 __pyx_t_1 = 0;
8399 goto __pyx_L0;
8400
8401 /* "pysam/libchtslib.pyx":142
8402 * return False
8403 *
8404 * def readable(self): # <<<<<<<<<<<<<<
8405 * return self.fp != NULL and 'r' in self.mode
8406 *
8407 */
8408
8409 /* function exit code */
8410 __pyx_L1_error:;
8411 __Pyx_XDECREF(__pyx_t_1);
8412 __Pyx_XDECREF(__pyx_t_3);
8413 __Pyx_AddTraceback("pysam.libchtslib.HFile.readable", __pyx_clineno, __pyx_lineno, __pyx_filename);
8414 __pyx_r = NULL;
8415 __pyx_L0:;
8416 __Pyx_XGIVEREF(__pyx_r);
8417 __Pyx_TraceReturn(__pyx_r, 0);
8418 __Pyx_RefNannyFinishContext();
8419 return __pyx_r;
8420 }
8421
8422 /* "pysam/libchtslib.pyx":145
8423 * return self.fp != NULL and 'r' in self.mode
8424 *
8425 * def read(self, Py_ssize_t size=-1): # <<<<<<<<<<<<<<
8426 * if self.fp == NULL:
8427 * raise IOError('operation on closed HFile')
8428 */
8429
8430 /* Python wrapper */
8431 static PyObject *__pyx_pw_5pysam_10libchtslib_5HFile_23read(PyObject *__pyx_v_self,
8432 #if CYTHON_METH_FASTCALL
8433 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
8434 #else
8435 PyObject *__pyx_args, PyObject *__pyx_kwds
8436 #endif
8437 ); /*proto*/
8438 PyDoc_STRVAR(__pyx_doc_5pysam_10libchtslib_5HFile_22read, "HFile.read(self, Py_ssize_t size=-1)");
8439 static PyMethodDef __pyx_mdef_5pysam_10libchtslib_5HFile_23read = {"read", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_5HFile_23read, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_5HFile_22read};
8440 static PyObject *__pyx_pw_5pysam_10libchtslib_5HFile_23read(PyObject *__pyx_v_self,
8441 #if CYTHON_METH_FASTCALL
8442 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
8443 #else
8444 PyObject *__pyx_args, PyObject *__pyx_kwds
8445 #endif
8446 ) {
8447 Py_ssize_t __pyx_v_size;
8448 #if !CYTHON_METH_FASTCALL
8449 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
8450 #endif
8451 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
8452 PyObject* values[1] = {0};
8453 int __pyx_lineno = 0;
8454 const char *__pyx_filename = NULL;
8455 int __pyx_clineno = 0;
8456 PyObject *__pyx_r = 0;
8457 __Pyx_RefNannyDeclarations
8458 __Pyx_RefNannySetupContext("read (wrapper)", 0);
8459 #if !CYTHON_METH_FASTCALL
8460 #if CYTHON_ASSUME_SAFE_MACROS
8461 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
8462 #else
8463 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
8464 #endif
8465 #endif
8466 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
8467 {
8468 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_size,0};
8469 if (__pyx_kwds) {
8470 Py_ssize_t kw_args;
8471 switch (__pyx_nargs) {
8472 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
8473 CYTHON_FALLTHROUGH;
8474 case 0: break;
8475 default: goto __pyx_L5_argtuple_error;
8476 }
8477 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
8478 switch (__pyx_nargs) {
8479 case 0:
8480 if (kw_args > 0) {
8481 PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_size);
8482 if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
8483 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 145, __pyx_L3_error)
8484 }
8485 }
8486 if (unlikely(kw_args > 0)) {
8487 const Py_ssize_t kwd_pos_args = __pyx_nargs;
8488 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "read") < 0)) __PYX_ERR(0, 145, __pyx_L3_error)
8489 }
8490 } else {
8491 switch (__pyx_nargs) {
8492 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
8493 CYTHON_FALLTHROUGH;
8494 case 0: break;
8495 default: goto __pyx_L5_argtuple_error;
8496 }
8497 }
8498 if (values[0]) {
8499 __pyx_v_size = __Pyx_PyIndex_AsSsize_t(values[0]); if (unlikely((__pyx_v_size == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 145, __pyx_L3_error)
8500 } else {
8501 __pyx_v_size = ((Py_ssize_t)-1L);
8502 }
8503 }
8504 goto __pyx_L6_skip;
8505 __pyx_L5_argtuple_error:;
8506 __Pyx_RaiseArgtupleInvalid("read", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 145, __pyx_L3_error)
8507 __pyx_L6_skip:;
8508 goto __pyx_L4_argument_unpacking_done;
8509 __pyx_L3_error:;
8510 {
8511 Py_ssize_t __pyx_temp;
8512 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
8513 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
8514 }
8515 }
8516 __Pyx_AddTraceback("pysam.libchtslib.HFile.read", __pyx_clineno, __pyx_lineno, __pyx_filename);
8517 __Pyx_RefNannyFinishContext();
8518 return NULL;
8519 __pyx_L4_argument_unpacking_done:;
8520 __pyx_r = __pyx_pf_5pysam_10libchtslib_5HFile_22read(((struct __pyx_obj_5pysam_10libchtslib_HFile *)__pyx_v_self), __pyx_v_size);
8521
8522 /* function exit code */
8523 {
8524 Py_ssize_t __pyx_temp;
8525 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
8526 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
8527 }
8528 }
8529 __Pyx_RefNannyFinishContext();
8530 return __pyx_r;
8531 }
8532
8533 static PyObject *__pyx_pf_5pysam_10libchtslib_5HFile_22read(struct __pyx_obj_5pysam_10libchtslib_HFile *__pyx_v_self, Py_ssize_t __pyx_v_size) {
8534 PyObject *__pyx_v_parts = 0;
8535 PyObject *__pyx_v_part = 0;
8536 Py_ssize_t __pyx_v_chunk_size;
8537 Py_ssize_t __pyx_v_ret;
8538 Py_ssize_t __pyx_v_bytes_read;
8539 char *__pyx_v_cpart;
8540 PyObject *__pyx_r = NULL;
8541 __Pyx_TraceDeclarations
8542 __Pyx_RefNannyDeclarations
8543 int __pyx_t_1;
8544 PyObject *__pyx_t_2 = NULL;
8545 int __pyx_t_3;
8546 Py_ssize_t __pyx_t_4;
8547 Py_ssize_t __pyx_t_5;
8548 Py_ssize_t __pyx_t_6;
8549 char *__pyx_t_7;
8550 PyObject *__pyx_t_8 = NULL;
8551 int __pyx_t_9;
8552 int __pyx_lineno = 0;
8553 const char *__pyx_filename = NULL;
8554 int __pyx_clineno = 0;
8555 __Pyx_TraceFrameInit(__pyx_codeobj__12)
8556 __Pyx_RefNannySetupContext("read", 1);
8557 __Pyx_TraceCall("read", __pyx_f[0], 145, 0, __PYX_ERR(0, 145, __pyx_L1_error));
8558
8559 /* "pysam/libchtslib.pyx":146
8560 *
8561 * def read(self, Py_ssize_t size=-1):
8562 * if self.fp == NULL: # <<<<<<<<<<<<<<
8563 * raise IOError('operation on closed HFile')
8564 *
8565 */
8566 __pyx_t_1 = (__pyx_v_self->fp == NULL);
8567 if (unlikely(__pyx_t_1)) {
8568
8569 /* "pysam/libchtslib.pyx":147
8570 * def read(self, Py_ssize_t size=-1):
8571 * if self.fp == NULL:
8572 * raise IOError('operation on closed HFile') # <<<<<<<<<<<<<<
8573 *
8574 * if size == 0:
8575 */
8576 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 147, __pyx_L1_error)
8577 __Pyx_GOTREF(__pyx_t_2);
8578 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
8579 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8580 __PYX_ERR(0, 147, __pyx_L1_error)
8581
8582 /* "pysam/libchtslib.pyx":146
8583 *
8584 * def read(self, Py_ssize_t size=-1):
8585 * if self.fp == NULL: # <<<<<<<<<<<<<<
8586 * raise IOError('operation on closed HFile')
8587 *
8588 */
8589 }
8590
8591 /* "pysam/libchtslib.pyx":149
8592 * raise IOError('operation on closed HFile')
8593 *
8594 * if size == 0: # <<<<<<<<<<<<<<
8595 * return b''
8596 *
8597 */
8598 __pyx_t_1 = (__pyx_v_size == 0);
8599 if (__pyx_t_1) {
8600
8601 /* "pysam/libchtslib.pyx":150
8602 *
8603 * if size == 0:
8604 * return b'' # <<<<<<<<<<<<<<
8605 *
8606 * cdef list parts = []
8607 */
8608 __Pyx_XDECREF(__pyx_r);
8609 __Pyx_INCREF(__pyx_kp_b__13);
8610 __pyx_r = __pyx_kp_b__13;
8611 goto __pyx_L0;
8612
8613 /* "pysam/libchtslib.pyx":149
8614 * raise IOError('operation on closed HFile')
8615 *
8616 * if size == 0: # <<<<<<<<<<<<<<
8617 * return b''
8618 *
8619 */
8620 }
8621
8622 /* "pysam/libchtslib.pyx":152
8623 * return b''
8624 *
8625 * cdef list parts = [] # <<<<<<<<<<<<<<
8626 * cdef bytes part
8627 * cdef Py_ssize_t chunk_size, ret, bytes_read = 0
8628 */
8629 __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 152, __pyx_L1_error)
8630 __Pyx_GOTREF(__pyx_t_2);
8631 __pyx_v_parts = ((PyObject*)__pyx_t_2);
8632 __pyx_t_2 = 0;
8633
8634 /* "pysam/libchtslib.pyx":154
8635 * cdef list parts = []
8636 * cdef bytes part
8637 * cdef Py_ssize_t chunk_size, ret, bytes_read = 0 # <<<<<<<<<<<<<<
8638 * cdef char *cpart
8639 *
8640 */
8641 __pyx_v_bytes_read = 0;
8642
8643 /* "pysam/libchtslib.pyx":157
8644 * cdef char *cpart
8645 *
8646 * while size == -1 or bytes_read < size: # <<<<<<<<<<<<<<
8647 * chunk_size = 4096
8648 * if size != -1:
8649 */
8650 while (1) {
8651 __pyx_t_3 = (__pyx_v_size == -1L);
8652 if (!__pyx_t_3) {
8653 } else {
8654 __pyx_t_1 = __pyx_t_3;
8655 goto __pyx_L7_bool_binop_done;
8656 }
8657 __pyx_t_3 = (__pyx_v_bytes_read < __pyx_v_size);
8658 __pyx_t_1 = __pyx_t_3;
8659 __pyx_L7_bool_binop_done:;
8660 if (!__pyx_t_1) break;
8661
8662 /* "pysam/libchtslib.pyx":158
8663 *
8664 * while size == -1 or bytes_read < size:
8665 * chunk_size = 4096 # <<<<<<<<<<<<<<
8666 * if size != -1:
8667 * chunk_size = min(chunk_size, size - bytes_read)
8668 */
8669 __pyx_v_chunk_size = 0x1000;
8670
8671 /* "pysam/libchtslib.pyx":159
8672 * while size == -1 or bytes_read < size:
8673 * chunk_size = 4096
8674 * if size != -1: # <<<<<<<<<<<<<<
8675 * chunk_size = min(chunk_size, size - bytes_read)
8676 *
8677 */
8678 __pyx_t_1 = (__pyx_v_size != -1L);
8679 if (__pyx_t_1) {
8680
8681 /* "pysam/libchtslib.pyx":160
8682 * chunk_size = 4096
8683 * if size != -1:
8684 * chunk_size = min(chunk_size, size - bytes_read) # <<<<<<<<<<<<<<
8685 *
8686 * part = PyBytes_FromStringAndSize(NULL, chunk_size)
8687 */
8688 __pyx_t_4 = (__pyx_v_size - __pyx_v_bytes_read);
8689 __pyx_t_5 = __pyx_v_chunk_size;
8690 __pyx_t_1 = (__pyx_t_4 < __pyx_t_5);
8691 if (__pyx_t_1) {
8692 __pyx_t_6 = __pyx_t_4;
8693 } else {
8694 __pyx_t_6 = __pyx_t_5;
8695 }
8696 __pyx_v_chunk_size = __pyx_t_6;
8697
8698 /* "pysam/libchtslib.pyx":159
8699 * while size == -1 or bytes_read < size:
8700 * chunk_size = 4096
8701 * if size != -1: # <<<<<<<<<<<<<<
8702 * chunk_size = min(chunk_size, size - bytes_read)
8703 *
8704 */
8705 }
8706
8707 /* "pysam/libchtslib.pyx":162
8708 * chunk_size = min(chunk_size, size - bytes_read)
8709 *
8710 * part = PyBytes_FromStringAndSize(NULL, chunk_size) # <<<<<<<<<<<<<<
8711 * cpart = <char *>part
8712 * ret = hread(self.fp, <void *>cpart, chunk_size)
8713 */
8714 __pyx_t_2 = PyBytes_FromStringAndSize(NULL, __pyx_v_chunk_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 162, __pyx_L1_error)
8715 __Pyx_GOTREF(__pyx_t_2);
8716 __Pyx_XDECREF_SET(__pyx_v_part, ((PyObject*)__pyx_t_2));
8717 __pyx_t_2 = 0;
8718
8719 /* "pysam/libchtslib.pyx":163
8720 *
8721 * part = PyBytes_FromStringAndSize(NULL, chunk_size)
8722 * cpart = <char *>part # <<<<<<<<<<<<<<
8723 * ret = hread(self.fp, <void *>cpart, chunk_size)
8724 *
8725 */
8726 if (unlikely(__pyx_v_part == Py_None)) {
8727 PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
8728 __PYX_ERR(0, 163, __pyx_L1_error)
8729 }
8730 __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_part); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(0, 163, __pyx_L1_error)
8731 __pyx_v_cpart = ((char *)__pyx_t_7);
8732
8733 /* "pysam/libchtslib.pyx":164
8734 * part = PyBytes_FromStringAndSize(NULL, chunk_size)
8735 * cpart = <char *>part
8736 * ret = hread(self.fp, <void *>cpart, chunk_size) # <<<<<<<<<<<<<<
8737 *
8738 * if ret < 0:
8739 */
8740 __pyx_v_ret = hread(__pyx_v_self->fp, ((void *)__pyx_v_cpart), __pyx_v_chunk_size);
8741
8742 /* "pysam/libchtslib.pyx":166
8743 * ret = hread(self.fp, <void *>cpart, chunk_size)
8744 *
8745 * if ret < 0: # <<<<<<<<<<<<<<
8746 * IOError(herrno(self.fp), 'failed to read HFile', self.name)
8747 * elif not ret:
8748 */
8749 __pyx_t_1 = (__pyx_v_ret < 0);
8750 if (__pyx_t_1) {
8751
8752 /* "pysam/libchtslib.pyx":167
8753 *
8754 * if ret < 0:
8755 * IOError(herrno(self.fp), 'failed to read HFile', self.name) # <<<<<<<<<<<<<<
8756 * elif not ret:
8757 * break
8758 */
8759 __pyx_t_2 = __Pyx_PyInt_From_int(herrno(__pyx_v_self->fp)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 167, __pyx_L1_error)
8760 __Pyx_GOTREF(__pyx_t_2);
8761 __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 167, __pyx_L1_error)
8762 __Pyx_GOTREF(__pyx_t_8);
8763 __Pyx_GIVEREF(__pyx_t_2);
8764 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2)) __PYX_ERR(0, 167, __pyx_L1_error);
8765 __Pyx_INCREF(__pyx_kp_u_failed_to_read_HFile);
8766 __Pyx_GIVEREF(__pyx_kp_u_failed_to_read_HFile);
8767 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_kp_u_failed_to_read_HFile)) __PYX_ERR(0, 167, __pyx_L1_error);
8768 __Pyx_INCREF(__pyx_v_self->name);
8769 __Pyx_GIVEREF(__pyx_v_self->name);
8770 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_v_self->name)) __PYX_ERR(0, 167, __pyx_L1_error);
8771 __pyx_t_2 = 0;
8772 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 167, __pyx_L1_error)
8773 __Pyx_GOTREF(__pyx_t_2);
8774 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
8775 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8776
8777 /* "pysam/libchtslib.pyx":166
8778 * ret = hread(self.fp, <void *>cpart, chunk_size)
8779 *
8780 * if ret < 0: # <<<<<<<<<<<<<<
8781 * IOError(herrno(self.fp), 'failed to read HFile', self.name)
8782 * elif not ret:
8783 */
8784 goto __pyx_L10;
8785 }
8786
8787 /* "pysam/libchtslib.pyx":168
8788 * if ret < 0:
8789 * IOError(herrno(self.fp), 'failed to read HFile', self.name)
8790 * elif not ret: # <<<<<<<<<<<<<<
8791 * break
8792 *
8793 */
8794 __pyx_t_1 = (!(__pyx_v_ret != 0));
8795 if (__pyx_t_1) {
8796
8797 /* "pysam/libchtslib.pyx":169
8798 * IOError(herrno(self.fp), 'failed to read HFile', self.name)
8799 * elif not ret:
8800 * break # <<<<<<<<<<<<<<
8801 *
8802 * bytes_read += ret
8803 */
8804 goto __pyx_L6_break;
8805
8806 /* "pysam/libchtslib.pyx":168
8807 * if ret < 0:
8808 * IOError(herrno(self.fp), 'failed to read HFile', self.name)
8809 * elif not ret: # <<<<<<<<<<<<<<
8810 * break
8811 *
8812 */
8813 }
8814 __pyx_L10:;
8815
8816 /* "pysam/libchtslib.pyx":171
8817 * break
8818 *
8819 * bytes_read += ret # <<<<<<<<<<<<<<
8820 *
8821 * if ret < chunk_size:
8822 */
8823 __pyx_v_bytes_read = (__pyx_v_bytes_read + __pyx_v_ret);
8824
8825 /* "pysam/libchtslib.pyx":173
8826 * bytes_read += ret
8827 *
8828 * if ret < chunk_size: # <<<<<<<<<<<<<<
8829 * part = cpart[:ret]
8830 *
8831 */
8832 __pyx_t_1 = (__pyx_v_ret < __pyx_v_chunk_size);
8833 if (__pyx_t_1) {
8834
8835 /* "pysam/libchtslib.pyx":174
8836 *
8837 * if ret < chunk_size:
8838 * part = cpart[:ret] # <<<<<<<<<<<<<<
8839 *
8840 * parts.append(part)
8841 */
8842 __pyx_t_2 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_cpart + 0, __pyx_v_ret - 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 174, __pyx_L1_error)
8843 __Pyx_GOTREF(__pyx_t_2);
8844 __Pyx_DECREF_SET(__pyx_v_part, ((PyObject*)__pyx_t_2));
8845 __pyx_t_2 = 0;
8846
8847 /* "pysam/libchtslib.pyx":173
8848 * bytes_read += ret
8849 *
8850 * if ret < chunk_size: # <<<<<<<<<<<<<<
8851 * part = cpart[:ret]
8852 *
8853 */
8854 }
8855
8856 /* "pysam/libchtslib.pyx":176
8857 * part = cpart[:ret]
8858 *
8859 * parts.append(part) # <<<<<<<<<<<<<<
8860 *
8861 * return b''.join(parts)
8862 */
8863 __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_parts, __pyx_v_part); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 176, __pyx_L1_error)
8864 }
8865 __pyx_L6_break:;
8866
8867 /* "pysam/libchtslib.pyx":178
8868 * parts.append(part)
8869 *
8870 * return b''.join(parts) # <<<<<<<<<<<<<<
8871 *
8872 * def readall(self):
8873 */
8874 __Pyx_XDECREF(__pyx_r);
8875 __pyx_t_2 = __Pyx_PyBytes_Join(__pyx_kp_b__13, __pyx_v_parts); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 178, __pyx_L1_error)
8876 __Pyx_GOTREF(__pyx_t_2);
8877 __pyx_r = __pyx_t_2;
8878 __pyx_t_2 = 0;
8879 goto __pyx_L0;
8880
8881 /* "pysam/libchtslib.pyx":145
8882 * return self.fp != NULL and 'r' in self.mode
8883 *
8884 * def read(self, Py_ssize_t size=-1): # <<<<<<<<<<<<<<
8885 * if self.fp == NULL:
8886 * raise IOError('operation on closed HFile')
8887 */
8888
8889 /* function exit code */
8890 __pyx_L1_error:;
8891 __Pyx_XDECREF(__pyx_t_2);
8892 __Pyx_XDECREF(__pyx_t_8);
8893 __Pyx_AddTraceback("pysam.libchtslib.HFile.read", __pyx_clineno, __pyx_lineno, __pyx_filename);
8894 __pyx_r = NULL;
8895 __pyx_L0:;
8896 __Pyx_XDECREF(__pyx_v_parts);
8897 __Pyx_XDECREF(__pyx_v_part);
8898 __Pyx_XGIVEREF(__pyx_r);
8899 __Pyx_TraceReturn(__pyx_r, 0);
8900 __Pyx_RefNannyFinishContext();
8901 return __pyx_r;
8902 }
8903
8904 /* "pysam/libchtslib.pyx":180
8905 * return b''.join(parts)
8906 *
8907 * def readall(self): # <<<<<<<<<<<<<<
8908 * return self.read()
8909 *
8910 */
8911
8912 /* Python wrapper */
8913 static PyObject *__pyx_pw_5pysam_10libchtslib_5HFile_25readall(PyObject *__pyx_v_self,
8914 #if CYTHON_METH_FASTCALL
8915 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
8916 #else
8917 PyObject *__pyx_args, PyObject *__pyx_kwds
8918 #endif
8919 ); /*proto*/
8920 PyDoc_STRVAR(__pyx_doc_5pysam_10libchtslib_5HFile_24readall, "HFile.readall(self)");
8921 static PyMethodDef __pyx_mdef_5pysam_10libchtslib_5HFile_25readall = {"readall", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_5HFile_25readall, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_5HFile_24readall};
8922 static PyObject *__pyx_pw_5pysam_10libchtslib_5HFile_25readall(PyObject *__pyx_v_self,
8923 #if CYTHON_METH_FASTCALL
8924 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
8925 #else
8926 PyObject *__pyx_args, PyObject *__pyx_kwds
8927 #endif
8928 ) {
8929 #if !CYTHON_METH_FASTCALL
8930 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
8931 #endif
8932 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
8933 PyObject *__pyx_r = 0;
8934 __Pyx_RefNannyDeclarations
8935 __Pyx_RefNannySetupContext("readall (wrapper)", 0);
8936 #if !CYTHON_METH_FASTCALL
8937 #if CYTHON_ASSUME_SAFE_MACROS
8938 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
8939 #else
8940 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
8941 #endif
8942 #endif
8943 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
8944 if (unlikely(__pyx_nargs > 0)) {
8945 __Pyx_RaiseArgtupleInvalid("readall", 1, 0, 0, __pyx_nargs); return NULL;}
8946 if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "readall", 0))) return NULL;
8947 __pyx_r = __pyx_pf_5pysam_10libchtslib_5HFile_24readall(((struct __pyx_obj_5pysam_10libchtslib_HFile *)__pyx_v_self));
8948
8949 /* function exit code */
8950 __Pyx_RefNannyFinishContext();
8951 return __pyx_r;
8952 }
8953
8954 static PyObject *__pyx_pf_5pysam_10libchtslib_5HFile_24readall(struct __pyx_obj_5pysam_10libchtslib_HFile *__pyx_v_self) {
8955 PyObject *__pyx_r = NULL;
8956 __Pyx_TraceDeclarations
8957 __Pyx_RefNannyDeclarations
8958 PyObject *__pyx_t_1 = NULL;
8959 PyObject *__pyx_t_2 = NULL;
8960 PyObject *__pyx_t_3 = NULL;
8961 unsigned int __pyx_t_4;
8962 int __pyx_lineno = 0;
8963 const char *__pyx_filename = NULL;
8964 int __pyx_clineno = 0;
8965 __Pyx_TraceFrameInit(__pyx_codeobj__14)
8966 __Pyx_RefNannySetupContext("readall", 1);
8967 __Pyx_TraceCall("readall", __pyx_f[0], 180, 0, __PYX_ERR(0, 180, __pyx_L1_error));
8968
8969 /* "pysam/libchtslib.pyx":181
8970 *
8971 * def readall(self):
8972 * return self.read() # <<<<<<<<<<<<<<
8973 *
8974 * def readinto(self, buf):
8975 */
8976 __Pyx_XDECREF(__pyx_r);
8977 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_read); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 181, __pyx_L1_error)
8978 __Pyx_GOTREF(__pyx_t_2);
8979 __pyx_t_3 = NULL;
8980 __pyx_t_4 = 0;
8981 #if CYTHON_UNPACK_METHODS
8982 if (likely(PyMethod_Check(__pyx_t_2))) {
8983 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
8984 if (likely(__pyx_t_3)) {
8985 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
8986 __Pyx_INCREF(__pyx_t_3);
8987 __Pyx_INCREF(function);
8988 __Pyx_DECREF_SET(__pyx_t_2, function);
8989 __pyx_t_4 = 1;
8990 }
8991 }
8992 #endif
8993 {
8994 PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
8995 __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
8996 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
8997 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 181, __pyx_L1_error)
8998 __Pyx_GOTREF(__pyx_t_1);
8999 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9000 }
9001 __pyx_r = __pyx_t_1;
9002 __pyx_t_1 = 0;
9003 goto __pyx_L0;
9004
9005 /* "pysam/libchtslib.pyx":180
9006 * return b''.join(parts)
9007 *
9008 * def readall(self): # <<<<<<<<<<<<<<
9009 * return self.read()
9010 *
9011 */
9012
9013 /* function exit code */
9014 __pyx_L1_error:;
9015 __Pyx_XDECREF(__pyx_t_1);
9016 __Pyx_XDECREF(__pyx_t_2);
9017 __Pyx_XDECREF(__pyx_t_3);
9018 __Pyx_AddTraceback("pysam.libchtslib.HFile.readall", __pyx_clineno, __pyx_lineno, __pyx_filename);
9019 __pyx_r = NULL;
9020 __pyx_L0:;
9021 __Pyx_XGIVEREF(__pyx_r);
9022 __Pyx_TraceReturn(__pyx_r, 0);
9023 __Pyx_RefNannyFinishContext();
9024 return __pyx_r;
9025 }
9026
9027 /* "pysam/libchtslib.pyx":183
9028 * return self.read()
9029 *
9030 * def readinto(self, buf): # <<<<<<<<<<<<<<
9031 * if self.fp == NULL:
9032 * raise IOError('operation on closed HFile')
9033 */
9034
9035 /* Python wrapper */
9036 static PyObject *__pyx_pw_5pysam_10libchtslib_5HFile_27readinto(PyObject *__pyx_v_self,
9037 #if CYTHON_METH_FASTCALL
9038 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
9039 #else
9040 PyObject *__pyx_args, PyObject *__pyx_kwds
9041 #endif
9042 ); /*proto*/
9043 PyDoc_STRVAR(__pyx_doc_5pysam_10libchtslib_5HFile_26readinto, "HFile.readinto(self, buf)");
9044 static PyMethodDef __pyx_mdef_5pysam_10libchtslib_5HFile_27readinto = {"readinto", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_5HFile_27readinto, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_5HFile_26readinto};
9045 static PyObject *__pyx_pw_5pysam_10libchtslib_5HFile_27readinto(PyObject *__pyx_v_self,
9046 #if CYTHON_METH_FASTCALL
9047 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
9048 #else
9049 PyObject *__pyx_args, PyObject *__pyx_kwds
9050 #endif
9051 ) {
9052 PyObject *__pyx_v_buf = 0;
9053 #if !CYTHON_METH_FASTCALL
9054 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
9055 #endif
9056 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
9057 PyObject* values[1] = {0};
9058 int __pyx_lineno = 0;
9059 const char *__pyx_filename = NULL;
9060 int __pyx_clineno = 0;
9061 PyObject *__pyx_r = 0;
9062 __Pyx_RefNannyDeclarations
9063 __Pyx_RefNannySetupContext("readinto (wrapper)", 0);
9064 #if !CYTHON_METH_FASTCALL
9065 #if CYTHON_ASSUME_SAFE_MACROS
9066 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
9067 #else
9068 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
9069 #endif
9070 #endif
9071 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
9072 {
9073 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_buf,0};
9074 if (__pyx_kwds) {
9075 Py_ssize_t kw_args;
9076 switch (__pyx_nargs) {
9077 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
9078 CYTHON_FALLTHROUGH;
9079 case 0: break;
9080 default: goto __pyx_L5_argtuple_error;
9081 }
9082 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
9083 switch (__pyx_nargs) {
9084 case 0:
9085 if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_buf)) != 0)) {
9086 (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
9087 kw_args--;
9088 }
9089 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 183, __pyx_L3_error)
9090 else goto __pyx_L5_argtuple_error;
9091 }
9092 if (unlikely(kw_args > 0)) {
9093 const Py_ssize_t kwd_pos_args = __pyx_nargs;
9094 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "readinto") < 0)) __PYX_ERR(0, 183, __pyx_L3_error)
9095 }
9096 } else if (unlikely(__pyx_nargs != 1)) {
9097 goto __pyx_L5_argtuple_error;
9098 } else {
9099 values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
9100 }
9101 __pyx_v_buf = values[0];
9102 }
9103 goto __pyx_L6_skip;
9104 __pyx_L5_argtuple_error:;
9105 __Pyx_RaiseArgtupleInvalid("readinto", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 183, __pyx_L3_error)
9106 __pyx_L6_skip:;
9107 goto __pyx_L4_argument_unpacking_done;
9108 __pyx_L3_error:;
9109 {
9110 Py_ssize_t __pyx_temp;
9111 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
9112 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
9113 }
9114 }
9115 __Pyx_AddTraceback("pysam.libchtslib.HFile.readinto", __pyx_clineno, __pyx_lineno, __pyx_filename);
9116 __Pyx_RefNannyFinishContext();
9117 return NULL;
9118 __pyx_L4_argument_unpacking_done:;
9119 __pyx_r = __pyx_pf_5pysam_10libchtslib_5HFile_26readinto(((struct __pyx_obj_5pysam_10libchtslib_HFile *)__pyx_v_self), __pyx_v_buf);
9120
9121 /* function exit code */
9122 {
9123 Py_ssize_t __pyx_temp;
9124 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
9125 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
9126 }
9127 }
9128 __Pyx_RefNannyFinishContext();
9129 return __pyx_r;
9130 }
9131
9132 static PyObject *__pyx_pf_5pysam_10libchtslib_5HFile_26readinto(struct __pyx_obj_5pysam_10libchtslib_HFile *__pyx_v_self, PyObject *__pyx_v_buf) {
9133 Py_ssize_t __pyx_v_size;
9134 PyObject *__pyx_v_mv = NULL;
9135 Py_ssize_t __pyx_v_ret;
9136 PyObject *__pyx_r = NULL;
9137 __Pyx_TraceDeclarations
9138 __Pyx_RefNannyDeclarations
9139 int __pyx_t_1;
9140 PyObject *__pyx_t_2 = NULL;
9141 Py_ssize_t __pyx_t_3;
9142 PyObject *__pyx_t_4 = NULL;
9143 int __pyx_lineno = 0;
9144 const char *__pyx_filename = NULL;
9145 int __pyx_clineno = 0;
9146 __Pyx_TraceFrameInit(__pyx_codeobj__15)
9147 __Pyx_RefNannySetupContext("readinto", 1);
9148 __Pyx_TraceCall("readinto", __pyx_f[0], 183, 0, __PYX_ERR(0, 183, __pyx_L1_error));
9149
9150 /* "pysam/libchtslib.pyx":184
9151 *
9152 * def readinto(self, buf):
9153 * if self.fp == NULL: # <<<<<<<<<<<<<<
9154 * raise IOError('operation on closed HFile')
9155 *
9156 */
9157 __pyx_t_1 = (__pyx_v_self->fp == NULL);
9158 if (unlikely(__pyx_t_1)) {
9159
9160 /* "pysam/libchtslib.pyx":185
9161 * def readinto(self, buf):
9162 * if self.fp == NULL:
9163 * raise IOError('operation on closed HFile') # <<<<<<<<<<<<<<
9164 *
9165 * size = len(buf)
9166 */
9167 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 185, __pyx_L1_error)
9168 __Pyx_GOTREF(__pyx_t_2);
9169 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
9170 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9171 __PYX_ERR(0, 185, __pyx_L1_error)
9172
9173 /* "pysam/libchtslib.pyx":184
9174 *
9175 * def readinto(self, buf):
9176 * if self.fp == NULL: # <<<<<<<<<<<<<<
9177 * raise IOError('operation on closed HFile')
9178 *
9179 */
9180 }
9181
9182 /* "pysam/libchtslib.pyx":187
9183 * raise IOError('operation on closed HFile')
9184 *
9185 * size = len(buf) # <<<<<<<<<<<<<<
9186 *
9187 * if size == 0:
9188 */
9189 __pyx_t_3 = PyObject_Length(__pyx_v_buf); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 187, __pyx_L1_error)
9190 __pyx_v_size = __pyx_t_3;
9191
9192 /* "pysam/libchtslib.pyx":189
9193 * size = len(buf)
9194 *
9195 * if size == 0: # <<<<<<<<<<<<<<
9196 * return size
9197 *
9198 */
9199 __pyx_t_1 = (__pyx_v_size == 0);
9200 if (__pyx_t_1) {
9201
9202 /* "pysam/libchtslib.pyx":190
9203 *
9204 * if size == 0:
9205 * return size # <<<<<<<<<<<<<<
9206 *
9207 * mv = memoryview(buf)
9208 */
9209 __Pyx_XDECREF(__pyx_r);
9210 __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 190, __pyx_L1_error)
9211 __Pyx_GOTREF(__pyx_t_2);
9212 __pyx_r = __pyx_t_2;
9213 __pyx_t_2 = 0;
9214 goto __pyx_L0;
9215
9216 /* "pysam/libchtslib.pyx":189
9217 * size = len(buf)
9218 *
9219 * if size == 0: # <<<<<<<<<<<<<<
9220 * return size
9221 *
9222 */
9223 }
9224
9225 /* "pysam/libchtslib.pyx":192
9226 * return size
9227 *
9228 * mv = memoryview(buf) # <<<<<<<<<<<<<<
9229 * ret = hread(self.fp, <void *>mv, size)
9230 *
9231 */
9232 __pyx_t_2 = PyMemoryView_FromObject(__pyx_v_buf); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 192, __pyx_L1_error)
9233 __Pyx_GOTREF(__pyx_t_2);
9234 __pyx_v_mv = ((PyObject*)__pyx_t_2);
9235 __pyx_t_2 = 0;
9236
9237 /* "pysam/libchtslib.pyx":193
9238 *
9239 * mv = memoryview(buf)
9240 * ret = hread(self.fp, <void *>mv, size) # <<<<<<<<<<<<<<
9241 *
9242 * if ret < 0:
9243 */
9244 __pyx_v_ret = hread(__pyx_v_self->fp, ((void *)__pyx_v_mv), __pyx_v_size);
9245
9246 /* "pysam/libchtslib.pyx":195
9247 * ret = hread(self.fp, <void *>mv, size)
9248 *
9249 * if ret < 0: # <<<<<<<<<<<<<<
9250 * IOError(herrno(self.fp), 'failed to read HFile', self.name)
9251 *
9252 */
9253 __pyx_t_1 = (__pyx_v_ret < 0);
9254 if (__pyx_t_1) {
9255
9256 /* "pysam/libchtslib.pyx":196
9257 *
9258 * if ret < 0:
9259 * IOError(herrno(self.fp), 'failed to read HFile', self.name) # <<<<<<<<<<<<<<
9260 *
9261 * return ret
9262 */
9263 __pyx_t_2 = __Pyx_PyInt_From_int(herrno(__pyx_v_self->fp)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 196, __pyx_L1_error)
9264 __Pyx_GOTREF(__pyx_t_2);
9265 __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 196, __pyx_L1_error)
9266 __Pyx_GOTREF(__pyx_t_4);
9267 __Pyx_GIVEREF(__pyx_t_2);
9268 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2)) __PYX_ERR(0, 196, __pyx_L1_error);
9269 __Pyx_INCREF(__pyx_kp_u_failed_to_read_HFile);
9270 __Pyx_GIVEREF(__pyx_kp_u_failed_to_read_HFile);
9271 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_kp_u_failed_to_read_HFile)) __PYX_ERR(0, 196, __pyx_L1_error);
9272 __Pyx_INCREF(__pyx_v_self->name);
9273 __Pyx_GIVEREF(__pyx_v_self->name);
9274 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_self->name)) __PYX_ERR(0, 196, __pyx_L1_error);
9275 __pyx_t_2 = 0;
9276 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 196, __pyx_L1_error)
9277 __Pyx_GOTREF(__pyx_t_2);
9278 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9279 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9280
9281 /* "pysam/libchtslib.pyx":195
9282 * ret = hread(self.fp, <void *>mv, size)
9283 *
9284 * if ret < 0: # <<<<<<<<<<<<<<
9285 * IOError(herrno(self.fp), 'failed to read HFile', self.name)
9286 *
9287 */
9288 }
9289
9290 /* "pysam/libchtslib.pyx":198
9291 * IOError(herrno(self.fp), 'failed to read HFile', self.name)
9292 *
9293 * return ret # <<<<<<<<<<<<<<
9294 *
9295 * def readline(self, Py_ssize_t size=-1):
9296 */
9297 __Pyx_XDECREF(__pyx_r);
9298 __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_ret); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 198, __pyx_L1_error)
9299 __Pyx_GOTREF(__pyx_t_2);
9300 __pyx_r = __pyx_t_2;
9301 __pyx_t_2 = 0;
9302 goto __pyx_L0;
9303
9304 /* "pysam/libchtslib.pyx":183
9305 * return self.read()
9306 *
9307 * def readinto(self, buf): # <<<<<<<<<<<<<<
9308 * if self.fp == NULL:
9309 * raise IOError('operation on closed HFile')
9310 */
9311
9312 /* function exit code */
9313 __pyx_L1_error:;
9314 __Pyx_XDECREF(__pyx_t_2);
9315 __Pyx_XDECREF(__pyx_t_4);
9316 __Pyx_AddTraceback("pysam.libchtslib.HFile.readinto", __pyx_clineno, __pyx_lineno, __pyx_filename);
9317 __pyx_r = NULL;
9318 __pyx_L0:;
9319 __Pyx_XDECREF(__pyx_v_mv);
9320 __Pyx_XGIVEREF(__pyx_r);
9321 __Pyx_TraceReturn(__pyx_r, 0);
9322 __Pyx_RefNannyFinishContext();
9323 return __pyx_r;
9324 }
9325
9326 /* "pysam/libchtslib.pyx":200
9327 * return ret
9328 *
9329 * def readline(self, Py_ssize_t size=-1): # <<<<<<<<<<<<<<
9330 * if self.fp == NULL:
9331 * raise IOError('operation on closed HFile')
9332 */
9333
9334 /* Python wrapper */
9335 static PyObject *__pyx_pw_5pysam_10libchtslib_5HFile_29readline(PyObject *__pyx_v_self,
9336 #if CYTHON_METH_FASTCALL
9337 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
9338 #else
9339 PyObject *__pyx_args, PyObject *__pyx_kwds
9340 #endif
9341 ); /*proto*/
9342 PyDoc_STRVAR(__pyx_doc_5pysam_10libchtslib_5HFile_28readline, "HFile.readline(self, Py_ssize_t size=-1)");
9343 static PyMethodDef __pyx_mdef_5pysam_10libchtslib_5HFile_29readline = {"readline", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_5HFile_29readline, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_5HFile_28readline};
9344 static PyObject *__pyx_pw_5pysam_10libchtslib_5HFile_29readline(PyObject *__pyx_v_self,
9345 #if CYTHON_METH_FASTCALL
9346 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
9347 #else
9348 PyObject *__pyx_args, PyObject *__pyx_kwds
9349 #endif
9350 ) {
9351 Py_ssize_t __pyx_v_size;
9352 #if !CYTHON_METH_FASTCALL
9353 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
9354 #endif
9355 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
9356 PyObject* values[1] = {0};
9357 int __pyx_lineno = 0;
9358 const char *__pyx_filename = NULL;
9359 int __pyx_clineno = 0;
9360 PyObject *__pyx_r = 0;
9361 __Pyx_RefNannyDeclarations
9362 __Pyx_RefNannySetupContext("readline (wrapper)", 0);
9363 #if !CYTHON_METH_FASTCALL
9364 #if CYTHON_ASSUME_SAFE_MACROS
9365 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
9366 #else
9367 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
9368 #endif
9369 #endif
9370 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
9371 {
9372 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_size,0};
9373 if (__pyx_kwds) {
9374 Py_ssize_t kw_args;
9375 switch (__pyx_nargs) {
9376 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
9377 CYTHON_FALLTHROUGH;
9378 case 0: break;
9379 default: goto __pyx_L5_argtuple_error;
9380 }
9381 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
9382 switch (__pyx_nargs) {
9383 case 0:
9384 if (kw_args > 0) {
9385 PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_size);
9386 if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
9387 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 200, __pyx_L3_error)
9388 }
9389 }
9390 if (unlikely(kw_args > 0)) {
9391 const Py_ssize_t kwd_pos_args = __pyx_nargs;
9392 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "readline") < 0)) __PYX_ERR(0, 200, __pyx_L3_error)
9393 }
9394 } else {
9395 switch (__pyx_nargs) {
9396 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
9397 CYTHON_FALLTHROUGH;
9398 case 0: break;
9399 default: goto __pyx_L5_argtuple_error;
9400 }
9401 }
9402 if (values[0]) {
9403 __pyx_v_size = __Pyx_PyIndex_AsSsize_t(values[0]); if (unlikely((__pyx_v_size == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 200, __pyx_L3_error)
9404 } else {
9405 __pyx_v_size = ((Py_ssize_t)-1L);
9406 }
9407 }
9408 goto __pyx_L6_skip;
9409 __pyx_L5_argtuple_error:;
9410 __Pyx_RaiseArgtupleInvalid("readline", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 200, __pyx_L3_error)
9411 __pyx_L6_skip:;
9412 goto __pyx_L4_argument_unpacking_done;
9413 __pyx_L3_error:;
9414 {
9415 Py_ssize_t __pyx_temp;
9416 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
9417 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
9418 }
9419 }
9420 __Pyx_AddTraceback("pysam.libchtslib.HFile.readline", __pyx_clineno, __pyx_lineno, __pyx_filename);
9421 __Pyx_RefNannyFinishContext();
9422 return NULL;
9423 __pyx_L4_argument_unpacking_done:;
9424 __pyx_r = __pyx_pf_5pysam_10libchtslib_5HFile_28readline(((struct __pyx_obj_5pysam_10libchtslib_HFile *)__pyx_v_self), __pyx_v_size);
9425
9426 /* function exit code */
9427 {
9428 Py_ssize_t __pyx_temp;
9429 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
9430 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
9431 }
9432 }
9433 __Pyx_RefNannyFinishContext();
9434 return __pyx_r;
9435 }
9436
9437 static PyObject *__pyx_pf_5pysam_10libchtslib_5HFile_28readline(struct __pyx_obj_5pysam_10libchtslib_HFile *__pyx_v_self, Py_ssize_t __pyx_v_size) {
9438 PyObject *__pyx_v_parts = 0;
9439 PyObject *__pyx_v_part = 0;
9440 Py_ssize_t __pyx_v_chunk_size;
9441 Py_ssize_t __pyx_v_ret;
9442 Py_ssize_t __pyx_v_bytes_read;
9443 char *__pyx_v_cpart;
9444 PyObject *__pyx_r = NULL;
9445 __Pyx_TraceDeclarations
9446 __Pyx_RefNannyDeclarations
9447 int __pyx_t_1;
9448 PyObject *__pyx_t_2 = NULL;
9449 int __pyx_t_3;
9450 Py_ssize_t __pyx_t_4;
9451 Py_ssize_t __pyx_t_5;
9452 Py_ssize_t __pyx_t_6;
9453 char *__pyx_t_7;
9454 PyObject *__pyx_t_8 = NULL;
9455 int __pyx_t_9;
9456 int __pyx_lineno = 0;
9457 const char *__pyx_filename = NULL;
9458 int __pyx_clineno = 0;
9459 __Pyx_TraceFrameInit(__pyx_codeobj__16)
9460 __Pyx_RefNannySetupContext("readline", 1);
9461 __Pyx_TraceCall("readline", __pyx_f[0], 200, 0, __PYX_ERR(0, 200, __pyx_L1_error));
9462
9463 /* "pysam/libchtslib.pyx":201
9464 *
9465 * def readline(self, Py_ssize_t size=-1):
9466 * if self.fp == NULL: # <<<<<<<<<<<<<<
9467 * raise IOError('operation on closed HFile')
9468 *
9469 */
9470 __pyx_t_1 = (__pyx_v_self->fp == NULL);
9471 if (unlikely(__pyx_t_1)) {
9472
9473 /* "pysam/libchtslib.pyx":202
9474 * def readline(self, Py_ssize_t size=-1):
9475 * if self.fp == NULL:
9476 * raise IOError('operation on closed HFile') # <<<<<<<<<<<<<<
9477 *
9478 * if size == 0:
9479 */
9480 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 202, __pyx_L1_error)
9481 __Pyx_GOTREF(__pyx_t_2);
9482 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
9483 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9484 __PYX_ERR(0, 202, __pyx_L1_error)
9485
9486 /* "pysam/libchtslib.pyx":201
9487 *
9488 * def readline(self, Py_ssize_t size=-1):
9489 * if self.fp == NULL: # <<<<<<<<<<<<<<
9490 * raise IOError('operation on closed HFile')
9491 *
9492 */
9493 }
9494
9495 /* "pysam/libchtslib.pyx":204
9496 * raise IOError('operation on closed HFile')
9497 *
9498 * if size == 0: # <<<<<<<<<<<<<<
9499 * return b''
9500 *
9501 */
9502 __pyx_t_1 = (__pyx_v_size == 0);
9503 if (__pyx_t_1) {
9504
9505 /* "pysam/libchtslib.pyx":205
9506 *
9507 * if size == 0:
9508 * return b'' # <<<<<<<<<<<<<<
9509 *
9510 * cdef list parts = []
9511 */
9512 __Pyx_XDECREF(__pyx_r);
9513 __Pyx_INCREF(__pyx_kp_b__13);
9514 __pyx_r = __pyx_kp_b__13;
9515 goto __pyx_L0;
9516
9517 /* "pysam/libchtslib.pyx":204
9518 * raise IOError('operation on closed HFile')
9519 *
9520 * if size == 0: # <<<<<<<<<<<<<<
9521 * return b''
9522 *
9523 */
9524 }
9525
9526 /* "pysam/libchtslib.pyx":207
9527 * return b''
9528 *
9529 * cdef list parts = [] # <<<<<<<<<<<<<<
9530 * cdef bytes part
9531 * cdef Py_ssize_t chunk_size, ret, bytes_read = 0
9532 */
9533 __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 207, __pyx_L1_error)
9534 __Pyx_GOTREF(__pyx_t_2);
9535 __pyx_v_parts = ((PyObject*)__pyx_t_2);
9536 __pyx_t_2 = 0;
9537
9538 /* "pysam/libchtslib.pyx":209
9539 * cdef list parts = []
9540 * cdef bytes part
9541 * cdef Py_ssize_t chunk_size, ret, bytes_read = 0 # <<<<<<<<<<<<<<
9542 * cdef char *cpart
9543 *
9544 */
9545 __pyx_v_bytes_read = 0;
9546
9547 /* "pysam/libchtslib.pyx":212
9548 * cdef char *cpart
9549 *
9550 * while size == -1 or bytes_read < size: # <<<<<<<<<<<<<<
9551 * chunk_size = 4096
9552 * if size != -1:
9553 */
9554 while (1) {
9555 __pyx_t_3 = (__pyx_v_size == -1L);
9556 if (!__pyx_t_3) {
9557 } else {
9558 __pyx_t_1 = __pyx_t_3;
9559 goto __pyx_L7_bool_binop_done;
9560 }
9561 __pyx_t_3 = (__pyx_v_bytes_read < __pyx_v_size);
9562 __pyx_t_1 = __pyx_t_3;
9563 __pyx_L7_bool_binop_done:;
9564 if (!__pyx_t_1) break;
9565
9566 /* "pysam/libchtslib.pyx":213
9567 *
9568 * while size == -1 or bytes_read < size:
9569 * chunk_size = 4096 # <<<<<<<<<<<<<<
9570 * if size != -1:
9571 * chunk_size = min(chunk_size, size - bytes_read)
9572 */
9573 __pyx_v_chunk_size = 0x1000;
9574
9575 /* "pysam/libchtslib.pyx":214
9576 * while size == -1 or bytes_read < size:
9577 * chunk_size = 4096
9578 * if size != -1: # <<<<<<<<<<<<<<
9579 * chunk_size = min(chunk_size, size - bytes_read)
9580 *
9581 */
9582 __pyx_t_1 = (__pyx_v_size != -1L);
9583 if (__pyx_t_1) {
9584
9585 /* "pysam/libchtslib.pyx":215
9586 * chunk_size = 4096
9587 * if size != -1:
9588 * chunk_size = min(chunk_size, size - bytes_read) # <<<<<<<<<<<<<<
9589 *
9590 * part = PyBytes_FromStringAndSize(NULL, chunk_size)
9591 */
9592 __pyx_t_4 = (__pyx_v_size - __pyx_v_bytes_read);
9593 __pyx_t_5 = __pyx_v_chunk_size;
9594 __pyx_t_1 = (__pyx_t_4 < __pyx_t_5);
9595 if (__pyx_t_1) {
9596 __pyx_t_6 = __pyx_t_4;
9597 } else {
9598 __pyx_t_6 = __pyx_t_5;
9599 }
9600 __pyx_v_chunk_size = __pyx_t_6;
9601
9602 /* "pysam/libchtslib.pyx":214
9603 * while size == -1 or bytes_read < size:
9604 * chunk_size = 4096
9605 * if size != -1: # <<<<<<<<<<<<<<
9606 * chunk_size = min(chunk_size, size - bytes_read)
9607 *
9608 */
9609 }
9610
9611 /* "pysam/libchtslib.pyx":217
9612 * chunk_size = min(chunk_size, size - bytes_read)
9613 *
9614 * part = PyBytes_FromStringAndSize(NULL, chunk_size) # <<<<<<<<<<<<<<
9615 * cpart = <char *>part
9616 *
9617 */
9618 __pyx_t_2 = PyBytes_FromStringAndSize(NULL, __pyx_v_chunk_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 217, __pyx_L1_error)
9619 __Pyx_GOTREF(__pyx_t_2);
9620 __Pyx_XDECREF_SET(__pyx_v_part, ((PyObject*)__pyx_t_2));
9621 __pyx_t_2 = 0;
9622
9623 /* "pysam/libchtslib.pyx":218
9624 *
9625 * part = PyBytes_FromStringAndSize(NULL, chunk_size)
9626 * cpart = <char *>part # <<<<<<<<<<<<<<
9627 *
9628 * # Python bytes objects allocate an extra byte for a null terminator
9629 */
9630 if (unlikely(__pyx_v_part == Py_None)) {
9631 PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
9632 __PYX_ERR(0, 218, __pyx_L1_error)
9633 }
9634 __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_part); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(0, 218, __pyx_L1_error)
9635 __pyx_v_cpart = ((char *)__pyx_t_7);
9636
9637 /* "pysam/libchtslib.pyx":221
9638 *
9639 * # Python bytes objects allocate an extra byte for a null terminator
9640 * ret = hgetln(cpart, chunk_size+1, self.fp) # <<<<<<<<<<<<<<
9641 *
9642 * if ret < 0:
9643 */
9644 __pyx_v_ret = hgetln(__pyx_v_cpart, (__pyx_v_chunk_size + 1), __pyx_v_self->fp);
9645
9646 /* "pysam/libchtslib.pyx":223
9647 * ret = hgetln(cpart, chunk_size+1, self.fp)
9648 *
9649 * if ret < 0: # <<<<<<<<<<<<<<
9650 * IOError(herrno(self.fp), 'failed to read HFile', self.name)
9651 * elif not ret:
9652 */
9653 __pyx_t_1 = (__pyx_v_ret < 0);
9654 if (__pyx_t_1) {
9655
9656 /* "pysam/libchtslib.pyx":224
9657 *
9658 * if ret < 0:
9659 * IOError(herrno(self.fp), 'failed to read HFile', self.name) # <<<<<<<<<<<<<<
9660 * elif not ret:
9661 * break
9662 */
9663 __pyx_t_2 = __Pyx_PyInt_From_int(herrno(__pyx_v_self->fp)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 224, __pyx_L1_error)
9664 __Pyx_GOTREF(__pyx_t_2);
9665 __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 224, __pyx_L1_error)
9666 __Pyx_GOTREF(__pyx_t_8);
9667 __Pyx_GIVEREF(__pyx_t_2);
9668 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2)) __PYX_ERR(0, 224, __pyx_L1_error);
9669 __Pyx_INCREF(__pyx_kp_u_failed_to_read_HFile);
9670 __Pyx_GIVEREF(__pyx_kp_u_failed_to_read_HFile);
9671 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_kp_u_failed_to_read_HFile)) __PYX_ERR(0, 224, __pyx_L1_error);
9672 __Pyx_INCREF(__pyx_v_self->name);
9673 __Pyx_GIVEREF(__pyx_v_self->name);
9674 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_v_self->name)) __PYX_ERR(0, 224, __pyx_L1_error);
9675 __pyx_t_2 = 0;
9676 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 224, __pyx_L1_error)
9677 __Pyx_GOTREF(__pyx_t_2);
9678 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
9679 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9680
9681 /* "pysam/libchtslib.pyx":223
9682 * ret = hgetln(cpart, chunk_size+1, self.fp)
9683 *
9684 * if ret < 0: # <<<<<<<<<<<<<<
9685 * IOError(herrno(self.fp), 'failed to read HFile', self.name)
9686 * elif not ret:
9687 */
9688 goto __pyx_L10;
9689 }
9690
9691 /* "pysam/libchtslib.pyx":225
9692 * if ret < 0:
9693 * IOError(herrno(self.fp), 'failed to read HFile', self.name)
9694 * elif not ret: # <<<<<<<<<<<<<<
9695 * break
9696 *
9697 */
9698 __pyx_t_1 = (!(__pyx_v_ret != 0));
9699 if (__pyx_t_1) {
9700
9701 /* "pysam/libchtslib.pyx":226
9702 * IOError(herrno(self.fp), 'failed to read HFile', self.name)
9703 * elif not ret:
9704 * break # <<<<<<<<<<<<<<
9705 *
9706 * bytes_read += ret
9707 */
9708 goto __pyx_L6_break;
9709
9710 /* "pysam/libchtslib.pyx":225
9711 * if ret < 0:
9712 * IOError(herrno(self.fp), 'failed to read HFile', self.name)
9713 * elif not ret: # <<<<<<<<<<<<<<
9714 * break
9715 *
9716 */
9717 }
9718 __pyx_L10:;
9719
9720 /* "pysam/libchtslib.pyx":228
9721 * break
9722 *
9723 * bytes_read += ret # <<<<<<<<<<<<<<
9724 *
9725 * if ret < chunk_size:
9726 */
9727 __pyx_v_bytes_read = (__pyx_v_bytes_read + __pyx_v_ret);
9728
9729 /* "pysam/libchtslib.pyx":230
9730 * bytes_read += ret
9731 *
9732 * if ret < chunk_size: # <<<<<<<<<<<<<<
9733 * part = cpart[:ret]
9734 * cpart = <char *>part
9735 */
9736 __pyx_t_1 = (__pyx_v_ret < __pyx_v_chunk_size);
9737 if (__pyx_t_1) {
9738
9739 /* "pysam/libchtslib.pyx":231
9740 *
9741 * if ret < chunk_size:
9742 * part = cpart[:ret] # <<<<<<<<<<<<<<
9743 * cpart = <char *>part
9744 *
9745 */
9746 __pyx_t_2 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_cpart + 0, __pyx_v_ret - 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 231, __pyx_L1_error)
9747 __Pyx_GOTREF(__pyx_t_2);
9748 __Pyx_DECREF_SET(__pyx_v_part, ((PyObject*)__pyx_t_2));
9749 __pyx_t_2 = 0;
9750
9751 /* "pysam/libchtslib.pyx":232
9752 * if ret < chunk_size:
9753 * part = cpart[:ret]
9754 * cpart = <char *>part # <<<<<<<<<<<<<<
9755 *
9756 * parts.append(part)
9757 */
9758 __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_part); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(0, 232, __pyx_L1_error)
9759 __pyx_v_cpart = ((char *)__pyx_t_7);
9760
9761 /* "pysam/libchtslib.pyx":230
9762 * bytes_read += ret
9763 *
9764 * if ret < chunk_size: # <<<<<<<<<<<<<<
9765 * part = cpart[:ret]
9766 * cpart = <char *>part
9767 */
9768 }
9769
9770 /* "pysam/libchtslib.pyx":234
9771 * cpart = <char *>part
9772 *
9773 * parts.append(part) # <<<<<<<<<<<<<<
9774 *
9775 * if cpart[ret-1] == b'\n':
9776 */
9777 __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_parts, __pyx_v_part); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 234, __pyx_L1_error)
9778
9779 /* "pysam/libchtslib.pyx":236
9780 * parts.append(part)
9781 *
9782 * if cpart[ret-1] == b'\n': # <<<<<<<<<<<<<<
9783 * break
9784 *
9785 */
9786 __pyx_t_1 = ((__pyx_v_cpart[(__pyx_v_ret - 1)]) == '\n');
9787 if (__pyx_t_1) {
9788
9789 /* "pysam/libchtslib.pyx":237
9790 *
9791 * if cpart[ret-1] == b'\n':
9792 * break # <<<<<<<<<<<<<<
9793 *
9794 * return b''.join(parts)
9795 */
9796 goto __pyx_L6_break;
9797
9798 /* "pysam/libchtslib.pyx":236
9799 * parts.append(part)
9800 *
9801 * if cpart[ret-1] == b'\n': # <<<<<<<<<<<<<<
9802 * break
9803 *
9804 */
9805 }
9806 }
9807 __pyx_L6_break:;
9808
9809 /* "pysam/libchtslib.pyx":239
9810 * break
9811 *
9812 * return b''.join(parts) # <<<<<<<<<<<<<<
9813 *
9814 * def readlines(self):
9815 */
9816 __Pyx_XDECREF(__pyx_r);
9817 __pyx_t_2 = __Pyx_PyBytes_Join(__pyx_kp_b__13, __pyx_v_parts); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 239, __pyx_L1_error)
9818 __Pyx_GOTREF(__pyx_t_2);
9819 __pyx_r = __pyx_t_2;
9820 __pyx_t_2 = 0;
9821 goto __pyx_L0;
9822
9823 /* "pysam/libchtslib.pyx":200
9824 * return ret
9825 *
9826 * def readline(self, Py_ssize_t size=-1): # <<<<<<<<<<<<<<
9827 * if self.fp == NULL:
9828 * raise IOError('operation on closed HFile')
9829 */
9830
9831 /* function exit code */
9832 __pyx_L1_error:;
9833 __Pyx_XDECREF(__pyx_t_2);
9834 __Pyx_XDECREF(__pyx_t_8);
9835 __Pyx_AddTraceback("pysam.libchtslib.HFile.readline", __pyx_clineno, __pyx_lineno, __pyx_filename);
9836 __pyx_r = NULL;
9837 __pyx_L0:;
9838 __Pyx_XDECREF(__pyx_v_parts);
9839 __Pyx_XDECREF(__pyx_v_part);
9840 __Pyx_XGIVEREF(__pyx_r);
9841 __Pyx_TraceReturn(__pyx_r, 0);
9842 __Pyx_RefNannyFinishContext();
9843 return __pyx_r;
9844 }
9845
9846 /* "pysam/libchtslib.pyx":241
9847 * return b''.join(parts)
9848 *
9849 * def readlines(self): # <<<<<<<<<<<<<<
9850 * return list(self)
9851 *
9852 */
9853
9854 /* Python wrapper */
9855 static PyObject *__pyx_pw_5pysam_10libchtslib_5HFile_31readlines(PyObject *__pyx_v_self,
9856 #if CYTHON_METH_FASTCALL
9857 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
9858 #else
9859 PyObject *__pyx_args, PyObject *__pyx_kwds
9860 #endif
9861 ); /*proto*/
9862 PyDoc_STRVAR(__pyx_doc_5pysam_10libchtslib_5HFile_30readlines, "HFile.readlines(self)");
9863 static PyMethodDef __pyx_mdef_5pysam_10libchtslib_5HFile_31readlines = {"readlines", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_5HFile_31readlines, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_5HFile_30readlines};
9864 static PyObject *__pyx_pw_5pysam_10libchtslib_5HFile_31readlines(PyObject *__pyx_v_self,
9865 #if CYTHON_METH_FASTCALL
9866 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
9867 #else
9868 PyObject *__pyx_args, PyObject *__pyx_kwds
9869 #endif
9870 ) {
9871 #if !CYTHON_METH_FASTCALL
9872 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
9873 #endif
9874 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
9875 PyObject *__pyx_r = 0;
9876 __Pyx_RefNannyDeclarations
9877 __Pyx_RefNannySetupContext("readlines (wrapper)", 0);
9878 #if !CYTHON_METH_FASTCALL
9879 #if CYTHON_ASSUME_SAFE_MACROS
9880 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
9881 #else
9882 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
9883 #endif
9884 #endif
9885 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
9886 if (unlikely(__pyx_nargs > 0)) {
9887 __Pyx_RaiseArgtupleInvalid("readlines", 1, 0, 0, __pyx_nargs); return NULL;}
9888 if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "readlines", 0))) return NULL;
9889 __pyx_r = __pyx_pf_5pysam_10libchtslib_5HFile_30readlines(((struct __pyx_obj_5pysam_10libchtslib_HFile *)__pyx_v_self));
9890
9891 /* function exit code */
9892 __Pyx_RefNannyFinishContext();
9893 return __pyx_r;
9894 }
9895
9896 static PyObject *__pyx_pf_5pysam_10libchtslib_5HFile_30readlines(struct __pyx_obj_5pysam_10libchtslib_HFile *__pyx_v_self) {
9897 PyObject *__pyx_r = NULL;
9898 __Pyx_TraceDeclarations
9899 __Pyx_RefNannyDeclarations
9900 PyObject *__pyx_t_1 = NULL;
9901 int __pyx_lineno = 0;
9902 const char *__pyx_filename = NULL;
9903 int __pyx_clineno = 0;
9904 __Pyx_TraceFrameInit(__pyx_codeobj__17)
9905 __Pyx_RefNannySetupContext("readlines", 1);
9906 __Pyx_TraceCall("readlines", __pyx_f[0], 241, 0, __PYX_ERR(0, 241, __pyx_L1_error));
9907
9908 /* "pysam/libchtslib.pyx":242
9909 *
9910 * def readlines(self):
9911 * return list(self) # <<<<<<<<<<<<<<
9912 *
9913 * def seek(self, Py_ssize_t offset, int whence=io.SEEK_SET):
9914 */
9915 __Pyx_XDECREF(__pyx_r);
9916 __pyx_t_1 = PySequence_List(((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 242, __pyx_L1_error)
9917 __Pyx_GOTREF(__pyx_t_1);
9918 __pyx_r = __pyx_t_1;
9919 __pyx_t_1 = 0;
9920 goto __pyx_L0;
9921
9922 /* "pysam/libchtslib.pyx":241
9923 * return b''.join(parts)
9924 *
9925 * def readlines(self): # <<<<<<<<<<<<<<
9926 * return list(self)
9927 *
9928 */
9929
9930 /* function exit code */
9931 __pyx_L1_error:;
9932 __Pyx_XDECREF(__pyx_t_1);
9933 __Pyx_AddTraceback("pysam.libchtslib.HFile.readlines", __pyx_clineno, __pyx_lineno, __pyx_filename);
9934 __pyx_r = NULL;
9935 __pyx_L0:;
9936 __Pyx_XGIVEREF(__pyx_r);
9937 __Pyx_TraceReturn(__pyx_r, 0);
9938 __Pyx_RefNannyFinishContext();
9939 return __pyx_r;
9940 }
9941
9942 /* "pysam/libchtslib.pyx":244
9943 * return list(self)
9944 *
9945 * def seek(self, Py_ssize_t offset, int whence=io.SEEK_SET): # <<<<<<<<<<<<<<
9946 * if self.fp == NULL:
9947 * raise IOError('operation on closed HFile')
9948 */
9949
9950 /* Python wrapper */
9951 static PyObject *__pyx_pw_5pysam_10libchtslib_5HFile_33seek(PyObject *__pyx_v_self,
9952 #if CYTHON_METH_FASTCALL
9953 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
9954 #else
9955 PyObject *__pyx_args, PyObject *__pyx_kwds
9956 #endif
9957 ); /*proto*/
9958 PyDoc_STRVAR(__pyx_doc_5pysam_10libchtslib_5HFile_32seek, "HFile.seek(self, Py_ssize_t offset, int whence=io.SEEK_SET)");
9959 static PyMethodDef __pyx_mdef_5pysam_10libchtslib_5HFile_33seek = {"seek", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_5HFile_33seek, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_5HFile_32seek};
9960 static PyObject *__pyx_pw_5pysam_10libchtslib_5HFile_33seek(PyObject *__pyx_v_self,
9961 #if CYTHON_METH_FASTCALL
9962 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
9963 #else
9964 PyObject *__pyx_args, PyObject *__pyx_kwds
9965 #endif
9966 ) {
9967 Py_ssize_t __pyx_v_offset;
9968 int __pyx_v_whence;
9969 #if !CYTHON_METH_FASTCALL
9970 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
9971 #endif
9972 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
9973 PyObject* values[2] = {0,0};
9974 int __pyx_lineno = 0;
9975 const char *__pyx_filename = NULL;
9976 int __pyx_clineno = 0;
9977 PyObject *__pyx_r = 0;
9978 __Pyx_RefNannyDeclarations
9979 __Pyx_RefNannySetupContext("seek (wrapper)", 0);
9980 #if !CYTHON_METH_FASTCALL
9981 #if CYTHON_ASSUME_SAFE_MACROS
9982 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
9983 #else
9984 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
9985 #endif
9986 #endif
9987 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
9988 {
9989 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_offset,&__pyx_n_s_whence,0};
9990 if (__pyx_kwds) {
9991 Py_ssize_t kw_args;
9992 switch (__pyx_nargs) {
9993 case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
9994 CYTHON_FALLTHROUGH;
9995 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
9996 CYTHON_FALLTHROUGH;
9997 case 0: break;
9998 default: goto __pyx_L5_argtuple_error;
9999 }
10000 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
10001 switch (__pyx_nargs) {
10002 case 0:
10003 if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_offset)) != 0)) {
10004 (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
10005 kw_args--;
10006 }
10007 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 244, __pyx_L3_error)
10008 else goto __pyx_L5_argtuple_error;
10009 CYTHON_FALLTHROUGH;
10010 case 1:
10011 if (kw_args > 0) {
10012 PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_whence);
10013 if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
10014 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 244, __pyx_L3_error)
10015 }
10016 }
10017 if (unlikely(kw_args > 0)) {
10018 const Py_ssize_t kwd_pos_args = __pyx_nargs;
10019 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "seek") < 0)) __PYX_ERR(0, 244, __pyx_L3_error)
10020 }
10021 } else {
10022 switch (__pyx_nargs) {
10023 case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
10024 CYTHON_FALLTHROUGH;
10025 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
10026 break;
10027 default: goto __pyx_L5_argtuple_error;
10028 }
10029 }
10030 __pyx_v_offset = __Pyx_PyIndex_AsSsize_t(values[0]); if (unlikely((__pyx_v_offset == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 244, __pyx_L3_error)
10031 if (values[1]) {
10032 __pyx_v_whence = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_whence == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 244, __pyx_L3_error)
10033 } else {
10034 __pyx_v_whence = __pyx_k__18;
10035 }
10036 }
10037 goto __pyx_L6_skip;
10038 __pyx_L5_argtuple_error:;
10039 __Pyx_RaiseArgtupleInvalid("seek", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 244, __pyx_L3_error)
10040 __pyx_L6_skip:;
10041 goto __pyx_L4_argument_unpacking_done;
10042 __pyx_L3_error:;
10043 {
10044 Py_ssize_t __pyx_temp;
10045 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
10046 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
10047 }
10048 }
10049 __Pyx_AddTraceback("pysam.libchtslib.HFile.seek", __pyx_clineno, __pyx_lineno, __pyx_filename);
10050 __Pyx_RefNannyFinishContext();
10051 return NULL;
10052 __pyx_L4_argument_unpacking_done:;
10053 __pyx_r = __pyx_pf_5pysam_10libchtslib_5HFile_32seek(((struct __pyx_obj_5pysam_10libchtslib_HFile *)__pyx_v_self), __pyx_v_offset, __pyx_v_whence);
10054
10055 /* function exit code */
10056 {
10057 Py_ssize_t __pyx_temp;
10058 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
10059 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
10060 }
10061 }
10062 __Pyx_RefNannyFinishContext();
10063 return __pyx_r;
10064 }
10065
10066 static PyObject *__pyx_pf_5pysam_10libchtslib_5HFile_32seek(struct __pyx_obj_5pysam_10libchtslib_HFile *__pyx_v_self, Py_ssize_t __pyx_v_offset, int __pyx_v_whence) {
10067 Py_ssize_t __pyx_v_off;
10068 PyObject *__pyx_r = NULL;
10069 __Pyx_TraceDeclarations
10070 __Pyx_RefNannyDeclarations
10071 int __pyx_t_1;
10072 PyObject *__pyx_t_2 = NULL;
10073 int __pyx_t_3;
10074 PyObject *__pyx_t_4 = NULL;
10075 int __pyx_lineno = 0;
10076 const char *__pyx_filename = NULL;
10077 int __pyx_clineno = 0;
10078 __Pyx_TraceFrameInit(__pyx_codeobj__19)
10079 __Pyx_RefNannySetupContext("seek", 1);
10080 __Pyx_TraceCall("seek", __pyx_f[0], 244, 0, __PYX_ERR(0, 244, __pyx_L1_error));
10081
10082 /* "pysam/libchtslib.pyx":245
10083 *
10084 * def seek(self, Py_ssize_t offset, int whence=io.SEEK_SET):
10085 * if self.fp == NULL: # <<<<<<<<<<<<<<
10086 * raise IOError('operation on closed HFile')
10087 *
10088 */
10089 __pyx_t_1 = (__pyx_v_self->fp == NULL);
10090 if (unlikely(__pyx_t_1)) {
10091
10092 /* "pysam/libchtslib.pyx":246
10093 * def seek(self, Py_ssize_t offset, int whence=io.SEEK_SET):
10094 * if self.fp == NULL:
10095 * raise IOError('operation on closed HFile') # <<<<<<<<<<<<<<
10096 *
10097 * cdef Py_ssize_t off = hseek(self.fp, offset, libc_whence_from_io(whence))
10098 */
10099 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 246, __pyx_L1_error)
10100 __Pyx_GOTREF(__pyx_t_2);
10101 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
10102 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10103 __PYX_ERR(0, 246, __pyx_L1_error)
10104
10105 /* "pysam/libchtslib.pyx":245
10106 *
10107 * def seek(self, Py_ssize_t offset, int whence=io.SEEK_SET):
10108 * if self.fp == NULL: # <<<<<<<<<<<<<<
10109 * raise IOError('operation on closed HFile')
10110 *
10111 */
10112 }
10113
10114 /* "pysam/libchtslib.pyx":248
10115 * raise IOError('operation on closed HFile')
10116 *
10117 * cdef Py_ssize_t off = hseek(self.fp, offset, libc_whence_from_io(whence)) # <<<<<<<<<<<<<<
10118 *
10119 * if off < 0:
10120 */
10121 __pyx_t_3 = __pyx_f_5pysam_9libcutils_libc_whence_from_io(__pyx_v_whence); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 248, __pyx_L1_error)
10122 __pyx_v_off = hseek(__pyx_v_self->fp, __pyx_v_offset, __pyx_t_3);
10123
10124 /* "pysam/libchtslib.pyx":250
10125 * cdef Py_ssize_t off = hseek(self.fp, offset, libc_whence_from_io(whence))
10126 *
10127 * if off < 0: # <<<<<<<<<<<<<<
10128 * raise IOError(herrno(self.fp), 'seek failed on HFile', self.name)
10129 *
10130 */
10131 __pyx_t_1 = (__pyx_v_off < 0);
10132 if (unlikely(__pyx_t_1)) {
10133
10134 /* "pysam/libchtslib.pyx":251
10135 *
10136 * if off < 0:
10137 * raise IOError(herrno(self.fp), 'seek failed on HFile', self.name) # <<<<<<<<<<<<<<
10138 *
10139 * return off
10140 */
10141 __pyx_t_2 = __Pyx_PyInt_From_int(herrno(__pyx_v_self->fp)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 251, __pyx_L1_error)
10142 __Pyx_GOTREF(__pyx_t_2);
10143 __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 251, __pyx_L1_error)
10144 __Pyx_GOTREF(__pyx_t_4);
10145 __Pyx_GIVEREF(__pyx_t_2);
10146 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2)) __PYX_ERR(0, 251, __pyx_L1_error);
10147 __Pyx_INCREF(__pyx_kp_u_seek_failed_on_HFile);
10148 __Pyx_GIVEREF(__pyx_kp_u_seek_failed_on_HFile);
10149 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_kp_u_seek_failed_on_HFile)) __PYX_ERR(0, 251, __pyx_L1_error);
10150 __Pyx_INCREF(__pyx_v_self->name);
10151 __Pyx_GIVEREF(__pyx_v_self->name);
10152 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_self->name)) __PYX_ERR(0, 251, __pyx_L1_error);
10153 __pyx_t_2 = 0;
10154 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 251, __pyx_L1_error)
10155 __Pyx_GOTREF(__pyx_t_2);
10156 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10157 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
10158 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10159 __PYX_ERR(0, 251, __pyx_L1_error)
10160
10161 /* "pysam/libchtslib.pyx":250
10162 * cdef Py_ssize_t off = hseek(self.fp, offset, libc_whence_from_io(whence))
10163 *
10164 * if off < 0: # <<<<<<<<<<<<<<
10165 * raise IOError(herrno(self.fp), 'seek failed on HFile', self.name)
10166 *
10167 */
10168 }
10169
10170 /* "pysam/libchtslib.pyx":253
10171 * raise IOError(herrno(self.fp), 'seek failed on HFile', self.name)
10172 *
10173 * return off # <<<<<<<<<<<<<<
10174 *
10175 * def tell(self):
10176 */
10177 __Pyx_XDECREF(__pyx_r);
10178 __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_off); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 253, __pyx_L1_error)
10179 __Pyx_GOTREF(__pyx_t_2);
10180 __pyx_r = __pyx_t_2;
10181 __pyx_t_2 = 0;
10182 goto __pyx_L0;
10183
10184 /* "pysam/libchtslib.pyx":244
10185 * return list(self)
10186 *
10187 * def seek(self, Py_ssize_t offset, int whence=io.SEEK_SET): # <<<<<<<<<<<<<<
10188 * if self.fp == NULL:
10189 * raise IOError('operation on closed HFile')
10190 */
10191
10192 /* function exit code */
10193 __pyx_L1_error:;
10194 __Pyx_XDECREF(__pyx_t_2);
10195 __Pyx_XDECREF(__pyx_t_4);
10196 __Pyx_AddTraceback("pysam.libchtslib.HFile.seek", __pyx_clineno, __pyx_lineno, __pyx_filename);
10197 __pyx_r = NULL;
10198 __pyx_L0:;
10199 __Pyx_XGIVEREF(__pyx_r);
10200 __Pyx_TraceReturn(__pyx_r, 0);
10201 __Pyx_RefNannyFinishContext();
10202 return __pyx_r;
10203 }
10204
10205 /* "pysam/libchtslib.pyx":255
10206 * return off
10207 *
10208 * def tell(self): # <<<<<<<<<<<<<<
10209 * if self.fp == NULL:
10210 * raise IOError('operation on closed HFile')
10211 */
10212
10213 /* Python wrapper */
10214 static PyObject *__pyx_pw_5pysam_10libchtslib_5HFile_35tell(PyObject *__pyx_v_self,
10215 #if CYTHON_METH_FASTCALL
10216 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
10217 #else
10218 PyObject *__pyx_args, PyObject *__pyx_kwds
10219 #endif
10220 ); /*proto*/
10221 PyDoc_STRVAR(__pyx_doc_5pysam_10libchtslib_5HFile_34tell, "HFile.tell(self)");
10222 static PyMethodDef __pyx_mdef_5pysam_10libchtslib_5HFile_35tell = {"tell", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_5HFile_35tell, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_5HFile_34tell};
10223 static PyObject *__pyx_pw_5pysam_10libchtslib_5HFile_35tell(PyObject *__pyx_v_self,
10224 #if CYTHON_METH_FASTCALL
10225 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
10226 #else
10227 PyObject *__pyx_args, PyObject *__pyx_kwds
10228 #endif
10229 ) {
10230 #if !CYTHON_METH_FASTCALL
10231 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
10232 #endif
10233 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
10234 PyObject *__pyx_r = 0;
10235 __Pyx_RefNannyDeclarations
10236 __Pyx_RefNannySetupContext("tell (wrapper)", 0);
10237 #if !CYTHON_METH_FASTCALL
10238 #if CYTHON_ASSUME_SAFE_MACROS
10239 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
10240 #else
10241 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
10242 #endif
10243 #endif
10244 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
10245 if (unlikely(__pyx_nargs > 0)) {
10246 __Pyx_RaiseArgtupleInvalid("tell", 1, 0, 0, __pyx_nargs); return NULL;}
10247 if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "tell", 0))) return NULL;
10248 __pyx_r = __pyx_pf_5pysam_10libchtslib_5HFile_34tell(((struct __pyx_obj_5pysam_10libchtslib_HFile *)__pyx_v_self));
10249
10250 /* function exit code */
10251 __Pyx_RefNannyFinishContext();
10252 return __pyx_r;
10253 }
10254
10255 static PyObject *__pyx_pf_5pysam_10libchtslib_5HFile_34tell(struct __pyx_obj_5pysam_10libchtslib_HFile *__pyx_v_self) {
10256 off_t __pyx_v_ret;
10257 PyObject *__pyx_r = NULL;
10258 __Pyx_TraceDeclarations
10259 __Pyx_RefNannyDeclarations
10260 int __pyx_t_1;
10261 PyObject *__pyx_t_2 = NULL;
10262 PyObject *__pyx_t_3 = NULL;
10263 int __pyx_lineno = 0;
10264 const char *__pyx_filename = NULL;
10265 int __pyx_clineno = 0;
10266 __Pyx_TraceFrameInit(__pyx_codeobj__20)
10267 __Pyx_RefNannySetupContext("tell", 1);
10268 __Pyx_TraceCall("tell", __pyx_f[0], 255, 0, __PYX_ERR(0, 255, __pyx_L1_error));
10269
10270 /* "pysam/libchtslib.pyx":256
10271 *
10272 * def tell(self):
10273 * if self.fp == NULL: # <<<<<<<<<<<<<<
10274 * raise IOError('operation on closed HFile')
10275 *
10276 */
10277 __pyx_t_1 = (__pyx_v_self->fp == NULL);
10278 if (unlikely(__pyx_t_1)) {
10279
10280 /* "pysam/libchtslib.pyx":257
10281 * def tell(self):
10282 * if self.fp == NULL:
10283 * raise IOError('operation on closed HFile') # <<<<<<<<<<<<<<
10284 *
10285 * ret = htell(self.fp)
10286 */
10287 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 257, __pyx_L1_error)
10288 __Pyx_GOTREF(__pyx_t_2);
10289 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
10290 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10291 __PYX_ERR(0, 257, __pyx_L1_error)
10292
10293 /* "pysam/libchtslib.pyx":256
10294 *
10295 * def tell(self):
10296 * if self.fp == NULL: # <<<<<<<<<<<<<<
10297 * raise IOError('operation on closed HFile')
10298 *
10299 */
10300 }
10301
10302 /* "pysam/libchtslib.pyx":259
10303 * raise IOError('operation on closed HFile')
10304 *
10305 * ret = htell(self.fp) # <<<<<<<<<<<<<<
10306 *
10307 * if ret < 0:
10308 */
10309 __pyx_v_ret = htell(__pyx_v_self->fp);
10310
10311 /* "pysam/libchtslib.pyx":261
10312 * ret = htell(self.fp)
10313 *
10314 * if ret < 0: # <<<<<<<<<<<<<<
10315 * raise IOError(herrno(self.fp), 'tell failed on HFile', self.name)
10316 *
10317 */
10318 __pyx_t_1 = (__pyx_v_ret < 0);
10319 if (unlikely(__pyx_t_1)) {
10320
10321 /* "pysam/libchtslib.pyx":262
10322 *
10323 * if ret < 0:
10324 * raise IOError(herrno(self.fp), 'tell failed on HFile', self.name) # <<<<<<<<<<<<<<
10325 *
10326 * return ret
10327 */
10328 __pyx_t_2 = __Pyx_PyInt_From_int(herrno(__pyx_v_self->fp)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 262, __pyx_L1_error)
10329 __Pyx_GOTREF(__pyx_t_2);
10330 __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 262, __pyx_L1_error)
10331 __Pyx_GOTREF(__pyx_t_3);
10332 __Pyx_GIVEREF(__pyx_t_2);
10333 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2)) __PYX_ERR(0, 262, __pyx_L1_error);
10334 __Pyx_INCREF(__pyx_kp_u_tell_failed_on_HFile);
10335 __Pyx_GIVEREF(__pyx_kp_u_tell_failed_on_HFile);
10336 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_kp_u_tell_failed_on_HFile)) __PYX_ERR(0, 262, __pyx_L1_error);
10337 __Pyx_INCREF(__pyx_v_self->name);
10338 __Pyx_GIVEREF(__pyx_v_self->name);
10339 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_self->name)) __PYX_ERR(0, 262, __pyx_L1_error);
10340 __pyx_t_2 = 0;
10341 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 262, __pyx_L1_error)
10342 __Pyx_GOTREF(__pyx_t_2);
10343 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10344 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
10345 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10346 __PYX_ERR(0, 262, __pyx_L1_error)
10347
10348 /* "pysam/libchtslib.pyx":261
10349 * ret = htell(self.fp)
10350 *
10351 * if ret < 0: # <<<<<<<<<<<<<<
10352 * raise IOError(herrno(self.fp), 'tell failed on HFile', self.name)
10353 *
10354 */
10355 }
10356
10357 /* "pysam/libchtslib.pyx":264
10358 * raise IOError(herrno(self.fp), 'tell failed on HFile', self.name)
10359 *
10360 * return ret # <<<<<<<<<<<<<<
10361 *
10362 * def seekable(self):
10363 */
10364 __Pyx_XDECREF(__pyx_r);
10365 __pyx_t_2 = __Pyx_PyInt_From_off_t(__pyx_v_ret); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 264, __pyx_L1_error)
10366 __Pyx_GOTREF(__pyx_t_2);
10367 __pyx_r = __pyx_t_2;
10368 __pyx_t_2 = 0;
10369 goto __pyx_L0;
10370
10371 /* "pysam/libchtslib.pyx":255
10372 * return off
10373 *
10374 * def tell(self): # <<<<<<<<<<<<<<
10375 * if self.fp == NULL:
10376 * raise IOError('operation on closed HFile')
10377 */
10378
10379 /* function exit code */
10380 __pyx_L1_error:;
10381 __Pyx_XDECREF(__pyx_t_2);
10382 __Pyx_XDECREF(__pyx_t_3);
10383 __Pyx_AddTraceback("pysam.libchtslib.HFile.tell", __pyx_clineno, __pyx_lineno, __pyx_filename);
10384 __pyx_r = NULL;
10385 __pyx_L0:;
10386 __Pyx_XGIVEREF(__pyx_r);
10387 __Pyx_TraceReturn(__pyx_r, 0);
10388 __Pyx_RefNannyFinishContext();
10389 return __pyx_r;
10390 }
10391
10392 /* "pysam/libchtslib.pyx":266
10393 * return ret
10394 *
10395 * def seekable(self): # <<<<<<<<<<<<<<
10396 * return self.fp != NULL
10397 *
10398 */
10399
10400 /* Python wrapper */
10401 static PyObject *__pyx_pw_5pysam_10libchtslib_5HFile_37seekable(PyObject *__pyx_v_self,
10402 #if CYTHON_METH_FASTCALL
10403 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
10404 #else
10405 PyObject *__pyx_args, PyObject *__pyx_kwds
10406 #endif
10407 ); /*proto*/
10408 PyDoc_STRVAR(__pyx_doc_5pysam_10libchtslib_5HFile_36seekable, "HFile.seekable(self)");
10409 static PyMethodDef __pyx_mdef_5pysam_10libchtslib_5HFile_37seekable = {"seekable", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_5HFile_37seekable, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_5HFile_36seekable};
10410 static PyObject *__pyx_pw_5pysam_10libchtslib_5HFile_37seekable(PyObject *__pyx_v_self,
10411 #if CYTHON_METH_FASTCALL
10412 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
10413 #else
10414 PyObject *__pyx_args, PyObject *__pyx_kwds
10415 #endif
10416 ) {
10417 #if !CYTHON_METH_FASTCALL
10418 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
10419 #endif
10420 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
10421 PyObject *__pyx_r = 0;
10422 __Pyx_RefNannyDeclarations
10423 __Pyx_RefNannySetupContext("seekable (wrapper)", 0);
10424 #if !CYTHON_METH_FASTCALL
10425 #if CYTHON_ASSUME_SAFE_MACROS
10426 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
10427 #else
10428 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
10429 #endif
10430 #endif
10431 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
10432 if (unlikely(__pyx_nargs > 0)) {
10433 __Pyx_RaiseArgtupleInvalid("seekable", 1, 0, 0, __pyx_nargs); return NULL;}
10434 if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "seekable", 0))) return NULL;
10435 __pyx_r = __pyx_pf_5pysam_10libchtslib_5HFile_36seekable(((struct __pyx_obj_5pysam_10libchtslib_HFile *)__pyx_v_self));
10436
10437 /* function exit code */
10438 __Pyx_RefNannyFinishContext();
10439 return __pyx_r;
10440 }
10441
10442 static PyObject *__pyx_pf_5pysam_10libchtslib_5HFile_36seekable(struct __pyx_obj_5pysam_10libchtslib_HFile *__pyx_v_self) {
10443 PyObject *__pyx_r = NULL;
10444 __Pyx_TraceDeclarations
10445 __Pyx_RefNannyDeclarations
10446 PyObject *__pyx_t_1 = NULL;
10447 int __pyx_lineno = 0;
10448 const char *__pyx_filename = NULL;
10449 int __pyx_clineno = 0;
10450 __Pyx_TraceFrameInit(__pyx_codeobj__21)
10451 __Pyx_RefNannySetupContext("seekable", 1);
10452 __Pyx_TraceCall("seekable", __pyx_f[0], 266, 0, __PYX_ERR(0, 266, __pyx_L1_error));
10453
10454 /* "pysam/libchtslib.pyx":267
10455 *
10456 * def seekable(self):
10457 * return self.fp != NULL # <<<<<<<<<<<<<<
10458 *
10459 * def truncate(self, size=None):
10460 */
10461 __Pyx_XDECREF(__pyx_r);
10462 __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_self->fp != NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 267, __pyx_L1_error)
10463 __Pyx_GOTREF(__pyx_t_1);
10464 __pyx_r = __pyx_t_1;
10465 __pyx_t_1 = 0;
10466 goto __pyx_L0;
10467
10468 /* "pysam/libchtslib.pyx":266
10469 * return ret
10470 *
10471 * def seekable(self): # <<<<<<<<<<<<<<
10472 * return self.fp != NULL
10473 *
10474 */
10475
10476 /* function exit code */
10477 __pyx_L1_error:;
10478 __Pyx_XDECREF(__pyx_t_1);
10479 __Pyx_AddTraceback("pysam.libchtslib.HFile.seekable", __pyx_clineno, __pyx_lineno, __pyx_filename);
10480 __pyx_r = NULL;
10481 __pyx_L0:;
10482 __Pyx_XGIVEREF(__pyx_r);
10483 __Pyx_TraceReturn(__pyx_r, 0);
10484 __Pyx_RefNannyFinishContext();
10485 return __pyx_r;
10486 }
10487
10488 /* "pysam/libchtslib.pyx":269
10489 * return self.fp != NULL
10490 *
10491 * def truncate(self, size=None): # <<<<<<<<<<<<<<
10492 * raise NotImplementedError()
10493 *
10494 */
10495
10496 /* Python wrapper */
10497 static PyObject *__pyx_pw_5pysam_10libchtslib_5HFile_39truncate(PyObject *__pyx_v_self,
10498 #if CYTHON_METH_FASTCALL
10499 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
10500 #else
10501 PyObject *__pyx_args, PyObject *__pyx_kwds
10502 #endif
10503 ); /*proto*/
10504 PyDoc_STRVAR(__pyx_doc_5pysam_10libchtslib_5HFile_38truncate, "HFile.truncate(self, size=None)");
10505 static PyMethodDef __pyx_mdef_5pysam_10libchtslib_5HFile_39truncate = {"truncate", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_5HFile_39truncate, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_5HFile_38truncate};
10506 static PyObject *__pyx_pw_5pysam_10libchtslib_5HFile_39truncate(PyObject *__pyx_v_self,
10507 #if CYTHON_METH_FASTCALL
10508 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
10509 #else
10510 PyObject *__pyx_args, PyObject *__pyx_kwds
10511 #endif
10512 ) {
10513 CYTHON_UNUSED PyObject *__pyx_v_size = 0;
10514 #if !CYTHON_METH_FASTCALL
10515 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
10516 #endif
10517 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
10518 PyObject* values[1] = {0};
10519 int __pyx_lineno = 0;
10520 const char *__pyx_filename = NULL;
10521 int __pyx_clineno = 0;
10522 PyObject *__pyx_r = 0;
10523 __Pyx_RefNannyDeclarations
10524 __Pyx_RefNannySetupContext("truncate (wrapper)", 0);
10525 #if !CYTHON_METH_FASTCALL
10526 #if CYTHON_ASSUME_SAFE_MACROS
10527 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
10528 #else
10529 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
10530 #endif
10531 #endif
10532 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
10533 {
10534 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_size,0};
10535 values[0] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
10536 if (__pyx_kwds) {
10537 Py_ssize_t kw_args;
10538 switch (__pyx_nargs) {
10539 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
10540 CYTHON_FALLTHROUGH;
10541 case 0: break;
10542 default: goto __pyx_L5_argtuple_error;
10543 }
10544 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
10545 switch (__pyx_nargs) {
10546 case 0:
10547 if (kw_args > 0) {
10548 PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_size);
10549 if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
10550 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 269, __pyx_L3_error)
10551 }
10552 }
10553 if (unlikely(kw_args > 0)) {
10554 const Py_ssize_t kwd_pos_args = __pyx_nargs;
10555 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "truncate") < 0)) __PYX_ERR(0, 269, __pyx_L3_error)
10556 }
10557 } else {
10558 switch (__pyx_nargs) {
10559 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
10560 CYTHON_FALLTHROUGH;
10561 case 0: break;
10562 default: goto __pyx_L5_argtuple_error;
10563 }
10564 }
10565 __pyx_v_size = values[0];
10566 }
10567 goto __pyx_L6_skip;
10568 __pyx_L5_argtuple_error:;
10569 __Pyx_RaiseArgtupleInvalid("truncate", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 269, __pyx_L3_error)
10570 __pyx_L6_skip:;
10571 goto __pyx_L4_argument_unpacking_done;
10572 __pyx_L3_error:;
10573 {
10574 Py_ssize_t __pyx_temp;
10575 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
10576 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
10577 }
10578 }
10579 __Pyx_AddTraceback("pysam.libchtslib.HFile.truncate", __pyx_clineno, __pyx_lineno, __pyx_filename);
10580 __Pyx_RefNannyFinishContext();
10581 return NULL;
10582 __pyx_L4_argument_unpacking_done:;
10583 __pyx_r = __pyx_pf_5pysam_10libchtslib_5HFile_38truncate(((struct __pyx_obj_5pysam_10libchtslib_HFile *)__pyx_v_self), __pyx_v_size);
10584
10585 /* function exit code */
10586 {
10587 Py_ssize_t __pyx_temp;
10588 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
10589 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
10590 }
10591 }
10592 __Pyx_RefNannyFinishContext();
10593 return __pyx_r;
10594 }
10595
10596 static PyObject *__pyx_pf_5pysam_10libchtslib_5HFile_38truncate(CYTHON_UNUSED struct __pyx_obj_5pysam_10libchtslib_HFile *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_size) {
10597 PyObject *__pyx_r = NULL;
10598 __Pyx_TraceDeclarations
10599 __Pyx_RefNannyDeclarations
10600 PyObject *__pyx_t_1 = NULL;
10601 int __pyx_lineno = 0;
10602 const char *__pyx_filename = NULL;
10603 int __pyx_clineno = 0;
10604 __Pyx_TraceFrameInit(__pyx_codeobj__22)
10605 __Pyx_RefNannySetupContext("truncate", 1);
10606 __Pyx_TraceCall("truncate", __pyx_f[0], 269, 0, __PYX_ERR(0, 269, __pyx_L1_error));
10607
10608 /* "pysam/libchtslib.pyx":270
10609 *
10610 * def truncate(self, size=None):
10611 * raise NotImplementedError() # <<<<<<<<<<<<<<
10612 *
10613 * def writable(self):
10614 */
10615 __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_builtin_NotImplementedError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 270, __pyx_L1_error)
10616 __Pyx_GOTREF(__pyx_t_1);
10617 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
10618 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10619 __PYX_ERR(0, 270, __pyx_L1_error)
10620
10621 /* "pysam/libchtslib.pyx":269
10622 * return self.fp != NULL
10623 *
10624 * def truncate(self, size=None): # <<<<<<<<<<<<<<
10625 * raise NotImplementedError()
10626 *
10627 */
10628
10629 /* function exit code */
10630 __pyx_L1_error:;
10631 __Pyx_XDECREF(__pyx_t_1);
10632 __Pyx_AddTraceback("pysam.libchtslib.HFile.truncate", __pyx_clineno, __pyx_lineno, __pyx_filename);
10633 __pyx_r = NULL;
10634 __Pyx_XGIVEREF(__pyx_r);
10635 __Pyx_TraceReturn(__pyx_r, 0);
10636 __Pyx_RefNannyFinishContext();
10637 return __pyx_r;
10638 }
10639
10640 /* "pysam/libchtslib.pyx":272
10641 * raise NotImplementedError()
10642 *
10643 * def writable(self): # <<<<<<<<<<<<<<
10644 * return self.fp != NULL and 'w' in self.mode
10645 *
10646 */
10647
10648 /* Python wrapper */
10649 static PyObject *__pyx_pw_5pysam_10libchtslib_5HFile_41writable(PyObject *__pyx_v_self,
10650 #if CYTHON_METH_FASTCALL
10651 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
10652 #else
10653 PyObject *__pyx_args, PyObject *__pyx_kwds
10654 #endif
10655 ); /*proto*/
10656 PyDoc_STRVAR(__pyx_doc_5pysam_10libchtslib_5HFile_40writable, "HFile.writable(self)");
10657 static PyMethodDef __pyx_mdef_5pysam_10libchtslib_5HFile_41writable = {"writable", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_5HFile_41writable, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_5HFile_40writable};
10658 static PyObject *__pyx_pw_5pysam_10libchtslib_5HFile_41writable(PyObject *__pyx_v_self,
10659 #if CYTHON_METH_FASTCALL
10660 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
10661 #else
10662 PyObject *__pyx_args, PyObject *__pyx_kwds
10663 #endif
10664 ) {
10665 #if !CYTHON_METH_FASTCALL
10666 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
10667 #endif
10668 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
10669 PyObject *__pyx_r = 0;
10670 __Pyx_RefNannyDeclarations
10671 __Pyx_RefNannySetupContext("writable (wrapper)", 0);
10672 #if !CYTHON_METH_FASTCALL
10673 #if CYTHON_ASSUME_SAFE_MACROS
10674 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
10675 #else
10676 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
10677 #endif
10678 #endif
10679 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
10680 if (unlikely(__pyx_nargs > 0)) {
10681 __Pyx_RaiseArgtupleInvalid("writable", 1, 0, 0, __pyx_nargs); return NULL;}
10682 if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "writable", 0))) return NULL;
10683 __pyx_r = __pyx_pf_5pysam_10libchtslib_5HFile_40writable(((struct __pyx_obj_5pysam_10libchtslib_HFile *)__pyx_v_self));
10684
10685 /* function exit code */
10686 __Pyx_RefNannyFinishContext();
10687 return __pyx_r;
10688 }
10689
10690 static PyObject *__pyx_pf_5pysam_10libchtslib_5HFile_40writable(struct __pyx_obj_5pysam_10libchtslib_HFile *__pyx_v_self) {
10691 PyObject *__pyx_r = NULL;
10692 __Pyx_TraceDeclarations
10693 __Pyx_RefNannyDeclarations
10694 PyObject *__pyx_t_1 = NULL;
10695 int __pyx_t_2;
10696 PyObject *__pyx_t_3 = NULL;
10697 int __pyx_lineno = 0;
10698 const char *__pyx_filename = NULL;
10699 int __pyx_clineno = 0;
10700 __Pyx_TraceFrameInit(__pyx_codeobj__23)
10701 __Pyx_RefNannySetupContext("writable", 1);
10702 __Pyx_TraceCall("writable", __pyx_f[0], 272, 0, __PYX_ERR(0, 272, __pyx_L1_error));
10703
10704 /* "pysam/libchtslib.pyx":273
10705 *
10706 * def writable(self):
10707 * return self.fp != NULL and 'w' in self.mode # <<<<<<<<<<<<<<
10708 *
10709 * def write(self, bytes b):
10710 */
10711 __Pyx_XDECREF(__pyx_r);
10712 __pyx_t_2 = (__pyx_v_self->fp != NULL);
10713 if (__pyx_t_2) {
10714 } else {
10715 __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 273, __pyx_L1_error)
10716 __Pyx_GOTREF(__pyx_t_3);
10717 __pyx_t_1 = __pyx_t_3;
10718 __pyx_t_3 = 0;
10719 goto __pyx_L3_bool_binop_done;
10720 }
10721 __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_n_u_w, __pyx_v_self->mode, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 273, __pyx_L1_error)
10722 __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 273, __pyx_L1_error)
10723 __Pyx_GOTREF(__pyx_t_3);
10724 __pyx_t_1 = __pyx_t_3;
10725 __pyx_t_3 = 0;
10726 __pyx_L3_bool_binop_done:;
10727 __pyx_r = __pyx_t_1;
10728 __pyx_t_1 = 0;
10729 goto __pyx_L0;
10730
10731 /* "pysam/libchtslib.pyx":272
10732 * raise NotImplementedError()
10733 *
10734 * def writable(self): # <<<<<<<<<<<<<<
10735 * return self.fp != NULL and 'w' in self.mode
10736 *
10737 */
10738
10739 /* function exit code */
10740 __pyx_L1_error:;
10741 __Pyx_XDECREF(__pyx_t_1);
10742 __Pyx_XDECREF(__pyx_t_3);
10743 __Pyx_AddTraceback("pysam.libchtslib.HFile.writable", __pyx_clineno, __pyx_lineno, __pyx_filename);
10744 __pyx_r = NULL;
10745 __pyx_L0:;
10746 __Pyx_XGIVEREF(__pyx_r);
10747 __Pyx_TraceReturn(__pyx_r, 0);
10748 __Pyx_RefNannyFinishContext();
10749 return __pyx_r;
10750 }
10751
10752 /* "pysam/libchtslib.pyx":275
10753 * return self.fp != NULL and 'w' in self.mode
10754 *
10755 * def write(self, bytes b): # <<<<<<<<<<<<<<
10756 * if self.fp == NULL:
10757 * raise IOError('operation on closed HFile')
10758 */
10759
10760 /* Python wrapper */
10761 static PyObject *__pyx_pw_5pysam_10libchtslib_5HFile_43write(PyObject *__pyx_v_self,
10762 #if CYTHON_METH_FASTCALL
10763 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
10764 #else
10765 PyObject *__pyx_args, PyObject *__pyx_kwds
10766 #endif
10767 ); /*proto*/
10768 PyDoc_STRVAR(__pyx_doc_5pysam_10libchtslib_5HFile_42write, "HFile.write(self, bytes b)");
10769 static PyMethodDef __pyx_mdef_5pysam_10libchtslib_5HFile_43write = {"write", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_5HFile_43write, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_5HFile_42write};
10770 static PyObject *__pyx_pw_5pysam_10libchtslib_5HFile_43write(PyObject *__pyx_v_self,
10771 #if CYTHON_METH_FASTCALL
10772 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
10773 #else
10774 PyObject *__pyx_args, PyObject *__pyx_kwds
10775 #endif
10776 ) {
10777 PyObject *__pyx_v_b = 0;
10778 #if !CYTHON_METH_FASTCALL
10779 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
10780 #endif
10781 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
10782 PyObject* values[1] = {0};
10783 int __pyx_lineno = 0;
10784 const char *__pyx_filename = NULL;
10785 int __pyx_clineno = 0;
10786 PyObject *__pyx_r = 0;
10787 __Pyx_RefNannyDeclarations
10788 __Pyx_RefNannySetupContext("write (wrapper)", 0);
10789 #if !CYTHON_METH_FASTCALL
10790 #if CYTHON_ASSUME_SAFE_MACROS
10791 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
10792 #else
10793 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
10794 #endif
10795 #endif
10796 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
10797 {
10798 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_b,0};
10799 if (__pyx_kwds) {
10800 Py_ssize_t kw_args;
10801 switch (__pyx_nargs) {
10802 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
10803 CYTHON_FALLTHROUGH;
10804 case 0: break;
10805 default: goto __pyx_L5_argtuple_error;
10806 }
10807 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
10808 switch (__pyx_nargs) {
10809 case 0:
10810 if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_b)) != 0)) {
10811 (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
10812 kw_args--;
10813 }
10814 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 275, __pyx_L3_error)
10815 else goto __pyx_L5_argtuple_error;
10816 }
10817 if (unlikely(kw_args > 0)) {
10818 const Py_ssize_t kwd_pos_args = __pyx_nargs;
10819 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "write") < 0)) __PYX_ERR(0, 275, __pyx_L3_error)
10820 }
10821 } else if (unlikely(__pyx_nargs != 1)) {
10822 goto __pyx_L5_argtuple_error;
10823 } else {
10824 values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
10825 }
10826 __pyx_v_b = ((PyObject*)values[0]);
10827 }
10828 goto __pyx_L6_skip;
10829 __pyx_L5_argtuple_error:;
10830 __Pyx_RaiseArgtupleInvalid("write", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 275, __pyx_L3_error)
10831 __pyx_L6_skip:;
10832 goto __pyx_L4_argument_unpacking_done;
10833 __pyx_L3_error:;
10834 {
10835 Py_ssize_t __pyx_temp;
10836 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
10837 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
10838 }
10839 }
10840 __Pyx_AddTraceback("pysam.libchtslib.HFile.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
10841 __Pyx_RefNannyFinishContext();
10842 return NULL;
10843 __pyx_L4_argument_unpacking_done:;
10844 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_b), (&PyBytes_Type), 1, "b", 1))) __PYX_ERR(0, 275, __pyx_L1_error)
10845 __pyx_r = __pyx_pf_5pysam_10libchtslib_5HFile_42write(((struct __pyx_obj_5pysam_10libchtslib_HFile *)__pyx_v_self), __pyx_v_b);
10846
10847 /* function exit code */
10848 goto __pyx_L0;
10849 __pyx_L1_error:;
10850 __pyx_r = NULL;
10851 __pyx_L0:;
10852 {
10853 Py_ssize_t __pyx_temp;
10854 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
10855 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
10856 }
10857 }
10858 __Pyx_RefNannyFinishContext();
10859 return __pyx_r;
10860 }
10861
10862 static PyObject *__pyx_pf_5pysam_10libchtslib_5HFile_42write(struct __pyx_obj_5pysam_10libchtslib_HFile *__pyx_v_self, PyObject *__pyx_v_b) {
10863 Py_ssize_t __pyx_v_got;
10864 PyObject *__pyx_r = NULL;
10865 __Pyx_TraceDeclarations
10866 __Pyx_RefNannyDeclarations
10867 int __pyx_t_1;
10868 PyObject *__pyx_t_2 = NULL;
10869 Py_ssize_t __pyx_t_3;
10870 PyObject *__pyx_t_4 = NULL;
10871 int __pyx_lineno = 0;
10872 const char *__pyx_filename = NULL;
10873 int __pyx_clineno = 0;
10874 __Pyx_TraceFrameInit(__pyx_codeobj__24)
10875 __Pyx_RefNannySetupContext("write", 1);
10876 __Pyx_TraceCall("write", __pyx_f[0], 275, 0, __PYX_ERR(0, 275, __pyx_L1_error));
10877
10878 /* "pysam/libchtslib.pyx":276
10879 *
10880 * def write(self, bytes b):
10881 * if self.fp == NULL: # <<<<<<<<<<<<<<
10882 * raise IOError('operation on closed HFile')
10883 *
10884 */
10885 __pyx_t_1 = (__pyx_v_self->fp == NULL);
10886 if (unlikely(__pyx_t_1)) {
10887
10888 /* "pysam/libchtslib.pyx":277
10889 * def write(self, bytes b):
10890 * if self.fp == NULL:
10891 * raise IOError('operation on closed HFile') # <<<<<<<<<<<<<<
10892 *
10893 * got = hwrite(self.fp, <void *>b, len(b))
10894 */
10895 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 277, __pyx_L1_error)
10896 __Pyx_GOTREF(__pyx_t_2);
10897 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
10898 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10899 __PYX_ERR(0, 277, __pyx_L1_error)
10900
10901 /* "pysam/libchtslib.pyx":276
10902 *
10903 * def write(self, bytes b):
10904 * if self.fp == NULL: # <<<<<<<<<<<<<<
10905 * raise IOError('operation on closed HFile')
10906 *
10907 */
10908 }
10909
10910 /* "pysam/libchtslib.pyx":279
10911 * raise IOError('operation on closed HFile')
10912 *
10913 * got = hwrite(self.fp, <void *>b, len(b)) # <<<<<<<<<<<<<<
10914 *
10915 * if got < 0:
10916 */
10917 if (unlikely(__pyx_v_b == Py_None)) {
10918 PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
10919 __PYX_ERR(0, 279, __pyx_L1_error)
10920 }
10921 __pyx_t_3 = __Pyx_PyBytes_GET_SIZE(__pyx_v_b); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 279, __pyx_L1_error)
10922 __pyx_v_got = hwrite(__pyx_v_self->fp, ((void *)__pyx_v_b), __pyx_t_3);
10923
10924 /* "pysam/libchtslib.pyx":281
10925 * got = hwrite(self.fp, <void *>b, len(b))
10926 *
10927 * if got < 0: # <<<<<<<<<<<<<<
10928 * raise IOError(herrno(self.fp), 'write failed on HFile', self.name)
10929 *
10930 */
10931 __pyx_t_1 = (__pyx_v_got < 0);
10932 if (unlikely(__pyx_t_1)) {
10933
10934 /* "pysam/libchtslib.pyx":282
10935 *
10936 * if got < 0:
10937 * raise IOError(herrno(self.fp), 'write failed on HFile', self.name) # <<<<<<<<<<<<<<
10938 *
10939 * return got
10940 */
10941 __pyx_t_2 = __Pyx_PyInt_From_int(herrno(__pyx_v_self->fp)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 282, __pyx_L1_error)
10942 __Pyx_GOTREF(__pyx_t_2);
10943 __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 282, __pyx_L1_error)
10944 __Pyx_GOTREF(__pyx_t_4);
10945 __Pyx_GIVEREF(__pyx_t_2);
10946 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2)) __PYX_ERR(0, 282, __pyx_L1_error);
10947 __Pyx_INCREF(__pyx_kp_u_write_failed_on_HFile);
10948 __Pyx_GIVEREF(__pyx_kp_u_write_failed_on_HFile);
10949 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_kp_u_write_failed_on_HFile)) __PYX_ERR(0, 282, __pyx_L1_error);
10950 __Pyx_INCREF(__pyx_v_self->name);
10951 __Pyx_GIVEREF(__pyx_v_self->name);
10952 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_self->name)) __PYX_ERR(0, 282, __pyx_L1_error);
10953 __pyx_t_2 = 0;
10954 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 282, __pyx_L1_error)
10955 __Pyx_GOTREF(__pyx_t_2);
10956 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10957 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
10958 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10959 __PYX_ERR(0, 282, __pyx_L1_error)
10960
10961 /* "pysam/libchtslib.pyx":281
10962 * got = hwrite(self.fp, <void *>b, len(b))
10963 *
10964 * if got < 0: # <<<<<<<<<<<<<<
10965 * raise IOError(herrno(self.fp), 'write failed on HFile', self.name)
10966 *
10967 */
10968 }
10969
10970 /* "pysam/libchtslib.pyx":284
10971 * raise IOError(herrno(self.fp), 'write failed on HFile', self.name)
10972 *
10973 * return got # <<<<<<<<<<<<<<
10974 *
10975 * def writelines(self, lines):
10976 */
10977 __Pyx_XDECREF(__pyx_r);
10978 __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_got); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 284, __pyx_L1_error)
10979 __Pyx_GOTREF(__pyx_t_2);
10980 __pyx_r = __pyx_t_2;
10981 __pyx_t_2 = 0;
10982 goto __pyx_L0;
10983
10984 /* "pysam/libchtslib.pyx":275
10985 * return self.fp != NULL and 'w' in self.mode
10986 *
10987 * def write(self, bytes b): # <<<<<<<<<<<<<<
10988 * if self.fp == NULL:
10989 * raise IOError('operation on closed HFile')
10990 */
10991
10992 /* function exit code */
10993 __pyx_L1_error:;
10994 __Pyx_XDECREF(__pyx_t_2);
10995 __Pyx_XDECREF(__pyx_t_4);
10996 __Pyx_AddTraceback("pysam.libchtslib.HFile.write", __pyx_clineno, __pyx_lineno, __pyx_filename);
10997 __pyx_r = NULL;
10998 __pyx_L0:;
10999 __Pyx_XGIVEREF(__pyx_r);
11000 __Pyx_TraceReturn(__pyx_r, 0);
11001 __Pyx_RefNannyFinishContext();
11002 return __pyx_r;
11003 }
11004
11005 /* "pysam/libchtslib.pyx":286
11006 * return got
11007 *
11008 * def writelines(self, lines): # <<<<<<<<<<<<<<
11009 * for line in lines:
11010 * self.write(line)
11011 */
11012
11013 /* Python wrapper */
11014 static PyObject *__pyx_pw_5pysam_10libchtslib_5HFile_45writelines(PyObject *__pyx_v_self,
11015 #if CYTHON_METH_FASTCALL
11016 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
11017 #else
11018 PyObject *__pyx_args, PyObject *__pyx_kwds
11019 #endif
11020 ); /*proto*/
11021 PyDoc_STRVAR(__pyx_doc_5pysam_10libchtslib_5HFile_44writelines, "HFile.writelines(self, lines)");
11022 static PyMethodDef __pyx_mdef_5pysam_10libchtslib_5HFile_45writelines = {"writelines", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_5HFile_45writelines, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_5HFile_44writelines};
11023 static PyObject *__pyx_pw_5pysam_10libchtslib_5HFile_45writelines(PyObject *__pyx_v_self,
11024 #if CYTHON_METH_FASTCALL
11025 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
11026 #else
11027 PyObject *__pyx_args, PyObject *__pyx_kwds
11028 #endif
11029 ) {
11030 PyObject *__pyx_v_lines = 0;
11031 #if !CYTHON_METH_FASTCALL
11032 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
11033 #endif
11034 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
11035 PyObject* values[1] = {0};
11036 int __pyx_lineno = 0;
11037 const char *__pyx_filename = NULL;
11038 int __pyx_clineno = 0;
11039 PyObject *__pyx_r = 0;
11040 __Pyx_RefNannyDeclarations
11041 __Pyx_RefNannySetupContext("writelines (wrapper)", 0);
11042 #if !CYTHON_METH_FASTCALL
11043 #if CYTHON_ASSUME_SAFE_MACROS
11044 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
11045 #else
11046 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
11047 #endif
11048 #endif
11049 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
11050 {
11051 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_lines,0};
11052 if (__pyx_kwds) {
11053 Py_ssize_t kw_args;
11054 switch (__pyx_nargs) {
11055 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
11056 CYTHON_FALLTHROUGH;
11057 case 0: break;
11058 default: goto __pyx_L5_argtuple_error;
11059 }
11060 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
11061 switch (__pyx_nargs) {
11062 case 0:
11063 if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_lines)) != 0)) {
11064 (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
11065 kw_args--;
11066 }
11067 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 286, __pyx_L3_error)
11068 else goto __pyx_L5_argtuple_error;
11069 }
11070 if (unlikely(kw_args > 0)) {
11071 const Py_ssize_t kwd_pos_args = __pyx_nargs;
11072 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "writelines") < 0)) __PYX_ERR(0, 286, __pyx_L3_error)
11073 }
11074 } else if (unlikely(__pyx_nargs != 1)) {
11075 goto __pyx_L5_argtuple_error;
11076 } else {
11077 values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
11078 }
11079 __pyx_v_lines = values[0];
11080 }
11081 goto __pyx_L6_skip;
11082 __pyx_L5_argtuple_error:;
11083 __Pyx_RaiseArgtupleInvalid("writelines", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 286, __pyx_L3_error)
11084 __pyx_L6_skip:;
11085 goto __pyx_L4_argument_unpacking_done;
11086 __pyx_L3_error:;
11087 {
11088 Py_ssize_t __pyx_temp;
11089 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
11090 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
11091 }
11092 }
11093 __Pyx_AddTraceback("pysam.libchtslib.HFile.writelines", __pyx_clineno, __pyx_lineno, __pyx_filename);
11094 __Pyx_RefNannyFinishContext();
11095 return NULL;
11096 __pyx_L4_argument_unpacking_done:;
11097 __pyx_r = __pyx_pf_5pysam_10libchtslib_5HFile_44writelines(((struct __pyx_obj_5pysam_10libchtslib_HFile *)__pyx_v_self), __pyx_v_lines);
11098
11099 /* function exit code */
11100 {
11101 Py_ssize_t __pyx_temp;
11102 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
11103 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
11104 }
11105 }
11106 __Pyx_RefNannyFinishContext();
11107 return __pyx_r;
11108 }
11109
11110 static PyObject *__pyx_pf_5pysam_10libchtslib_5HFile_44writelines(struct __pyx_obj_5pysam_10libchtslib_HFile *__pyx_v_self, PyObject *__pyx_v_lines) {
11111 PyObject *__pyx_v_line = NULL;
11112 PyObject *__pyx_r = NULL;
11113 __Pyx_TraceDeclarations
11114 __Pyx_RefNannyDeclarations
11115 PyObject *__pyx_t_1 = NULL;
11116 Py_ssize_t __pyx_t_2;
11117 PyObject *(*__pyx_t_3)(PyObject *);
11118 PyObject *__pyx_t_4 = NULL;
11119 PyObject *__pyx_t_5 = NULL;
11120 PyObject *__pyx_t_6 = NULL;
11121 unsigned int __pyx_t_7;
11122 int __pyx_lineno = 0;
11123 const char *__pyx_filename = NULL;
11124 int __pyx_clineno = 0;
11125 __Pyx_TraceFrameInit(__pyx_codeobj__25)
11126 __Pyx_RefNannySetupContext("writelines", 1);
11127 __Pyx_TraceCall("writelines", __pyx_f[0], 286, 0, __PYX_ERR(0, 286, __pyx_L1_error));
11128
11129 /* "pysam/libchtslib.pyx":287
11130 *
11131 * def writelines(self, lines):
11132 * for line in lines: # <<<<<<<<<<<<<<
11133 * self.write(line)
11134 *
11135 */
11136 if (likely(PyList_CheckExact(__pyx_v_lines)) || PyTuple_CheckExact(__pyx_v_lines)) {
11137 __pyx_t_1 = __pyx_v_lines; __Pyx_INCREF(__pyx_t_1);
11138 __pyx_t_2 = 0;
11139 __pyx_t_3 = NULL;
11140 } else {
11141 __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_lines); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 287, __pyx_L1_error)
11142 __Pyx_GOTREF(__pyx_t_1);
11143 __pyx_t_3 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 287, __pyx_L1_error)
11144 }
11145 for (;;) {
11146 if (likely(!__pyx_t_3)) {
11147 if (likely(PyList_CheckExact(__pyx_t_1))) {
11148 {
11149 Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
11150 #if !CYTHON_ASSUME_SAFE_MACROS
11151 if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 287, __pyx_L1_error)
11152 #endif
11153 if (__pyx_t_2 >= __pyx_temp) break;
11154 }
11155 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
11156 __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(0, 287, __pyx_L1_error)
11157 #else
11158 __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 287, __pyx_L1_error)
11159 __Pyx_GOTREF(__pyx_t_4);
11160 #endif
11161 } else {
11162 {
11163 Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
11164 #if !CYTHON_ASSUME_SAFE_MACROS
11165 if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 287, __pyx_L1_error)
11166 #endif
11167 if (__pyx_t_2 >= __pyx_temp) break;
11168 }
11169 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
11170 __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(0, 287, __pyx_L1_error)
11171 #else
11172 __pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 287, __pyx_L1_error)
11173 __Pyx_GOTREF(__pyx_t_4);
11174 #endif
11175 }
11176 } else {
11177 __pyx_t_4 = __pyx_t_3(__pyx_t_1);
11178 if (unlikely(!__pyx_t_4)) {
11179 PyObject* exc_type = PyErr_Occurred();
11180 if (exc_type) {
11181 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
11182 else __PYX_ERR(0, 287, __pyx_L1_error)
11183 }
11184 break;
11185 }
11186 __Pyx_GOTREF(__pyx_t_4);
11187 }
11188 __Pyx_XDECREF_SET(__pyx_v_line, __pyx_t_4);
11189 __pyx_t_4 = 0;
11190
11191 /* "pysam/libchtslib.pyx":288
11192 * def writelines(self, lines):
11193 * for line in lines:
11194 * self.write(line) # <<<<<<<<<<<<<<
11195 *
11196 *
11197 */
11198 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_write); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 288, __pyx_L1_error)
11199 __Pyx_GOTREF(__pyx_t_5);
11200 __pyx_t_6 = NULL;
11201 __pyx_t_7 = 0;
11202 #if CYTHON_UNPACK_METHODS
11203 if (likely(PyMethod_Check(__pyx_t_5))) {
11204 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
11205 if (likely(__pyx_t_6)) {
11206 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
11207 __Pyx_INCREF(__pyx_t_6);
11208 __Pyx_INCREF(function);
11209 __Pyx_DECREF_SET(__pyx_t_5, function);
11210 __pyx_t_7 = 1;
11211 }
11212 }
11213 #endif
11214 {
11215 PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_v_line};
11216 __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
11217 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
11218 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 288, __pyx_L1_error)
11219 __Pyx_GOTREF(__pyx_t_4);
11220 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11221 }
11222 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11223
11224 /* "pysam/libchtslib.pyx":287
11225 *
11226 * def writelines(self, lines):
11227 * for line in lines: # <<<<<<<<<<<<<<
11228 * self.write(line)
11229 *
11230 */
11231 }
11232 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11233
11234 /* "pysam/libchtslib.pyx":286
11235 * return got
11236 *
11237 * def writelines(self, lines): # <<<<<<<<<<<<<<
11238 * for line in lines:
11239 * self.write(line)
11240 */
11241
11242 /* function exit code */
11243 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
11244 goto __pyx_L0;
11245 __pyx_L1_error:;
11246 __Pyx_XDECREF(__pyx_t_1);
11247 __Pyx_XDECREF(__pyx_t_4);
11248 __Pyx_XDECREF(__pyx_t_5);
11249 __Pyx_XDECREF(__pyx_t_6);
11250 __Pyx_AddTraceback("pysam.libchtslib.HFile.writelines", __pyx_clineno, __pyx_lineno, __pyx_filename);
11251 __pyx_r = NULL;
11252 __pyx_L0:;
11253 __Pyx_XDECREF(__pyx_v_line);
11254 __Pyx_XGIVEREF(__pyx_r);
11255 __Pyx_TraceReturn(__pyx_r, 0);
11256 __Pyx_RefNannyFinishContext();
11257 return __pyx_r;
11258 }
11259
11260 /* "pysam/libchtslib.pyx":69
11261 * cdef class HFile(object):
11262 * cdef hFILE *fp
11263 * cdef readonly object name, mode # <<<<<<<<<<<<<<
11264 *
11265 * def __init__(self, name, mode='r', closefd=True):
11266 */
11267
11268 /* Python wrapper */
11269 static PyObject *__pyx_pw_5pysam_10libchtslib_5HFile_4name_1__get__(PyObject *__pyx_v_self); /*proto*/
11270 static PyObject *__pyx_pw_5pysam_10libchtslib_5HFile_4name_1__get__(PyObject *__pyx_v_self) {
11271 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
11272 PyObject *__pyx_r = 0;
11273 __Pyx_RefNannyDeclarations
11274 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
11275 __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
11276 __pyx_r = __pyx_pf_5pysam_10libchtslib_5HFile_4name___get__(((struct __pyx_obj_5pysam_10libchtslib_HFile *)__pyx_v_self));
11277
11278 /* function exit code */
11279 __Pyx_RefNannyFinishContext();
11280 return __pyx_r;
11281 }
11282
11283 static PyObject *__pyx_pf_5pysam_10libchtslib_5HFile_4name___get__(struct __pyx_obj_5pysam_10libchtslib_HFile *__pyx_v_self) {
11284 PyObject *__pyx_r = NULL;
11285 __Pyx_TraceDeclarations
11286 __Pyx_RefNannyDeclarations
11287 int __pyx_lineno = 0;
11288 const char *__pyx_filename = NULL;
11289 int __pyx_clineno = 0;
11290 __Pyx_RefNannySetupContext("__get__", 1);
11291 __Pyx_TraceCall("__get__", __pyx_f[0], 69, 0, __PYX_ERR(0, 69, __pyx_L1_error));
11292 __Pyx_XDECREF(__pyx_r);
11293 __Pyx_INCREF(__pyx_v_self->name);
11294 __pyx_r = __pyx_v_self->name;
11295 goto __pyx_L0;
11296
11297 /* function exit code */
11298 __pyx_L1_error:;
11299 __Pyx_AddTraceback("pysam.libchtslib.HFile.name.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11300 __pyx_r = NULL;
11301 __pyx_L0:;
11302 __Pyx_XGIVEREF(__pyx_r);
11303 __Pyx_TraceReturn(__pyx_r, 0);
11304 __Pyx_RefNannyFinishContext();
11305 return __pyx_r;
11306 }
11307
11308 /* Python wrapper */
11309 static PyObject *__pyx_pw_5pysam_10libchtslib_5HFile_4mode_1__get__(PyObject *__pyx_v_self); /*proto*/
11310 static PyObject *__pyx_pw_5pysam_10libchtslib_5HFile_4mode_1__get__(PyObject *__pyx_v_self) {
11311 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
11312 PyObject *__pyx_r = 0;
11313 __Pyx_RefNannyDeclarations
11314 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
11315 __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
11316 __pyx_r = __pyx_pf_5pysam_10libchtslib_5HFile_4mode___get__(((struct __pyx_obj_5pysam_10libchtslib_HFile *)__pyx_v_self));
11317
11318 /* function exit code */
11319 __Pyx_RefNannyFinishContext();
11320 return __pyx_r;
11321 }
11322
11323 static PyObject *__pyx_pf_5pysam_10libchtslib_5HFile_4mode___get__(struct __pyx_obj_5pysam_10libchtslib_HFile *__pyx_v_self) {
11324 PyObject *__pyx_r = NULL;
11325 __Pyx_TraceDeclarations
11326 __Pyx_RefNannyDeclarations
11327 int __pyx_lineno = 0;
11328 const char *__pyx_filename = NULL;
11329 int __pyx_clineno = 0;
11330 __Pyx_RefNannySetupContext("__get__", 1);
11331 __Pyx_TraceCall("__get__", __pyx_f[0], 69, 0, __PYX_ERR(0, 69, __pyx_L1_error));
11332 __Pyx_XDECREF(__pyx_r);
11333 __Pyx_INCREF(__pyx_v_self->mode);
11334 __pyx_r = __pyx_v_self->mode;
11335 goto __pyx_L0;
11336
11337 /* function exit code */
11338 __pyx_L1_error:;
11339 __Pyx_AddTraceback("pysam.libchtslib.HFile.mode.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11340 __pyx_r = NULL;
11341 __pyx_L0:;
11342 __Pyx_XGIVEREF(__pyx_r);
11343 __Pyx_TraceReturn(__pyx_r, 0);
11344 __Pyx_RefNannyFinishContext();
11345 return __pyx_r;
11346 }
11347
11348 /* "(tree fragment)":1
11349 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
11350 * raise TypeError, "self.fp cannot be converted to a Python object for pickling"
11351 * def __setstate_cython__(self, __pyx_state):
11352 */
11353
11354 /* Python wrapper */
11355 static PyObject *__pyx_pw_5pysam_10libchtslib_5HFile_47__reduce_cython__(PyObject *__pyx_v_self,
11356 #if CYTHON_METH_FASTCALL
11357 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
11358 #else
11359 PyObject *__pyx_args, PyObject *__pyx_kwds
11360 #endif
11361 ); /*proto*/
11362 PyDoc_STRVAR(__pyx_doc_5pysam_10libchtslib_5HFile_46__reduce_cython__, "HFile.__reduce_cython__(self)");
11363 static PyMethodDef __pyx_mdef_5pysam_10libchtslib_5HFile_47__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_5HFile_47__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_5HFile_46__reduce_cython__};
11364 static PyObject *__pyx_pw_5pysam_10libchtslib_5HFile_47__reduce_cython__(PyObject *__pyx_v_self,
11365 #if CYTHON_METH_FASTCALL
11366 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
11367 #else
11368 PyObject *__pyx_args, PyObject *__pyx_kwds
11369 #endif
11370 ) {
11371 #if !CYTHON_METH_FASTCALL
11372 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
11373 #endif
11374 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
11375 PyObject *__pyx_r = 0;
11376 __Pyx_RefNannyDeclarations
11377 __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
11378 #if !CYTHON_METH_FASTCALL
11379 #if CYTHON_ASSUME_SAFE_MACROS
11380 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
11381 #else
11382 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
11383 #endif
11384 #endif
11385 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
11386 if (unlikely(__pyx_nargs > 0)) {
11387 __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL;}
11388 if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) return NULL;
11389 __pyx_r = __pyx_pf_5pysam_10libchtslib_5HFile_46__reduce_cython__(((struct __pyx_obj_5pysam_10libchtslib_HFile *)__pyx_v_self));
11390
11391 /* function exit code */
11392 __Pyx_RefNannyFinishContext();
11393 return __pyx_r;
11394 }
11395
11396 static PyObject *__pyx_pf_5pysam_10libchtslib_5HFile_46__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5pysam_10libchtslib_HFile *__pyx_v_self) {
11397 PyObject *__pyx_r = NULL;
11398 __Pyx_TraceDeclarations
11399 __Pyx_RefNannyDeclarations
11400 int __pyx_lineno = 0;
11401 const char *__pyx_filename = NULL;
11402 int __pyx_clineno = 0;
11403 __Pyx_TraceFrameInit(__pyx_codeobj__26)
11404 __Pyx_RefNannySetupContext("__reduce_cython__", 1);
11405 __Pyx_TraceCall("__reduce_cython__", __pyx_f[1], 1, 0, __PYX_ERR(1, 1, __pyx_L1_error));
11406
11407 /* "(tree fragment)":2
11408 * def __reduce_cython__(self):
11409 * raise TypeError, "self.fp cannot be converted to a Python object for pickling" # <<<<<<<<<<<<<<
11410 * def __setstate_cython__(self, __pyx_state):
11411 * raise TypeError, "self.fp cannot be converted to a Python object for pickling"
11412 */
11413 __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_self_fp_cannot_be_converted_to_a, 0, 0);
11414 __PYX_ERR(1, 2, __pyx_L1_error)
11415
11416 /* "(tree fragment)":1
11417 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
11418 * raise TypeError, "self.fp cannot be converted to a Python object for pickling"
11419 * def __setstate_cython__(self, __pyx_state):
11420 */
11421
11422 /* function exit code */
11423 __pyx_L1_error:;
11424 __Pyx_AddTraceback("pysam.libchtslib.HFile.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11425 __pyx_r = NULL;
11426 __Pyx_XGIVEREF(__pyx_r);
11427 __Pyx_TraceReturn(__pyx_r, 0);
11428 __Pyx_RefNannyFinishContext();
11429 return __pyx_r;
11430 }
11431
11432 /* "(tree fragment)":3
11433 * def __reduce_cython__(self):
11434 * raise TypeError, "self.fp cannot be converted to a Python object for pickling"
11435 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
11436 * raise TypeError, "self.fp cannot be converted to a Python object for pickling"
11437 */
11438
11439 /* Python wrapper */
11440 static PyObject *__pyx_pw_5pysam_10libchtslib_5HFile_49__setstate_cython__(PyObject *__pyx_v_self,
11441 #if CYTHON_METH_FASTCALL
11442 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
11443 #else
11444 PyObject *__pyx_args, PyObject *__pyx_kwds
11445 #endif
11446 ); /*proto*/
11447 PyDoc_STRVAR(__pyx_doc_5pysam_10libchtslib_5HFile_48__setstate_cython__, "HFile.__setstate_cython__(self, __pyx_state)");
11448 static PyMethodDef __pyx_mdef_5pysam_10libchtslib_5HFile_49__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_5HFile_49__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_5HFile_48__setstate_cython__};
11449 static PyObject *__pyx_pw_5pysam_10libchtslib_5HFile_49__setstate_cython__(PyObject *__pyx_v_self,
11450 #if CYTHON_METH_FASTCALL
11451 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
11452 #else
11453 PyObject *__pyx_args, PyObject *__pyx_kwds
11454 #endif
11455 ) {
11456 CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
11457 #if !CYTHON_METH_FASTCALL
11458 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
11459 #endif
11460 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
11461 PyObject* values[1] = {0};
11462 int __pyx_lineno = 0;
11463 const char *__pyx_filename = NULL;
11464 int __pyx_clineno = 0;
11465 PyObject *__pyx_r = 0;
11466 __Pyx_RefNannyDeclarations
11467 __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
11468 #if !CYTHON_METH_FASTCALL
11469 #if CYTHON_ASSUME_SAFE_MACROS
11470 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
11471 #else
11472 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
11473 #endif
11474 #endif
11475 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
11476 {
11477 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0};
11478 if (__pyx_kwds) {
11479 Py_ssize_t kw_args;
11480 switch (__pyx_nargs) {
11481 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
11482 CYTHON_FALLTHROUGH;
11483 case 0: break;
11484 default: goto __pyx_L5_argtuple_error;
11485 }
11486 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
11487 switch (__pyx_nargs) {
11488 case 0:
11489 if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) {
11490 (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
11491 kw_args--;
11492 }
11493 else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 3, __pyx_L3_error)
11494 else goto __pyx_L5_argtuple_error;
11495 }
11496 if (unlikely(kw_args > 0)) {
11497 const Py_ssize_t kwd_pos_args = __pyx_nargs;
11498 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(1, 3, __pyx_L3_error)
11499 }
11500 } else if (unlikely(__pyx_nargs != 1)) {
11501 goto __pyx_L5_argtuple_error;
11502 } else {
11503 values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
11504 }
11505 __pyx_v___pyx_state = values[0];
11506 }
11507 goto __pyx_L6_skip;
11508 __pyx_L5_argtuple_error:;
11509 __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error)
11510 __pyx_L6_skip:;
11511 goto __pyx_L4_argument_unpacking_done;
11512 __pyx_L3_error:;
11513 {
11514 Py_ssize_t __pyx_temp;
11515 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
11516 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
11517 }
11518 }
11519 __Pyx_AddTraceback("pysam.libchtslib.HFile.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11520 __Pyx_RefNannyFinishContext();
11521 return NULL;
11522 __pyx_L4_argument_unpacking_done:;
11523 __pyx_r = __pyx_pf_5pysam_10libchtslib_5HFile_48__setstate_cython__(((struct __pyx_obj_5pysam_10libchtslib_HFile *)__pyx_v_self), __pyx_v___pyx_state);
11524
11525 /* function exit code */
11526 {
11527 Py_ssize_t __pyx_temp;
11528 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
11529 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
11530 }
11531 }
11532 __Pyx_RefNannyFinishContext();
11533 return __pyx_r;
11534 }
11535
11536 static PyObject *__pyx_pf_5pysam_10libchtslib_5HFile_48__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5pysam_10libchtslib_HFile *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
11537 PyObject *__pyx_r = NULL;
11538 __Pyx_TraceDeclarations
11539 __Pyx_RefNannyDeclarations
11540 int __pyx_lineno = 0;
11541 const char *__pyx_filename = NULL;
11542 int __pyx_clineno = 0;
11543 __Pyx_TraceFrameInit(__pyx_codeobj__27)
11544 __Pyx_RefNannySetupContext("__setstate_cython__", 1);
11545 __Pyx_TraceCall("__setstate_cython__", __pyx_f[1], 3, 0, __PYX_ERR(1, 3, __pyx_L1_error));
11546
11547 /* "(tree fragment)":4
11548 * raise TypeError, "self.fp cannot be converted to a Python object for pickling"
11549 * def __setstate_cython__(self, __pyx_state):
11550 * raise TypeError, "self.fp cannot be converted to a Python object for pickling" # <<<<<<<<<<<<<<
11551 */
11552 __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_self_fp_cannot_be_converted_to_a, 0, 0);
11553 __PYX_ERR(1, 4, __pyx_L1_error)
11554
11555 /* "(tree fragment)":3
11556 * def __reduce_cython__(self):
11557 * raise TypeError, "self.fp cannot be converted to a Python object for pickling"
11558 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
11559 * raise TypeError, "self.fp cannot be converted to a Python object for pickling"
11560 */
11561
11562 /* function exit code */
11563 __pyx_L1_error:;
11564 __Pyx_AddTraceback("pysam.libchtslib.HFile.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11565 __pyx_r = NULL;
11566 __Pyx_XGIVEREF(__pyx_r);
11567 __Pyx_TraceReturn(__pyx_r, 0);
11568 __Pyx_RefNannyFinishContext();
11569 return __pyx_r;
11570 }
11571
11572 /* "pysam/libchtslib.pyx":298
11573 *
11574 * class CallableValue(object):
11575 * def __init__(self, value): # <<<<<<<<<<<<<<
11576 * self.value = value
11577 * def __call__(self):
11578 */
11579
11580 /* Python wrapper */
11581 static PyObject *__pyx_pw_5pysam_10libchtslib_13CallableValue_1__init__(PyObject *__pyx_self,
11582 #if CYTHON_METH_FASTCALL
11583 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
11584 #else
11585 PyObject *__pyx_args, PyObject *__pyx_kwds
11586 #endif
11587 ); /*proto*/
11588 PyDoc_STRVAR(__pyx_doc_5pysam_10libchtslib_13CallableValue___init__, "CallableValue.__init__(self, value)");
11589 static PyMethodDef __pyx_mdef_5pysam_10libchtslib_13CallableValue_1__init__ = {"__init__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_13CallableValue_1__init__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_13CallableValue___init__};
11590 static PyObject *__pyx_pw_5pysam_10libchtslib_13CallableValue_1__init__(PyObject *__pyx_self,
11591 #if CYTHON_METH_FASTCALL
11592 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
11593 #else
11594 PyObject *__pyx_args, PyObject *__pyx_kwds
11595 #endif
11596 ) {
11597 PyObject *__pyx_v_self = 0;
11598 PyObject *__pyx_v_value = 0;
11599 #if !CYTHON_METH_FASTCALL
11600 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
11601 #endif
11602 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
11603 PyObject* values[2] = {0,0};
11604 int __pyx_lineno = 0;
11605 const char *__pyx_filename = NULL;
11606 int __pyx_clineno = 0;
11607 PyObject *__pyx_r = 0;
11608 __Pyx_RefNannyDeclarations
11609 __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
11610 #if !CYTHON_METH_FASTCALL
11611 #if CYTHON_ASSUME_SAFE_MACROS
11612 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
11613 #else
11614 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
11615 #endif
11616 #endif
11617 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
11618 {
11619 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_value,0};
11620 if (__pyx_kwds) {
11621 Py_ssize_t kw_args;
11622 switch (__pyx_nargs) {
11623 case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
11624 CYTHON_FALLTHROUGH;
11625 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
11626 CYTHON_FALLTHROUGH;
11627 case 0: break;
11628 default: goto __pyx_L5_argtuple_error;
11629 }
11630 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
11631 switch (__pyx_nargs) {
11632 case 0:
11633 if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_self)) != 0)) {
11634 (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
11635 kw_args--;
11636 }
11637 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 298, __pyx_L3_error)
11638 else goto __pyx_L5_argtuple_error;
11639 CYTHON_FALLTHROUGH;
11640 case 1:
11641 if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_value)) != 0)) {
11642 (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
11643 kw_args--;
11644 }
11645 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 298, __pyx_L3_error)
11646 else {
11647 __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 298, __pyx_L3_error)
11648 }
11649 }
11650 if (unlikely(kw_args > 0)) {
11651 const Py_ssize_t kwd_pos_args = __pyx_nargs;
11652 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(0, 298, __pyx_L3_error)
11653 }
11654 } else if (unlikely(__pyx_nargs != 2)) {
11655 goto __pyx_L5_argtuple_error;
11656 } else {
11657 values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
11658 values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
11659 }
11660 __pyx_v_self = values[0];
11661 __pyx_v_value = values[1];
11662 }
11663 goto __pyx_L6_skip;
11664 __pyx_L5_argtuple_error:;
11665 __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 298, __pyx_L3_error)
11666 __pyx_L6_skip:;
11667 goto __pyx_L4_argument_unpacking_done;
11668 __pyx_L3_error:;
11669 {
11670 Py_ssize_t __pyx_temp;
11671 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
11672 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
11673 }
11674 }
11675 __Pyx_AddTraceback("pysam.libchtslib.CallableValue.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11676 __Pyx_RefNannyFinishContext();
11677 return NULL;
11678 __pyx_L4_argument_unpacking_done:;
11679 __pyx_r = __pyx_pf_5pysam_10libchtslib_13CallableValue___init__(__pyx_self, __pyx_v_self, __pyx_v_value);
11680
11681 /* function exit code */
11682 {
11683 Py_ssize_t __pyx_temp;
11684 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
11685 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
11686 }
11687 }
11688 __Pyx_RefNannyFinishContext();
11689 return __pyx_r;
11690 }
11691
11692 static PyObject *__pyx_pf_5pysam_10libchtslib_13CallableValue___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
11693 PyObject *__pyx_r = NULL;
11694 __Pyx_TraceDeclarations
11695 __Pyx_RefNannyDeclarations
11696 int __pyx_lineno = 0;
11697 const char *__pyx_filename = NULL;
11698 int __pyx_clineno = 0;
11699 __Pyx_TraceFrameInit(__pyx_codeobj__28)
11700 __Pyx_RefNannySetupContext("__init__", 1);
11701 __Pyx_TraceCall("__init__", __pyx_f[0], 298, 0, __PYX_ERR(0, 298, __pyx_L1_error));
11702
11703 /* "pysam/libchtslib.pyx":299
11704 * class CallableValue(object):
11705 * def __init__(self, value):
11706 * self.value = value # <<<<<<<<<<<<<<
11707 * def __call__(self):
11708 * return self.value
11709 */
11710 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_value, __pyx_v_value) < 0) __PYX_ERR(0, 299, __pyx_L1_error)
11711
11712 /* "pysam/libchtslib.pyx":298
11713 *
11714 * class CallableValue(object):
11715 * def __init__(self, value): # <<<<<<<<<<<<<<
11716 * self.value = value
11717 * def __call__(self):
11718 */
11719
11720 /* function exit code */
11721 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
11722 goto __pyx_L0;
11723 __pyx_L1_error:;
11724 __Pyx_AddTraceback("pysam.libchtslib.CallableValue.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11725 __pyx_r = NULL;
11726 __pyx_L0:;
11727 __Pyx_XGIVEREF(__pyx_r);
11728 __Pyx_TraceReturn(__pyx_r, 0);
11729 __Pyx_RefNannyFinishContext();
11730 return __pyx_r;
11731 }
11732
11733 /* "pysam/libchtslib.pyx":300
11734 * def __init__(self, value):
11735 * self.value = value
11736 * def __call__(self): # <<<<<<<<<<<<<<
11737 * return self.value
11738 * def __bool__(self):
11739 */
11740
11741 /* Python wrapper */
11742 static PyObject *__pyx_pw_5pysam_10libchtslib_13CallableValue_3__call__(PyObject *__pyx_self,
11743 #if CYTHON_METH_FASTCALL
11744 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
11745 #else
11746 PyObject *__pyx_args, PyObject *__pyx_kwds
11747 #endif
11748 ); /*proto*/
11749 PyDoc_STRVAR(__pyx_doc_5pysam_10libchtslib_13CallableValue_2__call__, "CallableValue.__call__(self)");
11750 static PyMethodDef __pyx_mdef_5pysam_10libchtslib_13CallableValue_3__call__ = {"__call__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_13CallableValue_3__call__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_13CallableValue_2__call__};
11751 static PyObject *__pyx_pw_5pysam_10libchtslib_13CallableValue_3__call__(PyObject *__pyx_self,
11752 #if CYTHON_METH_FASTCALL
11753 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
11754 #else
11755 PyObject *__pyx_args, PyObject *__pyx_kwds
11756 #endif
11757 ) {
11758 PyObject *__pyx_v_self = 0;
11759 #if !CYTHON_METH_FASTCALL
11760 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
11761 #endif
11762 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
11763 PyObject* values[1] = {0};
11764 int __pyx_lineno = 0;
11765 const char *__pyx_filename = NULL;
11766 int __pyx_clineno = 0;
11767 PyObject *__pyx_r = 0;
11768 __Pyx_RefNannyDeclarations
11769 __Pyx_RefNannySetupContext("__call__ (wrapper)", 0);
11770 #if !CYTHON_METH_FASTCALL
11771 #if CYTHON_ASSUME_SAFE_MACROS
11772 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
11773 #else
11774 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
11775 #endif
11776 #endif
11777 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
11778 {
11779 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,0};
11780 if (__pyx_kwds) {
11781 Py_ssize_t kw_args;
11782 switch (__pyx_nargs) {
11783 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
11784 CYTHON_FALLTHROUGH;
11785 case 0: break;
11786 default: goto __pyx_L5_argtuple_error;
11787 }
11788 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
11789 switch (__pyx_nargs) {
11790 case 0:
11791 if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_self)) != 0)) {
11792 (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
11793 kw_args--;
11794 }
11795 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 300, __pyx_L3_error)
11796 else goto __pyx_L5_argtuple_error;
11797 }
11798 if (unlikely(kw_args > 0)) {
11799 const Py_ssize_t kwd_pos_args = __pyx_nargs;
11800 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__call__") < 0)) __PYX_ERR(0, 300, __pyx_L3_error)
11801 }
11802 } else if (unlikely(__pyx_nargs != 1)) {
11803 goto __pyx_L5_argtuple_error;
11804 } else {
11805 values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
11806 }
11807 __pyx_v_self = values[0];
11808 }
11809 goto __pyx_L6_skip;
11810 __pyx_L5_argtuple_error:;
11811 __Pyx_RaiseArgtupleInvalid("__call__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 300, __pyx_L3_error)
11812 __pyx_L6_skip:;
11813 goto __pyx_L4_argument_unpacking_done;
11814 __pyx_L3_error:;
11815 {
11816 Py_ssize_t __pyx_temp;
11817 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
11818 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
11819 }
11820 }
11821 __Pyx_AddTraceback("pysam.libchtslib.CallableValue.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11822 __Pyx_RefNannyFinishContext();
11823 return NULL;
11824 __pyx_L4_argument_unpacking_done:;
11825 __pyx_r = __pyx_pf_5pysam_10libchtslib_13CallableValue_2__call__(__pyx_self, __pyx_v_self);
11826
11827 /* function exit code */
11828 {
11829 Py_ssize_t __pyx_temp;
11830 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
11831 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
11832 }
11833 }
11834 __Pyx_RefNannyFinishContext();
11835 return __pyx_r;
11836 }
11837
11838 static PyObject *__pyx_pf_5pysam_10libchtslib_13CallableValue_2__call__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
11839 PyObject *__pyx_r = NULL;
11840 __Pyx_TraceDeclarations
11841 __Pyx_RefNannyDeclarations
11842 PyObject *__pyx_t_1 = NULL;
11843 int __pyx_lineno = 0;
11844 const char *__pyx_filename = NULL;
11845 int __pyx_clineno = 0;
11846 __Pyx_TraceFrameInit(__pyx_codeobj__29)
11847 __Pyx_RefNannySetupContext("__call__", 1);
11848 __Pyx_TraceCall("__call__", __pyx_f[0], 300, 0, __PYX_ERR(0, 300, __pyx_L1_error));
11849
11850 /* "pysam/libchtslib.pyx":301
11851 * self.value = value
11852 * def __call__(self):
11853 * return self.value # <<<<<<<<<<<<<<
11854 * def __bool__(self):
11855 * return self.value
11856 */
11857 __Pyx_XDECREF(__pyx_r);
11858 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 301, __pyx_L1_error)
11859 __Pyx_GOTREF(__pyx_t_1);
11860 __pyx_r = __pyx_t_1;
11861 __pyx_t_1 = 0;
11862 goto __pyx_L0;
11863
11864 /* "pysam/libchtslib.pyx":300
11865 * def __init__(self, value):
11866 * self.value = value
11867 * def __call__(self): # <<<<<<<<<<<<<<
11868 * return self.value
11869 * def __bool__(self):
11870 */
11871
11872 /* function exit code */
11873 __pyx_L1_error:;
11874 __Pyx_XDECREF(__pyx_t_1);
11875 __Pyx_AddTraceback("pysam.libchtslib.CallableValue.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11876 __pyx_r = NULL;
11877 __pyx_L0:;
11878 __Pyx_XGIVEREF(__pyx_r);
11879 __Pyx_TraceReturn(__pyx_r, 0);
11880 __Pyx_RefNannyFinishContext();
11881 return __pyx_r;
11882 }
11883
11884 /* "pysam/libchtslib.pyx":302
11885 * def __call__(self):
11886 * return self.value
11887 * def __bool__(self): # <<<<<<<<<<<<<<
11888 * return self.value
11889 * def __nonzero__(self):
11890 */
11891
11892 /* Python wrapper */
11893 static PyObject *__pyx_pw_5pysam_10libchtslib_13CallableValue_5__bool__(PyObject *__pyx_self,
11894 #if CYTHON_METH_FASTCALL
11895 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
11896 #else
11897 PyObject *__pyx_args, PyObject *__pyx_kwds
11898 #endif
11899 ); /*proto*/
11900 PyDoc_STRVAR(__pyx_doc_5pysam_10libchtslib_13CallableValue_4__bool__, "CallableValue.__bool__(self)");
11901 static PyMethodDef __pyx_mdef_5pysam_10libchtslib_13CallableValue_5__bool__ = {"__bool__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_13CallableValue_5__bool__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_13CallableValue_4__bool__};
11902 static PyObject *__pyx_pw_5pysam_10libchtslib_13CallableValue_5__bool__(PyObject *__pyx_self,
11903 #if CYTHON_METH_FASTCALL
11904 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
11905 #else
11906 PyObject *__pyx_args, PyObject *__pyx_kwds
11907 #endif
11908 ) {
11909 PyObject *__pyx_v_self = 0;
11910 #if !CYTHON_METH_FASTCALL
11911 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
11912 #endif
11913 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
11914 PyObject* values[1] = {0};
11915 int __pyx_lineno = 0;
11916 const char *__pyx_filename = NULL;
11917 int __pyx_clineno = 0;
11918 PyObject *__pyx_r = 0;
11919 __Pyx_RefNannyDeclarations
11920 __Pyx_RefNannySetupContext("__bool__ (wrapper)", 0);
11921 #if !CYTHON_METH_FASTCALL
11922 #if CYTHON_ASSUME_SAFE_MACROS
11923 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
11924 #else
11925 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
11926 #endif
11927 #endif
11928 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
11929 {
11930 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,0};
11931 if (__pyx_kwds) {
11932 Py_ssize_t kw_args;
11933 switch (__pyx_nargs) {
11934 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
11935 CYTHON_FALLTHROUGH;
11936 case 0: break;
11937 default: goto __pyx_L5_argtuple_error;
11938 }
11939 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
11940 switch (__pyx_nargs) {
11941 case 0:
11942 if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_self)) != 0)) {
11943 (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
11944 kw_args--;
11945 }
11946 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 302, __pyx_L3_error)
11947 else goto __pyx_L5_argtuple_error;
11948 }
11949 if (unlikely(kw_args > 0)) {
11950 const Py_ssize_t kwd_pos_args = __pyx_nargs;
11951 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__bool__") < 0)) __PYX_ERR(0, 302, __pyx_L3_error)
11952 }
11953 } else if (unlikely(__pyx_nargs != 1)) {
11954 goto __pyx_L5_argtuple_error;
11955 } else {
11956 values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
11957 }
11958 __pyx_v_self = values[0];
11959 }
11960 goto __pyx_L6_skip;
11961 __pyx_L5_argtuple_error:;
11962 __Pyx_RaiseArgtupleInvalid("__bool__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 302, __pyx_L3_error)
11963 __pyx_L6_skip:;
11964 goto __pyx_L4_argument_unpacking_done;
11965 __pyx_L3_error:;
11966 {
11967 Py_ssize_t __pyx_temp;
11968 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
11969 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
11970 }
11971 }
11972 __Pyx_AddTraceback("pysam.libchtslib.CallableValue.__bool__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11973 __Pyx_RefNannyFinishContext();
11974 return NULL;
11975 __pyx_L4_argument_unpacking_done:;
11976 __pyx_r = __pyx_pf_5pysam_10libchtslib_13CallableValue_4__bool__(__pyx_self, __pyx_v_self);
11977
11978 /* function exit code */
11979 {
11980 Py_ssize_t __pyx_temp;
11981 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
11982 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
11983 }
11984 }
11985 __Pyx_RefNannyFinishContext();
11986 return __pyx_r;
11987 }
11988
11989 static PyObject *__pyx_pf_5pysam_10libchtslib_13CallableValue_4__bool__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
11990 PyObject *__pyx_r = NULL;
11991 __Pyx_TraceDeclarations
11992 __Pyx_RefNannyDeclarations
11993 PyObject *__pyx_t_1 = NULL;
11994 int __pyx_lineno = 0;
11995 const char *__pyx_filename = NULL;
11996 int __pyx_clineno = 0;
11997 __Pyx_TraceFrameInit(__pyx_codeobj__30)
11998 __Pyx_RefNannySetupContext("__bool__", 1);
11999 __Pyx_TraceCall("__bool__", __pyx_f[0], 302, 0, __PYX_ERR(0, 302, __pyx_L1_error));
12000
12001 /* "pysam/libchtslib.pyx":303
12002 * return self.value
12003 * def __bool__(self):
12004 * return self.value # <<<<<<<<<<<<<<
12005 * def __nonzero__(self):
12006 * return self.value
12007 */
12008 __Pyx_XDECREF(__pyx_r);
12009 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 303, __pyx_L1_error)
12010 __Pyx_GOTREF(__pyx_t_1);
12011 __pyx_r = __pyx_t_1;
12012 __pyx_t_1 = 0;
12013 goto __pyx_L0;
12014
12015 /* "pysam/libchtslib.pyx":302
12016 * def __call__(self):
12017 * return self.value
12018 * def __bool__(self): # <<<<<<<<<<<<<<
12019 * return self.value
12020 * def __nonzero__(self):
12021 */
12022
12023 /* function exit code */
12024 __pyx_L1_error:;
12025 __Pyx_XDECREF(__pyx_t_1);
12026 __Pyx_AddTraceback("pysam.libchtslib.CallableValue.__bool__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12027 __pyx_r = NULL;
12028 __pyx_L0:;
12029 __Pyx_XGIVEREF(__pyx_r);
12030 __Pyx_TraceReturn(__pyx_r, 0);
12031 __Pyx_RefNannyFinishContext();
12032 return __pyx_r;
12033 }
12034
12035 /* "pysam/libchtslib.pyx":304
12036 * def __bool__(self):
12037 * return self.value
12038 * def __nonzero__(self): # <<<<<<<<<<<<<<
12039 * return self.value
12040 * def __eq__(self, other):
12041 */
12042
12043 /* Python wrapper */
12044 static PyObject *__pyx_pw_5pysam_10libchtslib_13CallableValue_7__nonzero__(PyObject *__pyx_self,
12045 #if CYTHON_METH_FASTCALL
12046 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
12047 #else
12048 PyObject *__pyx_args, PyObject *__pyx_kwds
12049 #endif
12050 ); /*proto*/
12051 PyDoc_STRVAR(__pyx_doc_5pysam_10libchtslib_13CallableValue_6__nonzero__, "CallableValue.__nonzero__(self)");
12052 static PyMethodDef __pyx_mdef_5pysam_10libchtslib_13CallableValue_7__nonzero__ = {"__nonzero__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_13CallableValue_7__nonzero__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_13CallableValue_6__nonzero__};
12053 static PyObject *__pyx_pw_5pysam_10libchtslib_13CallableValue_7__nonzero__(PyObject *__pyx_self,
12054 #if CYTHON_METH_FASTCALL
12055 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
12056 #else
12057 PyObject *__pyx_args, PyObject *__pyx_kwds
12058 #endif
12059 ) {
12060 PyObject *__pyx_v_self = 0;
12061 #if !CYTHON_METH_FASTCALL
12062 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
12063 #endif
12064 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
12065 PyObject* values[1] = {0};
12066 int __pyx_lineno = 0;
12067 const char *__pyx_filename = NULL;
12068 int __pyx_clineno = 0;
12069 PyObject *__pyx_r = 0;
12070 __Pyx_RefNannyDeclarations
12071 __Pyx_RefNannySetupContext("__nonzero__ (wrapper)", 0);
12072 #if !CYTHON_METH_FASTCALL
12073 #if CYTHON_ASSUME_SAFE_MACROS
12074 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
12075 #else
12076 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
12077 #endif
12078 #endif
12079 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
12080 {
12081 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,0};
12082 if (__pyx_kwds) {
12083 Py_ssize_t kw_args;
12084 switch (__pyx_nargs) {
12085 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
12086 CYTHON_FALLTHROUGH;
12087 case 0: break;
12088 default: goto __pyx_L5_argtuple_error;
12089 }
12090 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
12091 switch (__pyx_nargs) {
12092 case 0:
12093 if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_self)) != 0)) {
12094 (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
12095 kw_args--;
12096 }
12097 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 304, __pyx_L3_error)
12098 else goto __pyx_L5_argtuple_error;
12099 }
12100 if (unlikely(kw_args > 0)) {
12101 const Py_ssize_t kwd_pos_args = __pyx_nargs;
12102 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__nonzero__") < 0)) __PYX_ERR(0, 304, __pyx_L3_error)
12103 }
12104 } else if (unlikely(__pyx_nargs != 1)) {
12105 goto __pyx_L5_argtuple_error;
12106 } else {
12107 values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
12108 }
12109 __pyx_v_self = values[0];
12110 }
12111 goto __pyx_L6_skip;
12112 __pyx_L5_argtuple_error:;
12113 __Pyx_RaiseArgtupleInvalid("__nonzero__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 304, __pyx_L3_error)
12114 __pyx_L6_skip:;
12115 goto __pyx_L4_argument_unpacking_done;
12116 __pyx_L3_error:;
12117 {
12118 Py_ssize_t __pyx_temp;
12119 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
12120 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
12121 }
12122 }
12123 __Pyx_AddTraceback("pysam.libchtslib.CallableValue.__nonzero__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12124 __Pyx_RefNannyFinishContext();
12125 return NULL;
12126 __pyx_L4_argument_unpacking_done:;
12127 __pyx_r = __pyx_pf_5pysam_10libchtslib_13CallableValue_6__nonzero__(__pyx_self, __pyx_v_self);
12128
12129 /* function exit code */
12130 {
12131 Py_ssize_t __pyx_temp;
12132 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
12133 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
12134 }
12135 }
12136 __Pyx_RefNannyFinishContext();
12137 return __pyx_r;
12138 }
12139
12140 static PyObject *__pyx_pf_5pysam_10libchtslib_13CallableValue_6__nonzero__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
12141 PyObject *__pyx_r = NULL;
12142 __Pyx_TraceDeclarations
12143 __Pyx_RefNannyDeclarations
12144 PyObject *__pyx_t_1 = NULL;
12145 int __pyx_lineno = 0;
12146 const char *__pyx_filename = NULL;
12147 int __pyx_clineno = 0;
12148 __Pyx_TraceFrameInit(__pyx_codeobj__31)
12149 __Pyx_RefNannySetupContext("__nonzero__", 1);
12150 __Pyx_TraceCall("__nonzero__", __pyx_f[0], 304, 0, __PYX_ERR(0, 304, __pyx_L1_error));
12151
12152 /* "pysam/libchtslib.pyx":305
12153 * return self.value
12154 * def __nonzero__(self):
12155 * return self.value # <<<<<<<<<<<<<<
12156 * def __eq__(self, other):
12157 * return self.value == other
12158 */
12159 __Pyx_XDECREF(__pyx_r);
12160 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 305, __pyx_L1_error)
12161 __Pyx_GOTREF(__pyx_t_1);
12162 __pyx_r = __pyx_t_1;
12163 __pyx_t_1 = 0;
12164 goto __pyx_L0;
12165
12166 /* "pysam/libchtslib.pyx":304
12167 * def __bool__(self):
12168 * return self.value
12169 * def __nonzero__(self): # <<<<<<<<<<<<<<
12170 * return self.value
12171 * def __eq__(self, other):
12172 */
12173
12174 /* function exit code */
12175 __pyx_L1_error:;
12176 __Pyx_XDECREF(__pyx_t_1);
12177 __Pyx_AddTraceback("pysam.libchtslib.CallableValue.__nonzero__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12178 __pyx_r = NULL;
12179 __pyx_L0:;
12180 __Pyx_XGIVEREF(__pyx_r);
12181 __Pyx_TraceReturn(__pyx_r, 0);
12182 __Pyx_RefNannyFinishContext();
12183 return __pyx_r;
12184 }
12185
12186 /* "pysam/libchtslib.pyx":306
12187 * def __nonzero__(self):
12188 * return self.value
12189 * def __eq__(self, other): # <<<<<<<<<<<<<<
12190 * return self.value == other
12191 * def __ne__(self, other):
12192 */
12193
12194 /* Python wrapper */
12195 static PyObject *__pyx_pw_5pysam_10libchtslib_13CallableValue_9__eq__(PyObject *__pyx_self,
12196 #if CYTHON_METH_FASTCALL
12197 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
12198 #else
12199 PyObject *__pyx_args, PyObject *__pyx_kwds
12200 #endif
12201 ); /*proto*/
12202 PyDoc_STRVAR(__pyx_doc_5pysam_10libchtslib_13CallableValue_8__eq__, "CallableValue.__eq__(self, other)");
12203 static PyMethodDef __pyx_mdef_5pysam_10libchtslib_13CallableValue_9__eq__ = {"__eq__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_13CallableValue_9__eq__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_13CallableValue_8__eq__};
12204 static PyObject *__pyx_pw_5pysam_10libchtslib_13CallableValue_9__eq__(PyObject *__pyx_self,
12205 #if CYTHON_METH_FASTCALL
12206 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
12207 #else
12208 PyObject *__pyx_args, PyObject *__pyx_kwds
12209 #endif
12210 ) {
12211 PyObject *__pyx_v_self = 0;
12212 PyObject *__pyx_v_other = 0;
12213 #if !CYTHON_METH_FASTCALL
12214 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
12215 #endif
12216 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
12217 PyObject* values[2] = {0,0};
12218 int __pyx_lineno = 0;
12219 const char *__pyx_filename = NULL;
12220 int __pyx_clineno = 0;
12221 PyObject *__pyx_r = 0;
12222 __Pyx_RefNannyDeclarations
12223 __Pyx_RefNannySetupContext("__eq__ (wrapper)", 0);
12224 #if !CYTHON_METH_FASTCALL
12225 #if CYTHON_ASSUME_SAFE_MACROS
12226 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
12227 #else
12228 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
12229 #endif
12230 #endif
12231 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
12232 {
12233 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_other,0};
12234 if (__pyx_kwds) {
12235 Py_ssize_t kw_args;
12236 switch (__pyx_nargs) {
12237 case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
12238 CYTHON_FALLTHROUGH;
12239 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
12240 CYTHON_FALLTHROUGH;
12241 case 0: break;
12242 default: goto __pyx_L5_argtuple_error;
12243 }
12244 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
12245 switch (__pyx_nargs) {
12246 case 0:
12247 if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_self)) != 0)) {
12248 (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
12249 kw_args--;
12250 }
12251 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 306, __pyx_L3_error)
12252 else goto __pyx_L5_argtuple_error;
12253 CYTHON_FALLTHROUGH;
12254 case 1:
12255 if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_other)) != 0)) {
12256 (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
12257 kw_args--;
12258 }
12259 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 306, __pyx_L3_error)
12260 else {
12261 __Pyx_RaiseArgtupleInvalid("__eq__", 1, 2, 2, 1); __PYX_ERR(0, 306, __pyx_L3_error)
12262 }
12263 }
12264 if (unlikely(kw_args > 0)) {
12265 const Py_ssize_t kwd_pos_args = __pyx_nargs;
12266 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__eq__") < 0)) __PYX_ERR(0, 306, __pyx_L3_error)
12267 }
12268 } else if (unlikely(__pyx_nargs != 2)) {
12269 goto __pyx_L5_argtuple_error;
12270 } else {
12271 values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
12272 values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
12273 }
12274 __pyx_v_self = values[0];
12275 __pyx_v_other = values[1];
12276 }
12277 goto __pyx_L6_skip;
12278 __pyx_L5_argtuple_error:;
12279 __Pyx_RaiseArgtupleInvalid("__eq__", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 306, __pyx_L3_error)
12280 __pyx_L6_skip:;
12281 goto __pyx_L4_argument_unpacking_done;
12282 __pyx_L3_error:;
12283 {
12284 Py_ssize_t __pyx_temp;
12285 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
12286 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
12287 }
12288 }
12289 __Pyx_AddTraceback("pysam.libchtslib.CallableValue.__eq__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12290 __Pyx_RefNannyFinishContext();
12291 return NULL;
12292 __pyx_L4_argument_unpacking_done:;
12293 __pyx_r = __pyx_pf_5pysam_10libchtslib_13CallableValue_8__eq__(__pyx_self, __pyx_v_self, __pyx_v_other);
12294
12295 /* function exit code */
12296 {
12297 Py_ssize_t __pyx_temp;
12298 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
12299 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
12300 }
12301 }
12302 __Pyx_RefNannyFinishContext();
12303 return __pyx_r;
12304 }
12305
12306 static PyObject *__pyx_pf_5pysam_10libchtslib_13CallableValue_8__eq__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
12307 PyObject *__pyx_r = NULL;
12308 __Pyx_TraceDeclarations
12309 __Pyx_RefNannyDeclarations
12310 PyObject *__pyx_t_1 = NULL;
12311 PyObject *__pyx_t_2 = NULL;
12312 int __pyx_lineno = 0;
12313 const char *__pyx_filename = NULL;
12314 int __pyx_clineno = 0;
12315 __Pyx_TraceFrameInit(__pyx_codeobj__32)
12316 __Pyx_RefNannySetupContext("__eq__", 1);
12317 __Pyx_TraceCall("__eq__", __pyx_f[0], 306, 0, __PYX_ERR(0, 306, __pyx_L1_error));
12318
12319 /* "pysam/libchtslib.pyx":307
12320 * return self.value
12321 * def __eq__(self, other):
12322 * return self.value == other # <<<<<<<<<<<<<<
12323 * def __ne__(self, other):
12324 * return self.value != other
12325 */
12326 __Pyx_XDECREF(__pyx_r);
12327 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 307, __pyx_L1_error)
12328 __Pyx_GOTREF(__pyx_t_1);
12329 __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_v_other, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 307, __pyx_L1_error)
12330 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12331 __pyx_r = __pyx_t_2;
12332 __pyx_t_2 = 0;
12333 goto __pyx_L0;
12334
12335 /* "pysam/libchtslib.pyx":306
12336 * def __nonzero__(self):
12337 * return self.value
12338 * def __eq__(self, other): # <<<<<<<<<<<<<<
12339 * return self.value == other
12340 * def __ne__(self, other):
12341 */
12342
12343 /* function exit code */
12344 __pyx_L1_error:;
12345 __Pyx_XDECREF(__pyx_t_1);
12346 __Pyx_XDECREF(__pyx_t_2);
12347 __Pyx_AddTraceback("pysam.libchtslib.CallableValue.__eq__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12348 __pyx_r = NULL;
12349 __pyx_L0:;
12350 __Pyx_XGIVEREF(__pyx_r);
12351 __Pyx_TraceReturn(__pyx_r, 0);
12352 __Pyx_RefNannyFinishContext();
12353 return __pyx_r;
12354 }
12355
12356 /* "pysam/libchtslib.pyx":308
12357 * def __eq__(self, other):
12358 * return self.value == other
12359 * def __ne__(self, other): # <<<<<<<<<<<<<<
12360 * return self.value != other
12361 *
12362 */
12363
12364 /* Python wrapper */
12365 static PyObject *__pyx_pw_5pysam_10libchtslib_13CallableValue_11__ne__(PyObject *__pyx_self,
12366 #if CYTHON_METH_FASTCALL
12367 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
12368 #else
12369 PyObject *__pyx_args, PyObject *__pyx_kwds
12370 #endif
12371 ); /*proto*/
12372 PyDoc_STRVAR(__pyx_doc_5pysam_10libchtslib_13CallableValue_10__ne__, "CallableValue.__ne__(self, other)");
12373 static PyMethodDef __pyx_mdef_5pysam_10libchtslib_13CallableValue_11__ne__ = {"__ne__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_13CallableValue_11__ne__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_13CallableValue_10__ne__};
12374 static PyObject *__pyx_pw_5pysam_10libchtslib_13CallableValue_11__ne__(PyObject *__pyx_self,
12375 #if CYTHON_METH_FASTCALL
12376 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
12377 #else
12378 PyObject *__pyx_args, PyObject *__pyx_kwds
12379 #endif
12380 ) {
12381 PyObject *__pyx_v_self = 0;
12382 PyObject *__pyx_v_other = 0;
12383 #if !CYTHON_METH_FASTCALL
12384 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
12385 #endif
12386 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
12387 PyObject* values[2] = {0,0};
12388 int __pyx_lineno = 0;
12389 const char *__pyx_filename = NULL;
12390 int __pyx_clineno = 0;
12391 PyObject *__pyx_r = 0;
12392 __Pyx_RefNannyDeclarations
12393 __Pyx_RefNannySetupContext("__ne__ (wrapper)", 0);
12394 #if !CYTHON_METH_FASTCALL
12395 #if CYTHON_ASSUME_SAFE_MACROS
12396 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
12397 #else
12398 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
12399 #endif
12400 #endif
12401 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
12402 {
12403 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_other,0};
12404 if (__pyx_kwds) {
12405 Py_ssize_t kw_args;
12406 switch (__pyx_nargs) {
12407 case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
12408 CYTHON_FALLTHROUGH;
12409 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
12410 CYTHON_FALLTHROUGH;
12411 case 0: break;
12412 default: goto __pyx_L5_argtuple_error;
12413 }
12414 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
12415 switch (__pyx_nargs) {
12416 case 0:
12417 if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_self)) != 0)) {
12418 (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
12419 kw_args--;
12420 }
12421 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 308, __pyx_L3_error)
12422 else goto __pyx_L5_argtuple_error;
12423 CYTHON_FALLTHROUGH;
12424 case 1:
12425 if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_other)) != 0)) {
12426 (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
12427 kw_args--;
12428 }
12429 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 308, __pyx_L3_error)
12430 else {
12431 __Pyx_RaiseArgtupleInvalid("__ne__", 1, 2, 2, 1); __PYX_ERR(0, 308, __pyx_L3_error)
12432 }
12433 }
12434 if (unlikely(kw_args > 0)) {
12435 const Py_ssize_t kwd_pos_args = __pyx_nargs;
12436 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__ne__") < 0)) __PYX_ERR(0, 308, __pyx_L3_error)
12437 }
12438 } else if (unlikely(__pyx_nargs != 2)) {
12439 goto __pyx_L5_argtuple_error;
12440 } else {
12441 values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
12442 values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
12443 }
12444 __pyx_v_self = values[0];
12445 __pyx_v_other = values[1];
12446 }
12447 goto __pyx_L6_skip;
12448 __pyx_L5_argtuple_error:;
12449 __Pyx_RaiseArgtupleInvalid("__ne__", 1, 2, 2, __pyx_nargs); __PYX_ERR(0, 308, __pyx_L3_error)
12450 __pyx_L6_skip:;
12451 goto __pyx_L4_argument_unpacking_done;
12452 __pyx_L3_error:;
12453 {
12454 Py_ssize_t __pyx_temp;
12455 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
12456 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
12457 }
12458 }
12459 __Pyx_AddTraceback("pysam.libchtslib.CallableValue.__ne__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12460 __Pyx_RefNannyFinishContext();
12461 return NULL;
12462 __pyx_L4_argument_unpacking_done:;
12463 __pyx_r = __pyx_pf_5pysam_10libchtslib_13CallableValue_10__ne__(__pyx_self, __pyx_v_self, __pyx_v_other);
12464
12465 /* function exit code */
12466 {
12467 Py_ssize_t __pyx_temp;
12468 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
12469 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
12470 }
12471 }
12472 __Pyx_RefNannyFinishContext();
12473 return __pyx_r;
12474 }
12475
12476 static PyObject *__pyx_pf_5pysam_10libchtslib_13CallableValue_10__ne__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_other) {
12477 PyObject *__pyx_r = NULL;
12478 __Pyx_TraceDeclarations
12479 __Pyx_RefNannyDeclarations
12480 PyObject *__pyx_t_1 = NULL;
12481 PyObject *__pyx_t_2 = NULL;
12482 int __pyx_lineno = 0;
12483 const char *__pyx_filename = NULL;
12484 int __pyx_clineno = 0;
12485 __Pyx_TraceFrameInit(__pyx_codeobj__33)
12486 __Pyx_RefNannySetupContext("__ne__", 1);
12487 __Pyx_TraceCall("__ne__", __pyx_f[0], 308, 0, __PYX_ERR(0, 308, __pyx_L1_error));
12488
12489 /* "pysam/libchtslib.pyx":309
12490 * return self.value == other
12491 * def __ne__(self, other):
12492 * return self.value != other # <<<<<<<<<<<<<<
12493 *
12494 *
12495 */
12496 __Pyx_XDECREF(__pyx_r);
12497 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 309, __pyx_L1_error)
12498 __Pyx_GOTREF(__pyx_t_1);
12499 __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_v_other, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 309, __pyx_L1_error)
12500 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12501 __pyx_r = __pyx_t_2;
12502 __pyx_t_2 = 0;
12503 goto __pyx_L0;
12504
12505 /* "pysam/libchtslib.pyx":308
12506 * def __eq__(self, other):
12507 * return self.value == other
12508 * def __ne__(self, other): # <<<<<<<<<<<<<<
12509 * return self.value != other
12510 *
12511 */
12512
12513 /* function exit code */
12514 __pyx_L1_error:;
12515 __Pyx_XDECREF(__pyx_t_1);
12516 __Pyx_XDECREF(__pyx_t_2);
12517 __Pyx_AddTraceback("pysam.libchtslib.CallableValue.__ne__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12518 __pyx_r = NULL;
12519 __pyx_L0:;
12520 __Pyx_XGIVEREF(__pyx_r);
12521 __Pyx_TraceReturn(__pyx_r, 0);
12522 __Pyx_RefNannyFinishContext();
12523 return __pyx_r;
12524 }
12525
12526 /* "pysam/libchtslib.pyx":326
12527 * """
12528 *
12529 * def __cinit__(self, *args, **kwargs): # <<<<<<<<<<<<<<
12530 * self.htsfile = NULL
12531 * self.threads = 1
12532 */
12533
12534 /* Python wrapper */
12535 static int __pyx_pw_5pysam_10libchtslib_7HTSFile_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
12536 static int __pyx_pw_5pysam_10libchtslib_7HTSFile_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
12537 CYTHON_UNUSED PyObject *__pyx_v_args = 0;
12538 CYTHON_UNUSED PyObject *__pyx_v_kwargs = 0;
12539 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
12540 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
12541 int __pyx_r;
12542 __Pyx_RefNannyDeclarations
12543 __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
12544 #if CYTHON_ASSUME_SAFE_MACROS
12545 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
12546 #else
12547 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
12548 #endif
12549 __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
12550 if (unlikely(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 1))) return -1;
12551 __Pyx_INCREF(__pyx_args);
12552 __pyx_v_args = __pyx_args;
12553 __pyx_r = __pyx_pf_5pysam_10libchtslib_7HTSFile___cinit__(((struct __pyx_obj_5pysam_10libchtslib_HTSFile *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs);
12554
12555 /* function exit code */
12556 __Pyx_DECREF(__pyx_v_args);
12557 __Pyx_XDECREF(__pyx_v_kwargs);
12558 __Pyx_RefNannyFinishContext();
12559 return __pyx_r;
12560 }
12561
12562 static int __pyx_pf_5pysam_10libchtslib_7HTSFile___cinit__(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs) {
12563 int __pyx_r;
12564 __Pyx_TraceDeclarations
12565 __Pyx_RefNannyDeclarations
12566 int __pyx_lineno = 0;
12567 const char *__pyx_filename = NULL;
12568 int __pyx_clineno = 0;
12569 __Pyx_RefNannySetupContext("__cinit__", 1);
12570 __Pyx_TraceCall("__cinit__", __pyx_f[0], 326, 0, __PYX_ERR(0, 326, __pyx_L1_error));
12571
12572 /* "pysam/libchtslib.pyx":327
12573 *
12574 * def __cinit__(self, *args, **kwargs):
12575 * self.htsfile = NULL # <<<<<<<<<<<<<<
12576 * self.threads = 1
12577 * self.duplicate_filehandle = True
12578 */
12579 __pyx_v_self->htsfile = NULL;
12580
12581 /* "pysam/libchtslib.pyx":328
12582 * def __cinit__(self, *args, **kwargs):
12583 * self.htsfile = NULL
12584 * self.threads = 1 # <<<<<<<<<<<<<<
12585 * self.duplicate_filehandle = True
12586 *
12587 */
12588 __Pyx_INCREF(__pyx_int_1);
12589 __Pyx_GIVEREF(__pyx_int_1);
12590 __Pyx_GOTREF(__pyx_v_self->threads);
12591 __Pyx_DECREF(__pyx_v_self->threads);
12592 __pyx_v_self->threads = __pyx_int_1;
12593
12594 /* "pysam/libchtslib.pyx":329
12595 * self.htsfile = NULL
12596 * self.threads = 1
12597 * self.duplicate_filehandle = True # <<<<<<<<<<<<<<
12598 *
12599 * def close(self):
12600 */
12601 __pyx_v_self->duplicate_filehandle = 1;
12602
12603 /* "pysam/libchtslib.pyx":326
12604 * """
12605 *
12606 * def __cinit__(self, *args, **kwargs): # <<<<<<<<<<<<<<
12607 * self.htsfile = NULL
12608 * self.threads = 1
12609 */
12610
12611 /* function exit code */
12612 __pyx_r = 0;
12613 goto __pyx_L0;
12614 __pyx_L1_error:;
12615 __Pyx_AddTraceback("pysam.libchtslib.HTSFile.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12616 __pyx_r = -1;
12617 __pyx_L0:;
12618 __Pyx_TraceReturn(Py_None, 0);
12619 __Pyx_RefNannyFinishContext();
12620 return __pyx_r;
12621 }
12622
12623 /* "pysam/libchtslib.pyx":331
12624 * self.duplicate_filehandle = True
12625 *
12626 * def close(self): # <<<<<<<<<<<<<<
12627 * if self.htsfile:
12628 * hts_close(self.htsfile)
12629 */
12630
12631 /* Python wrapper */
12632 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_3close(PyObject *__pyx_v_self,
12633 #if CYTHON_METH_FASTCALL
12634 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
12635 #else
12636 PyObject *__pyx_args, PyObject *__pyx_kwds
12637 #endif
12638 ); /*proto*/
12639 PyDoc_STRVAR(__pyx_doc_5pysam_10libchtslib_7HTSFile_2close, "HTSFile.close(self)");
12640 static PyMethodDef __pyx_mdef_5pysam_10libchtslib_7HTSFile_3close = {"close", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_7HTSFile_3close, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_7HTSFile_2close};
12641 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_3close(PyObject *__pyx_v_self,
12642 #if CYTHON_METH_FASTCALL
12643 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
12644 #else
12645 PyObject *__pyx_args, PyObject *__pyx_kwds
12646 #endif
12647 ) {
12648 #if !CYTHON_METH_FASTCALL
12649 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
12650 #endif
12651 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
12652 PyObject *__pyx_r = 0;
12653 __Pyx_RefNannyDeclarations
12654 __Pyx_RefNannySetupContext("close (wrapper)", 0);
12655 #if !CYTHON_METH_FASTCALL
12656 #if CYTHON_ASSUME_SAFE_MACROS
12657 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
12658 #else
12659 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
12660 #endif
12661 #endif
12662 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
12663 if (unlikely(__pyx_nargs > 0)) {
12664 __Pyx_RaiseArgtupleInvalid("close", 1, 0, 0, __pyx_nargs); return NULL;}
12665 if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "close", 0))) return NULL;
12666 __pyx_r = __pyx_pf_5pysam_10libchtslib_7HTSFile_2close(((struct __pyx_obj_5pysam_10libchtslib_HTSFile *)__pyx_v_self));
12667
12668 /* function exit code */
12669 __Pyx_RefNannyFinishContext();
12670 return __pyx_r;
12671 }
12672
12673 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_2close(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self) {
12674 PyObject *__pyx_r = NULL;
12675 __Pyx_TraceDeclarations
12676 __Pyx_RefNannyDeclarations
12677 int __pyx_t_1;
12678 int __pyx_lineno = 0;
12679 const char *__pyx_filename = NULL;
12680 int __pyx_clineno = 0;
12681 __Pyx_TraceFrameInit(__pyx_codeobj__34)
12682 __Pyx_RefNannySetupContext("close", 1);
12683 __Pyx_TraceCall("close", __pyx_f[0], 331, 0, __PYX_ERR(0, 331, __pyx_L1_error));
12684
12685 /* "pysam/libchtslib.pyx":332
12686 *
12687 * def close(self):
12688 * if self.htsfile: # <<<<<<<<<<<<<<
12689 * hts_close(self.htsfile)
12690 * self.htsfile = NULL
12691 */
12692 __pyx_t_1 = (__pyx_v_self->htsfile != 0);
12693 if (__pyx_t_1) {
12694
12695 /* "pysam/libchtslib.pyx":333
12696 * def close(self):
12697 * if self.htsfile:
12698 * hts_close(self.htsfile) # <<<<<<<<<<<<<<
12699 * self.htsfile = NULL
12700 *
12701 */
12702 (void)(hts_close(__pyx_v_self->htsfile));
12703
12704 /* "pysam/libchtslib.pyx":334
12705 * if self.htsfile:
12706 * hts_close(self.htsfile)
12707 * self.htsfile = NULL # <<<<<<<<<<<<<<
12708 *
12709 * def __dealloc__(self):
12710 */
12711 __pyx_v_self->htsfile = NULL;
12712
12713 /* "pysam/libchtslib.pyx":332
12714 *
12715 * def close(self):
12716 * if self.htsfile: # <<<<<<<<<<<<<<
12717 * hts_close(self.htsfile)
12718 * self.htsfile = NULL
12719 */
12720 }
12721
12722 /* "pysam/libchtslib.pyx":331
12723 * self.duplicate_filehandle = True
12724 *
12725 * def close(self): # <<<<<<<<<<<<<<
12726 * if self.htsfile:
12727 * hts_close(self.htsfile)
12728 */
12729
12730 /* function exit code */
12731 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
12732 goto __pyx_L0;
12733 __pyx_L1_error:;
12734 __Pyx_AddTraceback("pysam.libchtslib.HTSFile.close", __pyx_clineno, __pyx_lineno, __pyx_filename);
12735 __pyx_r = NULL;
12736 __pyx_L0:;
12737 __Pyx_XGIVEREF(__pyx_r);
12738 __Pyx_TraceReturn(__pyx_r, 0);
12739 __Pyx_RefNannyFinishContext();
12740 return __pyx_r;
12741 }
12742
12743 /* "pysam/libchtslib.pyx":336
12744 * self.htsfile = NULL
12745 *
12746 * def __dealloc__(self): # <<<<<<<<<<<<<<
12747 * if self.htsfile:
12748 * hts_close(self.htsfile)
12749 */
12750
12751 /* Python wrapper */
12752 static void __pyx_pw_5pysam_10libchtslib_7HTSFile_5__dealloc__(PyObject *__pyx_v_self); /*proto*/
12753 static void __pyx_pw_5pysam_10libchtslib_7HTSFile_5__dealloc__(PyObject *__pyx_v_self) {
12754 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
12755 __Pyx_RefNannyDeclarations
12756 __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
12757 __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
12758 __pyx_pf_5pysam_10libchtslib_7HTSFile_4__dealloc__(((struct __pyx_obj_5pysam_10libchtslib_HTSFile *)__pyx_v_self));
12759
12760 /* function exit code */
12761 __Pyx_RefNannyFinishContext();
12762 }
12763
12764 static void __pyx_pf_5pysam_10libchtslib_7HTSFile_4__dealloc__(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self) {
12765 __Pyx_TraceDeclarations
12766 int __pyx_t_1;
12767 int __pyx_lineno = 0;
12768 const char *__pyx_filename = NULL;
12769 int __pyx_clineno = 0;
12770 __Pyx_TraceCall("__dealloc__", __pyx_f[0], 336, 0, __PYX_ERR(0, 336, __pyx_L1_error));
12771
12772 /* "pysam/libchtslib.pyx":337
12773 *
12774 * def __dealloc__(self):
12775 * if self.htsfile: # <<<<<<<<<<<<<<
12776 * hts_close(self.htsfile)
12777 * self.htsfile = NULL
12778 */
12779 __pyx_t_1 = (__pyx_v_self->htsfile != 0);
12780 if (__pyx_t_1) {
12781
12782 /* "pysam/libchtslib.pyx":338
12783 * def __dealloc__(self):
12784 * if self.htsfile:
12785 * hts_close(self.htsfile) # <<<<<<<<<<<<<<
12786 * self.htsfile = NULL
12787 *
12788 */
12789 (void)(hts_close(__pyx_v_self->htsfile));
12790
12791 /* "pysam/libchtslib.pyx":339
12792 * if self.htsfile:
12793 * hts_close(self.htsfile)
12794 * self.htsfile = NULL # <<<<<<<<<<<<<<
12795 *
12796 * def flush(self):
12797 */
12798 __pyx_v_self->htsfile = NULL;
12799
12800 /* "pysam/libchtslib.pyx":337
12801 *
12802 * def __dealloc__(self):
12803 * if self.htsfile: # <<<<<<<<<<<<<<
12804 * hts_close(self.htsfile)
12805 * self.htsfile = NULL
12806 */
12807 }
12808
12809 /* "pysam/libchtslib.pyx":336
12810 * self.htsfile = NULL
12811 *
12812 * def __dealloc__(self): # <<<<<<<<<<<<<<
12813 * if self.htsfile:
12814 * hts_close(self.htsfile)
12815 */
12816
12817 /* function exit code */
12818 goto __pyx_L0;
12819 __pyx_L1_error:;
12820 __Pyx_WriteUnraisable("pysam.libchtslib.HTSFile.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
12821 __pyx_L0:;
12822 __Pyx_TraceReturn(Py_None, 0);
12823 }
12824
12825 /* "pysam/libchtslib.pyx":341
12826 * self.htsfile = NULL
12827 *
12828 * def flush(self): # <<<<<<<<<<<<<<
12829 * """Flush any buffered data to the underlying output stream."""
12830 * if self.htsfile:
12831 */
12832
12833 /* Python wrapper */
12834 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_7flush(PyObject *__pyx_v_self,
12835 #if CYTHON_METH_FASTCALL
12836 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
12837 #else
12838 PyObject *__pyx_args, PyObject *__pyx_kwds
12839 #endif
12840 ); /*proto*/
12841 PyDoc_STRVAR(__pyx_doc_5pysam_10libchtslib_7HTSFile_6flush, "HTSFile.flush(self)\nFlush any buffered data to the underlying output stream.");
12842 static PyMethodDef __pyx_mdef_5pysam_10libchtslib_7HTSFile_7flush = {"flush", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_7HTSFile_7flush, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_7HTSFile_6flush};
12843 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_7flush(PyObject *__pyx_v_self,
12844 #if CYTHON_METH_FASTCALL
12845 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
12846 #else
12847 PyObject *__pyx_args, PyObject *__pyx_kwds
12848 #endif
12849 ) {
12850 #if !CYTHON_METH_FASTCALL
12851 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
12852 #endif
12853 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
12854 PyObject *__pyx_r = 0;
12855 __Pyx_RefNannyDeclarations
12856 __Pyx_RefNannySetupContext("flush (wrapper)", 0);
12857 #if !CYTHON_METH_FASTCALL
12858 #if CYTHON_ASSUME_SAFE_MACROS
12859 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
12860 #else
12861 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
12862 #endif
12863 #endif
12864 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
12865 if (unlikely(__pyx_nargs > 0)) {
12866 __Pyx_RaiseArgtupleInvalid("flush", 1, 0, 0, __pyx_nargs); return NULL;}
12867 if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "flush", 0))) return NULL;
12868 __pyx_r = __pyx_pf_5pysam_10libchtslib_7HTSFile_6flush(((struct __pyx_obj_5pysam_10libchtslib_HTSFile *)__pyx_v_self));
12869
12870 /* function exit code */
12871 __Pyx_RefNannyFinishContext();
12872 return __pyx_r;
12873 }
12874
12875 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_6flush(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self) {
12876 PyObject *__pyx_r = NULL;
12877 __Pyx_TraceDeclarations
12878 __Pyx_RefNannyDeclarations
12879 int __pyx_t_1;
12880 PyObject *__pyx_t_2 = NULL;
12881 PyObject *__pyx_t_3 = NULL;
12882 Py_ssize_t __pyx_t_4;
12883 Py_UCS4 __pyx_t_5;
12884 PyObject *__pyx_t_6 = NULL;
12885 PyObject *__pyx_t_7 = NULL;
12886 int __pyx_lineno = 0;
12887 const char *__pyx_filename = NULL;
12888 int __pyx_clineno = 0;
12889 __Pyx_TraceFrameInit(__pyx_codeobj__35)
12890 __Pyx_RefNannySetupContext("flush", 1);
12891 __Pyx_TraceCall("flush", __pyx_f[0], 341, 0, __PYX_ERR(0, 341, __pyx_L1_error));
12892
12893 /* "pysam/libchtslib.pyx":343
12894 * def flush(self):
12895 * """Flush any buffered data to the underlying output stream."""
12896 * if self.htsfile: # <<<<<<<<<<<<<<
12897 * if hts_flush(self.htsfile) < 0:
12898 * raise OSError(errno, f'Flushing {type(self).__name__} failed', force_str(self.filename))
12899 */
12900 __pyx_t_1 = (__pyx_v_self->htsfile != 0);
12901 if (__pyx_t_1) {
12902
12903 /* "pysam/libchtslib.pyx":344
12904 * """Flush any buffered data to the underlying output stream."""
12905 * if self.htsfile:
12906 * if hts_flush(self.htsfile) < 0: # <<<<<<<<<<<<<<
12907 * raise OSError(errno, f'Flushing {type(self).__name__} failed', force_str(self.filename))
12908 *
12909 */
12910 __pyx_t_1 = (hts_flush(__pyx_v_self->htsfile) < 0);
12911 if (unlikely(__pyx_t_1)) {
12912
12913 /* "pysam/libchtslib.pyx":345
12914 * if self.htsfile:
12915 * if hts_flush(self.htsfile) < 0:
12916 * raise OSError(errno, f'Flushing {type(self).__name__} failed', force_str(self.filename)) # <<<<<<<<<<<<<<
12917 *
12918 * def check_truncation(self, ignore_truncation=False):
12919 */
12920 __pyx_t_2 = __Pyx_PyInt_From_int(errno); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 345, __pyx_L1_error)
12921 __Pyx_GOTREF(__pyx_t_2);
12922 __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 345, __pyx_L1_error)
12923 __Pyx_GOTREF(__pyx_t_3);
12924 __pyx_t_4 = 0;
12925 __pyx_t_5 = 127;
12926 __Pyx_INCREF(__pyx_kp_u_Flushing);
12927 __pyx_t_4 += 9;
12928 __Pyx_GIVEREF(__pyx_kp_u_Flushing);
12929 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_Flushing);
12930 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))), __pyx_n_s_name_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 345, __pyx_L1_error)
12931 __Pyx_GOTREF(__pyx_t_6);
12932 __pyx_t_7 = __Pyx_PyObject_FormatSimple(__pyx_t_6, __pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 345, __pyx_L1_error)
12933 __Pyx_GOTREF(__pyx_t_7);
12934 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
12935 __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_5;
12936 __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7);
12937 __Pyx_GIVEREF(__pyx_t_7);
12938 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_7);
12939 __pyx_t_7 = 0;
12940 __Pyx_INCREF(__pyx_kp_u_failed);
12941 __pyx_t_4 += 7;
12942 __Pyx_GIVEREF(__pyx_kp_u_failed);
12943 PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u_failed);
12944 __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 345, __pyx_L1_error)
12945 __Pyx_GOTREF(__pyx_t_7);
12946 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12947 __pyx_t_3 = __pyx_v_self->filename;
12948 __Pyx_INCREF(__pyx_t_3);
12949 __pyx_t_6 = __pyx_f_5pysam_9libcutils_force_str(__pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 345, __pyx_L1_error)
12950 __Pyx_GOTREF(__pyx_t_6);
12951 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12952 __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 345, __pyx_L1_error)
12953 __Pyx_GOTREF(__pyx_t_3);
12954 __Pyx_GIVEREF(__pyx_t_2);
12955 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2)) __PYX_ERR(0, 345, __pyx_L1_error);
12956 __Pyx_GIVEREF(__pyx_t_7);
12957 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_7)) __PYX_ERR(0, 345, __pyx_L1_error);
12958 __Pyx_GIVEREF(__pyx_t_6);
12959 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_6)) __PYX_ERR(0, 345, __pyx_L1_error);
12960 __pyx_t_2 = 0;
12961 __pyx_t_7 = 0;
12962 __pyx_t_6 = 0;
12963 __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_OSError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 345, __pyx_L1_error)
12964 __Pyx_GOTREF(__pyx_t_6);
12965 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12966 __Pyx_Raise(__pyx_t_6, 0, 0, 0);
12967 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
12968 __PYX_ERR(0, 345, __pyx_L1_error)
12969
12970 /* "pysam/libchtslib.pyx":344
12971 * """Flush any buffered data to the underlying output stream."""
12972 * if self.htsfile:
12973 * if hts_flush(self.htsfile) < 0: # <<<<<<<<<<<<<<
12974 * raise OSError(errno, f'Flushing {type(self).__name__} failed', force_str(self.filename))
12975 *
12976 */
12977 }
12978
12979 /* "pysam/libchtslib.pyx":343
12980 * def flush(self):
12981 * """Flush any buffered data to the underlying output stream."""
12982 * if self.htsfile: # <<<<<<<<<<<<<<
12983 * if hts_flush(self.htsfile) < 0:
12984 * raise OSError(errno, f'Flushing {type(self).__name__} failed', force_str(self.filename))
12985 */
12986 }
12987
12988 /* "pysam/libchtslib.pyx":341
12989 * self.htsfile = NULL
12990 *
12991 * def flush(self): # <<<<<<<<<<<<<<
12992 * """Flush any buffered data to the underlying output stream."""
12993 * if self.htsfile:
12994 */
12995
12996 /* function exit code */
12997 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
12998 goto __pyx_L0;
12999 __pyx_L1_error:;
13000 __Pyx_XDECREF(__pyx_t_2);
13001 __Pyx_XDECREF(__pyx_t_3);
13002 __Pyx_XDECREF(__pyx_t_6);
13003 __Pyx_XDECREF(__pyx_t_7);
13004 __Pyx_AddTraceback("pysam.libchtslib.HTSFile.flush", __pyx_clineno, __pyx_lineno, __pyx_filename);
13005 __pyx_r = NULL;
13006 __pyx_L0:;
13007 __Pyx_XGIVEREF(__pyx_r);
13008 __Pyx_TraceReturn(__pyx_r, 0);
13009 __Pyx_RefNannyFinishContext();
13010 return __pyx_r;
13011 }
13012
13013 /* "pysam/libchtslib.pyx":347
13014 * raise OSError(errno, f'Flushing {type(self).__name__} failed', force_str(self.filename))
13015 *
13016 * def check_truncation(self, ignore_truncation=False): # <<<<<<<<<<<<<<
13017 * """Check if file is truncated."""
13018 * if not self.htsfile:
13019 */
13020
13021 /* Python wrapper */
13022 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_9check_truncation(PyObject *__pyx_v_self,
13023 #if CYTHON_METH_FASTCALL
13024 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
13025 #else
13026 PyObject *__pyx_args, PyObject *__pyx_kwds
13027 #endif
13028 ); /*proto*/
13029 PyDoc_STRVAR(__pyx_doc_5pysam_10libchtslib_7HTSFile_8check_truncation, "HTSFile.check_truncation(self, ignore_truncation=False)\nCheck if file is truncated.");
13030 static PyMethodDef __pyx_mdef_5pysam_10libchtslib_7HTSFile_9check_truncation = {"check_truncation", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_7HTSFile_9check_truncation, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_7HTSFile_8check_truncation};
13031 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_9check_truncation(PyObject *__pyx_v_self,
13032 #if CYTHON_METH_FASTCALL
13033 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
13034 #else
13035 PyObject *__pyx_args, PyObject *__pyx_kwds
13036 #endif
13037 ) {
13038 PyObject *__pyx_v_ignore_truncation = 0;
13039 #if !CYTHON_METH_FASTCALL
13040 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
13041 #endif
13042 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
13043 PyObject* values[1] = {0};
13044 int __pyx_lineno = 0;
13045 const char *__pyx_filename = NULL;
13046 int __pyx_clineno = 0;
13047 PyObject *__pyx_r = 0;
13048 __Pyx_RefNannyDeclarations
13049 __Pyx_RefNannySetupContext("check_truncation (wrapper)", 0);
13050 #if !CYTHON_METH_FASTCALL
13051 #if CYTHON_ASSUME_SAFE_MACROS
13052 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
13053 #else
13054 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
13055 #endif
13056 #endif
13057 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
13058 {
13059 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ignore_truncation,0};
13060 values[0] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_False));
13061 if (__pyx_kwds) {
13062 Py_ssize_t kw_args;
13063 switch (__pyx_nargs) {
13064 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
13065 CYTHON_FALLTHROUGH;
13066 case 0: break;
13067 default: goto __pyx_L5_argtuple_error;
13068 }
13069 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
13070 switch (__pyx_nargs) {
13071 case 0:
13072 if (kw_args > 0) {
13073 PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_ignore_truncation);
13074 if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
13075 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 347, __pyx_L3_error)
13076 }
13077 }
13078 if (unlikely(kw_args > 0)) {
13079 const Py_ssize_t kwd_pos_args = __pyx_nargs;
13080 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "check_truncation") < 0)) __PYX_ERR(0, 347, __pyx_L3_error)
13081 }
13082 } else {
13083 switch (__pyx_nargs) {
13084 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
13085 CYTHON_FALLTHROUGH;
13086 case 0: break;
13087 default: goto __pyx_L5_argtuple_error;
13088 }
13089 }
13090 __pyx_v_ignore_truncation = values[0];
13091 }
13092 goto __pyx_L6_skip;
13093 __pyx_L5_argtuple_error:;
13094 __Pyx_RaiseArgtupleInvalid("check_truncation", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 347, __pyx_L3_error)
13095 __pyx_L6_skip:;
13096 goto __pyx_L4_argument_unpacking_done;
13097 __pyx_L3_error:;
13098 {
13099 Py_ssize_t __pyx_temp;
13100 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
13101 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
13102 }
13103 }
13104 __Pyx_AddTraceback("pysam.libchtslib.HTSFile.check_truncation", __pyx_clineno, __pyx_lineno, __pyx_filename);
13105 __Pyx_RefNannyFinishContext();
13106 return NULL;
13107 __pyx_L4_argument_unpacking_done:;
13108 __pyx_r = __pyx_pf_5pysam_10libchtslib_7HTSFile_8check_truncation(((struct __pyx_obj_5pysam_10libchtslib_HTSFile *)__pyx_v_self), __pyx_v_ignore_truncation);
13109
13110 /* function exit code */
13111 {
13112 Py_ssize_t __pyx_temp;
13113 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
13114 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
13115 }
13116 }
13117 __Pyx_RefNannyFinishContext();
13118 return __pyx_r;
13119 }
13120
13121 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_8check_truncation(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self, PyObject *__pyx_v_ignore_truncation) {
13122 BGZF *__pyx_v_bgzfp;
13123 int __pyx_v_ret;
13124 PyObject *__pyx_v_msg = NULL;
13125 PyObject *__pyx_r = NULL;
13126 __Pyx_TraceDeclarations
13127 __Pyx_RefNannyDeclarations
13128 int __pyx_t_1;
13129 PyObject *__pyx_t_2 = NULL;
13130 PyObject *__pyx_t_3 = NULL;
13131 PyObject *__pyx_t_4 = NULL;
13132 unsigned int __pyx_t_5;
13133 int __pyx_lineno = 0;
13134 const char *__pyx_filename = NULL;
13135 int __pyx_clineno = 0;
13136 __Pyx_TraceFrameInit(__pyx_codeobj__36)
13137 __Pyx_RefNannySetupContext("check_truncation", 1);
13138 __Pyx_TraceCall("check_truncation", __pyx_f[0], 347, 0, __PYX_ERR(0, 347, __pyx_L1_error));
13139
13140 /* "pysam/libchtslib.pyx":349
13141 * def check_truncation(self, ignore_truncation=False):
13142 * """Check if file is truncated."""
13143 * if not self.htsfile: # <<<<<<<<<<<<<<
13144 * return
13145 *
13146 */
13147 __pyx_t_1 = (!(__pyx_v_self->htsfile != 0));
13148 if (__pyx_t_1) {
13149
13150 /* "pysam/libchtslib.pyx":350
13151 * """Check if file is truncated."""
13152 * if not self.htsfile:
13153 * return # <<<<<<<<<<<<<<
13154 *
13155 * if self.htsfile.format.compression != bgzf:
13156 */
13157 __Pyx_XDECREF(__pyx_r);
13158 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
13159 goto __pyx_L0;
13160
13161 /* "pysam/libchtslib.pyx":349
13162 * def check_truncation(self, ignore_truncation=False):
13163 * """Check if file is truncated."""
13164 * if not self.htsfile: # <<<<<<<<<<<<<<
13165 * return
13166 *
13167 */
13168 }
13169
13170 /* "pysam/libchtslib.pyx":352
13171 * return
13172 *
13173 * if self.htsfile.format.compression != bgzf: # <<<<<<<<<<<<<<
13174 * return
13175 *
13176 */
13177 __pyx_t_1 = (__pyx_v_self->htsfile->format.compression != bgzf);
13178 if (__pyx_t_1) {
13179
13180 /* "pysam/libchtslib.pyx":353
13181 *
13182 * if self.htsfile.format.compression != bgzf:
13183 * return # <<<<<<<<<<<<<<
13184 *
13185 * cdef BGZF *bgzfp = hts_get_bgzfp(self.htsfile)
13186 */
13187 __Pyx_XDECREF(__pyx_r);
13188 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
13189 goto __pyx_L0;
13190
13191 /* "pysam/libchtslib.pyx":352
13192 * return
13193 *
13194 * if self.htsfile.format.compression != bgzf: # <<<<<<<<<<<<<<
13195 * return
13196 *
13197 */
13198 }
13199
13200 /* "pysam/libchtslib.pyx":355
13201 * return
13202 *
13203 * cdef BGZF *bgzfp = hts_get_bgzfp(self.htsfile) # <<<<<<<<<<<<<<
13204 * if not bgzfp:
13205 * return
13206 */
13207 __pyx_v_bgzfp = hts_get_bgzfp(__pyx_v_self->htsfile);
13208
13209 /* "pysam/libchtslib.pyx":356
13210 *
13211 * cdef BGZF *bgzfp = hts_get_bgzfp(self.htsfile)
13212 * if not bgzfp: # <<<<<<<<<<<<<<
13213 * return
13214 *
13215 */
13216 __pyx_t_1 = (!(__pyx_v_bgzfp != 0));
13217 if (__pyx_t_1) {
13218
13219 /* "pysam/libchtslib.pyx":357
13220 * cdef BGZF *bgzfp = hts_get_bgzfp(self.htsfile)
13221 * if not bgzfp:
13222 * return # <<<<<<<<<<<<<<
13223 *
13224 * cdef int ret = bgzf_check_EOF(bgzfp)
13225 */
13226 __Pyx_XDECREF(__pyx_r);
13227 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
13228 goto __pyx_L0;
13229
13230 /* "pysam/libchtslib.pyx":356
13231 *
13232 * cdef BGZF *bgzfp = hts_get_bgzfp(self.htsfile)
13233 * if not bgzfp: # <<<<<<<<<<<<<<
13234 * return
13235 *
13236 */
13237 }
13238
13239 /* "pysam/libchtslib.pyx":359
13240 * return
13241 *
13242 * cdef int ret = bgzf_check_EOF(bgzfp) # <<<<<<<<<<<<<<
13243 * if ret < 0:
13244 * raise IOError(errno, 'error checking for EOF marker')
13245 */
13246 __pyx_v_ret = bgzf_check_EOF(__pyx_v_bgzfp);
13247
13248 /* "pysam/libchtslib.pyx":360
13249 *
13250 * cdef int ret = bgzf_check_EOF(bgzfp)
13251 * if ret < 0: # <<<<<<<<<<<<<<
13252 * raise IOError(errno, 'error checking for EOF marker')
13253 * elif ret == 0:
13254 */
13255 __pyx_t_1 = (__pyx_v_ret < 0);
13256 if (unlikely(__pyx_t_1)) {
13257
13258 /* "pysam/libchtslib.pyx":361
13259 * cdef int ret = bgzf_check_EOF(bgzfp)
13260 * if ret < 0:
13261 * raise IOError(errno, 'error checking for EOF marker') # <<<<<<<<<<<<<<
13262 * elif ret == 0:
13263 * msg = 'no BGZF EOF marker; file may be truncated'.format(self.filename)
13264 */
13265 __pyx_t_2 = __Pyx_PyInt_From_int(errno); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 361, __pyx_L1_error)
13266 __Pyx_GOTREF(__pyx_t_2);
13267 __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 361, __pyx_L1_error)
13268 __Pyx_GOTREF(__pyx_t_3);
13269 __Pyx_GIVEREF(__pyx_t_2);
13270 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2)) __PYX_ERR(0, 361, __pyx_L1_error);
13271 __Pyx_INCREF(__pyx_kp_u_error_checking_for_EOF_marker);
13272 __Pyx_GIVEREF(__pyx_kp_u_error_checking_for_EOF_marker);
13273 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_kp_u_error_checking_for_EOF_marker)) __PYX_ERR(0, 361, __pyx_L1_error);
13274 __pyx_t_2 = 0;
13275 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 361, __pyx_L1_error)
13276 __Pyx_GOTREF(__pyx_t_2);
13277 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13278 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
13279 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13280 __PYX_ERR(0, 361, __pyx_L1_error)
13281
13282 /* "pysam/libchtslib.pyx":360
13283 *
13284 * cdef int ret = bgzf_check_EOF(bgzfp)
13285 * if ret < 0: # <<<<<<<<<<<<<<
13286 * raise IOError(errno, 'error checking for EOF marker')
13287 * elif ret == 0:
13288 */
13289 }
13290
13291 /* "pysam/libchtslib.pyx":362
13292 * if ret < 0:
13293 * raise IOError(errno, 'error checking for EOF marker')
13294 * elif ret == 0: # <<<<<<<<<<<<<<
13295 * msg = 'no BGZF EOF marker; file may be truncated'.format(self.filename)
13296 * if ignore_truncation:
13297 */
13298 __pyx_t_1 = (__pyx_v_ret == 0);
13299 if (__pyx_t_1) {
13300
13301 /* "pysam/libchtslib.pyx":363
13302 * raise IOError(errno, 'error checking for EOF marker')
13303 * elif ret == 0:
13304 * msg = 'no BGZF EOF marker; file may be truncated'.format(self.filename) # <<<<<<<<<<<<<<
13305 * if ignore_truncation:
13306 * warn(msg)
13307 */
13308 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_no_BGZF_EOF_marker_file_may_be_t, __pyx_n_s_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 363, __pyx_L1_error)
13309 __Pyx_GOTREF(__pyx_t_3);
13310 __pyx_t_4 = NULL;
13311 __pyx_t_5 = 0;
13312 #if CYTHON_UNPACK_METHODS
13313 if (likely(PyMethod_Check(__pyx_t_3))) {
13314 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
13315 if (likely(__pyx_t_4)) {
13316 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
13317 __Pyx_INCREF(__pyx_t_4);
13318 __Pyx_INCREF(function);
13319 __Pyx_DECREF_SET(__pyx_t_3, function);
13320 __pyx_t_5 = 1;
13321 }
13322 }
13323 #endif
13324 {
13325 PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_self->filename};
13326 __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
13327 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
13328 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 363, __pyx_L1_error)
13329 __Pyx_GOTREF(__pyx_t_2);
13330 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13331 }
13332 __pyx_v_msg = __pyx_t_2;
13333 __pyx_t_2 = 0;
13334
13335 /* "pysam/libchtslib.pyx":364
13336 * elif ret == 0:
13337 * msg = 'no BGZF EOF marker; file may be truncated'.format(self.filename)
13338 * if ignore_truncation: # <<<<<<<<<<<<<<
13339 * warn(msg)
13340 * else:
13341 */
13342 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_ignore_truncation); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 364, __pyx_L1_error)
13343 if (likely(__pyx_t_1)) {
13344
13345 /* "pysam/libchtslib.pyx":365
13346 * msg = 'no BGZF EOF marker; file may be truncated'.format(self.filename)
13347 * if ignore_truncation:
13348 * warn(msg) # <<<<<<<<<<<<<<
13349 * else:
13350 * raise IOError(msg)
13351 */
13352 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_warn); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 365, __pyx_L1_error)
13353 __Pyx_GOTREF(__pyx_t_3);
13354 __pyx_t_4 = NULL;
13355 __pyx_t_5 = 0;
13356 #if CYTHON_UNPACK_METHODS
13357 if (unlikely(PyMethod_Check(__pyx_t_3))) {
13358 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
13359 if (likely(__pyx_t_4)) {
13360 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
13361 __Pyx_INCREF(__pyx_t_4);
13362 __Pyx_INCREF(function);
13363 __Pyx_DECREF_SET(__pyx_t_3, function);
13364 __pyx_t_5 = 1;
13365 }
13366 }
13367 #endif
13368 {
13369 PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_v_msg};
13370 __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
13371 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
13372 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 365, __pyx_L1_error)
13373 __Pyx_GOTREF(__pyx_t_2);
13374 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13375 }
13376 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13377
13378 /* "pysam/libchtslib.pyx":364
13379 * elif ret == 0:
13380 * msg = 'no BGZF EOF marker; file may be truncated'.format(self.filename)
13381 * if ignore_truncation: # <<<<<<<<<<<<<<
13382 * warn(msg)
13383 * else:
13384 */
13385 goto __pyx_L7;
13386 }
13387
13388 /* "pysam/libchtslib.pyx":367
13389 * warn(msg)
13390 * else:
13391 * raise IOError(msg) # <<<<<<<<<<<<<<
13392 *
13393 * def __enter__(self):
13394 */
13395 /*else*/ {
13396 __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IOError, __pyx_v_msg); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 367, __pyx_L1_error)
13397 __Pyx_GOTREF(__pyx_t_2);
13398 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
13399 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13400 __PYX_ERR(0, 367, __pyx_L1_error)
13401 }
13402 __pyx_L7:;
13403
13404 /* "pysam/libchtslib.pyx":362
13405 * if ret < 0:
13406 * raise IOError(errno, 'error checking for EOF marker')
13407 * elif ret == 0: # <<<<<<<<<<<<<<
13408 * msg = 'no BGZF EOF marker; file may be truncated'.format(self.filename)
13409 * if ignore_truncation:
13410 */
13411 }
13412
13413 /* "pysam/libchtslib.pyx":347
13414 * raise OSError(errno, f'Flushing {type(self).__name__} failed', force_str(self.filename))
13415 *
13416 * def check_truncation(self, ignore_truncation=False): # <<<<<<<<<<<<<<
13417 * """Check if file is truncated."""
13418 * if not self.htsfile:
13419 */
13420
13421 /* function exit code */
13422 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
13423 goto __pyx_L0;
13424 __pyx_L1_error:;
13425 __Pyx_XDECREF(__pyx_t_2);
13426 __Pyx_XDECREF(__pyx_t_3);
13427 __Pyx_XDECREF(__pyx_t_4);
13428 __Pyx_AddTraceback("pysam.libchtslib.HTSFile.check_truncation", __pyx_clineno, __pyx_lineno, __pyx_filename);
13429 __pyx_r = NULL;
13430 __pyx_L0:;
13431 __Pyx_XDECREF(__pyx_v_msg);
13432 __Pyx_XGIVEREF(__pyx_r);
13433 __Pyx_TraceReturn(__pyx_r, 0);
13434 __Pyx_RefNannyFinishContext();
13435 return __pyx_r;
13436 }
13437
13438 /* "pysam/libchtslib.pyx":369
13439 * raise IOError(msg)
13440 *
13441 * def __enter__(self): # <<<<<<<<<<<<<<
13442 * return self
13443 *
13444 */
13445
13446 /* Python wrapper */
13447 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_11__enter__(PyObject *__pyx_v_self,
13448 #if CYTHON_METH_FASTCALL
13449 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
13450 #else
13451 PyObject *__pyx_args, PyObject *__pyx_kwds
13452 #endif
13453 ); /*proto*/
13454 PyDoc_STRVAR(__pyx_doc_5pysam_10libchtslib_7HTSFile_10__enter__, "HTSFile.__enter__(self)");
13455 static PyMethodDef __pyx_mdef_5pysam_10libchtslib_7HTSFile_11__enter__ = {"__enter__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_7HTSFile_11__enter__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_7HTSFile_10__enter__};
13456 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_11__enter__(PyObject *__pyx_v_self,
13457 #if CYTHON_METH_FASTCALL
13458 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
13459 #else
13460 PyObject *__pyx_args, PyObject *__pyx_kwds
13461 #endif
13462 ) {
13463 #if !CYTHON_METH_FASTCALL
13464 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
13465 #endif
13466 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
13467 PyObject *__pyx_r = 0;
13468 __Pyx_RefNannyDeclarations
13469 __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0);
13470 #if !CYTHON_METH_FASTCALL
13471 #if CYTHON_ASSUME_SAFE_MACROS
13472 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
13473 #else
13474 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
13475 #endif
13476 #endif
13477 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
13478 if (unlikely(__pyx_nargs > 0)) {
13479 __Pyx_RaiseArgtupleInvalid("__enter__", 1, 0, 0, __pyx_nargs); return NULL;}
13480 if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__enter__", 0))) return NULL;
13481 __pyx_r = __pyx_pf_5pysam_10libchtslib_7HTSFile_10__enter__(((struct __pyx_obj_5pysam_10libchtslib_HTSFile *)__pyx_v_self));
13482
13483 /* function exit code */
13484 __Pyx_RefNannyFinishContext();
13485 return __pyx_r;
13486 }
13487
13488 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_10__enter__(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self) {
13489 PyObject *__pyx_r = NULL;
13490 __Pyx_TraceDeclarations
13491 __Pyx_RefNannyDeclarations
13492 int __pyx_lineno = 0;
13493 const char *__pyx_filename = NULL;
13494 int __pyx_clineno = 0;
13495 __Pyx_TraceFrameInit(__pyx_codeobj__37)
13496 __Pyx_RefNannySetupContext("__enter__", 1);
13497 __Pyx_TraceCall("__enter__", __pyx_f[0], 369, 0, __PYX_ERR(0, 369, __pyx_L1_error));
13498
13499 /* "pysam/libchtslib.pyx":370
13500 *
13501 * def __enter__(self):
13502 * return self # <<<<<<<<<<<<<<
13503 *
13504 * def __exit__(self, exc_type, exc_value, traceback):
13505 */
13506 __Pyx_XDECREF(__pyx_r);
13507 __Pyx_INCREF((PyObject *)__pyx_v_self);
13508 __pyx_r = ((PyObject *)__pyx_v_self);
13509 goto __pyx_L0;
13510
13511 /* "pysam/libchtslib.pyx":369
13512 * raise IOError(msg)
13513 *
13514 * def __enter__(self): # <<<<<<<<<<<<<<
13515 * return self
13516 *
13517 */
13518
13519 /* function exit code */
13520 __pyx_L1_error:;
13521 __Pyx_AddTraceback("pysam.libchtslib.HTSFile.__enter__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13522 __pyx_r = NULL;
13523 __pyx_L0:;
13524 __Pyx_XGIVEREF(__pyx_r);
13525 __Pyx_TraceReturn(__pyx_r, 0);
13526 __Pyx_RefNannyFinishContext();
13527 return __pyx_r;
13528 }
13529
13530 /* "pysam/libchtslib.pyx":372
13531 * return self
13532 *
13533 * def __exit__(self, exc_type, exc_value, traceback): # <<<<<<<<<<<<<<
13534 * self.close()
13535 * return False
13536 */
13537
13538 /* Python wrapper */
13539 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_13__exit__(PyObject *__pyx_v_self,
13540 #if CYTHON_METH_FASTCALL
13541 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
13542 #else
13543 PyObject *__pyx_args, PyObject *__pyx_kwds
13544 #endif
13545 ); /*proto*/
13546 PyDoc_STRVAR(__pyx_doc_5pysam_10libchtslib_7HTSFile_12__exit__, "HTSFile.__exit__(self, exc_type, exc_value, traceback)");
13547 static PyMethodDef __pyx_mdef_5pysam_10libchtslib_7HTSFile_13__exit__ = {"__exit__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_7HTSFile_13__exit__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_7HTSFile_12__exit__};
13548 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_13__exit__(PyObject *__pyx_v_self,
13549 #if CYTHON_METH_FASTCALL
13550 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
13551 #else
13552 PyObject *__pyx_args, PyObject *__pyx_kwds
13553 #endif
13554 ) {
13555 CYTHON_UNUSED PyObject *__pyx_v_exc_type = 0;
13556 CYTHON_UNUSED PyObject *__pyx_v_exc_value = 0;
13557 CYTHON_UNUSED PyObject *__pyx_v_traceback = 0;
13558 #if !CYTHON_METH_FASTCALL
13559 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
13560 #endif
13561 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
13562 PyObject* values[3] = {0,0,0};
13563 int __pyx_lineno = 0;
13564 const char *__pyx_filename = NULL;
13565 int __pyx_clineno = 0;
13566 PyObject *__pyx_r = 0;
13567 __Pyx_RefNannyDeclarations
13568 __Pyx_RefNannySetupContext("__exit__ (wrapper)", 0);
13569 #if !CYTHON_METH_FASTCALL
13570 #if CYTHON_ASSUME_SAFE_MACROS
13571 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
13572 #else
13573 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
13574 #endif
13575 #endif
13576 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
13577 {
13578 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_exc_type,&__pyx_n_s_exc_value,&__pyx_n_s_traceback,0};
13579 if (__pyx_kwds) {
13580 Py_ssize_t kw_args;
13581 switch (__pyx_nargs) {
13582 case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
13583 CYTHON_FALLTHROUGH;
13584 case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
13585 CYTHON_FALLTHROUGH;
13586 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
13587 CYTHON_FALLTHROUGH;
13588 case 0: break;
13589 default: goto __pyx_L5_argtuple_error;
13590 }
13591 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
13592 switch (__pyx_nargs) {
13593 case 0:
13594 if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_exc_type)) != 0)) {
13595 (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
13596 kw_args--;
13597 }
13598 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 372, __pyx_L3_error)
13599 else goto __pyx_L5_argtuple_error;
13600 CYTHON_FALLTHROUGH;
13601 case 1:
13602 if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_exc_value)) != 0)) {
13603 (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
13604 kw_args--;
13605 }
13606 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 372, __pyx_L3_error)
13607 else {
13608 __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 1); __PYX_ERR(0, 372, __pyx_L3_error)
13609 }
13610 CYTHON_FALLTHROUGH;
13611 case 2:
13612 if (likely((values[2] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_traceback)) != 0)) {
13613 (void)__Pyx_Arg_NewRef_FASTCALL(values[2]);
13614 kw_args--;
13615 }
13616 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 372, __pyx_L3_error)
13617 else {
13618 __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, 2); __PYX_ERR(0, 372, __pyx_L3_error)
13619 }
13620 }
13621 if (unlikely(kw_args > 0)) {
13622 const Py_ssize_t kwd_pos_args = __pyx_nargs;
13623 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__exit__") < 0)) __PYX_ERR(0, 372, __pyx_L3_error)
13624 }
13625 } else if (unlikely(__pyx_nargs != 3)) {
13626 goto __pyx_L5_argtuple_error;
13627 } else {
13628 values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
13629 values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
13630 values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
13631 }
13632 __pyx_v_exc_type = values[0];
13633 __pyx_v_exc_value = values[1];
13634 __pyx_v_traceback = values[2];
13635 }
13636 goto __pyx_L6_skip;
13637 __pyx_L5_argtuple_error:;
13638 __Pyx_RaiseArgtupleInvalid("__exit__", 1, 3, 3, __pyx_nargs); __PYX_ERR(0, 372, __pyx_L3_error)
13639 __pyx_L6_skip:;
13640 goto __pyx_L4_argument_unpacking_done;
13641 __pyx_L3_error:;
13642 {
13643 Py_ssize_t __pyx_temp;
13644 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
13645 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
13646 }
13647 }
13648 __Pyx_AddTraceback("pysam.libchtslib.HTSFile.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13649 __Pyx_RefNannyFinishContext();
13650 return NULL;
13651 __pyx_L4_argument_unpacking_done:;
13652 __pyx_r = __pyx_pf_5pysam_10libchtslib_7HTSFile_12__exit__(((struct __pyx_obj_5pysam_10libchtslib_HTSFile *)__pyx_v_self), __pyx_v_exc_type, __pyx_v_exc_value, __pyx_v_traceback);
13653
13654 /* function exit code */
13655 {
13656 Py_ssize_t __pyx_temp;
13657 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
13658 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
13659 }
13660 }
13661 __Pyx_RefNannyFinishContext();
13662 return __pyx_r;
13663 }
13664
13665 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_12__exit__(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exc_type, CYTHON_UNUSED PyObject *__pyx_v_exc_value, CYTHON_UNUSED PyObject *__pyx_v_traceback) {
13666 PyObject *__pyx_r = NULL;
13667 __Pyx_TraceDeclarations
13668 __Pyx_RefNannyDeclarations
13669 PyObject *__pyx_t_1 = NULL;
13670 PyObject *__pyx_t_2 = NULL;
13671 PyObject *__pyx_t_3 = NULL;
13672 unsigned int __pyx_t_4;
13673 int __pyx_lineno = 0;
13674 const char *__pyx_filename = NULL;
13675 int __pyx_clineno = 0;
13676 __Pyx_TraceFrameInit(__pyx_codeobj__38)
13677 __Pyx_RefNannySetupContext("__exit__", 1);
13678 __Pyx_TraceCall("__exit__", __pyx_f[0], 372, 0, __PYX_ERR(0, 372, __pyx_L1_error));
13679
13680 /* "pysam/libchtslib.pyx":373
13681 *
13682 * def __exit__(self, exc_type, exc_value, traceback):
13683 * self.close() # <<<<<<<<<<<<<<
13684 * return False
13685 *
13686 */
13687 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_close); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 373, __pyx_L1_error)
13688 __Pyx_GOTREF(__pyx_t_2);
13689 __pyx_t_3 = NULL;
13690 __pyx_t_4 = 0;
13691 #if CYTHON_UNPACK_METHODS
13692 if (likely(PyMethod_Check(__pyx_t_2))) {
13693 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
13694 if (likely(__pyx_t_3)) {
13695 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
13696 __Pyx_INCREF(__pyx_t_3);
13697 __Pyx_INCREF(function);
13698 __Pyx_DECREF_SET(__pyx_t_2, function);
13699 __pyx_t_4 = 1;
13700 }
13701 }
13702 #endif
13703 {
13704 PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
13705 __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
13706 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
13707 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 373, __pyx_L1_error)
13708 __Pyx_GOTREF(__pyx_t_1);
13709 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13710 }
13711 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13712
13713 /* "pysam/libchtslib.pyx":374
13714 * def __exit__(self, exc_type, exc_value, traceback):
13715 * self.close()
13716 * return False # <<<<<<<<<<<<<<
13717 *
13718 * @property
13719 */
13720 __Pyx_XDECREF(__pyx_r);
13721 __Pyx_INCREF(Py_False);
13722 __pyx_r = Py_False;
13723 goto __pyx_L0;
13724
13725 /* "pysam/libchtslib.pyx":372
13726 * return self
13727 *
13728 * def __exit__(self, exc_type, exc_value, traceback): # <<<<<<<<<<<<<<
13729 * self.close()
13730 * return False
13731 */
13732
13733 /* function exit code */
13734 __pyx_L1_error:;
13735 __Pyx_XDECREF(__pyx_t_1);
13736 __Pyx_XDECREF(__pyx_t_2);
13737 __Pyx_XDECREF(__pyx_t_3);
13738 __Pyx_AddTraceback("pysam.libchtslib.HTSFile.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13739 __pyx_r = NULL;
13740 __pyx_L0:;
13741 __Pyx_XGIVEREF(__pyx_r);
13742 __Pyx_TraceReturn(__pyx_r, 0);
13743 __Pyx_RefNannyFinishContext();
13744 return __pyx_r;
13745 }
13746
13747 /* "pysam/libchtslib.pyx":376
13748 * return False
13749 *
13750 * @property # <<<<<<<<<<<<<<
13751 * def category(self):
13752 * """General file format category. One of UNKNOWN, ALIGNMENTS,
13753 */
13754
13755 /* Python wrapper */
13756 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_8category_1__get__(PyObject *__pyx_v_self); /*proto*/
13757 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_8category_1__get__(PyObject *__pyx_v_self) {
13758 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
13759 PyObject *__pyx_r = 0;
13760 __Pyx_RefNannyDeclarations
13761 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
13762 __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
13763 __pyx_r = __pyx_pf_5pysam_10libchtslib_7HTSFile_8category___get__(((struct __pyx_obj_5pysam_10libchtslib_HTSFile *)__pyx_v_self));
13764
13765 /* function exit code */
13766 __Pyx_RefNannyFinishContext();
13767 return __pyx_r;
13768 }
13769
13770 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_8category___get__(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self) {
13771 PyObject *__pyx_r = NULL;
13772 __Pyx_TraceDeclarations
13773 __Pyx_RefNannyDeclarations
13774 int __pyx_t_1;
13775 PyObject *__pyx_t_2 = NULL;
13776 PyObject *__pyx_t_3 = NULL;
13777 int __pyx_lineno = 0;
13778 const char *__pyx_filename = NULL;
13779 int __pyx_clineno = 0;
13780 __Pyx_RefNannySetupContext("__get__", 1);
13781 __Pyx_TraceCall("__get__", __pyx_f[0], 376, 0, __PYX_ERR(0, 376, __pyx_L1_error));
13782
13783 /* "pysam/libchtslib.pyx":380
13784 * """General file format category. One of UNKNOWN, ALIGNMENTS,
13785 * VARIANTS, INDEX, REGIONS"""
13786 * if not self.htsfile: # <<<<<<<<<<<<<<
13787 * raise ValueError('metadata not available on closed file')
13788 * return FORMAT_CATEGORIES[self.htsfile.format.category]
13789 */
13790 __pyx_t_1 = (!(__pyx_v_self->htsfile != 0));
13791 if (unlikely(__pyx_t_1)) {
13792
13793 /* "pysam/libchtslib.pyx":381
13794 * VARIANTS, INDEX, REGIONS"""
13795 * if not self.htsfile:
13796 * raise ValueError('metadata not available on closed file') # <<<<<<<<<<<<<<
13797 * return FORMAT_CATEGORIES[self.htsfile.format.category]
13798 *
13799 */
13800 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__39, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 381, __pyx_L1_error)
13801 __Pyx_GOTREF(__pyx_t_2);
13802 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
13803 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13804 __PYX_ERR(0, 381, __pyx_L1_error)
13805
13806 /* "pysam/libchtslib.pyx":380
13807 * """General file format category. One of UNKNOWN, ALIGNMENTS,
13808 * VARIANTS, INDEX, REGIONS"""
13809 * if not self.htsfile: # <<<<<<<<<<<<<<
13810 * raise ValueError('metadata not available on closed file')
13811 * return FORMAT_CATEGORIES[self.htsfile.format.category]
13812 */
13813 }
13814
13815 /* "pysam/libchtslib.pyx":382
13816 * if not self.htsfile:
13817 * raise ValueError('metadata not available on closed file')
13818 * return FORMAT_CATEGORIES[self.htsfile.format.category] # <<<<<<<<<<<<<<
13819 *
13820 * @property
13821 */
13822 __Pyx_XDECREF(__pyx_r);
13823 if (unlikely(__pyx_v_5pysam_10libchtslib_FORMAT_CATEGORIES == Py_None)) {
13824 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
13825 __PYX_ERR(0, 382, __pyx_L1_error)
13826 }
13827 __pyx_t_2 = __Pyx_PyInt_From_enum__htsFormatCategory(__pyx_v_self->htsfile->format.category); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 382, __pyx_L1_error)
13828 __Pyx_GOTREF(__pyx_t_2);
13829 __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_5pysam_10libchtslib_FORMAT_CATEGORIES, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 382, __pyx_L1_error)
13830 __Pyx_GOTREF(__pyx_t_3);
13831 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13832 __pyx_r = __pyx_t_3;
13833 __pyx_t_3 = 0;
13834 goto __pyx_L0;
13835
13836 /* "pysam/libchtslib.pyx":376
13837 * return False
13838 *
13839 * @property # <<<<<<<<<<<<<<
13840 * def category(self):
13841 * """General file format category. One of UNKNOWN, ALIGNMENTS,
13842 */
13843
13844 /* function exit code */
13845 __pyx_L1_error:;
13846 __Pyx_XDECREF(__pyx_t_2);
13847 __Pyx_XDECREF(__pyx_t_3);
13848 __Pyx_AddTraceback("pysam.libchtslib.HTSFile.category.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13849 __pyx_r = NULL;
13850 __pyx_L0:;
13851 __Pyx_XGIVEREF(__pyx_r);
13852 __Pyx_TraceReturn(__pyx_r, 0);
13853 __Pyx_RefNannyFinishContext();
13854 return __pyx_r;
13855 }
13856
13857 /* "pysam/libchtslib.pyx":384
13858 * return FORMAT_CATEGORIES[self.htsfile.format.category]
13859 *
13860 * @property # <<<<<<<<<<<<<<
13861 * def format(self):
13862 * """File format.
13863 */
13864
13865 /* Python wrapper */
13866 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_6format_1__get__(PyObject *__pyx_v_self); /*proto*/
13867 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_6format_1__get__(PyObject *__pyx_v_self) {
13868 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
13869 PyObject *__pyx_r = 0;
13870 __Pyx_RefNannyDeclarations
13871 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
13872 __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
13873 __pyx_r = __pyx_pf_5pysam_10libchtslib_7HTSFile_6format___get__(((struct __pyx_obj_5pysam_10libchtslib_HTSFile *)__pyx_v_self));
13874
13875 /* function exit code */
13876 __Pyx_RefNannyFinishContext();
13877 return __pyx_r;
13878 }
13879
13880 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_6format___get__(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self) {
13881 PyObject *__pyx_r = NULL;
13882 __Pyx_TraceDeclarations
13883 __Pyx_RefNannyDeclarations
13884 int __pyx_t_1;
13885 PyObject *__pyx_t_2 = NULL;
13886 PyObject *__pyx_t_3 = NULL;
13887 int __pyx_lineno = 0;
13888 const char *__pyx_filename = NULL;
13889 int __pyx_clineno = 0;
13890 __Pyx_RefNannySetupContext("__get__", 1);
13891 __Pyx_TraceCall("__get__", __pyx_f[0], 384, 0, __PYX_ERR(0, 384, __pyx_L1_error));
13892
13893 /* "pysam/libchtslib.pyx":391
13894 * BAI, CRAM, CRAI, VCF, BCF, CSI, GZI, TBI, BED.
13895 * """
13896 * if not self.htsfile: # <<<<<<<<<<<<<<
13897 * raise ValueError('metadata not available on closed file')
13898 * return FORMATS[self.htsfile.format.format]
13899 */
13900 __pyx_t_1 = (!(__pyx_v_self->htsfile != 0));
13901 if (unlikely(__pyx_t_1)) {
13902
13903 /* "pysam/libchtslib.pyx":392
13904 * """
13905 * if not self.htsfile:
13906 * raise ValueError('metadata not available on closed file') # <<<<<<<<<<<<<<
13907 * return FORMATS[self.htsfile.format.format]
13908 *
13909 */
13910 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__39, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 392, __pyx_L1_error)
13911 __Pyx_GOTREF(__pyx_t_2);
13912 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
13913 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13914 __PYX_ERR(0, 392, __pyx_L1_error)
13915
13916 /* "pysam/libchtslib.pyx":391
13917 * BAI, CRAM, CRAI, VCF, BCF, CSI, GZI, TBI, BED.
13918 * """
13919 * if not self.htsfile: # <<<<<<<<<<<<<<
13920 * raise ValueError('metadata not available on closed file')
13921 * return FORMATS[self.htsfile.format.format]
13922 */
13923 }
13924
13925 /* "pysam/libchtslib.pyx":393
13926 * if not self.htsfile:
13927 * raise ValueError('metadata not available on closed file')
13928 * return FORMATS[self.htsfile.format.format] # <<<<<<<<<<<<<<
13929 *
13930 * @property
13931 */
13932 __Pyx_XDECREF(__pyx_r);
13933 if (unlikely(__pyx_v_5pysam_10libchtslib_FORMATS == Py_None)) {
13934 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
13935 __PYX_ERR(0, 393, __pyx_L1_error)
13936 }
13937 __pyx_t_2 = __Pyx_PyInt_From_enum__htsExactFormat(__pyx_v_self->htsfile->format.format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 393, __pyx_L1_error)
13938 __Pyx_GOTREF(__pyx_t_2);
13939 __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_5pysam_10libchtslib_FORMATS, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 393, __pyx_L1_error)
13940 __Pyx_GOTREF(__pyx_t_3);
13941 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13942 __pyx_r = __pyx_t_3;
13943 __pyx_t_3 = 0;
13944 goto __pyx_L0;
13945
13946 /* "pysam/libchtslib.pyx":384
13947 * return FORMAT_CATEGORIES[self.htsfile.format.category]
13948 *
13949 * @property # <<<<<<<<<<<<<<
13950 * def format(self):
13951 * """File format.
13952 */
13953
13954 /* function exit code */
13955 __pyx_L1_error:;
13956 __Pyx_XDECREF(__pyx_t_2);
13957 __Pyx_XDECREF(__pyx_t_3);
13958 __Pyx_AddTraceback("pysam.libchtslib.HTSFile.format.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13959 __pyx_r = NULL;
13960 __pyx_L0:;
13961 __Pyx_XGIVEREF(__pyx_r);
13962 __Pyx_TraceReturn(__pyx_r, 0);
13963 __Pyx_RefNannyFinishContext();
13964 return __pyx_r;
13965 }
13966
13967 /* "pysam/libchtslib.pyx":395
13968 * return FORMATS[self.htsfile.format.format]
13969 *
13970 * @property # <<<<<<<<<<<<<<
13971 * def version(self):
13972 * """Tuple of file format version numbers (major, minor)"""
13973 */
13974
13975 /* Python wrapper */
13976 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_7version_1__get__(PyObject *__pyx_v_self); /*proto*/
13977 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_7version_1__get__(PyObject *__pyx_v_self) {
13978 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
13979 PyObject *__pyx_r = 0;
13980 __Pyx_RefNannyDeclarations
13981 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
13982 __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
13983 __pyx_r = __pyx_pf_5pysam_10libchtslib_7HTSFile_7version___get__(((struct __pyx_obj_5pysam_10libchtslib_HTSFile *)__pyx_v_self));
13984
13985 /* function exit code */
13986 __Pyx_RefNannyFinishContext();
13987 return __pyx_r;
13988 }
13989
13990 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_7version___get__(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self) {
13991 PyObject *__pyx_r = NULL;
13992 __Pyx_TraceDeclarations
13993 __Pyx_RefNannyDeclarations
13994 int __pyx_t_1;
13995 PyObject *__pyx_t_2 = NULL;
13996 PyObject *__pyx_t_3 = NULL;
13997 PyObject *__pyx_t_4 = NULL;
13998 int __pyx_lineno = 0;
13999 const char *__pyx_filename = NULL;
14000 int __pyx_clineno = 0;
14001 __Pyx_RefNannySetupContext("__get__", 1);
14002 __Pyx_TraceCall("__get__", __pyx_f[0], 395, 0, __PYX_ERR(0, 395, __pyx_L1_error));
14003
14004 /* "pysam/libchtslib.pyx":398
14005 * def version(self):
14006 * """Tuple of file format version numbers (major, minor)"""
14007 * if not self.htsfile: # <<<<<<<<<<<<<<
14008 * raise ValueError('metadata not available on closed file')
14009 * return self.htsfile.format.version.major, self.htsfile.format.version.minor
14010 */
14011 __pyx_t_1 = (!(__pyx_v_self->htsfile != 0));
14012 if (unlikely(__pyx_t_1)) {
14013
14014 /* "pysam/libchtslib.pyx":399
14015 * """Tuple of file format version numbers (major, minor)"""
14016 * if not self.htsfile:
14017 * raise ValueError('metadata not available on closed file') # <<<<<<<<<<<<<<
14018 * return self.htsfile.format.version.major, self.htsfile.format.version.minor
14019 *
14020 */
14021 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__39, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 399, __pyx_L1_error)
14022 __Pyx_GOTREF(__pyx_t_2);
14023 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
14024 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14025 __PYX_ERR(0, 399, __pyx_L1_error)
14026
14027 /* "pysam/libchtslib.pyx":398
14028 * def version(self):
14029 * """Tuple of file format version numbers (major, minor)"""
14030 * if not self.htsfile: # <<<<<<<<<<<<<<
14031 * raise ValueError('metadata not available on closed file')
14032 * return self.htsfile.format.version.major, self.htsfile.format.version.minor
14033 */
14034 }
14035
14036 /* "pysam/libchtslib.pyx":400
14037 * if not self.htsfile:
14038 * raise ValueError('metadata not available on closed file')
14039 * return self.htsfile.format.version.major, self.htsfile.format.version.minor # <<<<<<<<<<<<<<
14040 *
14041 * @property
14042 */
14043 __Pyx_XDECREF(__pyx_r);
14044 __pyx_t_2 = __Pyx_PyInt_From_short(__pyx_v_self->htsfile->format.version.major); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 400, __pyx_L1_error)
14045 __Pyx_GOTREF(__pyx_t_2);
14046 __pyx_t_3 = __Pyx_PyInt_From_short(__pyx_v_self->htsfile->format.version.minor); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 400, __pyx_L1_error)
14047 __Pyx_GOTREF(__pyx_t_3);
14048 __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 400, __pyx_L1_error)
14049 __Pyx_GOTREF(__pyx_t_4);
14050 __Pyx_GIVEREF(__pyx_t_2);
14051 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2)) __PYX_ERR(0, 400, __pyx_L1_error);
14052 __Pyx_GIVEREF(__pyx_t_3);
14053 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3)) __PYX_ERR(0, 400, __pyx_L1_error);
14054 __pyx_t_2 = 0;
14055 __pyx_t_3 = 0;
14056 __pyx_r = __pyx_t_4;
14057 __pyx_t_4 = 0;
14058 goto __pyx_L0;
14059
14060 /* "pysam/libchtslib.pyx":395
14061 * return FORMATS[self.htsfile.format.format]
14062 *
14063 * @property # <<<<<<<<<<<<<<
14064 * def version(self):
14065 * """Tuple of file format version numbers (major, minor)"""
14066 */
14067
14068 /* function exit code */
14069 __pyx_L1_error:;
14070 __Pyx_XDECREF(__pyx_t_2);
14071 __Pyx_XDECREF(__pyx_t_3);
14072 __Pyx_XDECREF(__pyx_t_4);
14073 __Pyx_AddTraceback("pysam.libchtslib.HTSFile.version.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
14074 __pyx_r = NULL;
14075 __pyx_L0:;
14076 __Pyx_XGIVEREF(__pyx_r);
14077 __Pyx_TraceReturn(__pyx_r, 0);
14078 __Pyx_RefNannyFinishContext();
14079 return __pyx_r;
14080 }
14081
14082 /* "pysam/libchtslib.pyx":402
14083 * return self.htsfile.format.version.major, self.htsfile.format.version.minor
14084 *
14085 * @property # <<<<<<<<<<<<<<
14086 * def compression(self):
14087 * """File compression.
14088 */
14089
14090 /* Python wrapper */
14091 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_11compression_1__get__(PyObject *__pyx_v_self); /*proto*/
14092 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_11compression_1__get__(PyObject *__pyx_v_self) {
14093 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
14094 PyObject *__pyx_r = 0;
14095 __Pyx_RefNannyDeclarations
14096 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
14097 __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
14098 __pyx_r = __pyx_pf_5pysam_10libchtslib_7HTSFile_11compression___get__(((struct __pyx_obj_5pysam_10libchtslib_HTSFile *)__pyx_v_self));
14099
14100 /* function exit code */
14101 __Pyx_RefNannyFinishContext();
14102 return __pyx_r;
14103 }
14104
14105 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_11compression___get__(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self) {
14106 PyObject *__pyx_r = NULL;
14107 __Pyx_TraceDeclarations
14108 __Pyx_RefNannyDeclarations
14109 int __pyx_t_1;
14110 PyObject *__pyx_t_2 = NULL;
14111 PyObject *__pyx_t_3 = NULL;
14112 int __pyx_lineno = 0;
14113 const char *__pyx_filename = NULL;
14114 int __pyx_clineno = 0;
14115 __Pyx_RefNannySetupContext("__get__", 1);
14116 __Pyx_TraceCall("__get__", __pyx_f[0], 402, 0, __PYX_ERR(0, 402, __pyx_L1_error));
14117
14118 /* "pysam/libchtslib.pyx":407
14119 *
14120 * One of NONE, GZIP, BGZF, CUSTOM."""
14121 * if not self.htsfile: # <<<<<<<<<<<<<<
14122 * raise ValueError('metadata not available on closed file')
14123 * return COMPRESSION[self.htsfile.format.compression]
14124 */
14125 __pyx_t_1 = (!(__pyx_v_self->htsfile != 0));
14126 if (unlikely(__pyx_t_1)) {
14127
14128 /* "pysam/libchtslib.pyx":408
14129 * One of NONE, GZIP, BGZF, CUSTOM."""
14130 * if not self.htsfile:
14131 * raise ValueError('metadata not available on closed file') # <<<<<<<<<<<<<<
14132 * return COMPRESSION[self.htsfile.format.compression]
14133 *
14134 */
14135 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__39, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 408, __pyx_L1_error)
14136 __Pyx_GOTREF(__pyx_t_2);
14137 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
14138 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14139 __PYX_ERR(0, 408, __pyx_L1_error)
14140
14141 /* "pysam/libchtslib.pyx":407
14142 *
14143 * One of NONE, GZIP, BGZF, CUSTOM."""
14144 * if not self.htsfile: # <<<<<<<<<<<<<<
14145 * raise ValueError('metadata not available on closed file')
14146 * return COMPRESSION[self.htsfile.format.compression]
14147 */
14148 }
14149
14150 /* "pysam/libchtslib.pyx":409
14151 * if not self.htsfile:
14152 * raise ValueError('metadata not available on closed file')
14153 * return COMPRESSION[self.htsfile.format.compression] # <<<<<<<<<<<<<<
14154 *
14155 * @property
14156 */
14157 __Pyx_XDECREF(__pyx_r);
14158 if (unlikely(__pyx_v_5pysam_10libchtslib_COMPRESSION == Py_None)) {
14159 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
14160 __PYX_ERR(0, 409, __pyx_L1_error)
14161 }
14162 __pyx_t_2 = __Pyx_PyInt_From_enum__htsCompression(__pyx_v_self->htsfile->format.compression); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 409, __pyx_L1_error)
14163 __Pyx_GOTREF(__pyx_t_2);
14164 __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_5pysam_10libchtslib_COMPRESSION, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 409, __pyx_L1_error)
14165 __Pyx_GOTREF(__pyx_t_3);
14166 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14167 __pyx_r = __pyx_t_3;
14168 __pyx_t_3 = 0;
14169 goto __pyx_L0;
14170
14171 /* "pysam/libchtslib.pyx":402
14172 * return self.htsfile.format.version.major, self.htsfile.format.version.minor
14173 *
14174 * @property # <<<<<<<<<<<<<<
14175 * def compression(self):
14176 * """File compression.
14177 */
14178
14179 /* function exit code */
14180 __pyx_L1_error:;
14181 __Pyx_XDECREF(__pyx_t_2);
14182 __Pyx_XDECREF(__pyx_t_3);
14183 __Pyx_AddTraceback("pysam.libchtslib.HTSFile.compression.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
14184 __pyx_r = NULL;
14185 __pyx_L0:;
14186 __Pyx_XGIVEREF(__pyx_r);
14187 __Pyx_TraceReturn(__pyx_r, 0);
14188 __Pyx_RefNannyFinishContext();
14189 return __pyx_r;
14190 }
14191
14192 /* "pysam/libchtslib.pyx":411
14193 * return COMPRESSION[self.htsfile.format.compression]
14194 *
14195 * @property # <<<<<<<<<<<<<<
14196 * def description(self):
14197 * """Vaguely human readable description of the file format"""
14198 */
14199
14200 /* Python wrapper */
14201 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_11description_1__get__(PyObject *__pyx_v_self); /*proto*/
14202 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_11description_1__get__(PyObject *__pyx_v_self) {
14203 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
14204 PyObject *__pyx_r = 0;
14205 __Pyx_RefNannyDeclarations
14206 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
14207 __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
14208 __pyx_r = __pyx_pf_5pysam_10libchtslib_7HTSFile_11description___get__(((struct __pyx_obj_5pysam_10libchtslib_HTSFile *)__pyx_v_self));
14209
14210 /* function exit code */
14211 __Pyx_RefNannyFinishContext();
14212 return __pyx_r;
14213 }
14214
14215 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_11description___get__(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self) {
14216 char *__pyx_v_desc;
14217 PyObject *__pyx_r = NULL;
14218 __Pyx_TraceDeclarations
14219 __Pyx_RefNannyDeclarations
14220 int __pyx_t_1;
14221 PyObject *__pyx_t_2 = NULL;
14222 int __pyx_t_3;
14223 int __pyx_t_4;
14224 char const *__pyx_t_5;
14225 PyObject *__pyx_t_6 = NULL;
14226 PyObject *__pyx_t_7 = NULL;
14227 PyObject *__pyx_t_8 = NULL;
14228 PyObject *__pyx_t_9 = NULL;
14229 PyObject *__pyx_t_10 = NULL;
14230 PyObject *__pyx_t_11 = NULL;
14231 int __pyx_lineno = 0;
14232 const char *__pyx_filename = NULL;
14233 int __pyx_clineno = 0;
14234 __Pyx_RefNannySetupContext("__get__", 1);
14235 __Pyx_TraceCall("__get__", __pyx_f[0], 411, 0, __PYX_ERR(0, 411, __pyx_L1_error));
14236
14237 /* "pysam/libchtslib.pyx":414
14238 * def description(self):
14239 * """Vaguely human readable description of the file format"""
14240 * if not self.htsfile: # <<<<<<<<<<<<<<
14241 * raise ValueError('metadata not available on closed file')
14242 * cdef char *desc = hts_format_description(&self.htsfile.format)
14243 */
14244 __pyx_t_1 = (!(__pyx_v_self->htsfile != 0));
14245 if (unlikely(__pyx_t_1)) {
14246
14247 /* "pysam/libchtslib.pyx":415
14248 * """Vaguely human readable description of the file format"""
14249 * if not self.htsfile:
14250 * raise ValueError('metadata not available on closed file') # <<<<<<<<<<<<<<
14251 * cdef char *desc = hts_format_description(&self.htsfile.format)
14252 * try:
14253 */
14254 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__39, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 415, __pyx_L1_error)
14255 __Pyx_GOTREF(__pyx_t_2);
14256 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
14257 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14258 __PYX_ERR(0, 415, __pyx_L1_error)
14259
14260 /* "pysam/libchtslib.pyx":414
14261 * def description(self):
14262 * """Vaguely human readable description of the file format"""
14263 * if not self.htsfile: # <<<<<<<<<<<<<<
14264 * raise ValueError('metadata not available on closed file')
14265 * cdef char *desc = hts_format_description(&self.htsfile.format)
14266 */
14267 }
14268
14269 /* "pysam/libchtslib.pyx":416
14270 * if not self.htsfile:
14271 * raise ValueError('metadata not available on closed file')
14272 * cdef char *desc = hts_format_description(&self.htsfile.format) # <<<<<<<<<<<<<<
14273 * try:
14274 * return charptr_to_str(desc)
14275 */
14276 __pyx_v_desc = hts_format_description((&__pyx_v_self->htsfile->format));
14277
14278 /* "pysam/libchtslib.pyx":417
14279 * raise ValueError('metadata not available on closed file')
14280 * cdef char *desc = hts_format_description(&self.htsfile.format)
14281 * try: # <<<<<<<<<<<<<<
14282 * return charptr_to_str(desc)
14283 * finally:
14284 */
14285 /*try:*/ {
14286
14287 /* "pysam/libchtslib.pyx":418
14288 * cdef char *desc = hts_format_description(&self.htsfile.format)
14289 * try:
14290 * return charptr_to_str(desc) # <<<<<<<<<<<<<<
14291 * finally:
14292 * free(desc)
14293 */
14294 __Pyx_XDECREF(__pyx_r);
14295 __pyx_t_2 = __pyx_f_5pysam_9libcutils_charptr_to_str(__pyx_v_desc, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 418, __pyx_L5_error)
14296 __Pyx_GOTREF(__pyx_t_2);
14297 __pyx_r = __pyx_t_2;
14298 __pyx_t_2 = 0;
14299 goto __pyx_L4_return;
14300 }
14301
14302 /* "pysam/libchtslib.pyx":420
14303 * return charptr_to_str(desc)
14304 * finally:
14305 * free(desc) # <<<<<<<<<<<<<<
14306 *
14307 * @property
14308 */
14309 /*finally:*/ {
14310 __pyx_L5_error:;
14311 /*exception exit:*/{
14312 __Pyx_PyThreadState_declare
14313 __Pyx_PyThreadState_assign
14314 __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
14315 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
14316 if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
14317 if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8) < 0)) __Pyx_ErrFetch(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
14318 __Pyx_XGOTREF(__pyx_t_6);
14319 __Pyx_XGOTREF(__pyx_t_7);
14320 __Pyx_XGOTREF(__pyx_t_8);
14321 __Pyx_XGOTREF(__pyx_t_9);
14322 __Pyx_XGOTREF(__pyx_t_10);
14323 __Pyx_XGOTREF(__pyx_t_11);
14324 __pyx_t_3 = __pyx_lineno; __pyx_t_4 = __pyx_clineno; __pyx_t_5 = __pyx_filename;
14325 {
14326 free(__pyx_v_desc);
14327 }
14328 if (PY_MAJOR_VERSION >= 3) {
14329 __Pyx_XGIVEREF(__pyx_t_9);
14330 __Pyx_XGIVEREF(__pyx_t_10);
14331 __Pyx_XGIVEREF(__pyx_t_11);
14332 __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
14333 }
14334 __Pyx_XGIVEREF(__pyx_t_6);
14335 __Pyx_XGIVEREF(__pyx_t_7);
14336 __Pyx_XGIVEREF(__pyx_t_8);
14337 __Pyx_ErrRestore(__pyx_t_6, __pyx_t_7, __pyx_t_8);
14338 __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
14339 __pyx_lineno = __pyx_t_3; __pyx_clineno = __pyx_t_4; __pyx_filename = __pyx_t_5;
14340 goto __pyx_L1_error;
14341 }
14342 __pyx_L4_return: {
14343 __pyx_t_11 = __pyx_r;
14344 __pyx_r = 0;
14345 free(__pyx_v_desc);
14346 __pyx_r = __pyx_t_11;
14347 __pyx_t_11 = 0;
14348 goto __pyx_L0;
14349 }
14350 }
14351
14352 /* "pysam/libchtslib.pyx":411
14353 * return COMPRESSION[self.htsfile.format.compression]
14354 *
14355 * @property # <<<<<<<<<<<<<<
14356 * def description(self):
14357 * """Vaguely human readable description of the file format"""
14358 */
14359
14360 /* function exit code */
14361 __pyx_L1_error:;
14362 __Pyx_XDECREF(__pyx_t_2);
14363 __Pyx_AddTraceback("pysam.libchtslib.HTSFile.description.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
14364 __pyx_r = NULL;
14365 __pyx_L0:;
14366 __Pyx_XGIVEREF(__pyx_r);
14367 __Pyx_TraceReturn(__pyx_r, 0);
14368 __Pyx_RefNannyFinishContext();
14369 return __pyx_r;
14370 }
14371
14372 /* "pysam/libchtslib.pyx":422
14373 * free(desc)
14374 *
14375 * @property # <<<<<<<<<<<<<<
14376 * def is_open(self):
14377 * """return True if HTSFile is open and in a valid state."""
14378 */
14379
14380 /* Python wrapper */
14381 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_7is_open_1__get__(PyObject *__pyx_v_self); /*proto*/
14382 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_7is_open_1__get__(PyObject *__pyx_v_self) {
14383 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
14384 PyObject *__pyx_r = 0;
14385 __Pyx_RefNannyDeclarations
14386 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
14387 __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
14388 __pyx_r = __pyx_pf_5pysam_10libchtslib_7HTSFile_7is_open___get__(((struct __pyx_obj_5pysam_10libchtslib_HTSFile *)__pyx_v_self));
14389
14390 /* function exit code */
14391 __Pyx_RefNannyFinishContext();
14392 return __pyx_r;
14393 }
14394
14395 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_7is_open___get__(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self) {
14396 PyObject *__pyx_r = NULL;
14397 __Pyx_TraceDeclarations
14398 __Pyx_RefNannyDeclarations
14399 PyObject *__pyx_t_1 = NULL;
14400 int __pyx_t_2;
14401 PyObject *__pyx_t_3 = NULL;
14402 int __pyx_lineno = 0;
14403 const char *__pyx_filename = NULL;
14404 int __pyx_clineno = 0;
14405 __Pyx_RefNannySetupContext("__get__", 1);
14406 __Pyx_TraceCall("__get__", __pyx_f[0], 422, 0, __PYX_ERR(0, 422, __pyx_L1_error));
14407
14408 /* "pysam/libchtslib.pyx":425
14409 * def is_open(self):
14410 * """return True if HTSFile is open and in a valid state."""
14411 * return CTrue if self.htsfile != NULL else CFalse # <<<<<<<<<<<<<<
14412 *
14413 * @property
14414 */
14415 __Pyx_XDECREF(__pyx_r);
14416 __pyx_t_2 = (__pyx_v_self->htsfile != NULL);
14417 if (__pyx_t_2) {
14418 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_CTrue); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 425, __pyx_L1_error)
14419 __Pyx_GOTREF(__pyx_t_3);
14420 __pyx_t_1 = __pyx_t_3;
14421 __pyx_t_3 = 0;
14422 } else {
14423 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_CFalse); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 425, __pyx_L1_error)
14424 __Pyx_GOTREF(__pyx_t_3);
14425 __pyx_t_1 = __pyx_t_3;
14426 __pyx_t_3 = 0;
14427 }
14428 __pyx_r = __pyx_t_1;
14429 __pyx_t_1 = 0;
14430 goto __pyx_L0;
14431
14432 /* "pysam/libchtslib.pyx":422
14433 * free(desc)
14434 *
14435 * @property # <<<<<<<<<<<<<<
14436 * def is_open(self):
14437 * """return True if HTSFile is open and in a valid state."""
14438 */
14439
14440 /* function exit code */
14441 __pyx_L1_error:;
14442 __Pyx_XDECREF(__pyx_t_1);
14443 __Pyx_XDECREF(__pyx_t_3);
14444 __Pyx_AddTraceback("pysam.libchtslib.HTSFile.is_open.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
14445 __pyx_r = NULL;
14446 __pyx_L0:;
14447 __Pyx_XGIVEREF(__pyx_r);
14448 __Pyx_TraceReturn(__pyx_r, 0);
14449 __Pyx_RefNannyFinishContext();
14450 return __pyx_r;
14451 }
14452
14453 /* "pysam/libchtslib.pyx":427
14454 * return CTrue if self.htsfile != NULL else CFalse
14455 *
14456 * @property # <<<<<<<<<<<<<<
14457 * def is_closed(self):
14458 * """return True if HTSFile is closed."""
14459 */
14460
14461 /* Python wrapper */
14462 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_9is_closed_1__get__(PyObject *__pyx_v_self); /*proto*/
14463 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_9is_closed_1__get__(PyObject *__pyx_v_self) {
14464 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
14465 PyObject *__pyx_r = 0;
14466 __Pyx_RefNannyDeclarations
14467 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
14468 __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
14469 __pyx_r = __pyx_pf_5pysam_10libchtslib_7HTSFile_9is_closed___get__(((struct __pyx_obj_5pysam_10libchtslib_HTSFile *)__pyx_v_self));
14470
14471 /* function exit code */
14472 __Pyx_RefNannyFinishContext();
14473 return __pyx_r;
14474 }
14475
14476 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_9is_closed___get__(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self) {
14477 PyObject *__pyx_r = NULL;
14478 __Pyx_TraceDeclarations
14479 __Pyx_RefNannyDeclarations
14480 PyObject *__pyx_t_1 = NULL;
14481 int __pyx_lineno = 0;
14482 const char *__pyx_filename = NULL;
14483 int __pyx_clineno = 0;
14484 __Pyx_RefNannySetupContext("__get__", 1);
14485 __Pyx_TraceCall("__get__", __pyx_f[0], 427, 0, __PYX_ERR(0, 427, __pyx_L1_error));
14486
14487 /* "pysam/libchtslib.pyx":430
14488 * def is_closed(self):
14489 * """return True if HTSFile is closed."""
14490 * return self.htsfile == NULL # <<<<<<<<<<<<<<
14491 *
14492 * @property
14493 */
14494 __Pyx_XDECREF(__pyx_r);
14495 __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_self->htsfile == NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 430, __pyx_L1_error)
14496 __Pyx_GOTREF(__pyx_t_1);
14497 __pyx_r = __pyx_t_1;
14498 __pyx_t_1 = 0;
14499 goto __pyx_L0;
14500
14501 /* "pysam/libchtslib.pyx":427
14502 * return CTrue if self.htsfile != NULL else CFalse
14503 *
14504 * @property # <<<<<<<<<<<<<<
14505 * def is_closed(self):
14506 * """return True if HTSFile is closed."""
14507 */
14508
14509 /* function exit code */
14510 __pyx_L1_error:;
14511 __Pyx_XDECREF(__pyx_t_1);
14512 __Pyx_AddTraceback("pysam.libchtslib.HTSFile.is_closed.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
14513 __pyx_r = NULL;
14514 __pyx_L0:;
14515 __Pyx_XGIVEREF(__pyx_r);
14516 __Pyx_TraceReturn(__pyx_r, 0);
14517 __Pyx_RefNannyFinishContext();
14518 return __pyx_r;
14519 }
14520
14521 /* "pysam/libchtslib.pyx":432
14522 * return self.htsfile == NULL
14523 *
14524 * @property # <<<<<<<<<<<<<<
14525 * def closed(self):
14526 * """return True if HTSFile is closed."""
14527 */
14528
14529 /* Python wrapper */
14530 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_6closed_1__get__(PyObject *__pyx_v_self); /*proto*/
14531 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_6closed_1__get__(PyObject *__pyx_v_self) {
14532 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
14533 PyObject *__pyx_r = 0;
14534 __Pyx_RefNannyDeclarations
14535 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
14536 __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
14537 __pyx_r = __pyx_pf_5pysam_10libchtslib_7HTSFile_6closed___get__(((struct __pyx_obj_5pysam_10libchtslib_HTSFile *)__pyx_v_self));
14538
14539 /* function exit code */
14540 __Pyx_RefNannyFinishContext();
14541 return __pyx_r;
14542 }
14543
14544 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_6closed___get__(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self) {
14545 PyObject *__pyx_r = NULL;
14546 __Pyx_TraceDeclarations
14547 __Pyx_RefNannyDeclarations
14548 PyObject *__pyx_t_1 = NULL;
14549 int __pyx_lineno = 0;
14550 const char *__pyx_filename = NULL;
14551 int __pyx_clineno = 0;
14552 __Pyx_RefNannySetupContext("__get__", 1);
14553 __Pyx_TraceCall("__get__", __pyx_f[0], 432, 0, __PYX_ERR(0, 432, __pyx_L1_error));
14554
14555 /* "pysam/libchtslib.pyx":435
14556 * def closed(self):
14557 * """return True if HTSFile is closed."""
14558 * return self.htsfile == NULL # <<<<<<<<<<<<<<
14559 *
14560 * @property
14561 */
14562 __Pyx_XDECREF(__pyx_r);
14563 __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_self->htsfile == NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 435, __pyx_L1_error)
14564 __Pyx_GOTREF(__pyx_t_1);
14565 __pyx_r = __pyx_t_1;
14566 __pyx_t_1 = 0;
14567 goto __pyx_L0;
14568
14569 /* "pysam/libchtslib.pyx":432
14570 * return self.htsfile == NULL
14571 *
14572 * @property # <<<<<<<<<<<<<<
14573 * def closed(self):
14574 * """return True if HTSFile is closed."""
14575 */
14576
14577 /* function exit code */
14578 __pyx_L1_error:;
14579 __Pyx_XDECREF(__pyx_t_1);
14580 __Pyx_AddTraceback("pysam.libchtslib.HTSFile.closed.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
14581 __pyx_r = NULL;
14582 __pyx_L0:;
14583 __Pyx_XGIVEREF(__pyx_r);
14584 __Pyx_TraceReturn(__pyx_r, 0);
14585 __Pyx_RefNannyFinishContext();
14586 return __pyx_r;
14587 }
14588
14589 /* "pysam/libchtslib.pyx":437
14590 * return self.htsfile == NULL
14591 *
14592 * @property # <<<<<<<<<<<<<<
14593 * def is_write(self):
14594 * """return True if HTSFile is open for writing"""
14595 */
14596
14597 /* Python wrapper */
14598 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_8is_write_1__get__(PyObject *__pyx_v_self); /*proto*/
14599 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_8is_write_1__get__(PyObject *__pyx_v_self) {
14600 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
14601 PyObject *__pyx_r = 0;
14602 __Pyx_RefNannyDeclarations
14603 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
14604 __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
14605 __pyx_r = __pyx_pf_5pysam_10libchtslib_7HTSFile_8is_write___get__(((struct __pyx_obj_5pysam_10libchtslib_HTSFile *)__pyx_v_self));
14606
14607 /* function exit code */
14608 __Pyx_RefNannyFinishContext();
14609 return __pyx_r;
14610 }
14611
14612 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_8is_write___get__(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self) {
14613 PyObject *__pyx_r = NULL;
14614 __Pyx_TraceDeclarations
14615 __Pyx_RefNannyDeclarations
14616 PyObject *__pyx_t_1 = NULL;
14617 int __pyx_t_2;
14618 PyObject *__pyx_t_3 = NULL;
14619 int __pyx_lineno = 0;
14620 const char *__pyx_filename = NULL;
14621 int __pyx_clineno = 0;
14622 __Pyx_RefNannySetupContext("__get__", 1);
14623 __Pyx_TraceCall("__get__", __pyx_f[0], 437, 0, __PYX_ERR(0, 437, __pyx_L1_error));
14624
14625 /* "pysam/libchtslib.pyx":440
14626 * def is_write(self):
14627 * """return True if HTSFile is open for writing"""
14628 * return self.htsfile != NULL and self.htsfile.is_write != 0 # <<<<<<<<<<<<<<
14629 *
14630 * @property
14631 */
14632 __Pyx_XDECREF(__pyx_r);
14633 __pyx_t_2 = (__pyx_v_self->htsfile != NULL);
14634 if (__pyx_t_2) {
14635 } else {
14636 __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 440, __pyx_L1_error)
14637 __Pyx_GOTREF(__pyx_t_3);
14638 __pyx_t_1 = __pyx_t_3;
14639 __pyx_t_3 = 0;
14640 goto __pyx_L3_bool_binop_done;
14641 }
14642 __pyx_t_2 = (__pyx_v_self->htsfile->is_write != 0);
14643 __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 440, __pyx_L1_error)
14644 __Pyx_GOTREF(__pyx_t_3);
14645 __pyx_t_1 = __pyx_t_3;
14646 __pyx_t_3 = 0;
14647 __pyx_L3_bool_binop_done:;
14648 __pyx_r = __pyx_t_1;
14649 __pyx_t_1 = 0;
14650 goto __pyx_L0;
14651
14652 /* "pysam/libchtslib.pyx":437
14653 * return self.htsfile == NULL
14654 *
14655 * @property # <<<<<<<<<<<<<<
14656 * def is_write(self):
14657 * """return True if HTSFile is open for writing"""
14658 */
14659
14660 /* function exit code */
14661 __pyx_L1_error:;
14662 __Pyx_XDECREF(__pyx_t_1);
14663 __Pyx_XDECREF(__pyx_t_3);
14664 __Pyx_AddTraceback("pysam.libchtslib.HTSFile.is_write.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
14665 __pyx_r = NULL;
14666 __pyx_L0:;
14667 __Pyx_XGIVEREF(__pyx_r);
14668 __Pyx_TraceReturn(__pyx_r, 0);
14669 __Pyx_RefNannyFinishContext();
14670 return __pyx_r;
14671 }
14672
14673 /* "pysam/libchtslib.pyx":442
14674 * return self.htsfile != NULL and self.htsfile.is_write != 0
14675 *
14676 * @property # <<<<<<<<<<<<<<
14677 * def is_read(self):
14678 * """return True if HTSFile is open for reading"""
14679 */
14680
14681 /* Python wrapper */
14682 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_7is_read_1__get__(PyObject *__pyx_v_self); /*proto*/
14683 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_7is_read_1__get__(PyObject *__pyx_v_self) {
14684 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
14685 PyObject *__pyx_r = 0;
14686 __Pyx_RefNannyDeclarations
14687 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
14688 __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
14689 __pyx_r = __pyx_pf_5pysam_10libchtslib_7HTSFile_7is_read___get__(((struct __pyx_obj_5pysam_10libchtslib_HTSFile *)__pyx_v_self));
14690
14691 /* function exit code */
14692 __Pyx_RefNannyFinishContext();
14693 return __pyx_r;
14694 }
14695
14696 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_7is_read___get__(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self) {
14697 PyObject *__pyx_r = NULL;
14698 __Pyx_TraceDeclarations
14699 __Pyx_RefNannyDeclarations
14700 PyObject *__pyx_t_1 = NULL;
14701 int __pyx_t_2;
14702 PyObject *__pyx_t_3 = NULL;
14703 int __pyx_lineno = 0;
14704 const char *__pyx_filename = NULL;
14705 int __pyx_clineno = 0;
14706 __Pyx_RefNannySetupContext("__get__", 1);
14707 __Pyx_TraceCall("__get__", __pyx_f[0], 442, 0, __PYX_ERR(0, 442, __pyx_L1_error));
14708
14709 /* "pysam/libchtslib.pyx":445
14710 * def is_read(self):
14711 * """return True if HTSFile is open for reading"""
14712 * return self.htsfile != NULL and self.htsfile.is_write == 0 # <<<<<<<<<<<<<<
14713 *
14714 * @property
14715 */
14716 __Pyx_XDECREF(__pyx_r);
14717 __pyx_t_2 = (__pyx_v_self->htsfile != NULL);
14718 if (__pyx_t_2) {
14719 } else {
14720 __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 445, __pyx_L1_error)
14721 __Pyx_GOTREF(__pyx_t_3);
14722 __pyx_t_1 = __pyx_t_3;
14723 __pyx_t_3 = 0;
14724 goto __pyx_L3_bool_binop_done;
14725 }
14726 __pyx_t_2 = (__pyx_v_self->htsfile->is_write == 0);
14727 __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 445, __pyx_L1_error)
14728 __Pyx_GOTREF(__pyx_t_3);
14729 __pyx_t_1 = __pyx_t_3;
14730 __pyx_t_3 = 0;
14731 __pyx_L3_bool_binop_done:;
14732 __pyx_r = __pyx_t_1;
14733 __pyx_t_1 = 0;
14734 goto __pyx_L0;
14735
14736 /* "pysam/libchtslib.pyx":442
14737 * return self.htsfile != NULL and self.htsfile.is_write != 0
14738 *
14739 * @property # <<<<<<<<<<<<<<
14740 * def is_read(self):
14741 * """return True if HTSFile is open for reading"""
14742 */
14743
14744 /* function exit code */
14745 __pyx_L1_error:;
14746 __Pyx_XDECREF(__pyx_t_1);
14747 __Pyx_XDECREF(__pyx_t_3);
14748 __Pyx_AddTraceback("pysam.libchtslib.HTSFile.is_read.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
14749 __pyx_r = NULL;
14750 __pyx_L0:;
14751 __Pyx_XGIVEREF(__pyx_r);
14752 __Pyx_TraceReturn(__pyx_r, 0);
14753 __Pyx_RefNannyFinishContext();
14754 return __pyx_r;
14755 }
14756
14757 /* "pysam/libchtslib.pyx":447
14758 * return self.htsfile != NULL and self.htsfile.is_write == 0
14759 *
14760 * @property # <<<<<<<<<<<<<<
14761 * def is_sam(self):
14762 * """return True if HTSFile is reading or writing a SAM alignment file"""
14763 */
14764
14765 /* Python wrapper */
14766 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_6is_sam_1__get__(PyObject *__pyx_v_self); /*proto*/
14767 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_6is_sam_1__get__(PyObject *__pyx_v_self) {
14768 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
14769 PyObject *__pyx_r = 0;
14770 __Pyx_RefNannyDeclarations
14771 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
14772 __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
14773 __pyx_r = __pyx_pf_5pysam_10libchtslib_7HTSFile_6is_sam___get__(((struct __pyx_obj_5pysam_10libchtslib_HTSFile *)__pyx_v_self));
14774
14775 /* function exit code */
14776 __Pyx_RefNannyFinishContext();
14777 return __pyx_r;
14778 }
14779
14780 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_6is_sam___get__(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self) {
14781 PyObject *__pyx_r = NULL;
14782 __Pyx_TraceDeclarations
14783 __Pyx_RefNannyDeclarations
14784 PyObject *__pyx_t_1 = NULL;
14785 int __pyx_t_2;
14786 PyObject *__pyx_t_3 = NULL;
14787 int __pyx_lineno = 0;
14788 const char *__pyx_filename = NULL;
14789 int __pyx_clineno = 0;
14790 __Pyx_RefNannySetupContext("__get__", 1);
14791 __Pyx_TraceCall("__get__", __pyx_f[0], 447, 0, __PYX_ERR(0, 447, __pyx_L1_error));
14792
14793 /* "pysam/libchtslib.pyx":450
14794 * def is_sam(self):
14795 * """return True if HTSFile is reading or writing a SAM alignment file"""
14796 * return self.htsfile != NULL and self.htsfile.format.format == sam # <<<<<<<<<<<<<<
14797 *
14798 * @property
14799 */
14800 __Pyx_XDECREF(__pyx_r);
14801 __pyx_t_2 = (__pyx_v_self->htsfile != NULL);
14802 if (__pyx_t_2) {
14803 } else {
14804 __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 450, __pyx_L1_error)
14805 __Pyx_GOTREF(__pyx_t_3);
14806 __pyx_t_1 = __pyx_t_3;
14807 __pyx_t_3 = 0;
14808 goto __pyx_L3_bool_binop_done;
14809 }
14810 __pyx_t_2 = (__pyx_v_self->htsfile->format.format == sam);
14811 __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 450, __pyx_L1_error)
14812 __Pyx_GOTREF(__pyx_t_3);
14813 __pyx_t_1 = __pyx_t_3;
14814 __pyx_t_3 = 0;
14815 __pyx_L3_bool_binop_done:;
14816 __pyx_r = __pyx_t_1;
14817 __pyx_t_1 = 0;
14818 goto __pyx_L0;
14819
14820 /* "pysam/libchtslib.pyx":447
14821 * return self.htsfile != NULL and self.htsfile.is_write == 0
14822 *
14823 * @property # <<<<<<<<<<<<<<
14824 * def is_sam(self):
14825 * """return True if HTSFile is reading or writing a SAM alignment file"""
14826 */
14827
14828 /* function exit code */
14829 __pyx_L1_error:;
14830 __Pyx_XDECREF(__pyx_t_1);
14831 __Pyx_XDECREF(__pyx_t_3);
14832 __Pyx_AddTraceback("pysam.libchtslib.HTSFile.is_sam.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
14833 __pyx_r = NULL;
14834 __pyx_L0:;
14835 __Pyx_XGIVEREF(__pyx_r);
14836 __Pyx_TraceReturn(__pyx_r, 0);
14837 __Pyx_RefNannyFinishContext();
14838 return __pyx_r;
14839 }
14840
14841 /* "pysam/libchtslib.pyx":452
14842 * return self.htsfile != NULL and self.htsfile.format.format == sam
14843 *
14844 * @property # <<<<<<<<<<<<<<
14845 * def is_bam(self):
14846 * """return True if HTSFile is reading or writing a BAM alignment file"""
14847 */
14848
14849 /* Python wrapper */
14850 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_6is_bam_1__get__(PyObject *__pyx_v_self); /*proto*/
14851 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_6is_bam_1__get__(PyObject *__pyx_v_self) {
14852 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
14853 PyObject *__pyx_r = 0;
14854 __Pyx_RefNannyDeclarations
14855 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
14856 __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
14857 __pyx_r = __pyx_pf_5pysam_10libchtslib_7HTSFile_6is_bam___get__(((struct __pyx_obj_5pysam_10libchtslib_HTSFile *)__pyx_v_self));
14858
14859 /* function exit code */
14860 __Pyx_RefNannyFinishContext();
14861 return __pyx_r;
14862 }
14863
14864 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_6is_bam___get__(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self) {
14865 PyObject *__pyx_r = NULL;
14866 __Pyx_TraceDeclarations
14867 __Pyx_RefNannyDeclarations
14868 PyObject *__pyx_t_1 = NULL;
14869 int __pyx_t_2;
14870 PyObject *__pyx_t_3 = NULL;
14871 int __pyx_lineno = 0;
14872 const char *__pyx_filename = NULL;
14873 int __pyx_clineno = 0;
14874 __Pyx_RefNannySetupContext("__get__", 1);
14875 __Pyx_TraceCall("__get__", __pyx_f[0], 452, 0, __PYX_ERR(0, 452, __pyx_L1_error));
14876
14877 /* "pysam/libchtslib.pyx":455
14878 * def is_bam(self):
14879 * """return True if HTSFile is reading or writing a BAM alignment file"""
14880 * return self.htsfile != NULL and self.htsfile.format.format == bam # <<<<<<<<<<<<<<
14881 *
14882 * @property
14883 */
14884 __Pyx_XDECREF(__pyx_r);
14885 __pyx_t_2 = (__pyx_v_self->htsfile != NULL);
14886 if (__pyx_t_2) {
14887 } else {
14888 __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 455, __pyx_L1_error)
14889 __Pyx_GOTREF(__pyx_t_3);
14890 __pyx_t_1 = __pyx_t_3;
14891 __pyx_t_3 = 0;
14892 goto __pyx_L3_bool_binop_done;
14893 }
14894 __pyx_t_2 = (__pyx_v_self->htsfile->format.format == bam);
14895 __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 455, __pyx_L1_error)
14896 __Pyx_GOTREF(__pyx_t_3);
14897 __pyx_t_1 = __pyx_t_3;
14898 __pyx_t_3 = 0;
14899 __pyx_L3_bool_binop_done:;
14900 __pyx_r = __pyx_t_1;
14901 __pyx_t_1 = 0;
14902 goto __pyx_L0;
14903
14904 /* "pysam/libchtslib.pyx":452
14905 * return self.htsfile != NULL and self.htsfile.format.format == sam
14906 *
14907 * @property # <<<<<<<<<<<<<<
14908 * def is_bam(self):
14909 * """return True if HTSFile is reading or writing a BAM alignment file"""
14910 */
14911
14912 /* function exit code */
14913 __pyx_L1_error:;
14914 __Pyx_XDECREF(__pyx_t_1);
14915 __Pyx_XDECREF(__pyx_t_3);
14916 __Pyx_AddTraceback("pysam.libchtslib.HTSFile.is_bam.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
14917 __pyx_r = NULL;
14918 __pyx_L0:;
14919 __Pyx_XGIVEREF(__pyx_r);
14920 __Pyx_TraceReturn(__pyx_r, 0);
14921 __Pyx_RefNannyFinishContext();
14922 return __pyx_r;
14923 }
14924
14925 /* "pysam/libchtslib.pyx":457
14926 * return self.htsfile != NULL and self.htsfile.format.format == bam
14927 *
14928 * @property # <<<<<<<<<<<<<<
14929 * def is_cram(self):
14930 * """return True if HTSFile is reading or writing a BAM alignment file"""
14931 */
14932
14933 /* Python wrapper */
14934 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_7is_cram_1__get__(PyObject *__pyx_v_self); /*proto*/
14935 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_7is_cram_1__get__(PyObject *__pyx_v_self) {
14936 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
14937 PyObject *__pyx_r = 0;
14938 __Pyx_RefNannyDeclarations
14939 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
14940 __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
14941 __pyx_r = __pyx_pf_5pysam_10libchtslib_7HTSFile_7is_cram___get__(((struct __pyx_obj_5pysam_10libchtslib_HTSFile *)__pyx_v_self));
14942
14943 /* function exit code */
14944 __Pyx_RefNannyFinishContext();
14945 return __pyx_r;
14946 }
14947
14948 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_7is_cram___get__(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self) {
14949 PyObject *__pyx_r = NULL;
14950 __Pyx_TraceDeclarations
14951 __Pyx_RefNannyDeclarations
14952 PyObject *__pyx_t_1 = NULL;
14953 int __pyx_t_2;
14954 PyObject *__pyx_t_3 = NULL;
14955 int __pyx_lineno = 0;
14956 const char *__pyx_filename = NULL;
14957 int __pyx_clineno = 0;
14958 __Pyx_RefNannySetupContext("__get__", 1);
14959 __Pyx_TraceCall("__get__", __pyx_f[0], 457, 0, __PYX_ERR(0, 457, __pyx_L1_error));
14960
14961 /* "pysam/libchtslib.pyx":460
14962 * def is_cram(self):
14963 * """return True if HTSFile is reading or writing a BAM alignment file"""
14964 * return self.htsfile != NULL and self.htsfile.format.format == cram # <<<<<<<<<<<<<<
14965 *
14966 * @property
14967 */
14968 __Pyx_XDECREF(__pyx_r);
14969 __pyx_t_2 = (__pyx_v_self->htsfile != NULL);
14970 if (__pyx_t_2) {
14971 } else {
14972 __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 460, __pyx_L1_error)
14973 __Pyx_GOTREF(__pyx_t_3);
14974 __pyx_t_1 = __pyx_t_3;
14975 __pyx_t_3 = 0;
14976 goto __pyx_L3_bool_binop_done;
14977 }
14978 __pyx_t_2 = (__pyx_v_self->htsfile->format.format == cram);
14979 __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 460, __pyx_L1_error)
14980 __Pyx_GOTREF(__pyx_t_3);
14981 __pyx_t_1 = __pyx_t_3;
14982 __pyx_t_3 = 0;
14983 __pyx_L3_bool_binop_done:;
14984 __pyx_r = __pyx_t_1;
14985 __pyx_t_1 = 0;
14986 goto __pyx_L0;
14987
14988 /* "pysam/libchtslib.pyx":457
14989 * return self.htsfile != NULL and self.htsfile.format.format == bam
14990 *
14991 * @property # <<<<<<<<<<<<<<
14992 * def is_cram(self):
14993 * """return True if HTSFile is reading or writing a BAM alignment file"""
14994 */
14995
14996 /* function exit code */
14997 __pyx_L1_error:;
14998 __Pyx_XDECREF(__pyx_t_1);
14999 __Pyx_XDECREF(__pyx_t_3);
15000 __Pyx_AddTraceback("pysam.libchtslib.HTSFile.is_cram.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
15001 __pyx_r = NULL;
15002 __pyx_L0:;
15003 __Pyx_XGIVEREF(__pyx_r);
15004 __Pyx_TraceReturn(__pyx_r, 0);
15005 __Pyx_RefNannyFinishContext();
15006 return __pyx_r;
15007 }
15008
15009 /* "pysam/libchtslib.pyx":462
15010 * return self.htsfile != NULL and self.htsfile.format.format == cram
15011 *
15012 * @property # <<<<<<<<<<<<<<
15013 * def is_vcf(self):
15014 * """return True if HTSFile is reading or writing a VCF variant file"""
15015 */
15016
15017 /* Python wrapper */
15018 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_6is_vcf_1__get__(PyObject *__pyx_v_self); /*proto*/
15019 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_6is_vcf_1__get__(PyObject *__pyx_v_self) {
15020 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
15021 PyObject *__pyx_r = 0;
15022 __Pyx_RefNannyDeclarations
15023 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
15024 __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
15025 __pyx_r = __pyx_pf_5pysam_10libchtslib_7HTSFile_6is_vcf___get__(((struct __pyx_obj_5pysam_10libchtslib_HTSFile *)__pyx_v_self));
15026
15027 /* function exit code */
15028 __Pyx_RefNannyFinishContext();
15029 return __pyx_r;
15030 }
15031
15032 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_6is_vcf___get__(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self) {
15033 PyObject *__pyx_r = NULL;
15034 __Pyx_TraceDeclarations
15035 __Pyx_RefNannyDeclarations
15036 PyObject *__pyx_t_1 = NULL;
15037 int __pyx_t_2;
15038 PyObject *__pyx_t_3 = NULL;
15039 int __pyx_lineno = 0;
15040 const char *__pyx_filename = NULL;
15041 int __pyx_clineno = 0;
15042 __Pyx_RefNannySetupContext("__get__", 1);
15043 __Pyx_TraceCall("__get__", __pyx_f[0], 462, 0, __PYX_ERR(0, 462, __pyx_L1_error));
15044
15045 /* "pysam/libchtslib.pyx":465
15046 * def is_vcf(self):
15047 * """return True if HTSFile is reading or writing a VCF variant file"""
15048 * return self.htsfile != NULL and self.htsfile.format.format == vcf # <<<<<<<<<<<<<<
15049 *
15050 * @property
15051 */
15052 __Pyx_XDECREF(__pyx_r);
15053 __pyx_t_2 = (__pyx_v_self->htsfile != NULL);
15054 if (__pyx_t_2) {
15055 } else {
15056 __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 465, __pyx_L1_error)
15057 __Pyx_GOTREF(__pyx_t_3);
15058 __pyx_t_1 = __pyx_t_3;
15059 __pyx_t_3 = 0;
15060 goto __pyx_L3_bool_binop_done;
15061 }
15062 __pyx_t_2 = (__pyx_v_self->htsfile->format.format == vcf);
15063 __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 465, __pyx_L1_error)
15064 __Pyx_GOTREF(__pyx_t_3);
15065 __pyx_t_1 = __pyx_t_3;
15066 __pyx_t_3 = 0;
15067 __pyx_L3_bool_binop_done:;
15068 __pyx_r = __pyx_t_1;
15069 __pyx_t_1 = 0;
15070 goto __pyx_L0;
15071
15072 /* "pysam/libchtslib.pyx":462
15073 * return self.htsfile != NULL and self.htsfile.format.format == cram
15074 *
15075 * @property # <<<<<<<<<<<<<<
15076 * def is_vcf(self):
15077 * """return True if HTSFile is reading or writing a VCF variant file"""
15078 */
15079
15080 /* function exit code */
15081 __pyx_L1_error:;
15082 __Pyx_XDECREF(__pyx_t_1);
15083 __Pyx_XDECREF(__pyx_t_3);
15084 __Pyx_AddTraceback("pysam.libchtslib.HTSFile.is_vcf.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
15085 __pyx_r = NULL;
15086 __pyx_L0:;
15087 __Pyx_XGIVEREF(__pyx_r);
15088 __Pyx_TraceReturn(__pyx_r, 0);
15089 __Pyx_RefNannyFinishContext();
15090 return __pyx_r;
15091 }
15092
15093 /* "pysam/libchtslib.pyx":467
15094 * return self.htsfile != NULL and self.htsfile.format.format == vcf
15095 *
15096 * @property # <<<<<<<<<<<<<<
15097 * def is_bcf(self):
15098 * """return True if HTSFile is reading or writing a BCF variant file"""
15099 */
15100
15101 /* Python wrapper */
15102 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_6is_bcf_1__get__(PyObject *__pyx_v_self); /*proto*/
15103 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_6is_bcf_1__get__(PyObject *__pyx_v_self) {
15104 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
15105 PyObject *__pyx_r = 0;
15106 __Pyx_RefNannyDeclarations
15107 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
15108 __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
15109 __pyx_r = __pyx_pf_5pysam_10libchtslib_7HTSFile_6is_bcf___get__(((struct __pyx_obj_5pysam_10libchtslib_HTSFile *)__pyx_v_self));
15110
15111 /* function exit code */
15112 __Pyx_RefNannyFinishContext();
15113 return __pyx_r;
15114 }
15115
15116 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_6is_bcf___get__(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self) {
15117 PyObject *__pyx_r = NULL;
15118 __Pyx_TraceDeclarations
15119 __Pyx_RefNannyDeclarations
15120 PyObject *__pyx_t_1 = NULL;
15121 int __pyx_t_2;
15122 PyObject *__pyx_t_3 = NULL;
15123 int __pyx_lineno = 0;
15124 const char *__pyx_filename = NULL;
15125 int __pyx_clineno = 0;
15126 __Pyx_RefNannySetupContext("__get__", 1);
15127 __Pyx_TraceCall("__get__", __pyx_f[0], 467, 0, __PYX_ERR(0, 467, __pyx_L1_error));
15128
15129 /* "pysam/libchtslib.pyx":470
15130 * def is_bcf(self):
15131 * """return True if HTSFile is reading or writing a BCF variant file"""
15132 * return self.htsfile != NULL and self.htsfile.format.format == bcf # <<<<<<<<<<<<<<
15133 *
15134 * def reset(self):
15135 */
15136 __Pyx_XDECREF(__pyx_r);
15137 __pyx_t_2 = (__pyx_v_self->htsfile != NULL);
15138 if (__pyx_t_2) {
15139 } else {
15140 __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 470, __pyx_L1_error)
15141 __Pyx_GOTREF(__pyx_t_3);
15142 __pyx_t_1 = __pyx_t_3;
15143 __pyx_t_3 = 0;
15144 goto __pyx_L3_bool_binop_done;
15145 }
15146 __pyx_t_2 = (__pyx_v_self->htsfile->format.format == bcf);
15147 __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 470, __pyx_L1_error)
15148 __Pyx_GOTREF(__pyx_t_3);
15149 __pyx_t_1 = __pyx_t_3;
15150 __pyx_t_3 = 0;
15151 __pyx_L3_bool_binop_done:;
15152 __pyx_r = __pyx_t_1;
15153 __pyx_t_1 = 0;
15154 goto __pyx_L0;
15155
15156 /* "pysam/libchtslib.pyx":467
15157 * return self.htsfile != NULL and self.htsfile.format.format == vcf
15158 *
15159 * @property # <<<<<<<<<<<<<<
15160 * def is_bcf(self):
15161 * """return True if HTSFile is reading or writing a BCF variant file"""
15162 */
15163
15164 /* function exit code */
15165 __pyx_L1_error:;
15166 __Pyx_XDECREF(__pyx_t_1);
15167 __Pyx_XDECREF(__pyx_t_3);
15168 __Pyx_AddTraceback("pysam.libchtslib.HTSFile.is_bcf.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
15169 __pyx_r = NULL;
15170 __pyx_L0:;
15171 __Pyx_XGIVEREF(__pyx_r);
15172 __Pyx_TraceReturn(__pyx_r, 0);
15173 __Pyx_RefNannyFinishContext();
15174 return __pyx_r;
15175 }
15176
15177 /* "pysam/libchtslib.pyx":472
15178 * return self.htsfile != NULL and self.htsfile.format.format == bcf
15179 *
15180 * def reset(self): # <<<<<<<<<<<<<<
15181 * """reset file position to beginning of file just after the header.
15182 *
15183 */
15184
15185 /* Python wrapper */
15186 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_15reset(PyObject *__pyx_v_self,
15187 #if CYTHON_METH_FASTCALL
15188 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
15189 #else
15190 PyObject *__pyx_args, PyObject *__pyx_kwds
15191 #endif
15192 ); /*proto*/
15193 PyDoc_STRVAR(__pyx_doc_5pysam_10libchtslib_7HTSFile_14reset, "HTSFile.reset(self)\nreset file position to beginning of file just after the header.\n\n Returns\n -------\n\n The file position after moving the file pointer. : pointer\n\n ");
15194 static PyMethodDef __pyx_mdef_5pysam_10libchtslib_7HTSFile_15reset = {"reset", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_7HTSFile_15reset, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_7HTSFile_14reset};
15195 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_15reset(PyObject *__pyx_v_self,
15196 #if CYTHON_METH_FASTCALL
15197 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
15198 #else
15199 PyObject *__pyx_args, PyObject *__pyx_kwds
15200 #endif
15201 ) {
15202 #if !CYTHON_METH_FASTCALL
15203 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
15204 #endif
15205 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
15206 PyObject *__pyx_r = 0;
15207 __Pyx_RefNannyDeclarations
15208 __Pyx_RefNannySetupContext("reset (wrapper)", 0);
15209 #if !CYTHON_METH_FASTCALL
15210 #if CYTHON_ASSUME_SAFE_MACROS
15211 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
15212 #else
15213 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
15214 #endif
15215 #endif
15216 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
15217 if (unlikely(__pyx_nargs > 0)) {
15218 __Pyx_RaiseArgtupleInvalid("reset", 1, 0, 0, __pyx_nargs); return NULL;}
15219 if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "reset", 0))) return NULL;
15220 __pyx_r = __pyx_pf_5pysam_10libchtslib_7HTSFile_14reset(((struct __pyx_obj_5pysam_10libchtslib_HTSFile *)__pyx_v_self));
15221
15222 /* function exit code */
15223 __Pyx_RefNannyFinishContext();
15224 return __pyx_r;
15225 }
15226
15227 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_14reset(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self) {
15228 PyObject *__pyx_r = NULL;
15229 __Pyx_TraceDeclarations
15230 __Pyx_RefNannyDeclarations
15231 PyObject *__pyx_t_1 = NULL;
15232 PyObject *__pyx_t_2 = NULL;
15233 PyObject *__pyx_t_3 = NULL;
15234 PyObject *__pyx_t_4 = NULL;
15235 unsigned int __pyx_t_5;
15236 int __pyx_lineno = 0;
15237 const char *__pyx_filename = NULL;
15238 int __pyx_clineno = 0;
15239 __Pyx_TraceFrameInit(__pyx_codeobj__40)
15240 __Pyx_RefNannySetupContext("reset", 1);
15241 __Pyx_TraceCall("reset", __pyx_f[0], 472, 0, __PYX_ERR(0, 472, __pyx_L1_error));
15242
15243 /* "pysam/libchtslib.pyx":481
15244 *
15245 * """
15246 * return self.seek(self.start_offset) # <<<<<<<<<<<<<<
15247 *
15248 * def seek(self, uint64_t offset, int whence=io.SEEK_SET):
15249 */
15250 __Pyx_XDECREF(__pyx_r);
15251 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_seek); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 481, __pyx_L1_error)
15252 __Pyx_GOTREF(__pyx_t_2);
15253 __pyx_t_3 = __Pyx_PyInt_From_int64_t(__pyx_v_self->start_offset); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 481, __pyx_L1_error)
15254 __Pyx_GOTREF(__pyx_t_3);
15255 __pyx_t_4 = NULL;
15256 __pyx_t_5 = 0;
15257 #if CYTHON_UNPACK_METHODS
15258 if (likely(PyMethod_Check(__pyx_t_2))) {
15259 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
15260 if (likely(__pyx_t_4)) {
15261 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
15262 __Pyx_INCREF(__pyx_t_4);
15263 __Pyx_INCREF(function);
15264 __Pyx_DECREF_SET(__pyx_t_2, function);
15265 __pyx_t_5 = 1;
15266 }
15267 }
15268 #endif
15269 {
15270 PyObject *__pyx_callargs[2] = {__pyx_t_4, __pyx_t_3};
15271 __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
15272 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
15273 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15274 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 481, __pyx_L1_error)
15275 __Pyx_GOTREF(__pyx_t_1);
15276 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15277 }
15278 __pyx_r = __pyx_t_1;
15279 __pyx_t_1 = 0;
15280 goto __pyx_L0;
15281
15282 /* "pysam/libchtslib.pyx":472
15283 * return self.htsfile != NULL and self.htsfile.format.format == bcf
15284 *
15285 * def reset(self): # <<<<<<<<<<<<<<
15286 * """reset file position to beginning of file just after the header.
15287 *
15288 */
15289
15290 /* function exit code */
15291 __pyx_L1_error:;
15292 __Pyx_XDECREF(__pyx_t_1);
15293 __Pyx_XDECREF(__pyx_t_2);
15294 __Pyx_XDECREF(__pyx_t_3);
15295 __Pyx_XDECREF(__pyx_t_4);
15296 __Pyx_AddTraceback("pysam.libchtslib.HTSFile.reset", __pyx_clineno, __pyx_lineno, __pyx_filename);
15297 __pyx_r = NULL;
15298 __pyx_L0:;
15299 __Pyx_XGIVEREF(__pyx_r);
15300 __Pyx_TraceReturn(__pyx_r, 0);
15301 __Pyx_RefNannyFinishContext();
15302 return __pyx_r;
15303 }
15304
15305 /* "pysam/libchtslib.pyx":483
15306 * return self.seek(self.start_offset)
15307 *
15308 * def seek(self, uint64_t offset, int whence=io.SEEK_SET): # <<<<<<<<<<<<<<
15309 * """move file pointer to position *offset*, see :meth:`pysam.HTSFile.tell`."""
15310 * if not self.is_open:
15311 */
15312
15313 /* Python wrapper */
15314 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_17seek(PyObject *__pyx_v_self,
15315 #if CYTHON_METH_FASTCALL
15316 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
15317 #else
15318 PyObject *__pyx_args, PyObject *__pyx_kwds
15319 #endif
15320 ); /*proto*/
15321 PyDoc_STRVAR(__pyx_doc_5pysam_10libchtslib_7HTSFile_16seek, "HTSFile.seek(self, uint64_t offset, int whence=io.SEEK_SET)\nmove file pointer to position *offset*, see :meth:`pysam.HTSFile.tell`.");
15322 static PyMethodDef __pyx_mdef_5pysam_10libchtslib_7HTSFile_17seek = {"seek", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_7HTSFile_17seek, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_7HTSFile_16seek};
15323 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_17seek(PyObject *__pyx_v_self,
15324 #if CYTHON_METH_FASTCALL
15325 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
15326 #else
15327 PyObject *__pyx_args, PyObject *__pyx_kwds
15328 #endif
15329 ) {
15330 uint64_t __pyx_v_offset;
15331 int __pyx_v_whence;
15332 #if !CYTHON_METH_FASTCALL
15333 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
15334 #endif
15335 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
15336 PyObject* values[2] = {0,0};
15337 int __pyx_lineno = 0;
15338 const char *__pyx_filename = NULL;
15339 int __pyx_clineno = 0;
15340 PyObject *__pyx_r = 0;
15341 __Pyx_RefNannyDeclarations
15342 __Pyx_RefNannySetupContext("seek (wrapper)", 0);
15343 #if !CYTHON_METH_FASTCALL
15344 #if CYTHON_ASSUME_SAFE_MACROS
15345 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
15346 #else
15347 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
15348 #endif
15349 #endif
15350 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
15351 {
15352 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_offset,&__pyx_n_s_whence,0};
15353 if (__pyx_kwds) {
15354 Py_ssize_t kw_args;
15355 switch (__pyx_nargs) {
15356 case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
15357 CYTHON_FALLTHROUGH;
15358 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
15359 CYTHON_FALLTHROUGH;
15360 case 0: break;
15361 default: goto __pyx_L5_argtuple_error;
15362 }
15363 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
15364 switch (__pyx_nargs) {
15365 case 0:
15366 if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_offset)) != 0)) {
15367 (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
15368 kw_args--;
15369 }
15370 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 483, __pyx_L3_error)
15371 else goto __pyx_L5_argtuple_error;
15372 CYTHON_FALLTHROUGH;
15373 case 1:
15374 if (kw_args > 0) {
15375 PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_whence);
15376 if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
15377 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 483, __pyx_L3_error)
15378 }
15379 }
15380 if (unlikely(kw_args > 0)) {
15381 const Py_ssize_t kwd_pos_args = __pyx_nargs;
15382 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "seek") < 0)) __PYX_ERR(0, 483, __pyx_L3_error)
15383 }
15384 } else {
15385 switch (__pyx_nargs) {
15386 case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
15387 CYTHON_FALLTHROUGH;
15388 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
15389 break;
15390 default: goto __pyx_L5_argtuple_error;
15391 }
15392 }
15393 __pyx_v_offset = __Pyx_PyInt_As_uint64_t(values[0]); if (unlikely((__pyx_v_offset == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 483, __pyx_L3_error)
15394 if (values[1]) {
15395 __pyx_v_whence = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_whence == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 483, __pyx_L3_error)
15396 } else {
15397 __pyx_v_whence = __pyx_k__41;
15398 }
15399 }
15400 goto __pyx_L6_skip;
15401 __pyx_L5_argtuple_error:;
15402 __Pyx_RaiseArgtupleInvalid("seek", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 483, __pyx_L3_error)
15403 __pyx_L6_skip:;
15404 goto __pyx_L4_argument_unpacking_done;
15405 __pyx_L3_error:;
15406 {
15407 Py_ssize_t __pyx_temp;
15408 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
15409 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
15410 }
15411 }
15412 __Pyx_AddTraceback("pysam.libchtslib.HTSFile.seek", __pyx_clineno, __pyx_lineno, __pyx_filename);
15413 __Pyx_RefNannyFinishContext();
15414 return NULL;
15415 __pyx_L4_argument_unpacking_done:;
15416 __pyx_r = __pyx_pf_5pysam_10libchtslib_7HTSFile_16seek(((struct __pyx_obj_5pysam_10libchtslib_HTSFile *)__pyx_v_self), __pyx_v_offset, __pyx_v_whence);
15417
15418 /* function exit code */
15419 {
15420 Py_ssize_t __pyx_temp;
15421 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
15422 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
15423 }
15424 }
15425 __Pyx_RefNannyFinishContext();
15426 return __pyx_r;
15427 }
15428
15429 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_16seek(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self, uint64_t __pyx_v_offset, int __pyx_v_whence) {
15430 int64_t __pyx_v_ret;
15431 PyObject *__pyx_r = NULL;
15432 __Pyx_TraceDeclarations
15433 __Pyx_RefNannyDeclarations
15434 PyObject *__pyx_t_1 = NULL;
15435 int __pyx_t_2;
15436 int __pyx_t_3;
15437 int __pyx_t_4;
15438 int64_t __pyx_t_5;
15439 PyObject *__pyx_t_6 = NULL;
15440 PyObject *__pyx_t_7 = NULL;
15441 PyObject *__pyx_t_8 = NULL;
15442 unsigned int __pyx_t_9;
15443 int __pyx_lineno = 0;
15444 const char *__pyx_filename = NULL;
15445 int __pyx_clineno = 0;
15446 __Pyx_TraceFrameInit(__pyx_codeobj__42)
15447 __Pyx_RefNannySetupContext("seek", 1);
15448 __Pyx_TraceCall("seek", __pyx_f[0], 483, 0, __PYX_ERR(0, 483, __pyx_L1_error));
15449
15450 /* "pysam/libchtslib.pyx":485
15451 * def seek(self, uint64_t offset, int whence=io.SEEK_SET):
15452 * """move file pointer to position *offset*, see :meth:`pysam.HTSFile.tell`."""
15453 * if not self.is_open: # <<<<<<<<<<<<<<
15454 * raise ValueError('I/O operation on closed file')
15455 * if self.is_stream:
15456 */
15457 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_is_open); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 485, __pyx_L1_error)
15458 __Pyx_GOTREF(__pyx_t_1);
15459 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 485, __pyx_L1_error)
15460 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15461 __pyx_t_3 = (!__pyx_t_2);
15462 if (unlikely(__pyx_t_3)) {
15463
15464 /* "pysam/libchtslib.pyx":486
15465 * """move file pointer to position *offset*, see :meth:`pysam.HTSFile.tell`."""
15466 * if not self.is_open:
15467 * raise ValueError('I/O operation on closed file') # <<<<<<<<<<<<<<
15468 * if self.is_stream:
15469 * raise IOError('seek not available in streams')
15470 */
15471 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__43, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 486, __pyx_L1_error)
15472 __Pyx_GOTREF(__pyx_t_1);
15473 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
15474 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15475 __PYX_ERR(0, 486, __pyx_L1_error)
15476
15477 /* "pysam/libchtslib.pyx":485
15478 * def seek(self, uint64_t offset, int whence=io.SEEK_SET):
15479 * """move file pointer to position *offset*, see :meth:`pysam.HTSFile.tell`."""
15480 * if not self.is_open: # <<<<<<<<<<<<<<
15481 * raise ValueError('I/O operation on closed file')
15482 * if self.is_stream:
15483 */
15484 }
15485
15486 /* "pysam/libchtslib.pyx":487
15487 * if not self.is_open:
15488 * raise ValueError('I/O operation on closed file')
15489 * if self.is_stream: # <<<<<<<<<<<<<<
15490 * raise IOError('seek not available in streams')
15491 *
15492 */
15493 if (unlikely(__pyx_v_self->is_stream)) {
15494
15495 /* "pysam/libchtslib.pyx":488
15496 * raise ValueError('I/O operation on closed file')
15497 * if self.is_stream:
15498 * raise IOError('seek not available in streams') # <<<<<<<<<<<<<<
15499 *
15500 * whence = libc_whence_from_io(whence)
15501 */
15502 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_tuple__44, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 488, __pyx_L1_error)
15503 __Pyx_GOTREF(__pyx_t_1);
15504 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
15505 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15506 __PYX_ERR(0, 488, __pyx_L1_error)
15507
15508 /* "pysam/libchtslib.pyx":487
15509 * if not self.is_open:
15510 * raise ValueError('I/O operation on closed file')
15511 * if self.is_stream: # <<<<<<<<<<<<<<
15512 * raise IOError('seek not available in streams')
15513 *
15514 */
15515 }
15516
15517 /* "pysam/libchtslib.pyx":490
15518 * raise IOError('seek not available in streams')
15519 *
15520 * whence = libc_whence_from_io(whence) # <<<<<<<<<<<<<<
15521 *
15522 * cdef int64_t ret
15523 */
15524 __pyx_t_4 = __pyx_f_5pysam_9libcutils_libc_whence_from_io(__pyx_v_whence); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 490, __pyx_L1_error)
15525 __pyx_v_whence = __pyx_t_4;
15526
15527 /* "pysam/libchtslib.pyx":493
15528 *
15529 * cdef int64_t ret
15530 * if self.htsfile.format.compression == bgzf: # <<<<<<<<<<<<<<
15531 * with nogil:
15532 * ret = bgzf_seek(hts_get_bgzfp(self.htsfile), offset, whence)
15533 */
15534 switch (__pyx_v_self->htsfile->format.compression) {
15535 case bgzf:
15536
15537 /* "pysam/libchtslib.pyx":494
15538 * cdef int64_t ret
15539 * if self.htsfile.format.compression == bgzf:
15540 * with nogil: # <<<<<<<<<<<<<<
15541 * ret = bgzf_seek(hts_get_bgzfp(self.htsfile), offset, whence)
15542 * elif self.htsfile.format.compression == no_compression:
15543 */
15544 {
15545 #ifdef WITH_THREAD
15546 PyThreadState *_save;
15547 _save = NULL;
15548 Py_UNBLOCK_THREADS
15549 __Pyx_FastGIL_Remember();
15550 #endif
15551 /*try:*/ {
15552
15553 /* "pysam/libchtslib.pyx":495
15554 * if self.htsfile.format.compression == bgzf:
15555 * with nogil:
15556 * ret = bgzf_seek(hts_get_bgzfp(self.htsfile), offset, whence) # <<<<<<<<<<<<<<
15557 * elif self.htsfile.format.compression == no_compression:
15558 * ret = 0 if (hseek(self.htsfile.fp.hfile, offset, whence) >= 0) else -1
15559 */
15560 __pyx_v_ret = bgzf_seek(hts_get_bgzfp(__pyx_v_self->htsfile), __pyx_v_offset, __pyx_v_whence);
15561 }
15562
15563 /* "pysam/libchtslib.pyx":494
15564 * cdef int64_t ret
15565 * if self.htsfile.format.compression == bgzf:
15566 * with nogil: # <<<<<<<<<<<<<<
15567 * ret = bgzf_seek(hts_get_bgzfp(self.htsfile), offset, whence)
15568 * elif self.htsfile.format.compression == no_compression:
15569 */
15570 /*finally:*/ {
15571 /*normal exit:*/{
15572 #ifdef WITH_THREAD
15573 __Pyx_FastGIL_Forget();
15574 Py_BLOCK_THREADS
15575 #endif
15576 goto __pyx_L7;
15577 }
15578 __pyx_L7:;
15579 }
15580 }
15581
15582 /* "pysam/libchtslib.pyx":493
15583 *
15584 * cdef int64_t ret
15585 * if self.htsfile.format.compression == bgzf: # <<<<<<<<<<<<<<
15586 * with nogil:
15587 * ret = bgzf_seek(hts_get_bgzfp(self.htsfile), offset, whence)
15588 */
15589 break;
15590 case no_compression:
15591
15592 /* "pysam/libchtslib.pyx":497
15593 * ret = bgzf_seek(hts_get_bgzfp(self.htsfile), offset, whence)
15594 * elif self.htsfile.format.compression == no_compression:
15595 * ret = 0 if (hseek(self.htsfile.fp.hfile, offset, whence) >= 0) else -1 # <<<<<<<<<<<<<<
15596 * else:
15597 * raise NotImplementedError("seek not implemented in files compressed by method {}".format(
15598 */
15599 __pyx_t_3 = (hseek(__pyx_v_self->htsfile->fp.hfile, __pyx_v_offset, __pyx_v_whence) >= 0);
15600 if (__pyx_t_3) {
15601 __pyx_t_5 = 0;
15602 } else {
15603 __pyx_t_5 = -1L;
15604 }
15605 __pyx_v_ret = __pyx_t_5;
15606
15607 /* "pysam/libchtslib.pyx":496
15608 * with nogil:
15609 * ret = bgzf_seek(hts_get_bgzfp(self.htsfile), offset, whence)
15610 * elif self.htsfile.format.compression == no_compression: # <<<<<<<<<<<<<<
15611 * ret = 0 if (hseek(self.htsfile.fp.hfile, offset, whence) >= 0) else -1
15612 * else:
15613 */
15614 break;
15615 default:
15616
15617 /* "pysam/libchtslib.pyx":499
15618 * ret = 0 if (hseek(self.htsfile.fp.hfile, offset, whence) >= 0) else -1
15619 * else:
15620 * raise NotImplementedError("seek not implemented in files compressed by method {}".format( # <<<<<<<<<<<<<<
15621 * self.htsfile.format.compression))
15622 * return ret
15623 */
15624 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_seek_not_implemented_in_files_co, __pyx_n_s_format); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 499, __pyx_L1_error)
15625 __Pyx_GOTREF(__pyx_t_6);
15626
15627 /* "pysam/libchtslib.pyx":500
15628 * else:
15629 * raise NotImplementedError("seek not implemented in files compressed by method {}".format(
15630 * self.htsfile.format.compression)) # <<<<<<<<<<<<<<
15631 * return ret
15632 *
15633 */
15634 __pyx_t_7 = __Pyx_PyInt_From_enum__htsCompression(__pyx_v_self->htsfile->format.compression); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 500, __pyx_L1_error)
15635 __Pyx_GOTREF(__pyx_t_7);
15636 __pyx_t_8 = NULL;
15637 __pyx_t_9 = 0;
15638 #if CYTHON_UNPACK_METHODS
15639 if (likely(PyMethod_Check(__pyx_t_6))) {
15640 __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6);
15641 if (likely(__pyx_t_8)) {
15642 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
15643 __Pyx_INCREF(__pyx_t_8);
15644 __Pyx_INCREF(function);
15645 __Pyx_DECREF_SET(__pyx_t_6, function);
15646 __pyx_t_9 = 1;
15647 }
15648 }
15649 #endif
15650 {
15651 PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_t_7};
15652 __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9);
15653 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
15654 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
15655 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 499, __pyx_L1_error)
15656 __Pyx_GOTREF(__pyx_t_1);
15657 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
15658 }
15659
15660 /* "pysam/libchtslib.pyx":499
15661 * ret = 0 if (hseek(self.htsfile.fp.hfile, offset, whence) >= 0) else -1
15662 * else:
15663 * raise NotImplementedError("seek not implemented in files compressed by method {}".format( # <<<<<<<<<<<<<<
15664 * self.htsfile.format.compression))
15665 * return ret
15666 */
15667 __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_NotImplementedError, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 499, __pyx_L1_error)
15668 __Pyx_GOTREF(__pyx_t_6);
15669 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15670 __Pyx_Raise(__pyx_t_6, 0, 0, 0);
15671 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
15672 __PYX_ERR(0, 499, __pyx_L1_error)
15673 break;
15674 }
15675
15676 /* "pysam/libchtslib.pyx":501
15677 * raise NotImplementedError("seek not implemented in files compressed by method {}".format(
15678 * self.htsfile.format.compression))
15679 * return ret # <<<<<<<<<<<<<<
15680 *
15681 * def tell(self):
15682 */
15683 __Pyx_XDECREF(__pyx_r);
15684 __pyx_t_6 = __Pyx_PyInt_From_int64_t(__pyx_v_ret); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 501, __pyx_L1_error)
15685 __Pyx_GOTREF(__pyx_t_6);
15686 __pyx_r = __pyx_t_6;
15687 __pyx_t_6 = 0;
15688 goto __pyx_L0;
15689
15690 /* "pysam/libchtslib.pyx":483
15691 * return self.seek(self.start_offset)
15692 *
15693 * def seek(self, uint64_t offset, int whence=io.SEEK_SET): # <<<<<<<<<<<<<<
15694 * """move file pointer to position *offset*, see :meth:`pysam.HTSFile.tell`."""
15695 * if not self.is_open:
15696 */
15697
15698 /* function exit code */
15699 __pyx_L1_error:;
15700 __Pyx_XDECREF(__pyx_t_1);
15701 __Pyx_XDECREF(__pyx_t_6);
15702 __Pyx_XDECREF(__pyx_t_7);
15703 __Pyx_XDECREF(__pyx_t_8);
15704 __Pyx_AddTraceback("pysam.libchtslib.HTSFile.seek", __pyx_clineno, __pyx_lineno, __pyx_filename);
15705 __pyx_r = NULL;
15706 __pyx_L0:;
15707 __Pyx_XGIVEREF(__pyx_r);
15708 __Pyx_TraceReturn(__pyx_r, 0);
15709 __Pyx_RefNannyFinishContext();
15710 return __pyx_r;
15711 }
15712
15713 /* "pysam/libchtslib.pyx":503
15714 * return ret
15715 *
15716 * def tell(self): # <<<<<<<<<<<<<<
15717 * """return current file position, see :meth:`pysam.HTSFile.seek`."""
15718 * if not self.is_open:
15719 */
15720
15721 /* Python wrapper */
15722 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_19tell(PyObject *__pyx_v_self,
15723 #if CYTHON_METH_FASTCALL
15724 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
15725 #else
15726 PyObject *__pyx_args, PyObject *__pyx_kwds
15727 #endif
15728 ); /*proto*/
15729 PyDoc_STRVAR(__pyx_doc_5pysam_10libchtslib_7HTSFile_18tell, "HTSFile.tell(self)\nreturn current file position, see :meth:`pysam.HTSFile.seek`.");
15730 static PyMethodDef __pyx_mdef_5pysam_10libchtslib_7HTSFile_19tell = {"tell", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_7HTSFile_19tell, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_7HTSFile_18tell};
15731 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_19tell(PyObject *__pyx_v_self,
15732 #if CYTHON_METH_FASTCALL
15733 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
15734 #else
15735 PyObject *__pyx_args, PyObject *__pyx_kwds
15736 #endif
15737 ) {
15738 #if !CYTHON_METH_FASTCALL
15739 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
15740 #endif
15741 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
15742 PyObject *__pyx_r = 0;
15743 __Pyx_RefNannyDeclarations
15744 __Pyx_RefNannySetupContext("tell (wrapper)", 0);
15745 #if !CYTHON_METH_FASTCALL
15746 #if CYTHON_ASSUME_SAFE_MACROS
15747 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
15748 #else
15749 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
15750 #endif
15751 #endif
15752 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
15753 if (unlikely(__pyx_nargs > 0)) {
15754 __Pyx_RaiseArgtupleInvalid("tell", 1, 0, 0, __pyx_nargs); return NULL;}
15755 if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "tell", 0))) return NULL;
15756 __pyx_r = __pyx_pf_5pysam_10libchtslib_7HTSFile_18tell(((struct __pyx_obj_5pysam_10libchtslib_HTSFile *)__pyx_v_self));
15757
15758 /* function exit code */
15759 __Pyx_RefNannyFinishContext();
15760 return __pyx_r;
15761 }
15762
15763 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_18tell(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self) {
15764 int64_t __pyx_v_ret;
15765 PyObject *__pyx_r = NULL;
15766 __Pyx_TraceDeclarations
15767 __Pyx_RefNannyDeclarations
15768 PyObject *__pyx_t_1 = NULL;
15769 int __pyx_t_2;
15770 int __pyx_t_3;
15771 PyObject *__pyx_t_4 = NULL;
15772 PyObject *__pyx_t_5 = NULL;
15773 PyObject *__pyx_t_6 = NULL;
15774 unsigned int __pyx_t_7;
15775 int __pyx_lineno = 0;
15776 const char *__pyx_filename = NULL;
15777 int __pyx_clineno = 0;
15778 __Pyx_TraceFrameInit(__pyx_codeobj__45)
15779 __Pyx_RefNannySetupContext("tell", 1);
15780 __Pyx_TraceCall("tell", __pyx_f[0], 503, 0, __PYX_ERR(0, 503, __pyx_L1_error));
15781
15782 /* "pysam/libchtslib.pyx":505
15783 * def tell(self):
15784 * """return current file position, see :meth:`pysam.HTSFile.seek`."""
15785 * if not self.is_open: # <<<<<<<<<<<<<<
15786 * raise ValueError('I/O operation on closed file')
15787 * if self.is_stream:
15788 */
15789 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_is_open); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 505, __pyx_L1_error)
15790 __Pyx_GOTREF(__pyx_t_1);
15791 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 505, __pyx_L1_error)
15792 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15793 __pyx_t_3 = (!__pyx_t_2);
15794 if (unlikely(__pyx_t_3)) {
15795
15796 /* "pysam/libchtslib.pyx":506
15797 * """return current file position, see :meth:`pysam.HTSFile.seek`."""
15798 * if not self.is_open:
15799 * raise ValueError('I/O operation on closed file') # <<<<<<<<<<<<<<
15800 * if self.is_stream:
15801 * raise IOError('tell not available in streams')
15802 */
15803 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__43, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 506, __pyx_L1_error)
15804 __Pyx_GOTREF(__pyx_t_1);
15805 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
15806 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15807 __PYX_ERR(0, 506, __pyx_L1_error)
15808
15809 /* "pysam/libchtslib.pyx":505
15810 * def tell(self):
15811 * """return current file position, see :meth:`pysam.HTSFile.seek`."""
15812 * if not self.is_open: # <<<<<<<<<<<<<<
15813 * raise ValueError('I/O operation on closed file')
15814 * if self.is_stream:
15815 */
15816 }
15817
15818 /* "pysam/libchtslib.pyx":507
15819 * if not self.is_open:
15820 * raise ValueError('I/O operation on closed file')
15821 * if self.is_stream: # <<<<<<<<<<<<<<
15822 * raise IOError('tell not available in streams')
15823 *
15824 */
15825 if (unlikely(__pyx_v_self->is_stream)) {
15826
15827 /* "pysam/libchtslib.pyx":508
15828 * raise ValueError('I/O operation on closed file')
15829 * if self.is_stream:
15830 * raise IOError('tell not available in streams') # <<<<<<<<<<<<<<
15831 *
15832 * cdef int64_t ret
15833 */
15834 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_tuple__46, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 508, __pyx_L1_error)
15835 __Pyx_GOTREF(__pyx_t_1);
15836 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
15837 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15838 __PYX_ERR(0, 508, __pyx_L1_error)
15839
15840 /* "pysam/libchtslib.pyx":507
15841 * if not self.is_open:
15842 * raise ValueError('I/O operation on closed file')
15843 * if self.is_stream: # <<<<<<<<<<<<<<
15844 * raise IOError('tell not available in streams')
15845 *
15846 */
15847 }
15848
15849 /* "pysam/libchtslib.pyx":511
15850 *
15851 * cdef int64_t ret
15852 * if self.htsfile.format.compression == bgzf: # <<<<<<<<<<<<<<
15853 * with nogil:
15854 * ret = bgzf_tell(hts_get_bgzfp(self.htsfile))
15855 */
15856 __pyx_t_3 = (__pyx_v_self->htsfile->format.compression == bgzf);
15857 if (__pyx_t_3) {
15858
15859 /* "pysam/libchtslib.pyx":512
15860 * cdef int64_t ret
15861 * if self.htsfile.format.compression == bgzf:
15862 * with nogil: # <<<<<<<<<<<<<<
15863 * ret = bgzf_tell(hts_get_bgzfp(self.htsfile))
15864 * elif self.htsfile.format.compression == no_compression:
15865 */
15866 {
15867 #ifdef WITH_THREAD
15868 PyThreadState *_save;
15869 _save = NULL;
15870 Py_UNBLOCK_THREADS
15871 __Pyx_FastGIL_Remember();
15872 #endif
15873 /*try:*/ {
15874
15875 /* "pysam/libchtslib.pyx":513
15876 * if self.htsfile.format.compression == bgzf:
15877 * with nogil:
15878 * ret = bgzf_tell(hts_get_bgzfp(self.htsfile)) # <<<<<<<<<<<<<<
15879 * elif self.htsfile.format.compression == no_compression:
15880 * ret = htell(self.htsfile.fp.hfile)
15881 */
15882 __pyx_v_ret = bgzf_tell(hts_get_bgzfp(__pyx_v_self->htsfile));
15883 }
15884
15885 /* "pysam/libchtslib.pyx":512
15886 * cdef int64_t ret
15887 * if self.htsfile.format.compression == bgzf:
15888 * with nogil: # <<<<<<<<<<<<<<
15889 * ret = bgzf_tell(hts_get_bgzfp(self.htsfile))
15890 * elif self.htsfile.format.compression == no_compression:
15891 */
15892 /*finally:*/ {
15893 /*normal exit:*/{
15894 #ifdef WITH_THREAD
15895 __Pyx_FastGIL_Forget();
15896 Py_BLOCK_THREADS
15897 #endif
15898 goto __pyx_L8;
15899 }
15900 __pyx_L8:;
15901 }
15902 }
15903
15904 /* "pysam/libchtslib.pyx":511
15905 *
15906 * cdef int64_t ret
15907 * if self.htsfile.format.compression == bgzf: # <<<<<<<<<<<<<<
15908 * with nogil:
15909 * ret = bgzf_tell(hts_get_bgzfp(self.htsfile))
15910 */
15911 goto __pyx_L5;
15912 }
15913
15914 /* "pysam/libchtslib.pyx":514
15915 * with nogil:
15916 * ret = bgzf_tell(hts_get_bgzfp(self.htsfile))
15917 * elif self.htsfile.format.compression == no_compression: # <<<<<<<<<<<<<<
15918 * ret = htell(self.htsfile.fp.hfile)
15919 * elif self.htsfile.format.format == cram:
15920 */
15921 __pyx_t_3 = (__pyx_v_self->htsfile->format.compression == no_compression);
15922 if (__pyx_t_3) {
15923
15924 /* "pysam/libchtslib.pyx":515
15925 * ret = bgzf_tell(hts_get_bgzfp(self.htsfile))
15926 * elif self.htsfile.format.compression == no_compression:
15927 * ret = htell(self.htsfile.fp.hfile) # <<<<<<<<<<<<<<
15928 * elif self.htsfile.format.format == cram:
15929 * with nogil:
15930 */
15931 __pyx_v_ret = htell(__pyx_v_self->htsfile->fp.hfile);
15932
15933 /* "pysam/libchtslib.pyx":514
15934 * with nogil:
15935 * ret = bgzf_tell(hts_get_bgzfp(self.htsfile))
15936 * elif self.htsfile.format.compression == no_compression: # <<<<<<<<<<<<<<
15937 * ret = htell(self.htsfile.fp.hfile)
15938 * elif self.htsfile.format.format == cram:
15939 */
15940 goto __pyx_L5;
15941 }
15942
15943 /* "pysam/libchtslib.pyx":516
15944 * elif self.htsfile.format.compression == no_compression:
15945 * ret = htell(self.htsfile.fp.hfile)
15946 * elif self.htsfile.format.format == cram: # <<<<<<<<<<<<<<
15947 * with nogil:
15948 * ret = htell(cram_fd_get_fp(self.htsfile.fp.cram))
15949 */
15950 __pyx_t_3 = (__pyx_v_self->htsfile->format.format == cram);
15951 if (likely(__pyx_t_3)) {
15952
15953 /* "pysam/libchtslib.pyx":517
15954 * ret = htell(self.htsfile.fp.hfile)
15955 * elif self.htsfile.format.format == cram:
15956 * with nogil: # <<<<<<<<<<<<<<
15957 * ret = htell(cram_fd_get_fp(self.htsfile.fp.cram))
15958 * else:
15959 */
15960 {
15961 #ifdef WITH_THREAD
15962 PyThreadState *_save;
15963 _save = NULL;
15964 Py_UNBLOCK_THREADS
15965 __Pyx_FastGIL_Remember();
15966 #endif
15967 /*try:*/ {
15968
15969 /* "pysam/libchtslib.pyx":518
15970 * elif self.htsfile.format.format == cram:
15971 * with nogil:
15972 * ret = htell(cram_fd_get_fp(self.htsfile.fp.cram)) # <<<<<<<<<<<<<<
15973 * else:
15974 * raise NotImplementedError("seek not implemented in files compressed by method {}".format(
15975 */
15976 __pyx_v_ret = htell(cram_fd_get_fp(__pyx_v_self->htsfile->fp.cram));
15977 }
15978
15979 /* "pysam/libchtslib.pyx":517
15980 * ret = htell(self.htsfile.fp.hfile)
15981 * elif self.htsfile.format.format == cram:
15982 * with nogil: # <<<<<<<<<<<<<<
15983 * ret = htell(cram_fd_get_fp(self.htsfile.fp.cram))
15984 * else:
15985 */
15986 /*finally:*/ {
15987 /*normal exit:*/{
15988 #ifdef WITH_THREAD
15989 __Pyx_FastGIL_Forget();
15990 Py_BLOCK_THREADS
15991 #endif
15992 goto __pyx_L11;
15993 }
15994 __pyx_L11:;
15995 }
15996 }
15997
15998 /* "pysam/libchtslib.pyx":516
15999 * elif self.htsfile.format.compression == no_compression:
16000 * ret = htell(self.htsfile.fp.hfile)
16001 * elif self.htsfile.format.format == cram: # <<<<<<<<<<<<<<
16002 * with nogil:
16003 * ret = htell(cram_fd_get_fp(self.htsfile.fp.cram))
16004 */
16005 goto __pyx_L5;
16006 }
16007
16008 /* "pysam/libchtslib.pyx":520
16009 * ret = htell(cram_fd_get_fp(self.htsfile.fp.cram))
16010 * else:
16011 * raise NotImplementedError("seek not implemented in files compressed by method {}".format( # <<<<<<<<<<<<<<
16012 * self.htsfile.format.compression))
16013 *
16014 */
16015 /*else*/ {
16016 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_seek_not_implemented_in_files_co, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 520, __pyx_L1_error)
16017 __Pyx_GOTREF(__pyx_t_4);
16018
16019 /* "pysam/libchtslib.pyx":521
16020 * else:
16021 * raise NotImplementedError("seek not implemented in files compressed by method {}".format(
16022 * self.htsfile.format.compression)) # <<<<<<<<<<<<<<
16023 *
16024 * return ret
16025 */
16026 __pyx_t_5 = __Pyx_PyInt_From_enum__htsCompression(__pyx_v_self->htsfile->format.compression); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 521, __pyx_L1_error)
16027 __Pyx_GOTREF(__pyx_t_5);
16028 __pyx_t_6 = NULL;
16029 __pyx_t_7 = 0;
16030 #if CYTHON_UNPACK_METHODS
16031 if (likely(PyMethod_Check(__pyx_t_4))) {
16032 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
16033 if (likely(__pyx_t_6)) {
16034 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
16035 __Pyx_INCREF(__pyx_t_6);
16036 __Pyx_INCREF(function);
16037 __Pyx_DECREF_SET(__pyx_t_4, function);
16038 __pyx_t_7 = 1;
16039 }
16040 }
16041 #endif
16042 {
16043 PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_t_5};
16044 __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
16045 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
16046 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
16047 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 520, __pyx_L1_error)
16048 __Pyx_GOTREF(__pyx_t_1);
16049 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16050 }
16051
16052 /* "pysam/libchtslib.pyx":520
16053 * ret = htell(cram_fd_get_fp(self.htsfile.fp.cram))
16054 * else:
16055 * raise NotImplementedError("seek not implemented in files compressed by method {}".format( # <<<<<<<<<<<<<<
16056 * self.htsfile.format.compression))
16057 *
16058 */
16059 __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_NotImplementedError, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 520, __pyx_L1_error)
16060 __Pyx_GOTREF(__pyx_t_4);
16061 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16062 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
16063 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16064 __PYX_ERR(0, 520, __pyx_L1_error)
16065 }
16066 __pyx_L5:;
16067
16068 /* "pysam/libchtslib.pyx":523
16069 * self.htsfile.format.compression))
16070 *
16071 * return ret # <<<<<<<<<<<<<<
16072 *
16073 * cdef htsFile *_open_htsfile(self) except? NULL:
16074 */
16075 __Pyx_XDECREF(__pyx_r);
16076 __pyx_t_4 = __Pyx_PyInt_From_int64_t(__pyx_v_ret); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 523, __pyx_L1_error)
16077 __Pyx_GOTREF(__pyx_t_4);
16078 __pyx_r = __pyx_t_4;
16079 __pyx_t_4 = 0;
16080 goto __pyx_L0;
16081
16082 /* "pysam/libchtslib.pyx":503
16083 * return ret
16084 *
16085 * def tell(self): # <<<<<<<<<<<<<<
16086 * """return current file position, see :meth:`pysam.HTSFile.seek`."""
16087 * if not self.is_open:
16088 */
16089
16090 /* function exit code */
16091 __pyx_L1_error:;
16092 __Pyx_XDECREF(__pyx_t_1);
16093 __Pyx_XDECREF(__pyx_t_4);
16094 __Pyx_XDECREF(__pyx_t_5);
16095 __Pyx_XDECREF(__pyx_t_6);
16096 __Pyx_AddTraceback("pysam.libchtslib.HTSFile.tell", __pyx_clineno, __pyx_lineno, __pyx_filename);
16097 __pyx_r = NULL;
16098 __pyx_L0:;
16099 __Pyx_XGIVEREF(__pyx_r);
16100 __Pyx_TraceReturn(__pyx_r, 0);
16101 __Pyx_RefNannyFinishContext();
16102 return __pyx_r;
16103 }
16104
16105 /* "pysam/libchtslib.pyx":525
16106 * return ret
16107 *
16108 * cdef htsFile *_open_htsfile(self) except? NULL: # <<<<<<<<<<<<<<
16109 * cdef char *cfilename
16110 * cdef char *cmode = self.mode
16111 */
16112
16113 static htsFile *__pyx_f_5pysam_10libchtslib_7HTSFile__open_htsfile(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self) {
16114 char *__pyx_v_cfilename;
16115 char *__pyx_v_cmode;
16116 int __pyx_v_fd;
16117 int __pyx_v_dup_fd;
16118 int __pyx_v_threads;
16119 htsFile *__pyx_v_htsfile;
16120 PyObject *__pyx_v_smode = NULL;
16121 hFILE *__pyx_v_hfile;
16122 PyObject *__pyx_v_filename = NULL;
16123 htsFile *__pyx_r;
16124 __Pyx_TraceDeclarations
16125 __Pyx_RefNannyDeclarations
16126 char *__pyx_t_1;
16127 PyObject *__pyx_t_2 = NULL;
16128 int __pyx_t_3;
16129 int __pyx_t_4;
16130 PyObject *__pyx_t_5 = NULL;
16131 PyObject *__pyx_t_6 = NULL;
16132 unsigned int __pyx_t_7;
16133 PyObject *__pyx_t_8 = NULL;
16134 PyObject *__pyx_t_9 = NULL;
16135 PyObject *__pyx_t_10 = NULL;
16136 PyObject *__pyx_t_11 = NULL;
16137 PyObject *__pyx_t_12 = NULL;
16138 PyObject *__pyx_t_13 = NULL;
16139 PyObject *__pyx_t_14 = NULL;
16140 int __pyx_lineno = 0;
16141 const char *__pyx_filename = NULL;
16142 int __pyx_clineno = 0;
16143 __Pyx_RefNannySetupContext("_open_htsfile", 1);
16144 __Pyx_TraceCall("_open_htsfile", __pyx_f[0], 525, 0, __PYX_ERR(0, 525, __pyx_L1_error));
16145
16146 /* "pysam/libchtslib.pyx":527
16147 * cdef htsFile *_open_htsfile(self) except? NULL:
16148 * cdef char *cfilename
16149 * cdef char *cmode = self.mode # <<<<<<<<<<<<<<
16150 * cdef int fd, dup_fd, threads
16151 *
16152 */
16153 __pyx_t_1 = __Pyx_PyObject_AsWritableString(__pyx_v_self->mode); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 527, __pyx_L1_error)
16154 __pyx_v_cmode = __pyx_t_1;
16155
16156 /* "pysam/libchtslib.pyx":530
16157 * cdef int fd, dup_fd, threads
16158 *
16159 * threads = self.threads - 1 # <<<<<<<<<<<<<<
16160 * if isinstance(self.filename, bytes):
16161 * cfilename = self.filename
16162 */
16163 __pyx_t_2 = __Pyx_PyInt_SubtractObjC(__pyx_v_self->threads, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 530, __pyx_L1_error)
16164 __Pyx_GOTREF(__pyx_t_2);
16165 __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 530, __pyx_L1_error)
16166 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16167 __pyx_v_threads = __pyx_t_3;
16168
16169 /* "pysam/libchtslib.pyx":531
16170 *
16171 * threads = self.threads - 1
16172 * if isinstance(self.filename, bytes): # <<<<<<<<<<<<<<
16173 * cfilename = self.filename
16174 * with nogil:
16175 */
16176 __pyx_t_2 = __pyx_v_self->filename;
16177 __Pyx_INCREF(__pyx_t_2);
16178 __pyx_t_4 = PyBytes_Check(__pyx_t_2);
16179 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16180 if (__pyx_t_4) {
16181
16182 /* "pysam/libchtslib.pyx":532
16183 * threads = self.threads - 1
16184 * if isinstance(self.filename, bytes):
16185 * cfilename = self.filename # <<<<<<<<<<<<<<
16186 * with nogil:
16187 * htsfile = hts_open(cfilename, cmode)
16188 */
16189 __pyx_t_1 = __Pyx_PyObject_AsWritableString(__pyx_v_self->filename); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 532, __pyx_L1_error)
16190 __pyx_v_cfilename = __pyx_t_1;
16191
16192 /* "pysam/libchtslib.pyx":533
16193 * if isinstance(self.filename, bytes):
16194 * cfilename = self.filename
16195 * with nogil: # <<<<<<<<<<<<<<
16196 * htsfile = hts_open(cfilename, cmode)
16197 * if htsfile != NULL:
16198 */
16199 {
16200 #ifdef WITH_THREAD
16201 PyThreadState *_save;
16202 _save = NULL;
16203 Py_UNBLOCK_THREADS
16204 __Pyx_FastGIL_Remember();
16205 #endif
16206 /*try:*/ {
16207
16208 /* "pysam/libchtslib.pyx":534
16209 * cfilename = self.filename
16210 * with nogil:
16211 * htsfile = hts_open(cfilename, cmode) # <<<<<<<<<<<<<<
16212 * if htsfile != NULL:
16213 * hts_set_threads(htsfile, threads)
16214 */
16215 __pyx_v_htsfile = hts_open(__pyx_v_cfilename, __pyx_v_cmode);
16216
16217 /* "pysam/libchtslib.pyx":535
16218 * with nogil:
16219 * htsfile = hts_open(cfilename, cmode)
16220 * if htsfile != NULL: # <<<<<<<<<<<<<<
16221 * hts_set_threads(htsfile, threads)
16222 * return htsfile
16223 */
16224 __pyx_t_4 = (__pyx_v_htsfile != NULL);
16225 if (__pyx_t_4) {
16226
16227 /* "pysam/libchtslib.pyx":536
16228 * htsfile = hts_open(cfilename, cmode)
16229 * if htsfile != NULL:
16230 * hts_set_threads(htsfile, threads) # <<<<<<<<<<<<<<
16231 * return htsfile
16232 * else:
16233 */
16234 (void)(hts_set_threads(__pyx_v_htsfile, __pyx_v_threads));
16235
16236 /* "pysam/libchtslib.pyx":535
16237 * with nogil:
16238 * htsfile = hts_open(cfilename, cmode)
16239 * if htsfile != NULL: # <<<<<<<<<<<<<<
16240 * hts_set_threads(htsfile, threads)
16241 * return htsfile
16242 */
16243 }
16244
16245 /* "pysam/libchtslib.pyx":537
16246 * if htsfile != NULL:
16247 * hts_set_threads(htsfile, threads)
16248 * return htsfile # <<<<<<<<<<<<<<
16249 * else:
16250 * if isinstance(self.filename, int):
16251 */
16252 __pyx_r = __pyx_v_htsfile;
16253 goto __pyx_L4_return;
16254 }
16255
16256 /* "pysam/libchtslib.pyx":533
16257 * if isinstance(self.filename, bytes):
16258 * cfilename = self.filename
16259 * with nogil: # <<<<<<<<<<<<<<
16260 * htsfile = hts_open(cfilename, cmode)
16261 * if htsfile != NULL:
16262 */
16263 /*finally:*/ {
16264 __pyx_L4_return: {
16265 #ifdef WITH_THREAD
16266 __Pyx_FastGIL_Forget();
16267 Py_BLOCK_THREADS
16268 #endif
16269 goto __pyx_L0;
16270 }
16271 }
16272 }
16273
16274 /* "pysam/libchtslib.pyx":531
16275 *
16276 * threads = self.threads - 1
16277 * if isinstance(self.filename, bytes): # <<<<<<<<<<<<<<
16278 * cfilename = self.filename
16279 * with nogil:
16280 */
16281 }
16282
16283 /* "pysam/libchtslib.pyx":539
16284 * return htsfile
16285 * else:
16286 * if isinstance(self.filename, int): # <<<<<<<<<<<<<<
16287 * fd = self.filename
16288 * else:
16289 */
16290 /*else*/ {
16291 __pyx_t_2 = __pyx_v_self->filename;
16292 __Pyx_INCREF(__pyx_t_2);
16293 __pyx_t_4 = PyInt_Check(__pyx_t_2);
16294 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16295 if (__pyx_t_4) {
16296
16297 /* "pysam/libchtslib.pyx":540
16298 * else:
16299 * if isinstance(self.filename, int):
16300 * fd = self.filename # <<<<<<<<<<<<<<
16301 * else:
16302 * fd = self.filename.fileno()
16303 */
16304 __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_v_self->filename); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 540, __pyx_L1_error)
16305 __pyx_v_fd = __pyx_t_3;
16306
16307 /* "pysam/libchtslib.pyx":539
16308 * return htsfile
16309 * else:
16310 * if isinstance(self.filename, int): # <<<<<<<<<<<<<<
16311 * fd = self.filename
16312 * else:
16313 */
16314 goto __pyx_L8;
16315 }
16316
16317 /* "pysam/libchtslib.pyx":542
16318 * fd = self.filename
16319 * else:
16320 * fd = self.filename.fileno() # <<<<<<<<<<<<<<
16321 *
16322 * if self.duplicate_filehandle:
16323 */
16324 /*else*/ {
16325 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->filename, __pyx_n_s_fileno); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 542, __pyx_L1_error)
16326 __Pyx_GOTREF(__pyx_t_5);
16327 __pyx_t_6 = NULL;
16328 __pyx_t_7 = 0;
16329 #if CYTHON_UNPACK_METHODS
16330 if (likely(PyMethod_Check(__pyx_t_5))) {
16331 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
16332 if (likely(__pyx_t_6)) {
16333 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
16334 __Pyx_INCREF(__pyx_t_6);
16335 __Pyx_INCREF(function);
16336 __Pyx_DECREF_SET(__pyx_t_5, function);
16337 __pyx_t_7 = 1;
16338 }
16339 }
16340 #endif
16341 {
16342 PyObject *__pyx_callargs[2] = {__pyx_t_6, NULL};
16343 __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 0+__pyx_t_7);
16344 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
16345 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 542, __pyx_L1_error)
16346 __Pyx_GOTREF(__pyx_t_2);
16347 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
16348 }
16349 __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 542, __pyx_L1_error)
16350 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16351 __pyx_v_fd = __pyx_t_3;
16352 }
16353 __pyx_L8:;
16354
16355 /* "pysam/libchtslib.pyx":544
16356 * fd = self.filename.fileno()
16357 *
16358 * if self.duplicate_filehandle: # <<<<<<<<<<<<<<
16359 * dup_fd = dup(fd)
16360 * else:
16361 */
16362 if (__pyx_v_self->duplicate_filehandle) {
16363
16364 /* "pysam/libchtslib.pyx":545
16365 *
16366 * if self.duplicate_filehandle:
16367 * dup_fd = dup(fd) # <<<<<<<<<<<<<<
16368 * else:
16369 * dup_fd = fd
16370 */
16371 __pyx_v_dup_fd = dup(__pyx_v_fd);
16372
16373 /* "pysam/libchtslib.pyx":544
16374 * fd = self.filename.fileno()
16375 *
16376 * if self.duplicate_filehandle: # <<<<<<<<<<<<<<
16377 * dup_fd = dup(fd)
16378 * else:
16379 */
16380 goto __pyx_L9;
16381 }
16382
16383 /* "pysam/libchtslib.pyx":547
16384 * dup_fd = dup(fd)
16385 * else:
16386 * dup_fd = fd # <<<<<<<<<<<<<<
16387 *
16388 * # Replicate mode normalization done in hts_open_format
16389 */
16390 /*else*/ {
16391 __pyx_v_dup_fd = __pyx_v_fd;
16392 }
16393 __pyx_L9:;
16394
16395 /* "pysam/libchtslib.pyx":550
16396 *
16397 * # Replicate mode normalization done in hts_open_format
16398 * smode = self.mode.replace(b'b', b'').replace(b'c', b'') # <<<<<<<<<<<<<<
16399 * if b'b' in self.mode:
16400 * smode += b'b'
16401 */
16402 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->mode, __pyx_n_s_replace); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 550, __pyx_L1_error)
16403 __Pyx_GOTREF(__pyx_t_2);
16404 __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__47, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 550, __pyx_L1_error)
16405 __Pyx_GOTREF(__pyx_t_5);
16406 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16407 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_replace); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 550, __pyx_L1_error)
16408 __Pyx_GOTREF(__pyx_t_2);
16409 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
16410 __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__48, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 550, __pyx_L1_error)
16411 __Pyx_GOTREF(__pyx_t_5);
16412 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16413 __pyx_v_smode = __pyx_t_5;
16414 __pyx_t_5 = 0;
16415
16416 /* "pysam/libchtslib.pyx":551
16417 * # Replicate mode normalization done in hts_open_format
16418 * smode = self.mode.replace(b'b', b'').replace(b'c', b'')
16419 * if b'b' in self.mode: # <<<<<<<<<<<<<<
16420 * smode += b'b'
16421 * elif b'c' in self.mode:
16422 */
16423 __pyx_t_4 = (__Pyx_PySequence_ContainsTF(__pyx_n_b_b, __pyx_v_self->mode, Py_EQ)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 551, __pyx_L1_error)
16424 if (__pyx_t_4) {
16425
16426 /* "pysam/libchtslib.pyx":552
16427 * smode = self.mode.replace(b'b', b'').replace(b'c', b'')
16428 * if b'b' in self.mode:
16429 * smode += b'b' # <<<<<<<<<<<<<<
16430 * elif b'c' in self.mode:
16431 * smode += b'c'
16432 */
16433 __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_smode, __pyx_n_b_b); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 552, __pyx_L1_error)
16434 __Pyx_GOTREF(__pyx_t_5);
16435 __Pyx_DECREF_SET(__pyx_v_smode, __pyx_t_5);
16436 __pyx_t_5 = 0;
16437
16438 /* "pysam/libchtslib.pyx":551
16439 * # Replicate mode normalization done in hts_open_format
16440 * smode = self.mode.replace(b'b', b'').replace(b'c', b'')
16441 * if b'b' in self.mode: # <<<<<<<<<<<<<<
16442 * smode += b'b'
16443 * elif b'c' in self.mode:
16444 */
16445 goto __pyx_L10;
16446 }
16447
16448 /* "pysam/libchtslib.pyx":553
16449 * if b'b' in self.mode:
16450 * smode += b'b'
16451 * elif b'c' in self.mode: # <<<<<<<<<<<<<<
16452 * smode += b'c'
16453 * cmode = smode
16454 */
16455 __pyx_t_4 = (__Pyx_PySequence_ContainsTF(__pyx_n_b_c, __pyx_v_self->mode, Py_EQ)); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 553, __pyx_L1_error)
16456 if (__pyx_t_4) {
16457
16458 /* "pysam/libchtslib.pyx":554
16459 * smode += b'b'
16460 * elif b'c' in self.mode:
16461 * smode += b'c' # <<<<<<<<<<<<<<
16462 * cmode = smode
16463 *
16464 */
16465 __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_smode, __pyx_n_b_c); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 554, __pyx_L1_error)
16466 __Pyx_GOTREF(__pyx_t_5);
16467 __Pyx_DECREF_SET(__pyx_v_smode, __pyx_t_5);
16468 __pyx_t_5 = 0;
16469
16470 /* "pysam/libchtslib.pyx":553
16471 * if b'b' in self.mode:
16472 * smode += b'b'
16473 * elif b'c' in self.mode: # <<<<<<<<<<<<<<
16474 * smode += b'c'
16475 * cmode = smode
16476 */
16477 }
16478 __pyx_L10:;
16479
16480 /* "pysam/libchtslib.pyx":555
16481 * elif b'c' in self.mode:
16482 * smode += b'c'
16483 * cmode = smode # <<<<<<<<<<<<<<
16484 *
16485 * hfile = hdopen(dup_fd, cmode)
16486 */
16487 __pyx_t_1 = __Pyx_PyObject_AsWritableString(__pyx_v_smode); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 555, __pyx_L1_error)
16488 __pyx_v_cmode = __pyx_t_1;
16489
16490 /* "pysam/libchtslib.pyx":557
16491 * cmode = smode
16492 *
16493 * hfile = hdopen(dup_fd, cmode) # <<<<<<<<<<<<<<
16494 * if hfile == NULL:
16495 * raise IOError('Cannot create hfile')
16496 */
16497 __pyx_v_hfile = hdopen(__pyx_v_dup_fd, __pyx_v_cmode);
16498
16499 /* "pysam/libchtslib.pyx":558
16500 *
16501 * hfile = hdopen(dup_fd, cmode)
16502 * if hfile == NULL: # <<<<<<<<<<<<<<
16503 * raise IOError('Cannot create hfile')
16504 *
16505 */
16506 __pyx_t_4 = (__pyx_v_hfile == NULL);
16507 if (unlikely(__pyx_t_4)) {
16508
16509 /* "pysam/libchtslib.pyx":559
16510 * hfile = hdopen(dup_fd, cmode)
16511 * if hfile == NULL:
16512 * raise IOError('Cannot create hfile') # <<<<<<<<<<<<<<
16513 *
16514 * try:
16515 */
16516 __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_IOError, __pyx_tuple__49, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 559, __pyx_L1_error)
16517 __Pyx_GOTREF(__pyx_t_5);
16518 __Pyx_Raise(__pyx_t_5, 0, 0, 0);
16519 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
16520 __PYX_ERR(0, 559, __pyx_L1_error)
16521
16522 /* "pysam/libchtslib.pyx":558
16523 *
16524 * hfile = hdopen(dup_fd, cmode)
16525 * if hfile == NULL: # <<<<<<<<<<<<<<
16526 * raise IOError('Cannot create hfile')
16527 *
16528 */
16529 }
16530
16531 /* "pysam/libchtslib.pyx":561
16532 * raise IOError('Cannot create hfile')
16533 *
16534 * try: # <<<<<<<<<<<<<<
16535 * # filename.name can be an int
16536 * filename = str(self.filename.name)
16537 */
16538 {
16539 __Pyx_PyThreadState_declare
16540 __Pyx_PyThreadState_assign
16541 __Pyx_ExceptionSave(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
16542 __Pyx_XGOTREF(__pyx_t_8);
16543 __Pyx_XGOTREF(__pyx_t_9);
16544 __Pyx_XGOTREF(__pyx_t_10);
16545 /*try:*/ {
16546
16547 /* "pysam/libchtslib.pyx":563
16548 * try:
16549 * # filename.name can be an int
16550 * filename = str(self.filename.name) # <<<<<<<<<<<<<<
16551 * except AttributeError:
16552 * filename = '<fd:{}>'.format(fd)
16553 */
16554 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->filename, __pyx_n_s_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 563, __pyx_L12_error)
16555 __Pyx_GOTREF(__pyx_t_5);
16556 __pyx_t_2 = __Pyx_PyObject_Unicode(__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 563, __pyx_L12_error)
16557 __Pyx_GOTREF(__pyx_t_2);
16558 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
16559 __pyx_v_filename = __pyx_t_2;
16560 __pyx_t_2 = 0;
16561
16562 /* "pysam/libchtslib.pyx":561
16563 * raise IOError('Cannot create hfile')
16564 *
16565 * try: # <<<<<<<<<<<<<<
16566 * # filename.name can be an int
16567 * filename = str(self.filename.name)
16568 */
16569 }
16570 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
16571 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
16572 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
16573 goto __pyx_L17_try_end;
16574 __pyx_L12_error:;
16575 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
16576 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
16577 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
16578
16579 /* "pysam/libchtslib.pyx":564
16580 * # filename.name can be an int
16581 * filename = str(self.filename.name)
16582 * except AttributeError: # <<<<<<<<<<<<<<
16583 * filename = '<fd:{}>'.format(fd)
16584 *
16585 */
16586 __pyx_t_3 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
16587 if (__pyx_t_3) {
16588 __Pyx_AddTraceback("pysam.libchtslib.HTSFile._open_htsfile", __pyx_clineno, __pyx_lineno, __pyx_filename);
16589 if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_5, &__pyx_t_6) < 0) __PYX_ERR(0, 564, __pyx_L14_except_error)
16590 __Pyx_XGOTREF(__pyx_t_2);
16591 __Pyx_XGOTREF(__pyx_t_5);
16592 __Pyx_XGOTREF(__pyx_t_6);
16593
16594 /* "pysam/libchtslib.pyx":565
16595 * filename = str(self.filename.name)
16596 * except AttributeError:
16597 * filename = '<fd:{}>'.format(fd) # <<<<<<<<<<<<<<
16598 *
16599 * filename = encode_filename(filename)
16600 */
16601 __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_fd, __pyx_n_s_format); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 565, __pyx_L14_except_error)
16602 __Pyx_GOTREF(__pyx_t_12);
16603 __pyx_t_13 = __Pyx_PyInt_From_int(__pyx_v_fd); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 565, __pyx_L14_except_error)
16604 __Pyx_GOTREF(__pyx_t_13);
16605 __pyx_t_14 = NULL;
16606 __pyx_t_7 = 0;
16607 #if CYTHON_UNPACK_METHODS
16608 if (likely(PyMethod_Check(__pyx_t_12))) {
16609 __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_12);
16610 if (likely(__pyx_t_14)) {
16611 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
16612 __Pyx_INCREF(__pyx_t_14);
16613 __Pyx_INCREF(function);
16614 __Pyx_DECREF_SET(__pyx_t_12, function);
16615 __pyx_t_7 = 1;
16616 }
16617 }
16618 #endif
16619 {
16620 PyObject *__pyx_callargs[2] = {__pyx_t_14, __pyx_t_13};
16621 __pyx_t_11 = __Pyx_PyObject_FastCall(__pyx_t_12, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
16622 __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
16623 __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
16624 if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 565, __pyx_L14_except_error)
16625 __Pyx_GOTREF(__pyx_t_11);
16626 __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
16627 }
16628 __Pyx_XDECREF_SET(__pyx_v_filename, __pyx_t_11);
16629 __pyx_t_11 = 0;
16630 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
16631 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
16632 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
16633 goto __pyx_L13_exception_handled;
16634 }
16635 goto __pyx_L14_except_error;
16636
16637 /* "pysam/libchtslib.pyx":561
16638 * raise IOError('Cannot create hfile')
16639 *
16640 * try: # <<<<<<<<<<<<<<
16641 * # filename.name can be an int
16642 * filename = str(self.filename.name)
16643 */
16644 __pyx_L14_except_error:;
16645 __Pyx_XGIVEREF(__pyx_t_8);
16646 __Pyx_XGIVEREF(__pyx_t_9);
16647 __Pyx_XGIVEREF(__pyx_t_10);
16648 __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
16649 goto __pyx_L1_error;
16650 __pyx_L13_exception_handled:;
16651 __Pyx_XGIVEREF(__pyx_t_8);
16652 __Pyx_XGIVEREF(__pyx_t_9);
16653 __Pyx_XGIVEREF(__pyx_t_10);
16654 __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
16655 __pyx_L17_try_end:;
16656 }
16657
16658 /* "pysam/libchtslib.pyx":567
16659 * filename = '<fd:{}>'.format(fd)
16660 *
16661 * filename = encode_filename(filename) # <<<<<<<<<<<<<<
16662 * cfilename = filename
16663 * with nogil:
16664 */
16665 __pyx_t_6 = __pyx_f_5pysam_9libcutils_encode_filename(__pyx_v_filename); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 567, __pyx_L1_error)
16666 __Pyx_GOTREF(__pyx_t_6);
16667 __Pyx_DECREF_SET(__pyx_v_filename, __pyx_t_6);
16668 __pyx_t_6 = 0;
16669
16670 /* "pysam/libchtslib.pyx":568
16671 *
16672 * filename = encode_filename(filename)
16673 * cfilename = filename # <<<<<<<<<<<<<<
16674 * with nogil:
16675 * htsfile = hts_hopen(hfile, cfilename, cmode)
16676 */
16677 __pyx_t_1 = __Pyx_PyObject_AsWritableString(__pyx_v_filename); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 568, __pyx_L1_error)
16678 __pyx_v_cfilename = __pyx_t_1;
16679
16680 /* "pysam/libchtslib.pyx":569
16681 * filename = encode_filename(filename)
16682 * cfilename = filename
16683 * with nogil: # <<<<<<<<<<<<<<
16684 * htsfile = hts_hopen(hfile, cfilename, cmode)
16685 * if htsfile != NULL:
16686 */
16687 {
16688 #ifdef WITH_THREAD
16689 PyThreadState *_save;
16690 _save = NULL;
16691 Py_UNBLOCK_THREADS
16692 __Pyx_FastGIL_Remember();
16693 #endif
16694 /*try:*/ {
16695
16696 /* "pysam/libchtslib.pyx":570
16697 * cfilename = filename
16698 * with nogil:
16699 * htsfile = hts_hopen(hfile, cfilename, cmode) # <<<<<<<<<<<<<<
16700 * if htsfile != NULL:
16701 * hts_set_threads(htsfile, threads)
16702 */
16703 __pyx_v_htsfile = hts_hopen(__pyx_v_hfile, __pyx_v_cfilename, __pyx_v_cmode);
16704
16705 /* "pysam/libchtslib.pyx":571
16706 * with nogil:
16707 * htsfile = hts_hopen(hfile, cfilename, cmode)
16708 * if htsfile != NULL: # <<<<<<<<<<<<<<
16709 * hts_set_threads(htsfile, threads)
16710 * return htsfile
16711 */
16712 __pyx_t_4 = (__pyx_v_htsfile != NULL);
16713 if (__pyx_t_4) {
16714
16715 /* "pysam/libchtslib.pyx":572
16716 * htsfile = hts_hopen(hfile, cfilename, cmode)
16717 * if htsfile != NULL:
16718 * hts_set_threads(htsfile, threads) # <<<<<<<<<<<<<<
16719 * return htsfile
16720 *
16721 */
16722 (void)(hts_set_threads(__pyx_v_htsfile, __pyx_v_threads));
16723
16724 /* "pysam/libchtslib.pyx":571
16725 * with nogil:
16726 * htsfile = hts_hopen(hfile, cfilename, cmode)
16727 * if htsfile != NULL: # <<<<<<<<<<<<<<
16728 * hts_set_threads(htsfile, threads)
16729 * return htsfile
16730 */
16731 }
16732
16733 /* "pysam/libchtslib.pyx":573
16734 * if htsfile != NULL:
16735 * hts_set_threads(htsfile, threads)
16736 * return htsfile # <<<<<<<<<<<<<<
16737 *
16738 * def add_hts_options(self, format_options=None):
16739 */
16740 __pyx_r = __pyx_v_htsfile;
16741 goto __pyx_L20_return;
16742 }
16743
16744 /* "pysam/libchtslib.pyx":569
16745 * filename = encode_filename(filename)
16746 * cfilename = filename
16747 * with nogil: # <<<<<<<<<<<<<<
16748 * htsfile = hts_hopen(hfile, cfilename, cmode)
16749 * if htsfile != NULL:
16750 */
16751 /*finally:*/ {
16752 __pyx_L20_return: {
16753 #ifdef WITH_THREAD
16754 __Pyx_FastGIL_Forget();
16755 Py_BLOCK_THREADS
16756 #endif
16757 goto __pyx_L0;
16758 }
16759 }
16760 }
16761 }
16762
16763 /* "pysam/libchtslib.pyx":525
16764 * return ret
16765 *
16766 * cdef htsFile *_open_htsfile(self) except? NULL: # <<<<<<<<<<<<<<
16767 * cdef char *cfilename
16768 * cdef char *cmode = self.mode
16769 */
16770
16771 /* function exit code */
16772 __pyx_L1_error:;
16773 __Pyx_XDECREF(__pyx_t_2);
16774 __Pyx_XDECREF(__pyx_t_5);
16775 __Pyx_XDECREF(__pyx_t_6);
16776 __Pyx_XDECREF(__pyx_t_11);
16777 __Pyx_XDECREF(__pyx_t_12);
16778 __Pyx_XDECREF(__pyx_t_13);
16779 __Pyx_XDECREF(__pyx_t_14);
16780 __Pyx_AddTraceback("pysam.libchtslib.HTSFile._open_htsfile", __pyx_clineno, __pyx_lineno, __pyx_filename);
16781 __pyx_r = NULL;
16782 __pyx_L0:;
16783 __Pyx_XDECREF(__pyx_v_smode);
16784 __Pyx_XDECREF(__pyx_v_filename);
16785 __Pyx_TraceReturn(Py_None, 0);
16786 __Pyx_RefNannyFinishContext();
16787 return __pyx_r;
16788 }
16789
16790 /* "pysam/libchtslib.pyx":575
16791 * return htsfile
16792 *
16793 * def add_hts_options(self, format_options=None): # <<<<<<<<<<<<<<
16794 * """Given a list of key=value format option strings, add them to an open htsFile
16795 * """
16796 */
16797
16798 /* Python wrapper */
16799 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_21add_hts_options(PyObject *__pyx_v_self,
16800 #if CYTHON_METH_FASTCALL
16801 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
16802 #else
16803 PyObject *__pyx_args, PyObject *__pyx_kwds
16804 #endif
16805 ); /*proto*/
16806 PyDoc_STRVAR(__pyx_doc_5pysam_10libchtslib_7HTSFile_20add_hts_options, "HTSFile.add_hts_options(self, format_options=None)\nGiven a list of key=value format option strings, add them to an open htsFile\n ");
16807 static PyMethodDef __pyx_mdef_5pysam_10libchtslib_7HTSFile_21add_hts_options = {"add_hts_options", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_7HTSFile_21add_hts_options, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_7HTSFile_20add_hts_options};
16808 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_21add_hts_options(PyObject *__pyx_v_self,
16809 #if CYTHON_METH_FASTCALL
16810 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
16811 #else
16812 PyObject *__pyx_args, PyObject *__pyx_kwds
16813 #endif
16814 ) {
16815 PyObject *__pyx_v_format_options = 0;
16816 #if !CYTHON_METH_FASTCALL
16817 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
16818 #endif
16819 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
16820 PyObject* values[1] = {0};
16821 int __pyx_lineno = 0;
16822 const char *__pyx_filename = NULL;
16823 int __pyx_clineno = 0;
16824 PyObject *__pyx_r = 0;
16825 __Pyx_RefNannyDeclarations
16826 __Pyx_RefNannySetupContext("add_hts_options (wrapper)", 0);
16827 #if !CYTHON_METH_FASTCALL
16828 #if CYTHON_ASSUME_SAFE_MACROS
16829 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
16830 #else
16831 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
16832 #endif
16833 #endif
16834 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
16835 {
16836 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_format_options,0};
16837 values[0] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
16838 if (__pyx_kwds) {
16839 Py_ssize_t kw_args;
16840 switch (__pyx_nargs) {
16841 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
16842 CYTHON_FALLTHROUGH;
16843 case 0: break;
16844 default: goto __pyx_L5_argtuple_error;
16845 }
16846 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
16847 switch (__pyx_nargs) {
16848 case 0:
16849 if (kw_args > 0) {
16850 PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_format_options);
16851 if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
16852 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 575, __pyx_L3_error)
16853 }
16854 }
16855 if (unlikely(kw_args > 0)) {
16856 const Py_ssize_t kwd_pos_args = __pyx_nargs;
16857 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "add_hts_options") < 0)) __PYX_ERR(0, 575, __pyx_L3_error)
16858 }
16859 } else {
16860 switch (__pyx_nargs) {
16861 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
16862 CYTHON_FALLTHROUGH;
16863 case 0: break;
16864 default: goto __pyx_L5_argtuple_error;
16865 }
16866 }
16867 __pyx_v_format_options = values[0];
16868 }
16869 goto __pyx_L6_skip;
16870 __pyx_L5_argtuple_error:;
16871 __Pyx_RaiseArgtupleInvalid("add_hts_options", 0, 0, 1, __pyx_nargs); __PYX_ERR(0, 575, __pyx_L3_error)
16872 __pyx_L6_skip:;
16873 goto __pyx_L4_argument_unpacking_done;
16874 __pyx_L3_error:;
16875 {
16876 Py_ssize_t __pyx_temp;
16877 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
16878 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
16879 }
16880 }
16881 __Pyx_AddTraceback("pysam.libchtslib.HTSFile.add_hts_options", __pyx_clineno, __pyx_lineno, __pyx_filename);
16882 __Pyx_RefNannyFinishContext();
16883 return NULL;
16884 __pyx_L4_argument_unpacking_done:;
16885 __pyx_r = __pyx_pf_5pysam_10libchtslib_7HTSFile_20add_hts_options(((struct __pyx_obj_5pysam_10libchtslib_HTSFile *)__pyx_v_self), __pyx_v_format_options);
16886
16887 /* function exit code */
16888 {
16889 Py_ssize_t __pyx_temp;
16890 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
16891 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
16892 }
16893 }
16894 __Pyx_RefNannyFinishContext();
16895 return __pyx_r;
16896 }
16897
16898 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_20add_hts_options(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self, PyObject *__pyx_v_format_options) {
16899 int __pyx_v_rval;
16900 hts_opt *__pyx_v_opts;
16901 PyObject *__pyx_v_format_option = NULL;
16902 PyObject *__pyx_r = NULL;
16903 __Pyx_TraceDeclarations
16904 __Pyx_RefNannyDeclarations
16905 int __pyx_t_1;
16906 PyObject *__pyx_t_2 = NULL;
16907 Py_ssize_t __pyx_t_3;
16908 PyObject *(*__pyx_t_4)(PyObject *);
16909 PyObject *__pyx_t_5 = NULL;
16910 char const *__pyx_t_6;
16911 PyObject *__pyx_t_7 = NULL;
16912 PyObject *__pyx_t_8 = NULL;
16913 unsigned int __pyx_t_9;
16914 int __pyx_lineno = 0;
16915 const char *__pyx_filename = NULL;
16916 int __pyx_clineno = 0;
16917 __Pyx_TraceFrameInit(__pyx_codeobj__50)
16918 __Pyx_RefNannySetupContext("add_hts_options", 1);
16919 __Pyx_TraceCall("add_hts_options", __pyx_f[0], 575, 0, __PYX_ERR(0, 575, __pyx_L1_error));
16920
16921 /* "pysam/libchtslib.pyx":579
16922 * """
16923 * cdef int rval
16924 * cdef hts_opt *opts = NULL # <<<<<<<<<<<<<<
16925 *
16926 * if format_options:
16927 */
16928 __pyx_v_opts = NULL;
16929
16930 /* "pysam/libchtslib.pyx":581
16931 * cdef hts_opt *opts = NULL
16932 *
16933 * if format_options: # <<<<<<<<<<<<<<
16934 * for format_option in format_options:
16935 * rval = hts_opt_add(&opts, format_option)
16936 */
16937 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_format_options); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 581, __pyx_L1_error)
16938 if (__pyx_t_1) {
16939
16940 /* "pysam/libchtslib.pyx":582
16941 *
16942 * if format_options:
16943 * for format_option in format_options: # <<<<<<<<<<<<<<
16944 * rval = hts_opt_add(&opts, format_option)
16945 * if rval != 0:
16946 */
16947 if (likely(PyList_CheckExact(__pyx_v_format_options)) || PyTuple_CheckExact(__pyx_v_format_options)) {
16948 __pyx_t_2 = __pyx_v_format_options; __Pyx_INCREF(__pyx_t_2);
16949 __pyx_t_3 = 0;
16950 __pyx_t_4 = NULL;
16951 } else {
16952 __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_format_options); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 582, __pyx_L1_error)
16953 __Pyx_GOTREF(__pyx_t_2);
16954 __pyx_t_4 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 582, __pyx_L1_error)
16955 }
16956 for (;;) {
16957 if (likely(!__pyx_t_4)) {
16958 if (likely(PyList_CheckExact(__pyx_t_2))) {
16959 {
16960 Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
16961 #if !CYTHON_ASSUME_SAFE_MACROS
16962 if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 582, __pyx_L1_error)
16963 #endif
16964 if (__pyx_t_3 >= __pyx_temp) break;
16965 }
16966 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
16967 __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely((0 < 0))) __PYX_ERR(0, 582, __pyx_L1_error)
16968 #else
16969 __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 582, __pyx_L1_error)
16970 __Pyx_GOTREF(__pyx_t_5);
16971 #endif
16972 } else {
16973 {
16974 Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2);
16975 #if !CYTHON_ASSUME_SAFE_MACROS
16976 if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 582, __pyx_L1_error)
16977 #endif
16978 if (__pyx_t_3 >= __pyx_temp) break;
16979 }
16980 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
16981 __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely((0 < 0))) __PYX_ERR(0, 582, __pyx_L1_error)
16982 #else
16983 __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 582, __pyx_L1_error)
16984 __Pyx_GOTREF(__pyx_t_5);
16985 #endif
16986 }
16987 } else {
16988 __pyx_t_5 = __pyx_t_4(__pyx_t_2);
16989 if (unlikely(!__pyx_t_5)) {
16990 PyObject* exc_type = PyErr_Occurred();
16991 if (exc_type) {
16992 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
16993 else __PYX_ERR(0, 582, __pyx_L1_error)
16994 }
16995 break;
16996 }
16997 __Pyx_GOTREF(__pyx_t_5);
16998 }
16999 __Pyx_XDECREF_SET(__pyx_v_format_option, __pyx_t_5);
17000 __pyx_t_5 = 0;
17001
17002 /* "pysam/libchtslib.pyx":583
17003 * if format_options:
17004 * for format_option in format_options:
17005 * rval = hts_opt_add(&opts, format_option) # <<<<<<<<<<<<<<
17006 * if rval != 0:
17007 * if opts != NULL:
17008 */
17009 __pyx_t_6 = __Pyx_PyObject_AsString(__pyx_v_format_option); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 583, __pyx_L1_error)
17010 __pyx_v_rval = hts_opt_add((&__pyx_v_opts), __pyx_t_6);
17011
17012 /* "pysam/libchtslib.pyx":584
17013 * for format_option in format_options:
17014 * rval = hts_opt_add(&opts, format_option)
17015 * if rval != 0: # <<<<<<<<<<<<<<
17016 * if opts != NULL:
17017 * hts_opt_free(opts)
17018 */
17019 __pyx_t_1 = (__pyx_v_rval != 0);
17020 if (__pyx_t_1) {
17021
17022 /* "pysam/libchtslib.pyx":585
17023 * rval = hts_opt_add(&opts, format_option)
17024 * if rval != 0:
17025 * if opts != NULL: # <<<<<<<<<<<<<<
17026 * hts_opt_free(opts)
17027 * raise RuntimeError('Invalid format option ({}) specified'.format(format_option))
17028 */
17029 __pyx_t_1 = (__pyx_v_opts != NULL);
17030 if (__pyx_t_1) {
17031
17032 /* "pysam/libchtslib.pyx":586
17033 * if rval != 0:
17034 * if opts != NULL:
17035 * hts_opt_free(opts) # <<<<<<<<<<<<<<
17036 * raise RuntimeError('Invalid format option ({}) specified'.format(format_option))
17037 * if opts != NULL:
17038 */
17039 hts_opt_free(__pyx_v_opts);
17040
17041 /* "pysam/libchtslib.pyx":585
17042 * rval = hts_opt_add(&opts, format_option)
17043 * if rval != 0:
17044 * if opts != NULL: # <<<<<<<<<<<<<<
17045 * hts_opt_free(opts)
17046 * raise RuntimeError('Invalid format option ({}) specified'.format(format_option))
17047 */
17048 }
17049
17050 /* "pysam/libchtslib.pyx":587
17051 * if opts != NULL:
17052 * hts_opt_free(opts)
17053 * raise RuntimeError('Invalid format option ({}) specified'.format(format_option)) # <<<<<<<<<<<<<<
17054 * if opts != NULL:
17055 * rval = hts_opt_apply(self.htsfile, opts)
17056 */
17057 __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_kp_u_Invalid_format_option_specified, __pyx_n_s_format); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 587, __pyx_L1_error)
17058 __Pyx_GOTREF(__pyx_t_7);
17059 __pyx_t_8 = NULL;
17060 __pyx_t_9 = 0;
17061 #if CYTHON_UNPACK_METHODS
17062 if (likely(PyMethod_Check(__pyx_t_7))) {
17063 __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
17064 if (likely(__pyx_t_8)) {
17065 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
17066 __Pyx_INCREF(__pyx_t_8);
17067 __Pyx_INCREF(function);
17068 __Pyx_DECREF_SET(__pyx_t_7, function);
17069 __pyx_t_9 = 1;
17070 }
17071 }
17072 #endif
17073 {
17074 PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_v_format_option};
17075 __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9);
17076 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
17077 if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 587, __pyx_L1_error)
17078 __Pyx_GOTREF(__pyx_t_5);
17079 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
17080 }
17081 __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_RuntimeError, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 587, __pyx_L1_error)
17082 __Pyx_GOTREF(__pyx_t_7);
17083 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
17084 __Pyx_Raise(__pyx_t_7, 0, 0, 0);
17085 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
17086 __PYX_ERR(0, 587, __pyx_L1_error)
17087
17088 /* "pysam/libchtslib.pyx":584
17089 * for format_option in format_options:
17090 * rval = hts_opt_add(&opts, format_option)
17091 * if rval != 0: # <<<<<<<<<<<<<<
17092 * if opts != NULL:
17093 * hts_opt_free(opts)
17094 */
17095 }
17096
17097 /* "pysam/libchtslib.pyx":582
17098 *
17099 * if format_options:
17100 * for format_option in format_options: # <<<<<<<<<<<<<<
17101 * rval = hts_opt_add(&opts, format_option)
17102 * if rval != 0:
17103 */
17104 }
17105 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
17106
17107 /* "pysam/libchtslib.pyx":588
17108 * hts_opt_free(opts)
17109 * raise RuntimeError('Invalid format option ({}) specified'.format(format_option))
17110 * if opts != NULL: # <<<<<<<<<<<<<<
17111 * rval = hts_opt_apply(self.htsfile, opts)
17112 * if rval != 0:
17113 */
17114 __pyx_t_1 = (__pyx_v_opts != NULL);
17115 if (__pyx_t_1) {
17116
17117 /* "pysam/libchtslib.pyx":589
17118 * raise RuntimeError('Invalid format option ({}) specified'.format(format_option))
17119 * if opts != NULL:
17120 * rval = hts_opt_apply(self.htsfile, opts) # <<<<<<<<<<<<<<
17121 * if rval != 0:
17122 * hts_opt_free(opts)
17123 */
17124 __pyx_v_rval = hts_opt_apply(__pyx_v_self->htsfile, __pyx_v_opts);
17125
17126 /* "pysam/libchtslib.pyx":590
17127 * if opts != NULL:
17128 * rval = hts_opt_apply(self.htsfile, opts)
17129 * if rval != 0: # <<<<<<<<<<<<<<
17130 * hts_opt_free(opts)
17131 * raise RuntimeError('An error occurred while applying the requested format options')
17132 */
17133 __pyx_t_1 = (__pyx_v_rval != 0);
17134 if (unlikely(__pyx_t_1)) {
17135
17136 /* "pysam/libchtslib.pyx":591
17137 * rval = hts_opt_apply(self.htsfile, opts)
17138 * if rval != 0:
17139 * hts_opt_free(opts) # <<<<<<<<<<<<<<
17140 * raise RuntimeError('An error occurred while applying the requested format options')
17141 * hts_opt_free(opts)
17142 */
17143 hts_opt_free(__pyx_v_opts);
17144
17145 /* "pysam/libchtslib.pyx":592
17146 * if rval != 0:
17147 * hts_opt_free(opts)
17148 * raise RuntimeError('An error occurred while applying the requested format options') # <<<<<<<<<<<<<<
17149 * hts_opt_free(opts)
17150 *
17151 */
17152 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__51, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 592, __pyx_L1_error)
17153 __Pyx_GOTREF(__pyx_t_2);
17154 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
17155 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
17156 __PYX_ERR(0, 592, __pyx_L1_error)
17157
17158 /* "pysam/libchtslib.pyx":590
17159 * if opts != NULL:
17160 * rval = hts_opt_apply(self.htsfile, opts)
17161 * if rval != 0: # <<<<<<<<<<<<<<
17162 * hts_opt_free(opts)
17163 * raise RuntimeError('An error occurred while applying the requested format options')
17164 */
17165 }
17166
17167 /* "pysam/libchtslib.pyx":593
17168 * hts_opt_free(opts)
17169 * raise RuntimeError('An error occurred while applying the requested format options')
17170 * hts_opt_free(opts) # <<<<<<<<<<<<<<
17171 *
17172 * def parse_region(self, contig=None, start=None, stop=None,
17173 */
17174 hts_opt_free(__pyx_v_opts);
17175
17176 /* "pysam/libchtslib.pyx":588
17177 * hts_opt_free(opts)
17178 * raise RuntimeError('Invalid format option ({}) specified'.format(format_option))
17179 * if opts != NULL: # <<<<<<<<<<<<<<
17180 * rval = hts_opt_apply(self.htsfile, opts)
17181 * if rval != 0:
17182 */
17183 }
17184
17185 /* "pysam/libchtslib.pyx":581
17186 * cdef hts_opt *opts = NULL
17187 *
17188 * if format_options: # <<<<<<<<<<<<<<
17189 * for format_option in format_options:
17190 * rval = hts_opt_add(&opts, format_option)
17191 */
17192 }
17193
17194 /* "pysam/libchtslib.pyx":575
17195 * return htsfile
17196 *
17197 * def add_hts_options(self, format_options=None): # <<<<<<<<<<<<<<
17198 * """Given a list of key=value format option strings, add them to an open htsFile
17199 * """
17200 */
17201
17202 /* function exit code */
17203 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
17204 goto __pyx_L0;
17205 __pyx_L1_error:;
17206 __Pyx_XDECREF(__pyx_t_2);
17207 __Pyx_XDECREF(__pyx_t_5);
17208 __Pyx_XDECREF(__pyx_t_7);
17209 __Pyx_XDECREF(__pyx_t_8);
17210 __Pyx_AddTraceback("pysam.libchtslib.HTSFile.add_hts_options", __pyx_clineno, __pyx_lineno, __pyx_filename);
17211 __pyx_r = NULL;
17212 __pyx_L0:;
17213 __Pyx_XDECREF(__pyx_v_format_option);
17214 __Pyx_XGIVEREF(__pyx_r);
17215 __Pyx_TraceReturn(__pyx_r, 0);
17216 __Pyx_RefNannyFinishContext();
17217 return __pyx_r;
17218 }
17219
17220 /* "pysam/libchtslib.pyx":595
17221 * hts_opt_free(opts)
17222 *
17223 * def parse_region(self, contig=None, start=None, stop=None, # <<<<<<<<<<<<<<
17224 * region=None, tid=None,
17225 * reference=None, end=None):
17226 */
17227
17228 /* Python wrapper */
17229 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_23parse_region(PyObject *__pyx_v_self,
17230 #if CYTHON_METH_FASTCALL
17231 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
17232 #else
17233 PyObject *__pyx_args, PyObject *__pyx_kwds
17234 #endif
17235 ); /*proto*/
17236 PyDoc_STRVAR(__pyx_doc_5pysam_10libchtslib_7HTSFile_22parse_region, "HTSFile.parse_region(self, contig=None, start=None, stop=None, region=None, tid=None, reference=None, end=None)\nparse alternative ways to specify a genomic region. A region can\n either be specified by :term:`contig`, `start` and\n `stop`. `start` and `stop` denote 0-based, half-open\n intervals. :term:`reference` and `end` are also accepted for\n backward compatibility as synonyms for :term:`contig` and\n `stop`, respectively.\n\n Alternatively, a samtools :term:`region` string can be\n supplied.\n\n If any of the coordinates are missing they will be replaced by\n the minimum (`start`) or maximum (`stop`) coordinate.\n\n Note that region strings are 1-based inclusive, while `start`\n and `stop` denote an interval in 0-based, half-open\n coordinates (like BED files and Python slices).\n\n If `contig` or `region` or are ``*``, unmapped reads at the end\n of a BAM file will be returned. Setting either to ``.`` will\n iterate from the beginning of the file.\n\n Returns\n -------\n\n tuple :\n a tuple of `flag`, :term:`tid`, `start` and\n `stop`. The flag indicates whether no coordinates were\n supplied and the genomic region is the complete genomic space.\n\n Raises\n ------\n\n ValueError\n for invalid or out of bounds regions.\n\n ");
17237 static PyMethodDef __pyx_mdef_5pysam_10libchtslib_7HTSFile_23parse_region = {"parse_region", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_7HTSFile_23parse_region, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_7HTSFile_22parse_region};
17238 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_23parse_region(PyObject *__pyx_v_self,
17239 #if CYTHON_METH_FASTCALL
17240 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
17241 #else
17242 PyObject *__pyx_args, PyObject *__pyx_kwds
17243 #endif
17244 ) {
17245 PyObject *__pyx_v_contig = 0;
17246 PyObject *__pyx_v_start = 0;
17247 PyObject *__pyx_v_stop = 0;
17248 PyObject *__pyx_v_region = 0;
17249 PyObject *__pyx_v_tid = 0;
17250 PyObject *__pyx_v_reference = 0;
17251 PyObject *__pyx_v_end = 0;
17252 #if !CYTHON_METH_FASTCALL
17253 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
17254 #endif
17255 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
17256 PyObject* values[7] = {0,0,0,0,0,0,0};
17257 int __pyx_lineno = 0;
17258 const char *__pyx_filename = NULL;
17259 int __pyx_clineno = 0;
17260 PyObject *__pyx_r = 0;
17261 __Pyx_RefNannyDeclarations
17262 __Pyx_RefNannySetupContext("parse_region (wrapper)", 0);
17263 #if !CYTHON_METH_FASTCALL
17264 #if CYTHON_ASSUME_SAFE_MACROS
17265 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
17266 #else
17267 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
17268 #endif
17269 #endif
17270 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
17271 {
17272 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_contig,&__pyx_n_s_start,&__pyx_n_s_stop,&__pyx_n_s_region,&__pyx_n_s_tid,&__pyx_n_s_reference,&__pyx_n_s_end,0};
17273 values[0] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
17274 values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
17275 values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
17276
17277 /* "pysam/libchtslib.pyx":596
17278 *
17279 * def parse_region(self, contig=None, start=None, stop=None,
17280 * region=None, tid=None, # <<<<<<<<<<<<<<
17281 * reference=None, end=None):
17282 * """parse alternative ways to specify a genomic region. A region can
17283 */
17284 values[3] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
17285 values[4] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
17286
17287 /* "pysam/libchtslib.pyx":597
17288 * def parse_region(self, contig=None, start=None, stop=None,
17289 * region=None, tid=None,
17290 * reference=None, end=None): # <<<<<<<<<<<<<<
17291 * """parse alternative ways to specify a genomic region. A region can
17292 * either be specified by :term:`contig`, `start` and
17293 */
17294 values[5] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
17295 values[6] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
17296 if (__pyx_kwds) {
17297 Py_ssize_t kw_args;
17298 switch (__pyx_nargs) {
17299 case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6);
17300 CYTHON_FALLTHROUGH;
17301 case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5);
17302 CYTHON_FALLTHROUGH;
17303 case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
17304 CYTHON_FALLTHROUGH;
17305 case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
17306 CYTHON_FALLTHROUGH;
17307 case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
17308 CYTHON_FALLTHROUGH;
17309 case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
17310 CYTHON_FALLTHROUGH;
17311 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
17312 CYTHON_FALLTHROUGH;
17313 case 0: break;
17314 default: goto __pyx_L5_argtuple_error;
17315 }
17316 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
17317 switch (__pyx_nargs) {
17318 case 0:
17319 if (kw_args > 0) {
17320 PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_contig);
17321 if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
17322 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 595, __pyx_L3_error)
17323 }
17324 CYTHON_FALLTHROUGH;
17325 case 1:
17326 if (kw_args > 0) {
17327 PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_start);
17328 if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
17329 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 595, __pyx_L3_error)
17330 }
17331 CYTHON_FALLTHROUGH;
17332 case 2:
17333 if (kw_args > 0) {
17334 PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_stop);
17335 if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
17336 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 595, __pyx_L3_error)
17337 }
17338 CYTHON_FALLTHROUGH;
17339 case 3:
17340 if (kw_args > 0) {
17341 PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_region);
17342 if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
17343 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 595, __pyx_L3_error)
17344 }
17345 CYTHON_FALLTHROUGH;
17346 case 4:
17347 if (kw_args > 0) {
17348 PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tid);
17349 if (value) { values[4] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
17350 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 595, __pyx_L3_error)
17351 }
17352 CYTHON_FALLTHROUGH;
17353 case 5:
17354 if (kw_args > 0) {
17355 PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_reference);
17356 if (value) { values[5] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
17357 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 595, __pyx_L3_error)
17358 }
17359 CYTHON_FALLTHROUGH;
17360 case 6:
17361 if (kw_args > 0) {
17362 PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_end);
17363 if (value) { values[6] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
17364 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 595, __pyx_L3_error)
17365 }
17366 }
17367 if (unlikely(kw_args > 0)) {
17368 const Py_ssize_t kwd_pos_args = __pyx_nargs;
17369 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "parse_region") < 0)) __PYX_ERR(0, 595, __pyx_L3_error)
17370 }
17371 } else {
17372 switch (__pyx_nargs) {
17373 case 7: values[6] = __Pyx_Arg_FASTCALL(__pyx_args, 6);
17374 CYTHON_FALLTHROUGH;
17375 case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5);
17376 CYTHON_FALLTHROUGH;
17377 case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
17378 CYTHON_FALLTHROUGH;
17379 case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
17380 CYTHON_FALLTHROUGH;
17381 case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
17382 CYTHON_FALLTHROUGH;
17383 case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
17384 CYTHON_FALLTHROUGH;
17385 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
17386 CYTHON_FALLTHROUGH;
17387 case 0: break;
17388 default: goto __pyx_L5_argtuple_error;
17389 }
17390 }
17391 __pyx_v_contig = values[0];
17392 __pyx_v_start = values[1];
17393 __pyx_v_stop = values[2];
17394 __pyx_v_region = values[3];
17395 __pyx_v_tid = values[4];
17396 __pyx_v_reference = values[5];
17397 __pyx_v_end = values[6];
17398 }
17399 goto __pyx_L6_skip;
17400 __pyx_L5_argtuple_error:;
17401 __Pyx_RaiseArgtupleInvalid("parse_region", 0, 0, 7, __pyx_nargs); __PYX_ERR(0, 595, __pyx_L3_error)
17402 __pyx_L6_skip:;
17403 goto __pyx_L4_argument_unpacking_done;
17404 __pyx_L3_error:;
17405 {
17406 Py_ssize_t __pyx_temp;
17407 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
17408 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
17409 }
17410 }
17411 __Pyx_AddTraceback("pysam.libchtslib.HTSFile.parse_region", __pyx_clineno, __pyx_lineno, __pyx_filename);
17412 __Pyx_RefNannyFinishContext();
17413 return NULL;
17414 __pyx_L4_argument_unpacking_done:;
17415 __pyx_r = __pyx_pf_5pysam_10libchtslib_7HTSFile_22parse_region(((struct __pyx_obj_5pysam_10libchtslib_HTSFile *)__pyx_v_self), __pyx_v_contig, __pyx_v_start, __pyx_v_stop, __pyx_v_region, __pyx_v_tid, __pyx_v_reference, __pyx_v_end);
17416
17417 /* "pysam/libchtslib.pyx":595
17418 * hts_opt_free(opts)
17419 *
17420 * def parse_region(self, contig=None, start=None, stop=None, # <<<<<<<<<<<<<<
17421 * region=None, tid=None,
17422 * reference=None, end=None):
17423 */
17424
17425 /* function exit code */
17426 {
17427 Py_ssize_t __pyx_temp;
17428 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
17429 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
17430 }
17431 }
17432 __Pyx_RefNannyFinishContext();
17433 return __pyx_r;
17434 }
17435
17436 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_22parse_region(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self, PyObject *__pyx_v_contig, PyObject *__pyx_v_start, PyObject *__pyx_v_stop, PyObject *__pyx_v_region, PyObject *__pyx_v_tid, PyObject *__pyx_v_reference, PyObject *__pyx_v_end) {
17437 int __pyx_v_rtid;
17438 int32_t __pyx_v_rstart;
17439 int32_t __pyx_v_rstop;
17440 PyObject *__pyx_v_coord = NULL;
17441 PyObject *__pyx_v_parts = NULL;
17442 PyObject *__pyx_r = NULL;
17443 __Pyx_TraceDeclarations
17444 __Pyx_RefNannyDeclarations
17445 int __pyx_t_1;
17446 PyObject *__pyx_t_2 = NULL;
17447 int __pyx_t_3;
17448 PyObject *__pyx_t_4 = NULL;
17449 PyObject *__pyx_t_5 = NULL;
17450 PyObject *__pyx_t_6 = NULL;
17451 PyObject *__pyx_t_7 = NULL;
17452 int32_t __pyx_t_8;
17453 int __pyx_t_9;
17454 PyObject *__pyx_t_10 = NULL;
17455 PyObject *__pyx_t_11 = NULL;
17456 PyObject *__pyx_t_12 = NULL;
17457 unsigned int __pyx_t_13;
17458 PyObject *(*__pyx_t_14)(PyObject *);
17459 Py_ssize_t __pyx_t_15;
17460 int __pyx_lineno = 0;
17461 const char *__pyx_filename = NULL;
17462 int __pyx_clineno = 0;
17463 __Pyx_TraceFrameInit(__pyx_codeobj__52)
17464 __Pyx_RefNannySetupContext("parse_region", 0);
17465 __Pyx_TraceCall("parse_region", __pyx_f[0], 595, 0, __PYX_ERR(0, 595, __pyx_L1_error));
17466 __Pyx_INCREF(__pyx_v_contig);
17467 __Pyx_INCREF(__pyx_v_stop);
17468 __Pyx_INCREF(__pyx_v_region);
17469
17470 /* "pysam/libchtslib.pyx":638
17471 * cdef int32_t rstop
17472 *
17473 * if reference is not None: # <<<<<<<<<<<<<<
17474 * if contig is not None:
17475 * raise ValueError('contig and reference should not both be specified')
17476 */
17477 __pyx_t_1 = (__pyx_v_reference != Py_None);
17478 if (__pyx_t_1) {
17479
17480 /* "pysam/libchtslib.pyx":639
17481 *
17482 * if reference is not None:
17483 * if contig is not None: # <<<<<<<<<<<<<<
17484 * raise ValueError('contig and reference should not both be specified')
17485 * contig = reference
17486 */
17487 __pyx_t_1 = (__pyx_v_contig != Py_None);
17488 if (unlikely(__pyx_t_1)) {
17489
17490 /* "pysam/libchtslib.pyx":640
17491 * if reference is not None:
17492 * if contig is not None:
17493 * raise ValueError('contig and reference should not both be specified') # <<<<<<<<<<<<<<
17494 * contig = reference
17495 *
17496 */
17497 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__53, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 640, __pyx_L1_error)
17498 __Pyx_GOTREF(__pyx_t_2);
17499 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
17500 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
17501 __PYX_ERR(0, 640, __pyx_L1_error)
17502
17503 /* "pysam/libchtslib.pyx":639
17504 *
17505 * if reference is not None:
17506 * if contig is not None: # <<<<<<<<<<<<<<
17507 * raise ValueError('contig and reference should not both be specified')
17508 * contig = reference
17509 */
17510 }
17511
17512 /* "pysam/libchtslib.pyx":641
17513 * if contig is not None:
17514 * raise ValueError('contig and reference should not both be specified')
17515 * contig = reference # <<<<<<<<<<<<<<
17516 *
17517 * if end is not None:
17518 */
17519 __Pyx_INCREF(__pyx_v_reference);
17520 __Pyx_DECREF_SET(__pyx_v_contig, __pyx_v_reference);
17521
17522 /* "pysam/libchtslib.pyx":638
17523 * cdef int32_t rstop
17524 *
17525 * if reference is not None: # <<<<<<<<<<<<<<
17526 * if contig is not None:
17527 * raise ValueError('contig and reference should not both be specified')
17528 */
17529 }
17530
17531 /* "pysam/libchtslib.pyx":643
17532 * contig = reference
17533 *
17534 * if end is not None: # <<<<<<<<<<<<<<
17535 * if stop is not None:
17536 * raise ValueError('stop and end should not both be specified')
17537 */
17538 __pyx_t_1 = (__pyx_v_end != Py_None);
17539 if (__pyx_t_1) {
17540
17541 /* "pysam/libchtslib.pyx":644
17542 *
17543 * if end is not None:
17544 * if stop is not None: # <<<<<<<<<<<<<<
17545 * raise ValueError('stop and end should not both be specified')
17546 * stop = end
17547 */
17548 __pyx_t_1 = (__pyx_v_stop != Py_None);
17549 if (unlikely(__pyx_t_1)) {
17550
17551 /* "pysam/libchtslib.pyx":645
17552 * if end is not None:
17553 * if stop is not None:
17554 * raise ValueError('stop and end should not both be specified') # <<<<<<<<<<<<<<
17555 * stop = end
17556 *
17557 */
17558 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__54, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 645, __pyx_L1_error)
17559 __Pyx_GOTREF(__pyx_t_2);
17560 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
17561 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
17562 __PYX_ERR(0, 645, __pyx_L1_error)
17563
17564 /* "pysam/libchtslib.pyx":644
17565 *
17566 * if end is not None:
17567 * if stop is not None: # <<<<<<<<<<<<<<
17568 * raise ValueError('stop and end should not both be specified')
17569 * stop = end
17570 */
17571 }
17572
17573 /* "pysam/libchtslib.pyx":646
17574 * if stop is not None:
17575 * raise ValueError('stop and end should not both be specified')
17576 * stop = end # <<<<<<<<<<<<<<
17577 *
17578 * if contig is None and tid is None and region is None:
17579 */
17580 __Pyx_INCREF(__pyx_v_end);
17581 __Pyx_DECREF_SET(__pyx_v_stop, __pyx_v_end);
17582
17583 /* "pysam/libchtslib.pyx":643
17584 * contig = reference
17585 *
17586 * if end is not None: # <<<<<<<<<<<<<<
17587 * if stop is not None:
17588 * raise ValueError('stop and end should not both be specified')
17589 */
17590 }
17591
17592 /* "pysam/libchtslib.pyx":648
17593 * stop = end
17594 *
17595 * if contig is None and tid is None and region is None: # <<<<<<<<<<<<<<
17596 * return 0, 0, 0, MAX_POS
17597 *
17598 */
17599 __pyx_t_3 = (__pyx_v_contig == Py_None);
17600 if (__pyx_t_3) {
17601 } else {
17602 __pyx_t_1 = __pyx_t_3;
17603 goto __pyx_L8_bool_binop_done;
17604 }
17605 __pyx_t_3 = (__pyx_v_tid == Py_None);
17606 if (__pyx_t_3) {
17607 } else {
17608 __pyx_t_1 = __pyx_t_3;
17609 goto __pyx_L8_bool_binop_done;
17610 }
17611 __pyx_t_3 = (__pyx_v_region == Py_None);
17612 __pyx_t_1 = __pyx_t_3;
17613 __pyx_L8_bool_binop_done:;
17614 if (__pyx_t_1) {
17615
17616 /* "pysam/libchtslib.pyx":649
17617 *
17618 * if contig is None and tid is None and region is None:
17619 * return 0, 0, 0, MAX_POS # <<<<<<<<<<<<<<
17620 *
17621 * rtid = -1
17622 */
17623 __Pyx_XDECREF(__pyx_r);
17624 __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_5pysam_10libchtslib_MAX_POS); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 649, __pyx_L1_error)
17625 __Pyx_GOTREF(__pyx_t_2);
17626 __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 649, __pyx_L1_error)
17627 __Pyx_GOTREF(__pyx_t_4);
17628 __Pyx_INCREF(__pyx_int_0);
17629 __Pyx_GIVEREF(__pyx_int_0);
17630 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_int_0)) __PYX_ERR(0, 649, __pyx_L1_error);
17631 __Pyx_INCREF(__pyx_int_0);
17632 __Pyx_GIVEREF(__pyx_int_0);
17633 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_0)) __PYX_ERR(0, 649, __pyx_L1_error);
17634 __Pyx_INCREF(__pyx_int_0);
17635 __Pyx_GIVEREF(__pyx_int_0);
17636 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_int_0)) __PYX_ERR(0, 649, __pyx_L1_error);
17637 __Pyx_GIVEREF(__pyx_t_2);
17638 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_2)) __PYX_ERR(0, 649, __pyx_L1_error);
17639 __pyx_t_2 = 0;
17640 __pyx_r = __pyx_t_4;
17641 __pyx_t_4 = 0;
17642 goto __pyx_L0;
17643
17644 /* "pysam/libchtslib.pyx":648
17645 * stop = end
17646 *
17647 * if contig is None and tid is None and region is None: # <<<<<<<<<<<<<<
17648 * return 0, 0, 0, MAX_POS
17649 *
17650 */
17651 }
17652
17653 /* "pysam/libchtslib.pyx":651
17654 * return 0, 0, 0, MAX_POS
17655 *
17656 * rtid = -1 # <<<<<<<<<<<<<<
17657 * rstart = 0
17658 * rstop = MAX_POS
17659 */
17660 __pyx_v_rtid = -1;
17661
17662 /* "pysam/libchtslib.pyx":652
17663 *
17664 * rtid = -1
17665 * rstart = 0 # <<<<<<<<<<<<<<
17666 * rstop = MAX_POS
17667 * if start is not None:
17668 */
17669 __pyx_v_rstart = 0;
17670
17671 /* "pysam/libchtslib.pyx":653
17672 * rtid = -1
17673 * rstart = 0
17674 * rstop = MAX_POS # <<<<<<<<<<<<<<
17675 * if start is not None:
17676 * try:
17677 */
17678 __pyx_v_rstop = __pyx_v_5pysam_10libchtslib_MAX_POS;
17679
17680 /* "pysam/libchtslib.pyx":654
17681 * rstart = 0
17682 * rstop = MAX_POS
17683 * if start is not None: # <<<<<<<<<<<<<<
17684 * try:
17685 * rstart = start
17686 */
17687 __pyx_t_1 = (__pyx_v_start != Py_None);
17688 if (__pyx_t_1) {
17689
17690 /* "pysam/libchtslib.pyx":655
17691 * rstop = MAX_POS
17692 * if start is not None:
17693 * try: # <<<<<<<<<<<<<<
17694 * rstart = start
17695 * except OverflowError:
17696 */
17697 {
17698 __Pyx_PyThreadState_declare
17699 __Pyx_PyThreadState_assign
17700 __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7);
17701 __Pyx_XGOTREF(__pyx_t_5);
17702 __Pyx_XGOTREF(__pyx_t_6);
17703 __Pyx_XGOTREF(__pyx_t_7);
17704 /*try:*/ {
17705
17706 /* "pysam/libchtslib.pyx":656
17707 * if start is not None:
17708 * try:
17709 * rstart = start # <<<<<<<<<<<<<<
17710 * except OverflowError:
17711 * raise ValueError('start out of range (%i)' % start)
17712 */
17713 __pyx_t_8 = __Pyx_PyInt_As_int32_t(__pyx_v_start); if (unlikely((__pyx_t_8 == ((int32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 656, __pyx_L12_error)
17714 __pyx_v_rstart = __pyx_t_8;
17715
17716 /* "pysam/libchtslib.pyx":655
17717 * rstop = MAX_POS
17718 * if start is not None:
17719 * try: # <<<<<<<<<<<<<<
17720 * rstart = start
17721 * except OverflowError:
17722 */
17723 }
17724 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
17725 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
17726 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
17727 goto __pyx_L17_try_end;
17728 __pyx_L12_error:;
17729 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
17730 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
17731
17732 /* "pysam/libchtslib.pyx":657
17733 * try:
17734 * rstart = start
17735 * except OverflowError: # <<<<<<<<<<<<<<
17736 * raise ValueError('start out of range (%i)' % start)
17737 *
17738 */
17739 __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_OverflowError);
17740 if (__pyx_t_9) {
17741 __Pyx_AddTraceback("pysam.libchtslib.HTSFile.parse_region", __pyx_clineno, __pyx_lineno, __pyx_filename);
17742 if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_2, &__pyx_t_10) < 0) __PYX_ERR(0, 657, __pyx_L14_except_error)
17743 __Pyx_XGOTREF(__pyx_t_4);
17744 __Pyx_XGOTREF(__pyx_t_2);
17745 __Pyx_XGOTREF(__pyx_t_10);
17746
17747 /* "pysam/libchtslib.pyx":658
17748 * rstart = start
17749 * except OverflowError:
17750 * raise ValueError('start out of range (%i)' % start) # <<<<<<<<<<<<<<
17751 *
17752 * if stop is not None:
17753 */
17754 __pyx_t_11 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_start_out_of_range_i, __pyx_v_start); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 658, __pyx_L14_except_error)
17755 __Pyx_GOTREF(__pyx_t_11);
17756 __pyx_t_12 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 658, __pyx_L14_except_error)
17757 __Pyx_GOTREF(__pyx_t_12);
17758 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
17759 __Pyx_Raise(__pyx_t_12, 0, 0, 0);
17760 __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
17761 __PYX_ERR(0, 658, __pyx_L14_except_error)
17762 }
17763 goto __pyx_L14_except_error;
17764
17765 /* "pysam/libchtslib.pyx":655
17766 * rstop = MAX_POS
17767 * if start is not None:
17768 * try: # <<<<<<<<<<<<<<
17769 * rstart = start
17770 * except OverflowError:
17771 */
17772 __pyx_L14_except_error:;
17773 __Pyx_XGIVEREF(__pyx_t_5);
17774 __Pyx_XGIVEREF(__pyx_t_6);
17775 __Pyx_XGIVEREF(__pyx_t_7);
17776 __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7);
17777 goto __pyx_L1_error;
17778 __pyx_L17_try_end:;
17779 }
17780
17781 /* "pysam/libchtslib.pyx":654
17782 * rstart = 0
17783 * rstop = MAX_POS
17784 * if start is not None: # <<<<<<<<<<<<<<
17785 * try:
17786 * rstart = start
17787 */
17788 }
17789
17790 /* "pysam/libchtslib.pyx":660
17791 * raise ValueError('start out of range (%i)' % start)
17792 *
17793 * if stop is not None: # <<<<<<<<<<<<<<
17794 * try:
17795 * rstop = stop
17796 */
17797 __pyx_t_1 = (__pyx_v_stop != Py_None);
17798 if (__pyx_t_1) {
17799
17800 /* "pysam/libchtslib.pyx":661
17801 *
17802 * if stop is not None:
17803 * try: # <<<<<<<<<<<<<<
17804 * rstop = stop
17805 * except OverflowError:
17806 */
17807 {
17808 __Pyx_PyThreadState_declare
17809 __Pyx_PyThreadState_assign
17810 __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_6, &__pyx_t_5);
17811 __Pyx_XGOTREF(__pyx_t_7);
17812 __Pyx_XGOTREF(__pyx_t_6);
17813 __Pyx_XGOTREF(__pyx_t_5);
17814 /*try:*/ {
17815
17816 /* "pysam/libchtslib.pyx":662
17817 * if stop is not None:
17818 * try:
17819 * rstop = stop # <<<<<<<<<<<<<<
17820 * except OverflowError:
17821 * raise ValueError('stop out of range (%i)' % stop)
17822 */
17823 __pyx_t_8 = __Pyx_PyInt_As_int32_t(__pyx_v_stop); if (unlikely((__pyx_t_8 == ((int32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 662, __pyx_L21_error)
17824 __pyx_v_rstop = __pyx_t_8;
17825
17826 /* "pysam/libchtslib.pyx":661
17827 *
17828 * if stop is not None:
17829 * try: # <<<<<<<<<<<<<<
17830 * rstop = stop
17831 * except OverflowError:
17832 */
17833 }
17834 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
17835 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
17836 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
17837 goto __pyx_L26_try_end;
17838 __pyx_L21_error:;
17839 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
17840 __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
17841 __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
17842 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
17843 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
17844
17845 /* "pysam/libchtslib.pyx":663
17846 * try:
17847 * rstop = stop
17848 * except OverflowError: # <<<<<<<<<<<<<<
17849 * raise ValueError('stop out of range (%i)' % stop)
17850 *
17851 */
17852 __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_OverflowError);
17853 if (__pyx_t_9) {
17854 __Pyx_AddTraceback("pysam.libchtslib.HTSFile.parse_region", __pyx_clineno, __pyx_lineno, __pyx_filename);
17855 if (__Pyx_GetException(&__pyx_t_10, &__pyx_t_2, &__pyx_t_4) < 0) __PYX_ERR(0, 663, __pyx_L23_except_error)
17856 __Pyx_XGOTREF(__pyx_t_10);
17857 __Pyx_XGOTREF(__pyx_t_2);
17858 __Pyx_XGOTREF(__pyx_t_4);
17859
17860 /* "pysam/libchtslib.pyx":664
17861 * rstop = stop
17862 * except OverflowError:
17863 * raise ValueError('stop out of range (%i)' % stop) # <<<<<<<<<<<<<<
17864 *
17865 * if region:
17866 */
17867 __pyx_t_12 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_stop_out_of_range_i, __pyx_v_stop); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 664, __pyx_L23_except_error)
17868 __Pyx_GOTREF(__pyx_t_12);
17869 __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_12); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 664, __pyx_L23_except_error)
17870 __Pyx_GOTREF(__pyx_t_11);
17871 __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
17872 __Pyx_Raise(__pyx_t_11, 0, 0, 0);
17873 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
17874 __PYX_ERR(0, 664, __pyx_L23_except_error)
17875 }
17876 goto __pyx_L23_except_error;
17877
17878 /* "pysam/libchtslib.pyx":661
17879 *
17880 * if stop is not None:
17881 * try: # <<<<<<<<<<<<<<
17882 * rstop = stop
17883 * except OverflowError:
17884 */
17885 __pyx_L23_except_error:;
17886 __Pyx_XGIVEREF(__pyx_t_7);
17887 __Pyx_XGIVEREF(__pyx_t_6);
17888 __Pyx_XGIVEREF(__pyx_t_5);
17889 __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_6, __pyx_t_5);
17890 goto __pyx_L1_error;
17891 __pyx_L26_try_end:;
17892 }
17893
17894 /* "pysam/libchtslib.pyx":660
17895 * raise ValueError('start out of range (%i)' % start)
17896 *
17897 * if stop is not None: # <<<<<<<<<<<<<<
17898 * try:
17899 * rstop = stop
17900 */
17901 }
17902
17903 /* "pysam/libchtslib.pyx":666
17904 * raise ValueError('stop out of range (%i)' % stop)
17905 *
17906 * if region: # <<<<<<<<<<<<<<
17907 * region = force_str(region)
17908 * if ":" in region:
17909 */
17910 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_region); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 666, __pyx_L1_error)
17911 if (__pyx_t_1) {
17912
17913 /* "pysam/libchtslib.pyx":667
17914 *
17915 * if region:
17916 * region = force_str(region) # <<<<<<<<<<<<<<
17917 * if ":" in region:
17918 * contig, coord = region.split(":")
17919 */
17920 __pyx_t_4 = __pyx_f_5pysam_9libcutils_force_str(__pyx_v_region, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 667, __pyx_L1_error)
17921 __Pyx_GOTREF(__pyx_t_4);
17922 __Pyx_DECREF_SET(__pyx_v_region, __pyx_t_4);
17923 __pyx_t_4 = 0;
17924
17925 /* "pysam/libchtslib.pyx":668
17926 * if region:
17927 * region = force_str(region)
17928 * if ":" in region: # <<<<<<<<<<<<<<
17929 * contig, coord = region.split(":")
17930 * parts = coord.split("-")
17931 */
17932 __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_kp_u__55, __pyx_v_region, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 668, __pyx_L1_error)
17933 if (__pyx_t_1) {
17934
17935 /* "pysam/libchtslib.pyx":669
17936 * region = force_str(region)
17937 * if ":" in region:
17938 * contig, coord = region.split(":") # <<<<<<<<<<<<<<
17939 * parts = coord.split("-")
17940 * rstart = int(parts[0]) - 1
17941 */
17942 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_region, __pyx_n_s_split); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 669, __pyx_L1_error)
17943 __Pyx_GOTREF(__pyx_t_2);
17944 __pyx_t_10 = NULL;
17945 __pyx_t_13 = 0;
17946 #if CYTHON_UNPACK_METHODS
17947 if (likely(PyMethod_Check(__pyx_t_2))) {
17948 __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_2);
17949 if (likely(__pyx_t_10)) {
17950 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
17951 __Pyx_INCREF(__pyx_t_10);
17952 __Pyx_INCREF(function);
17953 __Pyx_DECREF_SET(__pyx_t_2, function);
17954 __pyx_t_13 = 1;
17955 }
17956 }
17957 #endif
17958 {
17959 PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_kp_u__55};
17960 __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_13, 1+__pyx_t_13);
17961 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
17962 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 669, __pyx_L1_error)
17963 __Pyx_GOTREF(__pyx_t_4);
17964 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
17965 }
17966 if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
17967 PyObject* sequence = __pyx_t_4;
17968 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
17969 if (unlikely(size != 2)) {
17970 if (size > 2) __Pyx_RaiseTooManyValuesError(2);
17971 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
17972 __PYX_ERR(0, 669, __pyx_L1_error)
17973 }
17974 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
17975 if (likely(PyTuple_CheckExact(sequence))) {
17976 __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
17977 __pyx_t_10 = PyTuple_GET_ITEM(sequence, 1);
17978 } else {
17979 __pyx_t_2 = PyList_GET_ITEM(sequence, 0);
17980 __pyx_t_10 = PyList_GET_ITEM(sequence, 1);
17981 }
17982 __Pyx_INCREF(__pyx_t_2);
17983 __Pyx_INCREF(__pyx_t_10);
17984 #else
17985 __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 669, __pyx_L1_error)
17986 __Pyx_GOTREF(__pyx_t_2);
17987 __pyx_t_10 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 669, __pyx_L1_error)
17988 __Pyx_GOTREF(__pyx_t_10);
17989 #endif
17990 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
17991 } else {
17992 Py_ssize_t index = -1;
17993 __pyx_t_11 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 669, __pyx_L1_error)
17994 __Pyx_GOTREF(__pyx_t_11);
17995 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
17996 __pyx_t_14 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_11);
17997 index = 0; __pyx_t_2 = __pyx_t_14(__pyx_t_11); if (unlikely(!__pyx_t_2)) goto __pyx_L31_unpacking_failed;
17998 __Pyx_GOTREF(__pyx_t_2);
17999 index = 1; __pyx_t_10 = __pyx_t_14(__pyx_t_11); if (unlikely(!__pyx_t_10)) goto __pyx_L31_unpacking_failed;
18000 __Pyx_GOTREF(__pyx_t_10);
18001 if (__Pyx_IternextUnpackEndCheck(__pyx_t_14(__pyx_t_11), 2) < 0) __PYX_ERR(0, 669, __pyx_L1_error)
18002 __pyx_t_14 = NULL;
18003 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
18004 goto __pyx_L32_unpacking_done;
18005 __pyx_L31_unpacking_failed:;
18006 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
18007 __pyx_t_14 = NULL;
18008 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
18009 __PYX_ERR(0, 669, __pyx_L1_error)
18010 __pyx_L32_unpacking_done:;
18011 }
18012 __Pyx_DECREF_SET(__pyx_v_contig, __pyx_t_2);
18013 __pyx_t_2 = 0;
18014 __pyx_v_coord = __pyx_t_10;
18015 __pyx_t_10 = 0;
18016
18017 /* "pysam/libchtslib.pyx":670
18018 * if ":" in region:
18019 * contig, coord = region.split(":")
18020 * parts = coord.split("-") # <<<<<<<<<<<<<<
18021 * rstart = int(parts[0]) - 1
18022 * if len(parts) >= 1:
18023 */
18024 __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_coord, __pyx_n_s_split); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 670, __pyx_L1_error)
18025 __Pyx_GOTREF(__pyx_t_10);
18026 __pyx_t_2 = NULL;
18027 __pyx_t_13 = 0;
18028 #if CYTHON_UNPACK_METHODS
18029 if (likely(PyMethod_Check(__pyx_t_10))) {
18030 __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_10);
18031 if (likely(__pyx_t_2)) {
18032 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
18033 __Pyx_INCREF(__pyx_t_2);
18034 __Pyx_INCREF(function);
18035 __Pyx_DECREF_SET(__pyx_t_10, function);
18036 __pyx_t_13 = 1;
18037 }
18038 }
18039 #endif
18040 {
18041 PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_kp_u__56};
18042 __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_10, __pyx_callargs+1-__pyx_t_13, 1+__pyx_t_13);
18043 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
18044 if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 670, __pyx_L1_error)
18045 __Pyx_GOTREF(__pyx_t_4);
18046 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
18047 }
18048 __pyx_v_parts = __pyx_t_4;
18049 __pyx_t_4 = 0;
18050
18051 /* "pysam/libchtslib.pyx":671
18052 * contig, coord = region.split(":")
18053 * parts = coord.split("-")
18054 * rstart = int(parts[0]) - 1 # <<<<<<<<<<<<<<
18055 * if len(parts) >= 1:
18056 * rstop = int(parts[1])
18057 */
18058 __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_parts, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 671, __pyx_L1_error)
18059 __Pyx_GOTREF(__pyx_t_4);
18060 __pyx_t_10 = __Pyx_PyNumber_Int(__pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 671, __pyx_L1_error)
18061 __Pyx_GOTREF(__pyx_t_10);
18062 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
18063 __pyx_t_4 = __Pyx_PyInt_SubtractObjC(__pyx_t_10, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 671, __pyx_L1_error)
18064 __Pyx_GOTREF(__pyx_t_4);
18065 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
18066 __pyx_t_8 = __Pyx_PyInt_As_int32_t(__pyx_t_4); if (unlikely((__pyx_t_8 == ((int32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 671, __pyx_L1_error)
18067 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
18068 __pyx_v_rstart = __pyx_t_8;
18069
18070 /* "pysam/libchtslib.pyx":672
18071 * parts = coord.split("-")
18072 * rstart = int(parts[0]) - 1
18073 * if len(parts) >= 1: # <<<<<<<<<<<<<<
18074 * rstop = int(parts[1])
18075 * else:
18076 */
18077 __pyx_t_15 = PyObject_Length(__pyx_v_parts); if (unlikely(__pyx_t_15 == ((Py_ssize_t)-1))) __PYX_ERR(0, 672, __pyx_L1_error)
18078 __pyx_t_1 = (__pyx_t_15 >= 1);
18079 if (__pyx_t_1) {
18080
18081 /* "pysam/libchtslib.pyx":673
18082 * rstart = int(parts[0]) - 1
18083 * if len(parts) >= 1:
18084 * rstop = int(parts[1]) # <<<<<<<<<<<<<<
18085 * else:
18086 * contig = region
18087 */
18088 __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_parts, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 673, __pyx_L1_error)
18089 __Pyx_GOTREF(__pyx_t_4);
18090 __pyx_t_10 = __Pyx_PyNumber_Int(__pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 673, __pyx_L1_error)
18091 __Pyx_GOTREF(__pyx_t_10);
18092 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
18093 __pyx_t_8 = __Pyx_PyInt_As_int32_t(__pyx_t_10); if (unlikely((__pyx_t_8 == ((int32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 673, __pyx_L1_error)
18094 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
18095 __pyx_v_rstop = __pyx_t_8;
18096
18097 /* "pysam/libchtslib.pyx":672
18098 * parts = coord.split("-")
18099 * rstart = int(parts[0]) - 1
18100 * if len(parts) >= 1: # <<<<<<<<<<<<<<
18101 * rstop = int(parts[1])
18102 * else:
18103 */
18104 }
18105
18106 /* "pysam/libchtslib.pyx":668
18107 * if region:
18108 * region = force_str(region)
18109 * if ":" in region: # <<<<<<<<<<<<<<
18110 * contig, coord = region.split(":")
18111 * parts = coord.split("-")
18112 */
18113 goto __pyx_L30;
18114 }
18115
18116 /* "pysam/libchtslib.pyx":675
18117 * rstop = int(parts[1])
18118 * else:
18119 * contig = region # <<<<<<<<<<<<<<
18120 *
18121 * if tid is not None:
18122 */
18123 /*else*/ {
18124 __Pyx_INCREF(__pyx_v_region);
18125 __Pyx_DECREF_SET(__pyx_v_contig, __pyx_v_region);
18126 }
18127 __pyx_L30:;
18128
18129 /* "pysam/libchtslib.pyx":666
18130 * raise ValueError('stop out of range (%i)' % stop)
18131 *
18132 * if region: # <<<<<<<<<<<<<<
18133 * region = force_str(region)
18134 * if ":" in region:
18135 */
18136 }
18137
18138 /* "pysam/libchtslib.pyx":677
18139 * contig = region
18140 *
18141 * if tid is not None: # <<<<<<<<<<<<<<
18142 * if not self.is_valid_tid(tid):
18143 * raise IndexError('invalid tid')
18144 */
18145 __pyx_t_1 = (__pyx_v_tid != Py_None);
18146 if (__pyx_t_1) {
18147
18148 /* "pysam/libchtslib.pyx":678
18149 *
18150 * if tid is not None:
18151 * if not self.is_valid_tid(tid): # <<<<<<<<<<<<<<
18152 * raise IndexError('invalid tid')
18153 * rtid = tid
18154 */
18155 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_is_valid_tid); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 678, __pyx_L1_error)
18156 __Pyx_GOTREF(__pyx_t_4);
18157 __pyx_t_2 = NULL;
18158 __pyx_t_13 = 0;
18159 #if CYTHON_UNPACK_METHODS
18160 if (likely(PyMethod_Check(__pyx_t_4))) {
18161 __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
18162 if (likely(__pyx_t_2)) {
18163 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
18164 __Pyx_INCREF(__pyx_t_2);
18165 __Pyx_INCREF(function);
18166 __Pyx_DECREF_SET(__pyx_t_4, function);
18167 __pyx_t_13 = 1;
18168 }
18169 }
18170 #endif
18171 {
18172 PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_tid};
18173 __pyx_t_10 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_13, 1+__pyx_t_13);
18174 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
18175 if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 678, __pyx_L1_error)
18176 __Pyx_GOTREF(__pyx_t_10);
18177 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
18178 }
18179 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 678, __pyx_L1_error)
18180 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
18181 __pyx_t_3 = (!__pyx_t_1);
18182 if (unlikely(__pyx_t_3)) {
18183
18184 /* "pysam/libchtslib.pyx":679
18185 * if tid is not None:
18186 * if not self.is_valid_tid(tid):
18187 * raise IndexError('invalid tid') # <<<<<<<<<<<<<<
18188 * rtid = tid
18189 * else:
18190 */
18191 __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_IndexError, __pyx_tuple__57, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 679, __pyx_L1_error)
18192 __Pyx_GOTREF(__pyx_t_10);
18193 __Pyx_Raise(__pyx_t_10, 0, 0, 0);
18194 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
18195 __PYX_ERR(0, 679, __pyx_L1_error)
18196
18197 /* "pysam/libchtslib.pyx":678
18198 *
18199 * if tid is not None:
18200 * if not self.is_valid_tid(tid): # <<<<<<<<<<<<<<
18201 * raise IndexError('invalid tid')
18202 * rtid = tid
18203 */
18204 }
18205
18206 /* "pysam/libchtslib.pyx":680
18207 * if not self.is_valid_tid(tid):
18208 * raise IndexError('invalid tid')
18209 * rtid = tid # <<<<<<<<<<<<<<
18210 * else:
18211 * if contig == "*":
18212 */
18213 __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_v_tid); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 680, __pyx_L1_error)
18214 __pyx_v_rtid = __pyx_t_9;
18215
18216 /* "pysam/libchtslib.pyx":677
18217 * contig = region
18218 *
18219 * if tid is not None: # <<<<<<<<<<<<<<
18220 * if not self.is_valid_tid(tid):
18221 * raise IndexError('invalid tid')
18222 */
18223 goto __pyx_L34;
18224 }
18225
18226 /* "pysam/libchtslib.pyx":682
18227 * rtid = tid
18228 * else:
18229 * if contig == "*": # <<<<<<<<<<<<<<
18230 * rtid = HTS_IDX_NOCOOR
18231 * elif contig == ".":
18232 */
18233 /*else*/ {
18234 __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_v_contig, __pyx_kp_u__58, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 682, __pyx_L1_error)
18235 if (__pyx_t_3) {
18236
18237 /* "pysam/libchtslib.pyx":683
18238 * else:
18239 * if contig == "*":
18240 * rtid = HTS_IDX_NOCOOR # <<<<<<<<<<<<<<
18241 * elif contig == ".":
18242 * rtid = HTS_IDX_START
18243 */
18244 __pyx_v_rtid = HTS_IDX_NOCOOR;
18245
18246 /* "pysam/libchtslib.pyx":682
18247 * rtid = tid
18248 * else:
18249 * if contig == "*": # <<<<<<<<<<<<<<
18250 * rtid = HTS_IDX_NOCOOR
18251 * elif contig == ".":
18252 */
18253 goto __pyx_L36;
18254 }
18255
18256 /* "pysam/libchtslib.pyx":684
18257 * if contig == "*":
18258 * rtid = HTS_IDX_NOCOOR
18259 * elif contig == ".": # <<<<<<<<<<<<<<
18260 * rtid = HTS_IDX_START
18261 * else:
18262 */
18263 __pyx_t_3 = (__Pyx_PyUnicode_Equals(__pyx_v_contig, __pyx_kp_u__59, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 684, __pyx_L1_error)
18264 if (__pyx_t_3) {
18265
18266 /* "pysam/libchtslib.pyx":685
18267 * rtid = HTS_IDX_NOCOOR
18268 * elif contig == ".":
18269 * rtid = HTS_IDX_START # <<<<<<<<<<<<<<
18270 * else:
18271 * rtid = self.get_tid(contig)
18272 */
18273 __pyx_v_rtid = HTS_IDX_START;
18274
18275 /* "pysam/libchtslib.pyx":684
18276 * if contig == "*":
18277 * rtid = HTS_IDX_NOCOOR
18278 * elif contig == ".": # <<<<<<<<<<<<<<
18279 * rtid = HTS_IDX_START
18280 * else:
18281 */
18282 goto __pyx_L36;
18283 }
18284
18285 /* "pysam/libchtslib.pyx":687
18286 * rtid = HTS_IDX_START
18287 * else:
18288 * rtid = self.get_tid(contig) # <<<<<<<<<<<<<<
18289 * if rtid < 0:
18290 * raise ValueError('invalid contig `%s`' % contig)
18291 */
18292 /*else*/ {
18293 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_tid); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 687, __pyx_L1_error)
18294 __Pyx_GOTREF(__pyx_t_4);
18295 __pyx_t_2 = NULL;
18296 __pyx_t_13 = 0;
18297 #if CYTHON_UNPACK_METHODS
18298 if (likely(PyMethod_Check(__pyx_t_4))) {
18299 __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
18300 if (likely(__pyx_t_2)) {
18301 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
18302 __Pyx_INCREF(__pyx_t_2);
18303 __Pyx_INCREF(function);
18304 __Pyx_DECREF_SET(__pyx_t_4, function);
18305 __pyx_t_13 = 1;
18306 }
18307 }
18308 #endif
18309 {
18310 PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_contig};
18311 __pyx_t_10 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_13, 1+__pyx_t_13);
18312 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
18313 if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 687, __pyx_L1_error)
18314 __Pyx_GOTREF(__pyx_t_10);
18315 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
18316 }
18317 __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_10); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 687, __pyx_L1_error)
18318 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
18319 __pyx_v_rtid = __pyx_t_9;
18320
18321 /* "pysam/libchtslib.pyx":688
18322 * else:
18323 * rtid = self.get_tid(contig)
18324 * if rtid < 0: # <<<<<<<<<<<<<<
18325 * raise ValueError('invalid contig `%s`' % contig)
18326 *
18327 */
18328 __pyx_t_3 = (__pyx_v_rtid < 0);
18329 if (unlikely(__pyx_t_3)) {
18330
18331 /* "pysam/libchtslib.pyx":689
18332 * rtid = self.get_tid(contig)
18333 * if rtid < 0:
18334 * raise ValueError('invalid contig `%s`' % contig) # <<<<<<<<<<<<<<
18335 *
18336 * if rstart > rstop:
18337 */
18338 __pyx_t_10 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_invalid_contig_s, __pyx_v_contig); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 689, __pyx_L1_error)
18339 __Pyx_GOTREF(__pyx_t_10);
18340 __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 689, __pyx_L1_error)
18341 __Pyx_GOTREF(__pyx_t_4);
18342 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
18343 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
18344 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
18345 __PYX_ERR(0, 689, __pyx_L1_error)
18346
18347 /* "pysam/libchtslib.pyx":688
18348 * else:
18349 * rtid = self.get_tid(contig)
18350 * if rtid < 0: # <<<<<<<<<<<<<<
18351 * raise ValueError('invalid contig `%s`' % contig)
18352 *
18353 */
18354 }
18355 }
18356 __pyx_L36:;
18357 }
18358 __pyx_L34:;
18359
18360 /* "pysam/libchtslib.pyx":691
18361 * raise ValueError('invalid contig `%s`' % contig)
18362 *
18363 * if rstart > rstop: # <<<<<<<<<<<<<<
18364 * raise ValueError('invalid coordinates: start (%i) > stop (%i)' % (rstart, rstop))
18365 * if not 0 <= rstart < MAX_POS:
18366 */
18367 __pyx_t_3 = (__pyx_v_rstart > __pyx_v_rstop);
18368 if (unlikely(__pyx_t_3)) {
18369
18370 /* "pysam/libchtslib.pyx":692
18371 *
18372 * if rstart > rstop:
18373 * raise ValueError('invalid coordinates: start (%i) > stop (%i)' % (rstart, rstop)) # <<<<<<<<<<<<<<
18374 * if not 0 <= rstart < MAX_POS:
18375 * raise ValueError('start out of range (%i)' % rstart)
18376 */
18377 __pyx_t_4 = __Pyx_PyInt_From_int32_t(__pyx_v_rstart); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 692, __pyx_L1_error)
18378 __Pyx_GOTREF(__pyx_t_4);
18379 __pyx_t_10 = __Pyx_PyInt_From_int32_t(__pyx_v_rstop); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 692, __pyx_L1_error)
18380 __Pyx_GOTREF(__pyx_t_10);
18381 __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 692, __pyx_L1_error)
18382 __Pyx_GOTREF(__pyx_t_2);
18383 __Pyx_GIVEREF(__pyx_t_4);
18384 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4)) __PYX_ERR(0, 692, __pyx_L1_error);
18385 __Pyx_GIVEREF(__pyx_t_10);
18386 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_10)) __PYX_ERR(0, 692, __pyx_L1_error);
18387 __pyx_t_4 = 0;
18388 __pyx_t_10 = 0;
18389 __pyx_t_10 = PyUnicode_Format(__pyx_kp_u_invalid_coordinates_start_i_stop, __pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 692, __pyx_L1_error)
18390 __Pyx_GOTREF(__pyx_t_10);
18391 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18392 __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 692, __pyx_L1_error)
18393 __Pyx_GOTREF(__pyx_t_2);
18394 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
18395 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
18396 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18397 __PYX_ERR(0, 692, __pyx_L1_error)
18398
18399 /* "pysam/libchtslib.pyx":691
18400 * raise ValueError('invalid contig `%s`' % contig)
18401 *
18402 * if rstart > rstop: # <<<<<<<<<<<<<<
18403 * raise ValueError('invalid coordinates: start (%i) > stop (%i)' % (rstart, rstop))
18404 * if not 0 <= rstart < MAX_POS:
18405 */
18406 }
18407
18408 /* "pysam/libchtslib.pyx":693
18409 * if rstart > rstop:
18410 * raise ValueError('invalid coordinates: start (%i) > stop (%i)' % (rstart, rstop))
18411 * if not 0 <= rstart < MAX_POS: # <<<<<<<<<<<<<<
18412 * raise ValueError('start out of range (%i)' % rstart)
18413 * if not 0 <= rstop <= MAX_POS:
18414 */
18415 __pyx_t_3 = (0 <= __pyx_v_rstart);
18416 if (__pyx_t_3) {
18417 __pyx_t_3 = (__pyx_v_rstart < __pyx_v_5pysam_10libchtslib_MAX_POS);
18418 }
18419 __pyx_t_1 = (!__pyx_t_3);
18420 if (unlikely(__pyx_t_1)) {
18421
18422 /* "pysam/libchtslib.pyx":694
18423 * raise ValueError('invalid coordinates: start (%i) > stop (%i)' % (rstart, rstop))
18424 * if not 0 <= rstart < MAX_POS:
18425 * raise ValueError('start out of range (%i)' % rstart) # <<<<<<<<<<<<<<
18426 * if not 0 <= rstop <= MAX_POS:
18427 * raise ValueError('stop out of range (%i)' % rstop)
18428 */
18429 __pyx_t_2 = __Pyx_PyInt_From_int32_t(__pyx_v_rstart); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 694, __pyx_L1_error)
18430 __Pyx_GOTREF(__pyx_t_2);
18431 __pyx_t_10 = PyUnicode_Format(__pyx_kp_u_start_out_of_range_i, __pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 694, __pyx_L1_error)
18432 __Pyx_GOTREF(__pyx_t_10);
18433 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18434 __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 694, __pyx_L1_error)
18435 __Pyx_GOTREF(__pyx_t_2);
18436 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
18437 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
18438 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18439 __PYX_ERR(0, 694, __pyx_L1_error)
18440
18441 /* "pysam/libchtslib.pyx":693
18442 * if rstart > rstop:
18443 * raise ValueError('invalid coordinates: start (%i) > stop (%i)' % (rstart, rstop))
18444 * if not 0 <= rstart < MAX_POS: # <<<<<<<<<<<<<<
18445 * raise ValueError('start out of range (%i)' % rstart)
18446 * if not 0 <= rstop <= MAX_POS:
18447 */
18448 }
18449
18450 /* "pysam/libchtslib.pyx":695
18451 * if not 0 <= rstart < MAX_POS:
18452 * raise ValueError('start out of range (%i)' % rstart)
18453 * if not 0 <= rstop <= MAX_POS: # <<<<<<<<<<<<<<
18454 * raise ValueError('stop out of range (%i)' % rstop)
18455 *
18456 */
18457 __pyx_t_1 = (0 <= __pyx_v_rstop);
18458 if (__pyx_t_1) {
18459 __pyx_t_1 = (__pyx_v_rstop <= __pyx_v_5pysam_10libchtslib_MAX_POS);
18460 }
18461 __pyx_t_3 = (!__pyx_t_1);
18462 if (unlikely(__pyx_t_3)) {
18463
18464 /* "pysam/libchtslib.pyx":696
18465 * raise ValueError('start out of range (%i)' % rstart)
18466 * if not 0 <= rstop <= MAX_POS:
18467 * raise ValueError('stop out of range (%i)' % rstop) # <<<<<<<<<<<<<<
18468 *
18469 * return 1, rtid, rstart, rstop
18470 */
18471 __pyx_t_2 = __Pyx_PyInt_From_int32_t(__pyx_v_rstop); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 696, __pyx_L1_error)
18472 __Pyx_GOTREF(__pyx_t_2);
18473 __pyx_t_10 = PyUnicode_Format(__pyx_kp_u_stop_out_of_range_i, __pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 696, __pyx_L1_error)
18474 __Pyx_GOTREF(__pyx_t_10);
18475 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18476 __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_10); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 696, __pyx_L1_error)
18477 __Pyx_GOTREF(__pyx_t_2);
18478 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
18479 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
18480 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18481 __PYX_ERR(0, 696, __pyx_L1_error)
18482
18483 /* "pysam/libchtslib.pyx":695
18484 * if not 0 <= rstart < MAX_POS:
18485 * raise ValueError('start out of range (%i)' % rstart)
18486 * if not 0 <= rstop <= MAX_POS: # <<<<<<<<<<<<<<
18487 * raise ValueError('stop out of range (%i)' % rstop)
18488 *
18489 */
18490 }
18491
18492 /* "pysam/libchtslib.pyx":698
18493 * raise ValueError('stop out of range (%i)' % rstop)
18494 *
18495 * return 1, rtid, rstart, rstop # <<<<<<<<<<<<<<
18496 *
18497 * def is_valid_tid(self, tid):
18498 */
18499 __Pyx_XDECREF(__pyx_r);
18500 __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_rtid); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 698, __pyx_L1_error)
18501 __Pyx_GOTREF(__pyx_t_2);
18502 __pyx_t_10 = __Pyx_PyInt_From_int32_t(__pyx_v_rstart); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 698, __pyx_L1_error)
18503 __Pyx_GOTREF(__pyx_t_10);
18504 __pyx_t_4 = __Pyx_PyInt_From_int32_t(__pyx_v_rstop); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 698, __pyx_L1_error)
18505 __Pyx_GOTREF(__pyx_t_4);
18506 __pyx_t_11 = PyTuple_New(4); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 698, __pyx_L1_error)
18507 __Pyx_GOTREF(__pyx_t_11);
18508 __Pyx_INCREF(__pyx_int_1);
18509 __Pyx_GIVEREF(__pyx_int_1);
18510 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_int_1)) __PYX_ERR(0, 698, __pyx_L1_error);
18511 __Pyx_GIVEREF(__pyx_t_2);
18512 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_2)) __PYX_ERR(0, 698, __pyx_L1_error);
18513 __Pyx_GIVEREF(__pyx_t_10);
18514 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_t_10)) __PYX_ERR(0, 698, __pyx_L1_error);
18515 __Pyx_GIVEREF(__pyx_t_4);
18516 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 3, __pyx_t_4)) __PYX_ERR(0, 698, __pyx_L1_error);
18517 __pyx_t_2 = 0;
18518 __pyx_t_10 = 0;
18519 __pyx_t_4 = 0;
18520 __pyx_r = __pyx_t_11;
18521 __pyx_t_11 = 0;
18522 goto __pyx_L0;
18523
18524 /* "pysam/libchtslib.pyx":595
18525 * hts_opt_free(opts)
18526 *
18527 * def parse_region(self, contig=None, start=None, stop=None, # <<<<<<<<<<<<<<
18528 * region=None, tid=None,
18529 * reference=None, end=None):
18530 */
18531
18532 /* function exit code */
18533 __pyx_L1_error:;
18534 __Pyx_XDECREF(__pyx_t_2);
18535 __Pyx_XDECREF(__pyx_t_4);
18536 __Pyx_XDECREF(__pyx_t_10);
18537 __Pyx_XDECREF(__pyx_t_11);
18538 __Pyx_XDECREF(__pyx_t_12);
18539 __Pyx_AddTraceback("pysam.libchtslib.HTSFile.parse_region", __pyx_clineno, __pyx_lineno, __pyx_filename);
18540 __pyx_r = NULL;
18541 __pyx_L0:;
18542 __Pyx_XDECREF(__pyx_v_coord);
18543 __Pyx_XDECREF(__pyx_v_parts);
18544 __Pyx_XDECREF(__pyx_v_contig);
18545 __Pyx_XDECREF(__pyx_v_stop);
18546 __Pyx_XDECREF(__pyx_v_region);
18547 __Pyx_XGIVEREF(__pyx_r);
18548 __Pyx_TraceReturn(__pyx_r, 0);
18549 __Pyx_RefNannyFinishContext();
18550 return __pyx_r;
18551 }
18552
18553 /* "pysam/libchtslib.pyx":700
18554 * return 1, rtid, rstart, rstop
18555 *
18556 * def is_valid_tid(self, tid): # <<<<<<<<<<<<<<
18557 * """
18558 * return True if the numerical :term:`tid` is valid; False otherwise.
18559 */
18560
18561 /* Python wrapper */
18562 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_25is_valid_tid(PyObject *__pyx_v_self,
18563 #if CYTHON_METH_FASTCALL
18564 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
18565 #else
18566 PyObject *__pyx_args, PyObject *__pyx_kwds
18567 #endif
18568 ); /*proto*/
18569 PyDoc_STRVAR(__pyx_doc_5pysam_10libchtslib_7HTSFile_24is_valid_tid, "HTSFile.is_valid_tid(self, tid)\n\n return True if the numerical :term:`tid` is valid; False otherwise.\n\n returns -1 if contig is not known.\n ");
18570 static PyMethodDef __pyx_mdef_5pysam_10libchtslib_7HTSFile_25is_valid_tid = {"is_valid_tid", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_7HTSFile_25is_valid_tid, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_7HTSFile_24is_valid_tid};
18571 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_25is_valid_tid(PyObject *__pyx_v_self,
18572 #if CYTHON_METH_FASTCALL
18573 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
18574 #else
18575 PyObject *__pyx_args, PyObject *__pyx_kwds
18576 #endif
18577 ) {
18578 CYTHON_UNUSED PyObject *__pyx_v_tid = 0;
18579 #if !CYTHON_METH_FASTCALL
18580 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
18581 #endif
18582 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
18583 PyObject* values[1] = {0};
18584 int __pyx_lineno = 0;
18585 const char *__pyx_filename = NULL;
18586 int __pyx_clineno = 0;
18587 PyObject *__pyx_r = 0;
18588 __Pyx_RefNannyDeclarations
18589 __Pyx_RefNannySetupContext("is_valid_tid (wrapper)", 0);
18590 #if !CYTHON_METH_FASTCALL
18591 #if CYTHON_ASSUME_SAFE_MACROS
18592 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
18593 #else
18594 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
18595 #endif
18596 #endif
18597 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
18598 {
18599 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tid,0};
18600 if (__pyx_kwds) {
18601 Py_ssize_t kw_args;
18602 switch (__pyx_nargs) {
18603 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
18604 CYTHON_FALLTHROUGH;
18605 case 0: break;
18606 default: goto __pyx_L5_argtuple_error;
18607 }
18608 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
18609 switch (__pyx_nargs) {
18610 case 0:
18611 if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tid)) != 0)) {
18612 (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
18613 kw_args--;
18614 }
18615 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 700, __pyx_L3_error)
18616 else goto __pyx_L5_argtuple_error;
18617 }
18618 if (unlikely(kw_args > 0)) {
18619 const Py_ssize_t kwd_pos_args = __pyx_nargs;
18620 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_valid_tid") < 0)) __PYX_ERR(0, 700, __pyx_L3_error)
18621 }
18622 } else if (unlikely(__pyx_nargs != 1)) {
18623 goto __pyx_L5_argtuple_error;
18624 } else {
18625 values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
18626 }
18627 __pyx_v_tid = values[0];
18628 }
18629 goto __pyx_L6_skip;
18630 __pyx_L5_argtuple_error:;
18631 __Pyx_RaiseArgtupleInvalid("is_valid_tid", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 700, __pyx_L3_error)
18632 __pyx_L6_skip:;
18633 goto __pyx_L4_argument_unpacking_done;
18634 __pyx_L3_error:;
18635 {
18636 Py_ssize_t __pyx_temp;
18637 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
18638 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
18639 }
18640 }
18641 __Pyx_AddTraceback("pysam.libchtslib.HTSFile.is_valid_tid", __pyx_clineno, __pyx_lineno, __pyx_filename);
18642 __Pyx_RefNannyFinishContext();
18643 return NULL;
18644 __pyx_L4_argument_unpacking_done:;
18645 __pyx_r = __pyx_pf_5pysam_10libchtslib_7HTSFile_24is_valid_tid(((struct __pyx_obj_5pysam_10libchtslib_HTSFile *)__pyx_v_self), __pyx_v_tid);
18646
18647 /* function exit code */
18648 {
18649 Py_ssize_t __pyx_temp;
18650 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
18651 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
18652 }
18653 }
18654 __Pyx_RefNannyFinishContext();
18655 return __pyx_r;
18656 }
18657
18658 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_24is_valid_tid(CYTHON_UNUSED struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_tid) {
18659 PyObject *__pyx_r = NULL;
18660 __Pyx_TraceDeclarations
18661 __Pyx_RefNannyDeclarations
18662 PyObject *__pyx_t_1 = NULL;
18663 int __pyx_lineno = 0;
18664 const char *__pyx_filename = NULL;
18665 int __pyx_clineno = 0;
18666 __Pyx_TraceFrameInit(__pyx_codeobj__60)
18667 __Pyx_RefNannySetupContext("is_valid_tid", 1);
18668 __Pyx_TraceCall("is_valid_tid", __pyx_f[0], 700, 0, __PYX_ERR(0, 700, __pyx_L1_error));
18669
18670 /* "pysam/libchtslib.pyx":706
18671 * returns -1 if contig is not known.
18672 * """
18673 * raise NotImplementedError() # <<<<<<<<<<<<<<
18674 *
18675 * def is_valid_reference_name(self, contig):
18676 */
18677 __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_builtin_NotImplementedError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 706, __pyx_L1_error)
18678 __Pyx_GOTREF(__pyx_t_1);
18679 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
18680 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
18681 __PYX_ERR(0, 706, __pyx_L1_error)
18682
18683 /* "pysam/libchtslib.pyx":700
18684 * return 1, rtid, rstart, rstop
18685 *
18686 * def is_valid_tid(self, tid): # <<<<<<<<<<<<<<
18687 * """
18688 * return True if the numerical :term:`tid` is valid; False otherwise.
18689 */
18690
18691 /* function exit code */
18692 __pyx_L1_error:;
18693 __Pyx_XDECREF(__pyx_t_1);
18694 __Pyx_AddTraceback("pysam.libchtslib.HTSFile.is_valid_tid", __pyx_clineno, __pyx_lineno, __pyx_filename);
18695 __pyx_r = NULL;
18696 __Pyx_XGIVEREF(__pyx_r);
18697 __Pyx_TraceReturn(__pyx_r, 0);
18698 __Pyx_RefNannyFinishContext();
18699 return __pyx_r;
18700 }
18701
18702 /* "pysam/libchtslib.pyx":708
18703 * raise NotImplementedError()
18704 *
18705 * def is_valid_reference_name(self, contig): # <<<<<<<<<<<<<<
18706 * """
18707 * return True if the contig name :term:`contig` is valid; False otherwise.
18708 */
18709
18710 /* Python wrapper */
18711 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_27is_valid_reference_name(PyObject *__pyx_v_self,
18712 #if CYTHON_METH_FASTCALL
18713 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
18714 #else
18715 PyObject *__pyx_args, PyObject *__pyx_kwds
18716 #endif
18717 ); /*proto*/
18718 PyDoc_STRVAR(__pyx_doc_5pysam_10libchtslib_7HTSFile_26is_valid_reference_name, "HTSFile.is_valid_reference_name(self, contig)\n\n return True if the contig name :term:`contig` is valid; False otherwise.\n ");
18719 static PyMethodDef __pyx_mdef_5pysam_10libchtslib_7HTSFile_27is_valid_reference_name = {"is_valid_reference_name", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_7HTSFile_27is_valid_reference_name, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_7HTSFile_26is_valid_reference_name};
18720 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_27is_valid_reference_name(PyObject *__pyx_v_self,
18721 #if CYTHON_METH_FASTCALL
18722 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
18723 #else
18724 PyObject *__pyx_args, PyObject *__pyx_kwds
18725 #endif
18726 ) {
18727 PyObject *__pyx_v_contig = 0;
18728 #if !CYTHON_METH_FASTCALL
18729 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
18730 #endif
18731 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
18732 PyObject* values[1] = {0};
18733 int __pyx_lineno = 0;
18734 const char *__pyx_filename = NULL;
18735 int __pyx_clineno = 0;
18736 PyObject *__pyx_r = 0;
18737 __Pyx_RefNannyDeclarations
18738 __Pyx_RefNannySetupContext("is_valid_reference_name (wrapper)", 0);
18739 #if !CYTHON_METH_FASTCALL
18740 #if CYTHON_ASSUME_SAFE_MACROS
18741 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
18742 #else
18743 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
18744 #endif
18745 #endif
18746 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
18747 {
18748 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_contig,0};
18749 if (__pyx_kwds) {
18750 Py_ssize_t kw_args;
18751 switch (__pyx_nargs) {
18752 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
18753 CYTHON_FALLTHROUGH;
18754 case 0: break;
18755 default: goto __pyx_L5_argtuple_error;
18756 }
18757 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
18758 switch (__pyx_nargs) {
18759 case 0:
18760 if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_contig)) != 0)) {
18761 (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
18762 kw_args--;
18763 }
18764 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 708, __pyx_L3_error)
18765 else goto __pyx_L5_argtuple_error;
18766 }
18767 if (unlikely(kw_args > 0)) {
18768 const Py_ssize_t kwd_pos_args = __pyx_nargs;
18769 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "is_valid_reference_name") < 0)) __PYX_ERR(0, 708, __pyx_L3_error)
18770 }
18771 } else if (unlikely(__pyx_nargs != 1)) {
18772 goto __pyx_L5_argtuple_error;
18773 } else {
18774 values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
18775 }
18776 __pyx_v_contig = values[0];
18777 }
18778 goto __pyx_L6_skip;
18779 __pyx_L5_argtuple_error:;
18780 __Pyx_RaiseArgtupleInvalid("is_valid_reference_name", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 708, __pyx_L3_error)
18781 __pyx_L6_skip:;
18782 goto __pyx_L4_argument_unpacking_done;
18783 __pyx_L3_error:;
18784 {
18785 Py_ssize_t __pyx_temp;
18786 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
18787 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
18788 }
18789 }
18790 __Pyx_AddTraceback("pysam.libchtslib.HTSFile.is_valid_reference_name", __pyx_clineno, __pyx_lineno, __pyx_filename);
18791 __Pyx_RefNannyFinishContext();
18792 return NULL;
18793 __pyx_L4_argument_unpacking_done:;
18794 __pyx_r = __pyx_pf_5pysam_10libchtslib_7HTSFile_26is_valid_reference_name(((struct __pyx_obj_5pysam_10libchtslib_HTSFile *)__pyx_v_self), __pyx_v_contig);
18795
18796 /* function exit code */
18797 {
18798 Py_ssize_t __pyx_temp;
18799 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
18800 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
18801 }
18802 }
18803 __Pyx_RefNannyFinishContext();
18804 return __pyx_r;
18805 }
18806
18807 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_26is_valid_reference_name(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self, PyObject *__pyx_v_contig) {
18808 PyObject *__pyx_r = NULL;
18809 __Pyx_TraceDeclarations
18810 __Pyx_RefNannyDeclarations
18811 PyObject *__pyx_t_1 = NULL;
18812 PyObject *__pyx_t_2 = NULL;
18813 PyObject *__pyx_t_3 = NULL;
18814 unsigned int __pyx_t_4;
18815 int __pyx_lineno = 0;
18816 const char *__pyx_filename = NULL;
18817 int __pyx_clineno = 0;
18818 __Pyx_TraceFrameInit(__pyx_codeobj__61)
18819 __Pyx_RefNannySetupContext("is_valid_reference_name", 1);
18820 __Pyx_TraceCall("is_valid_reference_name", __pyx_f[0], 708, 0, __PYX_ERR(0, 708, __pyx_L1_error));
18821
18822 /* "pysam/libchtslib.pyx":712
18823 * return True if the contig name :term:`contig` is valid; False otherwise.
18824 * """
18825 * return self.get_tid(contig) != -1 # <<<<<<<<<<<<<<
18826 *
18827 * def get_tid(self, contig):
18828 */
18829 __Pyx_XDECREF(__pyx_r);
18830 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_tid); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 712, __pyx_L1_error)
18831 __Pyx_GOTREF(__pyx_t_2);
18832 __pyx_t_3 = NULL;
18833 __pyx_t_4 = 0;
18834 #if CYTHON_UNPACK_METHODS
18835 if (likely(PyMethod_Check(__pyx_t_2))) {
18836 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
18837 if (likely(__pyx_t_3)) {
18838 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
18839 __Pyx_INCREF(__pyx_t_3);
18840 __Pyx_INCREF(function);
18841 __Pyx_DECREF_SET(__pyx_t_2, function);
18842 __pyx_t_4 = 1;
18843 }
18844 }
18845 #endif
18846 {
18847 PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_contig};
18848 __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
18849 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
18850 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 712, __pyx_L1_error)
18851 __Pyx_GOTREF(__pyx_t_1);
18852 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18853 }
18854 __pyx_t_2 = __Pyx_PyInt_NeObjC(__pyx_t_1, __pyx_int_neg_1, -1L, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 712, __pyx_L1_error)
18855 __Pyx_GOTREF(__pyx_t_2);
18856 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
18857 __pyx_r = __pyx_t_2;
18858 __pyx_t_2 = 0;
18859 goto __pyx_L0;
18860
18861 /* "pysam/libchtslib.pyx":708
18862 * raise NotImplementedError()
18863 *
18864 * def is_valid_reference_name(self, contig): # <<<<<<<<<<<<<<
18865 * """
18866 * return True if the contig name :term:`contig` is valid; False otherwise.
18867 */
18868
18869 /* function exit code */
18870 __pyx_L1_error:;
18871 __Pyx_XDECREF(__pyx_t_1);
18872 __Pyx_XDECREF(__pyx_t_2);
18873 __Pyx_XDECREF(__pyx_t_3);
18874 __Pyx_AddTraceback("pysam.libchtslib.HTSFile.is_valid_reference_name", __pyx_clineno, __pyx_lineno, __pyx_filename);
18875 __pyx_r = NULL;
18876 __pyx_L0:;
18877 __Pyx_XGIVEREF(__pyx_r);
18878 __Pyx_TraceReturn(__pyx_r, 0);
18879 __Pyx_RefNannyFinishContext();
18880 return __pyx_r;
18881 }
18882
18883 /* "pysam/libchtslib.pyx":714
18884 * return self.get_tid(contig) != -1
18885 *
18886 * def get_tid(self, contig): # <<<<<<<<<<<<<<
18887 * """
18888 * return the numerical :term:`tid` corresponding to
18889 */
18890
18891 /* Python wrapper */
18892 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_29get_tid(PyObject *__pyx_v_self,
18893 #if CYTHON_METH_FASTCALL
18894 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
18895 #else
18896 PyObject *__pyx_args, PyObject *__pyx_kwds
18897 #endif
18898 ); /*proto*/
18899 PyDoc_STRVAR(__pyx_doc_5pysam_10libchtslib_7HTSFile_28get_tid, "HTSFile.get_tid(self, contig)\n\n return the numerical :term:`tid` corresponding to\n :term:`contig`\n\n returns -1 if contig is not known.\n ");
18900 static PyMethodDef __pyx_mdef_5pysam_10libchtslib_7HTSFile_29get_tid = {"get_tid", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_7HTSFile_29get_tid, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_7HTSFile_28get_tid};
18901 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_29get_tid(PyObject *__pyx_v_self,
18902 #if CYTHON_METH_FASTCALL
18903 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
18904 #else
18905 PyObject *__pyx_args, PyObject *__pyx_kwds
18906 #endif
18907 ) {
18908 CYTHON_UNUSED PyObject *__pyx_v_contig = 0;
18909 #if !CYTHON_METH_FASTCALL
18910 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
18911 #endif
18912 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
18913 PyObject* values[1] = {0};
18914 int __pyx_lineno = 0;
18915 const char *__pyx_filename = NULL;
18916 int __pyx_clineno = 0;
18917 PyObject *__pyx_r = 0;
18918 __Pyx_RefNannyDeclarations
18919 __Pyx_RefNannySetupContext("get_tid (wrapper)", 0);
18920 #if !CYTHON_METH_FASTCALL
18921 #if CYTHON_ASSUME_SAFE_MACROS
18922 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
18923 #else
18924 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
18925 #endif
18926 #endif
18927 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
18928 {
18929 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_contig,0};
18930 if (__pyx_kwds) {
18931 Py_ssize_t kw_args;
18932 switch (__pyx_nargs) {
18933 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
18934 CYTHON_FALLTHROUGH;
18935 case 0: break;
18936 default: goto __pyx_L5_argtuple_error;
18937 }
18938 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
18939 switch (__pyx_nargs) {
18940 case 0:
18941 if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_contig)) != 0)) {
18942 (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
18943 kw_args--;
18944 }
18945 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 714, __pyx_L3_error)
18946 else goto __pyx_L5_argtuple_error;
18947 }
18948 if (unlikely(kw_args > 0)) {
18949 const Py_ssize_t kwd_pos_args = __pyx_nargs;
18950 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "get_tid") < 0)) __PYX_ERR(0, 714, __pyx_L3_error)
18951 }
18952 } else if (unlikely(__pyx_nargs != 1)) {
18953 goto __pyx_L5_argtuple_error;
18954 } else {
18955 values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
18956 }
18957 __pyx_v_contig = values[0];
18958 }
18959 goto __pyx_L6_skip;
18960 __pyx_L5_argtuple_error:;
18961 __Pyx_RaiseArgtupleInvalid("get_tid", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 714, __pyx_L3_error)
18962 __pyx_L6_skip:;
18963 goto __pyx_L4_argument_unpacking_done;
18964 __pyx_L3_error:;
18965 {
18966 Py_ssize_t __pyx_temp;
18967 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
18968 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
18969 }
18970 }
18971 __Pyx_AddTraceback("pysam.libchtslib.HTSFile.get_tid", __pyx_clineno, __pyx_lineno, __pyx_filename);
18972 __Pyx_RefNannyFinishContext();
18973 return NULL;
18974 __pyx_L4_argument_unpacking_done:;
18975 __pyx_r = __pyx_pf_5pysam_10libchtslib_7HTSFile_28get_tid(((struct __pyx_obj_5pysam_10libchtslib_HTSFile *)__pyx_v_self), __pyx_v_contig);
18976
18977 /* function exit code */
18978 {
18979 Py_ssize_t __pyx_temp;
18980 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
18981 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
18982 }
18983 }
18984 __Pyx_RefNannyFinishContext();
18985 return __pyx_r;
18986 }
18987
18988 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_28get_tid(CYTHON_UNUSED struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_contig) {
18989 PyObject *__pyx_r = NULL;
18990 __Pyx_TraceDeclarations
18991 __Pyx_RefNannyDeclarations
18992 PyObject *__pyx_t_1 = NULL;
18993 int __pyx_lineno = 0;
18994 const char *__pyx_filename = NULL;
18995 int __pyx_clineno = 0;
18996 __Pyx_TraceFrameInit(__pyx_codeobj__62)
18997 __Pyx_RefNannySetupContext("get_tid", 1);
18998 __Pyx_TraceCall("get_tid", __pyx_f[0], 714, 0, __PYX_ERR(0, 714, __pyx_L1_error));
18999
19000 /* "pysam/libchtslib.pyx":721
19001 * returns -1 if contig is not known.
19002 * """
19003 * raise NotImplementedError() # <<<<<<<<<<<<<<
19004 *
19005 * def get_reference_name(self, tid):
19006 */
19007 __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_builtin_NotImplementedError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 721, __pyx_L1_error)
19008 __Pyx_GOTREF(__pyx_t_1);
19009 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
19010 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
19011 __PYX_ERR(0, 721, __pyx_L1_error)
19012
19013 /* "pysam/libchtslib.pyx":714
19014 * return self.get_tid(contig) != -1
19015 *
19016 * def get_tid(self, contig): # <<<<<<<<<<<<<<
19017 * """
19018 * return the numerical :term:`tid` corresponding to
19019 */
19020
19021 /* function exit code */
19022 __pyx_L1_error:;
19023 __Pyx_XDECREF(__pyx_t_1);
19024 __Pyx_AddTraceback("pysam.libchtslib.HTSFile.get_tid", __pyx_clineno, __pyx_lineno, __pyx_filename);
19025 __pyx_r = NULL;
19026 __Pyx_XGIVEREF(__pyx_r);
19027 __Pyx_TraceReturn(__pyx_r, 0);
19028 __Pyx_RefNannyFinishContext();
19029 return __pyx_r;
19030 }
19031
19032 /* "pysam/libchtslib.pyx":723
19033 * raise NotImplementedError()
19034 *
19035 * def get_reference_name(self, tid): # <<<<<<<<<<<<<<
19036 * """
19037 * return :term:`contig` name corresponding to numerical :term:`tid`
19038 */
19039
19040 /* Python wrapper */
19041 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_31get_reference_name(PyObject *__pyx_v_self,
19042 #if CYTHON_METH_FASTCALL
19043 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
19044 #else
19045 PyObject *__pyx_args, PyObject *__pyx_kwds
19046 #endif
19047 ); /*proto*/
19048 PyDoc_STRVAR(__pyx_doc_5pysam_10libchtslib_7HTSFile_30get_reference_name, "HTSFile.get_reference_name(self, tid)\n\n return :term:`contig` name corresponding to numerical :term:`tid`\n ");
19049 static PyMethodDef __pyx_mdef_5pysam_10libchtslib_7HTSFile_31get_reference_name = {"get_reference_name", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_7HTSFile_31get_reference_name, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_7HTSFile_30get_reference_name};
19050 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_31get_reference_name(PyObject *__pyx_v_self,
19051 #if CYTHON_METH_FASTCALL
19052 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
19053 #else
19054 PyObject *__pyx_args, PyObject *__pyx_kwds
19055 #endif
19056 ) {
19057 CYTHON_UNUSED PyObject *__pyx_v_tid = 0;
19058 #if !CYTHON_METH_FASTCALL
19059 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
19060 #endif
19061 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
19062 PyObject* values[1] = {0};
19063 int __pyx_lineno = 0;
19064 const char *__pyx_filename = NULL;
19065 int __pyx_clineno = 0;
19066 PyObject *__pyx_r = 0;
19067 __Pyx_RefNannyDeclarations
19068 __Pyx_RefNannySetupContext("get_reference_name (wrapper)", 0);
19069 #if !CYTHON_METH_FASTCALL
19070 #if CYTHON_ASSUME_SAFE_MACROS
19071 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
19072 #else
19073 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
19074 #endif
19075 #endif
19076 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
19077 {
19078 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_tid,0};
19079 if (__pyx_kwds) {
19080 Py_ssize_t kw_args;
19081 switch (__pyx_nargs) {
19082 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
19083 CYTHON_FALLTHROUGH;
19084 case 0: break;
19085 default: goto __pyx_L5_argtuple_error;
19086 }
19087 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
19088 switch (__pyx_nargs) {
19089 case 0:
19090 if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_tid)) != 0)) {
19091 (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
19092 kw_args--;
19093 }
19094 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 723, __pyx_L3_error)
19095 else goto __pyx_L5_argtuple_error;
19096 }
19097 if (unlikely(kw_args > 0)) {
19098 const Py_ssize_t kwd_pos_args = __pyx_nargs;
19099 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "get_reference_name") < 0)) __PYX_ERR(0, 723, __pyx_L3_error)
19100 }
19101 } else if (unlikely(__pyx_nargs != 1)) {
19102 goto __pyx_L5_argtuple_error;
19103 } else {
19104 values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
19105 }
19106 __pyx_v_tid = values[0];
19107 }
19108 goto __pyx_L6_skip;
19109 __pyx_L5_argtuple_error:;
19110 __Pyx_RaiseArgtupleInvalid("get_reference_name", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 723, __pyx_L3_error)
19111 __pyx_L6_skip:;
19112 goto __pyx_L4_argument_unpacking_done;
19113 __pyx_L3_error:;
19114 {
19115 Py_ssize_t __pyx_temp;
19116 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
19117 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
19118 }
19119 }
19120 __Pyx_AddTraceback("pysam.libchtslib.HTSFile.get_reference_name", __pyx_clineno, __pyx_lineno, __pyx_filename);
19121 __Pyx_RefNannyFinishContext();
19122 return NULL;
19123 __pyx_L4_argument_unpacking_done:;
19124 __pyx_r = __pyx_pf_5pysam_10libchtslib_7HTSFile_30get_reference_name(((struct __pyx_obj_5pysam_10libchtslib_HTSFile *)__pyx_v_self), __pyx_v_tid);
19125
19126 /* function exit code */
19127 {
19128 Py_ssize_t __pyx_temp;
19129 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
19130 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
19131 }
19132 }
19133 __Pyx_RefNannyFinishContext();
19134 return __pyx_r;
19135 }
19136
19137 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_30get_reference_name(CYTHON_UNUSED struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_tid) {
19138 PyObject *__pyx_r = NULL;
19139 __Pyx_TraceDeclarations
19140 __Pyx_RefNannyDeclarations
19141 PyObject *__pyx_t_1 = NULL;
19142 int __pyx_lineno = 0;
19143 const char *__pyx_filename = NULL;
19144 int __pyx_clineno = 0;
19145 __Pyx_TraceFrameInit(__pyx_codeobj__63)
19146 __Pyx_RefNannySetupContext("get_reference_name", 1);
19147 __Pyx_TraceCall("get_reference_name", __pyx_f[0], 723, 0, __PYX_ERR(0, 723, __pyx_L1_error));
19148
19149 /* "pysam/libchtslib.pyx":727
19150 * return :term:`contig` name corresponding to numerical :term:`tid`
19151 * """
19152 * raise NotImplementedError() # <<<<<<<<<<<<<<
19153 */
19154 __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_builtin_NotImplementedError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 727, __pyx_L1_error)
19155 __Pyx_GOTREF(__pyx_t_1);
19156 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
19157 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
19158 __PYX_ERR(0, 727, __pyx_L1_error)
19159
19160 /* "pysam/libchtslib.pyx":723
19161 * raise NotImplementedError()
19162 *
19163 * def get_reference_name(self, tid): # <<<<<<<<<<<<<<
19164 * """
19165 * return :term:`contig` name corresponding to numerical :term:`tid`
19166 */
19167
19168 /* function exit code */
19169 __pyx_L1_error:;
19170 __Pyx_XDECREF(__pyx_t_1);
19171 __Pyx_AddTraceback("pysam.libchtslib.HTSFile.get_reference_name", __pyx_clineno, __pyx_lineno, __pyx_filename);
19172 __pyx_r = NULL;
19173 __Pyx_XGIVEREF(__pyx_r);
19174 __Pyx_TraceReturn(__pyx_r, 0);
19175 __Pyx_RefNannyFinishContext();
19176 return __pyx_r;
19177 }
19178
19179 /* "pysam/libchtslib.pxd":2710
19180 * cdef int64_t start_offset # BGZF offset of first record
19181 *
19182 * cdef readonly object filename # filename as supplied by user # <<<<<<<<<<<<<<
19183 * cdef readonly object mode # file opening mode
19184 * cdef readonly object threads # number of threads to use
19185 */
19186
19187 /* Python wrapper */
19188 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_8filename_1__get__(PyObject *__pyx_v_self); /*proto*/
19189 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_8filename_1__get__(PyObject *__pyx_v_self) {
19190 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
19191 PyObject *__pyx_r = 0;
19192 __Pyx_RefNannyDeclarations
19193 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
19194 __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
19195 __pyx_r = __pyx_pf_5pysam_10libchtslib_7HTSFile_8filename___get__(((struct __pyx_obj_5pysam_10libchtslib_HTSFile *)__pyx_v_self));
19196
19197 /* function exit code */
19198 __Pyx_RefNannyFinishContext();
19199 return __pyx_r;
19200 }
19201
19202 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_8filename___get__(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self) {
19203 PyObject *__pyx_r = NULL;
19204 __Pyx_TraceDeclarations
19205 __Pyx_RefNannyDeclarations
19206 int __pyx_lineno = 0;
19207 const char *__pyx_filename = NULL;
19208 int __pyx_clineno = 0;
19209 __Pyx_RefNannySetupContext("__get__", 1);
19210 __Pyx_TraceCall("__get__", __pyx_f[4], 2710, 0, __PYX_ERR(4, 2710, __pyx_L1_error));
19211 __Pyx_XDECREF(__pyx_r);
19212 __Pyx_INCREF(__pyx_v_self->filename);
19213 __pyx_r = __pyx_v_self->filename;
19214 goto __pyx_L0;
19215
19216 /* function exit code */
19217 __pyx_L1_error:;
19218 __Pyx_AddTraceback("pysam.libchtslib.HTSFile.filename.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
19219 __pyx_r = NULL;
19220 __pyx_L0:;
19221 __Pyx_XGIVEREF(__pyx_r);
19222 __Pyx_TraceReturn(__pyx_r, 0);
19223 __Pyx_RefNannyFinishContext();
19224 return __pyx_r;
19225 }
19226
19227 /* "pysam/libchtslib.pxd":2711
19228 *
19229 * cdef readonly object filename # filename as supplied by user
19230 * cdef readonly object mode # file opening mode # <<<<<<<<<<<<<<
19231 * cdef readonly object threads # number of threads to use
19232 * cdef readonly object index_filename # filename of index, if supplied by user
19233 */
19234
19235 /* Python wrapper */
19236 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_4mode_1__get__(PyObject *__pyx_v_self); /*proto*/
19237 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_4mode_1__get__(PyObject *__pyx_v_self) {
19238 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
19239 PyObject *__pyx_r = 0;
19240 __Pyx_RefNannyDeclarations
19241 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
19242 __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
19243 __pyx_r = __pyx_pf_5pysam_10libchtslib_7HTSFile_4mode___get__(((struct __pyx_obj_5pysam_10libchtslib_HTSFile *)__pyx_v_self));
19244
19245 /* function exit code */
19246 __Pyx_RefNannyFinishContext();
19247 return __pyx_r;
19248 }
19249
19250 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_4mode___get__(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self) {
19251 PyObject *__pyx_r = NULL;
19252 __Pyx_TraceDeclarations
19253 __Pyx_RefNannyDeclarations
19254 int __pyx_lineno = 0;
19255 const char *__pyx_filename = NULL;
19256 int __pyx_clineno = 0;
19257 __Pyx_RefNannySetupContext("__get__", 1);
19258 __Pyx_TraceCall("__get__", __pyx_f[4], 2711, 0, __PYX_ERR(4, 2711, __pyx_L1_error));
19259 __Pyx_XDECREF(__pyx_r);
19260 __Pyx_INCREF(__pyx_v_self->mode);
19261 __pyx_r = __pyx_v_self->mode;
19262 goto __pyx_L0;
19263
19264 /* function exit code */
19265 __pyx_L1_error:;
19266 __Pyx_AddTraceback("pysam.libchtslib.HTSFile.mode.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
19267 __pyx_r = NULL;
19268 __pyx_L0:;
19269 __Pyx_XGIVEREF(__pyx_r);
19270 __Pyx_TraceReturn(__pyx_r, 0);
19271 __Pyx_RefNannyFinishContext();
19272 return __pyx_r;
19273 }
19274
19275 /* "pysam/libchtslib.pxd":2712
19276 * cdef readonly object filename # filename as supplied by user
19277 * cdef readonly object mode # file opening mode
19278 * cdef readonly object threads # number of threads to use # <<<<<<<<<<<<<<
19279 * cdef readonly object index_filename # filename of index, if supplied by user
19280 *
19281 */
19282
19283 /* Python wrapper */
19284 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_7threads_1__get__(PyObject *__pyx_v_self); /*proto*/
19285 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_7threads_1__get__(PyObject *__pyx_v_self) {
19286 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
19287 PyObject *__pyx_r = 0;
19288 __Pyx_RefNannyDeclarations
19289 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
19290 __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
19291 __pyx_r = __pyx_pf_5pysam_10libchtslib_7HTSFile_7threads___get__(((struct __pyx_obj_5pysam_10libchtslib_HTSFile *)__pyx_v_self));
19292
19293 /* function exit code */
19294 __Pyx_RefNannyFinishContext();
19295 return __pyx_r;
19296 }
19297
19298 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_7threads___get__(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self) {
19299 PyObject *__pyx_r = NULL;
19300 __Pyx_TraceDeclarations
19301 __Pyx_RefNannyDeclarations
19302 int __pyx_lineno = 0;
19303 const char *__pyx_filename = NULL;
19304 int __pyx_clineno = 0;
19305 __Pyx_RefNannySetupContext("__get__", 1);
19306 __Pyx_TraceCall("__get__", __pyx_f[4], 2712, 0, __PYX_ERR(4, 2712, __pyx_L1_error));
19307 __Pyx_XDECREF(__pyx_r);
19308 __Pyx_INCREF(__pyx_v_self->threads);
19309 __pyx_r = __pyx_v_self->threads;
19310 goto __pyx_L0;
19311
19312 /* function exit code */
19313 __pyx_L1_error:;
19314 __Pyx_AddTraceback("pysam.libchtslib.HTSFile.threads.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
19315 __pyx_r = NULL;
19316 __pyx_L0:;
19317 __Pyx_XGIVEREF(__pyx_r);
19318 __Pyx_TraceReturn(__pyx_r, 0);
19319 __Pyx_RefNannyFinishContext();
19320 return __pyx_r;
19321 }
19322
19323 /* "pysam/libchtslib.pxd":2713
19324 * cdef readonly object mode # file opening mode
19325 * cdef readonly object threads # number of threads to use
19326 * cdef readonly object index_filename # filename of index, if supplied by user # <<<<<<<<<<<<<<
19327 *
19328 * cdef readonly bint is_stream # Is htsfile a non-seekable stream
19329 */
19330
19331 /* Python wrapper */
19332 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_14index_filename_1__get__(PyObject *__pyx_v_self); /*proto*/
19333 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_14index_filename_1__get__(PyObject *__pyx_v_self) {
19334 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
19335 PyObject *__pyx_r = 0;
19336 __Pyx_RefNannyDeclarations
19337 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
19338 __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
19339 __pyx_r = __pyx_pf_5pysam_10libchtslib_7HTSFile_14index_filename___get__(((struct __pyx_obj_5pysam_10libchtslib_HTSFile *)__pyx_v_self));
19340
19341 /* function exit code */
19342 __Pyx_RefNannyFinishContext();
19343 return __pyx_r;
19344 }
19345
19346 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_14index_filename___get__(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self) {
19347 PyObject *__pyx_r = NULL;
19348 __Pyx_TraceDeclarations
19349 __Pyx_RefNannyDeclarations
19350 int __pyx_lineno = 0;
19351 const char *__pyx_filename = NULL;
19352 int __pyx_clineno = 0;
19353 __Pyx_RefNannySetupContext("__get__", 1);
19354 __Pyx_TraceCall("__get__", __pyx_f[4], 2713, 0, __PYX_ERR(4, 2713, __pyx_L1_error));
19355 __Pyx_XDECREF(__pyx_r);
19356 __Pyx_INCREF(__pyx_v_self->index_filename);
19357 __pyx_r = __pyx_v_self->index_filename;
19358 goto __pyx_L0;
19359
19360 /* function exit code */
19361 __pyx_L1_error:;
19362 __Pyx_AddTraceback("pysam.libchtslib.HTSFile.index_filename.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
19363 __pyx_r = NULL;
19364 __pyx_L0:;
19365 __Pyx_XGIVEREF(__pyx_r);
19366 __Pyx_TraceReturn(__pyx_r, 0);
19367 __Pyx_RefNannyFinishContext();
19368 return __pyx_r;
19369 }
19370
19371 /* "pysam/libchtslib.pxd":2715
19372 * cdef readonly object index_filename # filename of index, if supplied by user
19373 *
19374 * cdef readonly bint is_stream # Is htsfile a non-seekable stream # <<<<<<<<<<<<<<
19375 * cdef readonly bint is_remote # Is htsfile a remote stream
19376 * cdef readonly bint duplicate_filehandle # Duplicate filehandle when opening via fh
19377 */
19378
19379 /* Python wrapper */
19380 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_9is_stream_1__get__(PyObject *__pyx_v_self); /*proto*/
19381 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_9is_stream_1__get__(PyObject *__pyx_v_self) {
19382 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
19383 PyObject *__pyx_r = 0;
19384 __Pyx_RefNannyDeclarations
19385 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
19386 __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
19387 __pyx_r = __pyx_pf_5pysam_10libchtslib_7HTSFile_9is_stream___get__(((struct __pyx_obj_5pysam_10libchtslib_HTSFile *)__pyx_v_self));
19388
19389 /* function exit code */
19390 __Pyx_RefNannyFinishContext();
19391 return __pyx_r;
19392 }
19393
19394 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_9is_stream___get__(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self) {
19395 PyObject *__pyx_r = NULL;
19396 __Pyx_TraceDeclarations
19397 __Pyx_RefNannyDeclarations
19398 PyObject *__pyx_t_1 = NULL;
19399 int __pyx_lineno = 0;
19400 const char *__pyx_filename = NULL;
19401 int __pyx_clineno = 0;
19402 __Pyx_RefNannySetupContext("__get__", 1);
19403 __Pyx_TraceCall("__get__", __pyx_f[4], 2715, 0, __PYX_ERR(4, 2715, __pyx_L1_error));
19404 __Pyx_XDECREF(__pyx_r);
19405 __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->is_stream); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2715, __pyx_L1_error)
19406 __Pyx_GOTREF(__pyx_t_1);
19407 __pyx_r = __pyx_t_1;
19408 __pyx_t_1 = 0;
19409 goto __pyx_L0;
19410
19411 /* function exit code */
19412 __pyx_L1_error:;
19413 __Pyx_XDECREF(__pyx_t_1);
19414 __Pyx_AddTraceback("pysam.libchtslib.HTSFile.is_stream.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
19415 __pyx_r = NULL;
19416 __pyx_L0:;
19417 __Pyx_XGIVEREF(__pyx_r);
19418 __Pyx_TraceReturn(__pyx_r, 0);
19419 __Pyx_RefNannyFinishContext();
19420 return __pyx_r;
19421 }
19422
19423 /* "pysam/libchtslib.pxd":2716
19424 *
19425 * cdef readonly bint is_stream # Is htsfile a non-seekable stream
19426 * cdef readonly bint is_remote # Is htsfile a remote stream # <<<<<<<<<<<<<<
19427 * cdef readonly bint duplicate_filehandle # Duplicate filehandle when opening via fh
19428 *
19429 */
19430
19431 /* Python wrapper */
19432 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_9is_remote_1__get__(PyObject *__pyx_v_self); /*proto*/
19433 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_9is_remote_1__get__(PyObject *__pyx_v_self) {
19434 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
19435 PyObject *__pyx_r = 0;
19436 __Pyx_RefNannyDeclarations
19437 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
19438 __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
19439 __pyx_r = __pyx_pf_5pysam_10libchtslib_7HTSFile_9is_remote___get__(((struct __pyx_obj_5pysam_10libchtslib_HTSFile *)__pyx_v_self));
19440
19441 /* function exit code */
19442 __Pyx_RefNannyFinishContext();
19443 return __pyx_r;
19444 }
19445
19446 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_9is_remote___get__(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self) {
19447 PyObject *__pyx_r = NULL;
19448 __Pyx_TraceDeclarations
19449 __Pyx_RefNannyDeclarations
19450 PyObject *__pyx_t_1 = NULL;
19451 int __pyx_lineno = 0;
19452 const char *__pyx_filename = NULL;
19453 int __pyx_clineno = 0;
19454 __Pyx_RefNannySetupContext("__get__", 1);
19455 __Pyx_TraceCall("__get__", __pyx_f[4], 2716, 0, __PYX_ERR(4, 2716, __pyx_L1_error));
19456 __Pyx_XDECREF(__pyx_r);
19457 __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->is_remote); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2716, __pyx_L1_error)
19458 __Pyx_GOTREF(__pyx_t_1);
19459 __pyx_r = __pyx_t_1;
19460 __pyx_t_1 = 0;
19461 goto __pyx_L0;
19462
19463 /* function exit code */
19464 __pyx_L1_error:;
19465 __Pyx_XDECREF(__pyx_t_1);
19466 __Pyx_AddTraceback("pysam.libchtslib.HTSFile.is_remote.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
19467 __pyx_r = NULL;
19468 __pyx_L0:;
19469 __Pyx_XGIVEREF(__pyx_r);
19470 __Pyx_TraceReturn(__pyx_r, 0);
19471 __Pyx_RefNannyFinishContext();
19472 return __pyx_r;
19473 }
19474
19475 /* "pysam/libchtslib.pxd":2717
19476 * cdef readonly bint is_stream # Is htsfile a non-seekable stream
19477 * cdef readonly bint is_remote # Is htsfile a remote stream
19478 * cdef readonly bint duplicate_filehandle # Duplicate filehandle when opening via fh # <<<<<<<<<<<<<<
19479 *
19480 * cdef htsFile *_open_htsfile(self) except? NULL
19481 */
19482
19483 /* Python wrapper */
19484 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_20duplicate_filehandle_1__get__(PyObject *__pyx_v_self); /*proto*/
19485 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_20duplicate_filehandle_1__get__(PyObject *__pyx_v_self) {
19486 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
19487 PyObject *__pyx_r = 0;
19488 __Pyx_RefNannyDeclarations
19489 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
19490 __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
19491 __pyx_r = __pyx_pf_5pysam_10libchtslib_7HTSFile_20duplicate_filehandle___get__(((struct __pyx_obj_5pysam_10libchtslib_HTSFile *)__pyx_v_self));
19492
19493 /* function exit code */
19494 __Pyx_RefNannyFinishContext();
19495 return __pyx_r;
19496 }
19497
19498 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_20duplicate_filehandle___get__(struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self) {
19499 PyObject *__pyx_r = NULL;
19500 __Pyx_TraceDeclarations
19501 __Pyx_RefNannyDeclarations
19502 PyObject *__pyx_t_1 = NULL;
19503 int __pyx_lineno = 0;
19504 const char *__pyx_filename = NULL;
19505 int __pyx_clineno = 0;
19506 __Pyx_RefNannySetupContext("__get__", 1);
19507 __Pyx_TraceCall("__get__", __pyx_f[4], 2717, 0, __PYX_ERR(4, 2717, __pyx_L1_error));
19508 __Pyx_XDECREF(__pyx_r);
19509 __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->duplicate_filehandle); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2717, __pyx_L1_error)
19510 __Pyx_GOTREF(__pyx_t_1);
19511 __pyx_r = __pyx_t_1;
19512 __pyx_t_1 = 0;
19513 goto __pyx_L0;
19514
19515 /* function exit code */
19516 __pyx_L1_error:;
19517 __Pyx_XDECREF(__pyx_t_1);
19518 __Pyx_AddTraceback("pysam.libchtslib.HTSFile.duplicate_filehandle.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
19519 __pyx_r = NULL;
19520 __pyx_L0:;
19521 __Pyx_XGIVEREF(__pyx_r);
19522 __Pyx_TraceReturn(__pyx_r, 0);
19523 __Pyx_RefNannyFinishContext();
19524 return __pyx_r;
19525 }
19526
19527 /* "(tree fragment)":1
19528 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
19529 * raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
19530 * def __setstate_cython__(self, __pyx_state):
19531 */
19532
19533 /* Python wrapper */
19534 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_33__reduce_cython__(PyObject *__pyx_v_self,
19535 #if CYTHON_METH_FASTCALL
19536 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
19537 #else
19538 PyObject *__pyx_args, PyObject *__pyx_kwds
19539 #endif
19540 ); /*proto*/
19541 PyDoc_STRVAR(__pyx_doc_5pysam_10libchtslib_7HTSFile_32__reduce_cython__, "HTSFile.__reduce_cython__(self)");
19542 static PyMethodDef __pyx_mdef_5pysam_10libchtslib_7HTSFile_33__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_7HTSFile_33__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_7HTSFile_32__reduce_cython__};
19543 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_33__reduce_cython__(PyObject *__pyx_v_self,
19544 #if CYTHON_METH_FASTCALL
19545 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
19546 #else
19547 PyObject *__pyx_args, PyObject *__pyx_kwds
19548 #endif
19549 ) {
19550 #if !CYTHON_METH_FASTCALL
19551 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
19552 #endif
19553 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
19554 PyObject *__pyx_r = 0;
19555 __Pyx_RefNannyDeclarations
19556 __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
19557 #if !CYTHON_METH_FASTCALL
19558 #if CYTHON_ASSUME_SAFE_MACROS
19559 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
19560 #else
19561 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
19562 #endif
19563 #endif
19564 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
19565 if (unlikely(__pyx_nargs > 0)) {
19566 __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL;}
19567 if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) return NULL;
19568 __pyx_r = __pyx_pf_5pysam_10libchtslib_7HTSFile_32__reduce_cython__(((struct __pyx_obj_5pysam_10libchtslib_HTSFile *)__pyx_v_self));
19569
19570 /* function exit code */
19571 __Pyx_RefNannyFinishContext();
19572 return __pyx_r;
19573 }
19574
19575 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_32__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self) {
19576 PyObject *__pyx_r = NULL;
19577 __Pyx_TraceDeclarations
19578 __Pyx_RefNannyDeclarations
19579 int __pyx_lineno = 0;
19580 const char *__pyx_filename = NULL;
19581 int __pyx_clineno = 0;
19582 __Pyx_TraceFrameInit(__pyx_codeobj__64)
19583 __Pyx_RefNannySetupContext("__reduce_cython__", 1);
19584 __Pyx_TraceCall("__reduce_cython__", __pyx_f[1], 1, 0, __PYX_ERR(1, 1, __pyx_L1_error));
19585
19586 /* "(tree fragment)":2
19587 * def __reduce_cython__(self):
19588 * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<<
19589 * def __setstate_cython__(self, __pyx_state):
19590 * raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
19591 */
19592 __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0);
19593 __PYX_ERR(1, 2, __pyx_L1_error)
19594
19595 /* "(tree fragment)":1
19596 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
19597 * raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
19598 * def __setstate_cython__(self, __pyx_state):
19599 */
19600
19601 /* function exit code */
19602 __pyx_L1_error:;
19603 __Pyx_AddTraceback("pysam.libchtslib.HTSFile.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
19604 __pyx_r = NULL;
19605 __Pyx_XGIVEREF(__pyx_r);
19606 __Pyx_TraceReturn(__pyx_r, 0);
19607 __Pyx_RefNannyFinishContext();
19608 return __pyx_r;
19609 }
19610
19611 /* "(tree fragment)":3
19612 * def __reduce_cython__(self):
19613 * raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
19614 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
19615 * raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
19616 */
19617
19618 /* Python wrapper */
19619 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_35__setstate_cython__(PyObject *__pyx_v_self,
19620 #if CYTHON_METH_FASTCALL
19621 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
19622 #else
19623 PyObject *__pyx_args, PyObject *__pyx_kwds
19624 #endif
19625 ); /*proto*/
19626 PyDoc_STRVAR(__pyx_doc_5pysam_10libchtslib_7HTSFile_34__setstate_cython__, "HTSFile.__setstate_cython__(self, __pyx_state)");
19627 static PyMethodDef __pyx_mdef_5pysam_10libchtslib_7HTSFile_35__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_7HTSFile_35__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_7HTSFile_34__setstate_cython__};
19628 static PyObject *__pyx_pw_5pysam_10libchtslib_7HTSFile_35__setstate_cython__(PyObject *__pyx_v_self,
19629 #if CYTHON_METH_FASTCALL
19630 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
19631 #else
19632 PyObject *__pyx_args, PyObject *__pyx_kwds
19633 #endif
19634 ) {
19635 CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
19636 #if !CYTHON_METH_FASTCALL
19637 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
19638 #endif
19639 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
19640 PyObject* values[1] = {0};
19641 int __pyx_lineno = 0;
19642 const char *__pyx_filename = NULL;
19643 int __pyx_clineno = 0;
19644 PyObject *__pyx_r = 0;
19645 __Pyx_RefNannyDeclarations
19646 __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
19647 #if !CYTHON_METH_FASTCALL
19648 #if CYTHON_ASSUME_SAFE_MACROS
19649 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
19650 #else
19651 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
19652 #endif
19653 #endif
19654 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
19655 {
19656 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0};
19657 if (__pyx_kwds) {
19658 Py_ssize_t kw_args;
19659 switch (__pyx_nargs) {
19660 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
19661 CYTHON_FALLTHROUGH;
19662 case 0: break;
19663 default: goto __pyx_L5_argtuple_error;
19664 }
19665 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
19666 switch (__pyx_nargs) {
19667 case 0:
19668 if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) {
19669 (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
19670 kw_args--;
19671 }
19672 else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 3, __pyx_L3_error)
19673 else goto __pyx_L5_argtuple_error;
19674 }
19675 if (unlikely(kw_args > 0)) {
19676 const Py_ssize_t kwd_pos_args = __pyx_nargs;
19677 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(1, 3, __pyx_L3_error)
19678 }
19679 } else if (unlikely(__pyx_nargs != 1)) {
19680 goto __pyx_L5_argtuple_error;
19681 } else {
19682 values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
19683 }
19684 __pyx_v___pyx_state = values[0];
19685 }
19686 goto __pyx_L6_skip;
19687 __pyx_L5_argtuple_error:;
19688 __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 3, __pyx_L3_error)
19689 __pyx_L6_skip:;
19690 goto __pyx_L4_argument_unpacking_done;
19691 __pyx_L3_error:;
19692 {
19693 Py_ssize_t __pyx_temp;
19694 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
19695 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
19696 }
19697 }
19698 __Pyx_AddTraceback("pysam.libchtslib.HTSFile.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
19699 __Pyx_RefNannyFinishContext();
19700 return NULL;
19701 __pyx_L4_argument_unpacking_done:;
19702 __pyx_r = __pyx_pf_5pysam_10libchtslib_7HTSFile_34__setstate_cython__(((struct __pyx_obj_5pysam_10libchtslib_HTSFile *)__pyx_v_self), __pyx_v___pyx_state);
19703
19704 /* function exit code */
19705 {
19706 Py_ssize_t __pyx_temp;
19707 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
19708 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
19709 }
19710 }
19711 __Pyx_RefNannyFinishContext();
19712 return __pyx_r;
19713 }
19714
19715 static PyObject *__pyx_pf_5pysam_10libchtslib_7HTSFile_34__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_5pysam_10libchtslib_HTSFile *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
19716 PyObject *__pyx_r = NULL;
19717 __Pyx_TraceDeclarations
19718 __Pyx_RefNannyDeclarations
19719 int __pyx_lineno = 0;
19720 const char *__pyx_filename = NULL;
19721 int __pyx_clineno = 0;
19722 __Pyx_TraceFrameInit(__pyx_codeobj__65)
19723 __Pyx_RefNannySetupContext("__setstate_cython__", 1);
19724 __Pyx_TraceCall("__setstate_cython__", __pyx_f[1], 3, 0, __PYX_ERR(1, 3, __pyx_L1_error));
19725
19726 /* "(tree fragment)":4
19727 * raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
19728 * def __setstate_cython__(self, __pyx_state):
19729 * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<<
19730 */
19731 __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0);
19732 __PYX_ERR(1, 4, __pyx_L1_error)
19733
19734 /* "(tree fragment)":3
19735 * def __reduce_cython__(self):
19736 * raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
19737 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
19738 * raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
19739 */
19740
19741 /* function exit code */
19742 __pyx_L1_error:;
19743 __Pyx_AddTraceback("pysam.libchtslib.HTSFile.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
19744 __pyx_r = NULL;
19745 __Pyx_XGIVEREF(__pyx_r);
19746 __Pyx_TraceReturn(__pyx_r, 0);
19747 __Pyx_RefNannyFinishContext();
19748 return __pyx_r;
19749 }
19750 static struct __pyx_vtabstruct_5pysam_10libchtslib_HTSFile __pyx_vtable_5pysam_10libchtslib_HTSFile;
19751
19752 static PyObject *__pyx_tp_new_5pysam_10libchtslib_HTSFile(PyTypeObject *t, PyObject *a, PyObject *k) {
19753 struct __pyx_obj_5pysam_10libchtslib_HTSFile *p;
19754 PyObject *o;
19755 #if CYTHON_COMPILING_IN_LIMITED_API
19756 allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
19757 o = alloc_func(t, 0);
19758 #else
19759 if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
19760 o = (*t->tp_alloc)(t, 0);
19761 } else {
19762 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
19763 }
19764 if (unlikely(!o)) return 0;
19765 #endif
19766 p = ((struct __pyx_obj_5pysam_10libchtslib_HTSFile *)o);
19767 p->__pyx_vtab = __pyx_vtabptr_5pysam_10libchtslib_HTSFile;
19768 p->filename = Py_None; Py_INCREF(Py_None);
19769 p->mode = Py_None; Py_INCREF(Py_None);
19770 p->threads = Py_None; Py_INCREF(Py_None);
19771 p->index_filename = Py_None; Py_INCREF(Py_None);
19772 if (unlikely(__pyx_pw_5pysam_10libchtslib_7HTSFile_1__cinit__(o, a, k) < 0)) goto bad;
19773 return o;
19774 bad:
19775 Py_DECREF(o); o = 0;
19776 return NULL;
19777 }
19778
19779 static void __pyx_tp_dealloc_5pysam_10libchtslib_HTSFile(PyObject *o) {
19780 struct __pyx_obj_5pysam_10libchtslib_HTSFile *p = (struct __pyx_obj_5pysam_10libchtslib_HTSFile *)o;
19781 #if CYTHON_USE_TP_FINALIZE
19782 if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
19783 if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5pysam_10libchtslib_HTSFile) {
19784 if (PyObject_CallFinalizerFromDealloc(o)) return;
19785 }
19786 }
19787 #endif
19788 PyObject_GC_UnTrack(o);
19789 {
19790 PyObject *etype, *eval, *etb;
19791 PyErr_Fetch(&etype, &eval, &etb);
19792 __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
19793 __pyx_pw_5pysam_10libchtslib_7HTSFile_5__dealloc__(o);
19794 __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
19795 PyErr_Restore(etype, eval, etb);
19796 }
19797 Py_CLEAR(p->filename);
19798 Py_CLEAR(p->mode);
19799 Py_CLEAR(p->threads);
19800 Py_CLEAR(p->index_filename);
19801 #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
19802 (*Py_TYPE(o)->tp_free)(o);
19803 #else
19804 {
19805 freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
19806 if (tp_free) tp_free(o);
19807 }
19808 #endif
19809 }
19810
19811 static int __pyx_tp_traverse_5pysam_10libchtslib_HTSFile(PyObject *o, visitproc v, void *a) {
19812 int e;
19813 struct __pyx_obj_5pysam_10libchtslib_HTSFile *p = (struct __pyx_obj_5pysam_10libchtslib_HTSFile *)o;
19814 if (p->filename) {
19815 e = (*v)(p->filename, a); if (e) return e;
19816 }
19817 if (p->mode) {
19818 e = (*v)(p->mode, a); if (e) return e;
19819 }
19820 if (p->threads) {
19821 e = (*v)(p->threads, a); if (e) return e;
19822 }
19823 if (p->index_filename) {
19824 e = (*v)(p->index_filename, a); if (e) return e;
19825 }
19826 return 0;
19827 }
19828
19829 static int __pyx_tp_clear_5pysam_10libchtslib_HTSFile(PyObject *o) {
19830 PyObject* tmp;
19831 struct __pyx_obj_5pysam_10libchtslib_HTSFile *p = (struct __pyx_obj_5pysam_10libchtslib_HTSFile *)o;
19832 tmp = ((PyObject*)p->filename);
19833 p->filename = Py_None; Py_INCREF(Py_None);
19834 Py_XDECREF(tmp);
19835 tmp = ((PyObject*)p->mode);
19836 p->mode = Py_None; Py_INCREF(Py_None);
19837 Py_XDECREF(tmp);
19838 tmp = ((PyObject*)p->threads);
19839 p->threads = Py_None; Py_INCREF(Py_None);
19840 Py_XDECREF(tmp);
19841 tmp = ((PyObject*)p->index_filename);
19842 p->index_filename = Py_None; Py_INCREF(Py_None);
19843 Py_XDECREF(tmp);
19844 return 0;
19845 }
19846
19847 static PyObject *__pyx_getprop_5pysam_10libchtslib_7HTSFile_category(PyObject *o, CYTHON_UNUSED void *x) {
19848 return __pyx_pw_5pysam_10libchtslib_7HTSFile_8category_1__get__(o);
19849 }
19850
19851 static PyObject *__pyx_getprop_5pysam_10libchtslib_7HTSFile_format(PyObject *o, CYTHON_UNUSED void *x) {
19852 return __pyx_pw_5pysam_10libchtslib_7HTSFile_6format_1__get__(o);
19853 }
19854
19855 static PyObject *__pyx_getprop_5pysam_10libchtslib_7HTSFile_version(PyObject *o, CYTHON_UNUSED void *x) {
19856 return __pyx_pw_5pysam_10libchtslib_7HTSFile_7version_1__get__(o);
19857 }
19858
19859 static PyObject *__pyx_getprop_5pysam_10libchtslib_7HTSFile_compression(PyObject *o, CYTHON_UNUSED void *x) {
19860 return __pyx_pw_5pysam_10libchtslib_7HTSFile_11compression_1__get__(o);
19861 }
19862
19863 static PyObject *__pyx_getprop_5pysam_10libchtslib_7HTSFile_description(PyObject *o, CYTHON_UNUSED void *x) {
19864 return __pyx_pw_5pysam_10libchtslib_7HTSFile_11description_1__get__(o);
19865 }
19866
19867 static PyObject *__pyx_getprop_5pysam_10libchtslib_7HTSFile_is_open(PyObject *o, CYTHON_UNUSED void *x) {
19868 return __pyx_pw_5pysam_10libchtslib_7HTSFile_7is_open_1__get__(o);
19869 }
19870
19871 static PyObject *__pyx_getprop_5pysam_10libchtslib_7HTSFile_is_closed(PyObject *o, CYTHON_UNUSED void *x) {
19872 return __pyx_pw_5pysam_10libchtslib_7HTSFile_9is_closed_1__get__(o);
19873 }
19874
19875 static PyObject *__pyx_getprop_5pysam_10libchtslib_7HTSFile_closed(PyObject *o, CYTHON_UNUSED void *x) {
19876 return __pyx_pw_5pysam_10libchtslib_7HTSFile_6closed_1__get__(o);
19877 }
19878
19879 static PyObject *__pyx_getprop_5pysam_10libchtslib_7HTSFile_is_write(PyObject *o, CYTHON_UNUSED void *x) {
19880 return __pyx_pw_5pysam_10libchtslib_7HTSFile_8is_write_1__get__(o);
19881 }
19882
19883 static PyObject *__pyx_getprop_5pysam_10libchtslib_7HTSFile_is_read(PyObject *o, CYTHON_UNUSED void *x) {
19884 return __pyx_pw_5pysam_10libchtslib_7HTSFile_7is_read_1__get__(o);
19885 }
19886
19887 static PyObject *__pyx_getprop_5pysam_10libchtslib_7HTSFile_is_sam(PyObject *o, CYTHON_UNUSED void *x) {
19888 return __pyx_pw_5pysam_10libchtslib_7HTSFile_6is_sam_1__get__(o);
19889 }
19890
19891 static PyObject *__pyx_getprop_5pysam_10libchtslib_7HTSFile_is_bam(PyObject *o, CYTHON_UNUSED void *x) {
19892 return __pyx_pw_5pysam_10libchtslib_7HTSFile_6is_bam_1__get__(o);
19893 }
19894
19895 static PyObject *__pyx_getprop_5pysam_10libchtslib_7HTSFile_is_cram(PyObject *o, CYTHON_UNUSED void *x) {
19896 return __pyx_pw_5pysam_10libchtslib_7HTSFile_7is_cram_1__get__(o);
19897 }
19898
19899 static PyObject *__pyx_getprop_5pysam_10libchtslib_7HTSFile_is_vcf(PyObject *o, CYTHON_UNUSED void *x) {
19900 return __pyx_pw_5pysam_10libchtslib_7HTSFile_6is_vcf_1__get__(o);
19901 }
19902
19903 static PyObject *__pyx_getprop_5pysam_10libchtslib_7HTSFile_is_bcf(PyObject *o, CYTHON_UNUSED void *x) {
19904 return __pyx_pw_5pysam_10libchtslib_7HTSFile_6is_bcf_1__get__(o);
19905 }
19906
19907 static PyObject *__pyx_getprop_5pysam_10libchtslib_7HTSFile_filename(PyObject *o, CYTHON_UNUSED void *x) {
19908 return __pyx_pw_5pysam_10libchtslib_7HTSFile_8filename_1__get__(o);
19909 }
19910
19911 static PyObject *__pyx_getprop_5pysam_10libchtslib_7HTSFile_mode(PyObject *o, CYTHON_UNUSED void *x) {
19912 return __pyx_pw_5pysam_10libchtslib_7HTSFile_4mode_1__get__(o);
19913 }
19914
19915 static PyObject *__pyx_getprop_5pysam_10libchtslib_7HTSFile_threads(PyObject *o, CYTHON_UNUSED void *x) {
19916 return __pyx_pw_5pysam_10libchtslib_7HTSFile_7threads_1__get__(o);
19917 }
19918
19919 static PyObject *__pyx_getprop_5pysam_10libchtslib_7HTSFile_index_filename(PyObject *o, CYTHON_UNUSED void *x) {
19920 return __pyx_pw_5pysam_10libchtslib_7HTSFile_14index_filename_1__get__(o);
19921 }
19922
19923 static PyObject *__pyx_getprop_5pysam_10libchtslib_7HTSFile_is_stream(PyObject *o, CYTHON_UNUSED void *x) {
19924 return __pyx_pw_5pysam_10libchtslib_7HTSFile_9is_stream_1__get__(o);
19925 }
19926
19927 static PyObject *__pyx_getprop_5pysam_10libchtslib_7HTSFile_is_remote(PyObject *o, CYTHON_UNUSED void *x) {
19928 return __pyx_pw_5pysam_10libchtslib_7HTSFile_9is_remote_1__get__(o);
19929 }
19930
19931 static PyObject *__pyx_getprop_5pysam_10libchtslib_7HTSFile_duplicate_filehandle(PyObject *o, CYTHON_UNUSED void *x) {
19932 return __pyx_pw_5pysam_10libchtslib_7HTSFile_20duplicate_filehandle_1__get__(o);
19933 }
19934
19935 static PyMethodDef __pyx_methods_5pysam_10libchtslib_HTSFile[] = {
19936 {"close", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_7HTSFile_3close, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_7HTSFile_2close},
19937 {"flush", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_7HTSFile_7flush, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_7HTSFile_6flush},
19938 {"check_truncation", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_7HTSFile_9check_truncation, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_7HTSFile_8check_truncation},
19939 {"__enter__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_7HTSFile_11__enter__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_7HTSFile_10__enter__},
19940 {"__exit__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_7HTSFile_13__exit__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_7HTSFile_12__exit__},
19941 {"reset", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_7HTSFile_15reset, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_7HTSFile_14reset},
19942 {"seek", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_7HTSFile_17seek, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_7HTSFile_16seek},
19943 {"tell", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_7HTSFile_19tell, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_7HTSFile_18tell},
19944 {"add_hts_options", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_7HTSFile_21add_hts_options, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_7HTSFile_20add_hts_options},
19945 {"parse_region", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_7HTSFile_23parse_region, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_7HTSFile_22parse_region},
19946 {"is_valid_tid", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_7HTSFile_25is_valid_tid, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_7HTSFile_24is_valid_tid},
19947 {"is_valid_reference_name", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_7HTSFile_27is_valid_reference_name, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_7HTSFile_26is_valid_reference_name},
19948 {"get_tid", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_7HTSFile_29get_tid, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_7HTSFile_28get_tid},
19949 {"get_reference_name", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_7HTSFile_31get_reference_name, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_7HTSFile_30get_reference_name},
19950 {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_7HTSFile_33__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_7HTSFile_32__reduce_cython__},
19951 {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_7HTSFile_35__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_7HTSFile_34__setstate_cython__},
19952 {0, 0, 0, 0}
19953 };
19954
19955 static struct PyGetSetDef __pyx_getsets_5pysam_10libchtslib_HTSFile[] = {
19956 {(char *)"category", __pyx_getprop_5pysam_10libchtslib_7HTSFile_category, 0, (char *)PyDoc_STR("General file format category. One of UNKNOWN, ALIGNMENTS,\n VARIANTS, INDEX, REGIONS"), 0},
19957 {(char *)"format", __pyx_getprop_5pysam_10libchtslib_7HTSFile_format, 0, (char *)PyDoc_STR("File format.\n\n One of UNKNOWN, BINARY_FORMAT, TEXT_FORMAT, SAM, BAM,\n BAI, CRAM, CRAI, VCF, BCF, CSI, GZI, TBI, BED.\n "), 0},
19958 {(char *)"version", __pyx_getprop_5pysam_10libchtslib_7HTSFile_version, 0, (char *)PyDoc_STR("Tuple of file format version numbers (major, minor)"), 0},
19959 {(char *)"compression", __pyx_getprop_5pysam_10libchtslib_7HTSFile_compression, 0, (char *)PyDoc_STR("File compression.\n\n One of NONE, GZIP, BGZF, CUSTOM."), 0},
19960 {(char *)"description", __pyx_getprop_5pysam_10libchtslib_7HTSFile_description, 0, (char *)PyDoc_STR("Vaguely human readable description of the file format"), 0},
19961 {(char *)"is_open", __pyx_getprop_5pysam_10libchtslib_7HTSFile_is_open, 0, (char *)PyDoc_STR("return True if HTSFile is open and in a valid state."), 0},
19962 {(char *)"is_closed", __pyx_getprop_5pysam_10libchtslib_7HTSFile_is_closed, 0, (char *)PyDoc_STR("return True if HTSFile is closed."), 0},
19963 {(char *)"closed", __pyx_getprop_5pysam_10libchtslib_7HTSFile_closed, 0, (char *)PyDoc_STR("return True if HTSFile is closed."), 0},
19964 {(char *)"is_write", __pyx_getprop_5pysam_10libchtslib_7HTSFile_is_write, 0, (char *)PyDoc_STR("return True if HTSFile is open for writing"), 0},
19965 {(char *)"is_read", __pyx_getprop_5pysam_10libchtslib_7HTSFile_is_read, 0, (char *)PyDoc_STR("return True if HTSFile is open for reading"), 0},
19966 {(char *)"is_sam", __pyx_getprop_5pysam_10libchtslib_7HTSFile_is_sam, 0, (char *)PyDoc_STR("return True if HTSFile is reading or writing a SAM alignment file"), 0},
19967 {(char *)"is_bam", __pyx_getprop_5pysam_10libchtslib_7HTSFile_is_bam, 0, (char *)PyDoc_STR("return True if HTSFile is reading or writing a BAM alignment file"), 0},
19968 {(char *)"is_cram", __pyx_getprop_5pysam_10libchtslib_7HTSFile_is_cram, 0, (char *)PyDoc_STR("return True if HTSFile is reading or writing a BAM alignment file"), 0},
19969 {(char *)"is_vcf", __pyx_getprop_5pysam_10libchtslib_7HTSFile_is_vcf, 0, (char *)PyDoc_STR("return True if HTSFile is reading or writing a VCF variant file"), 0},
19970 {(char *)"is_bcf", __pyx_getprop_5pysam_10libchtslib_7HTSFile_is_bcf, 0, (char *)PyDoc_STR("return True if HTSFile is reading or writing a BCF variant file"), 0},
19971 {(char *)"filename", __pyx_getprop_5pysam_10libchtslib_7HTSFile_filename, 0, (char *)0, 0},
19972 {(char *)"mode", __pyx_getprop_5pysam_10libchtslib_7HTSFile_mode, 0, (char *)0, 0},
19973 {(char *)"threads", __pyx_getprop_5pysam_10libchtslib_7HTSFile_threads, 0, (char *)0, 0},
19974 {(char *)"index_filename", __pyx_getprop_5pysam_10libchtslib_7HTSFile_index_filename, 0, (char *)0, 0},
19975 {(char *)"is_stream", __pyx_getprop_5pysam_10libchtslib_7HTSFile_is_stream, 0, (char *)0, 0},
19976 {(char *)"is_remote", __pyx_getprop_5pysam_10libchtslib_7HTSFile_is_remote, 0, (char *)0, 0},
19977 {(char *)"duplicate_filehandle", __pyx_getprop_5pysam_10libchtslib_7HTSFile_duplicate_filehandle, 0, (char *)0, 0},
19978 {0, 0, 0, 0, 0}
19979 };
19980 #if CYTHON_USE_TYPE_SPECS
19981 static PyType_Slot __pyx_type_5pysam_10libchtslib_HTSFile_slots[] = {
19982 {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5pysam_10libchtslib_HTSFile},
19983 {Py_tp_doc, (void *)PyDoc_STR("\n Base class for HTS file types\n ")},
19984 {Py_tp_traverse, (void *)__pyx_tp_traverse_5pysam_10libchtslib_HTSFile},
19985 {Py_tp_clear, (void *)__pyx_tp_clear_5pysam_10libchtslib_HTSFile},
19986 {Py_tp_methods, (void *)__pyx_methods_5pysam_10libchtslib_HTSFile},
19987 {Py_tp_getset, (void *)__pyx_getsets_5pysam_10libchtslib_HTSFile},
19988 {Py_tp_new, (void *)__pyx_tp_new_5pysam_10libchtslib_HTSFile},
19989 {0, 0},
19990 };
19991 static PyType_Spec __pyx_type_5pysam_10libchtslib_HTSFile_spec = {
19992 "pysam.libchtslib.HTSFile",
19993 sizeof(struct __pyx_obj_5pysam_10libchtslib_HTSFile),
19994 0,
19995 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
19996 __pyx_type_5pysam_10libchtslib_HTSFile_slots,
19997 };
19998 #else
19999
20000 static PyTypeObject __pyx_type_5pysam_10libchtslib_HTSFile = {
20001 PyVarObject_HEAD_INIT(0, 0)
20002 "pysam.libchtslib.""HTSFile", /*tp_name*/
20003 sizeof(struct __pyx_obj_5pysam_10libchtslib_HTSFile), /*tp_basicsize*/
20004 0, /*tp_itemsize*/
20005 __pyx_tp_dealloc_5pysam_10libchtslib_HTSFile, /*tp_dealloc*/
20006 #if PY_VERSION_HEX < 0x030800b4
20007 0, /*tp_print*/
20008 #endif
20009 #if PY_VERSION_HEX >= 0x030800b4
20010 0, /*tp_vectorcall_offset*/
20011 #endif
20012 0, /*tp_getattr*/
20013 0, /*tp_setattr*/
20014 #if PY_MAJOR_VERSION < 3
20015 0, /*tp_compare*/
20016 #endif
20017 #if PY_MAJOR_VERSION >= 3
20018 0, /*tp_as_async*/
20019 #endif
20020 0, /*tp_repr*/
20021 0, /*tp_as_number*/
20022 0, /*tp_as_sequence*/
20023 0, /*tp_as_mapping*/
20024 0, /*tp_hash*/
20025 0, /*tp_call*/
20026 0, /*tp_str*/
20027 0, /*tp_getattro*/
20028 0, /*tp_setattro*/
20029 0, /*tp_as_buffer*/
20030 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
20031 PyDoc_STR("\n Base class for HTS file types\n "), /*tp_doc*/
20032 __pyx_tp_traverse_5pysam_10libchtslib_HTSFile, /*tp_traverse*/
20033 __pyx_tp_clear_5pysam_10libchtslib_HTSFile, /*tp_clear*/
20034 0, /*tp_richcompare*/
20035 0, /*tp_weaklistoffset*/
20036 0, /*tp_iter*/
20037 0, /*tp_iternext*/
20038 __pyx_methods_5pysam_10libchtslib_HTSFile, /*tp_methods*/
20039 0, /*tp_members*/
20040 __pyx_getsets_5pysam_10libchtslib_HTSFile, /*tp_getset*/
20041 0, /*tp_base*/
20042 0, /*tp_dict*/
20043 0, /*tp_descr_get*/
20044 0, /*tp_descr_set*/
20045 #if !CYTHON_USE_TYPE_SPECS
20046 0, /*tp_dictoffset*/
20047 #endif
20048 0, /*tp_init*/
20049 0, /*tp_alloc*/
20050 __pyx_tp_new_5pysam_10libchtslib_HTSFile, /*tp_new*/
20051 0, /*tp_free*/
20052 0, /*tp_is_gc*/
20053 0, /*tp_bases*/
20054 0, /*tp_mro*/
20055 0, /*tp_cache*/
20056 0, /*tp_subclasses*/
20057 0, /*tp_weaklist*/
20058 0, /*tp_del*/
20059 0, /*tp_version_tag*/
20060 #if PY_VERSION_HEX >= 0x030400a1
20061 #if CYTHON_USE_TP_FINALIZE
20062 0, /*tp_finalize*/
20063 #else
20064 NULL, /*tp_finalize*/
20065 #endif
20066 #endif
20067 #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
20068 0, /*tp_vectorcall*/
20069 #endif
20070 #if __PYX_NEED_TP_PRINT_SLOT == 1
20071 0, /*tp_print*/
20072 #endif
20073 #if PY_VERSION_HEX >= 0x030C0000
20074 0, /*tp_watched*/
20075 #endif
20076 #if PY_VERSION_HEX >= 0x030d00A4
20077 0, /*tp_versions_used*/
20078 #endif
20079 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
20080 0, /*tp_pypy_flags*/
20081 #endif
20082 };
20083 #endif
20084 static struct __pyx_vtabstruct_5pysam_10libchtslib_HFile __pyx_vtable_5pysam_10libchtslib_HFile;
20085
20086 static PyObject *__pyx_tp_new_5pysam_10libchtslib_HFile(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
20087 struct __pyx_obj_5pysam_10libchtslib_HFile *p;
20088 PyObject *o;
20089 #if CYTHON_COMPILING_IN_LIMITED_API
20090 allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc);
20091 o = alloc_func(t, 0);
20092 #else
20093 if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) {
20094 o = (*t->tp_alloc)(t, 0);
20095 } else {
20096 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
20097 }
20098 if (unlikely(!o)) return 0;
20099 #endif
20100 p = ((struct __pyx_obj_5pysam_10libchtslib_HFile *)o);
20101 p->__pyx_vtab = __pyx_vtabptr_5pysam_10libchtslib_HFile;
20102 p->name = Py_None; Py_INCREF(Py_None);
20103 p->mode = Py_None; Py_INCREF(Py_None);
20104 return o;
20105 }
20106
20107 static void __pyx_tp_dealloc_5pysam_10libchtslib_HFile(PyObject *o) {
20108 struct __pyx_obj_5pysam_10libchtslib_HFile *p = (struct __pyx_obj_5pysam_10libchtslib_HFile *)o;
20109 #if CYTHON_USE_TP_FINALIZE
20110 if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __Pyx_PyObject_GetSlot(o, tp_finalize, destructor)) && !__Pyx_PyObject_GC_IsFinalized(o)) {
20111 if (__Pyx_PyObject_GetSlot(o, tp_dealloc, destructor) == __pyx_tp_dealloc_5pysam_10libchtslib_HFile) {
20112 if (PyObject_CallFinalizerFromDealloc(o)) return;
20113 }
20114 }
20115 #endif
20116 PyObject_GC_UnTrack(o);
20117 {
20118 PyObject *etype, *eval, *etb;
20119 PyErr_Fetch(&etype, &eval, &etb);
20120 __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
20121 __pyx_pw_5pysam_10libchtslib_5HFile_3__dealloc__(o);
20122 __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
20123 PyErr_Restore(etype, eval, etb);
20124 }
20125 Py_CLEAR(p->name);
20126 Py_CLEAR(p->mode);
20127 #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
20128 (*Py_TYPE(o)->tp_free)(o);
20129 #else
20130 {
20131 freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free);
20132 if (tp_free) tp_free(o);
20133 }
20134 #endif
20135 }
20136
20137 static int __pyx_tp_traverse_5pysam_10libchtslib_HFile(PyObject *o, visitproc v, void *a) {
20138 int e;
20139 struct __pyx_obj_5pysam_10libchtslib_HFile *p = (struct __pyx_obj_5pysam_10libchtslib_HFile *)o;
20140 if (p->name) {
20141 e = (*v)(p->name, a); if (e) return e;
20142 }
20143 if (p->mode) {
20144 e = (*v)(p->mode, a); if (e) return e;
20145 }
20146 return 0;
20147 }
20148
20149 static int __pyx_tp_clear_5pysam_10libchtslib_HFile(PyObject *o) {
20150 PyObject* tmp;
20151 struct __pyx_obj_5pysam_10libchtslib_HFile *p = (struct __pyx_obj_5pysam_10libchtslib_HFile *)o;
20152 tmp = ((PyObject*)p->name);
20153 p->name = Py_None; Py_INCREF(Py_None);
20154 Py_XDECREF(tmp);
20155 tmp = ((PyObject*)p->mode);
20156 p->mode = Py_None; Py_INCREF(Py_None);
20157 Py_XDECREF(tmp);
20158 return 0;
20159 }
20160
20161 static PyObject *__pyx_getprop_5pysam_10libchtslib_5HFile_closed(PyObject *o, CYTHON_UNUSED void *x) {
20162 return __pyx_pw_5pysam_10libchtslib_5HFile_6closed_1__get__(o);
20163 }
20164
20165 static PyObject *__pyx_getprop_5pysam_10libchtslib_5HFile_name(PyObject *o, CYTHON_UNUSED void *x) {
20166 return __pyx_pw_5pysam_10libchtslib_5HFile_4name_1__get__(o);
20167 }
20168
20169 static PyObject *__pyx_getprop_5pysam_10libchtslib_5HFile_mode(PyObject *o, CYTHON_UNUSED void *x) {
20170 return __pyx_pw_5pysam_10libchtslib_5HFile_4mode_1__get__(o);
20171 }
20172
20173 static PyObject *__pyx_specialmethod___pyx_pw_5pysam_10libchtslib_5HFile_15__next__(PyObject *self, CYTHON_UNUSED PyObject *arg) {
20174 PyObject *res = __pyx_pw_5pysam_10libchtslib_5HFile_15__next__(self);
20175 if (!res && !PyErr_Occurred()) { PyErr_SetNone(PyExc_StopIteration); }
20176 return res;
20177 }
20178
20179 static PyMethodDef __pyx_methods_5pysam_10libchtslib_HFile[] = {
20180 {"close", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_5HFile_5close, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_5HFile_4close},
20181 {"fileno", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_5HFile_7fileno, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_5HFile_6fileno},
20182 {"__enter__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_5HFile_9__enter__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_5HFile_8__enter__},
20183 {"__exit__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_5HFile_11__exit__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_5HFile_10__exit__},
20184 {"__next__", (PyCFunction)__pyx_specialmethod___pyx_pw_5pysam_10libchtslib_5HFile_15__next__, METH_NOARGS|METH_COEXIST, 0},
20185 {"flush", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_5HFile_17flush, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_5HFile_16flush},
20186 {"isatty", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_5HFile_19isatty, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_5HFile_18isatty},
20187 {"readable", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_5HFile_21readable, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_5HFile_20readable},
20188 {"read", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_5HFile_23read, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_5HFile_22read},
20189 {"readall", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_5HFile_25readall, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_5HFile_24readall},
20190 {"readinto", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_5HFile_27readinto, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_5HFile_26readinto},
20191 {"readline", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_5HFile_29readline, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_5HFile_28readline},
20192 {"readlines", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_5HFile_31readlines, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_5HFile_30readlines},
20193 {"seek", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_5HFile_33seek, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_5HFile_32seek},
20194 {"tell", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_5HFile_35tell, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_5HFile_34tell},
20195 {"seekable", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_5HFile_37seekable, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_5HFile_36seekable},
20196 {"truncate", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_5HFile_39truncate, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_5HFile_38truncate},
20197 {"writable", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_5HFile_41writable, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_5HFile_40writable},
20198 {"write", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_5HFile_43write, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_5HFile_42write},
20199 {"writelines", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_5HFile_45writelines, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_5HFile_44writelines},
20200 {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_5HFile_47__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_5HFile_46__reduce_cython__},
20201 {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_10libchtslib_5HFile_49__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_10libchtslib_5HFile_48__setstate_cython__},
20202 {0, 0, 0, 0}
20203 };
20204
20205 static struct PyGetSetDef __pyx_getsets_5pysam_10libchtslib_HFile[] = {
20206 {(char *)"closed", __pyx_getprop_5pysam_10libchtslib_5HFile_closed, 0, (char *)0, 0},
20207 {(char *)"name", __pyx_getprop_5pysam_10libchtslib_5HFile_name, 0, (char *)0, 0},
20208 {(char *)"mode", __pyx_getprop_5pysam_10libchtslib_5HFile_mode, 0, (char *)0, 0},
20209 {0, 0, 0, 0, 0}
20210 };
20211 #if CYTHON_USE_TYPE_SPECS
20212 static PyType_Slot __pyx_type_5pysam_10libchtslib_HFile_slots[] = {
20213 {Py_tp_dealloc, (void *)__pyx_tp_dealloc_5pysam_10libchtslib_HFile},
20214 {Py_tp_doc, (void *)PyDoc_STR("HFile(name, mode=u'r', closefd=True)")},
20215 {Py_tp_traverse, (void *)__pyx_tp_traverse_5pysam_10libchtslib_HFile},
20216 {Py_tp_clear, (void *)__pyx_tp_clear_5pysam_10libchtslib_HFile},
20217 {Py_tp_iter, (void *)__pyx_pw_5pysam_10libchtslib_5HFile_13__iter__},
20218 {Py_tp_iternext, (void *)__pyx_pw_5pysam_10libchtslib_5HFile_15__next__},
20219 {Py_tp_methods, (void *)__pyx_methods_5pysam_10libchtslib_HFile},
20220 {Py_tp_getset, (void *)__pyx_getsets_5pysam_10libchtslib_HFile},
20221 {Py_tp_init, (void *)__pyx_pw_5pysam_10libchtslib_5HFile_1__init__},
20222 {Py_tp_new, (void *)__pyx_tp_new_5pysam_10libchtslib_HFile},
20223 {0, 0},
20224 };
20225 static PyType_Spec __pyx_type_5pysam_10libchtslib_HFile_spec = {
20226 "pysam.libchtslib.HFile",
20227 sizeof(struct __pyx_obj_5pysam_10libchtslib_HFile),
20228 0,
20229 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
20230 __pyx_type_5pysam_10libchtslib_HFile_slots,
20231 };
20232 #else
20233
20234 static PyTypeObject __pyx_type_5pysam_10libchtslib_HFile = {
20235 PyVarObject_HEAD_INIT(0, 0)
20236 "pysam.libchtslib.""HFile", /*tp_name*/
20237 sizeof(struct __pyx_obj_5pysam_10libchtslib_HFile), /*tp_basicsize*/
20238 0, /*tp_itemsize*/
20239 __pyx_tp_dealloc_5pysam_10libchtslib_HFile, /*tp_dealloc*/
20240 #if PY_VERSION_HEX < 0x030800b4
20241 0, /*tp_print*/
20242 #endif
20243 #if PY_VERSION_HEX >= 0x030800b4
20244 0, /*tp_vectorcall_offset*/
20245 #endif
20246 0, /*tp_getattr*/
20247 0, /*tp_setattr*/
20248 #if PY_MAJOR_VERSION < 3
20249 0, /*tp_compare*/
20250 #endif
20251 #if PY_MAJOR_VERSION >= 3
20252 0, /*tp_as_async*/
20253 #endif
20254 0, /*tp_repr*/
20255 0, /*tp_as_number*/
20256 0, /*tp_as_sequence*/
20257 0, /*tp_as_mapping*/
20258 0, /*tp_hash*/
20259 0, /*tp_call*/
20260 0, /*tp_str*/
20261 0, /*tp_getattro*/
20262 0, /*tp_setattro*/
20263 0, /*tp_as_buffer*/
20264 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
20265 PyDoc_STR("HFile(name, mode=u'r', closefd=True)"), /*tp_doc*/
20266 __pyx_tp_traverse_5pysam_10libchtslib_HFile, /*tp_traverse*/
20267 __pyx_tp_clear_5pysam_10libchtslib_HFile, /*tp_clear*/
20268 0, /*tp_richcompare*/
20269 0, /*tp_weaklistoffset*/
20270 __pyx_pw_5pysam_10libchtslib_5HFile_13__iter__, /*tp_iter*/
20271 __pyx_pw_5pysam_10libchtslib_5HFile_15__next__, /*tp_iternext*/
20272 __pyx_methods_5pysam_10libchtslib_HFile, /*tp_methods*/
20273 0, /*tp_members*/
20274 __pyx_getsets_5pysam_10libchtslib_HFile, /*tp_getset*/
20275 0, /*tp_base*/
20276 0, /*tp_dict*/
20277 0, /*tp_descr_get*/
20278 0, /*tp_descr_set*/
20279 #if !CYTHON_USE_TYPE_SPECS
20280 0, /*tp_dictoffset*/
20281 #endif
20282 __pyx_pw_5pysam_10libchtslib_5HFile_1__init__, /*tp_init*/
20283 0, /*tp_alloc*/
20284 __pyx_tp_new_5pysam_10libchtslib_HFile, /*tp_new*/
20285 0, /*tp_free*/
20286 0, /*tp_is_gc*/
20287 0, /*tp_bases*/
20288 0, /*tp_mro*/
20289 0, /*tp_cache*/
20290 0, /*tp_subclasses*/
20291 0, /*tp_weaklist*/
20292 0, /*tp_del*/
20293 0, /*tp_version_tag*/
20294 #if PY_VERSION_HEX >= 0x030400a1
20295 #if CYTHON_USE_TP_FINALIZE
20296 0, /*tp_finalize*/
20297 #else
20298 NULL, /*tp_finalize*/
20299 #endif
20300 #endif
20301 #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
20302 0, /*tp_vectorcall*/
20303 #endif
20304 #if __PYX_NEED_TP_PRINT_SLOT == 1
20305 0, /*tp_print*/
20306 #endif
20307 #if PY_VERSION_HEX >= 0x030C0000
20308 0, /*tp_watched*/
20309 #endif
20310 #if PY_VERSION_HEX >= 0x030d00A4
20311 0, /*tp_versions_used*/
20312 #endif
20313 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
20314 0, /*tp_pypy_flags*/
20315 #endif
20316 };
20317 #endif
20318
20319 static PyMethodDef __pyx_methods[] = {
20320 {0, 0, 0, 0}
20321 };
20322 #ifndef CYTHON_SMALL_CODE
20323 #if defined(__clang__)
20324 #define CYTHON_SMALL_CODE
20325 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
20326 #define CYTHON_SMALL_CODE __attribute__((cold))
20327 #else
20328 #define CYTHON_SMALL_CODE
20329 #endif
20330 #endif
20331 /* #### Code section: pystring_table ### */
20332
20333 static int __Pyx_CreateStringTabAndInitStrings(void) {
20334 __Pyx_StringTabEntry __pyx_string_tab[] = {
20335 {&__pyx_n_u_ALIGNMENTS, __pyx_k_ALIGNMENTS, sizeof(__pyx_k_ALIGNMENTS), 0, 1, 0, 1},
20336 {&__pyx_kp_u_An_error_occurred_while_applying, __pyx_k_An_error_occurred_while_applying, sizeof(__pyx_k_An_error_occurred_while_applying), 0, 1, 0, 0},
20337 {&__pyx_n_s_AttributeError, __pyx_k_AttributeError, sizeof(__pyx_k_AttributeError), 0, 0, 1, 1},
20338 {&__pyx_n_u_BAI, __pyx_k_BAI, sizeof(__pyx_k_BAI), 0, 1, 0, 1},
20339 {&__pyx_n_u_BAM, __pyx_k_BAM, sizeof(__pyx_k_BAM), 0, 1, 0, 1},
20340 {&__pyx_n_u_BCF, __pyx_k_BCF, sizeof(__pyx_k_BCF), 0, 1, 0, 1},
20341 {&__pyx_n_u_BED, __pyx_k_BED, sizeof(__pyx_k_BED), 0, 1, 0, 1},
20342 {&__pyx_n_u_BGZF, __pyx_k_BGZF, sizeof(__pyx_k_BGZF), 0, 1, 0, 1},
20343 {&__pyx_n_u_BINARY_FORMAT, __pyx_k_BINARY_FORMAT, sizeof(__pyx_k_BINARY_FORMAT), 0, 1, 0, 1},
20344 {&__pyx_n_s_CFalse, __pyx_k_CFalse, sizeof(__pyx_k_CFalse), 0, 0, 1, 1},
20345 {&__pyx_n_u_CRAI, __pyx_k_CRAI, sizeof(__pyx_k_CRAI), 0, 1, 0, 1},
20346 {&__pyx_n_u_CRAM, __pyx_k_CRAM, sizeof(__pyx_k_CRAM), 0, 1, 0, 1},
20347 {&__pyx_n_u_CSI, __pyx_k_CSI, sizeof(__pyx_k_CSI), 0, 1, 0, 1},
20348 {&__pyx_n_s_CTrue, __pyx_k_CTrue, sizeof(__pyx_k_CTrue), 0, 0, 1, 1},
20349 {&__pyx_n_u_CUSTOM, __pyx_k_CUSTOM, sizeof(__pyx_k_CUSTOM), 0, 1, 0, 1},
20350 {&__pyx_n_s_CallableValue, __pyx_k_CallableValue, sizeof(__pyx_k_CallableValue), 0, 0, 1, 1},
20351 {&__pyx_n_s_CallableValue___bool, __pyx_k_CallableValue___bool, sizeof(__pyx_k_CallableValue___bool), 0, 0, 1, 1},
20352 {&__pyx_n_s_CallableValue___call, __pyx_k_CallableValue___call, sizeof(__pyx_k_CallableValue___call), 0, 0, 1, 1},
20353 {&__pyx_n_s_CallableValue___eq, __pyx_k_CallableValue___eq, sizeof(__pyx_k_CallableValue___eq), 0, 0, 1, 1},
20354 {&__pyx_n_s_CallableValue___init, __pyx_k_CallableValue___init, sizeof(__pyx_k_CallableValue___init), 0, 0, 1, 1},
20355 {&__pyx_n_s_CallableValue___ne, __pyx_k_CallableValue___ne, sizeof(__pyx_k_CallableValue___ne), 0, 0, 1, 1},
20356 {&__pyx_n_s_CallableValue___nonzero, __pyx_k_CallableValue___nonzero, sizeof(__pyx_k_CallableValue___nonzero), 0, 0, 1, 1},
20357 {&__pyx_kp_u_Cannot_create_hfile, __pyx_k_Cannot_create_hfile, sizeof(__pyx_k_Cannot_create_hfile), 0, 1, 0, 0},
20358 {&__pyx_kp_u_Flushing, __pyx_k_Flushing, sizeof(__pyx_k_Flushing), 0, 1, 0, 0},
20359 {&__pyx_n_u_GZI, __pyx_k_GZI, sizeof(__pyx_k_GZI), 0, 1, 0, 1},
20360 {&__pyx_n_u_GZIP, __pyx_k_GZIP, sizeof(__pyx_k_GZIP), 0, 1, 0, 1},
20361 {&__pyx_n_s_HFile, __pyx_k_HFile, sizeof(__pyx_k_HFile), 0, 0, 1, 1},
20362 {&__pyx_n_u_HFile, __pyx_k_HFile, sizeof(__pyx_k_HFile), 0, 1, 0, 1},
20363 {&__pyx_n_s_HFile___enter, __pyx_k_HFile___enter, sizeof(__pyx_k_HFile___enter), 0, 0, 1, 1},
20364 {&__pyx_n_s_HFile___exit, __pyx_k_HFile___exit, sizeof(__pyx_k_HFile___exit), 0, 0, 1, 1},
20365 {&__pyx_n_s_HFile___reduce_cython, __pyx_k_HFile___reduce_cython, sizeof(__pyx_k_HFile___reduce_cython), 0, 0, 1, 1},
20366 {&__pyx_n_s_HFile___setstate_cython, __pyx_k_HFile___setstate_cython, sizeof(__pyx_k_HFile___setstate_cython), 0, 0, 1, 1},
20367 {&__pyx_n_s_HFile_close, __pyx_k_HFile_close, sizeof(__pyx_k_HFile_close), 0, 0, 1, 1},
20368 {&__pyx_n_s_HFile_fileno, __pyx_k_HFile_fileno, sizeof(__pyx_k_HFile_fileno), 0, 0, 1, 1},
20369 {&__pyx_n_s_HFile_flush, __pyx_k_HFile_flush, sizeof(__pyx_k_HFile_flush), 0, 0, 1, 1},
20370 {&__pyx_n_s_HFile_isatty, __pyx_k_HFile_isatty, sizeof(__pyx_k_HFile_isatty), 0, 0, 1, 1},
20371 {&__pyx_n_s_HFile_read, __pyx_k_HFile_read, sizeof(__pyx_k_HFile_read), 0, 0, 1, 1},
20372 {&__pyx_n_s_HFile_readable, __pyx_k_HFile_readable, sizeof(__pyx_k_HFile_readable), 0, 0, 1, 1},
20373 {&__pyx_n_s_HFile_readall, __pyx_k_HFile_readall, sizeof(__pyx_k_HFile_readall), 0, 0, 1, 1},
20374 {&__pyx_n_s_HFile_readinto, __pyx_k_HFile_readinto, sizeof(__pyx_k_HFile_readinto), 0, 0, 1, 1},
20375 {&__pyx_n_s_HFile_readline, __pyx_k_HFile_readline, sizeof(__pyx_k_HFile_readline), 0, 0, 1, 1},
20376 {&__pyx_n_s_HFile_readlines, __pyx_k_HFile_readlines, sizeof(__pyx_k_HFile_readlines), 0, 0, 1, 1},
20377 {&__pyx_n_s_HFile_seek, __pyx_k_HFile_seek, sizeof(__pyx_k_HFile_seek), 0, 0, 1, 1},
20378 {&__pyx_n_s_HFile_seekable, __pyx_k_HFile_seekable, sizeof(__pyx_k_HFile_seekable), 0, 0, 1, 1},
20379 {&__pyx_n_s_HFile_tell, __pyx_k_HFile_tell, sizeof(__pyx_k_HFile_tell), 0, 0, 1, 1},
20380 {&__pyx_n_s_HFile_truncate, __pyx_k_HFile_truncate, sizeof(__pyx_k_HFile_truncate), 0, 0, 1, 1},
20381 {&__pyx_n_s_HFile_writable, __pyx_k_HFile_writable, sizeof(__pyx_k_HFile_writable), 0, 0, 1, 1},
20382 {&__pyx_n_s_HFile_write, __pyx_k_HFile_write, sizeof(__pyx_k_HFile_write), 0, 0, 1, 1},
20383 {&__pyx_n_s_HFile_writelines, __pyx_k_HFile_writelines, sizeof(__pyx_k_HFile_writelines), 0, 0, 1, 1},
20384 {&__pyx_n_s_HTSFile, __pyx_k_HTSFile, sizeof(__pyx_k_HTSFile), 0, 0, 1, 1},
20385 {&__pyx_n_u_HTSFile, __pyx_k_HTSFile, sizeof(__pyx_k_HTSFile), 0, 1, 0, 1},
20386 {&__pyx_n_s_HTSFile___enter, __pyx_k_HTSFile___enter, sizeof(__pyx_k_HTSFile___enter), 0, 0, 1, 1},
20387 {&__pyx_n_s_HTSFile___exit, __pyx_k_HTSFile___exit, sizeof(__pyx_k_HTSFile___exit), 0, 0, 1, 1},
20388 {&__pyx_n_s_HTSFile___reduce_cython, __pyx_k_HTSFile___reduce_cython, sizeof(__pyx_k_HTSFile___reduce_cython), 0, 0, 1, 1},
20389 {&__pyx_n_s_HTSFile___setstate_cython, __pyx_k_HTSFile___setstate_cython, sizeof(__pyx_k_HTSFile___setstate_cython), 0, 0, 1, 1},
20390 {&__pyx_n_s_HTSFile_add_hts_options, __pyx_k_HTSFile_add_hts_options, sizeof(__pyx_k_HTSFile_add_hts_options), 0, 0, 1, 1},
20391 {&__pyx_n_s_HTSFile_check_truncation, __pyx_k_HTSFile_check_truncation, sizeof(__pyx_k_HTSFile_check_truncation), 0, 0, 1, 1},
20392 {&__pyx_n_s_HTSFile_close, __pyx_k_HTSFile_close, sizeof(__pyx_k_HTSFile_close), 0, 0, 1, 1},
20393 {&__pyx_n_s_HTSFile_flush, __pyx_k_HTSFile_flush, sizeof(__pyx_k_HTSFile_flush), 0, 0, 1, 1},
20394 {&__pyx_n_s_HTSFile_get_reference_name, __pyx_k_HTSFile_get_reference_name, sizeof(__pyx_k_HTSFile_get_reference_name), 0, 0, 1, 1},
20395 {&__pyx_n_s_HTSFile_get_tid, __pyx_k_HTSFile_get_tid, sizeof(__pyx_k_HTSFile_get_tid), 0, 0, 1, 1},
20396 {&__pyx_n_s_HTSFile_is_valid_reference_name, __pyx_k_HTSFile_is_valid_reference_name, sizeof(__pyx_k_HTSFile_is_valid_reference_name), 0, 0, 1, 1},
20397 {&__pyx_n_s_HTSFile_is_valid_tid, __pyx_k_HTSFile_is_valid_tid, sizeof(__pyx_k_HTSFile_is_valid_tid), 0, 0, 1, 1},
20398 {&__pyx_n_s_HTSFile_parse_region, __pyx_k_HTSFile_parse_region, sizeof(__pyx_k_HTSFile_parse_region), 0, 0, 1, 1},
20399 {&__pyx_n_s_HTSFile_reset, __pyx_k_HTSFile_reset, sizeof(__pyx_k_HTSFile_reset), 0, 0, 1, 1},
20400 {&__pyx_n_s_HTSFile_seek, __pyx_k_HTSFile_seek, sizeof(__pyx_k_HTSFile_seek), 0, 0, 1, 1},
20401 {&__pyx_n_s_HTSFile_tell, __pyx_k_HTSFile_tell, sizeof(__pyx_k_HTSFile_tell), 0, 0, 1, 1},
20402 {&__pyx_n_u_INDEX, __pyx_k_INDEX, sizeof(__pyx_k_INDEX), 0, 1, 0, 1},
20403 {&__pyx_n_s_IOError, __pyx_k_IOError, sizeof(__pyx_k_IOError), 0, 0, 1, 1},
20404 {&__pyx_kp_u_I_O_operation_on_closed_file, __pyx_k_I_O_operation_on_closed_file, sizeof(__pyx_k_I_O_operation_on_closed_file), 0, 1, 0, 0},
20405 {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1},
20406 {&__pyx_kp_u_Invalid_format_option_specified, __pyx_k_Invalid_format_option_specified, sizeof(__pyx_k_Invalid_format_option_specified), 0, 1, 0, 0},
20407 {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
20408 {&__pyx_n_u_NONE, __pyx_k_NONE, sizeof(__pyx_k_NONE), 0, 1, 0, 1},
20409 {&__pyx_n_s_NotImplementedError, __pyx_k_NotImplementedError, sizeof(__pyx_k_NotImplementedError), 0, 0, 1, 1},
20410 {&__pyx_n_s_OSError, __pyx_k_OSError, sizeof(__pyx_k_OSError), 0, 0, 1, 1},
20411 {&__pyx_n_s_OverflowError, __pyx_k_OverflowError, sizeof(__pyx_k_OverflowError), 0, 0, 1, 1},
20412 {&__pyx_n_u_REGIONS, __pyx_k_REGIONS, sizeof(__pyx_k_REGIONS), 0, 1, 0, 1},
20413 {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1},
20414 {&__pyx_n_u_SAM, __pyx_k_SAM, sizeof(__pyx_k_SAM), 0, 1, 0, 1},
20415 {&__pyx_n_s_SEEK_SET, __pyx_k_SEEK_SET, sizeof(__pyx_k_SEEK_SET), 0, 0, 1, 1},
20416 {&__pyx_n_s_StopIteration, __pyx_k_StopIteration, sizeof(__pyx_k_StopIteration), 0, 0, 1, 1},
20417 {&__pyx_n_u_TBI, __pyx_k_TBI, sizeof(__pyx_k_TBI), 0, 1, 0, 1},
20418 {&__pyx_n_u_TEXT_FORMAT, __pyx_k_TEXT_FORMAT, sizeof(__pyx_k_TEXT_FORMAT), 0, 1, 0, 1},
20419 {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
20420 {&__pyx_n_u_UNKNOWN, __pyx_k_UNKNOWN, sizeof(__pyx_k_UNKNOWN), 0, 1, 0, 1},
20421 {&__pyx_n_u_VARIANTS, __pyx_k_VARIANTS, sizeof(__pyx_k_VARIANTS), 0, 1, 0, 1},
20422 {&__pyx_n_u_VCF, __pyx_k_VCF, sizeof(__pyx_k_VCF), 0, 1, 0, 1},
20423 {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
20424 {&__pyx_kp_b__13, __pyx_k__13, sizeof(__pyx_k__13), 0, 0, 0, 0},
20425 {&__pyx_kp_u__55, __pyx_k__55, sizeof(__pyx_k__55), 0, 1, 0, 0},
20426 {&__pyx_kp_u__56, __pyx_k__56, sizeof(__pyx_k__56), 0, 1, 0, 0},
20427 {&__pyx_n_s__58, __pyx_k__58, sizeof(__pyx_k__58), 0, 0, 1, 1},
20428 {&__pyx_kp_u__58, __pyx_k__58, sizeof(__pyx_k__58), 0, 1, 0, 0},
20429 {&__pyx_kp_u__59, __pyx_k__59, sizeof(__pyx_k__59), 0, 1, 0, 0},
20430 {&__pyx_n_s__97, __pyx_k__97, sizeof(__pyx_k__97), 0, 0, 1, 1},
20431 {&__pyx_n_s_add_hts_options, __pyx_k_add_hts_options, sizeof(__pyx_k_add_hts_options), 0, 0, 1, 1},
20432 {&__pyx_n_s_all, __pyx_k_all, sizeof(__pyx_k_all), 0, 0, 1, 1},
20433 {&__pyx_n_s_asyncio_coroutines, __pyx_k_asyncio_coroutines, sizeof(__pyx_k_asyncio_coroutines), 0, 0, 1, 1},
20434 {&__pyx_n_b_b, __pyx_k_b, sizeof(__pyx_k_b), 0, 0, 0, 1},
20435 {&__pyx_n_s_b, __pyx_k_b, sizeof(__pyx_k_b), 0, 0, 1, 1},
20436 {&__pyx_n_s_bgzfp, __pyx_k_bgzfp, sizeof(__pyx_k_bgzfp), 0, 0, 1, 1},
20437 {&__pyx_n_s_bool, __pyx_k_bool, sizeof(__pyx_k_bool), 0, 0, 1, 1},
20438 {&__pyx_n_s_buf, __pyx_k_buf, sizeof(__pyx_k_buf), 0, 0, 1, 1},
20439 {&__pyx_n_s_bytes_read, __pyx_k_bytes_read, sizeof(__pyx_k_bytes_read), 0, 0, 1, 1},
20440 {&__pyx_n_b_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 0, 1},
20441 {&__pyx_n_s_call, __pyx_k_call, sizeof(__pyx_k_call), 0, 0, 1, 1},
20442 {&__pyx_n_s_check_truncation, __pyx_k_check_truncation, sizeof(__pyx_k_check_truncation), 0, 0, 1, 1},
20443 {&__pyx_n_s_chunk_size, __pyx_k_chunk_size, sizeof(__pyx_k_chunk_size), 0, 0, 1, 1},
20444 {&__pyx_n_s_class_getitem, __pyx_k_class_getitem, sizeof(__pyx_k_class_getitem), 0, 0, 1, 1},
20445 {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
20446 {&__pyx_n_s_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1},
20447 {&__pyx_n_s_closefd, __pyx_k_closefd, sizeof(__pyx_k_closefd), 0, 0, 1, 1},
20448 {&__pyx_n_s_contig, __pyx_k_contig, sizeof(__pyx_k_contig), 0, 0, 1, 1},
20449 {&__pyx_kp_u_contig_and_reference_should_not, __pyx_k_contig_and_reference_should_not, sizeof(__pyx_k_contig_and_reference_should_not), 0, 1, 0, 0},
20450 {&__pyx_n_s_coord, __pyx_k_coord, sizeof(__pyx_k_coord), 0, 0, 1, 1},
20451 {&__pyx_n_s_cpart, __pyx_k_cpart, sizeof(__pyx_k_cpart), 0, 0, 1, 1},
20452 {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1},
20453 {&__pyx_kp_u_disable, __pyx_k_disable, sizeof(__pyx_k_disable), 0, 1, 0, 0},
20454 {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1},
20455 {&__pyx_kp_u_enable, __pyx_k_enable, sizeof(__pyx_k_enable), 0, 1, 0, 0},
20456 {&__pyx_n_s_end, __pyx_k_end, sizeof(__pyx_k_end), 0, 0, 1, 1},
20457 {&__pyx_n_s_enter, __pyx_k_enter, sizeof(__pyx_k_enter), 0, 0, 1, 1},
20458 {&__pyx_n_s_eq, __pyx_k_eq, sizeof(__pyx_k_eq), 0, 0, 1, 1},
20459 {&__pyx_kp_u_error_checking_for_EOF_marker, __pyx_k_error_checking_for_EOF_marker, sizeof(__pyx_k_error_checking_for_EOF_marker), 0, 1, 0, 0},
20460 {&__pyx_n_s_exc_type, __pyx_k_exc_type, sizeof(__pyx_k_exc_type), 0, 0, 1, 1},
20461 {&__pyx_n_s_exc_value, __pyx_k_exc_value, sizeof(__pyx_k_exc_value), 0, 0, 1, 1},
20462 {&__pyx_n_s_exit, __pyx_k_exit, sizeof(__pyx_k_exit), 0, 0, 1, 1},
20463 {&__pyx_kp_u_failed, __pyx_k_failed, sizeof(__pyx_k_failed), 0, 1, 0, 0},
20464 {&__pyx_kp_u_failed_to_close_HFile, __pyx_k_failed_to_close_HFile, sizeof(__pyx_k_failed_to_close_HFile), 0, 1, 0, 0},
20465 {&__pyx_kp_u_failed_to_flush_HFile, __pyx_k_failed_to_flush_HFile, sizeof(__pyx_k_failed_to_flush_HFile), 0, 1, 0, 0},
20466 {&__pyx_kp_u_failed_to_open_HFile, __pyx_k_failed_to_open_HFile, sizeof(__pyx_k_failed_to_open_HFile), 0, 1, 0, 0},
20467 {&__pyx_kp_u_failed_to_read_HFile, __pyx_k_failed_to_read_HFile, sizeof(__pyx_k_failed_to_read_HFile), 0, 1, 0, 0},
20468 {&__pyx_kp_u_fd, __pyx_k_fd, sizeof(__pyx_k_fd), 0, 1, 0, 0},
20469 {&__pyx_n_s_fileno, __pyx_k_fileno, sizeof(__pyx_k_fileno), 0, 0, 1, 1},
20470 {&__pyx_kp_u_fileno_not_available, __pyx_k_fileno_not_available, sizeof(__pyx_k_fileno_not_available), 0, 1, 0, 0},
20471 {&__pyx_n_s_flush, __pyx_k_flush, sizeof(__pyx_k_flush), 0, 0, 1, 1},
20472 {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1},
20473 {&__pyx_n_s_format_option, __pyx_k_format_option, sizeof(__pyx_k_format_option), 0, 0, 1, 1},
20474 {&__pyx_n_s_format_options, __pyx_k_format_options, sizeof(__pyx_k_format_options), 0, 0, 1, 1},
20475 {&__pyx_n_s_fp, __pyx_k_fp, sizeof(__pyx_k_fp), 0, 0, 1, 1},
20476 {&__pyx_kp_u_gc, __pyx_k_gc, sizeof(__pyx_k_gc), 0, 1, 0, 0},
20477 {&__pyx_n_s_get_reference_name, __pyx_k_get_reference_name, sizeof(__pyx_k_get_reference_name), 0, 0, 1, 1},
20478 {&__pyx_n_s_get_tid, __pyx_k_get_tid, sizeof(__pyx_k_get_tid), 0, 0, 1, 1},
20479 {&__pyx_n_s_get_verbosity, __pyx_k_get_verbosity, sizeof(__pyx_k_get_verbosity), 0, 0, 1, 1},
20480 {&__pyx_n_u_get_verbosity, __pyx_k_get_verbosity, sizeof(__pyx_k_get_verbosity), 0, 1, 0, 1},
20481 {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
20482 {&__pyx_n_s_got, __pyx_k_got, sizeof(__pyx_k_got), 0, 0, 1, 1},
20483 {&__pyx_n_s_ignore_truncation, __pyx_k_ignore_truncation, sizeof(__pyx_k_ignore_truncation), 0, 0, 1, 1},
20484 {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
20485 {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1},
20486 {&__pyx_n_s_init_subclass, __pyx_k_init_subclass, sizeof(__pyx_k_init_subclass), 0, 0, 1, 1},
20487 {&__pyx_n_s_initializing, __pyx_k_initializing, sizeof(__pyx_k_initializing), 0, 0, 1, 1},
20488 {&__pyx_kp_u_invalid_contig_s, __pyx_k_invalid_contig_s, sizeof(__pyx_k_invalid_contig_s), 0, 1, 0, 0},
20489 {&__pyx_kp_u_invalid_coordinates_start_i_stop, __pyx_k_invalid_coordinates_start_i_stop, sizeof(__pyx_k_invalid_coordinates_start_i_stop), 0, 1, 0, 0},
20490 {&__pyx_kp_u_invalid_tid, __pyx_k_invalid_tid, sizeof(__pyx_k_invalid_tid), 0, 1, 0, 0},
20491 {&__pyx_n_s_io, __pyx_k_io, sizeof(__pyx_k_io), 0, 0, 1, 1},
20492 {&__pyx_n_s_is_coroutine, __pyx_k_is_coroutine, sizeof(__pyx_k_is_coroutine), 0, 0, 1, 1},
20493 {&__pyx_n_s_is_open, __pyx_k_is_open, sizeof(__pyx_k_is_open), 0, 0, 1, 1},
20494 {&__pyx_n_s_is_valid_reference_name, __pyx_k_is_valid_reference_name, sizeof(__pyx_k_is_valid_reference_name), 0, 0, 1, 1},
20495 {&__pyx_n_s_is_valid_tid, __pyx_k_is_valid_tid, sizeof(__pyx_k_is_valid_tid), 0, 0, 1, 1},
20496 {&__pyx_n_s_isatty, __pyx_k_isatty, sizeof(__pyx_k_isatty), 0, 0, 1, 1},
20497 {&__pyx_kp_u_isenabled, __pyx_k_isenabled, sizeof(__pyx_k_isenabled), 0, 1, 0, 0},
20498 {&__pyx_n_s_join, __pyx_k_join, sizeof(__pyx_k_join), 0, 0, 1, 1},
20499 {&__pyx_n_s_line, __pyx_k_line, sizeof(__pyx_k_line), 0, 0, 1, 1},
20500 {&__pyx_n_s_lines, __pyx_k_lines, sizeof(__pyx_k_lines), 0, 0, 1, 1},
20501 {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
20502 {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1},
20503 {&__pyx_kp_u_metadata_not_available_on_closed, __pyx_k_metadata_not_available_on_closed, sizeof(__pyx_k_metadata_not_available_on_closed), 0, 1, 0, 0},
20504 {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1},
20505 {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1},
20506 {&__pyx_n_s_mro_entries, __pyx_k_mro_entries, sizeof(__pyx_k_mro_entries), 0, 0, 1, 1},
20507 {&__pyx_n_s_msg, __pyx_k_msg, sizeof(__pyx_k_msg), 0, 0, 1, 1},
20508 {&__pyx_n_s_mv, __pyx_k_mv, sizeof(__pyx_k_mv), 0, 0, 1, 1},
20509 {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
20510 {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1},
20511 {&__pyx_n_s_ne, __pyx_k_ne, sizeof(__pyx_k_ne), 0, 0, 1, 1},
20512 {&__pyx_kp_u_no_BGZF_EOF_marker_file_may_be_t, __pyx_k_no_BGZF_EOF_marker_file_may_be_t, sizeof(__pyx_k_no_BGZF_EOF_marker_file_may_be_t), 0, 1, 0, 0},
20513 {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non, sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0},
20514 {&__pyx_n_s_nonzero, __pyx_k_nonzero, sizeof(__pyx_k_nonzero), 0, 0, 1, 1},
20515 {&__pyx_n_s_object, __pyx_k_object, sizeof(__pyx_k_object), 0, 0, 1, 1},
20516 {&__pyx_n_s_off, __pyx_k_off, sizeof(__pyx_k_off), 0, 0, 1, 1},
20517 {&__pyx_n_s_offset, __pyx_k_offset, sizeof(__pyx_k_offset), 0, 0, 1, 1},
20518 {&__pyx_kp_u_operation_on_closed_HFile, __pyx_k_operation_on_closed_HFile, sizeof(__pyx_k_operation_on_closed_HFile), 0, 1, 0, 0},
20519 {&__pyx_n_s_opts, __pyx_k_opts, sizeof(__pyx_k_opts), 0, 0, 1, 1},
20520 {&__pyx_n_s_os, __pyx_k_os, sizeof(__pyx_k_os), 0, 0, 1, 1},
20521 {&__pyx_n_s_other, __pyx_k_other, sizeof(__pyx_k_other), 0, 0, 1, 1},
20522 {&__pyx_n_s_parse_region, __pyx_k_parse_region, sizeof(__pyx_k_parse_region), 0, 0, 1, 1},
20523 {&__pyx_n_s_part, __pyx_k_part, sizeof(__pyx_k_part), 0, 0, 1, 1},
20524 {&__pyx_n_s_parts, __pyx_k_parts, sizeof(__pyx_k_parts), 0, 0, 1, 1},
20525 {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1},
20526 {&__pyx_n_s_pysam_libchtslib, __pyx_k_pysam_libchtslib, sizeof(__pyx_k_pysam_libchtslib), 0, 0, 1, 1},
20527 {&__pyx_kp_s_pysam_libchtslib_pyx, __pyx_k_pysam_libchtslib_pyx, sizeof(__pyx_k_pysam_libchtslib_pyx), 0, 0, 1, 0},
20528 {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1},
20529 {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
20530 {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1},
20531 {&__pyx_n_u_r, __pyx_k_r, sizeof(__pyx_k_r), 0, 1, 0, 1},
20532 {&__pyx_n_s_re, __pyx_k_re, sizeof(__pyx_k_re), 0, 0, 1, 1},
20533 {&__pyx_n_s_read, __pyx_k_read, sizeof(__pyx_k_read), 0, 0, 1, 1},
20534 {&__pyx_n_s_readable, __pyx_k_readable, sizeof(__pyx_k_readable), 0, 0, 1, 1},
20535 {&__pyx_n_s_readall, __pyx_k_readall, sizeof(__pyx_k_readall), 0, 0, 1, 1},
20536 {&__pyx_n_s_readinto, __pyx_k_readinto, sizeof(__pyx_k_readinto), 0, 0, 1, 1},
20537 {&__pyx_n_s_readline, __pyx_k_readline, sizeof(__pyx_k_readline), 0, 0, 1, 1},
20538 {&__pyx_n_s_readlines, __pyx_k_readlines, sizeof(__pyx_k_readlines), 0, 0, 1, 1},
20539 {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
20540 {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
20541 {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
20542 {&__pyx_n_s_reference, __pyx_k_reference, sizeof(__pyx_k_reference), 0, 0, 1, 1},
20543 {&__pyx_n_s_region, __pyx_k_region, sizeof(__pyx_k_region), 0, 0, 1, 1},
20544 {&__pyx_n_s_replace, __pyx_k_replace, sizeof(__pyx_k_replace), 0, 0, 1, 1},
20545 {&__pyx_n_s_reset, __pyx_k_reset, sizeof(__pyx_k_reset), 0, 0, 1, 1},
20546 {&__pyx_n_s_ret, __pyx_k_ret, sizeof(__pyx_k_ret), 0, 0, 1, 1},
20547 {&__pyx_n_s_rstart, __pyx_k_rstart, sizeof(__pyx_k_rstart), 0, 0, 1, 1},
20548 {&__pyx_n_s_rstop, __pyx_k_rstop, sizeof(__pyx_k_rstop), 0, 0, 1, 1},
20549 {&__pyx_n_s_rtid, __pyx_k_rtid, sizeof(__pyx_k_rtid), 0, 0, 1, 1},
20550 {&__pyx_n_s_rval, __pyx_k_rval, sizeof(__pyx_k_rval), 0, 0, 1, 1},
20551 {&__pyx_n_s_seek, __pyx_k_seek, sizeof(__pyx_k_seek), 0, 0, 1, 1},
20552 {&__pyx_kp_u_seek_failed_on_HFile, __pyx_k_seek_failed_on_HFile, sizeof(__pyx_k_seek_failed_on_HFile), 0, 1, 0, 0},
20553 {&__pyx_kp_u_seek_not_available_in_streams, __pyx_k_seek_not_available_in_streams, sizeof(__pyx_k_seek_not_available_in_streams), 0, 1, 0, 0},
20554 {&__pyx_kp_u_seek_not_implemented_in_files_co, __pyx_k_seek_not_implemented_in_files_co, sizeof(__pyx_k_seek_not_implemented_in_files_co), 0, 1, 0, 0},
20555 {&__pyx_n_s_seekable, __pyx_k_seekable, sizeof(__pyx_k_seekable), 0, 0, 1, 1},
20556 {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1},
20557 {&__pyx_kp_s_self_fp_cannot_be_converted_to_a, __pyx_k_self_fp_cannot_be_converted_to_a, sizeof(__pyx_k_self_fp_cannot_be_converted_to_a), 0, 0, 1, 0},
20558 {&__pyx_n_s_set_name, __pyx_k_set_name, sizeof(__pyx_k_set_name), 0, 0, 1, 1},
20559 {&__pyx_n_s_set_verbosity, __pyx_k_set_verbosity, sizeof(__pyx_k_set_verbosity), 0, 0, 1, 1},
20560 {&__pyx_n_u_set_verbosity, __pyx_k_set_verbosity, sizeof(__pyx_k_set_verbosity), 0, 1, 0, 1},
20561 {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
20562 {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
20563 {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1},
20564 {&__pyx_n_s_spec, __pyx_k_spec, sizeof(__pyx_k_spec), 0, 0, 1, 1},
20565 {&__pyx_n_s_split, __pyx_k_split, sizeof(__pyx_k_split), 0, 0, 1, 1},
20566 {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1},
20567 {&__pyx_kp_u_start_out_of_range_i, __pyx_k_start_out_of_range_i, sizeof(__pyx_k_start_out_of_range_i), 0, 1, 0, 0},
20568 {&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1},
20569 {&__pyx_kp_u_stop_and_end_should_not_both_be, __pyx_k_stop_and_end_should_not_both_be, sizeof(__pyx_k_stop_and_end_should_not_both_be), 0, 1, 0, 0},
20570 {&__pyx_kp_u_stop_out_of_range_i, __pyx_k_stop_out_of_range_i, sizeof(__pyx_k_stop_out_of_range_i), 0, 1, 0, 0},
20571 {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
20572 {&__pyx_n_s_super, __pyx_k_super, sizeof(__pyx_k_super), 0, 0, 1, 1},
20573 {&__pyx_n_s_tb, __pyx_k_tb, sizeof(__pyx_k_tb), 0, 0, 1, 1},
20574 {&__pyx_n_s_tell, __pyx_k_tell, sizeof(__pyx_k_tell), 0, 0, 1, 1},
20575 {&__pyx_kp_u_tell_failed_on_HFile, __pyx_k_tell_failed_on_HFile, sizeof(__pyx_k_tell_failed_on_HFile), 0, 1, 0, 0},
20576 {&__pyx_kp_u_tell_not_available_in_streams, __pyx_k_tell_not_available_in_streams, sizeof(__pyx_k_tell_not_available_in_streams), 0, 1, 0, 0},
20577 {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
20578 {&__pyx_n_s_tid, __pyx_k_tid, sizeof(__pyx_k_tid), 0, 0, 1, 1},
20579 {&__pyx_n_s_traceback, __pyx_k_traceback, sizeof(__pyx_k_traceback), 0, 0, 1, 1},
20580 {&__pyx_n_s_truncate, __pyx_k_truncate, sizeof(__pyx_k_truncate), 0, 0, 1, 1},
20581 {&__pyx_n_s_type, __pyx_k_type, sizeof(__pyx_k_type), 0, 0, 1, 1},
20582 {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1},
20583 {&__pyx_n_s_verbosity, __pyx_k_verbosity, sizeof(__pyx_k_verbosity), 0, 0, 1, 1},
20584 {&__pyx_n_u_w, __pyx_k_w, sizeof(__pyx_k_w), 0, 1, 0, 1},
20585 {&__pyx_n_s_warn, __pyx_k_warn, sizeof(__pyx_k_warn), 0, 0, 1, 1},
20586 {&__pyx_n_s_warnings, __pyx_k_warnings, sizeof(__pyx_k_warnings), 0, 0, 1, 1},
20587 {&__pyx_n_s_whence, __pyx_k_whence, sizeof(__pyx_k_whence), 0, 0, 1, 1},
20588 {&__pyx_n_s_writable, __pyx_k_writable, sizeof(__pyx_k_writable), 0, 0, 1, 1},
20589 {&__pyx_n_s_write, __pyx_k_write, sizeof(__pyx_k_write), 0, 0, 1, 1},
20590 {&__pyx_kp_u_write_failed_on_HFile, __pyx_k_write_failed_on_HFile, sizeof(__pyx_k_write_failed_on_HFile), 0, 1, 0, 0},
20591 {&__pyx_n_s_writelines, __pyx_k_writelines, sizeof(__pyx_k_writelines), 0, 0, 1, 1},
20592 {0, 0, 0, 0, 0, 0, 0}
20593 };
20594 return __Pyx_InitStrings(__pyx_string_tab);
20595 }
20596 /* #### Code section: cached_builtins ### */
20597 static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
20598 __pyx_builtin_object = __Pyx_GetBuiltinName(__pyx_n_s_object); if (!__pyx_builtin_object) __PYX_ERR(0, 297, __pyx_L1_error)
20599 __pyx_builtin_IOError = __Pyx_GetBuiltinName(__pyx_n_s_IOError); if (!__pyx_builtin_IOError) __PYX_ERR(0, 96, __pyx_L1_error)
20600 __pyx_builtin_AttributeError = __Pyx_GetBuiltinName(__pyx_n_s_AttributeError); if (!__pyx_builtin_AttributeError) __PYX_ERR(0, 114, __pyx_L1_error)
20601 __pyx_builtin_StopIteration = __Pyx_GetBuiltinName(__pyx_n_s_StopIteration); if (!__pyx_builtin_StopIteration) __PYX_ERR(0, 128, __pyx_L1_error)
20602 __pyx_builtin_NotImplementedError = __Pyx_GetBuiltinName(__pyx_n_s_NotImplementedError); if (!__pyx_builtin_NotImplementedError) __PYX_ERR(0, 270, __pyx_L1_error)
20603 __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(1, 2, __pyx_L1_error)
20604 __pyx_builtin_OSError = __Pyx_GetBuiltinName(__pyx_n_s_OSError); if (!__pyx_builtin_OSError) __PYX_ERR(0, 345, __pyx_L1_error)
20605 __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 381, __pyx_L1_error)
20606 __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(0, 587, __pyx_L1_error)
20607 __pyx_builtin_OverflowError = __Pyx_GetBuiltinName(__pyx_n_s_OverflowError); if (!__pyx_builtin_OverflowError) __PYX_ERR(0, 657, __pyx_L1_error)
20608 __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(0, 679, __pyx_L1_error)
20609 __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(3, 120, __pyx_L1_error)
20610 return 0;
20611 __pyx_L1_error:;
20612 return -1;
20613 }
20614 /* #### Code section: cached_constants ### */
20615
20616 static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
20617 __Pyx_RefNannyDeclarations
20618 __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
20619
20620 /* "pysam/libchtslib.pyx":110
20621 * def fileno(self):
20622 * if self.fp == NULL:
20623 * raise IOError('operation on closed HFile') # <<<<<<<<<<<<<<
20624 * if isinstance(self.name, int):
20625 * return self.name
20626 */
20627 __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_u_operation_on_closed_HFile); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 110, __pyx_L1_error)
20628 __Pyx_GOTREF(__pyx_tuple__5);
20629 __Pyx_GIVEREF(__pyx_tuple__5);
20630
20631 /* "pysam/libchtslib.pyx":114
20632 * return self.name
20633 * else:
20634 * raise AttributeError('fileno not available') # <<<<<<<<<<<<<<
20635 *
20636 * def __enter__(self):
20637 */
20638 __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_u_fileno_not_available); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 114, __pyx_L1_error)
20639 __Pyx_GOTREF(__pyx_tuple__6);
20640 __Pyx_GIVEREF(__pyx_tuple__6);
20641
20642 /* "pysam/libchtslib.pyx":381
20643 * VARIANTS, INDEX, REGIONS"""
20644 * if not self.htsfile:
20645 * raise ValueError('metadata not available on closed file') # <<<<<<<<<<<<<<
20646 * return FORMAT_CATEGORIES[self.htsfile.format.category]
20647 *
20648 */
20649 __pyx_tuple__39 = PyTuple_Pack(1, __pyx_kp_u_metadata_not_available_on_closed); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 381, __pyx_L1_error)
20650 __Pyx_GOTREF(__pyx_tuple__39);
20651 __Pyx_GIVEREF(__pyx_tuple__39);
20652
20653 /* "pysam/libchtslib.pyx":486
20654 * """move file pointer to position *offset*, see :meth:`pysam.HTSFile.tell`."""
20655 * if not self.is_open:
20656 * raise ValueError('I/O operation on closed file') # <<<<<<<<<<<<<<
20657 * if self.is_stream:
20658 * raise IOError('seek not available in streams')
20659 */
20660 __pyx_tuple__43 = PyTuple_Pack(1, __pyx_kp_u_I_O_operation_on_closed_file); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(0, 486, __pyx_L1_error)
20661 __Pyx_GOTREF(__pyx_tuple__43);
20662 __Pyx_GIVEREF(__pyx_tuple__43);
20663
20664 /* "pysam/libchtslib.pyx":488
20665 * raise ValueError('I/O operation on closed file')
20666 * if self.is_stream:
20667 * raise IOError('seek not available in streams') # <<<<<<<<<<<<<<
20668 *
20669 * whence = libc_whence_from_io(whence)
20670 */
20671 __pyx_tuple__44 = PyTuple_Pack(1, __pyx_kp_u_seek_not_available_in_streams); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(0, 488, __pyx_L1_error)
20672 __Pyx_GOTREF(__pyx_tuple__44);
20673 __Pyx_GIVEREF(__pyx_tuple__44);
20674
20675 /* "pysam/libchtslib.pyx":508
20676 * raise ValueError('I/O operation on closed file')
20677 * if self.is_stream:
20678 * raise IOError('tell not available in streams') # <<<<<<<<<<<<<<
20679 *
20680 * cdef int64_t ret
20681 */
20682 __pyx_tuple__46 = PyTuple_Pack(1, __pyx_kp_u_tell_not_available_in_streams); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(0, 508, __pyx_L1_error)
20683 __Pyx_GOTREF(__pyx_tuple__46);
20684 __Pyx_GIVEREF(__pyx_tuple__46);
20685
20686 /* "pysam/libchtslib.pyx":550
20687 *
20688 * # Replicate mode normalization done in hts_open_format
20689 * smode = self.mode.replace(b'b', b'').replace(b'c', b'') # <<<<<<<<<<<<<<
20690 * if b'b' in self.mode:
20691 * smode += b'b'
20692 */
20693 __pyx_tuple__47 = PyTuple_Pack(2, __pyx_n_b_b, __pyx_kp_b__13); if (unlikely(!__pyx_tuple__47)) __PYX_ERR(0, 550, __pyx_L1_error)
20694 __Pyx_GOTREF(__pyx_tuple__47);
20695 __Pyx_GIVEREF(__pyx_tuple__47);
20696 __pyx_tuple__48 = PyTuple_Pack(2, __pyx_n_b_c, __pyx_kp_b__13); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(0, 550, __pyx_L1_error)
20697 __Pyx_GOTREF(__pyx_tuple__48);
20698 __Pyx_GIVEREF(__pyx_tuple__48);
20699
20700 /* "pysam/libchtslib.pyx":559
20701 * hfile = hdopen(dup_fd, cmode)
20702 * if hfile == NULL:
20703 * raise IOError('Cannot create hfile') # <<<<<<<<<<<<<<
20704 *
20705 * try:
20706 */
20707 __pyx_tuple__49 = PyTuple_Pack(1, __pyx_kp_u_Cannot_create_hfile); if (unlikely(!__pyx_tuple__49)) __PYX_ERR(0, 559, __pyx_L1_error)
20708 __Pyx_GOTREF(__pyx_tuple__49);
20709 __Pyx_GIVEREF(__pyx_tuple__49);
20710
20711 /* "pysam/libchtslib.pyx":592
20712 * if rval != 0:
20713 * hts_opt_free(opts)
20714 * raise RuntimeError('An error occurred while applying the requested format options') # <<<<<<<<<<<<<<
20715 * hts_opt_free(opts)
20716 *
20717 */
20718 __pyx_tuple__51 = PyTuple_Pack(1, __pyx_kp_u_An_error_occurred_while_applying); if (unlikely(!__pyx_tuple__51)) __PYX_ERR(0, 592, __pyx_L1_error)
20719 __Pyx_GOTREF(__pyx_tuple__51);
20720 __Pyx_GIVEREF(__pyx_tuple__51);
20721
20722 /* "pysam/libchtslib.pyx":640
20723 * if reference is not None:
20724 * if contig is not None:
20725 * raise ValueError('contig and reference should not both be specified') # <<<<<<<<<<<<<<
20726 * contig = reference
20727 *
20728 */
20729 __pyx_tuple__53 = PyTuple_Pack(1, __pyx_kp_u_contig_and_reference_should_not); if (unlikely(!__pyx_tuple__53)) __PYX_ERR(0, 640, __pyx_L1_error)
20730 __Pyx_GOTREF(__pyx_tuple__53);
20731 __Pyx_GIVEREF(__pyx_tuple__53);
20732
20733 /* "pysam/libchtslib.pyx":645
20734 * if end is not None:
20735 * if stop is not None:
20736 * raise ValueError('stop and end should not both be specified') # <<<<<<<<<<<<<<
20737 * stop = end
20738 *
20739 */
20740 __pyx_tuple__54 = PyTuple_Pack(1, __pyx_kp_u_stop_and_end_should_not_both_be); if (unlikely(!__pyx_tuple__54)) __PYX_ERR(0, 645, __pyx_L1_error)
20741 __Pyx_GOTREF(__pyx_tuple__54);
20742 __Pyx_GIVEREF(__pyx_tuple__54);
20743
20744 /* "pysam/libchtslib.pyx":679
20745 * if tid is not None:
20746 * if not self.is_valid_tid(tid):
20747 * raise IndexError('invalid tid') # <<<<<<<<<<<<<<
20748 * rtid = tid
20749 * else:
20750 */
20751 __pyx_tuple__57 = PyTuple_Pack(1, __pyx_kp_u_invalid_tid); if (unlikely(!__pyx_tuple__57)) __PYX_ERR(0, 679, __pyx_L1_error)
20752 __Pyx_GOTREF(__pyx_tuple__57);
20753 __Pyx_GIVEREF(__pyx_tuple__57);
20754
20755 /* "pysam/libchtslib.pyx":41
20756 * cdef int MAX_POS = (1 << 31) - 1
20757 *
20758 * cdef tuple FORMAT_CATEGORIES = ('UNKNOWN', 'ALIGNMENTS', 'VARIANTS', 'INDEX', 'REGIONS') # <<<<<<<<<<<<<<
20759 * cdef tuple FORMATS = ('UNKNOWN', 'BINARY_FORMAT', 'TEXT_FORMAT', 'SAM', 'BAM', 'BAI', 'CRAM', 'CRAI',
20760 * 'VCF', 'BCF', 'CSI', 'GZI', 'TBI', 'BED')
20761 */
20762 __pyx_tuple__66 = PyTuple_Pack(5, __pyx_n_u_UNKNOWN, __pyx_n_u_ALIGNMENTS, __pyx_n_u_VARIANTS, __pyx_n_u_INDEX, __pyx_n_u_REGIONS); if (unlikely(!__pyx_tuple__66)) __PYX_ERR(0, 41, __pyx_L1_error)
20763 __Pyx_GOTREF(__pyx_tuple__66);
20764 __Pyx_GIVEREF(__pyx_tuple__66);
20765
20766 /* "pysam/libchtslib.pyx":42
20767 *
20768 * cdef tuple FORMAT_CATEGORIES = ('UNKNOWN', 'ALIGNMENTS', 'VARIANTS', 'INDEX', 'REGIONS')
20769 * cdef tuple FORMATS = ('UNKNOWN', 'BINARY_FORMAT', 'TEXT_FORMAT', 'SAM', 'BAM', 'BAI', 'CRAM', 'CRAI', # <<<<<<<<<<<<<<
20770 * 'VCF', 'BCF', 'CSI', 'GZI', 'TBI', 'BED')
20771 * cdef tuple COMPRESSION = ('NONE', 'GZIP', 'BGZF', 'CUSTOM')
20772 */
20773 __pyx_tuple__67 = PyTuple_Pack(14, __pyx_n_u_UNKNOWN, __pyx_n_u_BINARY_FORMAT, __pyx_n_u_TEXT_FORMAT, __pyx_n_u_SAM, __pyx_n_u_BAM, __pyx_n_u_BAI, __pyx_n_u_CRAM, __pyx_n_u_CRAI, __pyx_n_u_VCF, __pyx_n_u_BCF, __pyx_n_u_CSI, __pyx_n_u_GZI, __pyx_n_u_TBI, __pyx_n_u_BED); if (unlikely(!__pyx_tuple__67)) __PYX_ERR(0, 42, __pyx_L1_error)
20774 __Pyx_GOTREF(__pyx_tuple__67);
20775 __Pyx_GIVEREF(__pyx_tuple__67);
20776
20777 /* "pysam/libchtslib.pyx":44
20778 * cdef tuple FORMATS = ('UNKNOWN', 'BINARY_FORMAT', 'TEXT_FORMAT', 'SAM', 'BAM', 'BAI', 'CRAM', 'CRAI',
20779 * 'VCF', 'BCF', 'CSI', 'GZI', 'TBI', 'BED')
20780 * cdef tuple COMPRESSION = ('NONE', 'GZIP', 'BGZF', 'CUSTOM') # <<<<<<<<<<<<<<
20781 *
20782 *
20783 */
20784 __pyx_tuple__68 = PyTuple_Pack(4, __pyx_n_u_NONE, __pyx_n_u_GZIP, __pyx_n_u_BGZF, __pyx_n_u_CUSTOM); if (unlikely(!__pyx_tuple__68)) __PYX_ERR(0, 44, __pyx_L1_error)
20785 __Pyx_GOTREF(__pyx_tuple__68);
20786 __Pyx_GIVEREF(__pyx_tuple__68);
20787
20788 /* "pysam/libchtslib.pyx":53
20789 *
20790 *
20791 * cpdef set_verbosity(int verbosity): # <<<<<<<<<<<<<<
20792 * """Set htslib's hts_verbose global variable to the specified value."""
20793 * return hts_set_verbosity(verbosity)
20794 */
20795 __pyx_tuple__69 = PyTuple_Pack(1, __pyx_n_s_verbosity); if (unlikely(!__pyx_tuple__69)) __PYX_ERR(0, 53, __pyx_L1_error)
20796 __Pyx_GOTREF(__pyx_tuple__69);
20797 __Pyx_GIVEREF(__pyx_tuple__69);
20798 __pyx_codeobj_ = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__69, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libchtslib_pyx, __pyx_n_s_set_verbosity, 53, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj_)) __PYX_ERR(0, 53, __pyx_L1_error)
20799
20800 /* "pysam/libchtslib.pyx":57
20801 * return hts_set_verbosity(verbosity)
20802 *
20803 * cpdef get_verbosity(): # <<<<<<<<<<<<<<
20804 * """Return the value of htslib's hts_verbose global variable."""
20805 * return hts_get_verbosity()
20806 */
20807 __pyx_codeobj__2 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libchtslib_pyx, __pyx_n_s_get_verbosity, 57, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__2)) __PYX_ERR(0, 57, __pyx_L1_error)
20808
20809 /* "pysam/libchtslib.pyx":98
20810 * raise IOError(errno, 'failed to open HFile', self.name)
20811 *
20812 * def close(self): # <<<<<<<<<<<<<<
20813 * if self.fp == NULL:
20814 * return
20815 */
20816 __pyx_tuple__70 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_fp); if (unlikely(!__pyx_tuple__70)) __PYX_ERR(0, 98, __pyx_L1_error)
20817 __Pyx_GOTREF(__pyx_tuple__70);
20818 __Pyx_GIVEREF(__pyx_tuple__70);
20819 __pyx_codeobj__3 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__70, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libchtslib_pyx, __pyx_n_s_close, 98, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__3)) __PYX_ERR(0, 98, __pyx_L1_error)
20820
20821 /* "pysam/libchtslib.pyx":108
20822 * raise IOError(errno, 'failed to close HFile', self.name)
20823 *
20824 * def fileno(self): # <<<<<<<<<<<<<<
20825 * if self.fp == NULL:
20826 * raise IOError('operation on closed HFile')
20827 */
20828 __pyx_tuple__71 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__71)) __PYX_ERR(0, 108, __pyx_L1_error)
20829 __Pyx_GOTREF(__pyx_tuple__71);
20830 __Pyx_GIVEREF(__pyx_tuple__71);
20831 __pyx_codeobj__4 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__71, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libchtslib_pyx, __pyx_n_s_fileno, 108, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__4)) __PYX_ERR(0, 108, __pyx_L1_error)
20832
20833 /* "pysam/libchtslib.pyx":116
20834 * raise AttributeError('fileno not available')
20835 *
20836 * def __enter__(self): # <<<<<<<<<<<<<<
20837 * return self
20838 *
20839 */
20840 __pyx_codeobj__7 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__71, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libchtslib_pyx, __pyx_n_s_enter, 116, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__7)) __PYX_ERR(0, 116, __pyx_L1_error)
20841
20842 /* "pysam/libchtslib.pyx":119
20843 * return self
20844 *
20845 * def __exit__(self, type, value, tb): # <<<<<<<<<<<<<<
20846 * self.close()
20847 *
20848 */
20849 __pyx_tuple__72 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_type, __pyx_n_s_value, __pyx_n_s_tb); if (unlikely(!__pyx_tuple__72)) __PYX_ERR(0, 119, __pyx_L1_error)
20850 __Pyx_GOTREF(__pyx_tuple__72);
20851 __Pyx_GIVEREF(__pyx_tuple__72);
20852 __pyx_codeobj__8 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__72, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libchtslib_pyx, __pyx_n_s_exit, 119, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__8)) __PYX_ERR(0, 119, __pyx_L1_error)
20853
20854 /* "pysam/libchtslib.pyx":131
20855 * return line
20856 *
20857 * def flush(self): # <<<<<<<<<<<<<<
20858 * if self.fp == NULL:
20859 * raise IOError('operation on closed HFile')
20860 */
20861 __pyx_codeobj__9 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__71, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libchtslib_pyx, __pyx_n_s_flush, 131, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) __PYX_ERR(0, 131, __pyx_L1_error)
20862
20863 /* "pysam/libchtslib.pyx":137
20864 * raise IOError(herrno(self.fp), 'failed to flush HFile', self.name)
20865 *
20866 * def isatty(self): # <<<<<<<<<<<<<<
20867 * if self.fp == NULL:
20868 * raise IOError('operation on closed HFile')
20869 */
20870 __pyx_codeobj__10 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__71, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libchtslib_pyx, __pyx_n_s_isatty, 137, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__10)) __PYX_ERR(0, 137, __pyx_L1_error)
20871
20872 /* "pysam/libchtslib.pyx":142
20873 * return False
20874 *
20875 * def readable(self): # <<<<<<<<<<<<<<
20876 * return self.fp != NULL and 'r' in self.mode
20877 *
20878 */
20879 __pyx_codeobj__11 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__71, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libchtslib_pyx, __pyx_n_s_readable, 142, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__11)) __PYX_ERR(0, 142, __pyx_L1_error)
20880
20881 /* "pysam/libchtslib.pyx":145
20882 * return self.fp != NULL and 'r' in self.mode
20883 *
20884 * def read(self, Py_ssize_t size=-1): # <<<<<<<<<<<<<<
20885 * if self.fp == NULL:
20886 * raise IOError('operation on closed HFile')
20887 */
20888 __pyx_tuple__73 = PyTuple_Pack(8, __pyx_n_s_self, __pyx_n_s_size, __pyx_n_s_parts, __pyx_n_s_part, __pyx_n_s_chunk_size, __pyx_n_s_ret, __pyx_n_s_bytes_read, __pyx_n_s_cpart); if (unlikely(!__pyx_tuple__73)) __PYX_ERR(0, 145, __pyx_L1_error)
20889 __Pyx_GOTREF(__pyx_tuple__73);
20890 __Pyx_GIVEREF(__pyx_tuple__73);
20891 __pyx_codeobj__12 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__73, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libchtslib_pyx, __pyx_n_s_read, 145, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__12)) __PYX_ERR(0, 145, __pyx_L1_error)
20892 __pyx_tuple__74 = PyTuple_Pack(1, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__74)) __PYX_ERR(0, 145, __pyx_L1_error)
20893 __Pyx_GOTREF(__pyx_tuple__74);
20894 __Pyx_GIVEREF(__pyx_tuple__74);
20895
20896 /* "pysam/libchtslib.pyx":180
20897 * return b''.join(parts)
20898 *
20899 * def readall(self): # <<<<<<<<<<<<<<
20900 * return self.read()
20901 *
20902 */
20903 __pyx_codeobj__14 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__71, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libchtslib_pyx, __pyx_n_s_readall, 180, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__14)) __PYX_ERR(0, 180, __pyx_L1_error)
20904
20905 /* "pysam/libchtslib.pyx":183
20906 * return self.read()
20907 *
20908 * def readinto(self, buf): # <<<<<<<<<<<<<<
20909 * if self.fp == NULL:
20910 * raise IOError('operation on closed HFile')
20911 */
20912 __pyx_tuple__75 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_buf, __pyx_n_s_size, __pyx_n_s_mv, __pyx_n_s_ret); if (unlikely(!__pyx_tuple__75)) __PYX_ERR(0, 183, __pyx_L1_error)
20913 __Pyx_GOTREF(__pyx_tuple__75);
20914 __Pyx_GIVEREF(__pyx_tuple__75);
20915 __pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__75, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libchtslib_pyx, __pyx_n_s_readinto, 183, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) __PYX_ERR(0, 183, __pyx_L1_error)
20916
20917 /* "pysam/libchtslib.pyx":200
20918 * return ret
20919 *
20920 * def readline(self, Py_ssize_t size=-1): # <<<<<<<<<<<<<<
20921 * if self.fp == NULL:
20922 * raise IOError('operation on closed HFile')
20923 */
20924 __pyx_codeobj__16 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__73, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libchtslib_pyx, __pyx_n_s_readline, 200, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__16)) __PYX_ERR(0, 200, __pyx_L1_error)
20925
20926 /* "pysam/libchtslib.pyx":241
20927 * return b''.join(parts)
20928 *
20929 * def readlines(self): # <<<<<<<<<<<<<<
20930 * return list(self)
20931 *
20932 */
20933 __pyx_codeobj__17 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__71, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libchtslib_pyx, __pyx_n_s_readlines, 241, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__17)) __PYX_ERR(0, 241, __pyx_L1_error)
20934
20935 /* "pysam/libchtslib.pyx":244
20936 * return list(self)
20937 *
20938 * def seek(self, Py_ssize_t offset, int whence=io.SEEK_SET): # <<<<<<<<<<<<<<
20939 * if self.fp == NULL:
20940 * raise IOError('operation on closed HFile')
20941 */
20942 __pyx_tuple__76 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_offset, __pyx_n_s_whence, __pyx_n_s_off); if (unlikely(!__pyx_tuple__76)) __PYX_ERR(0, 244, __pyx_L1_error)
20943 __Pyx_GOTREF(__pyx_tuple__76);
20944 __Pyx_GIVEREF(__pyx_tuple__76);
20945 __pyx_codeobj__19 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__76, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libchtslib_pyx, __pyx_n_s_seek, 244, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__19)) __PYX_ERR(0, 244, __pyx_L1_error)
20946
20947 /* "pysam/libchtslib.pyx":255
20948 * return off
20949 *
20950 * def tell(self): # <<<<<<<<<<<<<<
20951 * if self.fp == NULL:
20952 * raise IOError('operation on closed HFile')
20953 */
20954 __pyx_tuple__77 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_ret); if (unlikely(!__pyx_tuple__77)) __PYX_ERR(0, 255, __pyx_L1_error)
20955 __Pyx_GOTREF(__pyx_tuple__77);
20956 __Pyx_GIVEREF(__pyx_tuple__77);
20957 __pyx_codeobj__20 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__77, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libchtslib_pyx, __pyx_n_s_tell, 255, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) __PYX_ERR(0, 255, __pyx_L1_error)
20958
20959 /* "pysam/libchtslib.pyx":266
20960 * return ret
20961 *
20962 * def seekable(self): # <<<<<<<<<<<<<<
20963 * return self.fp != NULL
20964 *
20965 */
20966 __pyx_codeobj__21 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__71, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libchtslib_pyx, __pyx_n_s_seekable, 266, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__21)) __PYX_ERR(0, 266, __pyx_L1_error)
20967
20968 /* "pysam/libchtslib.pyx":269
20969 * return self.fp != NULL
20970 *
20971 * def truncate(self, size=None): # <<<<<<<<<<<<<<
20972 * raise NotImplementedError()
20973 *
20974 */
20975 __pyx_tuple__78 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_size); if (unlikely(!__pyx_tuple__78)) __PYX_ERR(0, 269, __pyx_L1_error)
20976 __Pyx_GOTREF(__pyx_tuple__78);
20977 __Pyx_GIVEREF(__pyx_tuple__78);
20978 __pyx_codeobj__22 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__78, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libchtslib_pyx, __pyx_n_s_truncate, 269, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__22)) __PYX_ERR(0, 269, __pyx_L1_error)
20979 __pyx_tuple__79 = PyTuple_Pack(1, Py_None); if (unlikely(!__pyx_tuple__79)) __PYX_ERR(0, 269, __pyx_L1_error)
20980 __Pyx_GOTREF(__pyx_tuple__79);
20981 __Pyx_GIVEREF(__pyx_tuple__79);
20982
20983 /* "pysam/libchtslib.pyx":272
20984 * raise NotImplementedError()
20985 *
20986 * def writable(self): # <<<<<<<<<<<<<<
20987 * return self.fp != NULL and 'w' in self.mode
20988 *
20989 */
20990 __pyx_codeobj__23 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__71, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libchtslib_pyx, __pyx_n_s_writable, 272, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__23)) __PYX_ERR(0, 272, __pyx_L1_error)
20991
20992 /* "pysam/libchtslib.pyx":275
20993 * return self.fp != NULL and 'w' in self.mode
20994 *
20995 * def write(self, bytes b): # <<<<<<<<<<<<<<
20996 * if self.fp == NULL:
20997 * raise IOError('operation on closed HFile')
20998 */
20999 __pyx_tuple__80 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_b, __pyx_n_s_got); if (unlikely(!__pyx_tuple__80)) __PYX_ERR(0, 275, __pyx_L1_error)
21000 __Pyx_GOTREF(__pyx_tuple__80);
21001 __Pyx_GIVEREF(__pyx_tuple__80);
21002 __pyx_codeobj__24 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__80, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libchtslib_pyx, __pyx_n_s_write, 275, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __PYX_ERR(0, 275, __pyx_L1_error)
21003
21004 /* "pysam/libchtslib.pyx":286
21005 * return got
21006 *
21007 * def writelines(self, lines): # <<<<<<<<<<<<<<
21008 * for line in lines:
21009 * self.write(line)
21010 */
21011 __pyx_tuple__81 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_lines, __pyx_n_s_line); if (unlikely(!__pyx_tuple__81)) __PYX_ERR(0, 286, __pyx_L1_error)
21012 __Pyx_GOTREF(__pyx_tuple__81);
21013 __Pyx_GIVEREF(__pyx_tuple__81);
21014 __pyx_codeobj__25 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__81, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libchtslib_pyx, __pyx_n_s_writelines, 286, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__25)) __PYX_ERR(0, 286, __pyx_L1_error)
21015
21016 /* "(tree fragment)":1
21017 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
21018 * raise TypeError, "self.fp cannot be converted to a Python object for pickling"
21019 * def __setstate_cython__(self, __pyx_state):
21020 */
21021 __pyx_codeobj__26 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__71, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __PYX_ERR(1, 1, __pyx_L1_error)
21022
21023 /* "(tree fragment)":3
21024 * def __reduce_cython__(self):
21025 * raise TypeError, "self.fp cannot be converted to a Python object for pickling"
21026 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
21027 * raise TypeError, "self.fp cannot be converted to a Python object for pickling"
21028 */
21029 __pyx_tuple__82 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_pyx_state); if (unlikely(!__pyx_tuple__82)) __PYX_ERR(1, 3, __pyx_L1_error)
21030 __Pyx_GOTREF(__pyx_tuple__82);
21031 __Pyx_GIVEREF(__pyx_tuple__82);
21032 __pyx_codeobj__27 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__82, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_setstate_cython, 3, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__27)) __PYX_ERR(1, 3, __pyx_L1_error)
21033
21034 /* "pysam/libchtslib.pyx":297
21035 * ########################################################################
21036 *
21037 * class CallableValue(object): # <<<<<<<<<<<<<<
21038 * def __init__(self, value):
21039 * self.value = value
21040 */
21041 __pyx_tuple__83 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__83)) __PYX_ERR(0, 297, __pyx_L1_error)
21042 __Pyx_GOTREF(__pyx_tuple__83);
21043 __Pyx_GIVEREF(__pyx_tuple__83);
21044 __pyx_tuple__84 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__84)) __PYX_ERR(0, 297, __pyx_L1_error)
21045 __Pyx_GOTREF(__pyx_tuple__84);
21046 __Pyx_GIVEREF(__pyx_tuple__84);
21047
21048 /* "pysam/libchtslib.pyx":298
21049 *
21050 * class CallableValue(object):
21051 * def __init__(self, value): # <<<<<<<<<<<<<<
21052 * self.value = value
21053 * def __call__(self):
21054 */
21055 __pyx_tuple__85 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_value); if (unlikely(!__pyx_tuple__85)) __PYX_ERR(0, 298, __pyx_L1_error)
21056 __Pyx_GOTREF(__pyx_tuple__85);
21057 __Pyx_GIVEREF(__pyx_tuple__85);
21058 __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__85, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libchtslib_pyx, __pyx_n_s_init, 298, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 298, __pyx_L1_error)
21059
21060 /* "pysam/libchtslib.pyx":300
21061 * def __init__(self, value):
21062 * self.value = value
21063 * def __call__(self): # <<<<<<<<<<<<<<
21064 * return self.value
21065 * def __bool__(self):
21066 */
21067 __pyx_codeobj__29 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__71, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libchtslib_pyx, __pyx_n_s_call, 300, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__29)) __PYX_ERR(0, 300, __pyx_L1_error)
21068
21069 /* "pysam/libchtslib.pyx":302
21070 * def __call__(self):
21071 * return self.value
21072 * def __bool__(self): # <<<<<<<<<<<<<<
21073 * return self.value
21074 * def __nonzero__(self):
21075 */
21076 __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__71, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libchtslib_pyx, __pyx_n_s_bool, 302, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(0, 302, __pyx_L1_error)
21077
21078 /* "pysam/libchtslib.pyx":304
21079 * def __bool__(self):
21080 * return self.value
21081 * def __nonzero__(self): # <<<<<<<<<<<<<<
21082 * return self.value
21083 * def __eq__(self, other):
21084 */
21085 __pyx_codeobj__31 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__71, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libchtslib_pyx, __pyx_n_s_nonzero, 304, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__31)) __PYX_ERR(0, 304, __pyx_L1_error)
21086
21087 /* "pysam/libchtslib.pyx":306
21088 * def __nonzero__(self):
21089 * return self.value
21090 * def __eq__(self, other): # <<<<<<<<<<<<<<
21091 * return self.value == other
21092 * def __ne__(self, other):
21093 */
21094 __pyx_tuple__86 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_other); if (unlikely(!__pyx_tuple__86)) __PYX_ERR(0, 306, __pyx_L1_error)
21095 __Pyx_GOTREF(__pyx_tuple__86);
21096 __Pyx_GIVEREF(__pyx_tuple__86);
21097 __pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__86, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libchtslib_pyx, __pyx_n_s_eq, 306, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(0, 306, __pyx_L1_error)
21098
21099 /* "pysam/libchtslib.pyx":308
21100 * def __eq__(self, other):
21101 * return self.value == other
21102 * def __ne__(self, other): # <<<<<<<<<<<<<<
21103 * return self.value != other
21104 *
21105 */
21106 __pyx_codeobj__33 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__86, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libchtslib_pyx, __pyx_n_s_ne, 308, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__33)) __PYX_ERR(0, 308, __pyx_L1_error)
21107
21108 /* "pysam/libchtslib.pyx":312
21109 *
21110 *
21111 * CTrue = CallableValue(True) # <<<<<<<<<<<<<<
21112 * CFalse = CallableValue(False)
21113 *
21114 */
21115 __pyx_tuple__87 = PyTuple_Pack(1, Py_True); if (unlikely(!__pyx_tuple__87)) __PYX_ERR(0, 312, __pyx_L1_error)
21116 __Pyx_GOTREF(__pyx_tuple__87);
21117 __Pyx_GIVEREF(__pyx_tuple__87);
21118
21119 /* "pysam/libchtslib.pyx":313
21120 *
21121 * CTrue = CallableValue(True)
21122 * CFalse = CallableValue(False) # <<<<<<<<<<<<<<
21123 *
21124 *
21125 */
21126 __pyx_tuple__88 = PyTuple_Pack(1, Py_False); if (unlikely(!__pyx_tuple__88)) __PYX_ERR(0, 313, __pyx_L1_error)
21127 __Pyx_GOTREF(__pyx_tuple__88);
21128 __Pyx_GIVEREF(__pyx_tuple__88);
21129
21130 /* "pysam/libchtslib.pyx":331
21131 * self.duplicate_filehandle = True
21132 *
21133 * def close(self): # <<<<<<<<<<<<<<
21134 * if self.htsfile:
21135 * hts_close(self.htsfile)
21136 */
21137 __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__71, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libchtslib_pyx, __pyx_n_s_close, 331, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(0, 331, __pyx_L1_error)
21138
21139 /* "pysam/libchtslib.pyx":341
21140 * self.htsfile = NULL
21141 *
21142 * def flush(self): # <<<<<<<<<<<<<<
21143 * """Flush any buffered data to the underlying output stream."""
21144 * if self.htsfile:
21145 */
21146 __pyx_codeobj__35 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__71, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libchtslib_pyx, __pyx_n_s_flush, 341, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__35)) __PYX_ERR(0, 341, __pyx_L1_error)
21147
21148 /* "pysam/libchtslib.pyx":347
21149 * raise OSError(errno, f'Flushing {type(self).__name__} failed', force_str(self.filename))
21150 *
21151 * def check_truncation(self, ignore_truncation=False): # <<<<<<<<<<<<<<
21152 * """Check if file is truncated."""
21153 * if not self.htsfile:
21154 */
21155 __pyx_tuple__89 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_ignore_truncation, __pyx_n_s_bgzfp, __pyx_n_s_ret, __pyx_n_s_msg); if (unlikely(!__pyx_tuple__89)) __PYX_ERR(0, 347, __pyx_L1_error)
21156 __Pyx_GOTREF(__pyx_tuple__89);
21157 __Pyx_GIVEREF(__pyx_tuple__89);
21158 __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__89, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libchtslib_pyx, __pyx_n_s_check_truncation, 347, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(0, 347, __pyx_L1_error)
21159
21160 /* "pysam/libchtslib.pyx":369
21161 * raise IOError(msg)
21162 *
21163 * def __enter__(self): # <<<<<<<<<<<<<<
21164 * return self
21165 *
21166 */
21167 __pyx_codeobj__37 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__71, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libchtslib_pyx, __pyx_n_s_enter, 369, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__37)) __PYX_ERR(0, 369, __pyx_L1_error)
21168
21169 /* "pysam/libchtslib.pyx":372
21170 * return self
21171 *
21172 * def __exit__(self, exc_type, exc_value, traceback): # <<<<<<<<<<<<<<
21173 * self.close()
21174 * return False
21175 */
21176 __pyx_tuple__90 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_exc_type, __pyx_n_s_exc_value, __pyx_n_s_traceback); if (unlikely(!__pyx_tuple__90)) __PYX_ERR(0, 372, __pyx_L1_error)
21177 __Pyx_GOTREF(__pyx_tuple__90);
21178 __Pyx_GIVEREF(__pyx_tuple__90);
21179 __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(4, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__90, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libchtslib_pyx, __pyx_n_s_exit, 372, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) __PYX_ERR(0, 372, __pyx_L1_error)
21180
21181 /* "pysam/libchtslib.pyx":472
21182 * return self.htsfile != NULL and self.htsfile.format.format == bcf
21183 *
21184 * def reset(self): # <<<<<<<<<<<<<<
21185 * """reset file position to beginning of file just after the header.
21186 *
21187 */
21188 __pyx_codeobj__40 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__71, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libchtslib_pyx, __pyx_n_s_reset, 472, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__40)) __PYX_ERR(0, 472, __pyx_L1_error)
21189
21190 /* "pysam/libchtslib.pyx":483
21191 * return self.seek(self.start_offset)
21192 *
21193 * def seek(self, uint64_t offset, int whence=io.SEEK_SET): # <<<<<<<<<<<<<<
21194 * """move file pointer to position *offset*, see :meth:`pysam.HTSFile.tell`."""
21195 * if not self.is_open:
21196 */
21197 __pyx_tuple__91 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_offset, __pyx_n_s_whence, __pyx_n_s_ret); if (unlikely(!__pyx_tuple__91)) __PYX_ERR(0, 483, __pyx_L1_error)
21198 __Pyx_GOTREF(__pyx_tuple__91);
21199 __Pyx_GIVEREF(__pyx_tuple__91);
21200 __pyx_codeobj__42 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__91, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libchtslib_pyx, __pyx_n_s_seek, 483, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__42)) __PYX_ERR(0, 483, __pyx_L1_error)
21201
21202 /* "pysam/libchtslib.pyx":503
21203 * return ret
21204 *
21205 * def tell(self): # <<<<<<<<<<<<<<
21206 * """return current file position, see :meth:`pysam.HTSFile.seek`."""
21207 * if not self.is_open:
21208 */
21209 __pyx_codeobj__45 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__77, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libchtslib_pyx, __pyx_n_s_tell, 503, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__45)) __PYX_ERR(0, 503, __pyx_L1_error)
21210
21211 /* "pysam/libchtslib.pyx":575
21212 * return htsfile
21213 *
21214 * def add_hts_options(self, format_options=None): # <<<<<<<<<<<<<<
21215 * """Given a list of key=value format option strings, add them to an open htsFile
21216 * """
21217 */
21218 __pyx_tuple__92 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_format_options, __pyx_n_s_rval, __pyx_n_s_opts, __pyx_n_s_format_option); if (unlikely(!__pyx_tuple__92)) __PYX_ERR(0, 575, __pyx_L1_error)
21219 __Pyx_GOTREF(__pyx_tuple__92);
21220 __Pyx_GIVEREF(__pyx_tuple__92);
21221 __pyx_codeobj__50 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__92, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libchtslib_pyx, __pyx_n_s_add_hts_options, 575, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__50)) __PYX_ERR(0, 575, __pyx_L1_error)
21222
21223 /* "pysam/libchtslib.pyx":595
21224 * hts_opt_free(opts)
21225 *
21226 * def parse_region(self, contig=None, start=None, stop=None, # <<<<<<<<<<<<<<
21227 * region=None, tid=None,
21228 * reference=None, end=None):
21229 */
21230 __pyx_tuple__93 = PyTuple_Pack(13, __pyx_n_s_self, __pyx_n_s_contig, __pyx_n_s_start, __pyx_n_s_stop, __pyx_n_s_region, __pyx_n_s_tid, __pyx_n_s_reference, __pyx_n_s_end, __pyx_n_s_rtid, __pyx_n_s_rstart, __pyx_n_s_rstop, __pyx_n_s_coord, __pyx_n_s_parts); if (unlikely(!__pyx_tuple__93)) __PYX_ERR(0, 595, __pyx_L1_error)
21231 __Pyx_GOTREF(__pyx_tuple__93);
21232 __Pyx_GIVEREF(__pyx_tuple__93);
21233 __pyx_codeobj__52 = (PyObject*)__Pyx_PyCode_New(8, 0, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__93, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libchtslib_pyx, __pyx_n_s_parse_region, 595, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__52)) __PYX_ERR(0, 595, __pyx_L1_error)
21234 __pyx_tuple__94 = PyTuple_Pack(7, Py_None, Py_None, Py_None, Py_None, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__94)) __PYX_ERR(0, 595, __pyx_L1_error)
21235 __Pyx_GOTREF(__pyx_tuple__94);
21236 __Pyx_GIVEREF(__pyx_tuple__94);
21237
21238 /* "pysam/libchtslib.pyx":700
21239 * return 1, rtid, rstart, rstop
21240 *
21241 * def is_valid_tid(self, tid): # <<<<<<<<<<<<<<
21242 * """
21243 * return True if the numerical :term:`tid` is valid; False otherwise.
21244 */
21245 __pyx_tuple__95 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_tid); if (unlikely(!__pyx_tuple__95)) __PYX_ERR(0, 700, __pyx_L1_error)
21246 __Pyx_GOTREF(__pyx_tuple__95);
21247 __Pyx_GIVEREF(__pyx_tuple__95);
21248 __pyx_codeobj__60 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__95, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libchtslib_pyx, __pyx_n_s_is_valid_tid, 700, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__60)) __PYX_ERR(0, 700, __pyx_L1_error)
21249
21250 /* "pysam/libchtslib.pyx":708
21251 * raise NotImplementedError()
21252 *
21253 * def is_valid_reference_name(self, contig): # <<<<<<<<<<<<<<
21254 * """
21255 * return True if the contig name :term:`contig` is valid; False otherwise.
21256 */
21257 __pyx_tuple__96 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_contig); if (unlikely(!__pyx_tuple__96)) __PYX_ERR(0, 708, __pyx_L1_error)
21258 __Pyx_GOTREF(__pyx_tuple__96);
21259 __Pyx_GIVEREF(__pyx_tuple__96);
21260 __pyx_codeobj__61 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__96, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libchtslib_pyx, __pyx_n_s_is_valid_reference_name, 708, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__61)) __PYX_ERR(0, 708, __pyx_L1_error)
21261
21262 /* "pysam/libchtslib.pyx":714
21263 * return self.get_tid(contig) != -1
21264 *
21265 * def get_tid(self, contig): # <<<<<<<<<<<<<<
21266 * """
21267 * return the numerical :term:`tid` corresponding to
21268 */
21269 __pyx_codeobj__62 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__96, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libchtslib_pyx, __pyx_n_s_get_tid, 714, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__62)) __PYX_ERR(0, 714, __pyx_L1_error)
21270
21271 /* "pysam/libchtslib.pyx":723
21272 * raise NotImplementedError()
21273 *
21274 * def get_reference_name(self, tid): # <<<<<<<<<<<<<<
21275 * """
21276 * return :term:`contig` name corresponding to numerical :term:`tid`
21277 */
21278 __pyx_codeobj__63 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__95, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libchtslib_pyx, __pyx_n_s_get_reference_name, 723, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__63)) __PYX_ERR(0, 723, __pyx_L1_error)
21279
21280 /* "(tree fragment)":1
21281 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
21282 * raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
21283 * def __setstate_cython__(self, __pyx_state):
21284 */
21285 __pyx_codeobj__64 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__71, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__64)) __PYX_ERR(1, 1, __pyx_L1_error)
21286
21287 /* "(tree fragment)":3
21288 * def __reduce_cython__(self):
21289 * raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
21290 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
21291 * raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
21292 */
21293 __pyx_codeobj__65 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__82, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_setstate_cython, 3, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__65)) __PYX_ERR(1, 3, __pyx_L1_error)
21294 __Pyx_RefNannyFinishContext();
21295 return 0;
21296 __pyx_L1_error:;
21297 __Pyx_RefNannyFinishContext();
21298 return -1;
21299 }
21300 /* #### Code section: init_constants ### */
21301
21302 static CYTHON_SMALL_CODE int __Pyx_InitConstants(void) {
21303 if (__Pyx_CreateStringTabAndInitStrings() < 0) __PYX_ERR(0, 1, __pyx_L1_error);
21304 __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
21305 __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
21306 __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error)
21307 return 0;
21308 __pyx_L1_error:;
21309 return -1;
21310 }
21311 /* #### Code section: init_globals ### */
21312
21313 static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
21314 return 0;
21315 }
21316 /* #### Code section: init_module ### */
21317
21318 static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
21319 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
21320 static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
21321 static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
21322 static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
21323 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
21324 static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
21325
21326 static int __Pyx_modinit_global_init_code(void) {
21327 __Pyx_RefNannyDeclarations
21328 __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
21329 /*--- Global init code ---*/
21330 __pyx_v_5pysam_10libchtslib_FORMAT_CATEGORIES = ((PyObject*)Py_None); Py_INCREF(Py_None);
21331 __pyx_v_5pysam_10libchtslib_FORMATS = ((PyObject*)Py_None); Py_INCREF(Py_None);
21332 __pyx_v_5pysam_10libchtslib_COMPRESSION = ((PyObject*)Py_None); Py_INCREF(Py_None);
21333 __Pyx_RefNannyFinishContext();
21334 return 0;
21335 }
21336
21337 static int __Pyx_modinit_variable_export_code(void) {
21338 __Pyx_RefNannyDeclarations
21339 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
21340 /*--- Variable export code ---*/
21341 __Pyx_RefNannyFinishContext();
21342 return 0;
21343 }
21344
21345 static int __Pyx_modinit_function_export_code(void) {
21346 __Pyx_RefNannyDeclarations
21347 __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
21348 /*--- Function export code ---*/
21349 __Pyx_RefNannyFinishContext();
21350 return 0;
21351 }
21352
21353 static int __Pyx_modinit_type_init_code(void) {
21354 __Pyx_RefNannyDeclarations
21355 int __pyx_lineno = 0;
21356 const char *__pyx_filename = NULL;
21357 int __pyx_clineno = 0;
21358 __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
21359 /*--- Type init code ---*/
21360 __pyx_vtabptr_5pysam_10libchtslib_HTSFile = &__pyx_vtable_5pysam_10libchtslib_HTSFile;
21361 __pyx_vtable_5pysam_10libchtslib_HTSFile._open_htsfile = (htsFile *(*)(struct __pyx_obj_5pysam_10libchtslib_HTSFile *))__pyx_f_5pysam_10libchtslib_7HTSFile__open_htsfile;
21362 #if CYTHON_USE_TYPE_SPECS
21363 __pyx_ptype_5pysam_10libchtslib_HTSFile = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_10libchtslib_HTSFile_spec, NULL); if (unlikely(!__pyx_ptype_5pysam_10libchtslib_HTSFile)) __PYX_ERR(0, 321, __pyx_L1_error)
21364 if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_10libchtslib_HTSFile_spec, __pyx_ptype_5pysam_10libchtslib_HTSFile) < 0) __PYX_ERR(0, 321, __pyx_L1_error)
21365 #else
21366 __pyx_ptype_5pysam_10libchtslib_HTSFile = &__pyx_type_5pysam_10libchtslib_HTSFile;
21367 #endif
21368 #if !CYTHON_COMPILING_IN_LIMITED_API
21369 #endif
21370 #if !CYTHON_USE_TYPE_SPECS
21371 if (__Pyx_PyType_Ready(__pyx_ptype_5pysam_10libchtslib_HTSFile) < 0) __PYX_ERR(0, 321, __pyx_L1_error)
21372 #endif
21373 #if PY_MAJOR_VERSION < 3
21374 __pyx_ptype_5pysam_10libchtslib_HTSFile->tp_print = 0;
21375 #endif
21376 #if !CYTHON_COMPILING_IN_LIMITED_API
21377 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5pysam_10libchtslib_HTSFile->tp_dictoffset && __pyx_ptype_5pysam_10libchtslib_HTSFile->tp_getattro == PyObject_GenericGetAttr)) {
21378 __pyx_ptype_5pysam_10libchtslib_HTSFile->tp_getattro = __Pyx_PyObject_GenericGetAttr;
21379 }
21380 #endif
21381 if (__Pyx_SetVtable(__pyx_ptype_5pysam_10libchtslib_HTSFile, __pyx_vtabptr_5pysam_10libchtslib_HTSFile) < 0) __PYX_ERR(0, 321, __pyx_L1_error)
21382 #if !CYTHON_COMPILING_IN_LIMITED_API
21383 if (__Pyx_MergeVtables(__pyx_ptype_5pysam_10libchtslib_HTSFile) < 0) __PYX_ERR(0, 321, __pyx_L1_error)
21384 #endif
21385 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_HTSFile, (PyObject *) __pyx_ptype_5pysam_10libchtslib_HTSFile) < 0) __PYX_ERR(0, 321, __pyx_L1_error)
21386 #if !CYTHON_COMPILING_IN_LIMITED_API
21387 if (__Pyx_setup_reduce((PyObject *) __pyx_ptype_5pysam_10libchtslib_HTSFile) < 0) __PYX_ERR(0, 321, __pyx_L1_error)
21388 #endif
21389 __pyx_vtabptr_5pysam_10libchtslib_HFile = &__pyx_vtable_5pysam_10libchtslib_HFile;
21390 __pyx_vtable_5pysam_10libchtslib_HFile._open = (PyObject *(*)(struct __pyx_obj_5pysam_10libchtslib_HFile *, PyObject *, PyObject *, struct __pyx_opt_args_5pysam_10libchtslib_5HFile__open *__pyx_optional_args))__pyx_f_5pysam_10libchtslib_5HFile__open;
21391 #if CYTHON_USE_TYPE_SPECS
21392 __pyx_ptype_5pysam_10libchtslib_HFile = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_5pysam_10libchtslib_HFile_spec, NULL); if (unlikely(!__pyx_ptype_5pysam_10libchtslib_HFile)) __PYX_ERR(0, 67, __pyx_L1_error)
21393 if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_5pysam_10libchtslib_HFile_spec, __pyx_ptype_5pysam_10libchtslib_HFile) < 0) __PYX_ERR(0, 67, __pyx_L1_error)
21394 #else
21395 __pyx_ptype_5pysam_10libchtslib_HFile = &__pyx_type_5pysam_10libchtslib_HFile;
21396 #endif
21397 #if !CYTHON_COMPILING_IN_LIMITED_API
21398 #endif
21399 #if !CYTHON_USE_TYPE_SPECS
21400 if (__Pyx_PyType_Ready(__pyx_ptype_5pysam_10libchtslib_HFile) < 0) __PYX_ERR(0, 67, __pyx_L1_error)
21401 #endif
21402 #if PY_MAJOR_VERSION < 3
21403 __pyx_ptype_5pysam_10libchtslib_HFile->tp_print = 0;
21404 #endif
21405 #if !CYTHON_COMPILING_IN_LIMITED_API
21406 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_5pysam_10libchtslib_HFile->tp_dictoffset && __pyx_ptype_5pysam_10libchtslib_HFile->tp_getattro == PyObject_GenericGetAttr)) {
21407 __pyx_ptype_5pysam_10libchtslib_HFile->tp_getattro = __Pyx_PyObject_GenericGetAttr;
21408 }
21409 #endif
21410 if (__Pyx_SetVtable(__pyx_ptype_5pysam_10libchtslib_HFile, __pyx_vtabptr_5pysam_10libchtslib_HFile) < 0) __PYX_ERR(0, 67, __pyx_L1_error)
21411 #if !CYTHON_COMPILING_IN_LIMITED_API
21412 if (__Pyx_MergeVtables(__pyx_ptype_5pysam_10libchtslib_HFile) < 0) __PYX_ERR(0, 67, __pyx_L1_error)
21413 #endif
21414 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_HFile, (PyObject *) __pyx_ptype_5pysam_10libchtslib_HFile) < 0) __PYX_ERR(0, 67, __pyx_L1_error)
21415 #if !CYTHON_COMPILING_IN_LIMITED_API
21416 if (__Pyx_setup_reduce((PyObject *) __pyx_ptype_5pysam_10libchtslib_HFile) < 0) __PYX_ERR(0, 67, __pyx_L1_error)
21417 #endif
21418 __Pyx_RefNannyFinishContext();
21419 return 0;
21420 __pyx_L1_error:;
21421 __Pyx_RefNannyFinishContext();
21422 return -1;
21423 }
21424
21425 static int __Pyx_modinit_type_import_code(void) {
21426 __Pyx_RefNannyDeclarations
21427 PyObject *__pyx_t_1 = NULL;
21428 int __pyx_lineno = 0;
21429 const char *__pyx_filename = NULL;
21430 int __pyx_clineno = 0;
21431 __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
21432 /*--- Type import code ---*/
21433 __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 9, __pyx_L1_error)
21434 __Pyx_GOTREF(__pyx_t_1);
21435 __pyx_ptype_7cpython_4type_type = __Pyx_ImportType_3_0_11(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type",
21436 #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
21437 sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(PyTypeObject),
21438 #elif CYTHON_COMPILING_IN_LIMITED_API
21439 sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(PyTypeObject),
21440 #else
21441 sizeof(PyHeapTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(PyHeapTypeObject),
21442 #endif
21443 __Pyx_ImportType_CheckSize_Warn_3_0_11); if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(5, 9, __pyx_L1_error)
21444 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21445 __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 8, __pyx_L1_error)
21446 __Pyx_GOTREF(__pyx_t_1);
21447 __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType_3_0_11(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(PyBoolObject),__Pyx_ImportType_CheckSize_Warn_3_0_11); if (!__pyx_ptype_7cpython_4bool_bool) __PYX_ERR(6, 8, __pyx_L1_error)
21448 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21449 __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 15, __pyx_L1_error)
21450 __Pyx_GOTREF(__pyx_t_1);
21451 __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType_3_0_11(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(PyComplexObject),__Pyx_ImportType_CheckSize_Warn_3_0_11); if (!__pyx_ptype_7cpython_7complex_complex) __PYX_ERR(7, 15, __pyx_L1_error)
21452 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21453 __pyx_t_1 = PyImport_ImportModule("array"); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 69, __pyx_L1_error)
21454 __Pyx_GOTREF(__pyx_t_1);
21455 __pyx_ptype_7cpython_5array_array = __Pyx_ImportType_3_0_11(__pyx_t_1, "array", "array", sizeof(arrayobject), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(arrayobject),__Pyx_ImportType_CheckSize_Warn_3_0_11); if (!__pyx_ptype_7cpython_5array_array) __PYX_ERR(3, 69, __pyx_L1_error)
21456 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21457 __Pyx_RefNannyFinishContext();
21458 return 0;
21459 __pyx_L1_error:;
21460 __Pyx_XDECREF(__pyx_t_1);
21461 __Pyx_RefNannyFinishContext();
21462 return -1;
21463 }
21464
21465 static int __Pyx_modinit_variable_import_code(void) {
21466 __Pyx_RefNannyDeclarations
21467 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
21468 /*--- Variable import code ---*/
21469 __Pyx_RefNannyFinishContext();
21470 return 0;
21471 }
21472
21473 static int __Pyx_modinit_function_import_code(void) {
21474 __Pyx_RefNannyDeclarations
21475 PyObject *__pyx_t_1 = NULL;
21476 int __pyx_lineno = 0;
21477 const char *__pyx_filename = NULL;
21478 int __pyx_clineno = 0;
21479 __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
21480 /*--- Function import code ---*/
21481 __pyx_t_1 = PyImport_ImportModule("pysam.libcutils"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error)
21482 __Pyx_GOTREF(__pyx_t_1);
21483 if (__Pyx_ImportFunction_3_0_11(__pyx_t_1, "libc_whence_from_io", (void (**)(void))&__pyx_f_5pysam_9libcutils_libc_whence_from_io, "int (int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21484 if (__Pyx_ImportFunction_3_0_11(__pyx_t_1, "charptr_to_str", (void (**)(void))&__pyx_f_5pysam_9libcutils_charptr_to_str, "PyObject *(char const *, struct __pyx_opt_args_5pysam_9libcutils_charptr_to_str *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21485 if (__Pyx_ImportFunction_3_0_11(__pyx_t_1, "charptr_to_str_w_len", (void (**)(void))&__pyx_f_5pysam_9libcutils_charptr_to_str_w_len, "PyObject *(char const *, size_t, struct __pyx_opt_args_5pysam_9libcutils_charptr_to_str_w_len *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21486 if (__Pyx_ImportFunction_3_0_11(__pyx_t_1, "force_str", (void (**)(void))&__pyx_f_5pysam_9libcutils_force_str, "PyObject *(PyObject *, struct __pyx_opt_args_5pysam_9libcutils_force_str *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21487 if (__Pyx_ImportFunction_3_0_11(__pyx_t_1, "force_bytes", (void (**)(void))&__pyx_f_5pysam_9libcutils_force_bytes, "PyObject *(PyObject *, struct __pyx_opt_args_5pysam_9libcutils_force_bytes *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21488 if (__Pyx_ImportFunction_3_0_11(__pyx_t_1, "encode_filename", (void (**)(void))&__pyx_f_5pysam_9libcutils_encode_filename, "PyObject *(PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21489 if (__Pyx_ImportFunction_3_0_11(__pyx_t_1, "from_string_and_size", (void (**)(void))&__pyx_f_5pysam_9libcutils_from_string_and_size, "PyObject *(char const *, size_t)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21490 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21491 __Pyx_RefNannyFinishContext();
21492 return 0;
21493 __pyx_L1_error:;
21494 __Pyx_XDECREF(__pyx_t_1);
21495 __Pyx_RefNannyFinishContext();
21496 return -1;
21497 }
21498
21499
21500 #if PY_MAJOR_VERSION >= 3
21501 #if CYTHON_PEP489_MULTI_PHASE_INIT
21502 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
21503 static int __pyx_pymod_exec_libchtslib(PyObject* module); /*proto*/
21504 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
21505 {Py_mod_create, (void*)__pyx_pymod_create},
21506 {Py_mod_exec, (void*)__pyx_pymod_exec_libchtslib},
21507 {0, NULL}
21508 };
21509 #endif
21510
21511 #ifdef __cplusplus
21512 namespace {
21513 struct PyModuleDef __pyx_moduledef =
21514 #else
21515 static struct PyModuleDef __pyx_moduledef =
21516 #endif
21517 {
21518 PyModuleDef_HEAD_INIT,
21519 "libchtslib",
21520 0, /* m_doc */
21521 #if CYTHON_PEP489_MULTI_PHASE_INIT
21522 0, /* m_size */
21523 #elif CYTHON_USE_MODULE_STATE
21524 sizeof(__pyx_mstate), /* m_size */
21525 #else
21526 -1, /* m_size */
21527 #endif
21528 __pyx_methods /* m_methods */,
21529 #if CYTHON_PEP489_MULTI_PHASE_INIT
21530 __pyx_moduledef_slots, /* m_slots */
21531 #else
21532 NULL, /* m_reload */
21533 #endif
21534 #if CYTHON_USE_MODULE_STATE
21535 __pyx_m_traverse, /* m_traverse */
21536 __pyx_m_clear, /* m_clear */
21537 NULL /* m_free */
21538 #else
21539 NULL, /* m_traverse */
21540 NULL, /* m_clear */
21541 NULL /* m_free */
21542 #endif
21543 };
21544 #ifdef __cplusplus
21545 } /* anonymous namespace */
21546 #endif
21547 #endif
21548
21549 #ifndef CYTHON_NO_PYINIT_EXPORT
21550 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
21551 #elif PY_MAJOR_VERSION < 3
21552 #ifdef __cplusplus
21553 #define __Pyx_PyMODINIT_FUNC extern "C" void
21554 #else
21555 #define __Pyx_PyMODINIT_FUNC void
21556 #endif
21557 #else
21558 #ifdef __cplusplus
21559 #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
21560 #else
21561 #define __Pyx_PyMODINIT_FUNC PyObject *
21562 #endif
21563 #endif
21564
21565
21566 #if PY_MAJOR_VERSION < 3
21567 __Pyx_PyMODINIT_FUNC initlibchtslib(void) CYTHON_SMALL_CODE; /*proto*/
21568 __Pyx_PyMODINIT_FUNC initlibchtslib(void)
21569 #else
21570 __Pyx_PyMODINIT_FUNC PyInit_libchtslib(void) CYTHON_SMALL_CODE; /*proto*/
21571 __Pyx_PyMODINIT_FUNC PyInit_libchtslib(void)
21572 #if CYTHON_PEP489_MULTI_PHASE_INIT
21573 {
21574 return PyModuleDef_Init(&__pyx_moduledef);
21575 }
21576 static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
21577 #if PY_VERSION_HEX >= 0x030700A1
21578 static PY_INT64_T main_interpreter_id = -1;
21579 PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
21580 if (main_interpreter_id == -1) {
21581 main_interpreter_id = current_id;
21582 return (unlikely(current_id == -1)) ? -1 : 0;
21583 } else if (unlikely(main_interpreter_id != current_id))
21584 #else
21585 static PyInterpreterState *main_interpreter = NULL;
21586 PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
21587 if (!main_interpreter) {
21588 main_interpreter = current_interpreter;
21589 } else if (unlikely(main_interpreter != current_interpreter))
21590 #endif
21591 {
21592 PyErr_SetString(
21593 PyExc_ImportError,
21594 "Interpreter change detected - this module can only be loaded into one interpreter per process.");
21595 return -1;
21596 }
21597 return 0;
21598 }
21599 #if CYTHON_COMPILING_IN_LIMITED_API
21600 static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *module, const char* from_name, const char* to_name, int allow_none)
21601 #else
21602 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)
21603 #endif
21604 {
21605 PyObject *value = PyObject_GetAttrString(spec, from_name);
21606 int result = 0;
21607 if (likely(value)) {
21608 if (allow_none || value != Py_None) {
21609 #if CYTHON_COMPILING_IN_LIMITED_API
21610 result = PyModule_AddObject(module, to_name, value);
21611 #else
21612 result = PyDict_SetItemString(moddict, to_name, value);
21613 #endif
21614 }
21615 Py_DECREF(value);
21616 } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
21617 PyErr_Clear();
21618 } else {
21619 result = -1;
21620 }
21621 return result;
21622 }
21623 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def) {
21624 PyObject *module = NULL, *moddict, *modname;
21625 CYTHON_UNUSED_VAR(def);
21626 if (__Pyx_check_single_interpreter())
21627 return NULL;
21628 if (__pyx_m)
21629 return __Pyx_NewRef(__pyx_m);
21630 modname = PyObject_GetAttrString(spec, "name");
21631 if (unlikely(!modname)) goto bad;
21632 module = PyModule_NewObject(modname);
21633 Py_DECREF(modname);
21634 if (unlikely(!module)) goto bad;
21635 #if CYTHON_COMPILING_IN_LIMITED_API
21636 moddict = module;
21637 #else
21638 moddict = PyModule_GetDict(module);
21639 if (unlikely(!moddict)) goto bad;
21640 #endif
21641 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
21642 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
21643 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
21644 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
21645 return module;
21646 bad:
21647 Py_XDECREF(module);
21648 return NULL;
21649 }
21650
21651
21652 static CYTHON_SMALL_CODE int __pyx_pymod_exec_libchtslib(PyObject *__pyx_pyinit_module)
21653 #endif
21654 #endif
21655 {
21656 int stringtab_initialized = 0;
21657 #if CYTHON_USE_MODULE_STATE
21658 int pystate_addmodule_run = 0;
21659 #endif
21660 __Pyx_TraceDeclarations
21661 PyObject *__pyx_t_1 = NULL;
21662 PyObject *__pyx_t_2 = NULL;
21663 PyObject *__pyx_t_3 = NULL;
21664 int __pyx_t_4;
21665 PyObject *__pyx_t_5 = NULL;
21666 PyObject *__pyx_t_6 = NULL;
21667 int __pyx_lineno = 0;
21668 const char *__pyx_filename = NULL;
21669 int __pyx_clineno = 0;
21670 __Pyx_RefNannyDeclarations
21671 #if CYTHON_PEP489_MULTI_PHASE_INIT
21672 if (__pyx_m) {
21673 if (__pyx_m == __pyx_pyinit_module) return 0;
21674 PyErr_SetString(PyExc_RuntimeError, "Module 'libchtslib' has already been imported. Re-initialisation is not supported.");
21675 return -1;
21676 }
21677 #elif PY_MAJOR_VERSION >= 3
21678 if (__pyx_m) return __Pyx_NewRef(__pyx_m);
21679 #endif
21680 /*--- Module creation code ---*/
21681 #if CYTHON_PEP489_MULTI_PHASE_INIT
21682 __pyx_m = __pyx_pyinit_module;
21683 Py_INCREF(__pyx_m);
21684 #else
21685 #if PY_MAJOR_VERSION < 3
21686 __pyx_m = Py_InitModule4("libchtslib", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
21687 if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
21688 #elif CYTHON_USE_MODULE_STATE
21689 __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
21690 {
21691 int add_module_result = PyState_AddModule(__pyx_t_1, &__pyx_moduledef);
21692 __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to "libchtslib" pseudovariable */
21693 if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
21694 pystate_addmodule_run = 1;
21695 }
21696 #else
21697 __pyx_m = PyModule_Create(&__pyx_moduledef);
21698 if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
21699 #endif
21700 #endif
21701 CYTHON_UNUSED_VAR(__pyx_t_1);
21702 __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
21703 Py_INCREF(__pyx_d);
21704 __pyx_b = __Pyx_PyImport_AddModuleRef(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
21705 __pyx_cython_runtime = __Pyx_PyImport_AddModuleRef((const char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
21706 if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21707 #if CYTHON_REFNANNY
21708 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
21709 if (!__Pyx_RefNanny) {
21710 PyErr_Clear();
21711 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
21712 if (!__Pyx_RefNanny)
21713 Py_FatalError("failed to import 'refnanny' module");
21714 }
21715 #endif
21716 __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_libchtslib(void)", 0);
21717 if (__Pyx_check_binary_version(__PYX_LIMITED_VERSION_HEX, __Pyx_get_runtime_version(), CYTHON_COMPILING_IN_LIMITED_API) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21718 #ifdef __Pxy_PyFrame_Initialize_Offsets
21719 __Pxy_PyFrame_Initialize_Offsets();
21720 #endif
21721 __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
21722 __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
21723 __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
21724 #ifdef __Pyx_CyFunction_USED
21725 if (__pyx_CyFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21726 #endif
21727 #ifdef __Pyx_FusedFunction_USED
21728 if (__pyx_FusedFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21729 #endif
21730 #ifdef __Pyx_Coroutine_USED
21731 if (__pyx_Coroutine_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21732 #endif
21733 #ifdef __Pyx_Generator_USED
21734 if (__pyx_Generator_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21735 #endif
21736 #ifdef __Pyx_AsyncGen_USED
21737 if (__pyx_AsyncGen_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21738 #endif
21739 #ifdef __Pyx_StopAsyncIteration_USED
21740 if (__pyx_StopAsyncIteration_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21741 #endif
21742 /*--- Library function declarations ---*/
21743 /*--- Threads initialization code ---*/
21744 #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
21745 PyEval_InitThreads();
21746 #endif
21747 /*--- Initialize various global constants etc. ---*/
21748 if (__Pyx_InitConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21749 stringtab_initialized = 1;
21750 if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21751 #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
21752 if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21753 #endif
21754 if (__pyx_module_is_main_pysam__libchtslib) {
21755 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21756 }
21757 #if PY_MAJOR_VERSION >= 3
21758 {
21759 PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
21760 if (!PyDict_GetItemString(modules, "pysam.libchtslib")) {
21761 if (unlikely((PyDict_SetItemString(modules, "pysam.libchtslib", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
21762 }
21763 }
21764 #endif
21765 /*--- Builtin init code ---*/
21766 if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21767 /*--- Constants init code ---*/
21768 if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21769 /*--- Global type/function init code ---*/
21770 (void)__Pyx_modinit_global_init_code();
21771 (void)__Pyx_modinit_variable_export_code();
21772 (void)__Pyx_modinit_function_export_code();
21773 if (unlikely((__Pyx_modinit_type_init_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
21774 if (unlikely((__Pyx_modinit_type_import_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
21775 (void)__Pyx_modinit_variable_import_code();
21776 if (unlikely((__Pyx_modinit_function_import_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
21777 /*--- Execution code ---*/
21778 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
21779 if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21780 #endif
21781 __Pyx_TraceCall("__Pyx_PyMODINIT_FUNC PyInit_libchtslib(void)", __pyx_f[0], 1, 0, __PYX_ERR(0, 1, __pyx_L1_error));
21782
21783 /* "pysam/libchtslib.pyx":25
21784 * ########################################################################
21785 *
21786 * import os # <<<<<<<<<<<<<<
21787 * import io
21788 * import re
21789 */
21790 __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_n_s_os, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 25, __pyx_L1_error)
21791 __Pyx_GOTREF(__pyx_t_2);
21792 if (PyDict_SetItem(__pyx_d, __pyx_n_s_os, __pyx_t_2) < 0) __PYX_ERR(0, 25, __pyx_L1_error)
21793 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21794
21795 /* "pysam/libchtslib.pyx":26
21796 *
21797 * import os
21798 * import io # <<<<<<<<<<<<<<
21799 * import re
21800 * from warnings import warn
21801 */
21802 __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_n_s_io, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 26, __pyx_L1_error)
21803 __Pyx_GOTREF(__pyx_t_2);
21804 if (PyDict_SetItem(__pyx_d, __pyx_n_s_io, __pyx_t_2) < 0) __PYX_ERR(0, 26, __pyx_L1_error)
21805 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21806
21807 /* "pysam/libchtslib.pyx":27
21808 * import os
21809 * import io
21810 * import re # <<<<<<<<<<<<<<
21811 * from warnings import warn
21812 *
21813 */
21814 __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_n_s_re, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 27, __pyx_L1_error)
21815 __Pyx_GOTREF(__pyx_t_2);
21816 if (PyDict_SetItem(__pyx_d, __pyx_n_s_re, __pyx_t_2) < 0) __PYX_ERR(0, 27, __pyx_L1_error)
21817 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21818
21819 /* "pysam/libchtslib.pyx":28
21820 * import io
21821 * import re
21822 * from warnings import warn # <<<<<<<<<<<<<<
21823 *
21824 *
21825 */
21826 __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 28, __pyx_L1_error)
21827 __Pyx_GOTREF(__pyx_t_2);
21828 __Pyx_INCREF(__pyx_n_s_warn);
21829 __Pyx_GIVEREF(__pyx_n_s_warn);
21830 if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_warn)) __PYX_ERR(0, 28, __pyx_L1_error);
21831 __pyx_t_3 = __Pyx_Import(__pyx_n_s_warnings, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 28, __pyx_L1_error)
21832 __Pyx_GOTREF(__pyx_t_3);
21833 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21834 __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_warn); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 28, __pyx_L1_error)
21835 __Pyx_GOTREF(__pyx_t_2);
21836 if (PyDict_SetItem(__pyx_d, __pyx_n_s_warn, __pyx_t_2) < 0) __PYX_ERR(0, 28, __pyx_L1_error)
21837 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
21838 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21839
21840 /* "pysam/libchtslib.pyx":36
21841 * ########################################################################
21842 *
21843 * __all__ = ['get_verbosity', 'set_verbosity', 'HFile', 'HTSFile'] # <<<<<<<<<<<<<<
21844 *
21845 * # maximum genomic coordinace
21846 */
21847 __pyx_t_3 = PyList_New(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 36, __pyx_L1_error)
21848 __Pyx_GOTREF(__pyx_t_3);
21849 __Pyx_INCREF(__pyx_n_u_get_verbosity);
21850 __Pyx_GIVEREF(__pyx_n_u_get_verbosity);
21851 if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_u_get_verbosity)) __PYX_ERR(0, 36, __pyx_L1_error);
21852 __Pyx_INCREF(__pyx_n_u_set_verbosity);
21853 __Pyx_GIVEREF(__pyx_n_u_set_verbosity);
21854 if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 1, __pyx_n_u_set_verbosity)) __PYX_ERR(0, 36, __pyx_L1_error);
21855 __Pyx_INCREF(__pyx_n_u_HFile);
21856 __Pyx_GIVEREF(__pyx_n_u_HFile);
21857 if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 2, __pyx_n_u_HFile)) __PYX_ERR(0, 36, __pyx_L1_error);
21858 __Pyx_INCREF(__pyx_n_u_HTSFile);
21859 __Pyx_GIVEREF(__pyx_n_u_HTSFile);
21860 if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 3, __pyx_n_u_HTSFile)) __PYX_ERR(0, 36, __pyx_L1_error);
21861 if (PyDict_SetItem(__pyx_d, __pyx_n_s_all, __pyx_t_3) < 0) __PYX_ERR(0, 36, __pyx_L1_error)
21862 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21863
21864 /* "pysam/libchtslib.pyx":39
21865 *
21866 * # maximum genomic coordinace
21867 * cdef int MAX_POS = (1 << 31) - 1 # <<<<<<<<<<<<<<
21868 *
21869 * cdef tuple FORMAT_CATEGORIES = ('UNKNOWN', 'ALIGNMENTS', 'VARIANTS', 'INDEX', 'REGIONS')
21870 */
21871 __pyx_v_5pysam_10libchtslib_MAX_POS = 0x7fffffff;
21872
21873 /* "pysam/libchtslib.pyx":41
21874 * cdef int MAX_POS = (1 << 31) - 1
21875 *
21876 * cdef tuple FORMAT_CATEGORIES = ('UNKNOWN', 'ALIGNMENTS', 'VARIANTS', 'INDEX', 'REGIONS') # <<<<<<<<<<<<<<
21877 * cdef tuple FORMATS = ('UNKNOWN', 'BINARY_FORMAT', 'TEXT_FORMAT', 'SAM', 'BAM', 'BAI', 'CRAM', 'CRAI',
21878 * 'VCF', 'BCF', 'CSI', 'GZI', 'TBI', 'BED')
21879 */
21880 __Pyx_INCREF(__pyx_tuple__66);
21881 __Pyx_XGOTREF(__pyx_v_5pysam_10libchtslib_FORMAT_CATEGORIES);
21882 __Pyx_DECREF_SET(__pyx_v_5pysam_10libchtslib_FORMAT_CATEGORIES, __pyx_tuple__66);
21883 __Pyx_GIVEREF(__pyx_tuple__66);
21884
21885 /* "pysam/libchtslib.pyx":42
21886 *
21887 * cdef tuple FORMAT_CATEGORIES = ('UNKNOWN', 'ALIGNMENTS', 'VARIANTS', 'INDEX', 'REGIONS')
21888 * cdef tuple FORMATS = ('UNKNOWN', 'BINARY_FORMAT', 'TEXT_FORMAT', 'SAM', 'BAM', 'BAI', 'CRAM', 'CRAI', # <<<<<<<<<<<<<<
21889 * 'VCF', 'BCF', 'CSI', 'GZI', 'TBI', 'BED')
21890 * cdef tuple COMPRESSION = ('NONE', 'GZIP', 'BGZF', 'CUSTOM')
21891 */
21892 __Pyx_INCREF(__pyx_tuple__67);
21893 __Pyx_XGOTREF(__pyx_v_5pysam_10libchtslib_FORMATS);
21894 __Pyx_DECREF_SET(__pyx_v_5pysam_10libchtslib_FORMATS, __pyx_tuple__67);
21895 __Pyx_GIVEREF(__pyx_tuple__67);
21896
21897 /* "pysam/libchtslib.pyx":44
21898 * cdef tuple FORMATS = ('UNKNOWN', 'BINARY_FORMAT', 'TEXT_FORMAT', 'SAM', 'BAM', 'BAI', 'CRAM', 'CRAI',
21899 * 'VCF', 'BCF', 'CSI', 'GZI', 'TBI', 'BED')
21900 * cdef tuple COMPRESSION = ('NONE', 'GZIP', 'BGZF', 'CUSTOM') # <<<<<<<<<<<<<<
21901 *
21902 *
21903 */
21904 __Pyx_INCREF(__pyx_tuple__68);
21905 __Pyx_XGOTREF(__pyx_v_5pysam_10libchtslib_COMPRESSION);
21906 __Pyx_DECREF_SET(__pyx_v_5pysam_10libchtslib_COMPRESSION, __pyx_tuple__68);
21907 __Pyx_GIVEREF(__pyx_tuple__68);
21908
21909 /* "pysam/libchtslib.pyx":53
21910 *
21911 *
21912 * cpdef set_verbosity(int verbosity): # <<<<<<<<<<<<<<
21913 * """Set htslib's hts_verbose global variable to the specified value."""
21914 * return hts_set_verbosity(verbosity)
21915 */
21916 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_10libchtslib_1set_verbosity, 0, __pyx_n_s_set_verbosity, NULL, __pyx_n_s_pysam_libchtslib, __pyx_d, ((PyObject *)__pyx_codeobj_)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 53, __pyx_L1_error)
21917 __Pyx_GOTREF(__pyx_t_3);
21918 if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_verbosity, __pyx_t_3) < 0) __PYX_ERR(0, 53, __pyx_L1_error)
21919 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21920
21921 /* "pysam/libchtslib.pyx":57
21922 * return hts_set_verbosity(verbosity)
21923 *
21924 * cpdef get_verbosity(): # <<<<<<<<<<<<<<
21925 * """Return the value of htslib's hts_verbose global variable."""
21926 * return hts_get_verbosity()
21927 */
21928 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_10libchtslib_3get_verbosity, 0, __pyx_n_s_get_verbosity, NULL, __pyx_n_s_pysam_libchtslib, __pyx_d, ((PyObject *)__pyx_codeobj__2)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 57, __pyx_L1_error)
21929 __Pyx_GOTREF(__pyx_t_3);
21930 if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_verbosity, __pyx_t_3) < 0) __PYX_ERR(0, 57, __pyx_L1_error)
21931 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21932
21933 /* "pysam/libchtslib.pyx":98
21934 * raise IOError(errno, 'failed to open HFile', self.name)
21935 *
21936 * def close(self): # <<<<<<<<<<<<<<
21937 * if self.fp == NULL:
21938 * return
21939 */
21940 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_10libchtslib_5HFile_5close, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_HFile_close, NULL, __pyx_n_s_pysam_libchtslib, __pyx_d, ((PyObject *)__pyx_codeobj__3)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 98, __pyx_L1_error)
21941 __Pyx_GOTREF(__pyx_t_3);
21942 if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_10libchtslib_HFile, __pyx_n_s_close, __pyx_t_3) < 0) __PYX_ERR(0, 98, __pyx_L1_error)
21943 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21944 PyType_Modified(__pyx_ptype_5pysam_10libchtslib_HFile);
21945
21946 /* "pysam/libchtslib.pyx":108
21947 * raise IOError(errno, 'failed to close HFile', self.name)
21948 *
21949 * def fileno(self): # <<<<<<<<<<<<<<
21950 * if self.fp == NULL:
21951 * raise IOError('operation on closed HFile')
21952 */
21953 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_10libchtslib_5HFile_7fileno, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_HFile_fileno, NULL, __pyx_n_s_pysam_libchtslib, __pyx_d, ((PyObject *)__pyx_codeobj__4)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 108, __pyx_L1_error)
21954 __Pyx_GOTREF(__pyx_t_3);
21955 if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_10libchtslib_HFile, __pyx_n_s_fileno, __pyx_t_3) < 0) __PYX_ERR(0, 108, __pyx_L1_error)
21956 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21957 PyType_Modified(__pyx_ptype_5pysam_10libchtslib_HFile);
21958
21959 /* "pysam/libchtslib.pyx":116
21960 * raise AttributeError('fileno not available')
21961 *
21962 * def __enter__(self): # <<<<<<<<<<<<<<
21963 * return self
21964 *
21965 */
21966 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_10libchtslib_5HFile_9__enter__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_HFile___enter, NULL, __pyx_n_s_pysam_libchtslib, __pyx_d, ((PyObject *)__pyx_codeobj__7)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 116, __pyx_L1_error)
21967 __Pyx_GOTREF(__pyx_t_3);
21968 if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_10libchtslib_HFile, __pyx_n_s_enter, __pyx_t_3) < 0) __PYX_ERR(0, 116, __pyx_L1_error)
21969 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21970 PyType_Modified(__pyx_ptype_5pysam_10libchtslib_HFile);
21971
21972 /* "pysam/libchtslib.pyx":119
21973 * return self
21974 *
21975 * def __exit__(self, type, value, tb): # <<<<<<<<<<<<<<
21976 * self.close()
21977 *
21978 */
21979 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_10libchtslib_5HFile_11__exit__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_HFile___exit, NULL, __pyx_n_s_pysam_libchtslib, __pyx_d, ((PyObject *)__pyx_codeobj__8)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 119, __pyx_L1_error)
21980 __Pyx_GOTREF(__pyx_t_3);
21981 if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_10libchtslib_HFile, __pyx_n_s_exit, __pyx_t_3) < 0) __PYX_ERR(0, 119, __pyx_L1_error)
21982 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21983 PyType_Modified(__pyx_ptype_5pysam_10libchtslib_HFile);
21984
21985 /* "pysam/libchtslib.pyx":131
21986 * return line
21987 *
21988 * def flush(self): # <<<<<<<<<<<<<<
21989 * if self.fp == NULL:
21990 * raise IOError('operation on closed HFile')
21991 */
21992 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_10libchtslib_5HFile_17flush, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_HFile_flush, NULL, __pyx_n_s_pysam_libchtslib, __pyx_d, ((PyObject *)__pyx_codeobj__9)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 131, __pyx_L1_error)
21993 __Pyx_GOTREF(__pyx_t_3);
21994 if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_10libchtslib_HFile, __pyx_n_s_flush, __pyx_t_3) < 0) __PYX_ERR(0, 131, __pyx_L1_error)
21995 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
21996 PyType_Modified(__pyx_ptype_5pysam_10libchtslib_HFile);
21997
21998 /* "pysam/libchtslib.pyx":137
21999 * raise IOError(herrno(self.fp), 'failed to flush HFile', self.name)
22000 *
22001 * def isatty(self): # <<<<<<<<<<<<<<
22002 * if self.fp == NULL:
22003 * raise IOError('operation on closed HFile')
22004 */
22005 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_10libchtslib_5HFile_19isatty, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_HFile_isatty, NULL, __pyx_n_s_pysam_libchtslib, __pyx_d, ((PyObject *)__pyx_codeobj__10)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 137, __pyx_L1_error)
22006 __Pyx_GOTREF(__pyx_t_3);
22007 if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_10libchtslib_HFile, __pyx_n_s_isatty, __pyx_t_3) < 0) __PYX_ERR(0, 137, __pyx_L1_error)
22008 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22009 PyType_Modified(__pyx_ptype_5pysam_10libchtslib_HFile);
22010
22011 /* "pysam/libchtslib.pyx":142
22012 * return False
22013 *
22014 * def readable(self): # <<<<<<<<<<<<<<
22015 * return self.fp != NULL and 'r' in self.mode
22016 *
22017 */
22018 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_10libchtslib_5HFile_21readable, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_HFile_readable, NULL, __pyx_n_s_pysam_libchtslib, __pyx_d, ((PyObject *)__pyx_codeobj__11)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 142, __pyx_L1_error)
22019 __Pyx_GOTREF(__pyx_t_3);
22020 if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_10libchtslib_HFile, __pyx_n_s_readable, __pyx_t_3) < 0) __PYX_ERR(0, 142, __pyx_L1_error)
22021 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22022 PyType_Modified(__pyx_ptype_5pysam_10libchtslib_HFile);
22023
22024 /* "pysam/libchtslib.pyx":145
22025 * return self.fp != NULL and 'r' in self.mode
22026 *
22027 * def read(self, Py_ssize_t size=-1): # <<<<<<<<<<<<<<
22028 * if self.fp == NULL:
22029 * raise IOError('operation on closed HFile')
22030 */
22031 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_10libchtslib_5HFile_23read, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_HFile_read, NULL, __pyx_n_s_pysam_libchtslib, __pyx_d, ((PyObject *)__pyx_codeobj__12)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 145, __pyx_L1_error)
22032 __Pyx_GOTREF(__pyx_t_3);
22033 __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__74);
22034 if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_10libchtslib_HFile, __pyx_n_s_read, __pyx_t_3) < 0) __PYX_ERR(0, 145, __pyx_L1_error)
22035 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22036 PyType_Modified(__pyx_ptype_5pysam_10libchtslib_HFile);
22037
22038 /* "pysam/libchtslib.pyx":180
22039 * return b''.join(parts)
22040 *
22041 * def readall(self): # <<<<<<<<<<<<<<
22042 * return self.read()
22043 *
22044 */
22045 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_10libchtslib_5HFile_25readall, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_HFile_readall, NULL, __pyx_n_s_pysam_libchtslib, __pyx_d, ((PyObject *)__pyx_codeobj__14)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 180, __pyx_L1_error)
22046 __Pyx_GOTREF(__pyx_t_3);
22047 if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_10libchtslib_HFile, __pyx_n_s_readall, __pyx_t_3) < 0) __PYX_ERR(0, 180, __pyx_L1_error)
22048 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22049 PyType_Modified(__pyx_ptype_5pysam_10libchtslib_HFile);
22050
22051 /* "pysam/libchtslib.pyx":183
22052 * return self.read()
22053 *
22054 * def readinto(self, buf): # <<<<<<<<<<<<<<
22055 * if self.fp == NULL:
22056 * raise IOError('operation on closed HFile')
22057 */
22058 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_10libchtslib_5HFile_27readinto, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_HFile_readinto, NULL, __pyx_n_s_pysam_libchtslib, __pyx_d, ((PyObject *)__pyx_codeobj__15)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 183, __pyx_L1_error)
22059 __Pyx_GOTREF(__pyx_t_3);
22060 if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_10libchtslib_HFile, __pyx_n_s_readinto, __pyx_t_3) < 0) __PYX_ERR(0, 183, __pyx_L1_error)
22061 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22062 PyType_Modified(__pyx_ptype_5pysam_10libchtslib_HFile);
22063
22064 /* "pysam/libchtslib.pyx":200
22065 * return ret
22066 *
22067 * def readline(self, Py_ssize_t size=-1): # <<<<<<<<<<<<<<
22068 * if self.fp == NULL:
22069 * raise IOError('operation on closed HFile')
22070 */
22071 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_10libchtslib_5HFile_29readline, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_HFile_readline, NULL, __pyx_n_s_pysam_libchtslib, __pyx_d, ((PyObject *)__pyx_codeobj__16)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 200, __pyx_L1_error)
22072 __Pyx_GOTREF(__pyx_t_3);
22073 __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__74);
22074 if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_10libchtslib_HFile, __pyx_n_s_readline, __pyx_t_3) < 0) __PYX_ERR(0, 200, __pyx_L1_error)
22075 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22076 PyType_Modified(__pyx_ptype_5pysam_10libchtslib_HFile);
22077
22078 /* "pysam/libchtslib.pyx":241
22079 * return b''.join(parts)
22080 *
22081 * def readlines(self): # <<<<<<<<<<<<<<
22082 * return list(self)
22083 *
22084 */
22085 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_10libchtslib_5HFile_31readlines, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_HFile_readlines, NULL, __pyx_n_s_pysam_libchtslib, __pyx_d, ((PyObject *)__pyx_codeobj__17)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 241, __pyx_L1_error)
22086 __Pyx_GOTREF(__pyx_t_3);
22087 if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_10libchtslib_HFile, __pyx_n_s_readlines, __pyx_t_3) < 0) __PYX_ERR(0, 241, __pyx_L1_error)
22088 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22089 PyType_Modified(__pyx_ptype_5pysam_10libchtslib_HFile);
22090
22091 /* "pysam/libchtslib.pyx":244
22092 * return list(self)
22093 *
22094 * def seek(self, Py_ssize_t offset, int whence=io.SEEK_SET): # <<<<<<<<<<<<<<
22095 * if self.fp == NULL:
22096 * raise IOError('operation on closed HFile')
22097 */
22098 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_io); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 244, __pyx_L1_error)
22099 __Pyx_GOTREF(__pyx_t_3);
22100 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_SEEK_SET); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 244, __pyx_L1_error)
22101 __Pyx_GOTREF(__pyx_t_2);
22102 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22103 __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 244, __pyx_L1_error)
22104 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
22105 __pyx_k__18 = __pyx_t_4;
22106 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_io); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 244, __pyx_L1_error)
22107 __Pyx_GOTREF(__pyx_t_2);
22108 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_SEEK_SET); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 244, __pyx_L1_error)
22109 __Pyx_GOTREF(__pyx_t_3);
22110 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
22111 __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 244, __pyx_L1_error)
22112 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22113 __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 244, __pyx_L1_error)
22114 __Pyx_GOTREF(__pyx_t_3);
22115 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 244, __pyx_L1_error)
22116 __Pyx_GOTREF(__pyx_t_2);
22117 __Pyx_GIVEREF(__pyx_t_3);
22118 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3)) __PYX_ERR(0, 244, __pyx_L1_error);
22119 __pyx_t_3 = 0;
22120 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_10libchtslib_5HFile_33seek, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_HFile_seek, NULL, __pyx_n_s_pysam_libchtslib, __pyx_d, ((PyObject *)__pyx_codeobj__19)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 244, __pyx_L1_error)
22121 __Pyx_GOTREF(__pyx_t_3);
22122 __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_t_2);
22123 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
22124 if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_10libchtslib_HFile, __pyx_n_s_seek, __pyx_t_3) < 0) __PYX_ERR(0, 244, __pyx_L1_error)
22125 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22126 PyType_Modified(__pyx_ptype_5pysam_10libchtslib_HFile);
22127
22128 /* "pysam/libchtslib.pyx":255
22129 * return off
22130 *
22131 * def tell(self): # <<<<<<<<<<<<<<
22132 * if self.fp == NULL:
22133 * raise IOError('operation on closed HFile')
22134 */
22135 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_10libchtslib_5HFile_35tell, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_HFile_tell, NULL, __pyx_n_s_pysam_libchtslib, __pyx_d, ((PyObject *)__pyx_codeobj__20)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 255, __pyx_L1_error)
22136 __Pyx_GOTREF(__pyx_t_3);
22137 if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_10libchtslib_HFile, __pyx_n_s_tell, __pyx_t_3) < 0) __PYX_ERR(0, 255, __pyx_L1_error)
22138 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22139 PyType_Modified(__pyx_ptype_5pysam_10libchtslib_HFile);
22140
22141 /* "pysam/libchtslib.pyx":266
22142 * return ret
22143 *
22144 * def seekable(self): # <<<<<<<<<<<<<<
22145 * return self.fp != NULL
22146 *
22147 */
22148 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_10libchtslib_5HFile_37seekable, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_HFile_seekable, NULL, __pyx_n_s_pysam_libchtslib, __pyx_d, ((PyObject *)__pyx_codeobj__21)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 266, __pyx_L1_error)
22149 __Pyx_GOTREF(__pyx_t_3);
22150 if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_10libchtslib_HFile, __pyx_n_s_seekable, __pyx_t_3) < 0) __PYX_ERR(0, 266, __pyx_L1_error)
22151 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22152 PyType_Modified(__pyx_ptype_5pysam_10libchtslib_HFile);
22153
22154 /* "pysam/libchtslib.pyx":269
22155 * return self.fp != NULL
22156 *
22157 * def truncate(self, size=None): # <<<<<<<<<<<<<<
22158 * raise NotImplementedError()
22159 *
22160 */
22161 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_10libchtslib_5HFile_39truncate, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_HFile_truncate, NULL, __pyx_n_s_pysam_libchtslib, __pyx_d, ((PyObject *)__pyx_codeobj__22)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 269, __pyx_L1_error)
22162 __Pyx_GOTREF(__pyx_t_3);
22163 __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__79);
22164 if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_10libchtslib_HFile, __pyx_n_s_truncate, __pyx_t_3) < 0) __PYX_ERR(0, 269, __pyx_L1_error)
22165 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22166 PyType_Modified(__pyx_ptype_5pysam_10libchtslib_HFile);
22167
22168 /* "pysam/libchtslib.pyx":272
22169 * raise NotImplementedError()
22170 *
22171 * def writable(self): # <<<<<<<<<<<<<<
22172 * return self.fp != NULL and 'w' in self.mode
22173 *
22174 */
22175 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_10libchtslib_5HFile_41writable, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_HFile_writable, NULL, __pyx_n_s_pysam_libchtslib, __pyx_d, ((PyObject *)__pyx_codeobj__23)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 272, __pyx_L1_error)
22176 __Pyx_GOTREF(__pyx_t_3);
22177 if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_10libchtslib_HFile, __pyx_n_s_writable, __pyx_t_3) < 0) __PYX_ERR(0, 272, __pyx_L1_error)
22178 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22179 PyType_Modified(__pyx_ptype_5pysam_10libchtslib_HFile);
22180
22181 /* "pysam/libchtslib.pyx":275
22182 * return self.fp != NULL and 'w' in self.mode
22183 *
22184 * def write(self, bytes b): # <<<<<<<<<<<<<<
22185 * if self.fp == NULL:
22186 * raise IOError('operation on closed HFile')
22187 */
22188 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_10libchtslib_5HFile_43write, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_HFile_write, NULL, __pyx_n_s_pysam_libchtslib, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 275, __pyx_L1_error)
22189 __Pyx_GOTREF(__pyx_t_3);
22190 if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_10libchtslib_HFile, __pyx_n_s_write, __pyx_t_3) < 0) __PYX_ERR(0, 275, __pyx_L1_error)
22191 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22192 PyType_Modified(__pyx_ptype_5pysam_10libchtslib_HFile);
22193
22194 /* "pysam/libchtslib.pyx":286
22195 * return got
22196 *
22197 * def writelines(self, lines): # <<<<<<<<<<<<<<
22198 * for line in lines:
22199 * self.write(line)
22200 */
22201 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_10libchtslib_5HFile_45writelines, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_HFile_writelines, NULL, __pyx_n_s_pysam_libchtslib, __pyx_d, ((PyObject *)__pyx_codeobj__25)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 286, __pyx_L1_error)
22202 __Pyx_GOTREF(__pyx_t_3);
22203 if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_10libchtslib_HFile, __pyx_n_s_writelines, __pyx_t_3) < 0) __PYX_ERR(0, 286, __pyx_L1_error)
22204 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22205 PyType_Modified(__pyx_ptype_5pysam_10libchtslib_HFile);
22206
22207 /* "(tree fragment)":1
22208 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
22209 * raise TypeError, "self.fp cannot be converted to a Python object for pickling"
22210 * def __setstate_cython__(self, __pyx_state):
22211 */
22212 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_10libchtslib_5HFile_47__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_HFile___reduce_cython, NULL, __pyx_n_s_pysam_libchtslib, __pyx_d, ((PyObject *)__pyx_codeobj__26)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1, __pyx_L1_error)
22213 __Pyx_GOTREF(__pyx_t_3);
22214 if (PyDict_SetItem(__pyx_d, __pyx_n_s_reduce_cython, __pyx_t_3) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
22215 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22216
22217 /* "(tree fragment)":3
22218 * def __reduce_cython__(self):
22219 * raise TypeError, "self.fp cannot be converted to a Python object for pickling"
22220 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
22221 * raise TypeError, "self.fp cannot be converted to a Python object for pickling"
22222 */
22223 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_10libchtslib_5HFile_49__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_HFile___setstate_cython, NULL, __pyx_n_s_pysam_libchtslib, __pyx_d, ((PyObject *)__pyx_codeobj__27)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3, __pyx_L1_error)
22224 __Pyx_GOTREF(__pyx_t_3);
22225 if (PyDict_SetItem(__pyx_d, __pyx_n_s_setstate_cython, __pyx_t_3) < 0) __PYX_ERR(1, 3, __pyx_L1_error)
22226 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22227
22228 /* "pysam/libchtslib.pyx":297
22229 * ########################################################################
22230 *
22231 * class CallableValue(object): # <<<<<<<<<<<<<<
22232 * def __init__(self, value):
22233 * self.value = value
22234 */
22235 __pyx_t_3 = __Pyx_PEP560_update_bases(__pyx_tuple__84); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 297, __pyx_L1_error)
22236 __Pyx_GOTREF(__pyx_t_3);
22237 __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 297, __pyx_L1_error)
22238 __Pyx_GOTREF(__pyx_t_2);
22239 __pyx_t_5 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_3, __pyx_n_s_CallableValue, __pyx_n_s_CallableValue, (PyObject *) NULL, __pyx_n_s_pysam_libchtslib, (PyObject *) NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 297, __pyx_L1_error)
22240 __Pyx_GOTREF(__pyx_t_5);
22241 if (__pyx_t_3 != __pyx_tuple__84) {
22242 if (unlikely((PyDict_SetItemString(__pyx_t_5, "__orig_bases__", __pyx_tuple__84) < 0))) __PYX_ERR(0, 297, __pyx_L1_error)
22243 }
22244
22245 /* "pysam/libchtslib.pyx":298
22246 *
22247 * class CallableValue(object):
22248 * def __init__(self, value): # <<<<<<<<<<<<<<
22249 * self.value = value
22250 * def __call__(self):
22251 */
22252 __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_10libchtslib_13CallableValue_1__init__, 0, __pyx_n_s_CallableValue___init, NULL, __pyx_n_s_pysam_libchtslib, __pyx_d, ((PyObject *)__pyx_codeobj__28)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 298, __pyx_L1_error)
22253 __Pyx_GOTREF(__pyx_t_6);
22254 if (__Pyx_SetNameInClass(__pyx_t_5, __pyx_n_s_init, __pyx_t_6) < 0) __PYX_ERR(0, 298, __pyx_L1_error)
22255 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
22256
22257 /* "pysam/libchtslib.pyx":300
22258 * def __init__(self, value):
22259 * self.value = value
22260 * def __call__(self): # <<<<<<<<<<<<<<
22261 * return self.value
22262 * def __bool__(self):
22263 */
22264 __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_10libchtslib_13CallableValue_3__call__, 0, __pyx_n_s_CallableValue___call, NULL, __pyx_n_s_pysam_libchtslib, __pyx_d, ((PyObject *)__pyx_codeobj__29)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 300, __pyx_L1_error)
22265 __Pyx_GOTREF(__pyx_t_6);
22266 if (__Pyx_SetNameInClass(__pyx_t_5, __pyx_n_s_call, __pyx_t_6) < 0) __PYX_ERR(0, 300, __pyx_L1_error)
22267 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
22268
22269 /* "pysam/libchtslib.pyx":302
22270 * def __call__(self):
22271 * return self.value
22272 * def __bool__(self): # <<<<<<<<<<<<<<
22273 * return self.value
22274 * def __nonzero__(self):
22275 */
22276 __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_10libchtslib_13CallableValue_5__bool__, 0, __pyx_n_s_CallableValue___bool, NULL, __pyx_n_s_pysam_libchtslib, __pyx_d, ((PyObject *)__pyx_codeobj__30)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 302, __pyx_L1_error)
22277 __Pyx_GOTREF(__pyx_t_6);
22278 if (__Pyx_SetNameInClass(__pyx_t_5, __pyx_n_s_bool, __pyx_t_6) < 0) __PYX_ERR(0, 302, __pyx_L1_error)
22279 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
22280
22281 /* "pysam/libchtslib.pyx":304
22282 * def __bool__(self):
22283 * return self.value
22284 * def __nonzero__(self): # <<<<<<<<<<<<<<
22285 * return self.value
22286 * def __eq__(self, other):
22287 */
22288 __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_10libchtslib_13CallableValue_7__nonzero__, 0, __pyx_n_s_CallableValue___nonzero, NULL, __pyx_n_s_pysam_libchtslib, __pyx_d, ((PyObject *)__pyx_codeobj__31)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 304, __pyx_L1_error)
22289 __Pyx_GOTREF(__pyx_t_6);
22290 if (__Pyx_SetNameInClass(__pyx_t_5, __pyx_n_s_nonzero, __pyx_t_6) < 0) __PYX_ERR(0, 304, __pyx_L1_error)
22291 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
22292
22293 /* "pysam/libchtslib.pyx":306
22294 * def __nonzero__(self):
22295 * return self.value
22296 * def __eq__(self, other): # <<<<<<<<<<<<<<
22297 * return self.value == other
22298 * def __ne__(self, other):
22299 */
22300 __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_10libchtslib_13CallableValue_9__eq__, 0, __pyx_n_s_CallableValue___eq, NULL, __pyx_n_s_pysam_libchtslib, __pyx_d, ((PyObject *)__pyx_codeobj__32)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 306, __pyx_L1_error)
22301 __Pyx_GOTREF(__pyx_t_6);
22302 if (__Pyx_SetNameInClass(__pyx_t_5, __pyx_n_s_eq, __pyx_t_6) < 0) __PYX_ERR(0, 306, __pyx_L1_error)
22303 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
22304
22305 /* "pysam/libchtslib.pyx":308
22306 * def __eq__(self, other):
22307 * return self.value == other
22308 * def __ne__(self, other): # <<<<<<<<<<<<<<
22309 * return self.value != other
22310 *
22311 */
22312 __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_10libchtslib_13CallableValue_11__ne__, 0, __pyx_n_s_CallableValue___ne, NULL, __pyx_n_s_pysam_libchtslib, __pyx_d, ((PyObject *)__pyx_codeobj__33)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 308, __pyx_L1_error)
22313 __Pyx_GOTREF(__pyx_t_6);
22314 if (__Pyx_SetNameInClass(__pyx_t_5, __pyx_n_s_ne, __pyx_t_6) < 0) __PYX_ERR(0, 308, __pyx_L1_error)
22315 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
22316
22317 /* "pysam/libchtslib.pyx":297
22318 * ########################################################################
22319 *
22320 * class CallableValue(object): # <<<<<<<<<<<<<<
22321 * def __init__(self, value):
22322 * self.value = value
22323 */
22324 __pyx_t_6 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_CallableValue, __pyx_t_3, __pyx_t_5, NULL, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 297, __pyx_L1_error)
22325 __Pyx_GOTREF(__pyx_t_6);
22326 if (PyDict_SetItem(__pyx_d, __pyx_n_s_CallableValue, __pyx_t_6) < 0) __PYX_ERR(0, 297, __pyx_L1_error)
22327 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
22328 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
22329 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
22330 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22331
22332 /* "pysam/libchtslib.pyx":312
22333 *
22334 *
22335 * CTrue = CallableValue(True) # <<<<<<<<<<<<<<
22336 * CFalse = CallableValue(False)
22337 *
22338 */
22339 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_CallableValue); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 312, __pyx_L1_error)
22340 __Pyx_GOTREF(__pyx_t_3);
22341 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__87, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 312, __pyx_L1_error)
22342 __Pyx_GOTREF(__pyx_t_2);
22343 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22344 if (PyDict_SetItem(__pyx_d, __pyx_n_s_CTrue, __pyx_t_2) < 0) __PYX_ERR(0, 312, __pyx_L1_error)
22345 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
22346
22347 /* "pysam/libchtslib.pyx":313
22348 *
22349 * CTrue = CallableValue(True)
22350 * CFalse = CallableValue(False) # <<<<<<<<<<<<<<
22351 *
22352 *
22353 */
22354 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_CallableValue); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 313, __pyx_L1_error)
22355 __Pyx_GOTREF(__pyx_t_2);
22356 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__88, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 313, __pyx_L1_error)
22357 __Pyx_GOTREF(__pyx_t_3);
22358 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
22359 if (PyDict_SetItem(__pyx_d, __pyx_n_s_CFalse, __pyx_t_3) < 0) __PYX_ERR(0, 313, __pyx_L1_error)
22360 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22361
22362 /* "pysam/libchtslib.pyx":331
22363 * self.duplicate_filehandle = True
22364 *
22365 * def close(self): # <<<<<<<<<<<<<<
22366 * if self.htsfile:
22367 * hts_close(self.htsfile)
22368 */
22369 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_10libchtslib_7HTSFile_3close, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_HTSFile_close, NULL, __pyx_n_s_pysam_libchtslib, __pyx_d, ((PyObject *)__pyx_codeobj__34)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 331, __pyx_L1_error)
22370 __Pyx_GOTREF(__pyx_t_3);
22371 if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_10libchtslib_HTSFile, __pyx_n_s_close, __pyx_t_3) < 0) __PYX_ERR(0, 331, __pyx_L1_error)
22372 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22373 PyType_Modified(__pyx_ptype_5pysam_10libchtslib_HTSFile);
22374
22375 /* "pysam/libchtslib.pyx":341
22376 * self.htsfile = NULL
22377 *
22378 * def flush(self): # <<<<<<<<<<<<<<
22379 * """Flush any buffered data to the underlying output stream."""
22380 * if self.htsfile:
22381 */
22382 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_10libchtslib_7HTSFile_7flush, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_HTSFile_flush, NULL, __pyx_n_s_pysam_libchtslib, __pyx_d, ((PyObject *)__pyx_codeobj__35)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 341, __pyx_L1_error)
22383 __Pyx_GOTREF(__pyx_t_3);
22384 if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_10libchtslib_HTSFile, __pyx_n_s_flush, __pyx_t_3) < 0) __PYX_ERR(0, 341, __pyx_L1_error)
22385 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22386 PyType_Modified(__pyx_ptype_5pysam_10libchtslib_HTSFile);
22387
22388 /* "pysam/libchtslib.pyx":347
22389 * raise OSError(errno, f'Flushing {type(self).__name__} failed', force_str(self.filename))
22390 *
22391 * def check_truncation(self, ignore_truncation=False): # <<<<<<<<<<<<<<
22392 * """Check if file is truncated."""
22393 * if not self.htsfile:
22394 */
22395 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_10libchtslib_7HTSFile_9check_truncation, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_HTSFile_check_truncation, NULL, __pyx_n_s_pysam_libchtslib, __pyx_d, ((PyObject *)__pyx_codeobj__36)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 347, __pyx_L1_error)
22396 __Pyx_GOTREF(__pyx_t_3);
22397 __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__88);
22398 if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_10libchtslib_HTSFile, __pyx_n_s_check_truncation, __pyx_t_3) < 0) __PYX_ERR(0, 347, __pyx_L1_error)
22399 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22400 PyType_Modified(__pyx_ptype_5pysam_10libchtslib_HTSFile);
22401
22402 /* "pysam/libchtslib.pyx":369
22403 * raise IOError(msg)
22404 *
22405 * def __enter__(self): # <<<<<<<<<<<<<<
22406 * return self
22407 *
22408 */
22409 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_10libchtslib_7HTSFile_11__enter__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_HTSFile___enter, NULL, __pyx_n_s_pysam_libchtslib, __pyx_d, ((PyObject *)__pyx_codeobj__37)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 369, __pyx_L1_error)
22410 __Pyx_GOTREF(__pyx_t_3);
22411 if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_10libchtslib_HTSFile, __pyx_n_s_enter, __pyx_t_3) < 0) __PYX_ERR(0, 369, __pyx_L1_error)
22412 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22413 PyType_Modified(__pyx_ptype_5pysam_10libchtslib_HTSFile);
22414
22415 /* "pysam/libchtslib.pyx":372
22416 * return self
22417 *
22418 * def __exit__(self, exc_type, exc_value, traceback): # <<<<<<<<<<<<<<
22419 * self.close()
22420 * return False
22421 */
22422 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_10libchtslib_7HTSFile_13__exit__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_HTSFile___exit, NULL, __pyx_n_s_pysam_libchtslib, __pyx_d, ((PyObject *)__pyx_codeobj__38)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 372, __pyx_L1_error)
22423 __Pyx_GOTREF(__pyx_t_3);
22424 if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_10libchtslib_HTSFile, __pyx_n_s_exit, __pyx_t_3) < 0) __PYX_ERR(0, 372, __pyx_L1_error)
22425 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22426 PyType_Modified(__pyx_ptype_5pysam_10libchtslib_HTSFile);
22427
22428 /* "pysam/libchtslib.pyx":472
22429 * return self.htsfile != NULL and self.htsfile.format.format == bcf
22430 *
22431 * def reset(self): # <<<<<<<<<<<<<<
22432 * """reset file position to beginning of file just after the header.
22433 *
22434 */
22435 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_10libchtslib_7HTSFile_15reset, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_HTSFile_reset, NULL, __pyx_n_s_pysam_libchtslib, __pyx_d, ((PyObject *)__pyx_codeobj__40)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 472, __pyx_L1_error)
22436 __Pyx_GOTREF(__pyx_t_3);
22437 if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_10libchtslib_HTSFile, __pyx_n_s_reset, __pyx_t_3) < 0) __PYX_ERR(0, 472, __pyx_L1_error)
22438 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22439 PyType_Modified(__pyx_ptype_5pysam_10libchtslib_HTSFile);
22440
22441 /* "pysam/libchtslib.pyx":483
22442 * return self.seek(self.start_offset)
22443 *
22444 * def seek(self, uint64_t offset, int whence=io.SEEK_SET): # <<<<<<<<<<<<<<
22445 * """move file pointer to position *offset*, see :meth:`pysam.HTSFile.tell`."""
22446 * if not self.is_open:
22447 */
22448 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_io); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 483, __pyx_L1_error)
22449 __Pyx_GOTREF(__pyx_t_3);
22450 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_SEEK_SET); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 483, __pyx_L1_error)
22451 __Pyx_GOTREF(__pyx_t_2);
22452 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22453 __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 483, __pyx_L1_error)
22454 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
22455 __pyx_k__41 = __pyx_t_4;
22456 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_io); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 483, __pyx_L1_error)
22457 __Pyx_GOTREF(__pyx_t_2);
22458 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_SEEK_SET); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 483, __pyx_L1_error)
22459 __Pyx_GOTREF(__pyx_t_3);
22460 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
22461 __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 483, __pyx_L1_error)
22462 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22463 __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 483, __pyx_L1_error)
22464 __Pyx_GOTREF(__pyx_t_3);
22465 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 483, __pyx_L1_error)
22466 __Pyx_GOTREF(__pyx_t_2);
22467 __Pyx_GIVEREF(__pyx_t_3);
22468 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3)) __PYX_ERR(0, 483, __pyx_L1_error);
22469 __pyx_t_3 = 0;
22470 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_10libchtslib_7HTSFile_17seek, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_HTSFile_seek, NULL, __pyx_n_s_pysam_libchtslib, __pyx_d, ((PyObject *)__pyx_codeobj__42)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 483, __pyx_L1_error)
22471 __Pyx_GOTREF(__pyx_t_3);
22472 __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_t_2);
22473 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
22474 if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_10libchtslib_HTSFile, __pyx_n_s_seek, __pyx_t_3) < 0) __PYX_ERR(0, 483, __pyx_L1_error)
22475 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22476 PyType_Modified(__pyx_ptype_5pysam_10libchtslib_HTSFile);
22477
22478 /* "pysam/libchtslib.pyx":503
22479 * return ret
22480 *
22481 * def tell(self): # <<<<<<<<<<<<<<
22482 * """return current file position, see :meth:`pysam.HTSFile.seek`."""
22483 * if not self.is_open:
22484 */
22485 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_10libchtslib_7HTSFile_19tell, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_HTSFile_tell, NULL, __pyx_n_s_pysam_libchtslib, __pyx_d, ((PyObject *)__pyx_codeobj__45)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 503, __pyx_L1_error)
22486 __Pyx_GOTREF(__pyx_t_3);
22487 if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_10libchtslib_HTSFile, __pyx_n_s_tell, __pyx_t_3) < 0) __PYX_ERR(0, 503, __pyx_L1_error)
22488 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22489 PyType_Modified(__pyx_ptype_5pysam_10libchtslib_HTSFile);
22490
22491 /* "pysam/libchtslib.pyx":575
22492 * return htsfile
22493 *
22494 * def add_hts_options(self, format_options=None): # <<<<<<<<<<<<<<
22495 * """Given a list of key=value format option strings, add them to an open htsFile
22496 * """
22497 */
22498 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_10libchtslib_7HTSFile_21add_hts_options, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_HTSFile_add_hts_options, NULL, __pyx_n_s_pysam_libchtslib, __pyx_d, ((PyObject *)__pyx_codeobj__50)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 575, __pyx_L1_error)
22499 __Pyx_GOTREF(__pyx_t_3);
22500 __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__79);
22501 if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_10libchtslib_HTSFile, __pyx_n_s_add_hts_options, __pyx_t_3) < 0) __PYX_ERR(0, 575, __pyx_L1_error)
22502 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22503 PyType_Modified(__pyx_ptype_5pysam_10libchtslib_HTSFile);
22504
22505 /* "pysam/libchtslib.pyx":595
22506 * hts_opt_free(opts)
22507 *
22508 * def parse_region(self, contig=None, start=None, stop=None, # <<<<<<<<<<<<<<
22509 * region=None, tid=None,
22510 * reference=None, end=None):
22511 */
22512 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_10libchtslib_7HTSFile_23parse_region, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_HTSFile_parse_region, NULL, __pyx_n_s_pysam_libchtslib, __pyx_d, ((PyObject *)__pyx_codeobj__52)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 595, __pyx_L1_error)
22513 __Pyx_GOTREF(__pyx_t_3);
22514 __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__94);
22515 if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_10libchtslib_HTSFile, __pyx_n_s_parse_region, __pyx_t_3) < 0) __PYX_ERR(0, 595, __pyx_L1_error)
22516 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22517 PyType_Modified(__pyx_ptype_5pysam_10libchtslib_HTSFile);
22518
22519 /* "pysam/libchtslib.pyx":700
22520 * return 1, rtid, rstart, rstop
22521 *
22522 * def is_valid_tid(self, tid): # <<<<<<<<<<<<<<
22523 * """
22524 * return True if the numerical :term:`tid` is valid; False otherwise.
22525 */
22526 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_10libchtslib_7HTSFile_25is_valid_tid, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_HTSFile_is_valid_tid, NULL, __pyx_n_s_pysam_libchtslib, __pyx_d, ((PyObject *)__pyx_codeobj__60)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 700, __pyx_L1_error)
22527 __Pyx_GOTREF(__pyx_t_3);
22528 if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_10libchtslib_HTSFile, __pyx_n_s_is_valid_tid, __pyx_t_3) < 0) __PYX_ERR(0, 700, __pyx_L1_error)
22529 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22530 PyType_Modified(__pyx_ptype_5pysam_10libchtslib_HTSFile);
22531
22532 /* "pysam/libchtslib.pyx":708
22533 * raise NotImplementedError()
22534 *
22535 * def is_valid_reference_name(self, contig): # <<<<<<<<<<<<<<
22536 * """
22537 * return True if the contig name :term:`contig` is valid; False otherwise.
22538 */
22539 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_10libchtslib_7HTSFile_27is_valid_reference_name, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_HTSFile_is_valid_reference_name, NULL, __pyx_n_s_pysam_libchtslib, __pyx_d, ((PyObject *)__pyx_codeobj__61)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 708, __pyx_L1_error)
22540 __Pyx_GOTREF(__pyx_t_3);
22541 if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_10libchtslib_HTSFile, __pyx_n_s_is_valid_reference_name, __pyx_t_3) < 0) __PYX_ERR(0, 708, __pyx_L1_error)
22542 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22543 PyType_Modified(__pyx_ptype_5pysam_10libchtslib_HTSFile);
22544
22545 /* "pysam/libchtslib.pyx":714
22546 * return self.get_tid(contig) != -1
22547 *
22548 * def get_tid(self, contig): # <<<<<<<<<<<<<<
22549 * """
22550 * return the numerical :term:`tid` corresponding to
22551 */
22552 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_10libchtslib_7HTSFile_29get_tid, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_HTSFile_get_tid, NULL, __pyx_n_s_pysam_libchtslib, __pyx_d, ((PyObject *)__pyx_codeobj__62)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 714, __pyx_L1_error)
22553 __Pyx_GOTREF(__pyx_t_3);
22554 if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_10libchtslib_HTSFile, __pyx_n_s_get_tid, __pyx_t_3) < 0) __PYX_ERR(0, 714, __pyx_L1_error)
22555 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22556 PyType_Modified(__pyx_ptype_5pysam_10libchtslib_HTSFile);
22557
22558 /* "pysam/libchtslib.pyx":723
22559 * raise NotImplementedError()
22560 *
22561 * def get_reference_name(self, tid): # <<<<<<<<<<<<<<
22562 * """
22563 * return :term:`contig` name corresponding to numerical :term:`tid`
22564 */
22565 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_10libchtslib_7HTSFile_31get_reference_name, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_HTSFile_get_reference_name, NULL, __pyx_n_s_pysam_libchtslib, __pyx_d, ((PyObject *)__pyx_codeobj__63)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 723, __pyx_L1_error)
22566 __Pyx_GOTREF(__pyx_t_3);
22567 if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_5pysam_10libchtslib_HTSFile, __pyx_n_s_get_reference_name, __pyx_t_3) < 0) __PYX_ERR(0, 723, __pyx_L1_error)
22568 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22569 PyType_Modified(__pyx_ptype_5pysam_10libchtslib_HTSFile);
22570
22571 /* "(tree fragment)":1
22572 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
22573 * raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
22574 * def __setstate_cython__(self, __pyx_state):
22575 */
22576 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_10libchtslib_7HTSFile_33__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_HTSFile___reduce_cython, NULL, __pyx_n_s_pysam_libchtslib, __pyx_d, ((PyObject *)__pyx_codeobj__64)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1, __pyx_L1_error)
22577 __Pyx_GOTREF(__pyx_t_3);
22578 if (PyDict_SetItem(__pyx_d, __pyx_n_s_reduce_cython, __pyx_t_3) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
22579 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22580
22581 /* "(tree fragment)":3
22582 * def __reduce_cython__(self):
22583 * raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
22584 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
22585 * raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
22586 */
22587 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_10libchtslib_7HTSFile_35__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_HTSFile___setstate_cython, NULL, __pyx_n_s_pysam_libchtslib, __pyx_d, ((PyObject *)__pyx_codeobj__65)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 3, __pyx_L1_error)
22588 __Pyx_GOTREF(__pyx_t_3);
22589 if (PyDict_SetItem(__pyx_d, __pyx_n_s_setstate_cython, __pyx_t_3) < 0) __PYX_ERR(1, 3, __pyx_L1_error)
22590 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22591
22592 /* "pysam/libchtslib.pyx":1
22593 * # cython: language_level=3 # <<<<<<<<<<<<<<
22594 * # cython: embedsignature=True
22595 * # cython: profile=True
22596 */
22597 __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1, __pyx_L1_error)
22598 __Pyx_GOTREF(__pyx_t_3);
22599 if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_3) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22600 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22601 __Pyx_TraceReturn(Py_None, 0);
22602
22603 /*--- Wrapped vars code ---*/
22604
22605 goto __pyx_L0;
22606 __pyx_L1_error:;
22607 __Pyx_XDECREF(__pyx_t_2);
22608 __Pyx_XDECREF(__pyx_t_3);
22609 __Pyx_XDECREF(__pyx_t_5);
22610 __Pyx_XDECREF(__pyx_t_6);
22611 if (__pyx_m) {
22612 if (__pyx_d && stringtab_initialized) {
22613 __Pyx_AddTraceback("init pysam.libchtslib", __pyx_clineno, __pyx_lineno, __pyx_filename);
22614 }
22615 #if !CYTHON_USE_MODULE_STATE
22616 Py_CLEAR(__pyx_m);
22617 #else
22618 Py_DECREF(__pyx_m);
22619 if (pystate_addmodule_run) {
22620 PyObject *tp, *value, *tb;
22621 PyErr_Fetch(&tp, &value, &tb);
22622 PyState_RemoveModule(&__pyx_moduledef);
22623 PyErr_Restore(tp, value, tb);
22624 }
22625 #endif
22626 } else if (!PyErr_Occurred()) {
22627 PyErr_SetString(PyExc_ImportError, "init pysam.libchtslib");
22628 }
22629 __pyx_L0:;
22630 __Pyx_RefNannyFinishContext();
22631 #if CYTHON_PEP489_MULTI_PHASE_INIT
22632 return (__pyx_m != NULL) ? 0 : -1;
22633 #elif PY_MAJOR_VERSION >= 3
22634 return __pyx_m;
22635 #else
22636 return;
22637 #endif
22638 }
22639 /* #### Code section: cleanup_globals ### */
22640 /* #### Code section: cleanup_module ### */
22641 /* #### Code section: main_method ### */
22642 /* #### Code section: utility_code_pragmas ### */
22643 #ifdef _MSC_VER
22644 #pragma warning( push )
22645 /* Warning 4127: conditional expression is constant
22646 * Cython uses constant conditional expressions to allow in inline functions to be optimized at
22647 * compile-time, so this warning is not useful
22648 */
22649 #pragma warning( disable : 4127 )
22650 #endif
22651
22652
22653
22654 /* #### Code section: utility_code_def ### */
22655
22656 /* --- Runtime support code --- */
22657 /* Refnanny */
22658 #if CYTHON_REFNANNY
22659 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
22660 PyObject *m = NULL, *p = NULL;
22661 void *r = NULL;
22662 m = PyImport_ImportModule(modname);
22663 if (!m) goto end;
22664 p = PyObject_GetAttrString(m, "RefNannyAPI");
22665 if (!p) goto end;
22666 r = PyLong_AsVoidPtr(p);
22667 end:
22668 Py_XDECREF(p);
22669 Py_XDECREF(m);
22670 return (__Pyx_RefNannyAPIStruct *)r;
22671 }
22672 #endif
22673
22674 /* PyErrExceptionMatches */
22675 #if CYTHON_FAST_THREAD_STATE
22676 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
22677 Py_ssize_t i, n;
22678 n = PyTuple_GET_SIZE(tuple);
22679 #if PY_MAJOR_VERSION >= 3
22680 for (i=0; i<n; i++) {
22681 if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
22682 }
22683 #endif
22684 for (i=0; i<n; i++) {
22685 if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
22686 }
22687 return 0;
22688 }
22689 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
22690 int result;
22691 PyObject *exc_type;
22692 #if PY_VERSION_HEX >= 0x030C00A6
22693 PyObject *current_exception = tstate->current_exception;
22694 if (unlikely(!current_exception)) return 0;
22695 exc_type = (PyObject*) Py_TYPE(current_exception);
22696 if (exc_type == err) return 1;
22697 #else
22698 exc_type = tstate->curexc_type;
22699 if (exc_type == err) return 1;
22700 if (unlikely(!exc_type)) return 0;
22701 #endif
22702 #if CYTHON_AVOID_BORROWED_REFS
22703 Py_INCREF(exc_type);
22704 #endif
22705 if (unlikely(PyTuple_Check(err))) {
22706 result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
22707 } else {
22708 result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
22709 }
22710 #if CYTHON_AVOID_BORROWED_REFS
22711 Py_DECREF(exc_type);
22712 #endif
22713 return result;
22714 }
22715 #endif
22716
22717 /* PyErrFetchRestore */
22718 #if CYTHON_FAST_THREAD_STATE
22719 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
22720 #if PY_VERSION_HEX >= 0x030C00A6
22721 PyObject *tmp_value;
22722 assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value)));
22723 if (value) {
22724 #if CYTHON_COMPILING_IN_CPYTHON
22725 if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb))
22726 #endif
22727 PyException_SetTraceback(value, tb);
22728 }
22729 tmp_value = tstate->current_exception;
22730 tstate->current_exception = value;
22731 Py_XDECREF(tmp_value);
22732 Py_XDECREF(type);
22733 Py_XDECREF(tb);
22734 #else
22735 PyObject *tmp_type, *tmp_value, *tmp_tb;
22736 tmp_type = tstate->curexc_type;
22737 tmp_value = tstate->curexc_value;
22738 tmp_tb = tstate->curexc_traceback;
22739 tstate->curexc_type = type;
22740 tstate->curexc_value = value;
22741 tstate->curexc_traceback = tb;
22742 Py_XDECREF(tmp_type);
22743 Py_XDECREF(tmp_value);
22744 Py_XDECREF(tmp_tb);
22745 #endif
22746 }
22747 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
22748 #if PY_VERSION_HEX >= 0x030C00A6
22749 PyObject* exc_value;
22750 exc_value = tstate->current_exception;
22751 tstate->current_exception = 0;
22752 *value = exc_value;
22753 *type = NULL;
22754 *tb = NULL;
22755 if (exc_value) {
22756 *type = (PyObject*) Py_TYPE(exc_value);
22757 Py_INCREF(*type);
22758 #if CYTHON_COMPILING_IN_CPYTHON
22759 *tb = ((PyBaseExceptionObject*) exc_value)->traceback;
22760 Py_XINCREF(*tb);
22761 #else
22762 *tb = PyException_GetTraceback(exc_value);
22763 #endif
22764 }
22765 #else
22766 *type = tstate->curexc_type;
22767 *value = tstate->curexc_value;
22768 *tb = tstate->curexc_traceback;
22769 tstate->curexc_type = 0;
22770 tstate->curexc_value = 0;
22771 tstate->curexc_traceback = 0;
22772 #endif
22773 }
22774 #endif
22775
22776 /* PyObjectGetAttrStr */
22777 #if CYTHON_USE_TYPE_SLOTS
22778 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
22779 PyTypeObject* tp = Py_TYPE(obj);
22780 if (likely(tp->tp_getattro))
22781 return tp->tp_getattro(obj, attr_name);
22782 #if PY_MAJOR_VERSION < 3
22783 if (likely(tp->tp_getattr))
22784 return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
22785 #endif
22786 return PyObject_GetAttr(obj, attr_name);
22787 }
22788 #endif
22789
22790 /* PyObjectGetAttrStrNoError */
22791 #if __PYX_LIMITED_VERSION_HEX < 0x030d00A1
22792 static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
22793 __Pyx_PyThreadState_declare
22794 __Pyx_PyThreadState_assign
22795 if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
22796 __Pyx_PyErr_Clear();
22797 }
22798 #endif
22799 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
22800 PyObject *result;
22801 #if __PYX_LIMITED_VERSION_HEX >= 0x030d00A1
22802 (void) PyObject_GetOptionalAttr(obj, attr_name, &result);
22803 return result;
22804 #else
22805 #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1
22806 PyTypeObject* tp = Py_TYPE(obj);
22807 if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
22808 return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
22809 }
22810 #endif
22811 result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
22812 if (unlikely(!result)) {
22813 __Pyx_PyObject_GetAttrStr_ClearAttributeError();
22814 }
22815 return result;
22816 #endif
22817 }
22818
22819 /* GetBuiltinName */
22820 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
22821 PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_b, name);
22822 if (unlikely(!result) && !PyErr_Occurred()) {
22823 PyErr_Format(PyExc_NameError,
22824 #if PY_MAJOR_VERSION >= 3
22825 "name '%U' is not defined", name);
22826 #else
22827 "name '%.200s' is not defined", PyString_AS_STRING(name));
22828 #endif
22829 }
22830 return result;
22831 }
22832
22833 /* TupleAndListFromArray */
22834 #if CYTHON_COMPILING_IN_CPYTHON
22835 static CYTHON_INLINE void __Pyx_copy_object_array(PyObject *const *CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) {
22836 PyObject *v;
22837 Py_ssize_t i;
22838 for (i = 0; i < length; i++) {
22839 v = dest[i] = src[i];
22840 Py_INCREF(v);
22841 }
22842 }
22843 static CYTHON_INLINE PyObject *
22844 __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n)
22845 {
22846 PyObject *res;
22847 if (n <= 0) {
22848 Py_INCREF(__pyx_empty_tuple);
22849 return __pyx_empty_tuple;
22850 }
22851 res = PyTuple_New(n);
22852 if (unlikely(res == NULL)) return NULL;
22853 __Pyx_copy_object_array(src, ((PyTupleObject*)res)->ob_item, n);
22854 return res;
22855 }
22856 static CYTHON_INLINE PyObject *
22857 __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n)
22858 {
22859 PyObject *res;
22860 if (n <= 0) {
22861 return PyList_New(0);
22862 }
22863 res = PyList_New(n);
22864 if (unlikely(res == NULL)) return NULL;
22865 __Pyx_copy_object_array(src, ((PyListObject*)res)->ob_item, n);
22866 return res;
22867 }
22868 #endif
22869
22870 /* BytesEquals */
22871 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
22872 #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API
22873 return PyObject_RichCompareBool(s1, s2, equals);
22874 #else
22875 if (s1 == s2) {
22876 return (equals == Py_EQ);
22877 } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
22878 const char *ps1, *ps2;
22879 Py_ssize_t length = PyBytes_GET_SIZE(s1);
22880 if (length != PyBytes_GET_SIZE(s2))
22881 return (equals == Py_NE);
22882 ps1 = PyBytes_AS_STRING(s1);
22883 ps2 = PyBytes_AS_STRING(s2);
22884 if (ps1[0] != ps2[0]) {
22885 return (equals == Py_NE);
22886 } else if (length == 1) {
22887 return (equals == Py_EQ);
22888 } else {
22889 int result;
22890 #if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000)
22891 Py_hash_t hash1, hash2;
22892 hash1 = ((PyBytesObject*)s1)->ob_shash;
22893 hash2 = ((PyBytesObject*)s2)->ob_shash;
22894 if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
22895 return (equals == Py_NE);
22896 }
22897 #endif
22898 result = memcmp(ps1, ps2, (size_t)length);
22899 return (equals == Py_EQ) ? (result == 0) : (result != 0);
22900 }
22901 } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
22902 return (equals == Py_NE);
22903 } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
22904 return (equals == Py_NE);
22905 } else {
22906 int result;
22907 PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
22908 if (!py_result)
22909 return -1;
22910 result = __Pyx_PyObject_IsTrue(py_result);
22911 Py_DECREF(py_result);
22912 return result;
22913 }
22914 #endif
22915 }
22916
22917 /* UnicodeEquals */
22918 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
22919 #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API
22920 return PyObject_RichCompareBool(s1, s2, equals);
22921 #else
22922 #if PY_MAJOR_VERSION < 3
22923 PyObject* owned_ref = NULL;
22924 #endif
22925 int s1_is_unicode, s2_is_unicode;
22926 if (s1 == s2) {
22927 goto return_eq;
22928 }
22929 s1_is_unicode = PyUnicode_CheckExact(s1);
22930 s2_is_unicode = PyUnicode_CheckExact(s2);
22931 #if PY_MAJOR_VERSION < 3
22932 if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
22933 owned_ref = PyUnicode_FromObject(s2);
22934 if (unlikely(!owned_ref))
22935 return -1;
22936 s2 = owned_ref;
22937 s2_is_unicode = 1;
22938 } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
22939 owned_ref = PyUnicode_FromObject(s1);
22940 if (unlikely(!owned_ref))
22941 return -1;
22942 s1 = owned_ref;
22943 s1_is_unicode = 1;
22944 } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
22945 return __Pyx_PyBytes_Equals(s1, s2, equals);
22946 }
22947 #endif
22948 if (s1_is_unicode & s2_is_unicode) {
22949 Py_ssize_t length;
22950 int kind;
22951 void *data1, *data2;
22952 if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
22953 return -1;
22954 length = __Pyx_PyUnicode_GET_LENGTH(s1);
22955 if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
22956 goto return_ne;
22957 }
22958 #if CYTHON_USE_UNICODE_INTERNALS
22959 {
22960 Py_hash_t hash1, hash2;
22961 #if CYTHON_PEP393_ENABLED
22962 hash1 = ((PyASCIIObject*)s1)->hash;
22963 hash2 = ((PyASCIIObject*)s2)->hash;
22964 #else
22965 hash1 = ((PyUnicodeObject*)s1)->hash;
22966 hash2 = ((PyUnicodeObject*)s2)->hash;
22967 #endif
22968 if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
22969 goto return_ne;
22970 }
22971 }
22972 #endif
22973 kind = __Pyx_PyUnicode_KIND(s1);
22974 if (kind != __Pyx_PyUnicode_KIND(s2)) {
22975 goto return_ne;
22976 }
22977 data1 = __Pyx_PyUnicode_DATA(s1);
22978 data2 = __Pyx_PyUnicode_DATA(s2);
22979 if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
22980 goto return_ne;
22981 } else if (length == 1) {
22982 goto return_eq;
22983 } else {
22984 int result = memcmp(data1, data2, (size_t)(length * kind));
22985 #if PY_MAJOR_VERSION < 3
22986 Py_XDECREF(owned_ref);
22987 #endif
22988 return (equals == Py_EQ) ? (result == 0) : (result != 0);
22989 }
22990 } else if ((s1 == Py_None) & s2_is_unicode) {
22991 goto return_ne;
22992 } else if ((s2 == Py_None) & s1_is_unicode) {
22993 goto return_ne;
22994 } else {
22995 int result;
22996 PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
22997 #if PY_MAJOR_VERSION < 3
22998 Py_XDECREF(owned_ref);
22999 #endif
23000 if (!py_result)
23001 return -1;
23002 result = __Pyx_PyObject_IsTrue(py_result);
23003 Py_DECREF(py_result);
23004 return result;
23005 }
23006 return_eq:
23007 #if PY_MAJOR_VERSION < 3
23008 Py_XDECREF(owned_ref);
23009 #endif
23010 return (equals == Py_EQ);
23011 return_ne:
23012 #if PY_MAJOR_VERSION < 3
23013 Py_XDECREF(owned_ref);
23014 #endif
23015 return (equals == Py_NE);
23016 #endif
23017 }
23018
23019 /* fastcall */
23020 #if CYTHON_METH_FASTCALL
23021 static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s)
23022 {
23023 Py_ssize_t i, n = PyTuple_GET_SIZE(kwnames);
23024 for (i = 0; i < n; i++)
23025 {
23026 if (s == PyTuple_GET_ITEM(kwnames, i)) return kwvalues[i];
23027 }
23028 for (i = 0; i < n; i++)
23029 {
23030 int eq = __Pyx_PyUnicode_Equals(s, PyTuple_GET_ITEM(kwnames, i), Py_EQ);
23031 if (unlikely(eq != 0)) {
23032 if (unlikely(eq < 0)) return NULL;
23033 return kwvalues[i];
23034 }
23035 }
23036 return NULL;
23037 }
23038 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000
23039 CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues) {
23040 Py_ssize_t i, nkwargs = PyTuple_GET_SIZE(kwnames);
23041 PyObject *dict;
23042 dict = PyDict_New();
23043 if (unlikely(!dict))
23044 return NULL;
23045 for (i=0; i<nkwargs; i++) {
23046 PyObject *key = PyTuple_GET_ITEM(kwnames, i);
23047 if (unlikely(PyDict_SetItem(dict, key, kwvalues[i]) < 0))
23048 goto bad;
23049 }
23050 return dict;
23051 bad:
23052 Py_DECREF(dict);
23053 return NULL;
23054 }
23055 #endif
23056 #endif
23057
23058 /* Profile */
23059 #if CYTHON_PROFILE
23060 static int __Pyx_TraceSetupAndCall(PyCodeObject** code,
23061 PyFrameObject** frame,
23062 PyThreadState* tstate,
23063 const char *funcname,
23064 const char *srcfile,
23065 int firstlineno) {
23066 PyObject *type, *value, *traceback;
23067 int retval;
23068 if (*frame == NULL || !CYTHON_PROFILE_REUSE_FRAME) {
23069 if (*code == NULL) {
23070 *code = __Pyx_createFrameCodeObject(funcname, srcfile, firstlineno);
23071 if (*code == NULL) return 0;
23072 }
23073 *frame = PyFrame_New(
23074 tstate, /*PyThreadState *tstate*/
23075 *code, /*PyCodeObject *code*/
23076 __pyx_d, /*PyObject *globals*/
23077 0 /*PyObject *locals*/
23078 );
23079 if (*frame == NULL) return 0;
23080 if (CYTHON_TRACE && (*frame)->f_trace == NULL) {
23081 Py_INCREF(Py_None);
23082 (*frame)->f_trace = Py_None;
23083 }
23084 #if PY_VERSION_HEX < 0x030400B1
23085 } else {
23086 (*frame)->f_tstate = tstate;
23087 #endif
23088 }
23089 __Pyx_PyFrame_SetLineNumber(*frame, firstlineno);
23090 retval = 1;
23091 __Pyx_EnterTracing(tstate);
23092 __Pyx_ErrFetchInState(tstate, &type, &value, &traceback);
23093 #if CYTHON_TRACE
23094 if (tstate->c_tracefunc)
23095 retval = tstate->c_tracefunc(tstate->c_traceobj, *frame, PyTrace_CALL, NULL) == 0;
23096 if (retval && tstate->c_profilefunc)
23097 #endif
23098 retval = tstate->c_profilefunc(tstate->c_profileobj, *frame, PyTrace_CALL, NULL) == 0;
23099 __Pyx_LeaveTracing(tstate);
23100 if (retval) {
23101 __Pyx_ErrRestoreInState(tstate, type, value, traceback);
23102 return __Pyx_IsTracing(tstate, 0, 0) && retval;
23103 } else {
23104 Py_XDECREF(type);
23105 Py_XDECREF(value);
23106 Py_XDECREF(traceback);
23107 return -1;
23108 }
23109 }
23110 static PyCodeObject *__Pyx_createFrameCodeObject(const char *funcname, const char *srcfile, int firstlineno) {
23111 PyCodeObject *py_code = 0;
23112 #if PY_MAJOR_VERSION >= 3
23113 py_code = PyCode_NewEmpty(srcfile, funcname, firstlineno);
23114 if (likely(py_code)) {
23115 py_code->co_flags |= CO_OPTIMIZED | CO_NEWLOCALS;
23116 }
23117 #else
23118 PyObject *py_srcfile = 0;
23119 PyObject *py_funcname = 0;
23120 py_funcname = PyString_FromString(funcname);
23121 if (unlikely(!py_funcname)) goto bad;
23122 py_srcfile = PyString_FromString(srcfile);
23123 if (unlikely(!py_srcfile)) goto bad;
23124 py_code = PyCode_New(
23125 0,
23126 0,
23127 0,
23128 CO_OPTIMIZED | CO_NEWLOCALS,
23129 __pyx_empty_bytes, /*PyObject *code,*/
23130 __pyx_empty_tuple, /*PyObject *consts,*/
23131 __pyx_empty_tuple, /*PyObject *names,*/
23132 __pyx_empty_tuple, /*PyObject *varnames,*/
23133 __pyx_empty_tuple, /*PyObject *freevars,*/
23134 __pyx_empty_tuple, /*PyObject *cellvars,*/
23135 py_srcfile, /*PyObject *filename,*/
23136 py_funcname, /*PyObject *name,*/
23137 firstlineno,
23138 __pyx_empty_bytes /*PyObject *lnotab*/
23139 );
23140 bad:
23141 Py_XDECREF(py_srcfile);
23142 Py_XDECREF(py_funcname);
23143 #endif
23144 return py_code;
23145 }
23146 #endif
23147
23148 /* RaiseDoubleKeywords */
23149 static void __Pyx_RaiseDoubleKeywordsError(
23150 const char* func_name,
23151 PyObject* kw_name)
23152 {
23153 PyErr_Format(PyExc_TypeError,
23154 #if PY_MAJOR_VERSION >= 3
23155 "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
23156 #else
23157 "%s() got multiple values for keyword argument '%s'", func_name,
23158 PyString_AsString(kw_name));
23159 #endif
23160 }
23161
23162 /* ParseKeywords */
23163 static int __Pyx_ParseOptionalKeywords(
23164 PyObject *kwds,
23165 PyObject *const *kwvalues,
23166 PyObject **argnames[],
23167 PyObject *kwds2,
23168 PyObject *values[],
23169 Py_ssize_t num_pos_args,
23170 const char* function_name)
23171 {
23172 PyObject *key = 0, *value = 0;
23173 Py_ssize_t pos = 0;
23174 PyObject*** name;
23175 PyObject*** first_kw_arg = argnames + num_pos_args;
23176 int kwds_is_tuple = CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds));
23177 while (1) {
23178 Py_XDECREF(key); key = NULL;
23179 Py_XDECREF(value); value = NULL;
23180 if (kwds_is_tuple) {
23181 Py_ssize_t size;
23182 #if CYTHON_ASSUME_SAFE_MACROS
23183 size = PyTuple_GET_SIZE(kwds);
23184 #else
23185 size = PyTuple_Size(kwds);
23186 if (size < 0) goto bad;
23187 #endif
23188 if (pos >= size) break;
23189 #if CYTHON_AVOID_BORROWED_REFS
23190 key = __Pyx_PySequence_ITEM(kwds, pos);
23191 if (!key) goto bad;
23192 #elif CYTHON_ASSUME_SAFE_MACROS
23193 key = PyTuple_GET_ITEM(kwds, pos);
23194 #else
23195 key = PyTuple_GetItem(kwds, pos);
23196 if (!key) goto bad;
23197 #endif
23198 value = kwvalues[pos];
23199 pos++;
23200 }
23201 else
23202 {
23203 if (!PyDict_Next(kwds, &pos, &key, &value)) break;
23204 #if CYTHON_AVOID_BORROWED_REFS
23205 Py_INCREF(key);
23206 #endif
23207 }
23208 name = first_kw_arg;
23209 while (*name && (**name != key)) name++;
23210 if (*name) {
23211 values[name-argnames] = value;
23212 #if CYTHON_AVOID_BORROWED_REFS
23213 Py_INCREF(value);
23214 Py_DECREF(key);
23215 #endif
23216 key = NULL;
23217 value = NULL;
23218 continue;
23219 }
23220 #if !CYTHON_AVOID_BORROWED_REFS
23221 Py_INCREF(key);
23222 #endif
23223 Py_INCREF(value);
23224 name = first_kw_arg;
23225 #if PY_MAJOR_VERSION < 3
23226 if (likely(PyString_Check(key))) {
23227 while (*name) {
23228 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
23229 && _PyString_Eq(**name, key)) {
23230 values[name-argnames] = value;
23231 #if CYTHON_AVOID_BORROWED_REFS
23232 value = NULL;
23233 #endif
23234 break;
23235 }
23236 name++;
23237 }
23238 if (*name) continue;
23239 else {
23240 PyObject*** argname = argnames;
23241 while (argname != first_kw_arg) {
23242 if ((**argname == key) || (
23243 (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
23244 && _PyString_Eq(**argname, key))) {
23245 goto arg_passed_twice;
23246 }
23247 argname++;
23248 }
23249 }
23250 } else
23251 #endif
23252 if (likely(PyUnicode_Check(key))) {
23253 while (*name) {
23254 int cmp = (
23255 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
23256 (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
23257 #endif
23258 PyUnicode_Compare(**name, key)
23259 );
23260 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
23261 if (cmp == 0) {
23262 values[name-argnames] = value;
23263 #if CYTHON_AVOID_BORROWED_REFS
23264 value = NULL;
23265 #endif
23266 break;
23267 }
23268 name++;
23269 }
23270 if (*name) continue;
23271 else {
23272 PyObject*** argname = argnames;
23273 while (argname != first_kw_arg) {
23274 int cmp = (**argname == key) ? 0 :
23275 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
23276 (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
23277 #endif
23278 PyUnicode_Compare(**argname, key);
23279 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
23280 if (cmp == 0) goto arg_passed_twice;
23281 argname++;
23282 }
23283 }
23284 } else
23285 goto invalid_keyword_type;
23286 if (kwds2) {
23287 if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
23288 } else {
23289 goto invalid_keyword;
23290 }
23291 }
23292 Py_XDECREF(key);
23293 Py_XDECREF(value);
23294 return 0;
23295 arg_passed_twice:
23296 __Pyx_RaiseDoubleKeywordsError(function_name, key);
23297 goto bad;
23298 invalid_keyword_type:
23299 PyErr_Format(PyExc_TypeError,
23300 "%.200s() keywords must be strings", function_name);
23301 goto bad;
23302 invalid_keyword:
23303 #if PY_MAJOR_VERSION < 3
23304 PyErr_Format(PyExc_TypeError,
23305 "%.200s() got an unexpected keyword argument '%.200s'",
23306 function_name, PyString_AsString(key));
23307 #else
23308 PyErr_Format(PyExc_TypeError,
23309 "%s() got an unexpected keyword argument '%U'",
23310 function_name, key);
23311 #endif
23312 bad:
23313 Py_XDECREF(key);
23314 Py_XDECREF(value);
23315 return -1;
23316 }
23317
23318 /* RaiseArgTupleInvalid */
23319 static void __Pyx_RaiseArgtupleInvalid(
23320 const char* func_name,
23321 int exact,
23322 Py_ssize_t num_min,
23323 Py_ssize_t num_max,
23324 Py_ssize_t num_found)
23325 {
23326 Py_ssize_t num_expected;
23327 const char *more_or_less;
23328 if (num_found < num_min) {
23329 num_expected = num_min;
23330 more_or_less = "at least";
23331 } else {
23332 num_expected = num_max;
23333 more_or_less = "at most";
23334 }
23335 if (exact) {
23336 more_or_less = "exactly";
23337 }
23338 PyErr_Format(PyExc_TypeError,
23339 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
23340 func_name, more_or_less, num_expected,
23341 (num_expected == 1) ? "" : "s", num_found);
23342 }
23343
23344 /* PyFunctionFastCall */
23345 #if CYTHON_FAST_PYCALL && !CYTHON_VECTORCALL
23346 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
23347 PyObject *globals) {
23348 PyFrameObject *f;
23349 PyThreadState *tstate = __Pyx_PyThreadState_Current;
23350 PyObject **fastlocals;
23351 Py_ssize_t i;
23352 PyObject *result;
23353 assert(globals != NULL);
23354 /* XXX Perhaps we should create a specialized
23355 PyFrame_New() that doesn't take locals, but does
23356 take builtins without sanity checking them.
23357 */
23358 assert(tstate != NULL);
23359 f = PyFrame_New(tstate, co, globals, NULL);
23360 if (f == NULL) {
23361 return NULL;
23362 }
23363 fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
23364 for (i = 0; i < na; i++) {
23365 Py_INCREF(*args);
23366 fastlocals[i] = *args++;
23367 }
23368 result = PyEval_EvalFrameEx(f,0);
23369 ++tstate->recursion_depth;
23370 Py_DECREF(f);
23371 --tstate->recursion_depth;
23372 return result;
23373 }
23374 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
23375 PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
23376 PyObject *globals = PyFunction_GET_GLOBALS(func);
23377 PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
23378 PyObject *closure;
23379 #if PY_MAJOR_VERSION >= 3
23380 PyObject *kwdefs;
23381 #endif
23382 PyObject *kwtuple, **k;
23383 PyObject **d;
23384 Py_ssize_t nd;
23385 Py_ssize_t nk;
23386 PyObject *result;
23387 assert(kwargs == NULL || PyDict_Check(kwargs));
23388 nk = kwargs ? PyDict_Size(kwargs) : 0;
23389 #if PY_MAJOR_VERSION < 3
23390 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) {
23391 return NULL;
23392 }
23393 #else
23394 if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) {
23395 return NULL;
23396 }
23397 #endif
23398 if (
23399 #if PY_MAJOR_VERSION >= 3
23400 co->co_kwonlyargcount == 0 &&
23401 #endif
23402 likely(kwargs == NULL || nk == 0) &&
23403 co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
23404 if (argdefs == NULL && co->co_argcount == nargs) {
23405 result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
23406 goto done;
23407 }
23408 else if (nargs == 0 && argdefs != NULL
23409 && co->co_argcount == Py_SIZE(argdefs)) {
23410 /* function called with no arguments, but all parameters have
23411 a default value: use default values as arguments .*/
23412 args = &PyTuple_GET_ITEM(argdefs, 0);
23413 result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
23414 goto done;
23415 }
23416 }
23417 if (kwargs != NULL) {
23418 Py_ssize_t pos, i;
23419 kwtuple = PyTuple_New(2 * nk);
23420 if (kwtuple == NULL) {
23421 result = NULL;
23422 goto done;
23423 }
23424 k = &PyTuple_GET_ITEM(kwtuple, 0);
23425 pos = i = 0;
23426 while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
23427 Py_INCREF(k[i]);
23428 Py_INCREF(k[i+1]);
23429 i += 2;
23430 }
23431 nk = i / 2;
23432 }
23433 else {
23434 kwtuple = NULL;
23435 k = NULL;
23436 }
23437 closure = PyFunction_GET_CLOSURE(func);
23438 #if PY_MAJOR_VERSION >= 3
23439 kwdefs = PyFunction_GET_KW_DEFAULTS(func);
23440 #endif
23441 if (argdefs != NULL) {
23442 d = &PyTuple_GET_ITEM(argdefs, 0);
23443 nd = Py_SIZE(argdefs);
23444 }
23445 else {
23446 d = NULL;
23447 nd = 0;
23448 }
23449 #if PY_MAJOR_VERSION >= 3
23450 result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
23451 args, (int)nargs,
23452 k, (int)nk,
23453 d, (int)nd, kwdefs, closure);
23454 #else
23455 result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
23456 args, (int)nargs,
23457 k, (int)nk,
23458 d, (int)nd, closure);
23459 #endif
23460 Py_XDECREF(kwtuple);
23461 done:
23462 Py_LeaveRecursiveCall();
23463 return result;
23464 }
23465 #endif
23466
23467 /* PyObjectCall */
23468 #if CYTHON_COMPILING_IN_CPYTHON
23469 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
23470 PyObject *result;
23471 ternaryfunc call = Py_TYPE(func)->tp_call;
23472 if (unlikely(!call))
23473 return PyObject_Call(func, arg, kw);
23474 #if PY_MAJOR_VERSION < 3
23475 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
23476 return NULL;
23477 #else
23478 if (unlikely(Py_EnterRecursiveCall(" while calling a Python object")))
23479 return NULL;
23480 #endif
23481 result = (*call)(func, arg, kw);
23482 Py_LeaveRecursiveCall();
23483 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
23484 PyErr_SetString(
23485 PyExc_SystemError,
23486 "NULL result without error in PyObject_Call");
23487 }
23488 return result;
23489 }
23490 #endif
23491
23492 /* PyObjectCallMethO */
23493 #if CYTHON_COMPILING_IN_CPYTHON
23494 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
23495 PyObject *self, *result;
23496 PyCFunction cfunc;
23497 cfunc = __Pyx_CyOrPyCFunction_GET_FUNCTION(func);
23498 self = __Pyx_CyOrPyCFunction_GET_SELF(func);
23499 #if PY_MAJOR_VERSION < 3
23500 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
23501 return NULL;
23502 #else
23503 if (unlikely(Py_EnterRecursiveCall(" while calling a Python object")))
23504 return NULL;
23505 #endif
23506 result = cfunc(self, arg);
23507 Py_LeaveRecursiveCall();
23508 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
23509 PyErr_SetString(
23510 PyExc_SystemError,
23511 "NULL result without error in PyObject_Call");
23512 }
23513 return result;
23514 }
23515 #endif
23516
23517 /* PyObjectFastCall */
23518 #if PY_VERSION_HEX < 0x03090000 || CYTHON_COMPILING_IN_LIMITED_API
23519 static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs) {
23520 PyObject *argstuple;
23521 PyObject *result = 0;
23522 size_t i;
23523 argstuple = PyTuple_New((Py_ssize_t)nargs);
23524 if (unlikely(!argstuple)) return NULL;
23525 for (i = 0; i < nargs; i++) {
23526 Py_INCREF(args[i]);
23527 if (__Pyx_PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]) < 0) goto bad;
23528 }
23529 result = __Pyx_PyObject_Call(func, argstuple, kwargs);
23530 bad:
23531 Py_DECREF(argstuple);
23532 return result;
23533 }
23534 #endif
23535 static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t _nargs, PyObject *kwargs) {
23536 Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs);
23537 #if CYTHON_COMPILING_IN_CPYTHON
23538 if (nargs == 0 && kwargs == NULL) {
23539 if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_NOARGS))
23540 return __Pyx_PyObject_CallMethO(func, NULL);
23541 }
23542 else if (nargs == 1 && kwargs == NULL) {
23543 if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_O))
23544 return __Pyx_PyObject_CallMethO(func, args[0]);
23545 }
23546 #endif
23547 #if PY_VERSION_HEX < 0x030800B1
23548 #if CYTHON_FAST_PYCCALL
23549 if (PyCFunction_Check(func)) {
23550 if (kwargs) {
23551 return _PyCFunction_FastCallDict(func, args, nargs, kwargs);
23552 } else {
23553 return _PyCFunction_FastCallKeywords(func, args, nargs, NULL);
23554 }
23555 }
23556 #if PY_VERSION_HEX >= 0x030700A1
23557 if (!kwargs && __Pyx_IS_TYPE(func, &PyMethodDescr_Type)) {
23558 return _PyMethodDescr_FastCallKeywords(func, args, nargs, NULL);
23559 }
23560 #endif
23561 #endif
23562 #if CYTHON_FAST_PYCALL
23563 if (PyFunction_Check(func)) {
23564 return __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs);
23565 }
23566 #endif
23567 #endif
23568 if (kwargs == NULL) {
23569 #if CYTHON_VECTORCALL
23570 #if PY_VERSION_HEX < 0x03090000
23571 vectorcallfunc f = _PyVectorcall_Function(func);
23572 #else
23573 vectorcallfunc f = PyVectorcall_Function(func);
23574 #endif
23575 if (f) {
23576 return f(func, args, (size_t)nargs, NULL);
23577 }
23578 #elif defined(__Pyx_CyFunction_USED) && CYTHON_BACKPORT_VECTORCALL
23579 if (__Pyx_CyFunction_CheckExact(func)) {
23580 __pyx_vectorcallfunc f = __Pyx_CyFunction_func_vectorcall(func);
23581 if (f) return f(func, args, (size_t)nargs, NULL);
23582 }
23583 #endif
23584 }
23585 if (nargs == 0) {
23586 return __Pyx_PyObject_Call(func, __pyx_empty_tuple, kwargs);
23587 }
23588 #if PY_VERSION_HEX >= 0x03090000 && !CYTHON_COMPILING_IN_LIMITED_API
23589 return PyObject_VectorcallDict(func, args, (size_t)nargs, kwargs);
23590 #else
23591 return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs);
23592 #endif
23593 }
23594
23595 /* WriteUnraisableException */
23596 static void __Pyx_WriteUnraisable(const char *name, int clineno,
23597 int lineno, const char *filename,
23598 int full_traceback, int nogil) {
23599 PyObject *old_exc, *old_val, *old_tb;
23600 PyObject *ctx;
23601 __Pyx_PyThreadState_declare
23602 #ifdef WITH_THREAD
23603 PyGILState_STATE state;
23604 if (nogil)
23605 state = PyGILState_Ensure();
23606 else state = (PyGILState_STATE)0;
23607 #endif
23608 CYTHON_UNUSED_VAR(clineno);
23609 CYTHON_UNUSED_VAR(lineno);
23610 CYTHON_UNUSED_VAR(filename);
23611 CYTHON_MAYBE_UNUSED_VAR(nogil);
23612 __Pyx_PyThreadState_assign
23613 __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
23614 if (full_traceback) {
23615 Py_XINCREF(old_exc);
23616 Py_XINCREF(old_val);
23617 Py_XINCREF(old_tb);
23618 __Pyx_ErrRestore(old_exc, old_val, old_tb);
23619 PyErr_PrintEx(0);
23620 }
23621 #if PY_MAJOR_VERSION < 3
23622 ctx = PyString_FromString(name);
23623 #else
23624 ctx = PyUnicode_FromString(name);
23625 #endif
23626 __Pyx_ErrRestore(old_exc, old_val, old_tb);
23627 if (!ctx) {
23628 PyErr_WriteUnraisable(Py_None);
23629 } else {
23630 PyErr_WriteUnraisable(ctx);
23631 Py_DECREF(ctx);
23632 }
23633 #ifdef WITH_THREAD
23634 if (nogil)
23635 PyGILState_Release(state);
23636 #endif
23637 }
23638
23639 /* RaiseException */
23640 #if PY_MAJOR_VERSION < 3
23641 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
23642 __Pyx_PyThreadState_declare
23643 CYTHON_UNUSED_VAR(cause);
23644 Py_XINCREF(type);
23645 if (!value || value == Py_None)
23646 value = NULL;
23647 else
23648 Py_INCREF(value);
23649 if (!tb || tb == Py_None)
23650 tb = NULL;
23651 else {
23652 Py_INCREF(tb);
23653 if (!PyTraceBack_Check(tb)) {
23654 PyErr_SetString(PyExc_TypeError,
23655 "raise: arg 3 must be a traceback or None");
23656 goto raise_error;
23657 }
23658 }
23659 if (PyType_Check(type)) {
23660 #if CYTHON_COMPILING_IN_PYPY
23661 if (!value) {
23662 Py_INCREF(Py_None);
23663 value = Py_None;
23664 }
23665 #endif
23666 PyErr_NormalizeException(&type, &value, &tb);
23667 } else {
23668 if (value) {
23669 PyErr_SetString(PyExc_TypeError,
23670 "instance exception may not have a separate value");
23671 goto raise_error;
23672 }
23673 value = type;
23674 type = (PyObject*) Py_TYPE(type);
23675 Py_INCREF(type);
23676 if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
23677 PyErr_SetString(PyExc_TypeError,
23678 "raise: exception class must be a subclass of BaseException");
23679 goto raise_error;
23680 }
23681 }
23682 __Pyx_PyThreadState_assign
23683 __Pyx_ErrRestore(type, value, tb);
23684 return;
23685 raise_error:
23686 Py_XDECREF(value);
23687 Py_XDECREF(type);
23688 Py_XDECREF(tb);
23689 return;
23690 }
23691 #else
23692 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
23693 PyObject* owned_instance = NULL;
23694 if (tb == Py_None) {
23695 tb = 0;
23696 } else if (tb && !PyTraceBack_Check(tb)) {
23697 PyErr_SetString(PyExc_TypeError,
23698 "raise: arg 3 must be a traceback or None");
23699 goto bad;
23700 }
23701 if (value == Py_None)
23702 value = 0;
23703 if (PyExceptionInstance_Check(type)) {
23704 if (value) {
23705 PyErr_SetString(PyExc_TypeError,
23706 "instance exception may not have a separate value");
23707 goto bad;
23708 }
23709 value = type;
23710 type = (PyObject*) Py_TYPE(value);
23711 } else if (PyExceptionClass_Check(type)) {
23712 PyObject *instance_class = NULL;
23713 if (value && PyExceptionInstance_Check(value)) {
23714 instance_class = (PyObject*) Py_TYPE(value);
23715 if (instance_class != type) {
23716 int is_subclass = PyObject_IsSubclass(instance_class, type);
23717 if (!is_subclass) {
23718 instance_class = NULL;
23719 } else if (unlikely(is_subclass == -1)) {
23720 goto bad;
23721 } else {
23722 type = instance_class;
23723 }
23724 }
23725 }
23726 if (!instance_class) {
23727 PyObject *args;
23728 if (!value)
23729 args = PyTuple_New(0);
23730 else if (PyTuple_Check(value)) {
23731 Py_INCREF(value);
23732 args = value;
23733 } else
23734 args = PyTuple_Pack(1, value);
23735 if (!args)
23736 goto bad;
23737 owned_instance = PyObject_Call(type, args, NULL);
23738 Py_DECREF(args);
23739 if (!owned_instance)
23740 goto bad;
23741 value = owned_instance;
23742 if (!PyExceptionInstance_Check(value)) {
23743 PyErr_Format(PyExc_TypeError,
23744 "calling %R should have returned an instance of "
23745 "BaseException, not %R",
23746 type, Py_TYPE(value));
23747 goto bad;
23748 }
23749 }
23750 } else {
23751 PyErr_SetString(PyExc_TypeError,
23752 "raise: exception class must be a subclass of BaseException");
23753 goto bad;
23754 }
23755 if (cause) {
23756 PyObject *fixed_cause;
23757 if (cause == Py_None) {
23758 fixed_cause = NULL;
23759 } else if (PyExceptionClass_Check(cause)) {
23760 fixed_cause = PyObject_CallObject(cause, NULL);
23761 if (fixed_cause == NULL)
23762 goto bad;
23763 } else if (PyExceptionInstance_Check(cause)) {
23764 fixed_cause = cause;
23765 Py_INCREF(fixed_cause);
23766 } else {
23767 PyErr_SetString(PyExc_TypeError,
23768 "exception causes must derive from "
23769 "BaseException");
23770 goto bad;
23771 }
23772 PyException_SetCause(value, fixed_cause);
23773 }
23774 PyErr_SetObject(type, value);
23775 if (tb) {
23776 #if PY_VERSION_HEX >= 0x030C00A6
23777 PyException_SetTraceback(value, tb);
23778 #elif CYTHON_FAST_THREAD_STATE
23779 PyThreadState *tstate = __Pyx_PyThreadState_Current;
23780 PyObject* tmp_tb = tstate->curexc_traceback;
23781 if (tb != tmp_tb) {
23782 Py_INCREF(tb);
23783 tstate->curexc_traceback = tb;
23784 Py_XDECREF(tmp_tb);
23785 }
23786 #else
23787 PyObject *tmp_type, *tmp_value, *tmp_tb;
23788 PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
23789 Py_INCREF(tb);
23790 PyErr_Restore(tmp_type, tmp_value, tb);
23791 Py_XDECREF(tmp_tb);
23792 #endif
23793 }
23794 bad:
23795 Py_XDECREF(owned_instance);
23796 return;
23797 }
23798 #endif
23799
23800 /* KeywordStringCheck */
23801 static int __Pyx_CheckKeywordStrings(
23802 PyObject *kw,
23803 const char* function_name,
23804 int kw_allowed)
23805 {
23806 PyObject* key = 0;
23807 Py_ssize_t pos = 0;
23808 #if CYTHON_COMPILING_IN_PYPY
23809 if (!kw_allowed && PyDict_Next(kw, &pos, &key, 0))
23810 goto invalid_keyword;
23811 return 1;
23812 #else
23813 if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kw))) {
23814 Py_ssize_t kwsize;
23815 #if CYTHON_ASSUME_SAFE_MACROS
23816 kwsize = PyTuple_GET_SIZE(kw);
23817 #else
23818 kwsize = PyTuple_Size(kw);
23819 if (kwsize < 0) return 0;
23820 #endif
23821 if (unlikely(kwsize == 0))
23822 return 1;
23823 if (!kw_allowed) {
23824 #if CYTHON_ASSUME_SAFE_MACROS
23825 key = PyTuple_GET_ITEM(kw, 0);
23826 #else
23827 key = PyTuple_GetItem(kw, pos);
23828 if (!key) return 0;
23829 #endif
23830 goto invalid_keyword;
23831 }
23832 #if PY_VERSION_HEX < 0x03090000
23833 for (pos = 0; pos < kwsize; pos++) {
23834 #if CYTHON_ASSUME_SAFE_MACROS
23835 key = PyTuple_GET_ITEM(kw, pos);
23836 #else
23837 key = PyTuple_GetItem(kw, pos);
23838 if (!key) return 0;
23839 #endif
23840 if (unlikely(!PyUnicode_Check(key)))
23841 goto invalid_keyword_type;
23842 }
23843 #endif
23844 return 1;
23845 }
23846 while (PyDict_Next(kw, &pos, &key, 0)) {
23847 #if PY_MAJOR_VERSION < 3
23848 if (unlikely(!PyString_Check(key)))
23849 #endif
23850 if (unlikely(!PyUnicode_Check(key)))
23851 goto invalid_keyword_type;
23852 }
23853 if (!kw_allowed && unlikely(key))
23854 goto invalid_keyword;
23855 return 1;
23856 invalid_keyword_type:
23857 PyErr_Format(PyExc_TypeError,
23858 "%.200s() keywords must be strings", function_name);
23859 return 0;
23860 #endif
23861 invalid_keyword:
23862 #if PY_MAJOR_VERSION < 3
23863 PyErr_Format(PyExc_TypeError,
23864 "%.200s() got an unexpected keyword argument '%.200s'",
23865 function_name, PyString_AsString(key));
23866 #else
23867 PyErr_Format(PyExc_TypeError,
23868 "%s() got an unexpected keyword argument '%U'",
23869 function_name, key);
23870 #endif
23871 return 0;
23872 }
23873
23874 /* PyObjectCall2Args */
23875 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
23876 PyObject *args[3] = {NULL, arg1, arg2};
23877 return __Pyx_PyObject_FastCall(function, args+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
23878 }
23879
23880 /* PyObjectCallOneArg */
23881 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
23882 PyObject *args[2] = {NULL, arg};
23883 return __Pyx_PyObject_FastCall(func, args+1, 1 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
23884 }
23885
23886 /* PyObjectGetMethod */
23887 static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) {
23888 PyObject *attr;
23889 #if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP
23890 __Pyx_TypeName type_name;
23891 PyTypeObject *tp = Py_TYPE(obj);
23892 PyObject *descr;
23893 descrgetfunc f = NULL;
23894 PyObject **dictptr, *dict;
23895 int meth_found = 0;
23896 assert (*method == NULL);
23897 if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) {
23898 attr = __Pyx_PyObject_GetAttrStr(obj, name);
23899 goto try_unpack;
23900 }
23901 if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) {
23902 return 0;
23903 }
23904 descr = _PyType_Lookup(tp, name);
23905 if (likely(descr != NULL)) {
23906 Py_INCREF(descr);
23907 #if defined(Py_TPFLAGS_METHOD_DESCRIPTOR) && Py_TPFLAGS_METHOD_DESCRIPTOR
23908 if (__Pyx_PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_METHOD_DESCRIPTOR))
23909 #elif PY_MAJOR_VERSION >= 3
23910 #ifdef __Pyx_CyFunction_USED
23911 if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr)))
23912 #else
23913 if (likely(PyFunction_Check(descr) || __Pyx_IS_TYPE(descr, &PyMethodDescr_Type)))
23914 #endif
23915 #else
23916 #ifdef __Pyx_CyFunction_USED
23917 if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr)))
23918 #else
23919 if (likely(PyFunction_Check(descr)))
23920 #endif
23921 #endif
23922 {
23923 meth_found = 1;
23924 } else {
23925 f = Py_TYPE(descr)->tp_descr_get;
23926 if (f != NULL && PyDescr_IsData(descr)) {
23927 attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
23928 Py_DECREF(descr);
23929 goto try_unpack;
23930 }
23931 }
23932 }
23933 dictptr = _PyObject_GetDictPtr(obj);
23934 if (dictptr != NULL && (dict = *dictptr) != NULL) {
23935 Py_INCREF(dict);
23936 attr = __Pyx_PyDict_GetItemStr(dict, name);
23937 if (attr != NULL) {
23938 Py_INCREF(attr);
23939 Py_DECREF(dict);
23940 Py_XDECREF(descr);
23941 goto try_unpack;
23942 }
23943 Py_DECREF(dict);
23944 }
23945 if (meth_found) {
23946 *method = descr;
23947 return 1;
23948 }
23949 if (f != NULL) {
23950 attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
23951 Py_DECREF(descr);
23952 goto try_unpack;
23953 }
23954 if (likely(descr != NULL)) {
23955 *method = descr;
23956 return 0;
23957 }
23958 type_name = __Pyx_PyType_GetName(tp);
23959 PyErr_Format(PyExc_AttributeError,
23960 #if PY_MAJOR_VERSION >= 3
23961 "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'",
23962 type_name, name);
23963 #else
23964 "'" __Pyx_FMT_TYPENAME "' object has no attribute '%.400s'",
23965 type_name, PyString_AS_STRING(name));
23966 #endif
23967 __Pyx_DECREF_TypeName(type_name);
23968 return 0;
23969 #else
23970 attr = __Pyx_PyObject_GetAttrStr(obj, name);
23971 goto try_unpack;
23972 #endif
23973 try_unpack:
23974 #if CYTHON_UNPACK_METHODS
23975 if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) {
23976 PyObject *function = PyMethod_GET_FUNCTION(attr);
23977 Py_INCREF(function);
23978 Py_DECREF(attr);
23979 *method = function;
23980 return 1;
23981 }
23982 #endif
23983 *method = attr;
23984 return 0;
23985 }
23986
23987 /* PyObjectCallMethod1 */
23988 #if !(CYTHON_VECTORCALL && __PYX_LIMITED_VERSION_HEX >= 0x030C00A2)
23989 static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
23990 PyObject *result = __Pyx_PyObject_CallOneArg(method, arg);
23991 Py_DECREF(method);
23992 return result;
23993 }
23994 #endif
23995 static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
23996 #if CYTHON_VECTORCALL && __PYX_LIMITED_VERSION_HEX >= 0x030C00A2
23997 PyObject *args[2] = {obj, arg};
23998 (void) __Pyx_PyObject_GetMethod;
23999 (void) __Pyx_PyObject_CallOneArg;
24000 (void) __Pyx_PyObject_Call2Args;
24001 return PyObject_VectorcallMethod(method_name, args, 2 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
24002 #else
24003 PyObject *method = NULL, *result;
24004 int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
24005 if (likely(is_method)) {
24006 result = __Pyx_PyObject_Call2Args(method, obj, arg);
24007 Py_DECREF(method);
24008 return result;
24009 }
24010 if (unlikely(!method)) return NULL;
24011 return __Pyx__PyObject_CallMethod1(method, arg);
24012 #endif
24013 }
24014
24015 /* StringJoin */
24016 static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values) {
24017 (void) __Pyx_PyObject_CallMethod1;
24018 #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION < 3
24019 return _PyString_Join(sep, values);
24020 #elif CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000
24021 return _PyBytes_Join(sep, values);
24022 #else
24023 return __Pyx_PyObject_CallMethod1(sep, __pyx_n_s_join, values);
24024 #endif
24025 }
24026
24027 /* PyObjectCallNoArg */
24028 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
24029 PyObject *arg[2] = {NULL, NULL};
24030 return __Pyx_PyObject_FastCall(func, arg + 1, 0 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
24031 }
24032
24033 /* ArgTypeTest */
24034 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
24035 {
24036 __Pyx_TypeName type_name;
24037 __Pyx_TypeName obj_type_name;
24038 if (unlikely(!type)) {
24039 PyErr_SetString(PyExc_SystemError, "Missing type object");
24040 return 0;
24041 }
24042 else if (exact) {
24043 #if PY_MAJOR_VERSION == 2
24044 if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
24045 #endif
24046 }
24047 else {
24048 if (likely(__Pyx_TypeCheck(obj, type))) return 1;
24049 }
24050 type_name = __Pyx_PyType_GetName(type);
24051 obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj));
24052 PyErr_Format(PyExc_TypeError,
24053 "Argument '%.200s' has incorrect type (expected " __Pyx_FMT_TYPENAME
24054 ", got " __Pyx_FMT_TYPENAME ")", name, type_name, obj_type_name);
24055 __Pyx_DECREF_TypeName(type_name);
24056 __Pyx_DECREF_TypeName(obj_type_name);
24057 return 0;
24058 }
24059
24060 /* PyObjectSetAttrStr */
24061 #if CYTHON_USE_TYPE_SLOTS
24062 static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) {
24063 PyTypeObject* tp = Py_TYPE(obj);
24064 if (likely(tp->tp_setattro))
24065 return tp->tp_setattro(obj, attr_name, value);
24066 #if PY_MAJOR_VERSION < 3
24067 if (likely(tp->tp_setattr))
24068 return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value);
24069 #endif
24070 return PyObject_SetAttr(obj, attr_name, value);
24071 }
24072 #endif
24073
24074 /* JoinPyUnicode */
24075 static PyObject* __Pyx_PyUnicode_Join(PyObject* value_tuple, Py_ssize_t value_count, Py_ssize_t result_ulength,
24076 Py_UCS4 max_char) {
24077 #if CYTHON_USE_UNICODE_INTERNALS && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
24078 PyObject *result_uval;
24079 int result_ukind, kind_shift;
24080 Py_ssize_t i, char_pos;
24081 void *result_udata;
24082 CYTHON_MAYBE_UNUSED_VAR(max_char);
24083 #if CYTHON_PEP393_ENABLED
24084 result_uval = PyUnicode_New(result_ulength, max_char);
24085 if (unlikely(!result_uval)) return NULL;
24086 result_ukind = (max_char <= 255) ? PyUnicode_1BYTE_KIND : (max_char <= 65535) ? PyUnicode_2BYTE_KIND : PyUnicode_4BYTE_KIND;
24087 kind_shift = (result_ukind == PyUnicode_4BYTE_KIND) ? 2 : result_ukind - 1;
24088 result_udata = PyUnicode_DATA(result_uval);
24089 #else
24090 result_uval = PyUnicode_FromUnicode(NULL, result_ulength);
24091 if (unlikely(!result_uval)) return NULL;
24092 result_ukind = sizeof(Py_UNICODE);
24093 kind_shift = (result_ukind == 4) ? 2 : result_ukind - 1;
24094 result_udata = PyUnicode_AS_UNICODE(result_uval);
24095 #endif
24096 assert(kind_shift == 2 || kind_shift == 1 || kind_shift == 0);
24097 char_pos = 0;
24098 for (i=0; i < value_count; i++) {
24099 int ukind;
24100 Py_ssize_t ulength;
24101 void *udata;
24102 PyObject *uval = PyTuple_GET_ITEM(value_tuple, i);
24103 if (unlikely(__Pyx_PyUnicode_READY(uval)))
24104 goto bad;
24105 ulength = __Pyx_PyUnicode_GET_LENGTH(uval);
24106 if (unlikely(!ulength))
24107 continue;
24108 if (unlikely((PY_SSIZE_T_MAX >> kind_shift) - ulength < char_pos))
24109 goto overflow;
24110 ukind = __Pyx_PyUnicode_KIND(uval);
24111 udata = __Pyx_PyUnicode_DATA(uval);
24112 if (!CYTHON_PEP393_ENABLED || ukind == result_ukind) {
24113 memcpy((char *)result_udata + (char_pos << kind_shift), udata, (size_t) (ulength << kind_shift));
24114 } else {
24115 #if PY_VERSION_HEX >= 0x030d0000
24116 if (unlikely(PyUnicode_CopyCharacters(result_uval, char_pos, uval, 0, ulength) < 0)) goto bad;
24117 #elif CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030300F0 || defined(_PyUnicode_FastCopyCharacters)
24118 _PyUnicode_FastCopyCharacters(result_uval, char_pos, uval, 0, ulength);
24119 #else
24120 Py_ssize_t j;
24121 for (j=0; j < ulength; j++) {
24122 Py_UCS4 uchar = __Pyx_PyUnicode_READ(ukind, udata, j);
24123 __Pyx_PyUnicode_WRITE(result_ukind, result_udata, char_pos+j, uchar);
24124 }
24125 #endif
24126 }
24127 char_pos += ulength;
24128 }
24129 return result_uval;
24130 overflow:
24131 PyErr_SetString(PyExc_OverflowError, "join() result is too long for a Python string");
24132 bad:
24133 Py_DECREF(result_uval);
24134 return NULL;
24135 #else
24136 CYTHON_UNUSED_VAR(max_char);
24137 CYTHON_UNUSED_VAR(result_ulength);
24138 CYTHON_UNUSED_VAR(value_count);
24139 return PyUnicode_Join(__pyx_empty_unicode, value_tuple);
24140 #endif
24141 }
24142
24143 /* PyDictVersioning */
24144 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
24145 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
24146 PyObject *dict = Py_TYPE(obj)->tp_dict;
24147 return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
24148 }
24149 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
24150 PyObject **dictptr = NULL;
24151 Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
24152 if (offset) {
24153 #if CYTHON_COMPILING_IN_CPYTHON
24154 dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
24155 #else
24156 dictptr = _PyObject_GetDictPtr(obj);
24157 #endif
24158 }
24159 return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
24160 }
24161 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
24162 PyObject *dict = Py_TYPE(obj)->tp_dict;
24163 if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
24164 return 0;
24165 return obj_dict_version == __Pyx_get_object_dict_version(obj);
24166 }
24167 #endif
24168
24169 /* GetModuleGlobalName */
24170 #if CYTHON_USE_DICT_VERSIONS
24171 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
24172 #else
24173 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
24174 #endif
24175 {
24176 PyObject *result;
24177 #if !CYTHON_AVOID_BORROWED_REFS
24178 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && PY_VERSION_HEX < 0x030d0000
24179 result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
24180 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
24181 if (likely(result)) {
24182 return __Pyx_NewRef(result);
24183 } else if (unlikely(PyErr_Occurred())) {
24184 return NULL;
24185 }
24186 #elif CYTHON_COMPILING_IN_LIMITED_API
24187 if (unlikely(!__pyx_m)) {
24188 return NULL;
24189 }
24190 result = PyObject_GetAttr(__pyx_m, name);
24191 if (likely(result)) {
24192 return result;
24193 }
24194 #else
24195 result = PyDict_GetItem(__pyx_d, name);
24196 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
24197 if (likely(result)) {
24198 return __Pyx_NewRef(result);
24199 }
24200 #endif
24201 #else
24202 result = PyObject_GetItem(__pyx_d, name);
24203 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
24204 if (likely(result)) {
24205 return __Pyx_NewRef(result);
24206 }
24207 PyErr_Clear();
24208 #endif
24209 return __Pyx_GetBuiltinName(name);
24210 }
24211
24212 /* GetItemInt */
24213 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
24214 PyObject *r;
24215 if (unlikely(!j)) return NULL;
24216 r = PyObject_GetItem(o, j);
24217 Py_DECREF(j);
24218 return r;
24219 }
24220 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
24221 CYTHON_NCP_UNUSED int wraparound,
24222 CYTHON_NCP_UNUSED int boundscheck) {
24223 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
24224 Py_ssize_t wrapped_i = i;
24225 if (wraparound & unlikely(i < 0)) {
24226 wrapped_i += PyList_GET_SIZE(o);
24227 }
24228 if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
24229 PyObject *r = PyList_GET_ITEM(o, wrapped_i);
24230 Py_INCREF(r);
24231 return r;
24232 }
24233 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
24234 #else
24235 return PySequence_GetItem(o, i);
24236 #endif
24237 }
24238 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
24239 CYTHON_NCP_UNUSED int wraparound,
24240 CYTHON_NCP_UNUSED int boundscheck) {
24241 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
24242 Py_ssize_t wrapped_i = i;
24243 if (wraparound & unlikely(i < 0)) {
24244 wrapped_i += PyTuple_GET_SIZE(o);
24245 }
24246 if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
24247 PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
24248 Py_INCREF(r);
24249 return r;
24250 }
24251 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
24252 #else
24253 return PySequence_GetItem(o, i);
24254 #endif
24255 }
24256 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
24257 CYTHON_NCP_UNUSED int wraparound,
24258 CYTHON_NCP_UNUSED int boundscheck) {
24259 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
24260 if (is_list || PyList_CheckExact(o)) {
24261 Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
24262 if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
24263 PyObject *r = PyList_GET_ITEM(o, n);
24264 Py_INCREF(r);
24265 return r;
24266 }
24267 }
24268 else if (PyTuple_CheckExact(o)) {
24269 Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
24270 if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
24271 PyObject *r = PyTuple_GET_ITEM(o, n);
24272 Py_INCREF(r);
24273 return r;
24274 }
24275 } else {
24276 PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping;
24277 PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence;
24278 if (mm && mm->mp_subscript) {
24279 PyObject *r, *key = PyInt_FromSsize_t(i);
24280 if (unlikely(!key)) return NULL;
24281 r = mm->mp_subscript(o, key);
24282 Py_DECREF(key);
24283 return r;
24284 }
24285 if (likely(sm && sm->sq_item)) {
24286 if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) {
24287 Py_ssize_t l = sm->sq_length(o);
24288 if (likely(l >= 0)) {
24289 i += l;
24290 } else {
24291 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
24292 return NULL;
24293 PyErr_Clear();
24294 }
24295 }
24296 return sm->sq_item(o, i);
24297 }
24298 }
24299 #else
24300 if (is_list || !PyMapping_Check(o)) {
24301 return PySequence_GetItem(o, i);
24302 }
24303 #endif
24304 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
24305 }
24306
24307 /* ObjectGetItem */
24308 #if CYTHON_USE_TYPE_SLOTS
24309 static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject *index) {
24310 PyObject *runerr = NULL;
24311 Py_ssize_t key_value;
24312 key_value = __Pyx_PyIndex_AsSsize_t(index);
24313 if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
24314 return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
24315 }
24316 if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
24317 __Pyx_TypeName index_type_name = __Pyx_PyType_GetName(Py_TYPE(index));
24318 PyErr_Clear();
24319 PyErr_Format(PyExc_IndexError,
24320 "cannot fit '" __Pyx_FMT_TYPENAME "' into an index-sized integer", index_type_name);
24321 __Pyx_DECREF_TypeName(index_type_name);
24322 }
24323 return NULL;
24324 }
24325 static PyObject *__Pyx_PyObject_GetItem_Slow(PyObject *obj, PyObject *key) {
24326 __Pyx_TypeName obj_type_name;
24327 if (likely(PyType_Check(obj))) {
24328 PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(obj, __pyx_n_s_class_getitem);
24329 if (!meth) {
24330 PyErr_Clear();
24331 } else {
24332 PyObject *result = __Pyx_PyObject_CallOneArg(meth, key);
24333 Py_DECREF(meth);
24334 return result;
24335 }
24336 }
24337 obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj));
24338 PyErr_Format(PyExc_TypeError,
24339 "'" __Pyx_FMT_TYPENAME "' object is not subscriptable", obj_type_name);
24340 __Pyx_DECREF_TypeName(obj_type_name);
24341 return NULL;
24342 }
24343 static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key) {
24344 PyTypeObject *tp = Py_TYPE(obj);
24345 PyMappingMethods *mm = tp->tp_as_mapping;
24346 PySequenceMethods *sm = tp->tp_as_sequence;
24347 if (likely(mm && mm->mp_subscript)) {
24348 return mm->mp_subscript(obj, key);
24349 }
24350 if (likely(sm && sm->sq_item)) {
24351 return __Pyx_PyObject_GetIndex(obj, key);
24352 }
24353 return __Pyx_PyObject_GetItem_Slow(obj, key);
24354 }
24355 #endif
24356
24357 /* GetException */
24358 #if CYTHON_FAST_THREAD_STATE
24359 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
24360 #else
24361 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
24362 #endif
24363 {
24364 PyObject *local_type = NULL, *local_value, *local_tb = NULL;
24365 #if CYTHON_FAST_THREAD_STATE
24366 PyObject *tmp_type, *tmp_value, *tmp_tb;
24367 #if PY_VERSION_HEX >= 0x030C00A6
24368 local_value = tstate->current_exception;
24369 tstate->current_exception = 0;
24370 if (likely(local_value)) {
24371 local_type = (PyObject*) Py_TYPE(local_value);
24372 Py_INCREF(local_type);
24373 local_tb = PyException_GetTraceback(local_value);
24374 }
24375 #else
24376 local_type = tstate->curexc_type;
24377 local_value = tstate->curexc_value;
24378 local_tb = tstate->curexc_traceback;
24379 tstate->curexc_type = 0;
24380 tstate->curexc_value = 0;
24381 tstate->curexc_traceback = 0;
24382 #endif
24383 #else
24384 PyErr_Fetch(&local_type, &local_value, &local_tb);
24385 #endif
24386 PyErr_NormalizeException(&local_type, &local_value, &local_tb);
24387 #if CYTHON_FAST_THREAD_STATE && PY_VERSION_HEX >= 0x030C00A6
24388 if (unlikely(tstate->current_exception))
24389 #elif CYTHON_FAST_THREAD_STATE
24390 if (unlikely(tstate->curexc_type))
24391 #else
24392 if (unlikely(PyErr_Occurred()))
24393 #endif
24394 goto bad;
24395 #if PY_MAJOR_VERSION >= 3
24396 if (local_tb) {
24397 if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
24398 goto bad;
24399 }
24400 #endif
24401 Py_XINCREF(local_tb);
24402 Py_XINCREF(local_type);
24403 Py_XINCREF(local_value);
24404 *type = local_type;
24405 *value = local_value;
24406 *tb = local_tb;
24407 #if CYTHON_FAST_THREAD_STATE
24408 #if CYTHON_USE_EXC_INFO_STACK
24409 {
24410 _PyErr_StackItem *exc_info = tstate->exc_info;
24411 #if PY_VERSION_HEX >= 0x030B00a4
24412 tmp_value = exc_info->exc_value;
24413 exc_info->exc_value = local_value;
24414 tmp_type = NULL;
24415 tmp_tb = NULL;
24416 Py_XDECREF(local_type);
24417 Py_XDECREF(local_tb);
24418 #else
24419 tmp_type = exc_info->exc_type;
24420 tmp_value = exc_info->exc_value;
24421 tmp_tb = exc_info->exc_traceback;
24422 exc_info->exc_type = local_type;
24423 exc_info->exc_value = local_value;
24424 exc_info->exc_traceback = local_tb;
24425 #endif
24426 }
24427 #else
24428 tmp_type = tstate->exc_type;
24429 tmp_value = tstate->exc_value;
24430 tmp_tb = tstate->exc_traceback;
24431 tstate->exc_type = local_type;
24432 tstate->exc_value = local_value;
24433 tstate->exc_traceback = local_tb;
24434 #endif
24435 Py_XDECREF(tmp_type);
24436 Py_XDECREF(tmp_value);
24437 Py_XDECREF(tmp_tb);
24438 #else
24439 PyErr_SetExcInfo(local_type, local_value, local_tb);
24440 #endif
24441 return 0;
24442 bad:
24443 *type = 0;
24444 *value = 0;
24445 *tb = 0;
24446 Py_XDECREF(local_type);
24447 Py_XDECREF(local_value);
24448 Py_XDECREF(local_tb);
24449 return -1;
24450 }
24451
24452 /* SwapException */
24453 #if CYTHON_FAST_THREAD_STATE
24454 static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
24455 PyObject *tmp_type, *tmp_value, *tmp_tb;
24456 #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4
24457 _PyErr_StackItem *exc_info = tstate->exc_info;
24458 tmp_value = exc_info->exc_value;
24459 exc_info->exc_value = *value;
24460 if (tmp_value == NULL || tmp_value == Py_None) {
24461 Py_XDECREF(tmp_value);
24462 tmp_value = NULL;
24463 tmp_type = NULL;
24464 tmp_tb = NULL;
24465 } else {
24466 tmp_type = (PyObject*) Py_TYPE(tmp_value);
24467 Py_INCREF(tmp_type);
24468 #if CYTHON_COMPILING_IN_CPYTHON
24469 tmp_tb = ((PyBaseExceptionObject*) tmp_value)->traceback;
24470 Py_XINCREF(tmp_tb);
24471 #else
24472 tmp_tb = PyException_GetTraceback(tmp_value);
24473 #endif
24474 }
24475 #elif CYTHON_USE_EXC_INFO_STACK
24476 _PyErr_StackItem *exc_info = tstate->exc_info;
24477 tmp_type = exc_info->exc_type;
24478 tmp_value = exc_info->exc_value;
24479 tmp_tb = exc_info->exc_traceback;
24480 exc_info->exc_type = *type;
24481 exc_info->exc_value = *value;
24482 exc_info->exc_traceback = *tb;
24483 #else
24484 tmp_type = tstate->exc_type;
24485 tmp_value = tstate->exc_value;
24486 tmp_tb = tstate->exc_traceback;
24487 tstate->exc_type = *type;
24488 tstate->exc_value = *value;
24489 tstate->exc_traceback = *tb;
24490 #endif
24491 *type = tmp_type;
24492 *value = tmp_value;
24493 *tb = tmp_tb;
24494 }
24495 #else
24496 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
24497 PyObject *tmp_type, *tmp_value, *tmp_tb;
24498 PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
24499 PyErr_SetExcInfo(*type, *value, *tb);
24500 *type = tmp_type;
24501 *value = tmp_value;
24502 *tb = tmp_tb;
24503 }
24504 #endif
24505
24506 /* GetTopmostException */
24507 #if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE
24508 static _PyErr_StackItem *
24509 __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
24510 {
24511 _PyErr_StackItem *exc_info = tstate->exc_info;
24512 while ((exc_info->exc_value == NULL || exc_info->exc_value == Py_None) &&
24513 exc_info->previous_item != NULL)
24514 {
24515 exc_info = exc_info->previous_item;
24516 }
24517 return exc_info;
24518 }
24519 #endif
24520
24521 /* SaveResetException */
24522 #if CYTHON_FAST_THREAD_STATE
24523 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
24524 #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4
24525 _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
24526 PyObject *exc_value = exc_info->exc_value;
24527 if (exc_value == NULL || exc_value == Py_None) {
24528 *value = NULL;
24529 *type = NULL;
24530 *tb = NULL;
24531 } else {
24532 *value = exc_value;
24533 Py_INCREF(*value);
24534 *type = (PyObject*) Py_TYPE(exc_value);
24535 Py_INCREF(*type);
24536 *tb = PyException_GetTraceback(exc_value);
24537 }
24538 #elif CYTHON_USE_EXC_INFO_STACK
24539 _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
24540 *type = exc_info->exc_type;
24541 *value = exc_info->exc_value;
24542 *tb = exc_info->exc_traceback;
24543 Py_XINCREF(*type);
24544 Py_XINCREF(*value);
24545 Py_XINCREF(*tb);
24546 #else
24547 *type = tstate->exc_type;
24548 *value = tstate->exc_value;
24549 *tb = tstate->exc_traceback;
24550 Py_XINCREF(*type);
24551 Py_XINCREF(*value);
24552 Py_XINCREF(*tb);
24553 #endif
24554 }
24555 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
24556 #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4
24557 _PyErr_StackItem *exc_info = tstate->exc_info;
24558 PyObject *tmp_value = exc_info->exc_value;
24559 exc_info->exc_value = value;
24560 Py_XDECREF(tmp_value);
24561 Py_XDECREF(type);
24562 Py_XDECREF(tb);
24563 #else
24564 PyObject *tmp_type, *tmp_value, *tmp_tb;
24565 #if CYTHON_USE_EXC_INFO_STACK
24566 _PyErr_StackItem *exc_info = tstate->exc_info;
24567 tmp_type = exc_info->exc_type;
24568 tmp_value = exc_info->exc_value;
24569 tmp_tb = exc_info->exc_traceback;
24570 exc_info->exc_type = type;
24571 exc_info->exc_value = value;
24572 exc_info->exc_traceback = tb;
24573 #else
24574 tmp_type = tstate->exc_type;
24575 tmp_value = tstate->exc_value;
24576 tmp_tb = tstate->exc_traceback;
24577 tstate->exc_type = type;
24578 tstate->exc_value = value;
24579 tstate->exc_traceback = tb;
24580 #endif
24581 Py_XDECREF(tmp_type);
24582 Py_XDECREF(tmp_value);
24583 Py_XDECREF(tmp_tb);
24584 #endif
24585 }
24586 #endif
24587
24588 /* PyIntBinop */
24589 #if !CYTHON_COMPILING_IN_PYPY
24590 static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
24591 CYTHON_MAYBE_UNUSED_VAR(intval);
24592 CYTHON_MAYBE_UNUSED_VAR(inplace);
24593 CYTHON_UNUSED_VAR(zerodivision_check);
24594 #if PY_MAJOR_VERSION < 3
24595 if (likely(PyInt_CheckExact(op1))) {
24596 const long b = intval;
24597 long x;
24598 long a = PyInt_AS_LONG(op1);
24599
24600 x = (long)((unsigned long)a - (unsigned long)b);
24601 if (likely((x^a) >= 0 || (x^~b) >= 0))
24602 return PyInt_FromLong(x);
24603 return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
24604 }
24605 #endif
24606 #if CYTHON_USE_PYLONG_INTERNALS
24607 if (likely(PyLong_CheckExact(op1))) {
24608 const long b = intval;
24609 long a, x;
24610 #ifdef HAVE_LONG_LONG
24611 const PY_LONG_LONG llb = intval;
24612 PY_LONG_LONG lla, llx;
24613 #endif
24614 if (unlikely(__Pyx_PyLong_IsZero(op1))) {
24615 return PyLong_FromLong(-intval);
24616 }
24617 if (likely(__Pyx_PyLong_IsCompact(op1))) {
24618 a = __Pyx_PyLong_CompactValue(op1);
24619 } else {
24620 const digit* digits = __Pyx_PyLong_Digits(op1);
24621 const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(op1);
24622 switch (size) {
24623 case -2:
24624 if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
24625 a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
24626 break;
24627 #ifdef HAVE_LONG_LONG
24628 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
24629 lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
24630 goto long_long;
24631 #endif
24632 }
24633 CYTHON_FALLTHROUGH;
24634 case 2:
24635 if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
24636 a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
24637 break;
24638 #ifdef HAVE_LONG_LONG
24639 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
24640 lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
24641 goto long_long;
24642 #endif
24643 }
24644 CYTHON_FALLTHROUGH;
24645 case -3:
24646 if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
24647 a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
24648 break;
24649 #ifdef HAVE_LONG_LONG
24650 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
24651 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]));
24652 goto long_long;
24653 #endif
24654 }
24655 CYTHON_FALLTHROUGH;
24656 case 3:
24657 if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
24658 a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
24659 break;
24660 #ifdef HAVE_LONG_LONG
24661 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
24662 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]));
24663 goto long_long;
24664 #endif
24665 }
24666 CYTHON_FALLTHROUGH;
24667 case -4:
24668 if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
24669 a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
24670 break;
24671 #ifdef HAVE_LONG_LONG
24672 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
24673 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]));
24674 goto long_long;
24675 #endif
24676 }
24677 CYTHON_FALLTHROUGH;
24678 case 4:
24679 if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
24680 a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
24681 break;
24682 #ifdef HAVE_LONG_LONG
24683 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
24684 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]));
24685 goto long_long;
24686 #endif
24687 }
24688 CYTHON_FALLTHROUGH;
24689 default: return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
24690 }
24691 }
24692 x = a - b;
24693 return PyLong_FromLong(x);
24694 #ifdef HAVE_LONG_LONG
24695 long_long:
24696 llx = lla - llb;
24697 return PyLong_FromLongLong(llx);
24698 #endif
24699
24700
24701 }
24702 #endif
24703 if (PyFloat_CheckExact(op1)) {
24704 const long b = intval;
24705 #if CYTHON_COMPILING_IN_LIMITED_API
24706 double a = __pyx_PyFloat_AsDouble(op1);
24707 #else
24708 double a = PyFloat_AS_DOUBLE(op1);
24709 #endif
24710 double result;
24711
24712 PyFPE_START_PROTECT("subtract", return NULL)
24713 result = ((double)a) - (double)b;
24714 PyFPE_END_PROTECT(result)
24715 return PyFloat_FromDouble(result);
24716 }
24717 return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2);
24718 }
24719 #endif
24720
24721 /* RaiseTooManyValuesToUnpack */
24722 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
24723 PyErr_Format(PyExc_ValueError,
24724 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
24725 }
24726
24727 /* RaiseNeedMoreValuesToUnpack */
24728 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
24729 PyErr_Format(PyExc_ValueError,
24730 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
24731 index, (index == 1) ? "" : "s");
24732 }
24733
24734 /* IterFinish */
24735 static CYTHON_INLINE int __Pyx_IterFinish(void) {
24736 PyObject* exc_type;
24737 __Pyx_PyThreadState_declare
24738 __Pyx_PyThreadState_assign
24739 exc_type = __Pyx_PyErr_CurrentExceptionType();
24740 if (unlikely(exc_type)) {
24741 if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))
24742 return -1;
24743 __Pyx_PyErr_Clear();
24744 return 0;
24745 }
24746 return 0;
24747 }
24748
24749 /* UnpackItemEndCheck */
24750 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
24751 if (unlikely(retval)) {
24752 Py_DECREF(retval);
24753 __Pyx_RaiseTooManyValuesError(expected);
24754 return -1;
24755 }
24756 return __Pyx_IterFinish();
24757 }
24758
24759 /* PyIntCompare */
24760 static CYTHON_INLINE PyObject* __Pyx_PyInt_NeObjC(PyObject *op1, PyObject *op2, long intval, long inplace) {
24761 CYTHON_MAYBE_UNUSED_VAR(intval);
24762 CYTHON_UNUSED_VAR(inplace);
24763 if (op1 == op2) {
24764 Py_RETURN_FALSE;
24765 }
24766 #if PY_MAJOR_VERSION < 3
24767 if (likely(PyInt_CheckExact(op1))) {
24768 const long b = intval;
24769 long a = PyInt_AS_LONG(op1);
24770 if (a != b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
24771 }
24772 #endif
24773 #if CYTHON_USE_PYLONG_INTERNALS
24774 if (likely(PyLong_CheckExact(op1))) {
24775 int unequal;
24776 unsigned long uintval;
24777 Py_ssize_t size = __Pyx_PyLong_DigitCount(op1);
24778 const digit* digits = __Pyx_PyLong_Digits(op1);
24779 if (intval == 0) {
24780 if (__Pyx_PyLong_IsZero(op1) != 1) Py_RETURN_TRUE; else Py_RETURN_FALSE;
24781 } else if (intval < 0) {
24782 if (__Pyx_PyLong_IsNonNeg(op1))
24783 Py_RETURN_TRUE;
24784 intval = -intval;
24785 } else {
24786 if (__Pyx_PyLong_IsNeg(op1))
24787 Py_RETURN_TRUE;
24788 }
24789 uintval = (unsigned long) intval;
24790 #if PyLong_SHIFT * 4 < SIZEOF_LONG*8
24791 if (uintval >> (PyLong_SHIFT * 4)) {
24792 unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
24793 | (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));
24794 } else
24795 #endif
24796 #if PyLong_SHIFT * 3 < SIZEOF_LONG*8
24797 if (uintval >> (PyLong_SHIFT * 3)) {
24798 unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
24799 | (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));
24800 } else
24801 #endif
24802 #if PyLong_SHIFT * 2 < SIZEOF_LONG*8
24803 if (uintval >> (PyLong_SHIFT * 2)) {
24804 unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
24805 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
24806 } else
24807 #endif
24808 #if PyLong_SHIFT * 1 < SIZEOF_LONG*8
24809 if (uintval >> (PyLong_SHIFT * 1)) {
24810 unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
24811 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
24812 } else
24813 #endif
24814 unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK));
24815 if (unequal != 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
24816 }
24817 #endif
24818 if (PyFloat_CheckExact(op1)) {
24819 const long b = intval;
24820 #if CYTHON_COMPILING_IN_LIMITED_API
24821 double a = __pyx_PyFloat_AsDouble(op1);
24822 #else
24823 double a = PyFloat_AS_DOUBLE(op1);
24824 #endif
24825 if ((double)a != (double)b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
24826 }
24827 return (
24828 PyObject_RichCompare(op1, op2, Py_NE));
24829 }
24830
24831 /* FixUpExtensionType */
24832 #if CYTHON_USE_TYPE_SPECS
24833 static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type) {
24834 #if PY_VERSION_HEX > 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
24835 CYTHON_UNUSED_VAR(spec);
24836 CYTHON_UNUSED_VAR(type);
24837 #else
24838 const PyType_Slot *slot = spec->slots;
24839 while (slot && slot->slot && slot->slot != Py_tp_members)
24840 slot++;
24841 if (slot && slot->slot == Py_tp_members) {
24842 int changed = 0;
24843 #if !(PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON)
24844 const
24845 #endif
24846 PyMemberDef *memb = (PyMemberDef*) slot->pfunc;
24847 while (memb && memb->name) {
24848 if (memb->name[0] == '_' && memb->name[1] == '_') {
24849 #if PY_VERSION_HEX < 0x030900b1
24850 if (strcmp(memb->name, "__weaklistoffset__") == 0) {
24851 assert(memb->type == T_PYSSIZET);
24852 assert(memb->flags == READONLY);
24853 type->tp_weaklistoffset = memb->offset;
24854 changed = 1;
24855 }
24856 else if (strcmp(memb->name, "__dictoffset__") == 0) {
24857 assert(memb->type == T_PYSSIZET);
24858 assert(memb->flags == READONLY);
24859 type->tp_dictoffset = memb->offset;
24860 changed = 1;
24861 }
24862 #if CYTHON_METH_FASTCALL
24863 else if (strcmp(memb->name, "__vectorcalloffset__") == 0) {
24864 assert(memb->type == T_PYSSIZET);
24865 assert(memb->flags == READONLY);
24866 #if PY_VERSION_HEX >= 0x030800b4
24867 type->tp_vectorcall_offset = memb->offset;
24868 #else
24869 type->tp_print = (printfunc) memb->offset;
24870 #endif
24871 changed = 1;
24872 }
24873 #endif
24874 #else
24875 if ((0));
24876 #endif
24877 #if PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON
24878 else if (strcmp(memb->name, "__module__") == 0) {
24879 PyObject *descr;
24880 assert(memb->type == T_OBJECT);
24881 assert(memb->flags == 0 || memb->flags == READONLY);
24882 descr = PyDescr_NewMember(type, memb);
24883 if (unlikely(!descr))
24884 return -1;
24885 if (unlikely(PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr) < 0)) {
24886 Py_DECREF(descr);
24887 return -1;
24888 }
24889 Py_DECREF(descr);
24890 changed = 1;
24891 }
24892 #endif
24893 }
24894 memb++;
24895 }
24896 if (changed)
24897 PyType_Modified(type);
24898 }
24899 #endif
24900 return 0;
24901 }
24902 #endif
24903
24904 /* PyObjectCallMethod0 */
24905 static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) {
24906 PyObject *method = NULL, *result = NULL;
24907 int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
24908 if (likely(is_method)) {
24909 result = __Pyx_PyObject_CallOneArg(method, obj);
24910 Py_DECREF(method);
24911 return result;
24912 }
24913 if (unlikely(!method)) goto bad;
24914 result = __Pyx_PyObject_CallNoArg(method);
24915 Py_DECREF(method);
24916 bad:
24917 return result;
24918 }
24919
24920 /* ValidateBasesTuple */
24921 #if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS
24922 static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases) {
24923 Py_ssize_t i, n;
24924 #if CYTHON_ASSUME_SAFE_MACROS
24925 n = PyTuple_GET_SIZE(bases);
24926 #else
24927 n = PyTuple_Size(bases);
24928 if (n < 0) return -1;
24929 #endif
24930 for (i = 1; i < n; i++)
24931 {
24932 #if CYTHON_AVOID_BORROWED_REFS
24933 PyObject *b0 = PySequence_GetItem(bases, i);
24934 if (!b0) return -1;
24935 #elif CYTHON_ASSUME_SAFE_MACROS
24936 PyObject *b0 = PyTuple_GET_ITEM(bases, i);
24937 #else
24938 PyObject *b0 = PyTuple_GetItem(bases, i);
24939 if (!b0) return -1;
24940 #endif
24941 PyTypeObject *b;
24942 #if PY_MAJOR_VERSION < 3
24943 if (PyClass_Check(b0))
24944 {
24945 PyErr_Format(PyExc_TypeError, "base class '%.200s' is an old-style class",
24946 PyString_AS_STRING(((PyClassObject*)b0)->cl_name));
24947 #if CYTHON_AVOID_BORROWED_REFS
24948 Py_DECREF(b0);
24949 #endif
24950 return -1;
24951 }
24952 #endif
24953 b = (PyTypeObject*) b0;
24954 if (!__Pyx_PyType_HasFeature(b, Py_TPFLAGS_HEAPTYPE))
24955 {
24956 __Pyx_TypeName b_name = __Pyx_PyType_GetName(b);
24957 PyErr_Format(PyExc_TypeError,
24958 "base class '" __Pyx_FMT_TYPENAME "' is not a heap type", b_name);
24959 __Pyx_DECREF_TypeName(b_name);
24960 #if CYTHON_AVOID_BORROWED_REFS
24961 Py_DECREF(b0);
24962 #endif
24963 return -1;
24964 }
24965 if (dictoffset == 0)
24966 {
24967 Py_ssize_t b_dictoffset = 0;
24968 #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY
24969 b_dictoffset = b->tp_dictoffset;
24970 #else
24971 PyObject *py_b_dictoffset = PyObject_GetAttrString((PyObject*)b, "__dictoffset__");
24972 if (!py_b_dictoffset) goto dictoffset_return;
24973 b_dictoffset = PyLong_AsSsize_t(py_b_dictoffset);
24974 Py_DECREF(py_b_dictoffset);
24975 if (b_dictoffset == -1 && PyErr_Occurred()) goto dictoffset_return;
24976 #endif
24977 if (b_dictoffset) {
24978 {
24979 __Pyx_TypeName b_name = __Pyx_PyType_GetName(b);
24980 PyErr_Format(PyExc_TypeError,
24981 "extension type '%.200s' has no __dict__ slot, "
24982 "but base type '" __Pyx_FMT_TYPENAME "' has: "
24983 "either add 'cdef dict __dict__' to the extension type "
24984 "or add '__slots__ = [...]' to the base type",
24985 type_name, b_name);
24986 __Pyx_DECREF_TypeName(b_name);
24987 }
24988 #if !(CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY)
24989 dictoffset_return:
24990 #endif
24991 #if CYTHON_AVOID_BORROWED_REFS
24992 Py_DECREF(b0);
24993 #endif
24994 return -1;
24995 }
24996 }
24997 #if CYTHON_AVOID_BORROWED_REFS
24998 Py_DECREF(b0);
24999 #endif
25000 }
25001 return 0;
25002 }
25003 #endif
25004
25005 /* PyType_Ready */
25006 static int __Pyx_PyType_Ready(PyTypeObject *t) {
25007 #if CYTHON_USE_TYPE_SPECS || !(CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API) || defined(PYSTON_MAJOR_VERSION)
25008 (void)__Pyx_PyObject_CallMethod0;
25009 #if CYTHON_USE_TYPE_SPECS
25010 (void)__Pyx_validate_bases_tuple;
25011 #endif
25012 return PyType_Ready(t);
25013 #else
25014 int r;
25015 PyObject *bases = __Pyx_PyType_GetSlot(t, tp_bases, PyObject*);
25016 if (bases && unlikely(__Pyx_validate_bases_tuple(t->tp_name, t->tp_dictoffset, bases) == -1))
25017 return -1;
25018 #if PY_VERSION_HEX >= 0x03050000 && !defined(PYSTON_MAJOR_VERSION)
25019 {
25020 int gc_was_enabled;
25021 #if PY_VERSION_HEX >= 0x030A00b1
25022 gc_was_enabled = PyGC_Disable();
25023 (void)__Pyx_PyObject_CallMethod0;
25024 #else
25025 PyObject *ret, *py_status;
25026 PyObject *gc = NULL;
25027 #if PY_VERSION_HEX >= 0x030700a1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM+0 >= 0x07030400)
25028 gc = PyImport_GetModule(__pyx_kp_u_gc);
25029 #endif
25030 if (unlikely(!gc)) gc = PyImport_Import(__pyx_kp_u_gc);
25031 if (unlikely(!gc)) return -1;
25032 py_status = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_isenabled);
25033 if (unlikely(!py_status)) {
25034 Py_DECREF(gc);
25035 return -1;
25036 }
25037 gc_was_enabled = __Pyx_PyObject_IsTrue(py_status);
25038 Py_DECREF(py_status);
25039 if (gc_was_enabled > 0) {
25040 ret = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_disable);
25041 if (unlikely(!ret)) {
25042 Py_DECREF(gc);
25043 return -1;
25044 }
25045 Py_DECREF(ret);
25046 } else if (unlikely(gc_was_enabled == -1)) {
25047 Py_DECREF(gc);
25048 return -1;
25049 }
25050 #endif
25051 t->tp_flags |= Py_TPFLAGS_HEAPTYPE;
25052 #if PY_VERSION_HEX >= 0x030A0000
25053 t->tp_flags |= Py_TPFLAGS_IMMUTABLETYPE;
25054 #endif
25055 #else
25056 (void)__Pyx_PyObject_CallMethod0;
25057 #endif
25058 r = PyType_Ready(t);
25059 #if PY_VERSION_HEX >= 0x03050000 && !defined(PYSTON_MAJOR_VERSION)
25060 t->tp_flags &= ~Py_TPFLAGS_HEAPTYPE;
25061 #if PY_VERSION_HEX >= 0x030A00b1
25062 if (gc_was_enabled)
25063 PyGC_Enable();
25064 #else
25065 if (gc_was_enabled) {
25066 PyObject *tp, *v, *tb;
25067 PyErr_Fetch(&tp, &v, &tb);
25068 ret = __Pyx_PyObject_CallMethod0(gc, __pyx_kp_u_enable);
25069 if (likely(ret || r == -1)) {
25070 Py_XDECREF(ret);
25071 PyErr_Restore(tp, v, tb);
25072 } else {
25073 Py_XDECREF(tp);
25074 Py_XDECREF(v);
25075 Py_XDECREF(tb);
25076 r = -1;
25077 }
25078 }
25079 Py_DECREF(gc);
25080 #endif
25081 }
25082 #endif
25083 return r;
25084 #endif
25085 }
25086
25087 /* PyObject_GenericGetAttrNoDict */
25088 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
25089 static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
25090 __Pyx_TypeName type_name = __Pyx_PyType_GetName(tp);
25091 PyErr_Format(PyExc_AttributeError,
25092 #if PY_MAJOR_VERSION >= 3
25093 "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'",
25094 type_name, attr_name);
25095 #else
25096 "'" __Pyx_FMT_TYPENAME "' object has no attribute '%.400s'",
25097 type_name, PyString_AS_STRING(attr_name));
25098 #endif
25099 __Pyx_DECREF_TypeName(type_name);
25100 return NULL;
25101 }
25102 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
25103 PyObject *descr;
25104 PyTypeObject *tp = Py_TYPE(obj);
25105 if (unlikely(!PyString_Check(attr_name))) {
25106 return PyObject_GenericGetAttr(obj, attr_name);
25107 }
25108 assert(!tp->tp_dictoffset);
25109 descr = _PyType_Lookup(tp, attr_name);
25110 if (unlikely(!descr)) {
25111 return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
25112 }
25113 Py_INCREF(descr);
25114 #if PY_MAJOR_VERSION < 3
25115 if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
25116 #endif
25117 {
25118 descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
25119 if (unlikely(f)) {
25120 PyObject *res = f(descr, obj, (PyObject *)tp);
25121 Py_DECREF(descr);
25122 return res;
25123 }
25124 }
25125 return descr;
25126 }
25127 #endif
25128
25129 /* PyObject_GenericGetAttr */
25130 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
25131 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
25132 if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
25133 return PyObject_GenericGetAttr(obj, attr_name);
25134 }
25135 return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
25136 }
25137 #endif
25138
25139 /* SetVTable */
25140 static int __Pyx_SetVtable(PyTypeObject *type, void *vtable) {
25141 PyObject *ob = PyCapsule_New(vtable, 0, 0);
25142 if (unlikely(!ob))
25143 goto bad;
25144 #if CYTHON_COMPILING_IN_LIMITED_API
25145 if (unlikely(PyObject_SetAttr((PyObject *) type, __pyx_n_s_pyx_vtable, ob) < 0))
25146 #else
25147 if (unlikely(PyDict_SetItem(type->tp_dict, __pyx_n_s_pyx_vtable, ob) < 0))
25148 #endif
25149 goto bad;
25150 Py_DECREF(ob);
25151 return 0;
25152 bad:
25153 Py_XDECREF(ob);
25154 return -1;
25155 }
25156
25157 /* GetVTable */
25158 static void* __Pyx_GetVtable(PyTypeObject *type) {
25159 void* ptr;
25160 #if CYTHON_COMPILING_IN_LIMITED_API
25161 PyObject *ob = PyObject_GetAttr((PyObject *)type, __pyx_n_s_pyx_vtable);
25162 #else
25163 PyObject *ob = PyObject_GetItem(type->tp_dict, __pyx_n_s_pyx_vtable);
25164 #endif
25165 if (!ob)
25166 goto bad;
25167 ptr = PyCapsule_GetPointer(ob, 0);
25168 if (!ptr && !PyErr_Occurred())
25169 PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type");
25170 Py_DECREF(ob);
25171 return ptr;
25172 bad:
25173 Py_XDECREF(ob);
25174 return NULL;
25175 }
25176
25177 /* MergeVTables */
25178 #if !CYTHON_COMPILING_IN_LIMITED_API
25179 static int __Pyx_MergeVtables(PyTypeObject *type) {
25180 int i;
25181 void** base_vtables;
25182 __Pyx_TypeName tp_base_name;
25183 __Pyx_TypeName base_name;
25184 void* unknown = (void*)-1;
25185 PyObject* bases = type->tp_bases;
25186 int base_depth = 0;
25187 {
25188 PyTypeObject* base = type->tp_base;
25189 while (base) {
25190 base_depth += 1;
25191 base = base->tp_base;
25192 }
25193 }
25194 base_vtables = (void**) malloc(sizeof(void*) * (size_t)(base_depth + 1));
25195 base_vtables[0] = unknown;
25196 for (i = 1; i < PyTuple_GET_SIZE(bases); i++) {
25197 void* base_vtable = __Pyx_GetVtable(((PyTypeObject*)PyTuple_GET_ITEM(bases, i)));
25198 if (base_vtable != NULL) {
25199 int j;
25200 PyTypeObject* base = type->tp_base;
25201 for (j = 0; j < base_depth; j++) {
25202 if (base_vtables[j] == unknown) {
25203 base_vtables[j] = __Pyx_GetVtable(base);
25204 base_vtables[j + 1] = unknown;
25205 }
25206 if (base_vtables[j] == base_vtable) {
25207 break;
25208 } else if (base_vtables[j] == NULL) {
25209 goto bad;
25210 }
25211 base = base->tp_base;
25212 }
25213 }
25214 }
25215 PyErr_Clear();
25216 free(base_vtables);
25217 return 0;
25218 bad:
25219 tp_base_name = __Pyx_PyType_GetName(type->tp_base);
25220 base_name = __Pyx_PyType_GetName((PyTypeObject*)PyTuple_GET_ITEM(bases, i));
25221 PyErr_Format(PyExc_TypeError,
25222 "multiple bases have vtable conflict: '" __Pyx_FMT_TYPENAME "' and '" __Pyx_FMT_TYPENAME "'", tp_base_name, base_name);
25223 __Pyx_DECREF_TypeName(tp_base_name);
25224 __Pyx_DECREF_TypeName(base_name);
25225 free(base_vtables);
25226 return -1;
25227 }
25228 #endif
25229
25230 /* SetupReduce */
25231 #if !CYTHON_COMPILING_IN_LIMITED_API
25232 static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
25233 int ret;
25234 PyObject *name_attr;
25235 name_attr = __Pyx_PyObject_GetAttrStrNoError(meth, __pyx_n_s_name_2);
25236 if (likely(name_attr)) {
25237 ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
25238 } else {
25239 ret = -1;
25240 }
25241 if (unlikely(ret < 0)) {
25242 PyErr_Clear();
25243 ret = 0;
25244 }
25245 Py_XDECREF(name_attr);
25246 return ret;
25247 }
25248 static int __Pyx_setup_reduce(PyObject* type_obj) {
25249 int ret = 0;
25250 PyObject *object_reduce = NULL;
25251 PyObject *object_getstate = NULL;
25252 PyObject *object_reduce_ex = NULL;
25253 PyObject *reduce = NULL;
25254 PyObject *reduce_ex = NULL;
25255 PyObject *reduce_cython = NULL;
25256 PyObject *setstate = NULL;
25257 PyObject *setstate_cython = NULL;
25258 PyObject *getstate = NULL;
25259 #if CYTHON_USE_PYTYPE_LOOKUP
25260 getstate = _PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate);
25261 #else
25262 getstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_getstate);
25263 if (!getstate && PyErr_Occurred()) {
25264 goto __PYX_BAD;
25265 }
25266 #endif
25267 if (getstate) {
25268 #if CYTHON_USE_PYTYPE_LOOKUP
25269 object_getstate = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_getstate);
25270 #else
25271 object_getstate = __Pyx_PyObject_GetAttrStrNoError((PyObject*)&PyBaseObject_Type, __pyx_n_s_getstate);
25272 if (!object_getstate && PyErr_Occurred()) {
25273 goto __PYX_BAD;
25274 }
25275 #endif
25276 if (object_getstate != getstate) {
25277 goto __PYX_GOOD;
25278 }
25279 }
25280 #if CYTHON_USE_PYTYPE_LOOKUP
25281 object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
25282 #else
25283 object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
25284 #endif
25285 reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD;
25286 if (reduce_ex == object_reduce_ex) {
25287 #if CYTHON_USE_PYTYPE_LOOKUP
25288 object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
25289 #else
25290 object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
25291 #endif
25292 reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD;
25293 if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
25294 reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython);
25295 if (likely(reduce_cython)) {
25296 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
25297 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
25298 } else if (reduce == object_reduce || PyErr_Occurred()) {
25299 goto __PYX_BAD;
25300 }
25301 setstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate);
25302 if (!setstate) PyErr_Clear();
25303 if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
25304 setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython);
25305 if (likely(setstate_cython)) {
25306 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
25307 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
25308 } else if (!setstate || PyErr_Occurred()) {
25309 goto __PYX_BAD;
25310 }
25311 }
25312 PyType_Modified((PyTypeObject*)type_obj);
25313 }
25314 }
25315 goto __PYX_GOOD;
25316 __PYX_BAD:
25317 if (!PyErr_Occurred()) {
25318 __Pyx_TypeName type_obj_name =
25319 __Pyx_PyType_GetName((PyTypeObject*)type_obj);
25320 PyErr_Format(PyExc_RuntimeError,
25321 "Unable to initialize pickling for " __Pyx_FMT_TYPENAME, type_obj_name);
25322 __Pyx_DECREF_TypeName(type_obj_name);
25323 }
25324 ret = -1;
25325 __PYX_GOOD:
25326 #if !CYTHON_USE_PYTYPE_LOOKUP
25327 Py_XDECREF(object_reduce);
25328 Py_XDECREF(object_reduce_ex);
25329 Py_XDECREF(object_getstate);
25330 Py_XDECREF(getstate);
25331 #endif
25332 Py_XDECREF(reduce);
25333 Py_XDECREF(reduce_ex);
25334 Py_XDECREF(reduce_cython);
25335 Py_XDECREF(setstate);
25336 Py_XDECREF(setstate_cython);
25337 return ret;
25338 }
25339 #endif
25340
25341 /* TypeImport */
25342 #ifndef __PYX_HAVE_RT_ImportType_3_0_11
25343 #define __PYX_HAVE_RT_ImportType_3_0_11
25344 static PyTypeObject *__Pyx_ImportType_3_0_11(PyObject *module, const char *module_name, const char *class_name,
25345 size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_11 check_size)
25346 {
25347 PyObject *result = 0;
25348 char warning[200];
25349 Py_ssize_t basicsize;
25350 Py_ssize_t itemsize;
25351 #if CYTHON_COMPILING_IN_LIMITED_API
25352 PyObject *py_basicsize;
25353 PyObject *py_itemsize;
25354 #endif
25355 result = PyObject_GetAttrString(module, class_name);
25356 if (!result)
25357 goto bad;
25358 if (!PyType_Check(result)) {
25359 PyErr_Format(PyExc_TypeError,
25360 "%.200s.%.200s is not a type object",
25361 module_name, class_name);
25362 goto bad;
25363 }
25364 #if !CYTHON_COMPILING_IN_LIMITED_API
25365 basicsize = ((PyTypeObject *)result)->tp_basicsize;
25366 itemsize = ((PyTypeObject *)result)->tp_itemsize;
25367 #else
25368 py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
25369 if (!py_basicsize)
25370 goto bad;
25371 basicsize = PyLong_AsSsize_t(py_basicsize);
25372 Py_DECREF(py_basicsize);
25373 py_basicsize = 0;
25374 if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
25375 goto bad;
25376 py_itemsize = PyObject_GetAttrString(result, "__itemsize__");
25377 if (!py_itemsize)
25378 goto bad;
25379 itemsize = PyLong_AsSsize_t(py_itemsize);
25380 Py_DECREF(py_itemsize);
25381 py_itemsize = 0;
25382 if (itemsize == (Py_ssize_t)-1 && PyErr_Occurred())
25383 goto bad;
25384 #endif
25385 if (itemsize) {
25386 if (size % alignment) {
25387 alignment = size % alignment;
25388 }
25389 if (itemsize < (Py_ssize_t)alignment)
25390 itemsize = (Py_ssize_t)alignment;
25391 }
25392 if ((size_t)(basicsize + itemsize) < size) {
25393 PyErr_Format(PyExc_ValueError,
25394 "%.200s.%.200s size changed, may indicate binary incompatibility. "
25395 "Expected %zd from C header, got %zd from PyObject",
25396 module_name, class_name, size, basicsize+itemsize);
25397 goto bad;
25398 }
25399 if (check_size == __Pyx_ImportType_CheckSize_Error_3_0_11 &&
25400 ((size_t)basicsize > size || (size_t)(basicsize + itemsize) < size)) {
25401 PyErr_Format(PyExc_ValueError,
25402 "%.200s.%.200s size changed, may indicate binary incompatibility. "
25403 "Expected %zd from C header, got %zd-%zd from PyObject",
25404 module_name, class_name, size, basicsize, basicsize+itemsize);
25405 goto bad;
25406 }
25407 else if (check_size == __Pyx_ImportType_CheckSize_Warn_3_0_11 && (size_t)basicsize > size) {
25408 PyOS_snprintf(warning, sizeof(warning),
25409 "%s.%s size changed, may indicate binary incompatibility. "
25410 "Expected %zd from C header, got %zd from PyObject",
25411 module_name, class_name, size, basicsize);
25412 if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
25413 }
25414 return (PyTypeObject *)result;
25415 bad:
25416 Py_XDECREF(result);
25417 return NULL;
25418 }
25419 #endif
25420
25421 /* Import */
25422 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
25423 PyObject *module = 0;
25424 PyObject *empty_dict = 0;
25425 PyObject *empty_list = 0;
25426 #if PY_MAJOR_VERSION < 3
25427 PyObject *py_import;
25428 py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
25429 if (unlikely(!py_import))
25430 goto bad;
25431 if (!from_list) {
25432 empty_list = PyList_New(0);
25433 if (unlikely(!empty_list))
25434 goto bad;
25435 from_list = empty_list;
25436 }
25437 #endif
25438 empty_dict = PyDict_New();
25439 if (unlikely(!empty_dict))
25440 goto bad;
25441 {
25442 #if PY_MAJOR_VERSION >= 3
25443 if (level == -1) {
25444 if (strchr(__Pyx_MODULE_NAME, '.') != NULL) {
25445 module = PyImport_ImportModuleLevelObject(
25446 name, __pyx_d, empty_dict, from_list, 1);
25447 if (unlikely(!module)) {
25448 if (unlikely(!PyErr_ExceptionMatches(PyExc_ImportError)))
25449 goto bad;
25450 PyErr_Clear();
25451 }
25452 }
25453 level = 0;
25454 }
25455 #endif
25456 if (!module) {
25457 #if PY_MAJOR_VERSION < 3
25458 PyObject *py_level = PyInt_FromLong(level);
25459 if (unlikely(!py_level))
25460 goto bad;
25461 module = PyObject_CallFunctionObjArgs(py_import,
25462 name, __pyx_d, empty_dict, from_list, py_level, (PyObject *)NULL);
25463 Py_DECREF(py_level);
25464 #else
25465 module = PyImport_ImportModuleLevelObject(
25466 name, __pyx_d, empty_dict, from_list, level);
25467 #endif
25468 }
25469 }
25470 bad:
25471 Py_XDECREF(empty_dict);
25472 Py_XDECREF(empty_list);
25473 #if PY_MAJOR_VERSION < 3
25474 Py_XDECREF(py_import);
25475 #endif
25476 return module;
25477 }
25478
25479 /* ImportDottedModule */
25480 #if PY_MAJOR_VERSION >= 3
25481 static PyObject *__Pyx__ImportDottedModule_Error(PyObject *name, PyObject *parts_tuple, Py_ssize_t count) {
25482 PyObject *partial_name = NULL, *slice = NULL, *sep = NULL;
25483 if (unlikely(PyErr_Occurred())) {
25484 PyErr_Clear();
25485 }
25486 if (likely(PyTuple_GET_SIZE(parts_tuple) == count)) {
25487 partial_name = name;
25488 } else {
25489 slice = PySequence_GetSlice(parts_tuple, 0, count);
25490 if (unlikely(!slice))
25491 goto bad;
25492 sep = PyUnicode_FromStringAndSize(".", 1);
25493 if (unlikely(!sep))
25494 goto bad;
25495 partial_name = PyUnicode_Join(sep, slice);
25496 }
25497 PyErr_Format(
25498 #if PY_MAJOR_VERSION < 3
25499 PyExc_ImportError,
25500 "No module named '%s'", PyString_AS_STRING(partial_name));
25501 #else
25502 #if PY_VERSION_HEX >= 0x030600B1
25503 PyExc_ModuleNotFoundError,
25504 #else
25505 PyExc_ImportError,
25506 #endif
25507 "No module named '%U'", partial_name);
25508 #endif
25509 bad:
25510 Py_XDECREF(sep);
25511 Py_XDECREF(slice);
25512 Py_XDECREF(partial_name);
25513 return NULL;
25514 }
25515 #endif
25516 #if PY_MAJOR_VERSION >= 3
25517 static PyObject *__Pyx__ImportDottedModule_Lookup(PyObject *name) {
25518 PyObject *imported_module;
25519 #if PY_VERSION_HEX < 0x030700A1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400)
25520 PyObject *modules = PyImport_GetModuleDict();
25521 if (unlikely(!modules))
25522 return NULL;
25523 imported_module = __Pyx_PyDict_GetItemStr(modules, name);
25524 Py_XINCREF(imported_module);
25525 #else
25526 imported_module = PyImport_GetModule(name);
25527 #endif
25528 return imported_module;
25529 }
25530 #endif
25531 #if PY_MAJOR_VERSION >= 3
25532 static PyObject *__Pyx_ImportDottedModule_WalkParts(PyObject *module, PyObject *name, PyObject *parts_tuple) {
25533 Py_ssize_t i, nparts;
25534 nparts = PyTuple_GET_SIZE(parts_tuple);
25535 for (i=1; i < nparts && module; i++) {
25536 PyObject *part, *submodule;
25537 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
25538 part = PyTuple_GET_ITEM(parts_tuple, i);
25539 #else
25540 part = PySequence_ITEM(parts_tuple, i);
25541 #endif
25542 submodule = __Pyx_PyObject_GetAttrStrNoError(module, part);
25543 #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
25544 Py_DECREF(part);
25545 #endif
25546 Py_DECREF(module);
25547 module = submodule;
25548 }
25549 if (unlikely(!module)) {
25550 return __Pyx__ImportDottedModule_Error(name, parts_tuple, i);
25551 }
25552 return module;
25553 }
25554 #endif
25555 static PyObject *__Pyx__ImportDottedModule(PyObject *name, PyObject *parts_tuple) {
25556 #if PY_MAJOR_VERSION < 3
25557 PyObject *module, *from_list, *star = __pyx_n_s__58;
25558 CYTHON_UNUSED_VAR(parts_tuple);
25559 from_list = PyList_New(1);
25560 if (unlikely(!from_list))
25561 return NULL;
25562 Py_INCREF(star);
25563 PyList_SET_ITEM(from_list, 0, star);
25564 module = __Pyx_Import(name, from_list, 0);
25565 Py_DECREF(from_list);
25566 return module;
25567 #else
25568 PyObject *imported_module;
25569 PyObject *module = __Pyx_Import(name, NULL, 0);
25570 if (!parts_tuple || unlikely(!module))
25571 return module;
25572 imported_module = __Pyx__ImportDottedModule_Lookup(name);
25573 if (likely(imported_module)) {
25574 Py_DECREF(module);
25575 return imported_module;
25576 }
25577 PyErr_Clear();
25578 return __Pyx_ImportDottedModule_WalkParts(module, name, parts_tuple);
25579 #endif
25580 }
25581 static PyObject *__Pyx_ImportDottedModule(PyObject *name, PyObject *parts_tuple) {
25582 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030400B1
25583 PyObject *module = __Pyx__ImportDottedModule_Lookup(name);
25584 if (likely(module)) {
25585 PyObject *spec = __Pyx_PyObject_GetAttrStrNoError(module, __pyx_n_s_spec);
25586 if (likely(spec)) {
25587 PyObject *unsafe = __Pyx_PyObject_GetAttrStrNoError(spec, __pyx_n_s_initializing);
25588 if (likely(!unsafe || !__Pyx_PyObject_IsTrue(unsafe))) {
25589 Py_DECREF(spec);
25590 spec = NULL;
25591 }
25592 Py_XDECREF(unsafe);
25593 }
25594 if (likely(!spec)) {
25595 PyErr_Clear();
25596 return module;
25597 }
25598 Py_DECREF(spec);
25599 Py_DECREF(module);
25600 } else if (PyErr_Occurred()) {
25601 PyErr_Clear();
25602 }
25603 #endif
25604 return __Pyx__ImportDottedModule(name, parts_tuple);
25605 }
25606
25607 /* ImportFrom */
25608 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
25609 PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
25610 if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
25611 const char* module_name_str = 0;
25612 PyObject* module_name = 0;
25613 PyObject* module_dot = 0;
25614 PyObject* full_name = 0;
25615 PyErr_Clear();
25616 module_name_str = PyModule_GetName(module);
25617 if (unlikely(!module_name_str)) { goto modbad; }
25618 module_name = PyUnicode_FromString(module_name_str);
25619 if (unlikely(!module_name)) { goto modbad; }
25620 module_dot = PyUnicode_Concat(module_name, __pyx_kp_u__59);
25621 if (unlikely(!module_dot)) { goto modbad; }
25622 full_name = PyUnicode_Concat(module_dot, name);
25623 if (unlikely(!full_name)) { goto modbad; }
25624 #if PY_VERSION_HEX < 0x030700A1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400)
25625 {
25626 PyObject *modules = PyImport_GetModuleDict();
25627 if (unlikely(!modules))
25628 goto modbad;
25629 value = PyObject_GetItem(modules, full_name);
25630 }
25631 #else
25632 value = PyImport_GetModule(full_name);
25633 #endif
25634 modbad:
25635 Py_XDECREF(full_name);
25636 Py_XDECREF(module_dot);
25637 Py_XDECREF(module_name);
25638 }
25639 if (unlikely(!value)) {
25640 PyErr_Format(PyExc_ImportError,
25641 #if PY_MAJOR_VERSION < 3
25642 "cannot import name %.230s", PyString_AS_STRING(name));
25643 #else
25644 "cannot import name %S", name);
25645 #endif
25646 }
25647 return value;
25648 }
25649
25650 /* FetchSharedCythonModule */
25651 static PyObject *__Pyx_FetchSharedCythonABIModule(void) {
25652 return __Pyx_PyImport_AddModuleRef((char*) __PYX_ABI_MODULE_NAME);
25653 }
25654
25655 /* FetchCommonType */
25656 static int __Pyx_VerifyCachedType(PyObject *cached_type,
25657 const char *name,
25658 Py_ssize_t basicsize,
25659 Py_ssize_t expected_basicsize) {
25660 if (!PyType_Check(cached_type)) {
25661 PyErr_Format(PyExc_TypeError,
25662 "Shared Cython type %.200s is not a type object", name);
25663 return -1;
25664 }
25665 if (basicsize != expected_basicsize) {
25666 PyErr_Format(PyExc_TypeError,
25667 "Shared Cython type %.200s has the wrong size, try recompiling",
25668 name);
25669 return -1;
25670 }
25671 return 0;
25672 }
25673 #if !CYTHON_USE_TYPE_SPECS
25674 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
25675 PyObject* abi_module;
25676 const char* object_name;
25677 PyTypeObject *cached_type = NULL;
25678 abi_module = __Pyx_FetchSharedCythonABIModule();
25679 if (!abi_module) return NULL;
25680 object_name = strrchr(type->tp_name, '.');
25681 object_name = object_name ? object_name+1 : type->tp_name;
25682 cached_type = (PyTypeObject*) PyObject_GetAttrString(abi_module, object_name);
25683 if (cached_type) {
25684 if (__Pyx_VerifyCachedType(
25685 (PyObject *)cached_type,
25686 object_name,
25687 cached_type->tp_basicsize,
25688 type->tp_basicsize) < 0) {
25689 goto bad;
25690 }
25691 goto done;
25692 }
25693 if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
25694 PyErr_Clear();
25695 if (PyType_Ready(type) < 0) goto bad;
25696 if (PyObject_SetAttrString(abi_module, object_name, (PyObject *)type) < 0)
25697 goto bad;
25698 Py_INCREF(type);
25699 cached_type = type;
25700 done:
25701 Py_DECREF(abi_module);
25702 return cached_type;
25703 bad:
25704 Py_XDECREF(cached_type);
25705 cached_type = NULL;
25706 goto done;
25707 }
25708 #else
25709 static PyTypeObject *__Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases) {
25710 PyObject *abi_module, *cached_type = NULL;
25711 const char* object_name = strrchr(spec->name, '.');
25712 object_name = object_name ? object_name+1 : spec->name;
25713 abi_module = __Pyx_FetchSharedCythonABIModule();
25714 if (!abi_module) return NULL;
25715 cached_type = PyObject_GetAttrString(abi_module, object_name);
25716 if (cached_type) {
25717 Py_ssize_t basicsize;
25718 #if CYTHON_COMPILING_IN_LIMITED_API
25719 PyObject *py_basicsize;
25720 py_basicsize = PyObject_GetAttrString(cached_type, "__basicsize__");
25721 if (unlikely(!py_basicsize)) goto bad;
25722 basicsize = PyLong_AsSsize_t(py_basicsize);
25723 Py_DECREF(py_basicsize);
25724 py_basicsize = 0;
25725 if (unlikely(basicsize == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
25726 #else
25727 basicsize = likely(PyType_Check(cached_type)) ? ((PyTypeObject*) cached_type)->tp_basicsize : -1;
25728 #endif
25729 if (__Pyx_VerifyCachedType(
25730 cached_type,
25731 object_name,
25732 basicsize,
25733 spec->basicsize) < 0) {
25734 goto bad;
25735 }
25736 goto done;
25737 }
25738 if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
25739 PyErr_Clear();
25740 CYTHON_UNUSED_VAR(module);
25741 cached_type = __Pyx_PyType_FromModuleAndSpec(abi_module, spec, bases);
25742 if (unlikely(!cached_type)) goto bad;
25743 if (unlikely(__Pyx_fix_up_extension_type_from_spec(spec, (PyTypeObject *) cached_type) < 0)) goto bad;
25744 if (PyObject_SetAttrString(abi_module, object_name, cached_type) < 0) goto bad;
25745 done:
25746 Py_DECREF(abi_module);
25747 assert(cached_type == NULL || PyType_Check(cached_type));
25748 return (PyTypeObject *) cached_type;
25749 bad:
25750 Py_XDECREF(cached_type);
25751 cached_type = NULL;
25752 goto done;
25753 }
25754 #endif
25755
25756 /* PyVectorcallFastCallDict */
25757 #if CYTHON_METH_FASTCALL
25758 static PyObject *__Pyx_PyVectorcall_FastCallDict_kw(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw)
25759 {
25760 PyObject *res = NULL;
25761 PyObject *kwnames;
25762 PyObject **newargs;
25763 PyObject **kwvalues;
25764 Py_ssize_t i, pos;
25765 size_t j;
25766 PyObject *key, *value;
25767 unsigned long keys_are_strings;
25768 Py_ssize_t nkw = PyDict_GET_SIZE(kw);
25769 newargs = (PyObject **)PyMem_Malloc((nargs + (size_t)nkw) * sizeof(args[0]));
25770 if (unlikely(newargs == NULL)) {
25771 PyErr_NoMemory();
25772 return NULL;
25773 }
25774 for (j = 0; j < nargs; j++) newargs[j] = args[j];
25775 kwnames = PyTuple_New(nkw);
25776 if (unlikely(kwnames == NULL)) {
25777 PyMem_Free(newargs);
25778 return NULL;
25779 }
25780 kwvalues = newargs + nargs;
25781 pos = i = 0;
25782 keys_are_strings = Py_TPFLAGS_UNICODE_SUBCLASS;
25783 while (PyDict_Next(kw, &pos, &key, &value)) {
25784 keys_are_strings &= Py_TYPE(key)->tp_flags;
25785 Py_INCREF(key);
25786 Py_INCREF(value);
25787 PyTuple_SET_ITEM(kwnames, i, key);
25788 kwvalues[i] = value;
25789 i++;
25790 }
25791 if (unlikely(!keys_are_strings)) {
25792 PyErr_SetString(PyExc_TypeError, "keywords must be strings");
25793 goto cleanup;
25794 }
25795 res = vc(func, newargs, nargs, kwnames);
25796 cleanup:
25797 Py_DECREF(kwnames);
25798 for (i = 0; i < nkw; i++)
25799 Py_DECREF(kwvalues[i]);
25800 PyMem_Free(newargs);
25801 return res;
25802 }
25803 static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw)
25804 {
25805 if (likely(kw == NULL) || PyDict_GET_SIZE(kw) == 0) {
25806 return vc(func, args, nargs, NULL);
25807 }
25808 return __Pyx_PyVectorcall_FastCallDict_kw(func, vc, args, nargs, kw);
25809 }
25810 #endif
25811
25812 /* CythonFunctionShared */
25813 #if CYTHON_COMPILING_IN_LIMITED_API
25814 static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void *cfunc) {
25815 if (__Pyx_CyFunction_Check(func)) {
25816 return PyCFunction_GetFunction(((__pyx_CyFunctionObject*)func)->func) == (PyCFunction) cfunc;
25817 } else if (PyCFunction_Check(func)) {
25818 return PyCFunction_GetFunction(func) == (PyCFunction) cfunc;
25819 }
25820 return 0;
25821 }
25822 #else
25823 static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void *cfunc) {
25824 return __Pyx_CyOrPyCFunction_Check(func) && __Pyx_CyOrPyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc;
25825 }
25826 #endif
25827 static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj) {
25828 #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
25829 __Pyx_Py_XDECREF_SET(
25830 __Pyx_CyFunction_GetClassObj(f),
25831 ((classobj) ? __Pyx_NewRef(classobj) : NULL));
25832 #else
25833 __Pyx_Py_XDECREF_SET(
25834 ((PyCMethodObject *) (f))->mm_class,
25835 (PyTypeObject*)((classobj) ? __Pyx_NewRef(classobj) : NULL));
25836 #endif
25837 }
25838 static PyObject *
25839 __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, void *closure)
25840 {
25841 CYTHON_UNUSED_VAR(closure);
25842 if (unlikely(op->func_doc == NULL)) {
25843 #if CYTHON_COMPILING_IN_LIMITED_API
25844 op->func_doc = PyObject_GetAttrString(op->func, "__doc__");
25845 if (unlikely(!op->func_doc)) return NULL;
25846 #else
25847 if (((PyCFunctionObject*)op)->m_ml->ml_doc) {
25848 #if PY_MAJOR_VERSION >= 3
25849 op->func_doc = PyUnicode_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc);
25850 #else
25851 op->func_doc = PyString_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc);
25852 #endif
25853 if (unlikely(op->func_doc == NULL))
25854 return NULL;
25855 } else {
25856 Py_INCREF(Py_None);
25857 return Py_None;
25858 }
25859 #endif
25860 }
25861 Py_INCREF(op->func_doc);
25862 return op->func_doc;
25863 }
25864 static int
25865 __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, void *context)
25866 {
25867 CYTHON_UNUSED_VAR(context);
25868 if (value == NULL) {
25869 value = Py_None;
25870 }
25871 Py_INCREF(value);
25872 __Pyx_Py_XDECREF_SET(op->func_doc, value);
25873 return 0;
25874 }
25875 static PyObject *
25876 __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, void *context)
25877 {
25878 CYTHON_UNUSED_VAR(context);
25879 if (unlikely(op->func_name == NULL)) {
25880 #if CYTHON_COMPILING_IN_LIMITED_API
25881 op->func_name = PyObject_GetAttrString(op->func, "__name__");
25882 #elif PY_MAJOR_VERSION >= 3
25883 op->func_name = PyUnicode_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name);
25884 #else
25885 op->func_name = PyString_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name);
25886 #endif
25887 if (unlikely(op->func_name == NULL))
25888 return NULL;
25889 }
25890 Py_INCREF(op->func_name);
25891 return op->func_name;
25892 }
25893 static int
25894 __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, void *context)
25895 {
25896 CYTHON_UNUSED_VAR(context);
25897 #if PY_MAJOR_VERSION >= 3
25898 if (unlikely(value == NULL || !PyUnicode_Check(value)))
25899 #else
25900 if (unlikely(value == NULL || !PyString_Check(value)))
25901 #endif
25902 {
25903 PyErr_SetString(PyExc_TypeError,
25904 "__name__ must be set to a string object");
25905 return -1;
25906 }
25907 Py_INCREF(value);
25908 __Pyx_Py_XDECREF_SET(op->func_name, value);
25909 return 0;
25910 }
25911 static PyObject *
25912 __Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, void *context)
25913 {
25914 CYTHON_UNUSED_VAR(context);
25915 Py_INCREF(op->func_qualname);
25916 return op->func_qualname;
25917 }
25918 static int
25919 __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, void *context)
25920 {
25921 CYTHON_UNUSED_VAR(context);
25922 #if PY_MAJOR_VERSION >= 3
25923 if (unlikely(value == NULL || !PyUnicode_Check(value)))
25924 #else
25925 if (unlikely(value == NULL || !PyString_Check(value)))
25926 #endif
25927 {
25928 PyErr_SetString(PyExc_TypeError,
25929 "__qualname__ must be set to a string object");
25930 return -1;
25931 }
25932 Py_INCREF(value);
25933 __Pyx_Py_XDECREF_SET(op->func_qualname, value);
25934 return 0;
25935 }
25936 static PyObject *
25937 __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, void *context)
25938 {
25939 CYTHON_UNUSED_VAR(context);
25940 if (unlikely(op->func_dict == NULL)) {
25941 op->func_dict = PyDict_New();
25942 if (unlikely(op->func_dict == NULL))
25943 return NULL;
25944 }
25945 Py_INCREF(op->func_dict);
25946 return op->func_dict;
25947 }
25948 static int
25949 __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, void *context)
25950 {
25951 CYTHON_UNUSED_VAR(context);
25952 if (unlikely(value == NULL)) {
25953 PyErr_SetString(PyExc_TypeError,
25954 "function's dictionary may not be deleted");
25955 return -1;
25956 }
25957 if (unlikely(!PyDict_Check(value))) {
25958 PyErr_SetString(PyExc_TypeError,
25959 "setting function's dictionary to a non-dict");
25960 return -1;
25961 }
25962 Py_INCREF(value);
25963 __Pyx_Py_XDECREF_SET(op->func_dict, value);
25964 return 0;
25965 }
25966 static PyObject *
25967 __Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, void *context)
25968 {
25969 CYTHON_UNUSED_VAR(context);
25970 Py_INCREF(op->func_globals);
25971 return op->func_globals;
25972 }
25973 static PyObject *
25974 __Pyx_CyFunction_get_closure(__pyx_CyFunctionObject *op, void *context)
25975 {
25976 CYTHON_UNUSED_VAR(op);
25977 CYTHON_UNUSED_VAR(context);
25978 Py_INCREF(Py_None);
25979 return Py_None;
25980 }
25981 static PyObject *
25982 __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, void *context)
25983 {
25984 PyObject* result = (op->func_code) ? op->func_code : Py_None;
25985 CYTHON_UNUSED_VAR(context);
25986 Py_INCREF(result);
25987 return result;
25988 }
25989 static int
25990 __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
25991 int result = 0;
25992 PyObject *res = op->defaults_getter((PyObject *) op);
25993 if (unlikely(!res))
25994 return -1;
25995 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
25996 op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
25997 Py_INCREF(op->defaults_tuple);
25998 op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
25999 Py_INCREF(op->defaults_kwdict);
26000 #else
26001 op->defaults_tuple = __Pyx_PySequence_ITEM(res, 0);
26002 if (unlikely(!op->defaults_tuple)) result = -1;
26003 else {
26004 op->defaults_kwdict = __Pyx_PySequence_ITEM(res, 1);
26005 if (unlikely(!op->defaults_kwdict)) result = -1;
26006 }
26007 #endif
26008 Py_DECREF(res);
26009 return result;
26010 }
26011 static int
26012 __Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
26013 CYTHON_UNUSED_VAR(context);
26014 if (!value) {
26015 value = Py_None;
26016 } else if (unlikely(value != Py_None && !PyTuple_Check(value))) {
26017 PyErr_SetString(PyExc_TypeError,
26018 "__defaults__ must be set to a tuple object");
26019 return -1;
26020 }
26021 PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__defaults__ will not "
26022 "currently affect the values used in function calls", 1);
26023 Py_INCREF(value);
26024 __Pyx_Py_XDECREF_SET(op->defaults_tuple, value);
26025 return 0;
26026 }
26027 static PyObject *
26028 __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, void *context) {
26029 PyObject* result = op->defaults_tuple;
26030 CYTHON_UNUSED_VAR(context);
26031 if (unlikely(!result)) {
26032 if (op->defaults_getter) {
26033 if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL;
26034 result = op->defaults_tuple;
26035 } else {
26036 result = Py_None;
26037 }
26038 }
26039 Py_INCREF(result);
26040 return result;
26041 }
26042 static int
26043 __Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
26044 CYTHON_UNUSED_VAR(context);
26045 if (!value) {
26046 value = Py_None;
26047 } else if (unlikely(value != Py_None && !PyDict_Check(value))) {
26048 PyErr_SetString(PyExc_TypeError,
26049 "__kwdefaults__ must be set to a dict object");
26050 return -1;
26051 }
26052 PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__kwdefaults__ will not "
26053 "currently affect the values used in function calls", 1);
26054 Py_INCREF(value);
26055 __Pyx_Py_XDECREF_SET(op->defaults_kwdict, value);
26056 return 0;
26057 }
26058 static PyObject *
26059 __Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, void *context) {
26060 PyObject* result = op->defaults_kwdict;
26061 CYTHON_UNUSED_VAR(context);
26062 if (unlikely(!result)) {
26063 if (op->defaults_getter) {
26064 if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL;
26065 result = op->defaults_kwdict;
26066 } else {
26067 result = Py_None;
26068 }
26069 }
26070 Py_INCREF(result);
26071 return result;
26072 }
26073 static int
26074 __Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
26075 CYTHON_UNUSED_VAR(context);
26076 if (!value || value == Py_None) {
26077 value = NULL;
26078 } else if (unlikely(!PyDict_Check(value))) {
26079 PyErr_SetString(PyExc_TypeError,
26080 "__annotations__ must be set to a dict object");
26081 return -1;
26082 }
26083 Py_XINCREF(value);
26084 __Pyx_Py_XDECREF_SET(op->func_annotations, value);
26085 return 0;
26086 }
26087 static PyObject *
26088 __Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, void *context) {
26089 PyObject* result = op->func_annotations;
26090 CYTHON_UNUSED_VAR(context);
26091 if (unlikely(!result)) {
26092 result = PyDict_New();
26093 if (unlikely(!result)) return NULL;
26094 op->func_annotations = result;
26095 }
26096 Py_INCREF(result);
26097 return result;
26098 }
26099 static PyObject *
26100 __Pyx_CyFunction_get_is_coroutine(__pyx_CyFunctionObject *op, void *context) {
26101 int is_coroutine;
26102 CYTHON_UNUSED_VAR(context);
26103 if (op->func_is_coroutine) {
26104 return __Pyx_NewRef(op->func_is_coroutine);
26105 }
26106 is_coroutine = op->flags & __Pyx_CYFUNCTION_COROUTINE;
26107 #if PY_VERSION_HEX >= 0x03050000
26108 if (is_coroutine) {
26109 PyObject *module, *fromlist, *marker = __pyx_n_s_is_coroutine;
26110 fromlist = PyList_New(1);
26111 if (unlikely(!fromlist)) return NULL;
26112 Py_INCREF(marker);
26113 #if CYTHON_ASSUME_SAFE_MACROS
26114 PyList_SET_ITEM(fromlist, 0, marker);
26115 #else
26116 if (unlikely(PyList_SetItem(fromlist, 0, marker) < 0)) {
26117 Py_DECREF(marker);
26118 Py_DECREF(fromlist);
26119 return NULL;
26120 }
26121 #endif
26122 module = PyImport_ImportModuleLevelObject(__pyx_n_s_asyncio_coroutines, NULL, NULL, fromlist, 0);
26123 Py_DECREF(fromlist);
26124 if (unlikely(!module)) goto ignore;
26125 op->func_is_coroutine = __Pyx_PyObject_GetAttrStr(module, marker);
26126 Py_DECREF(module);
26127 if (likely(op->func_is_coroutine)) {
26128 return __Pyx_NewRef(op->func_is_coroutine);
26129 }
26130 ignore:
26131 PyErr_Clear();
26132 }
26133 #endif
26134 op->func_is_coroutine = __Pyx_PyBool_FromLong(is_coroutine);
26135 return __Pyx_NewRef(op->func_is_coroutine);
26136 }
26137 #if CYTHON_COMPILING_IN_LIMITED_API
26138 static PyObject *
26139 __Pyx_CyFunction_get_module(__pyx_CyFunctionObject *op, void *context) {
26140 CYTHON_UNUSED_VAR(context);
26141 return PyObject_GetAttrString(op->func, "__module__");
26142 }
26143 static int
26144 __Pyx_CyFunction_set_module(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
26145 CYTHON_UNUSED_VAR(context);
26146 return PyObject_SetAttrString(op->func, "__module__", value);
26147 }
26148 #endif
26149 static PyGetSetDef __pyx_CyFunction_getsets[] = {
26150 {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
26151 {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
26152 {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
26153 {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
26154 {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
26155 {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
26156 {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
26157 {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
26158 {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
26159 {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
26160 {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
26161 {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
26162 {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
26163 {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
26164 {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
26165 {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
26166 {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
26167 {(char *) "_is_coroutine", (getter)__Pyx_CyFunction_get_is_coroutine, 0, 0, 0},
26168 #if CYTHON_COMPILING_IN_LIMITED_API
26169 {"__module__", (getter)__Pyx_CyFunction_get_module, (setter)__Pyx_CyFunction_set_module, 0, 0},
26170 #endif
26171 {0, 0, 0, 0, 0}
26172 };
26173 static PyMemberDef __pyx_CyFunction_members[] = {
26174 #if !CYTHON_COMPILING_IN_LIMITED_API
26175 {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), 0, 0},
26176 #endif
26177 #if CYTHON_USE_TYPE_SPECS
26178 {(char *) "__dictoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_dict), READONLY, 0},
26179 #if CYTHON_METH_FASTCALL
26180 #if CYTHON_BACKPORT_VECTORCALL
26181 {(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_vectorcall), READONLY, 0},
26182 #else
26183 #if !CYTHON_COMPILING_IN_LIMITED_API
26184 {(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(PyCFunctionObject, vectorcall), READONLY, 0},
26185 #endif
26186 #endif
26187 #endif
26188 #if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API
26189 {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_weakreflist), READONLY, 0},
26190 #else
26191 {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(PyCFunctionObject, m_weakreflist), READONLY, 0},
26192 #endif
26193 #endif
26194 {0, 0, 0, 0, 0}
26195 };
26196 static PyObject *
26197 __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, PyObject *args)
26198 {
26199 CYTHON_UNUSED_VAR(args);
26200 #if PY_MAJOR_VERSION >= 3
26201 Py_INCREF(m->func_qualname);
26202 return m->func_qualname;
26203 #else
26204 return PyString_FromString(((PyCFunctionObject*)m)->m_ml->ml_name);
26205 #endif
26206 }
26207 static PyMethodDef __pyx_CyFunction_methods[] = {
26208 {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
26209 {0, 0, 0, 0}
26210 };
26211 #if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API
26212 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
26213 #else
26214 #define __Pyx_CyFunction_weakreflist(cyfunc) (((PyCFunctionObject*)cyfunc)->m_weakreflist)
26215 #endif
26216 static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname,
26217 PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
26218 #if !CYTHON_COMPILING_IN_LIMITED_API
26219 PyCFunctionObject *cf = (PyCFunctionObject*) op;
26220 #endif
26221 if (unlikely(op == NULL))
26222 return NULL;
26223 #if CYTHON_COMPILING_IN_LIMITED_API
26224 op->func = PyCFunction_NewEx(ml, (PyObject*)op, module);
26225 if (unlikely(!op->func)) return NULL;
26226 #endif
26227 op->flags = flags;
26228 __Pyx_CyFunction_weakreflist(op) = NULL;
26229 #if !CYTHON_COMPILING_IN_LIMITED_API
26230 cf->m_ml = ml;
26231 cf->m_self = (PyObject *) op;
26232 #endif
26233 Py_XINCREF(closure);
26234 op->func_closure = closure;
26235 #if !CYTHON_COMPILING_IN_LIMITED_API
26236 Py_XINCREF(module);
26237 cf->m_module = module;
26238 #endif
26239 op->func_dict = NULL;
26240 op->func_name = NULL;
26241 Py_INCREF(qualname);
26242 op->func_qualname = qualname;
26243 op->func_doc = NULL;
26244 #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
26245 op->func_classobj = NULL;
26246 #else
26247 ((PyCMethodObject*)op)->mm_class = NULL;
26248 #endif
26249 op->func_globals = globals;
26250 Py_INCREF(op->func_globals);
26251 Py_XINCREF(code);
26252 op->func_code = code;
26253 op->defaults_pyobjects = 0;
26254 op->defaults_size = 0;
26255 op->defaults = NULL;
26256 op->defaults_tuple = NULL;
26257 op->defaults_kwdict = NULL;
26258 op->defaults_getter = NULL;
26259 op->func_annotations = NULL;
26260 op->func_is_coroutine = NULL;
26261 #if CYTHON_METH_FASTCALL
26262 switch (ml->ml_flags & (METH_VARARGS | METH_FASTCALL | METH_NOARGS | METH_O | METH_KEYWORDS | METH_METHOD)) {
26263 case METH_NOARGS:
26264 __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_NOARGS;
26265 break;
26266 case METH_O:
26267 __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_O;
26268 break;
26269 case METH_METHOD | METH_FASTCALL | METH_KEYWORDS:
26270 __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD;
26271 break;
26272 case METH_FASTCALL | METH_KEYWORDS:
26273 __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS;
26274 break;
26275 case METH_VARARGS | METH_KEYWORDS:
26276 __Pyx_CyFunction_func_vectorcall(op) = NULL;
26277 break;
26278 default:
26279 PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction");
26280 Py_DECREF(op);
26281 return NULL;
26282 }
26283 #endif
26284 return (PyObject *) op;
26285 }
26286 static int
26287 __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
26288 {
26289 Py_CLEAR(m->func_closure);
26290 #if CYTHON_COMPILING_IN_LIMITED_API
26291 Py_CLEAR(m->func);
26292 #else
26293 Py_CLEAR(((PyCFunctionObject*)m)->m_module);
26294 #endif
26295 Py_CLEAR(m->func_dict);
26296 Py_CLEAR(m->func_name);
26297 Py_CLEAR(m->func_qualname);
26298 Py_CLEAR(m->func_doc);
26299 Py_CLEAR(m->func_globals);
26300 Py_CLEAR(m->func_code);
26301 #if !CYTHON_COMPILING_IN_LIMITED_API
26302 #if PY_VERSION_HEX < 0x030900B1
26303 Py_CLEAR(__Pyx_CyFunction_GetClassObj(m));
26304 #else
26305 {
26306 PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class;
26307 ((PyCMethodObject *) (m))->mm_class = NULL;
26308 Py_XDECREF(cls);
26309 }
26310 #endif
26311 #endif
26312 Py_CLEAR(m->defaults_tuple);
26313 Py_CLEAR(m->defaults_kwdict);
26314 Py_CLEAR(m->func_annotations);
26315 Py_CLEAR(m->func_is_coroutine);
26316 if (m->defaults) {
26317 PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
26318 int i;
26319 for (i = 0; i < m->defaults_pyobjects; i++)
26320 Py_XDECREF(pydefaults[i]);
26321 PyObject_Free(m->defaults);
26322 m->defaults = NULL;
26323 }
26324 return 0;
26325 }
26326 static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
26327 {
26328 if (__Pyx_CyFunction_weakreflist(m) != NULL)
26329 PyObject_ClearWeakRefs((PyObject *) m);
26330 __Pyx_CyFunction_clear(m);
26331 __Pyx_PyHeapTypeObject_GC_Del(m);
26332 }
26333 static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
26334 {
26335 PyObject_GC_UnTrack(m);
26336 __Pyx__CyFunction_dealloc(m);
26337 }
26338 static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
26339 {
26340 Py_VISIT(m->func_closure);
26341 #if CYTHON_COMPILING_IN_LIMITED_API
26342 Py_VISIT(m->func);
26343 #else
26344 Py_VISIT(((PyCFunctionObject*)m)->m_module);
26345 #endif
26346 Py_VISIT(m->func_dict);
26347 Py_VISIT(m->func_name);
26348 Py_VISIT(m->func_qualname);
26349 Py_VISIT(m->func_doc);
26350 Py_VISIT(m->func_globals);
26351 Py_VISIT(m->func_code);
26352 #if !CYTHON_COMPILING_IN_LIMITED_API
26353 Py_VISIT(__Pyx_CyFunction_GetClassObj(m));
26354 #endif
26355 Py_VISIT(m->defaults_tuple);
26356 Py_VISIT(m->defaults_kwdict);
26357 Py_VISIT(m->func_is_coroutine);
26358 if (m->defaults) {
26359 PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
26360 int i;
26361 for (i = 0; i < m->defaults_pyobjects; i++)
26362 Py_VISIT(pydefaults[i]);
26363 }
26364 return 0;
26365 }
26366 static PyObject*
26367 __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
26368 {
26369 #if PY_MAJOR_VERSION >= 3
26370 return PyUnicode_FromFormat("<cyfunction %U at %p>",
26371 op->func_qualname, (void *)op);
26372 #else
26373 return PyString_FromFormat("<cyfunction %s at %p>",
26374 PyString_AsString(op->func_qualname), (void *)op);
26375 #endif
26376 }
26377 static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) {
26378 #if CYTHON_COMPILING_IN_LIMITED_API
26379 PyObject *f = ((__pyx_CyFunctionObject*)func)->func;
26380 PyObject *py_name = NULL;
26381 PyCFunction meth;
26382 int flags;
26383 meth = PyCFunction_GetFunction(f);
26384 if (unlikely(!meth)) return NULL;
26385 flags = PyCFunction_GetFlags(f);
26386 if (unlikely(flags < 0)) return NULL;
26387 #else
26388 PyCFunctionObject* f = (PyCFunctionObject*)func;
26389 PyCFunction meth = f->m_ml->ml_meth;
26390 int flags = f->m_ml->ml_flags;
26391 #endif
26392 Py_ssize_t size;
26393 switch (flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
26394 case METH_VARARGS:
26395 if (likely(kw == NULL || PyDict_Size(kw) == 0))
26396 return (*meth)(self, arg);
26397 break;
26398 case METH_VARARGS | METH_KEYWORDS:
26399 return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw);
26400 case METH_NOARGS:
26401 if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
26402 #if CYTHON_ASSUME_SAFE_MACROS
26403 size = PyTuple_GET_SIZE(arg);
26404 #else
26405 size = PyTuple_Size(arg);
26406 if (unlikely(size < 0)) return NULL;
26407 #endif
26408 if (likely(size == 0))
26409 return (*meth)(self, NULL);
26410 #if CYTHON_COMPILING_IN_LIMITED_API
26411 py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL);
26412 if (!py_name) return NULL;
26413 PyErr_Format(PyExc_TypeError,
26414 "%.200S() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
26415 py_name, size);
26416 Py_DECREF(py_name);
26417 #else
26418 PyErr_Format(PyExc_TypeError,
26419 "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
26420 f->m_ml->ml_name, size);
26421 #endif
26422 return NULL;
26423 }
26424 break;
26425 case METH_O:
26426 if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
26427 #if CYTHON_ASSUME_SAFE_MACROS
26428 size = PyTuple_GET_SIZE(arg);
26429 #else
26430 size = PyTuple_Size(arg);
26431 if (unlikely(size < 0)) return NULL;
26432 #endif
26433 if (likely(size == 1)) {
26434 PyObject *result, *arg0;
26435 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
26436 arg0 = PyTuple_GET_ITEM(arg, 0);
26437 #else
26438 arg0 = __Pyx_PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL;
26439 #endif
26440 result = (*meth)(self, arg0);
26441 #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
26442 Py_DECREF(arg0);
26443 #endif
26444 return result;
26445 }
26446 #if CYTHON_COMPILING_IN_LIMITED_API
26447 py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL);
26448 if (!py_name) return NULL;
26449 PyErr_Format(PyExc_TypeError,
26450 "%.200S() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
26451 py_name, size);
26452 Py_DECREF(py_name);
26453 #else
26454 PyErr_Format(PyExc_TypeError,
26455 "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
26456 f->m_ml->ml_name, size);
26457 #endif
26458 return NULL;
26459 }
26460 break;
26461 default:
26462 PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction");
26463 return NULL;
26464 }
26465 #if CYTHON_COMPILING_IN_LIMITED_API
26466 py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL);
26467 if (!py_name) return NULL;
26468 PyErr_Format(PyExc_TypeError, "%.200S() takes no keyword arguments",
26469 py_name);
26470 Py_DECREF(py_name);
26471 #else
26472 PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
26473 f->m_ml->ml_name);
26474 #endif
26475 return NULL;
26476 }
26477 static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
26478 PyObject *self, *result;
26479 #if CYTHON_COMPILING_IN_LIMITED_API
26480 self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)func)->func);
26481 if (unlikely(!self) && PyErr_Occurred()) return NULL;
26482 #else
26483 self = ((PyCFunctionObject*)func)->m_self;
26484 #endif
26485 result = __Pyx_CyFunction_CallMethod(func, self, arg, kw);
26486 return result;
26487 }
26488 static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
26489 PyObject *result;
26490 __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
26491 #if CYTHON_METH_FASTCALL
26492 __pyx_vectorcallfunc vc = __Pyx_CyFunction_func_vectorcall(cyfunc);
26493 if (vc) {
26494 #if CYTHON_ASSUME_SAFE_MACROS
26495 return __Pyx_PyVectorcall_FastCallDict(func, vc, &PyTuple_GET_ITEM(args, 0), (size_t)PyTuple_GET_SIZE(args), kw);
26496 #else
26497 (void) &__Pyx_PyVectorcall_FastCallDict;
26498 return PyVectorcall_Call(func, args, kw);
26499 #endif
26500 }
26501 #endif
26502 if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
26503 Py_ssize_t argc;
26504 PyObject *new_args;
26505 PyObject *self;
26506 #if CYTHON_ASSUME_SAFE_MACROS
26507 argc = PyTuple_GET_SIZE(args);
26508 #else
26509 argc = PyTuple_Size(args);
26510 if (unlikely(!argc) < 0) return NULL;
26511 #endif
26512 new_args = PyTuple_GetSlice(args, 1, argc);
26513 if (unlikely(!new_args))
26514 return NULL;
26515 self = PyTuple_GetItem(args, 0);
26516 if (unlikely(!self)) {
26517 Py_DECREF(new_args);
26518 #if PY_MAJOR_VERSION > 2
26519 PyErr_Format(PyExc_TypeError,
26520 "unbound method %.200S() needs an argument",
26521 cyfunc->func_qualname);
26522 #else
26523 PyErr_SetString(PyExc_TypeError,
26524 "unbound method needs an argument");
26525 #endif
26526 return NULL;
26527 }
26528 result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw);
26529 Py_DECREF(new_args);
26530 } else {
26531 result = __Pyx_CyFunction_Call(func, args, kw);
26532 }
26533 return result;
26534 }
26535 #if CYTHON_METH_FASTCALL
26536 static CYTHON_INLINE int __Pyx_CyFunction_Vectorcall_CheckArgs(__pyx_CyFunctionObject *cyfunc, Py_ssize_t nargs, PyObject *kwnames)
26537 {
26538 int ret = 0;
26539 if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
26540 if (unlikely(nargs < 1)) {
26541 PyErr_Format(PyExc_TypeError, "%.200s() needs an argument",
26542 ((PyCFunctionObject*)cyfunc)->m_ml->ml_name);
26543 return -1;
26544 }
26545 ret = 1;
26546 }
26547 if (unlikely(kwnames) && unlikely(PyTuple_GET_SIZE(kwnames))) {
26548 PyErr_Format(PyExc_TypeError,
26549 "%.200s() takes no keyword arguments", ((PyCFunctionObject*)cyfunc)->m_ml->ml_name);
26550 return -1;
26551 }
26552 return ret;
26553 }
26554 static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
26555 {
26556 __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
26557 PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml;
26558 #if CYTHON_BACKPORT_VECTORCALL
26559 Py_ssize_t nargs = (Py_ssize_t)nargsf;
26560 #else
26561 Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
26562 #endif
26563 PyObject *self;
26564 switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) {
26565 case 1:
26566 self = args[0];
26567 args += 1;
26568 nargs -= 1;
26569 break;
26570 case 0:
26571 self = ((PyCFunctionObject*)cyfunc)->m_self;
26572 break;
26573 default:
26574 return NULL;
26575 }
26576 if (unlikely(nargs != 0)) {
26577 PyErr_Format(PyExc_TypeError,
26578 "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
26579 def->ml_name, nargs);
26580 return NULL;
26581 }
26582 return def->ml_meth(self, NULL);
26583 }
26584 static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
26585 {
26586 __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
26587 PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml;
26588 #if CYTHON_BACKPORT_VECTORCALL
26589 Py_ssize_t nargs = (Py_ssize_t)nargsf;
26590 #else
26591 Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
26592 #endif
26593 PyObject *self;
26594 switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) {
26595 case 1:
26596 self = args[0];
26597 args += 1;
26598 nargs -= 1;
26599 break;
26600 case 0:
26601 self = ((PyCFunctionObject*)cyfunc)->m_self;
26602 break;
26603 default:
26604 return NULL;
26605 }
26606 if (unlikely(nargs != 1)) {
26607 PyErr_Format(PyExc_TypeError,
26608 "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
26609 def->ml_name, nargs);
26610 return NULL;
26611 }
26612 return def->ml_meth(self, args[0]);
26613 }
26614 static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
26615 {
26616 __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
26617 PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml;
26618 #if CYTHON_BACKPORT_VECTORCALL
26619 Py_ssize_t nargs = (Py_ssize_t)nargsf;
26620 #else
26621 Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
26622 #endif
26623 PyObject *self;
26624 switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) {
26625 case 1:
26626 self = args[0];
26627 args += 1;
26628 nargs -= 1;
26629 break;
26630 case 0:
26631 self = ((PyCFunctionObject*)cyfunc)->m_self;
26632 break;
26633 default:
26634 return NULL;
26635 }
26636 return ((__Pyx_PyCFunctionFastWithKeywords)(void(*)(void))def->ml_meth)(self, args, nargs, kwnames);
26637 }
26638 static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
26639 {
26640 __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
26641 PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml;
26642 PyTypeObject *cls = (PyTypeObject *) __Pyx_CyFunction_GetClassObj(cyfunc);
26643 #if CYTHON_BACKPORT_VECTORCALL
26644 Py_ssize_t nargs = (Py_ssize_t)nargsf;
26645 #else
26646 Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
26647 #endif
26648 PyObject *self;
26649 switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) {
26650 case 1:
26651 self = args[0];
26652 args += 1;
26653 nargs -= 1;
26654 break;
26655 case 0:
26656 self = ((PyCFunctionObject*)cyfunc)->m_self;
26657 break;
26658 default:
26659 return NULL;
26660 }
26661 return ((__Pyx_PyCMethod)(void(*)(void))def->ml_meth)(self, cls, args, (size_t)nargs, kwnames);
26662 }
26663 #endif
26664 #if CYTHON_USE_TYPE_SPECS
26665 static PyType_Slot __pyx_CyFunctionType_slots[] = {
26666 {Py_tp_dealloc, (void *)__Pyx_CyFunction_dealloc},
26667 {Py_tp_repr, (void *)__Pyx_CyFunction_repr},
26668 {Py_tp_call, (void *)__Pyx_CyFunction_CallAsMethod},
26669 {Py_tp_traverse, (void *)__Pyx_CyFunction_traverse},
26670 {Py_tp_clear, (void *)__Pyx_CyFunction_clear},
26671 {Py_tp_methods, (void *)__pyx_CyFunction_methods},
26672 {Py_tp_members, (void *)__pyx_CyFunction_members},
26673 {Py_tp_getset, (void *)__pyx_CyFunction_getsets},
26674 {Py_tp_descr_get, (void *)__Pyx_PyMethod_New},
26675 {0, 0},
26676 };
26677 static PyType_Spec __pyx_CyFunctionType_spec = {
26678 __PYX_TYPE_MODULE_PREFIX "cython_function_or_method",
26679 sizeof(__pyx_CyFunctionObject),
26680 0,
26681 #ifdef Py_TPFLAGS_METHOD_DESCRIPTOR
26682 Py_TPFLAGS_METHOD_DESCRIPTOR |
26683 #endif
26684 #if (defined(_Py_TPFLAGS_HAVE_VECTORCALL) && CYTHON_METH_FASTCALL)
26685 _Py_TPFLAGS_HAVE_VECTORCALL |
26686 #endif
26687 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE,
26688 __pyx_CyFunctionType_slots
26689 };
26690 #else
26691 static PyTypeObject __pyx_CyFunctionType_type = {
26692 PyVarObject_HEAD_INIT(0, 0)
26693 __PYX_TYPE_MODULE_PREFIX "cython_function_or_method",
26694 sizeof(__pyx_CyFunctionObject),
26695 0,
26696 (destructor) __Pyx_CyFunction_dealloc,
26697 #if !CYTHON_METH_FASTCALL
26698 0,
26699 #elif CYTHON_BACKPORT_VECTORCALL
26700 (printfunc)offsetof(__pyx_CyFunctionObject, func_vectorcall),
26701 #else
26702 offsetof(PyCFunctionObject, vectorcall),
26703 #endif
26704 0,
26705 0,
26706 #if PY_MAJOR_VERSION < 3
26707 0,
26708 #else
26709 0,
26710 #endif
26711 (reprfunc) __Pyx_CyFunction_repr,
26712 0,
26713 0,
26714 0,
26715 0,
26716 __Pyx_CyFunction_CallAsMethod,
26717 0,
26718 0,
26719 0,
26720 0,
26721 #ifdef Py_TPFLAGS_METHOD_DESCRIPTOR
26722 Py_TPFLAGS_METHOD_DESCRIPTOR |
26723 #endif
26724 #if defined(_Py_TPFLAGS_HAVE_VECTORCALL) && CYTHON_METH_FASTCALL
26725 _Py_TPFLAGS_HAVE_VECTORCALL |
26726 #endif
26727 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE,
26728 0,
26729 (traverseproc) __Pyx_CyFunction_traverse,
26730 (inquiry) __Pyx_CyFunction_clear,
26731 0,
26732 #if PY_VERSION_HEX < 0x030500A0
26733 offsetof(__pyx_CyFunctionObject, func_weakreflist),
26734 #else
26735 offsetof(PyCFunctionObject, m_weakreflist),
26736 #endif
26737 0,
26738 0,
26739 __pyx_CyFunction_methods,
26740 __pyx_CyFunction_members,
26741 __pyx_CyFunction_getsets,
26742 0,
26743 0,
26744 __Pyx_PyMethod_New,
26745 0,
26746 offsetof(__pyx_CyFunctionObject, func_dict),
26747 0,
26748 0,
26749 0,
26750 0,
26751 0,
26752 0,
26753 0,
26754 0,
26755 0,
26756 0,
26757 0,
26758 0,
26759 #if PY_VERSION_HEX >= 0x030400a1
26760 0,
26761 #endif
26762 #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
26763 0,
26764 #endif
26765 #if __PYX_NEED_TP_PRINT_SLOT
26766 0,
26767 #endif
26768 #if PY_VERSION_HEX >= 0x030C0000
26769 0,
26770 #endif
26771 #if PY_VERSION_HEX >= 0x030d00A4
26772 0,
26773 #endif
26774 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
26775 0,
26776 #endif
26777 };
26778 #endif
26779 static int __pyx_CyFunction_init(PyObject *module) {
26780 #if CYTHON_USE_TYPE_SPECS
26781 __pyx_CyFunctionType = __Pyx_FetchCommonTypeFromSpec(module, &__pyx_CyFunctionType_spec, NULL);
26782 #else
26783 CYTHON_UNUSED_VAR(module);
26784 __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
26785 #endif
26786 if (unlikely(__pyx_CyFunctionType == NULL)) {
26787 return -1;
26788 }
26789 return 0;
26790 }
26791 static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
26792 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
26793 m->defaults = PyObject_Malloc(size);
26794 if (unlikely(!m->defaults))
26795 return PyErr_NoMemory();
26796 memset(m->defaults, 0, size);
26797 m->defaults_pyobjects = pyobjects;
26798 m->defaults_size = size;
26799 return m->defaults;
26800 }
26801 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
26802 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
26803 m->defaults_tuple = tuple;
26804 Py_INCREF(tuple);
26805 }
26806 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
26807 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
26808 m->defaults_kwdict = dict;
26809 Py_INCREF(dict);
26810 }
26811 static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
26812 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
26813 m->func_annotations = dict;
26814 Py_INCREF(dict);
26815 }
26816
26817 /* CythonFunction */
26818 static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname,
26819 PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
26820 PyObject *op = __Pyx_CyFunction_Init(
26821 PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType),
26822 ml, flags, qualname, closure, module, globals, code
26823 );
26824 if (likely(op)) {
26825 PyObject_GC_Track(op);
26826 }
26827 return op;
26828 }
26829
26830 /* Py3UpdateBases */
26831 static PyObject*
26832 __Pyx_PEP560_update_bases(PyObject *bases)
26833 {
26834 Py_ssize_t i, j, size_bases;
26835 PyObject *base, *meth, *new_base, *result, *new_bases = NULL;
26836 size_bases = PyTuple_GET_SIZE(bases);
26837 for (i = 0; i < size_bases; i++) {
26838 base = PyTuple_GET_ITEM(bases, i);
26839 if (PyType_Check(base)) {
26840 if (new_bases) {
26841 if (PyList_Append(new_bases, base) < 0) {
26842 goto error;
26843 }
26844 }
26845 continue;
26846 }
26847 meth = __Pyx_PyObject_GetAttrStrNoError(base, __pyx_n_s_mro_entries);
26848 if (!meth && PyErr_Occurred()) {
26849 goto error;
26850 }
26851 if (!meth) {
26852 if (new_bases) {
26853 if (PyList_Append(new_bases, base) < 0) {
26854 goto error;
26855 }
26856 }
26857 continue;
26858 }
26859 new_base = __Pyx_PyObject_CallOneArg(meth, bases);
26860 Py_DECREF(meth);
26861 if (!new_base) {
26862 goto error;
26863 }
26864 if (!PyTuple_Check(new_base)) {
26865 PyErr_SetString(PyExc_TypeError,
26866 "__mro_entries__ must return a tuple");
26867 Py_DECREF(new_base);
26868 goto error;
26869 }
26870 if (!new_bases) {
26871 if (!(new_bases = PyList_New(i))) {
26872 goto error;
26873 }
26874 for (j = 0; j < i; j++) {
26875 base = PyTuple_GET_ITEM(bases, j);
26876 PyList_SET_ITEM(new_bases, j, base);
26877 Py_INCREF(base);
26878 }
26879 }
26880 j = PyList_GET_SIZE(new_bases);
26881 if (PyList_SetSlice(new_bases, j, j, new_base) < 0) {
26882 goto error;
26883 }
26884 Py_DECREF(new_base);
26885 }
26886 if (!new_bases) {
26887 Py_INCREF(bases);
26888 return bases;
26889 }
26890 result = PyList_AsTuple(new_bases);
26891 Py_DECREF(new_bases);
26892 return result;
26893 error:
26894 Py_XDECREF(new_bases);
26895 return NULL;
26896 }
26897
26898 /* CalculateMetaclass */
26899 static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) {
26900 Py_ssize_t i, nbases;
26901 #if CYTHON_ASSUME_SAFE_MACROS
26902 nbases = PyTuple_GET_SIZE(bases);
26903 #else
26904 nbases = PyTuple_Size(bases);
26905 if (nbases < 0) return NULL;
26906 #endif
26907 for (i=0; i < nbases; i++) {
26908 PyTypeObject *tmptype;
26909 #if CYTHON_ASSUME_SAFE_MACROS
26910 PyObject *tmp = PyTuple_GET_ITEM(bases, i);
26911 #else
26912 PyObject *tmp = PyTuple_GetItem(bases, i);
26913 if (!tmp) return NULL;
26914 #endif
26915 tmptype = Py_TYPE(tmp);
26916 #if PY_MAJOR_VERSION < 3
26917 if (tmptype == &PyClass_Type)
26918 continue;
26919 #endif
26920 if (!metaclass) {
26921 metaclass = tmptype;
26922 continue;
26923 }
26924 if (PyType_IsSubtype(metaclass, tmptype))
26925 continue;
26926 if (PyType_IsSubtype(tmptype, metaclass)) {
26927 metaclass = tmptype;
26928 continue;
26929 }
26930 PyErr_SetString(PyExc_TypeError,
26931 "metaclass conflict: "
26932 "the metaclass of a derived class "
26933 "must be a (non-strict) subclass "
26934 "of the metaclasses of all its bases");
26935 return NULL;
26936 }
26937 if (!metaclass) {
26938 #if PY_MAJOR_VERSION < 3
26939 metaclass = &PyClass_Type;
26940 #else
26941 metaclass = &PyType_Type;
26942 #endif
26943 }
26944 Py_INCREF((PyObject*) metaclass);
26945 return (PyObject*) metaclass;
26946 }
26947
26948 /* PyObjectLookupSpecial */
26949 #if CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
26950 static CYTHON_INLINE PyObject* __Pyx__PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name, int with_error) {
26951 PyObject *res;
26952 PyTypeObject *tp = Py_TYPE(obj);
26953 #if PY_MAJOR_VERSION < 3
26954 if (unlikely(PyInstance_Check(obj)))
26955 return with_error ? __Pyx_PyObject_GetAttrStr(obj, attr_name) : __Pyx_PyObject_GetAttrStrNoError(obj, attr_name);
26956 #endif
26957 res = _PyType_Lookup(tp, attr_name);
26958 if (likely(res)) {
26959 descrgetfunc f = Py_TYPE(res)->tp_descr_get;
26960 if (!f) {
26961 Py_INCREF(res);
26962 } else {
26963 res = f(res, obj, (PyObject *)tp);
26964 }
26965 } else if (with_error) {
26966 PyErr_SetObject(PyExc_AttributeError, attr_name);
26967 }
26968 return res;
26969 }
26970 #endif
26971
26972 /* Py3ClassCreate */
26973 static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name,
26974 PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) {
26975 PyObject *ns;
26976 if (metaclass) {
26977 PyObject *prep = __Pyx_PyObject_GetAttrStrNoError(metaclass, __pyx_n_s_prepare);
26978 if (prep) {
26979 PyObject *pargs[3] = {NULL, name, bases};
26980 ns = __Pyx_PyObject_FastCallDict(prep, pargs+1, 2 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET, mkw);
26981 Py_DECREF(prep);
26982 } else {
26983 if (unlikely(PyErr_Occurred()))
26984 return NULL;
26985 ns = PyDict_New();
26986 }
26987 } else {
26988 ns = PyDict_New();
26989 }
26990 if (unlikely(!ns))
26991 return NULL;
26992 if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module, modname) < 0)) goto bad;
26993 #if PY_VERSION_HEX >= 0x03030000
26994 if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad;
26995 #else
26996 CYTHON_MAYBE_UNUSED_VAR(qualname);
26997 #endif
26998 if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc, doc) < 0)) goto bad;
26999 return ns;
27000 bad:
27001 Py_DECREF(ns);
27002 return NULL;
27003 }
27004 #if PY_VERSION_HEX < 0x030600A4 && CYTHON_PEP487_INIT_SUBCLASS
27005 static int __Pyx_SetNamesPEP487(PyObject *type_obj) {
27006 PyTypeObject *type = (PyTypeObject*) type_obj;
27007 PyObject *names_to_set, *key, *value, *set_name, *tmp;
27008 Py_ssize_t i = 0;
27009 #if CYTHON_USE_TYPE_SLOTS
27010 names_to_set = PyDict_Copy(type->tp_dict);
27011 #else
27012 {
27013 PyObject *d = PyObject_GetAttr(type_obj, __pyx_n_s_dict);
27014 names_to_set = NULL;
27015 if (likely(d)) {
27016 PyObject *names_to_set = PyDict_New();
27017 int ret = likely(names_to_set) ? PyDict_Update(names_to_set, d) : -1;
27018 Py_DECREF(d);
27019 if (unlikely(ret < 0))
27020 Py_CLEAR(names_to_set);
27021 }
27022 }
27023 #endif
27024 if (unlikely(names_to_set == NULL))
27025 goto bad;
27026 while (PyDict_Next(names_to_set, &i, &key, &value)) {
27027 set_name = __Pyx_PyObject_LookupSpecialNoError(value, __pyx_n_s_set_name);
27028 if (unlikely(set_name != NULL)) {
27029 tmp = __Pyx_PyObject_Call2Args(set_name, type_obj, key);
27030 Py_DECREF(set_name);
27031 if (unlikely(tmp == NULL)) {
27032 __Pyx_TypeName value_type_name =
27033 __Pyx_PyType_GetName(Py_TYPE(value));
27034 __Pyx_TypeName type_name = __Pyx_PyType_GetName(type);
27035 PyErr_Format(PyExc_RuntimeError,
27036 #if PY_MAJOR_VERSION >= 3
27037 "Error calling __set_name__ on '" __Pyx_FMT_TYPENAME "' instance %R " "in '" __Pyx_FMT_TYPENAME "'",
27038 value_type_name, key, type_name);
27039 #else
27040 "Error calling __set_name__ on '" __Pyx_FMT_TYPENAME "' instance %.100s in '" __Pyx_FMT_TYPENAME "'",
27041 value_type_name,
27042 PyString_Check(key) ? PyString_AS_STRING(key) : "?",
27043 type_name);
27044 #endif
27045 goto bad;
27046 } else {
27047 Py_DECREF(tmp);
27048 }
27049 }
27050 else if (unlikely(PyErr_Occurred())) {
27051 goto bad;
27052 }
27053 }
27054 Py_DECREF(names_to_set);
27055 return 0;
27056 bad:
27057 Py_XDECREF(names_to_set);
27058 return -1;
27059 }
27060 static PyObject *__Pyx_InitSubclassPEP487(PyObject *type_obj, PyObject *mkw) {
27061 #if CYTHON_USE_TYPE_SLOTS && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
27062 PyTypeObject *type = (PyTypeObject*) type_obj;
27063 PyObject *mro = type->tp_mro;
27064 Py_ssize_t i, nbases;
27065 if (unlikely(!mro)) goto done;
27066 (void) &__Pyx_GetBuiltinName;
27067 Py_INCREF(mro);
27068 nbases = PyTuple_GET_SIZE(mro);
27069 assert(PyTuple_GET_ITEM(mro, 0) == type_obj);
27070 for (i = 1; i < nbases-1; i++) {
27071 PyObject *base, *dict, *meth;
27072 base = PyTuple_GET_ITEM(mro, i);
27073 dict = ((PyTypeObject *)base)->tp_dict;
27074 meth = __Pyx_PyDict_GetItemStrWithError(dict, __pyx_n_s_init_subclass);
27075 if (unlikely(meth)) {
27076 descrgetfunc f = Py_TYPE(meth)->tp_descr_get;
27077 PyObject *res;
27078 Py_INCREF(meth);
27079 if (likely(f)) {
27080 res = f(meth, NULL, type_obj);
27081 Py_DECREF(meth);
27082 if (unlikely(!res)) goto bad;
27083 meth = res;
27084 }
27085 res = __Pyx_PyObject_FastCallDict(meth, NULL, 0, mkw);
27086 Py_DECREF(meth);
27087 if (unlikely(!res)) goto bad;
27088 Py_DECREF(res);
27089 goto done;
27090 } else if (unlikely(PyErr_Occurred())) {
27091 goto bad;
27092 }
27093 }
27094 done:
27095 Py_XDECREF(mro);
27096 return type_obj;
27097 bad:
27098 Py_XDECREF(mro);
27099 Py_DECREF(type_obj);
27100 return NULL;
27101 #else
27102 PyObject *super_type, *super, *func, *res;
27103 #if CYTHON_COMPILING_IN_PYPY && !defined(PySuper_Type)
27104 super_type = __Pyx_GetBuiltinName(__pyx_n_s_super);
27105 #else
27106 super_type = (PyObject*) &PySuper_Type;
27107 (void) &__Pyx_GetBuiltinName;
27108 #endif
27109 super = likely(super_type) ? __Pyx_PyObject_Call2Args(super_type, type_obj, type_obj) : NULL;
27110 #if CYTHON_COMPILING_IN_PYPY && !defined(PySuper_Type)
27111 Py_XDECREF(super_type);
27112 #endif
27113 if (unlikely(!super)) {
27114 Py_CLEAR(type_obj);
27115 goto done;
27116 }
27117 func = __Pyx_PyObject_GetAttrStrNoError(super, __pyx_n_s_init_subclass);
27118 Py_DECREF(super);
27119 if (likely(!func)) {
27120 if (unlikely(PyErr_Occurred()))
27121 Py_CLEAR(type_obj);
27122 goto done;
27123 }
27124 res = __Pyx_PyObject_FastCallDict(func, NULL, 0, mkw);
27125 Py_DECREF(func);
27126 if (unlikely(!res))
27127 Py_CLEAR(type_obj);
27128 Py_XDECREF(res);
27129 done:
27130 return type_obj;
27131 #endif
27132 }
27133 #endif
27134 static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases,
27135 PyObject *dict, PyObject *mkw,
27136 int calculate_metaclass, int allow_py2_metaclass) {
27137 PyObject *result;
27138 PyObject *owned_metaclass = NULL;
27139 PyObject *margs[4] = {NULL, name, bases, dict};
27140 if (allow_py2_metaclass) {
27141 owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass);
27142 if (owned_metaclass) {
27143 metaclass = owned_metaclass;
27144 } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) {
27145 PyErr_Clear();
27146 } else {
27147 return NULL;
27148 }
27149 }
27150 if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) {
27151 metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases);
27152 Py_XDECREF(owned_metaclass);
27153 if (unlikely(!metaclass))
27154 return NULL;
27155 owned_metaclass = metaclass;
27156 }
27157 result = __Pyx_PyObject_FastCallDict(metaclass, margs+1, 3 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET,
27158 #if PY_VERSION_HEX < 0x030600A4
27159 (metaclass == (PyObject*)&PyType_Type) ? NULL : mkw
27160 #else
27161 mkw
27162 #endif
27163 );
27164 Py_XDECREF(owned_metaclass);
27165 #if PY_VERSION_HEX < 0x030600A4 && CYTHON_PEP487_INIT_SUBCLASS
27166 if (likely(result) && likely(PyType_Check(result))) {
27167 if (unlikely(__Pyx_SetNamesPEP487(result) < 0)) {
27168 Py_CLEAR(result);
27169 } else {
27170 result = __Pyx_InitSubclassPEP487(result, mkw);
27171 }
27172 }
27173 #else
27174 (void) &__Pyx_GetBuiltinName;
27175 #endif
27176 return result;
27177 }
27178
27179 /* CLineInTraceback */
27180 #ifndef CYTHON_CLINE_IN_TRACEBACK
27181 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) {
27182 PyObject *use_cline;
27183 PyObject *ptype, *pvalue, *ptraceback;
27184 #if CYTHON_COMPILING_IN_CPYTHON
27185 PyObject **cython_runtime_dict;
27186 #endif
27187 CYTHON_MAYBE_UNUSED_VAR(tstate);
27188 if (unlikely(!__pyx_cython_runtime)) {
27189 return c_line;
27190 }
27191 __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
27192 #if CYTHON_COMPILING_IN_CPYTHON
27193 cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
27194 if (likely(cython_runtime_dict)) {
27195 __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
27196 use_cline, *cython_runtime_dict,
27197 __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
27198 } else
27199 #endif
27200 {
27201 PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStrNoError(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
27202 if (use_cline_obj) {
27203 use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
27204 Py_DECREF(use_cline_obj);
27205 } else {
27206 PyErr_Clear();
27207 use_cline = NULL;
27208 }
27209 }
27210 if (!use_cline) {
27211 c_line = 0;
27212 (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
27213 }
27214 else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
27215 c_line = 0;
27216 }
27217 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
27218 return c_line;
27219 }
27220 #endif
27221
27222 /* CodeObjectCache */
27223 #if !CYTHON_COMPILING_IN_LIMITED_API
27224 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
27225 int start = 0, mid = 0, end = count - 1;
27226 if (end >= 0 && code_line > entries[end].code_line) {
27227 return count;
27228 }
27229 while (start < end) {
27230 mid = start + (end - start) / 2;
27231 if (code_line < entries[mid].code_line) {
27232 end = mid;
27233 } else if (code_line > entries[mid].code_line) {
27234 start = mid + 1;
27235 } else {
27236 return mid;
27237 }
27238 }
27239 if (code_line <= entries[mid].code_line) {
27240 return mid;
27241 } else {
27242 return mid + 1;
27243 }
27244 }
27245 static PyCodeObject *__pyx_find_code_object(int code_line) {
27246 PyCodeObject* code_object;
27247 int pos;
27248 if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
27249 return NULL;
27250 }
27251 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
27252 if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
27253 return NULL;
27254 }
27255 code_object = __pyx_code_cache.entries[pos].code_object;
27256 Py_INCREF(code_object);
27257 return code_object;
27258 }
27259 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
27260 int pos, i;
27261 __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
27262 if (unlikely(!code_line)) {
27263 return;
27264 }
27265 if (unlikely(!entries)) {
27266 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
27267 if (likely(entries)) {
27268 __pyx_code_cache.entries = entries;
27269 __pyx_code_cache.max_count = 64;
27270 __pyx_code_cache.count = 1;
27271 entries[0].code_line = code_line;
27272 entries[0].code_object = code_object;
27273 Py_INCREF(code_object);
27274 }
27275 return;
27276 }
27277 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
27278 if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
27279 PyCodeObject* tmp = entries[pos].code_object;
27280 entries[pos].code_object = code_object;
27281 Py_DECREF(tmp);
27282 return;
27283 }
27284 if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
27285 int new_max = __pyx_code_cache.max_count + 64;
27286 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
27287 __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
27288 if (unlikely(!entries)) {
27289 return;
27290 }
27291 __pyx_code_cache.entries = entries;
27292 __pyx_code_cache.max_count = new_max;
27293 }
27294 for (i=__pyx_code_cache.count; i>pos; i--) {
27295 entries[i] = entries[i-1];
27296 }
27297 entries[pos].code_line = code_line;
27298 entries[pos].code_object = code_object;
27299 __pyx_code_cache.count++;
27300 Py_INCREF(code_object);
27301 }
27302 #endif
27303
27304 /* AddTraceback */
27305 #include "compile.h"
27306 #include "frameobject.h"
27307 #include "traceback.h"
27308 #if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API
27309 #ifndef Py_BUILD_CORE
27310 #define Py_BUILD_CORE 1
27311 #endif
27312 #include "internal/pycore_frame.h"
27313 #endif
27314 #if CYTHON_COMPILING_IN_LIMITED_API
27315 static PyObject *__Pyx_PyCode_Replace_For_AddTraceback(PyObject *code, PyObject *scratch_dict,
27316 PyObject *firstlineno, PyObject *name) {
27317 PyObject *replace = NULL;
27318 if (unlikely(PyDict_SetItemString(scratch_dict, "co_firstlineno", firstlineno))) return NULL;
27319 if (unlikely(PyDict_SetItemString(scratch_dict, "co_name", name))) return NULL;
27320 replace = PyObject_GetAttrString(code, "replace");
27321 if (likely(replace)) {
27322 PyObject *result;
27323 result = PyObject_Call(replace, __pyx_empty_tuple, scratch_dict);
27324 Py_DECREF(replace);
27325 return result;
27326 }
27327 PyErr_Clear();
27328 #if __PYX_LIMITED_VERSION_HEX < 0x030780000
27329 {
27330 PyObject *compiled = NULL, *result = NULL;
27331 if (unlikely(PyDict_SetItemString(scratch_dict, "code", code))) return NULL;
27332 if (unlikely(PyDict_SetItemString(scratch_dict, "type", (PyObject*)(&PyType_Type)))) return NULL;
27333 compiled = Py_CompileString(
27334 "out = type(code)(\n"
27335 " code.co_argcount, code.co_kwonlyargcount, code.co_nlocals, code.co_stacksize,\n"
27336 " code.co_flags, code.co_code, code.co_consts, code.co_names,\n"
27337 " code.co_varnames, code.co_filename, co_name, co_firstlineno,\n"
27338 " code.co_lnotab)\n", "<dummy>", Py_file_input);
27339 if (!compiled) return NULL;
27340 result = PyEval_EvalCode(compiled, scratch_dict, scratch_dict);
27341 Py_DECREF(compiled);
27342 if (!result) PyErr_Print();
27343 Py_DECREF(result);
27344 result = PyDict_GetItemString(scratch_dict, "out");
27345 if (result) Py_INCREF(result);
27346 return result;
27347 }
27348 #else
27349 return NULL;
27350 #endif
27351 }
27352 static void __Pyx_AddTraceback(const char *funcname, int c_line,
27353 int py_line, const char *filename) {
27354 PyObject *code_object = NULL, *py_py_line = NULL, *py_funcname = NULL, *dict = NULL;
27355 PyObject *replace = NULL, *getframe = NULL, *frame = NULL;
27356 PyObject *exc_type, *exc_value, *exc_traceback;
27357 int success = 0;
27358 if (c_line) {
27359 (void) __pyx_cfilenm;
27360 (void) __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line);
27361 }
27362 PyErr_Fetch(&exc_type, &exc_value, &exc_traceback);
27363 code_object = Py_CompileString("_getframe()", filename, Py_eval_input);
27364 if (unlikely(!code_object)) goto bad;
27365 py_py_line = PyLong_FromLong(py_line);
27366 if (unlikely(!py_py_line)) goto bad;
27367 py_funcname = PyUnicode_FromString(funcname);
27368 if (unlikely(!py_funcname)) goto bad;
27369 dict = PyDict_New();
27370 if (unlikely(!dict)) goto bad;
27371 {
27372 PyObject *old_code_object = code_object;
27373 code_object = __Pyx_PyCode_Replace_For_AddTraceback(code_object, dict, py_py_line, py_funcname);
27374 Py_DECREF(old_code_object);
27375 }
27376 if (unlikely(!code_object)) goto bad;
27377 getframe = PySys_GetObject("_getframe");
27378 if (unlikely(!getframe)) goto bad;
27379 if (unlikely(PyDict_SetItemString(dict, "_getframe", getframe))) goto bad;
27380 frame = PyEval_EvalCode(code_object, dict, dict);
27381 if (unlikely(!frame) || frame == Py_None) goto bad;
27382 success = 1;
27383 bad:
27384 PyErr_Restore(exc_type, exc_value, exc_traceback);
27385 Py_XDECREF(code_object);
27386 Py_XDECREF(py_py_line);
27387 Py_XDECREF(py_funcname);
27388 Py_XDECREF(dict);
27389 Py_XDECREF(replace);
27390 if (success) {
27391 PyTraceBack_Here(
27392 (struct _frame*)frame);
27393 }
27394 Py_XDECREF(frame);
27395 }
27396 #else
27397 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
27398 const char *funcname, int c_line,
27399 int py_line, const char *filename) {
27400 PyCodeObject *py_code = NULL;
27401 PyObject *py_funcname = NULL;
27402 #if PY_MAJOR_VERSION < 3
27403 PyObject *py_srcfile = NULL;
27404 py_srcfile = PyString_FromString(filename);
27405 if (!py_srcfile) goto bad;
27406 #endif
27407 if (c_line) {
27408 #if PY_MAJOR_VERSION < 3
27409 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
27410 if (!py_funcname) goto bad;
27411 #else
27412 py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
27413 if (!py_funcname) goto bad;
27414 funcname = PyUnicode_AsUTF8(py_funcname);
27415 if (!funcname) goto bad;
27416 #endif
27417 }
27418 else {
27419 #if PY_MAJOR_VERSION < 3
27420 py_funcname = PyString_FromString(funcname);
27421 if (!py_funcname) goto bad;
27422 #endif
27423 }
27424 #if PY_MAJOR_VERSION < 3
27425 py_code = __Pyx_PyCode_New(
27426 0,
27427 0,
27428 0,
27429 0,
27430 0,
27431 0,
27432 __pyx_empty_bytes, /*PyObject *code,*/
27433 __pyx_empty_tuple, /*PyObject *consts,*/
27434 __pyx_empty_tuple, /*PyObject *names,*/
27435 __pyx_empty_tuple, /*PyObject *varnames,*/
27436 __pyx_empty_tuple, /*PyObject *freevars,*/
27437 __pyx_empty_tuple, /*PyObject *cellvars,*/
27438 py_srcfile, /*PyObject *filename,*/
27439 py_funcname, /*PyObject *name,*/
27440 py_line,
27441 __pyx_empty_bytes /*PyObject *lnotab*/
27442 );
27443 Py_DECREF(py_srcfile);
27444 #else
27445 py_code = PyCode_NewEmpty(filename, funcname, py_line);
27446 #endif
27447 Py_XDECREF(py_funcname);
27448 return py_code;
27449 bad:
27450 Py_XDECREF(py_funcname);
27451 #if PY_MAJOR_VERSION < 3
27452 Py_XDECREF(py_srcfile);
27453 #endif
27454 return NULL;
27455 }
27456 static void __Pyx_AddTraceback(const char *funcname, int c_line,
27457 int py_line, const char *filename) {
27458 PyCodeObject *py_code = 0;
27459 PyFrameObject *py_frame = 0;
27460 PyThreadState *tstate = __Pyx_PyThreadState_Current;
27461 PyObject *ptype, *pvalue, *ptraceback;
27462 if (c_line) {
27463 c_line = __Pyx_CLineForTraceback(tstate, c_line);
27464 }
27465 py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
27466 if (!py_code) {
27467 __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
27468 py_code = __Pyx_CreateCodeObjectForTraceback(
27469 funcname, c_line, py_line, filename);
27470 if (!py_code) {
27471 /* If the code object creation fails, then we should clear the
27472 fetched exception references and propagate the new exception */
27473 Py_XDECREF(ptype);
27474 Py_XDECREF(pvalue);
27475 Py_XDECREF(ptraceback);
27476 goto bad;
27477 }
27478 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
27479 __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
27480 }
27481 py_frame = PyFrame_New(
27482 tstate, /*PyThreadState *tstate,*/
27483 py_code, /*PyCodeObject *code,*/
27484 __pyx_d, /*PyObject *globals,*/
27485 0 /*PyObject *locals*/
27486 );
27487 if (!py_frame) goto bad;
27488 __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
27489 PyTraceBack_Here(py_frame);
27490 bad:
27491 Py_XDECREF(py_code);
27492 Py_XDECREF(py_frame);
27493 }
27494 #endif
27495
27496 /* CIntFromPyVerify */
27497 #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
27498 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
27499 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
27500 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
27501 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
27502 {\
27503 func_type value = func_value;\
27504 if (sizeof(target_type) < sizeof(func_type)) {\
27505 if (unlikely(value != (func_type) (target_type) value)) {\
27506 func_type zero = 0;\
27507 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
27508 return (target_type) -1;\
27509 if (is_unsigned && unlikely(value < zero))\
27510 goto raise_neg_overflow;\
27511 else\
27512 goto raise_overflow;\
27513 }\
27514 }\
27515 return (target_type) value;\
27516 }
27517
27518 /* CIntFromPy */
27519 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
27520 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
27521 #pragma GCC diagnostic push
27522 #pragma GCC diagnostic ignored "-Wconversion"
27523 #endif
27524 const int neg_one = (int) -1, const_zero = (int) 0;
27525 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
27526 #pragma GCC diagnostic pop
27527 #endif
27528 const int is_unsigned = neg_one > const_zero;
27529 #if PY_MAJOR_VERSION < 3
27530 if (likely(PyInt_Check(x))) {
27531 if ((sizeof(int) < sizeof(long))) {
27532 __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
27533 } else {
27534 long val = PyInt_AS_LONG(x);
27535 if (is_unsigned && unlikely(val < 0)) {
27536 goto raise_neg_overflow;
27537 }
27538 return (int) val;
27539 }
27540 }
27541 #endif
27542 if (unlikely(!PyLong_Check(x))) {
27543 int val;
27544 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
27545 if (!tmp) return (int) -1;
27546 val = __Pyx_PyInt_As_int(tmp);
27547 Py_DECREF(tmp);
27548 return val;
27549 }
27550 if (is_unsigned) {
27551 #if CYTHON_USE_PYLONG_INTERNALS
27552 if (unlikely(__Pyx_PyLong_IsNeg(x))) {
27553 goto raise_neg_overflow;
27554 } else if (__Pyx_PyLong_IsCompact(x)) {
27555 __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
27556 } else {
27557 const digit* digits = __Pyx_PyLong_Digits(x);
27558 assert(__Pyx_PyLong_DigitCount(x) > 1);
27559 switch (__Pyx_PyLong_DigitCount(x)) {
27560 case 2:
27561 if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) {
27562 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
27563 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27564 } else if ((8 * sizeof(int) >= 2 * PyLong_SHIFT)) {
27565 return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
27566 }
27567 }
27568 break;
27569 case 3:
27570 if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) {
27571 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
27572 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27573 } else if ((8 * sizeof(int) >= 3 * PyLong_SHIFT)) {
27574 return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
27575 }
27576 }
27577 break;
27578 case 4:
27579 if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) {
27580 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
27581 __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])))
27582 } else if ((8 * sizeof(int) >= 4 * PyLong_SHIFT)) {
27583 return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
27584 }
27585 }
27586 break;
27587 }
27588 }
27589 #endif
27590 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
27591 if (unlikely(Py_SIZE(x) < 0)) {
27592 goto raise_neg_overflow;
27593 }
27594 #else
27595 {
27596 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
27597 if (unlikely(result < 0))
27598 return (int) -1;
27599 if (unlikely(result == 1))
27600 goto raise_neg_overflow;
27601 }
27602 #endif
27603 if ((sizeof(int) <= sizeof(unsigned long))) {
27604 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
27605 #ifdef HAVE_LONG_LONG
27606 } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) {
27607 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
27608 #endif
27609 }
27610 } else {
27611 #if CYTHON_USE_PYLONG_INTERNALS
27612 if (__Pyx_PyLong_IsCompact(x)) {
27613 __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
27614 } else {
27615 const digit* digits = __Pyx_PyLong_Digits(x);
27616 assert(__Pyx_PyLong_DigitCount(x) > 1);
27617 switch (__Pyx_PyLong_SignedDigitCount(x)) {
27618 case -2:
27619 if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) {
27620 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
27621 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27622 } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
27623 return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
27624 }
27625 }
27626 break;
27627 case 2:
27628 if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) {
27629 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
27630 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27631 } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
27632 return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
27633 }
27634 }
27635 break;
27636 case -3:
27637 if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
27638 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
27639 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27640 } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
27641 return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
27642 }
27643 }
27644 break;
27645 case 3:
27646 if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) {
27647 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
27648 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27649 } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
27650 return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
27651 }
27652 }
27653 break;
27654 case -4:
27655 if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
27656 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
27657 __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])))
27658 } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) {
27659 return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
27660 }
27661 }
27662 break;
27663 case 4:
27664 if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) {
27665 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
27666 __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])))
27667 } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) {
27668 return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
27669 }
27670 }
27671 break;
27672 }
27673 }
27674 #endif
27675 if ((sizeof(int) <= sizeof(long))) {
27676 __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
27677 #ifdef HAVE_LONG_LONG
27678 } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) {
27679 __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
27680 #endif
27681 }
27682 }
27683 {
27684 int val;
27685 int ret = -1;
27686 #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
27687 Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
27688 x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
27689 if (unlikely(bytes_copied == -1)) {
27690 } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
27691 goto raise_overflow;
27692 } else {
27693 ret = 0;
27694 }
27695 #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
27696 int one = 1; int is_little = (int)*(unsigned char *)&one;
27697 unsigned char *bytes = (unsigned char *)&val;
27698 ret = _PyLong_AsByteArray((PyLongObject *)x,
27699 bytes, sizeof(val),
27700 is_little, !is_unsigned);
27701 #else
27702 PyObject *v;
27703 PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
27704 int bits, remaining_bits, is_negative = 0;
27705 int chunk_size = (sizeof(long) < 8) ? 30 : 62;
27706 if (likely(PyLong_CheckExact(x))) {
27707 v = __Pyx_NewRef(x);
27708 } else {
27709 v = PyNumber_Long(x);
27710 if (unlikely(!v)) return (int) -1;
27711 assert(PyLong_CheckExact(v));
27712 }
27713 {
27714 int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
27715 if (unlikely(result < 0)) {
27716 Py_DECREF(v);
27717 return (int) -1;
27718 }
27719 is_negative = result == 1;
27720 }
27721 if (is_unsigned && unlikely(is_negative)) {
27722 Py_DECREF(v);
27723 goto raise_neg_overflow;
27724 } else if (is_negative) {
27725 stepval = PyNumber_Invert(v);
27726 Py_DECREF(v);
27727 if (unlikely(!stepval))
27728 return (int) -1;
27729 } else {
27730 stepval = v;
27731 }
27732 v = NULL;
27733 val = (int) 0;
27734 mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
27735 shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
27736 for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) {
27737 PyObject *tmp, *digit;
27738 long idigit;
27739 digit = PyNumber_And(stepval, mask);
27740 if (unlikely(!digit)) goto done;
27741 idigit = PyLong_AsLong(digit);
27742 Py_DECREF(digit);
27743 if (unlikely(idigit < 0)) goto done;
27744 val |= ((int) idigit) << bits;
27745 tmp = PyNumber_Rshift(stepval, shift);
27746 if (unlikely(!tmp)) goto done;
27747 Py_DECREF(stepval); stepval = tmp;
27748 }
27749 Py_DECREF(shift); shift = NULL;
27750 Py_DECREF(mask); mask = NULL;
27751 {
27752 long idigit = PyLong_AsLong(stepval);
27753 if (unlikely(idigit < 0)) goto done;
27754 remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1);
27755 if (unlikely(idigit >= (1L << remaining_bits)))
27756 goto raise_overflow;
27757 val |= ((int) idigit) << bits;
27758 }
27759 if (!is_unsigned) {
27760 if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1))))
27761 goto raise_overflow;
27762 if (is_negative)
27763 val = ~val;
27764 }
27765 ret = 0;
27766 done:
27767 Py_XDECREF(shift);
27768 Py_XDECREF(mask);
27769 Py_XDECREF(stepval);
27770 #endif
27771 if (unlikely(ret))
27772 return (int) -1;
27773 return val;
27774 }
27775 raise_overflow:
27776 PyErr_SetString(PyExc_OverflowError,
27777 "value too large to convert to int");
27778 return (int) -1;
27779 raise_neg_overflow:
27780 PyErr_SetString(PyExc_OverflowError,
27781 "can't convert negative value to int");
27782 return (int) -1;
27783 }
27784
27785 /* CIntToPy */
27786 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
27787 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
27788 #pragma GCC diagnostic push
27789 #pragma GCC diagnostic ignored "-Wconversion"
27790 #endif
27791 const int neg_one = (int) -1, const_zero = (int) 0;
27792 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
27793 #pragma GCC diagnostic pop
27794 #endif
27795 const int is_unsigned = neg_one > const_zero;
27796 if (is_unsigned) {
27797 if (sizeof(int) < sizeof(long)) {
27798 return PyInt_FromLong((long) value);
27799 } else if (sizeof(int) <= sizeof(unsigned long)) {
27800 return PyLong_FromUnsignedLong((unsigned long) value);
27801 #ifdef HAVE_LONG_LONG
27802 } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
27803 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
27804 #endif
27805 }
27806 } else {
27807 if (sizeof(int) <= sizeof(long)) {
27808 return PyInt_FromLong((long) value);
27809 #ifdef HAVE_LONG_LONG
27810 } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
27811 return PyLong_FromLongLong((PY_LONG_LONG) value);
27812 #endif
27813 }
27814 }
27815 {
27816 unsigned char *bytes = (unsigned char *)&value;
27817 #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
27818 if (is_unsigned) {
27819 return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
27820 } else {
27821 return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
27822 }
27823 #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
27824 int one = 1; int little = (int)*(unsigned char *)&one;
27825 return _PyLong_FromByteArray(bytes, sizeof(int),
27826 little, !is_unsigned);
27827 #else
27828 int one = 1; int little = (int)*(unsigned char *)&one;
27829 PyObject *from_bytes, *result = NULL;
27830 PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL;
27831 from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
27832 if (!from_bytes) return NULL;
27833 py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(int));
27834 if (!py_bytes) goto limited_bad;
27835 order_str = PyUnicode_FromString(little ? "little" : "big");
27836 if (!order_str) goto limited_bad;
27837 arg_tuple = PyTuple_Pack(2, py_bytes, order_str);
27838 if (!arg_tuple) goto limited_bad;
27839 if (!is_unsigned) {
27840 kwds = PyDict_New();
27841 if (!kwds) goto limited_bad;
27842 if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(Py_True))) goto limited_bad;
27843 }
27844 result = PyObject_Call(from_bytes, arg_tuple, kwds);
27845 limited_bad:
27846 Py_XDECREF(kwds);
27847 Py_XDECREF(arg_tuple);
27848 Py_XDECREF(order_str);
27849 Py_XDECREF(py_bytes);
27850 Py_XDECREF(from_bytes);
27851 return result;
27852 #endif
27853 }
27854 }
27855
27856 /* CIntFromPy */
27857 static CYTHON_INLINE uint64_t __Pyx_PyInt_As_uint64_t(PyObject *x) {
27858 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
27859 #pragma GCC diagnostic push
27860 #pragma GCC diagnostic ignored "-Wconversion"
27861 #endif
27862 const uint64_t neg_one = (uint64_t) -1, const_zero = (uint64_t) 0;
27863 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
27864 #pragma GCC diagnostic pop
27865 #endif
27866 const int is_unsigned = neg_one > const_zero;
27867 #if PY_MAJOR_VERSION < 3
27868 if (likely(PyInt_Check(x))) {
27869 if ((sizeof(uint64_t) < sizeof(long))) {
27870 __PYX_VERIFY_RETURN_INT(uint64_t, long, PyInt_AS_LONG(x))
27871 } else {
27872 long val = PyInt_AS_LONG(x);
27873 if (is_unsigned && unlikely(val < 0)) {
27874 goto raise_neg_overflow;
27875 }
27876 return (uint64_t) val;
27877 }
27878 }
27879 #endif
27880 if (unlikely(!PyLong_Check(x))) {
27881 uint64_t val;
27882 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
27883 if (!tmp) return (uint64_t) -1;
27884 val = __Pyx_PyInt_As_uint64_t(tmp);
27885 Py_DECREF(tmp);
27886 return val;
27887 }
27888 if (is_unsigned) {
27889 #if CYTHON_USE_PYLONG_INTERNALS
27890 if (unlikely(__Pyx_PyLong_IsNeg(x))) {
27891 goto raise_neg_overflow;
27892 } else if (__Pyx_PyLong_IsCompact(x)) {
27893 __PYX_VERIFY_RETURN_INT(uint64_t, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
27894 } else {
27895 const digit* digits = __Pyx_PyLong_Digits(x);
27896 assert(__Pyx_PyLong_DigitCount(x) > 1);
27897 switch (__Pyx_PyLong_DigitCount(x)) {
27898 case 2:
27899 if ((8 * sizeof(uint64_t) > 1 * PyLong_SHIFT)) {
27900 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
27901 __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27902 } else if ((8 * sizeof(uint64_t) >= 2 * PyLong_SHIFT)) {
27903 return (uint64_t) (((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]));
27904 }
27905 }
27906 break;
27907 case 3:
27908 if ((8 * sizeof(uint64_t) > 2 * PyLong_SHIFT)) {
27909 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
27910 __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27911 } else if ((8 * sizeof(uint64_t) >= 3 * PyLong_SHIFT)) {
27912 return (uint64_t) (((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]));
27913 }
27914 }
27915 break;
27916 case 4:
27917 if ((8 * sizeof(uint64_t) > 3 * PyLong_SHIFT)) {
27918 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
27919 __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27920 } else if ((8 * sizeof(uint64_t) >= 4 * PyLong_SHIFT)) {
27921 return (uint64_t) (((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0]));
27922 }
27923 }
27924 break;
27925 }
27926 }
27927 #endif
27928 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
27929 if (unlikely(Py_SIZE(x) < 0)) {
27930 goto raise_neg_overflow;
27931 }
27932 #else
27933 {
27934 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
27935 if (unlikely(result < 0))
27936 return (uint64_t) -1;
27937 if (unlikely(result == 1))
27938 goto raise_neg_overflow;
27939 }
27940 #endif
27941 if ((sizeof(uint64_t) <= sizeof(unsigned long))) {
27942 __PYX_VERIFY_RETURN_INT_EXC(uint64_t, unsigned long, PyLong_AsUnsignedLong(x))
27943 #ifdef HAVE_LONG_LONG
27944 } else if ((sizeof(uint64_t) <= sizeof(unsigned PY_LONG_LONG))) {
27945 __PYX_VERIFY_RETURN_INT_EXC(uint64_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
27946 #endif
27947 }
27948 } else {
27949 #if CYTHON_USE_PYLONG_INTERNALS
27950 if (__Pyx_PyLong_IsCompact(x)) {
27951 __PYX_VERIFY_RETURN_INT(uint64_t, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
27952 } else {
27953 const digit* digits = __Pyx_PyLong_Digits(x);
27954 assert(__Pyx_PyLong_DigitCount(x) > 1);
27955 switch (__Pyx_PyLong_SignedDigitCount(x)) {
27956 case -2:
27957 if ((8 * sizeof(uint64_t) - 1 > 1 * PyLong_SHIFT)) {
27958 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
27959 __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27960 } else if ((8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT)) {
27961 return (uint64_t) (((uint64_t)-1)*(((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
27962 }
27963 }
27964 break;
27965 case 2:
27966 if ((8 * sizeof(uint64_t) > 1 * PyLong_SHIFT)) {
27967 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
27968 __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27969 } else if ((8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT)) {
27970 return (uint64_t) ((((((uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
27971 }
27972 }
27973 break;
27974 case -3:
27975 if ((8 * sizeof(uint64_t) - 1 > 2 * PyLong_SHIFT)) {
27976 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
27977 __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27978 } else if ((8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT)) {
27979 return (uint64_t) (((uint64_t)-1)*(((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
27980 }
27981 }
27982 break;
27983 case 3:
27984 if ((8 * sizeof(uint64_t) > 2 * PyLong_SHIFT)) {
27985 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
27986 __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27987 } else if ((8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT)) {
27988 return (uint64_t) ((((((((uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
27989 }
27990 }
27991 break;
27992 case -4:
27993 if ((8 * sizeof(uint64_t) - 1 > 3 * PyLong_SHIFT)) {
27994 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
27995 __PYX_VERIFY_RETURN_INT(uint64_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
27996 } else if ((8 * sizeof(uint64_t) - 1 > 4 * PyLong_SHIFT)) {
27997 return (uint64_t) (((uint64_t)-1)*(((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
27998 }
27999 }
28000 break;
28001 case 4:
28002 if ((8 * sizeof(uint64_t) > 3 * PyLong_SHIFT)) {
28003 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
28004 __PYX_VERIFY_RETURN_INT(uint64_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28005 } else if ((8 * sizeof(uint64_t) - 1 > 4 * PyLong_SHIFT)) {
28006 return (uint64_t) ((((((((((uint64_t)digits[3]) << PyLong_SHIFT) | (uint64_t)digits[2]) << PyLong_SHIFT) | (uint64_t)digits[1]) << PyLong_SHIFT) | (uint64_t)digits[0])));
28007 }
28008 }
28009 break;
28010 }
28011 }
28012 #endif
28013 if ((sizeof(uint64_t) <= sizeof(long))) {
28014 __PYX_VERIFY_RETURN_INT_EXC(uint64_t, long, PyLong_AsLong(x))
28015 #ifdef HAVE_LONG_LONG
28016 } else if ((sizeof(uint64_t) <= sizeof(PY_LONG_LONG))) {
28017 __PYX_VERIFY_RETURN_INT_EXC(uint64_t, PY_LONG_LONG, PyLong_AsLongLong(x))
28018 #endif
28019 }
28020 }
28021 {
28022 uint64_t val;
28023 int ret = -1;
28024 #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
28025 Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
28026 x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
28027 if (unlikely(bytes_copied == -1)) {
28028 } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
28029 goto raise_overflow;
28030 } else {
28031 ret = 0;
28032 }
28033 #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
28034 int one = 1; int is_little = (int)*(unsigned char *)&one;
28035 unsigned char *bytes = (unsigned char *)&val;
28036 ret = _PyLong_AsByteArray((PyLongObject *)x,
28037 bytes, sizeof(val),
28038 is_little, !is_unsigned);
28039 #else
28040 PyObject *v;
28041 PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
28042 int bits, remaining_bits, is_negative = 0;
28043 int chunk_size = (sizeof(long) < 8) ? 30 : 62;
28044 if (likely(PyLong_CheckExact(x))) {
28045 v = __Pyx_NewRef(x);
28046 } else {
28047 v = PyNumber_Long(x);
28048 if (unlikely(!v)) return (uint64_t) -1;
28049 assert(PyLong_CheckExact(v));
28050 }
28051 {
28052 int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
28053 if (unlikely(result < 0)) {
28054 Py_DECREF(v);
28055 return (uint64_t) -1;
28056 }
28057 is_negative = result == 1;
28058 }
28059 if (is_unsigned && unlikely(is_negative)) {
28060 Py_DECREF(v);
28061 goto raise_neg_overflow;
28062 } else if (is_negative) {
28063 stepval = PyNumber_Invert(v);
28064 Py_DECREF(v);
28065 if (unlikely(!stepval))
28066 return (uint64_t) -1;
28067 } else {
28068 stepval = v;
28069 }
28070 v = NULL;
28071 val = (uint64_t) 0;
28072 mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
28073 shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
28074 for (bits = 0; bits < (int) sizeof(uint64_t) * 8 - chunk_size; bits += chunk_size) {
28075 PyObject *tmp, *digit;
28076 long idigit;
28077 digit = PyNumber_And(stepval, mask);
28078 if (unlikely(!digit)) goto done;
28079 idigit = PyLong_AsLong(digit);
28080 Py_DECREF(digit);
28081 if (unlikely(idigit < 0)) goto done;
28082 val |= ((uint64_t) idigit) << bits;
28083 tmp = PyNumber_Rshift(stepval, shift);
28084 if (unlikely(!tmp)) goto done;
28085 Py_DECREF(stepval); stepval = tmp;
28086 }
28087 Py_DECREF(shift); shift = NULL;
28088 Py_DECREF(mask); mask = NULL;
28089 {
28090 long idigit = PyLong_AsLong(stepval);
28091 if (unlikely(idigit < 0)) goto done;
28092 remaining_bits = ((int) sizeof(uint64_t) * 8) - bits - (is_unsigned ? 0 : 1);
28093 if (unlikely(idigit >= (1L << remaining_bits)))
28094 goto raise_overflow;
28095 val |= ((uint64_t) idigit) << bits;
28096 }
28097 if (!is_unsigned) {
28098 if (unlikely(val & (((uint64_t) 1) << (sizeof(uint64_t) * 8 - 1))))
28099 goto raise_overflow;
28100 if (is_negative)
28101 val = ~val;
28102 }
28103 ret = 0;
28104 done:
28105 Py_XDECREF(shift);
28106 Py_XDECREF(mask);
28107 Py_XDECREF(stepval);
28108 #endif
28109 if (unlikely(ret))
28110 return (uint64_t) -1;
28111 return val;
28112 }
28113 raise_overflow:
28114 PyErr_SetString(PyExc_OverflowError,
28115 "value too large to convert to uint64_t");
28116 return (uint64_t) -1;
28117 raise_neg_overflow:
28118 PyErr_SetString(PyExc_OverflowError,
28119 "can't convert negative value to uint64_t");
28120 return (uint64_t) -1;
28121 }
28122
28123 /* CIntToPy */
28124 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_off_t(off_t value) {
28125 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
28126 #pragma GCC diagnostic push
28127 #pragma GCC diagnostic ignored "-Wconversion"
28128 #endif
28129 const off_t neg_one = (off_t) -1, const_zero = (off_t) 0;
28130 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
28131 #pragma GCC diagnostic pop
28132 #endif
28133 const int is_unsigned = neg_one > const_zero;
28134 if (is_unsigned) {
28135 if (sizeof(off_t) < sizeof(long)) {
28136 return PyInt_FromLong((long) value);
28137 } else if (sizeof(off_t) <= sizeof(unsigned long)) {
28138 return PyLong_FromUnsignedLong((unsigned long) value);
28139 #ifdef HAVE_LONG_LONG
28140 } else if (sizeof(off_t) <= sizeof(unsigned PY_LONG_LONG)) {
28141 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
28142 #endif
28143 }
28144 } else {
28145 if (sizeof(off_t) <= sizeof(long)) {
28146 return PyInt_FromLong((long) value);
28147 #ifdef HAVE_LONG_LONG
28148 } else if (sizeof(off_t) <= sizeof(PY_LONG_LONG)) {
28149 return PyLong_FromLongLong((PY_LONG_LONG) value);
28150 #endif
28151 }
28152 }
28153 {
28154 unsigned char *bytes = (unsigned char *)&value;
28155 #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
28156 if (is_unsigned) {
28157 return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
28158 } else {
28159 return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
28160 }
28161 #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
28162 int one = 1; int little = (int)*(unsigned char *)&one;
28163 return _PyLong_FromByteArray(bytes, sizeof(off_t),
28164 little, !is_unsigned);
28165 #else
28166 int one = 1; int little = (int)*(unsigned char *)&one;
28167 PyObject *from_bytes, *result = NULL;
28168 PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL;
28169 from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
28170 if (!from_bytes) return NULL;
28171 py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(off_t));
28172 if (!py_bytes) goto limited_bad;
28173 order_str = PyUnicode_FromString(little ? "little" : "big");
28174 if (!order_str) goto limited_bad;
28175 arg_tuple = PyTuple_Pack(2, py_bytes, order_str);
28176 if (!arg_tuple) goto limited_bad;
28177 if (!is_unsigned) {
28178 kwds = PyDict_New();
28179 if (!kwds) goto limited_bad;
28180 if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(Py_True))) goto limited_bad;
28181 }
28182 result = PyObject_Call(from_bytes, arg_tuple, kwds);
28183 limited_bad:
28184 Py_XDECREF(kwds);
28185 Py_XDECREF(arg_tuple);
28186 Py_XDECREF(order_str);
28187 Py_XDECREF(py_bytes);
28188 Py_XDECREF(from_bytes);
28189 return result;
28190 #endif
28191 }
28192 }
28193
28194 /* CIntToPy */
28195 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__htsFormatCategory(enum htsFormatCategory value) {
28196 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
28197 #pragma GCC diagnostic push
28198 #pragma GCC diagnostic ignored "-Wconversion"
28199 #endif
28200 const enum htsFormatCategory neg_one = (enum htsFormatCategory) -1, const_zero = (enum htsFormatCategory) 0;
28201 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
28202 #pragma GCC diagnostic pop
28203 #endif
28204 const int is_unsigned = neg_one > const_zero;
28205 if (is_unsigned) {
28206 if (sizeof(enum htsFormatCategory) < sizeof(long)) {
28207 return PyInt_FromLong((long) value);
28208 } else if (sizeof(enum htsFormatCategory) <= sizeof(unsigned long)) {
28209 return PyLong_FromUnsignedLong((unsigned long) value);
28210 #ifdef HAVE_LONG_LONG
28211 } else if (sizeof(enum htsFormatCategory) <= sizeof(unsigned PY_LONG_LONG)) {
28212 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
28213 #endif
28214 }
28215 } else {
28216 if (sizeof(enum htsFormatCategory) <= sizeof(long)) {
28217 return PyInt_FromLong((long) value);
28218 #ifdef HAVE_LONG_LONG
28219 } else if (sizeof(enum htsFormatCategory) <= sizeof(PY_LONG_LONG)) {
28220 return PyLong_FromLongLong((PY_LONG_LONG) value);
28221 #endif
28222 }
28223 }
28224 {
28225 unsigned char *bytes = (unsigned char *)&value;
28226 #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
28227 if (is_unsigned) {
28228 return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
28229 } else {
28230 return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
28231 }
28232 #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
28233 int one = 1; int little = (int)*(unsigned char *)&one;
28234 return _PyLong_FromByteArray(bytes, sizeof(enum htsFormatCategory),
28235 little, !is_unsigned);
28236 #else
28237 int one = 1; int little = (int)*(unsigned char *)&one;
28238 PyObject *from_bytes, *result = NULL;
28239 PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL;
28240 from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
28241 if (!from_bytes) return NULL;
28242 py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(enum htsFormatCategory));
28243 if (!py_bytes) goto limited_bad;
28244 order_str = PyUnicode_FromString(little ? "little" : "big");
28245 if (!order_str) goto limited_bad;
28246 arg_tuple = PyTuple_Pack(2, py_bytes, order_str);
28247 if (!arg_tuple) goto limited_bad;
28248 if (!is_unsigned) {
28249 kwds = PyDict_New();
28250 if (!kwds) goto limited_bad;
28251 if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(Py_True))) goto limited_bad;
28252 }
28253 result = PyObject_Call(from_bytes, arg_tuple, kwds);
28254 limited_bad:
28255 Py_XDECREF(kwds);
28256 Py_XDECREF(arg_tuple);
28257 Py_XDECREF(order_str);
28258 Py_XDECREF(py_bytes);
28259 Py_XDECREF(from_bytes);
28260 return result;
28261 #endif
28262 }
28263 }
28264
28265 /* CIntToPy */
28266 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__htsExactFormat(enum htsExactFormat value) {
28267 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
28268 #pragma GCC diagnostic push
28269 #pragma GCC diagnostic ignored "-Wconversion"
28270 #endif
28271 const enum htsExactFormat neg_one = (enum htsExactFormat) -1, const_zero = (enum htsExactFormat) 0;
28272 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
28273 #pragma GCC diagnostic pop
28274 #endif
28275 const int is_unsigned = neg_one > const_zero;
28276 if (is_unsigned) {
28277 if (sizeof(enum htsExactFormat) < sizeof(long)) {
28278 return PyInt_FromLong((long) value);
28279 } else if (sizeof(enum htsExactFormat) <= sizeof(unsigned long)) {
28280 return PyLong_FromUnsignedLong((unsigned long) value);
28281 #ifdef HAVE_LONG_LONG
28282 } else if (sizeof(enum htsExactFormat) <= sizeof(unsigned PY_LONG_LONG)) {
28283 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
28284 #endif
28285 }
28286 } else {
28287 if (sizeof(enum htsExactFormat) <= sizeof(long)) {
28288 return PyInt_FromLong((long) value);
28289 #ifdef HAVE_LONG_LONG
28290 } else if (sizeof(enum htsExactFormat) <= sizeof(PY_LONG_LONG)) {
28291 return PyLong_FromLongLong((PY_LONG_LONG) value);
28292 #endif
28293 }
28294 }
28295 {
28296 unsigned char *bytes = (unsigned char *)&value;
28297 #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
28298 if (is_unsigned) {
28299 return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
28300 } else {
28301 return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
28302 }
28303 #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
28304 int one = 1; int little = (int)*(unsigned char *)&one;
28305 return _PyLong_FromByteArray(bytes, sizeof(enum htsExactFormat),
28306 little, !is_unsigned);
28307 #else
28308 int one = 1; int little = (int)*(unsigned char *)&one;
28309 PyObject *from_bytes, *result = NULL;
28310 PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL;
28311 from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
28312 if (!from_bytes) return NULL;
28313 py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(enum htsExactFormat));
28314 if (!py_bytes) goto limited_bad;
28315 order_str = PyUnicode_FromString(little ? "little" : "big");
28316 if (!order_str) goto limited_bad;
28317 arg_tuple = PyTuple_Pack(2, py_bytes, order_str);
28318 if (!arg_tuple) goto limited_bad;
28319 if (!is_unsigned) {
28320 kwds = PyDict_New();
28321 if (!kwds) goto limited_bad;
28322 if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(Py_True))) goto limited_bad;
28323 }
28324 result = PyObject_Call(from_bytes, arg_tuple, kwds);
28325 limited_bad:
28326 Py_XDECREF(kwds);
28327 Py_XDECREF(arg_tuple);
28328 Py_XDECREF(order_str);
28329 Py_XDECREF(py_bytes);
28330 Py_XDECREF(from_bytes);
28331 return result;
28332 #endif
28333 }
28334 }
28335
28336 /* CIntToPy */
28337 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_short(short value) {
28338 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
28339 #pragma GCC diagnostic push
28340 #pragma GCC diagnostic ignored "-Wconversion"
28341 #endif
28342 const short neg_one = (short) -1, const_zero = (short) 0;
28343 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
28344 #pragma GCC diagnostic pop
28345 #endif
28346 const int is_unsigned = neg_one > const_zero;
28347 if (is_unsigned) {
28348 if (sizeof(short) < sizeof(long)) {
28349 return PyInt_FromLong((long) value);
28350 } else if (sizeof(short) <= sizeof(unsigned long)) {
28351 return PyLong_FromUnsignedLong((unsigned long) value);
28352 #ifdef HAVE_LONG_LONG
28353 } else if (sizeof(short) <= sizeof(unsigned PY_LONG_LONG)) {
28354 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
28355 #endif
28356 }
28357 } else {
28358 if (sizeof(short) <= sizeof(long)) {
28359 return PyInt_FromLong((long) value);
28360 #ifdef HAVE_LONG_LONG
28361 } else if (sizeof(short) <= sizeof(PY_LONG_LONG)) {
28362 return PyLong_FromLongLong((PY_LONG_LONG) value);
28363 #endif
28364 }
28365 }
28366 {
28367 unsigned char *bytes = (unsigned char *)&value;
28368 #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
28369 if (is_unsigned) {
28370 return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
28371 } else {
28372 return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
28373 }
28374 #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
28375 int one = 1; int little = (int)*(unsigned char *)&one;
28376 return _PyLong_FromByteArray(bytes, sizeof(short),
28377 little, !is_unsigned);
28378 #else
28379 int one = 1; int little = (int)*(unsigned char *)&one;
28380 PyObject *from_bytes, *result = NULL;
28381 PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL;
28382 from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
28383 if (!from_bytes) return NULL;
28384 py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(short));
28385 if (!py_bytes) goto limited_bad;
28386 order_str = PyUnicode_FromString(little ? "little" : "big");
28387 if (!order_str) goto limited_bad;
28388 arg_tuple = PyTuple_Pack(2, py_bytes, order_str);
28389 if (!arg_tuple) goto limited_bad;
28390 if (!is_unsigned) {
28391 kwds = PyDict_New();
28392 if (!kwds) goto limited_bad;
28393 if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(Py_True))) goto limited_bad;
28394 }
28395 result = PyObject_Call(from_bytes, arg_tuple, kwds);
28396 limited_bad:
28397 Py_XDECREF(kwds);
28398 Py_XDECREF(arg_tuple);
28399 Py_XDECREF(order_str);
28400 Py_XDECREF(py_bytes);
28401 Py_XDECREF(from_bytes);
28402 return result;
28403 #endif
28404 }
28405 }
28406
28407 /* CIntToPy */
28408 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__htsCompression(enum htsCompression value) {
28409 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
28410 #pragma GCC diagnostic push
28411 #pragma GCC diagnostic ignored "-Wconversion"
28412 #endif
28413 const enum htsCompression neg_one = (enum htsCompression) -1, const_zero = (enum htsCompression) 0;
28414 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
28415 #pragma GCC diagnostic pop
28416 #endif
28417 const int is_unsigned = neg_one > const_zero;
28418 if (is_unsigned) {
28419 if (sizeof(enum htsCompression) < sizeof(long)) {
28420 return PyInt_FromLong((long) value);
28421 } else if (sizeof(enum htsCompression) <= sizeof(unsigned long)) {
28422 return PyLong_FromUnsignedLong((unsigned long) value);
28423 #ifdef HAVE_LONG_LONG
28424 } else if (sizeof(enum htsCompression) <= sizeof(unsigned PY_LONG_LONG)) {
28425 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
28426 #endif
28427 }
28428 } else {
28429 if (sizeof(enum htsCompression) <= sizeof(long)) {
28430 return PyInt_FromLong((long) value);
28431 #ifdef HAVE_LONG_LONG
28432 } else if (sizeof(enum htsCompression) <= sizeof(PY_LONG_LONG)) {
28433 return PyLong_FromLongLong((PY_LONG_LONG) value);
28434 #endif
28435 }
28436 }
28437 {
28438 unsigned char *bytes = (unsigned char *)&value;
28439 #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
28440 if (is_unsigned) {
28441 return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
28442 } else {
28443 return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
28444 }
28445 #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
28446 int one = 1; int little = (int)*(unsigned char *)&one;
28447 return _PyLong_FromByteArray(bytes, sizeof(enum htsCompression),
28448 little, !is_unsigned);
28449 #else
28450 int one = 1; int little = (int)*(unsigned char *)&one;
28451 PyObject *from_bytes, *result = NULL;
28452 PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL;
28453 from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
28454 if (!from_bytes) return NULL;
28455 py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(enum htsCompression));
28456 if (!py_bytes) goto limited_bad;
28457 order_str = PyUnicode_FromString(little ? "little" : "big");
28458 if (!order_str) goto limited_bad;
28459 arg_tuple = PyTuple_Pack(2, py_bytes, order_str);
28460 if (!arg_tuple) goto limited_bad;
28461 if (!is_unsigned) {
28462 kwds = PyDict_New();
28463 if (!kwds) goto limited_bad;
28464 if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(Py_True))) goto limited_bad;
28465 }
28466 result = PyObject_Call(from_bytes, arg_tuple, kwds);
28467 limited_bad:
28468 Py_XDECREF(kwds);
28469 Py_XDECREF(arg_tuple);
28470 Py_XDECREF(order_str);
28471 Py_XDECREF(py_bytes);
28472 Py_XDECREF(from_bytes);
28473 return result;
28474 #endif
28475 }
28476 }
28477
28478 /* CIntToPy */
28479 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int64_t(int64_t value) {
28480 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
28481 #pragma GCC diagnostic push
28482 #pragma GCC diagnostic ignored "-Wconversion"
28483 #endif
28484 const int64_t neg_one = (int64_t) -1, const_zero = (int64_t) 0;
28485 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
28486 #pragma GCC diagnostic pop
28487 #endif
28488 const int is_unsigned = neg_one > const_zero;
28489 if (is_unsigned) {
28490 if (sizeof(int64_t) < sizeof(long)) {
28491 return PyInt_FromLong((long) value);
28492 } else if (sizeof(int64_t) <= sizeof(unsigned long)) {
28493 return PyLong_FromUnsignedLong((unsigned long) value);
28494 #ifdef HAVE_LONG_LONG
28495 } else if (sizeof(int64_t) <= sizeof(unsigned PY_LONG_LONG)) {
28496 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
28497 #endif
28498 }
28499 } else {
28500 if (sizeof(int64_t) <= sizeof(long)) {
28501 return PyInt_FromLong((long) value);
28502 #ifdef HAVE_LONG_LONG
28503 } else if (sizeof(int64_t) <= sizeof(PY_LONG_LONG)) {
28504 return PyLong_FromLongLong((PY_LONG_LONG) value);
28505 #endif
28506 }
28507 }
28508 {
28509 unsigned char *bytes = (unsigned char *)&value;
28510 #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
28511 if (is_unsigned) {
28512 return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
28513 } else {
28514 return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
28515 }
28516 #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
28517 int one = 1; int little = (int)*(unsigned char *)&one;
28518 return _PyLong_FromByteArray(bytes, sizeof(int64_t),
28519 little, !is_unsigned);
28520 #else
28521 int one = 1; int little = (int)*(unsigned char *)&one;
28522 PyObject *from_bytes, *result = NULL;
28523 PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL;
28524 from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
28525 if (!from_bytes) return NULL;
28526 py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(int64_t));
28527 if (!py_bytes) goto limited_bad;
28528 order_str = PyUnicode_FromString(little ? "little" : "big");
28529 if (!order_str) goto limited_bad;
28530 arg_tuple = PyTuple_Pack(2, py_bytes, order_str);
28531 if (!arg_tuple) goto limited_bad;
28532 if (!is_unsigned) {
28533 kwds = PyDict_New();
28534 if (!kwds) goto limited_bad;
28535 if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(Py_True))) goto limited_bad;
28536 }
28537 result = PyObject_Call(from_bytes, arg_tuple, kwds);
28538 limited_bad:
28539 Py_XDECREF(kwds);
28540 Py_XDECREF(arg_tuple);
28541 Py_XDECREF(order_str);
28542 Py_XDECREF(py_bytes);
28543 Py_XDECREF(from_bytes);
28544 return result;
28545 #endif
28546 }
28547 }
28548
28549 /* CIntFromPy */
28550 static CYTHON_INLINE int32_t __Pyx_PyInt_As_int32_t(PyObject *x) {
28551 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
28552 #pragma GCC diagnostic push
28553 #pragma GCC diagnostic ignored "-Wconversion"
28554 #endif
28555 const int32_t neg_one = (int32_t) -1, const_zero = (int32_t) 0;
28556 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
28557 #pragma GCC diagnostic pop
28558 #endif
28559 const int is_unsigned = neg_one > const_zero;
28560 #if PY_MAJOR_VERSION < 3
28561 if (likely(PyInt_Check(x))) {
28562 if ((sizeof(int32_t) < sizeof(long))) {
28563 __PYX_VERIFY_RETURN_INT(int32_t, long, PyInt_AS_LONG(x))
28564 } else {
28565 long val = PyInt_AS_LONG(x);
28566 if (is_unsigned && unlikely(val < 0)) {
28567 goto raise_neg_overflow;
28568 }
28569 return (int32_t) val;
28570 }
28571 }
28572 #endif
28573 if (unlikely(!PyLong_Check(x))) {
28574 int32_t val;
28575 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
28576 if (!tmp) return (int32_t) -1;
28577 val = __Pyx_PyInt_As_int32_t(tmp);
28578 Py_DECREF(tmp);
28579 return val;
28580 }
28581 if (is_unsigned) {
28582 #if CYTHON_USE_PYLONG_INTERNALS
28583 if (unlikely(__Pyx_PyLong_IsNeg(x))) {
28584 goto raise_neg_overflow;
28585 } else if (__Pyx_PyLong_IsCompact(x)) {
28586 __PYX_VERIFY_RETURN_INT(int32_t, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
28587 } else {
28588 const digit* digits = __Pyx_PyLong_Digits(x);
28589 assert(__Pyx_PyLong_DigitCount(x) > 1);
28590 switch (__Pyx_PyLong_DigitCount(x)) {
28591 case 2:
28592 if ((8 * sizeof(int32_t) > 1 * PyLong_SHIFT)) {
28593 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
28594 __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28595 } else if ((8 * sizeof(int32_t) >= 2 * PyLong_SHIFT)) {
28596 return (int32_t) (((((int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]));
28597 }
28598 }
28599 break;
28600 case 3:
28601 if ((8 * sizeof(int32_t) > 2 * PyLong_SHIFT)) {
28602 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
28603 __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28604 } else if ((8 * sizeof(int32_t) >= 3 * PyLong_SHIFT)) {
28605 return (int32_t) (((((((int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]));
28606 }
28607 }
28608 break;
28609 case 4:
28610 if ((8 * sizeof(int32_t) > 3 * PyLong_SHIFT)) {
28611 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
28612 __PYX_VERIFY_RETURN_INT(int32_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])))
28613 } else if ((8 * sizeof(int32_t) >= 4 * PyLong_SHIFT)) {
28614 return (int32_t) (((((((((int32_t)digits[3]) << PyLong_SHIFT) | (int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]));
28615 }
28616 }
28617 break;
28618 }
28619 }
28620 #endif
28621 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
28622 if (unlikely(Py_SIZE(x) < 0)) {
28623 goto raise_neg_overflow;
28624 }
28625 #else
28626 {
28627 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
28628 if (unlikely(result < 0))
28629 return (int32_t) -1;
28630 if (unlikely(result == 1))
28631 goto raise_neg_overflow;
28632 }
28633 #endif
28634 if ((sizeof(int32_t) <= sizeof(unsigned long))) {
28635 __PYX_VERIFY_RETURN_INT_EXC(int32_t, unsigned long, PyLong_AsUnsignedLong(x))
28636 #ifdef HAVE_LONG_LONG
28637 } else if ((sizeof(int32_t) <= sizeof(unsigned PY_LONG_LONG))) {
28638 __PYX_VERIFY_RETURN_INT_EXC(int32_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
28639 #endif
28640 }
28641 } else {
28642 #if CYTHON_USE_PYLONG_INTERNALS
28643 if (__Pyx_PyLong_IsCompact(x)) {
28644 __PYX_VERIFY_RETURN_INT(int32_t, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
28645 } else {
28646 const digit* digits = __Pyx_PyLong_Digits(x);
28647 assert(__Pyx_PyLong_DigitCount(x) > 1);
28648 switch (__Pyx_PyLong_SignedDigitCount(x)) {
28649 case -2:
28650 if ((8 * sizeof(int32_t) - 1 > 1 * PyLong_SHIFT)) {
28651 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
28652 __PYX_VERIFY_RETURN_INT(int32_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28653 } else if ((8 * sizeof(int32_t) - 1 > 2 * PyLong_SHIFT)) {
28654 return (int32_t) (((int32_t)-1)*(((((int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])));
28655 }
28656 }
28657 break;
28658 case 2:
28659 if ((8 * sizeof(int32_t) > 1 * PyLong_SHIFT)) {
28660 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
28661 __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28662 } else if ((8 * sizeof(int32_t) - 1 > 2 * PyLong_SHIFT)) {
28663 return (int32_t) ((((((int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])));
28664 }
28665 }
28666 break;
28667 case -3:
28668 if ((8 * sizeof(int32_t) - 1 > 2 * PyLong_SHIFT)) {
28669 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
28670 __PYX_VERIFY_RETURN_INT(int32_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28671 } else if ((8 * sizeof(int32_t) - 1 > 3 * PyLong_SHIFT)) {
28672 return (int32_t) (((int32_t)-1)*(((((((int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])));
28673 }
28674 }
28675 break;
28676 case 3:
28677 if ((8 * sizeof(int32_t) > 2 * PyLong_SHIFT)) {
28678 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
28679 __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
28680 } else if ((8 * sizeof(int32_t) - 1 > 3 * PyLong_SHIFT)) {
28681 return (int32_t) ((((((((int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])));
28682 }
28683 }
28684 break;
28685 case -4:
28686 if ((8 * sizeof(int32_t) - 1 > 3 * PyLong_SHIFT)) {
28687 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
28688 __PYX_VERIFY_RETURN_INT(int32_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])))
28689 } else if ((8 * sizeof(int32_t) - 1 > 4 * PyLong_SHIFT)) {
28690 return (int32_t) (((int32_t)-1)*(((((((((int32_t)digits[3]) << PyLong_SHIFT) | (int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])));
28691 }
28692 }
28693 break;
28694 case 4:
28695 if ((8 * sizeof(int32_t) > 3 * PyLong_SHIFT)) {
28696 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
28697 __PYX_VERIFY_RETURN_INT(int32_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])))
28698 } else if ((8 * sizeof(int32_t) - 1 > 4 * PyLong_SHIFT)) {
28699 return (int32_t) ((((((((((int32_t)digits[3]) << PyLong_SHIFT) | (int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])));
28700 }
28701 }
28702 break;
28703 }
28704 }
28705 #endif
28706 if ((sizeof(int32_t) <= sizeof(long))) {
28707 __PYX_VERIFY_RETURN_INT_EXC(int32_t, long, PyLong_AsLong(x))
28708 #ifdef HAVE_LONG_LONG
28709 } else if ((sizeof(int32_t) <= sizeof(PY_LONG_LONG))) {
28710 __PYX_VERIFY_RETURN_INT_EXC(int32_t, PY_LONG_LONG, PyLong_AsLongLong(x))
28711 #endif
28712 }
28713 }
28714 {
28715 int32_t val;
28716 int ret = -1;
28717 #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
28718 Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
28719 x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
28720 if (unlikely(bytes_copied == -1)) {
28721 } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
28722 goto raise_overflow;
28723 } else {
28724 ret = 0;
28725 }
28726 #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
28727 int one = 1; int is_little = (int)*(unsigned char *)&one;
28728 unsigned char *bytes = (unsigned char *)&val;
28729 ret = _PyLong_AsByteArray((PyLongObject *)x,
28730 bytes, sizeof(val),
28731 is_little, !is_unsigned);
28732 #else
28733 PyObject *v;
28734 PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
28735 int bits, remaining_bits, is_negative = 0;
28736 int chunk_size = (sizeof(long) < 8) ? 30 : 62;
28737 if (likely(PyLong_CheckExact(x))) {
28738 v = __Pyx_NewRef(x);
28739 } else {
28740 v = PyNumber_Long(x);
28741 if (unlikely(!v)) return (int32_t) -1;
28742 assert(PyLong_CheckExact(v));
28743 }
28744 {
28745 int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
28746 if (unlikely(result < 0)) {
28747 Py_DECREF(v);
28748 return (int32_t) -1;
28749 }
28750 is_negative = result == 1;
28751 }
28752 if (is_unsigned && unlikely(is_negative)) {
28753 Py_DECREF(v);
28754 goto raise_neg_overflow;
28755 } else if (is_negative) {
28756 stepval = PyNumber_Invert(v);
28757 Py_DECREF(v);
28758 if (unlikely(!stepval))
28759 return (int32_t) -1;
28760 } else {
28761 stepval = v;
28762 }
28763 v = NULL;
28764 val = (int32_t) 0;
28765 mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
28766 shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
28767 for (bits = 0; bits < (int) sizeof(int32_t) * 8 - chunk_size; bits += chunk_size) {
28768 PyObject *tmp, *digit;
28769 long idigit;
28770 digit = PyNumber_And(stepval, mask);
28771 if (unlikely(!digit)) goto done;
28772 idigit = PyLong_AsLong(digit);
28773 Py_DECREF(digit);
28774 if (unlikely(idigit < 0)) goto done;
28775 val |= ((int32_t) idigit) << bits;
28776 tmp = PyNumber_Rshift(stepval, shift);
28777 if (unlikely(!tmp)) goto done;
28778 Py_DECREF(stepval); stepval = tmp;
28779 }
28780 Py_DECREF(shift); shift = NULL;
28781 Py_DECREF(mask); mask = NULL;
28782 {
28783 long idigit = PyLong_AsLong(stepval);
28784 if (unlikely(idigit < 0)) goto done;
28785 remaining_bits = ((int) sizeof(int32_t) * 8) - bits - (is_unsigned ? 0 : 1);
28786 if (unlikely(idigit >= (1L << remaining_bits)))
28787 goto raise_overflow;
28788 val |= ((int32_t) idigit) << bits;
28789 }
28790 if (!is_unsigned) {
28791 if (unlikely(val & (((int32_t) 1) << (sizeof(int32_t) * 8 - 1))))
28792 goto raise_overflow;
28793 if (is_negative)
28794 val = ~val;
28795 }
28796 ret = 0;
28797 done:
28798 Py_XDECREF(shift);
28799 Py_XDECREF(mask);
28800 Py_XDECREF(stepval);
28801 #endif
28802 if (unlikely(ret))
28803 return (int32_t) -1;
28804 return val;
28805 }
28806 raise_overflow:
28807 PyErr_SetString(PyExc_OverflowError,
28808 "value too large to convert to int32_t");
28809 return (int32_t) -1;
28810 raise_neg_overflow:
28811 PyErr_SetString(PyExc_OverflowError,
28812 "can't convert negative value to int32_t");
28813 return (int32_t) -1;
28814 }
28815
28816 /* CIntToPy */
28817 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
28818 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
28819 #pragma GCC diagnostic push
28820 #pragma GCC diagnostic ignored "-Wconversion"
28821 #endif
28822 const long neg_one = (long) -1, const_zero = (long) 0;
28823 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
28824 #pragma GCC diagnostic pop
28825 #endif
28826 const int is_unsigned = neg_one > const_zero;
28827 if (is_unsigned) {
28828 if (sizeof(long) < sizeof(long)) {
28829 return PyInt_FromLong((long) value);
28830 } else if (sizeof(long) <= sizeof(unsigned long)) {
28831 return PyLong_FromUnsignedLong((unsigned long) value);
28832 #ifdef HAVE_LONG_LONG
28833 } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
28834 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
28835 #endif
28836 }
28837 } else {
28838 if (sizeof(long) <= sizeof(long)) {
28839 return PyInt_FromLong((long) value);
28840 #ifdef HAVE_LONG_LONG
28841 } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
28842 return PyLong_FromLongLong((PY_LONG_LONG) value);
28843 #endif
28844 }
28845 }
28846 {
28847 unsigned char *bytes = (unsigned char *)&value;
28848 #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
28849 if (is_unsigned) {
28850 return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
28851 } else {
28852 return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
28853 }
28854 #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
28855 int one = 1; int little = (int)*(unsigned char *)&one;
28856 return _PyLong_FromByteArray(bytes, sizeof(long),
28857 little, !is_unsigned);
28858 #else
28859 int one = 1; int little = (int)*(unsigned char *)&one;
28860 PyObject *from_bytes, *result = NULL;
28861 PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL;
28862 from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
28863 if (!from_bytes) return NULL;
28864 py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(long));
28865 if (!py_bytes) goto limited_bad;
28866 order_str = PyUnicode_FromString(little ? "little" : "big");
28867 if (!order_str) goto limited_bad;
28868 arg_tuple = PyTuple_Pack(2, py_bytes, order_str);
28869 if (!arg_tuple) goto limited_bad;
28870 if (!is_unsigned) {
28871 kwds = PyDict_New();
28872 if (!kwds) goto limited_bad;
28873 if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(Py_True))) goto limited_bad;
28874 }
28875 result = PyObject_Call(from_bytes, arg_tuple, kwds);
28876 limited_bad:
28877 Py_XDECREF(kwds);
28878 Py_XDECREF(arg_tuple);
28879 Py_XDECREF(order_str);
28880 Py_XDECREF(py_bytes);
28881 Py_XDECREF(from_bytes);
28882 return result;
28883 #endif
28884 }
28885 }
28886
28887 /* CIntToPy */
28888 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int32_t(int32_t value) {
28889 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
28890 #pragma GCC diagnostic push
28891 #pragma GCC diagnostic ignored "-Wconversion"
28892 #endif
28893 const int32_t neg_one = (int32_t) -1, const_zero = (int32_t) 0;
28894 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
28895 #pragma GCC diagnostic pop
28896 #endif
28897 const int is_unsigned = neg_one > const_zero;
28898 if (is_unsigned) {
28899 if (sizeof(int32_t) < sizeof(long)) {
28900 return PyInt_FromLong((long) value);
28901 } else if (sizeof(int32_t) <= sizeof(unsigned long)) {
28902 return PyLong_FromUnsignedLong((unsigned long) value);
28903 #ifdef HAVE_LONG_LONG
28904 } else if (sizeof(int32_t) <= sizeof(unsigned PY_LONG_LONG)) {
28905 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
28906 #endif
28907 }
28908 } else {
28909 if (sizeof(int32_t) <= sizeof(long)) {
28910 return PyInt_FromLong((long) value);
28911 #ifdef HAVE_LONG_LONG
28912 } else if (sizeof(int32_t) <= sizeof(PY_LONG_LONG)) {
28913 return PyLong_FromLongLong((PY_LONG_LONG) value);
28914 #endif
28915 }
28916 }
28917 {
28918 unsigned char *bytes = (unsigned char *)&value;
28919 #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
28920 if (is_unsigned) {
28921 return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
28922 } else {
28923 return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
28924 }
28925 #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
28926 int one = 1; int little = (int)*(unsigned char *)&one;
28927 return _PyLong_FromByteArray(bytes, sizeof(int32_t),
28928 little, !is_unsigned);
28929 #else
28930 int one = 1; int little = (int)*(unsigned char *)&one;
28931 PyObject *from_bytes, *result = NULL;
28932 PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL;
28933 from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
28934 if (!from_bytes) return NULL;
28935 py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(int32_t));
28936 if (!py_bytes) goto limited_bad;
28937 order_str = PyUnicode_FromString(little ? "little" : "big");
28938 if (!order_str) goto limited_bad;
28939 arg_tuple = PyTuple_Pack(2, py_bytes, order_str);
28940 if (!arg_tuple) goto limited_bad;
28941 if (!is_unsigned) {
28942 kwds = PyDict_New();
28943 if (!kwds) goto limited_bad;
28944 if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(Py_True))) goto limited_bad;
28945 }
28946 result = PyObject_Call(from_bytes, arg_tuple, kwds);
28947 limited_bad:
28948 Py_XDECREF(kwds);
28949 Py_XDECREF(arg_tuple);
28950 Py_XDECREF(order_str);
28951 Py_XDECREF(py_bytes);
28952 Py_XDECREF(from_bytes);
28953 return result;
28954 #endif
28955 }
28956 }
28957
28958 /* FormatTypeName */
28959 #if CYTHON_COMPILING_IN_LIMITED_API
28960 static __Pyx_TypeName
28961 __Pyx_PyType_GetName(PyTypeObject* tp)
28962 {
28963 PyObject *name = __Pyx_PyObject_GetAttrStr((PyObject *)tp,
28964 __pyx_n_s_name_2);
28965 if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) {
28966 PyErr_Clear();
28967 Py_XDECREF(name);
28968 name = __Pyx_NewRef(__pyx_n_s__97);
28969 }
28970 return name;
28971 }
28972 #endif
28973
28974 /* CIntFromPy */
28975 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
28976 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
28977 #pragma GCC diagnostic push
28978 #pragma GCC diagnostic ignored "-Wconversion"
28979 #endif
28980 const long neg_one = (long) -1, const_zero = (long) 0;
28981 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
28982 #pragma GCC diagnostic pop
28983 #endif
28984 const int is_unsigned = neg_one > const_zero;
28985 #if PY_MAJOR_VERSION < 3
28986 if (likely(PyInt_Check(x))) {
28987 if ((sizeof(long) < sizeof(long))) {
28988 __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
28989 } else {
28990 long val = PyInt_AS_LONG(x);
28991 if (is_unsigned && unlikely(val < 0)) {
28992 goto raise_neg_overflow;
28993 }
28994 return (long) val;
28995 }
28996 }
28997 #endif
28998 if (unlikely(!PyLong_Check(x))) {
28999 long val;
29000 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
29001 if (!tmp) return (long) -1;
29002 val = __Pyx_PyInt_As_long(tmp);
29003 Py_DECREF(tmp);
29004 return val;
29005 }
29006 if (is_unsigned) {
29007 #if CYTHON_USE_PYLONG_INTERNALS
29008 if (unlikely(__Pyx_PyLong_IsNeg(x))) {
29009 goto raise_neg_overflow;
29010 } else if (__Pyx_PyLong_IsCompact(x)) {
29011 __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
29012 } else {
29013 const digit* digits = __Pyx_PyLong_Digits(x);
29014 assert(__Pyx_PyLong_DigitCount(x) > 1);
29015 switch (__Pyx_PyLong_DigitCount(x)) {
29016 case 2:
29017 if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) {
29018 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
29019 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
29020 } else if ((8 * sizeof(long) >= 2 * PyLong_SHIFT)) {
29021 return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
29022 }
29023 }
29024 break;
29025 case 3:
29026 if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) {
29027 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
29028 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
29029 } else if ((8 * sizeof(long) >= 3 * PyLong_SHIFT)) {
29030 return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
29031 }
29032 }
29033 break;
29034 case 4:
29035 if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) {
29036 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
29037 __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])))
29038 } else if ((8 * sizeof(long) >= 4 * PyLong_SHIFT)) {
29039 return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
29040 }
29041 }
29042 break;
29043 }
29044 }
29045 #endif
29046 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
29047 if (unlikely(Py_SIZE(x) < 0)) {
29048 goto raise_neg_overflow;
29049 }
29050 #else
29051 {
29052 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
29053 if (unlikely(result < 0))
29054 return (long) -1;
29055 if (unlikely(result == 1))
29056 goto raise_neg_overflow;
29057 }
29058 #endif
29059 if ((sizeof(long) <= sizeof(unsigned long))) {
29060 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
29061 #ifdef HAVE_LONG_LONG
29062 } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) {
29063 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
29064 #endif
29065 }
29066 } else {
29067 #if CYTHON_USE_PYLONG_INTERNALS
29068 if (__Pyx_PyLong_IsCompact(x)) {
29069 __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
29070 } else {
29071 const digit* digits = __Pyx_PyLong_Digits(x);
29072 assert(__Pyx_PyLong_DigitCount(x) > 1);
29073 switch (__Pyx_PyLong_SignedDigitCount(x)) {
29074 case -2:
29075 if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) {
29076 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
29077 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
29078 } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
29079 return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
29080 }
29081 }
29082 break;
29083 case 2:
29084 if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) {
29085 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
29086 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
29087 } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
29088 return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
29089 }
29090 }
29091 break;
29092 case -3:
29093 if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
29094 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
29095 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
29096 } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
29097 return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
29098 }
29099 }
29100 break;
29101 case 3:
29102 if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) {
29103 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
29104 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
29105 } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
29106 return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
29107 }
29108 }
29109 break;
29110 case -4:
29111 if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
29112 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
29113 __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])))
29114 } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) {
29115 return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
29116 }
29117 }
29118 break;
29119 case 4:
29120 if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) {
29121 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
29122 __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])))
29123 } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) {
29124 return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
29125 }
29126 }
29127 break;
29128 }
29129 }
29130 #endif
29131 if ((sizeof(long) <= sizeof(long))) {
29132 __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
29133 #ifdef HAVE_LONG_LONG
29134 } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) {
29135 __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
29136 #endif
29137 }
29138 }
29139 {
29140 long val;
29141 int ret = -1;
29142 #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
29143 Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
29144 x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
29145 if (unlikely(bytes_copied == -1)) {
29146 } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
29147 goto raise_overflow;
29148 } else {
29149 ret = 0;
29150 }
29151 #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
29152 int one = 1; int is_little = (int)*(unsigned char *)&one;
29153 unsigned char *bytes = (unsigned char *)&val;
29154 ret = _PyLong_AsByteArray((PyLongObject *)x,
29155 bytes, sizeof(val),
29156 is_little, !is_unsigned);
29157 #else
29158 PyObject *v;
29159 PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
29160 int bits, remaining_bits, is_negative = 0;
29161 int chunk_size = (sizeof(long) < 8) ? 30 : 62;
29162 if (likely(PyLong_CheckExact(x))) {
29163 v = __Pyx_NewRef(x);
29164 } else {
29165 v = PyNumber_Long(x);
29166 if (unlikely(!v)) return (long) -1;
29167 assert(PyLong_CheckExact(v));
29168 }
29169 {
29170 int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
29171 if (unlikely(result < 0)) {
29172 Py_DECREF(v);
29173 return (long) -1;
29174 }
29175 is_negative = result == 1;
29176 }
29177 if (is_unsigned && unlikely(is_negative)) {
29178 Py_DECREF(v);
29179 goto raise_neg_overflow;
29180 } else if (is_negative) {
29181 stepval = PyNumber_Invert(v);
29182 Py_DECREF(v);
29183 if (unlikely(!stepval))
29184 return (long) -1;
29185 } else {
29186 stepval = v;
29187 }
29188 v = NULL;
29189 val = (long) 0;
29190 mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
29191 shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
29192 for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) {
29193 PyObject *tmp, *digit;
29194 long idigit;
29195 digit = PyNumber_And(stepval, mask);
29196 if (unlikely(!digit)) goto done;
29197 idigit = PyLong_AsLong(digit);
29198 Py_DECREF(digit);
29199 if (unlikely(idigit < 0)) goto done;
29200 val |= ((long) idigit) << bits;
29201 tmp = PyNumber_Rshift(stepval, shift);
29202 if (unlikely(!tmp)) goto done;
29203 Py_DECREF(stepval); stepval = tmp;
29204 }
29205 Py_DECREF(shift); shift = NULL;
29206 Py_DECREF(mask); mask = NULL;
29207 {
29208 long idigit = PyLong_AsLong(stepval);
29209 if (unlikely(idigit < 0)) goto done;
29210 remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1);
29211 if (unlikely(idigit >= (1L << remaining_bits)))
29212 goto raise_overflow;
29213 val |= ((long) idigit) << bits;
29214 }
29215 if (!is_unsigned) {
29216 if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1))))
29217 goto raise_overflow;
29218 if (is_negative)
29219 val = ~val;
29220 }
29221 ret = 0;
29222 done:
29223 Py_XDECREF(shift);
29224 Py_XDECREF(mask);
29225 Py_XDECREF(stepval);
29226 #endif
29227 if (unlikely(ret))
29228 return (long) -1;
29229 return val;
29230 }
29231 raise_overflow:
29232 PyErr_SetString(PyExc_OverflowError,
29233 "value too large to convert to long");
29234 return (long) -1;
29235 raise_neg_overflow:
29236 PyErr_SetString(PyExc_OverflowError,
29237 "can't convert negative value to long");
29238 return (long) -1;
29239 }
29240
29241 /* FastTypeChecks */
29242 #if CYTHON_COMPILING_IN_CPYTHON
29243 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
29244 while (a) {
29245 a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*);
29246 if (a == b)
29247 return 1;
29248 }
29249 return b == &PyBaseObject_Type;
29250 }
29251 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
29252 PyObject *mro;
29253 if (a == b) return 1;
29254 mro = a->tp_mro;
29255 if (likely(mro)) {
29256 Py_ssize_t i, n;
29257 n = PyTuple_GET_SIZE(mro);
29258 for (i = 0; i < n; i++) {
29259 if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
29260 return 1;
29261 }
29262 return 0;
29263 }
29264 return __Pyx_InBases(a, b);
29265 }
29266 static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) {
29267 PyObject *mro;
29268 if (cls == a || cls == b) return 1;
29269 mro = cls->tp_mro;
29270 if (likely(mro)) {
29271 Py_ssize_t i, n;
29272 n = PyTuple_GET_SIZE(mro);
29273 for (i = 0; i < n; i++) {
29274 PyObject *base = PyTuple_GET_ITEM(mro, i);
29275 if (base == (PyObject *)a || base == (PyObject *)b)
29276 return 1;
29277 }
29278 return 0;
29279 }
29280 return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b);
29281 }
29282 #if PY_MAJOR_VERSION == 2
29283 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
29284 PyObject *exception, *value, *tb;
29285 int res;
29286 __Pyx_PyThreadState_declare
29287 __Pyx_PyThreadState_assign
29288 __Pyx_ErrFetch(&exception, &value, &tb);
29289 res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
29290 if (unlikely(res == -1)) {
29291 PyErr_WriteUnraisable(err);
29292 res = 0;
29293 }
29294 if (!res) {
29295 res = PyObject_IsSubclass(err, exc_type2);
29296 if (unlikely(res == -1)) {
29297 PyErr_WriteUnraisable(err);
29298 res = 0;
29299 }
29300 }
29301 __Pyx_ErrRestore(exception, value, tb);
29302 return res;
29303 }
29304 #else
29305 static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
29306 if (exc_type1) {
29307 return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2);
29308 } else {
29309 return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
29310 }
29311 }
29312 #endif
29313 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
29314 Py_ssize_t i, n;
29315 assert(PyExceptionClass_Check(exc_type));
29316 n = PyTuple_GET_SIZE(tuple);
29317 #if PY_MAJOR_VERSION >= 3
29318 for (i=0; i<n; i++) {
29319 if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
29320 }
29321 #endif
29322 for (i=0; i<n; i++) {
29323 PyObject *t = PyTuple_GET_ITEM(tuple, i);
29324 #if PY_MAJOR_VERSION < 3
29325 if (likely(exc_type == t)) return 1;
29326 #endif
29327 if (likely(PyExceptionClass_Check(t))) {
29328 if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
29329 } else {
29330 }
29331 }
29332 return 0;
29333 }
29334 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
29335 if (likely(err == exc_type)) return 1;
29336 if (likely(PyExceptionClass_Check(err))) {
29337 if (likely(PyExceptionClass_Check(exc_type))) {
29338 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
29339 } else if (likely(PyTuple_Check(exc_type))) {
29340 return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
29341 } else {
29342 }
29343 }
29344 return PyErr_GivenExceptionMatches(err, exc_type);
29345 }
29346 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
29347 assert(PyExceptionClass_Check(exc_type1));
29348 assert(PyExceptionClass_Check(exc_type2));
29349 if (likely(err == exc_type1 || err == exc_type2)) return 1;
29350 if (likely(PyExceptionClass_Check(err))) {
29351 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
29352 }
29353 return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
29354 }
29355 #endif
29356
29357 /* CheckBinaryVersion */
29358 static unsigned long __Pyx_get_runtime_version(void) {
29359 #if __PYX_LIMITED_VERSION_HEX >= 0x030B00A4
29360 return Py_Version & ~0xFFUL;
29361 #else
29362 const char* rt_version = Py_GetVersion();
29363 unsigned long version = 0;
29364 unsigned long factor = 0x01000000UL;
29365 unsigned int digit = 0;
29366 int i = 0;
29367 while (factor) {
29368 while ('0' <= rt_version[i] && rt_version[i] <= '9') {
29369 digit = digit * 10 + (unsigned int) (rt_version[i] - '0');
29370 ++i;
29371 }
29372 version += factor * digit;
29373 if (rt_version[i] != '.')
29374 break;
29375 digit = 0;
29376 factor >>= 8;
29377 ++i;
29378 }
29379 return version;
29380 #endif
29381 }
29382 static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer) {
29383 const unsigned long MAJOR_MINOR = 0xFFFF0000UL;
29384 if ((rt_version & MAJOR_MINOR) == (ct_version & MAJOR_MINOR))
29385 return 0;
29386 if (likely(allow_newer && (rt_version & MAJOR_MINOR) > (ct_version & MAJOR_MINOR)))
29387 return 1;
29388 {
29389 char message[200];
29390 PyOS_snprintf(message, sizeof(message),
29391 "compile time Python version %d.%d "
29392 "of module '%.100s' "
29393 "%s "
29394 "runtime version %d.%d",
29395 (int) (ct_version >> 24), (int) ((ct_version >> 16) & 0xFF),
29396 __Pyx_MODULE_NAME,
29397 (allow_newer) ? "was newer than" : "does not match",
29398 (int) (rt_version >> 24), (int) ((rt_version >> 16) & 0xFF)
29399 );
29400 return PyErr_WarnEx(NULL, message, 1);
29401 }
29402 }
29403
29404 /* FunctionImport */
29405 #ifndef __PYX_HAVE_RT_ImportFunction_3_0_11
29406 #define __PYX_HAVE_RT_ImportFunction_3_0_11
29407 static int __Pyx_ImportFunction_3_0_11(PyObject *module, const char *funcname, void (**f)(void), const char *sig) {
29408 PyObject *d = 0;
29409 PyObject *cobj = 0;
29410 union {
29411 void (*fp)(void);
29412 void *p;
29413 } tmp;
29414 d = PyObject_GetAttrString(module, (char *)"__pyx_capi__");
29415 if (!d)
29416 goto bad;
29417 cobj = PyDict_GetItemString(d, funcname);
29418 if (!cobj) {
29419 PyErr_Format(PyExc_ImportError,
29420 "%.200s does not export expected C function %.200s",
29421 PyModule_GetName(module), funcname);
29422 goto bad;
29423 }
29424 if (!PyCapsule_IsValid(cobj, sig)) {
29425 PyErr_Format(PyExc_TypeError,
29426 "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
29427 PyModule_GetName(module), funcname, sig, PyCapsule_GetName(cobj));
29428 goto bad;
29429 }
29430 tmp.p = PyCapsule_GetPointer(cobj, sig);
29431 *f = tmp.fp;
29432 if (!(*f))
29433 goto bad;
29434 Py_DECREF(d);
29435 return 0;
29436 bad:
29437 Py_XDECREF(d);
29438 return -1;
29439 }
29440 #endif
29441
29442 /* InitStrings */
29443 #if PY_MAJOR_VERSION >= 3
29444 static int __Pyx_InitString(__Pyx_StringTabEntry t, PyObject **str) {
29445 if (t.is_unicode | t.is_str) {
29446 if (t.intern) {
29447 *str = PyUnicode_InternFromString(t.s);
29448 } else if (t.encoding) {
29449 *str = PyUnicode_Decode(t.s, t.n - 1, t.encoding, NULL);
29450 } else {
29451 *str = PyUnicode_FromStringAndSize(t.s, t.n - 1);
29452 }
29453 } else {
29454 *str = PyBytes_FromStringAndSize(t.s, t.n - 1);
29455 }
29456 if (!*str)
29457 return -1;
29458 if (PyObject_Hash(*str) == -1)
29459 return -1;
29460 return 0;
29461 }
29462 #endif
29463 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
29464 while (t->p) {
29465 #if PY_MAJOR_VERSION >= 3
29466 __Pyx_InitString(*t, t->p);
29467 #else
29468 if (t->is_unicode) {
29469 *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
29470 } else if (t->intern) {
29471 *t->p = PyString_InternFromString(t->s);
29472 } else {
29473 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
29474 }
29475 if (!*t->p)
29476 return -1;
29477 if (PyObject_Hash(*t->p) == -1)
29478 return -1;
29479 #endif
29480 ++t;
29481 }
29482 return 0;
29483 }
29484
29485 #include <string.h>
29486 static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s) {
29487 size_t len = strlen(s);
29488 if (unlikely(len > (size_t) PY_SSIZE_T_MAX)) {
29489 PyErr_SetString(PyExc_OverflowError, "byte string is too long");
29490 return -1;
29491 }
29492 return (Py_ssize_t) len;
29493 }
29494 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
29495 Py_ssize_t len = __Pyx_ssize_strlen(c_str);
29496 if (unlikely(len < 0)) return NULL;
29497 return __Pyx_PyUnicode_FromStringAndSize(c_str, len);
29498 }
29499 static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char* c_str) {
29500 Py_ssize_t len = __Pyx_ssize_strlen(c_str);
29501 if (unlikely(len < 0)) return NULL;
29502 return PyByteArray_FromStringAndSize(c_str, len);
29503 }
29504 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
29505 Py_ssize_t ignore;
29506 return __Pyx_PyObject_AsStringAndSize(o, &ignore);
29507 }
29508 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
29509 #if !CYTHON_PEP393_ENABLED
29510 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
29511 char* defenc_c;
29512 PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
29513 if (!defenc) return NULL;
29514 defenc_c = PyBytes_AS_STRING(defenc);
29515 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
29516 {
29517 char* end = defenc_c + PyBytes_GET_SIZE(defenc);
29518 char* c;
29519 for (c = defenc_c; c < end; c++) {
29520 if ((unsigned char) (*c) >= 128) {
29521 PyUnicode_AsASCIIString(o);
29522 return NULL;
29523 }
29524 }
29525 }
29526 #endif
29527 *length = PyBytes_GET_SIZE(defenc);
29528 return defenc_c;
29529 }
29530 #else
29531 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
29532 if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
29533 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
29534 if (likely(PyUnicode_IS_ASCII(o))) {
29535 *length = PyUnicode_GET_LENGTH(o);
29536 return PyUnicode_AsUTF8(o);
29537 } else {
29538 PyUnicode_AsASCIIString(o);
29539 return NULL;
29540 }
29541 #else
29542 return PyUnicode_AsUTF8AndSize(o, length);
29543 #endif
29544 }
29545 #endif
29546 #endif
29547 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
29548 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
29549 if (
29550 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
29551 __Pyx_sys_getdefaultencoding_not_ascii &&
29552 #endif
29553 PyUnicode_Check(o)) {
29554 return __Pyx_PyUnicode_AsStringAndSize(o, length);
29555 } else
29556 #endif
29557 #if (!CYTHON_COMPILING_IN_PYPY && !CYTHON_COMPILING_IN_LIMITED_API) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
29558 if (PyByteArray_Check(o)) {
29559 *length = PyByteArray_GET_SIZE(o);
29560 return PyByteArray_AS_STRING(o);
29561 } else
29562 #endif
29563 {
29564 char* result;
29565 int r = PyBytes_AsStringAndSize(o, &result, length);
29566 if (unlikely(r < 0)) {
29567 return NULL;
29568 } else {
29569 return result;
29570 }
29571 }
29572 }
29573 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
29574 int is_true = x == Py_True;
29575 if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
29576 else return PyObject_IsTrue(x);
29577 }
29578 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
29579 int retval;
29580 if (unlikely(!x)) return -1;
29581 retval = __Pyx_PyObject_IsTrue(x);
29582 Py_DECREF(x);
29583 return retval;
29584 }
29585 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
29586 __Pyx_TypeName result_type_name = __Pyx_PyType_GetName(Py_TYPE(result));
29587 #if PY_MAJOR_VERSION >= 3
29588 if (PyLong_Check(result)) {
29589 if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
29590 "__int__ returned non-int (type " __Pyx_FMT_TYPENAME "). "
29591 "The ability to return an instance of a strict subclass of int is deprecated, "
29592 "and may be removed in a future version of Python.",
29593 result_type_name)) {
29594 __Pyx_DECREF_TypeName(result_type_name);
29595 Py_DECREF(result);
29596 return NULL;
29597 }
29598 __Pyx_DECREF_TypeName(result_type_name);
29599 return result;
29600 }
29601 #endif
29602 PyErr_Format(PyExc_TypeError,
29603 "__%.4s__ returned non-%.4s (type " __Pyx_FMT_TYPENAME ")",
29604 type_name, type_name, result_type_name);
29605 __Pyx_DECREF_TypeName(result_type_name);
29606 Py_DECREF(result);
29607 return NULL;
29608 }
29609 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
29610 #if CYTHON_USE_TYPE_SLOTS
29611 PyNumberMethods *m;
29612 #endif
29613 const char *name = NULL;
29614 PyObject *res = NULL;
29615 #if PY_MAJOR_VERSION < 3
29616 if (likely(PyInt_Check(x) || PyLong_Check(x)))
29617 #else
29618 if (likely(PyLong_Check(x)))
29619 #endif
29620 return __Pyx_NewRef(x);
29621 #if CYTHON_USE_TYPE_SLOTS
29622 m = Py_TYPE(x)->tp_as_number;
29623 #if PY_MAJOR_VERSION < 3
29624 if (m && m->nb_int) {
29625 name = "int";
29626 res = m->nb_int(x);
29627 }
29628 else if (m && m->nb_long) {
29629 name = "long";
29630 res = m->nb_long(x);
29631 }
29632 #else
29633 if (likely(m && m->nb_int)) {
29634 name = "int";
29635 res = m->nb_int(x);
29636 }
29637 #endif
29638 #else
29639 if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
29640 res = PyNumber_Int(x);
29641 }
29642 #endif
29643 if (likely(res)) {
29644 #if PY_MAJOR_VERSION < 3
29645 if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
29646 #else
29647 if (unlikely(!PyLong_CheckExact(res))) {
29648 #endif
29649 return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
29650 }
29651 }
29652 else if (!PyErr_Occurred()) {
29653 PyErr_SetString(PyExc_TypeError,
29654 "an integer is required");
29655 }
29656 return res;
29657 }
29658 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
29659 Py_ssize_t ival;
29660 PyObject *x;
29661 #if PY_MAJOR_VERSION < 3
29662 if (likely(PyInt_CheckExact(b))) {
29663 if (sizeof(Py_ssize_t) >= sizeof(long))
29664 return PyInt_AS_LONG(b);
29665 else
29666 return PyInt_AsSsize_t(b);
29667 }
29668 #endif
29669 if (likely(PyLong_CheckExact(b))) {
29670 #if CYTHON_USE_PYLONG_INTERNALS
29671 if (likely(__Pyx_PyLong_IsCompact(b))) {
29672 return __Pyx_PyLong_CompactValue(b);
29673 } else {
29674 const digit* digits = __Pyx_PyLong_Digits(b);
29675 const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(b);
29676 switch (size) {
29677 case 2:
29678 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
29679 return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
29680 }
29681 break;
29682 case -2:
29683 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
29684 return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
29685 }
29686 break;
29687 case 3:
29688 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
29689 return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
29690 }
29691 break;
29692 case -3:
29693 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
29694 return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
29695 }
29696 break;
29697 case 4:
29698 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
29699 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]));
29700 }
29701 break;
29702 case -4:
29703 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
29704 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]));
29705 }
29706 break;
29707 }
29708 }
29709 #endif
29710 return PyLong_AsSsize_t(b);
29711 }
29712 x = PyNumber_Index(b);
29713 if (!x) return -1;
29714 ival = PyInt_AsSsize_t(x);
29715 Py_DECREF(x);
29716 return ival;
29717 }
29718 static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) {
29719 if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) {
29720 return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o);
29721 #if PY_MAJOR_VERSION < 3
29722 } else if (likely(PyInt_CheckExact(o))) {
29723 return PyInt_AS_LONG(o);
29724 #endif
29725 } else {
29726 Py_ssize_t ival;
29727 PyObject *x;
29728 x = PyNumber_Index(o);
29729 if (!x) return -1;
29730 ival = PyInt_AsLong(x);
29731 Py_DECREF(x);
29732 return ival;
29733 }
29734 }
29735 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
29736 return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
29737 }
29738 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
29739 return PyInt_FromSize_t(ival);
29740 }
29741
29742
29743 /* #### Code section: utility_code_pragmas_end ### */
29744 #ifdef _MSC_VER
29745 #pragma warning( pop )
29746 #endif
29747
29748
29749
29750 /* #### Code section: end ### */
29751 #endif /* Py_PYTHON_H */