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

planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author jpayne
date Tue, 18 Mar 2025 17:55:14 -0400
parents
children
rev   line source
jpayne@69 1 /* Generated by Cython 3.0.11 */
jpayne@69 2
jpayne@69 3 /* BEGIN: Cython Metadata
jpayne@69 4 {
jpayne@69 5 "distutils": {
jpayne@69 6 "define_macros": [
jpayne@69 7 [
jpayne@69 8 "BUILDING_WHEEL",
jpayne@69 9 null
jpayne@69 10 ]
jpayne@69 11 ],
jpayne@69 12 "depends": [
jpayne@69 13 "/project/bcftools/bcftools.pysam.h",
jpayne@69 14 "/project/samtools/samtools.pysam.h"
jpayne@69 15 ],
jpayne@69 16 "extra_compile_args": [
jpayne@69 17 "-Wno-unused",
jpayne@69 18 "-Wno-strict-prototypes",
jpayne@69 19 "-Wno-sign-compare",
jpayne@69 20 "-Wno-error=declaration-after-statement"
jpayne@69 21 ],
jpayne@69 22 "extra_link_args": [
jpayne@69 23 "-Wl,-rpath,$ORIGIN"
jpayne@69 24 ],
jpayne@69 25 "include_dirs": [
jpayne@69 26 "/project/pysam",
jpayne@69 27 "/project/htslib",
jpayne@69 28 "/project/samtools",
jpayne@69 29 "/project/samtools/lz4",
jpayne@69 30 "/project/bcftools",
jpayne@69 31 "/project"
jpayne@69 32 ],
jpayne@69 33 "language": "c",
jpayne@69 34 "libraries": [
jpayne@69 35 "z",
jpayne@69 36 "lzma",
jpayne@69 37 "bz2",
jpayne@69 38 "z",
jpayne@69 39 "m",
jpayne@69 40 "curl",
jpayne@69 41 "crypto",
jpayne@69 42 "chtslib.cpython-37m-x86_64-linux-gnu",
jpayne@69 43 "csamtools.cpython-37m-x86_64-linux-gnu",
jpayne@69 44 "cbcftools.cpython-37m-x86_64-linux-gnu"
jpayne@69 45 ],
jpayne@69 46 "library_dirs": [
jpayne@69 47 "/project/pysam",
jpayne@69 48 "/project",
jpayne@69 49 "build/lib.linux-x86_64-cpython-37/pysam",
jpayne@69 50 "build/lib.linux-x86_64-cpython-37/pysam",
jpayne@69 51 "build/lib.linux-x86_64-cpython-37/pysam",
jpayne@69 52 "build/lib.linux-x86_64-cpython-37/pysam"
jpayne@69 53 ],
jpayne@69 54 "name": "pysam.libcutils",
jpayne@69 55 "sources": [
jpayne@69 56 "pysam/libcutils.pyx",
jpayne@69 57 "pysam/pysam_util.c"
jpayne@69 58 ]
jpayne@69 59 },
jpayne@69 60 "module_name": "pysam.libcutils"
jpayne@69 61 }
jpayne@69 62 END: Cython Metadata */
jpayne@69 63
jpayne@69 64 #ifndef PY_SSIZE_T_CLEAN
jpayne@69 65 #define PY_SSIZE_T_CLEAN
jpayne@69 66 #endif /* PY_SSIZE_T_CLEAN */
jpayne@69 67 #if defined(CYTHON_LIMITED_API) && 0
jpayne@69 68 #ifndef Py_LIMITED_API
jpayne@69 69 #if CYTHON_LIMITED_API+0 > 0x03030000
jpayne@69 70 #define Py_LIMITED_API CYTHON_LIMITED_API
jpayne@69 71 #else
jpayne@69 72 #define Py_LIMITED_API 0x03030000
jpayne@69 73 #endif
jpayne@69 74 #endif
jpayne@69 75 #endif
jpayne@69 76
jpayne@69 77 #include "Python.h"
jpayne@69 78
jpayne@69 79 #if PY_MAJOR_VERSION >= 3
jpayne@69 80 #define __Pyx_PyFloat_FromString(obj) PyFloat_FromString(obj)
jpayne@69 81 #else
jpayne@69 82 #define __Pyx_PyFloat_FromString(obj) PyFloat_FromString(obj, NULL)
jpayne@69 83 #endif
jpayne@69 84
jpayne@69 85
jpayne@69 86 #if PY_MAJOR_VERSION <= 2
jpayne@69 87 #define PyDict_GetItemWithError _PyDict_GetItemWithError
jpayne@69 88 #endif
jpayne@69 89
jpayne@69 90
jpayne@69 91 #if (PY_VERSION_HEX < 0x030700b1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030600)) && !defined(PyContextVar_Get)
jpayne@69 92 #define PyContextVar_Get(var, d, v) ((d) ? ((void)(var), Py_INCREF(d), (v)[0] = (d), 0) : ((v)[0] = NULL, 0) )
jpayne@69 93 #endif
jpayne@69 94
jpayne@69 95 #ifndef Py_PYTHON_H
jpayne@69 96 #error Python headers needed to compile C extensions, please install development version of Python.
jpayne@69 97 #elif PY_VERSION_HEX < 0x02070000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
jpayne@69 98 #error Cython requires Python 2.7+ or Python 3.3+.
jpayne@69 99 #else
jpayne@69 100 #if defined(CYTHON_LIMITED_API) && CYTHON_LIMITED_API
jpayne@69 101 #define __PYX_EXTRA_ABI_MODULE_NAME "limited"
jpayne@69 102 #else
jpayne@69 103 #define __PYX_EXTRA_ABI_MODULE_NAME ""
jpayne@69 104 #endif
jpayne@69 105 #define CYTHON_ABI "3_0_11" __PYX_EXTRA_ABI_MODULE_NAME
jpayne@69 106 #define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI
jpayne@69 107 #define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "."
jpayne@69 108 #define CYTHON_HEX_VERSION 0x03000BF0
jpayne@69 109 #define CYTHON_FUTURE_DIVISION 1
jpayne@69 110 #include <stddef.h>
jpayne@69 111 #ifndef offsetof
jpayne@69 112 #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
jpayne@69 113 #endif
jpayne@69 114 #if !defined(_WIN32) && !defined(WIN32) && !defined(MS_WINDOWS)
jpayne@69 115 #ifndef __stdcall
jpayne@69 116 #define __stdcall
jpayne@69 117 #endif
jpayne@69 118 #ifndef __cdecl
jpayne@69 119 #define __cdecl
jpayne@69 120 #endif
jpayne@69 121 #ifndef __fastcall
jpayne@69 122 #define __fastcall
jpayne@69 123 #endif
jpayne@69 124 #endif
jpayne@69 125 #ifndef DL_IMPORT
jpayne@69 126 #define DL_IMPORT(t) t
jpayne@69 127 #endif
jpayne@69 128 #ifndef DL_EXPORT
jpayne@69 129 #define DL_EXPORT(t) t
jpayne@69 130 #endif
jpayne@69 131 #define __PYX_COMMA ,
jpayne@69 132 #ifndef HAVE_LONG_LONG
jpayne@69 133 #define HAVE_LONG_LONG
jpayne@69 134 #endif
jpayne@69 135 #ifndef PY_LONG_LONG
jpayne@69 136 #define PY_LONG_LONG LONG_LONG
jpayne@69 137 #endif
jpayne@69 138 #ifndef Py_HUGE_VAL
jpayne@69 139 #define Py_HUGE_VAL HUGE_VAL
jpayne@69 140 #endif
jpayne@69 141 #define __PYX_LIMITED_VERSION_HEX PY_VERSION_HEX
jpayne@69 142 #if defined(GRAALVM_PYTHON)
jpayne@69 143 /* For very preliminary testing purposes. Most variables are set the same as PyPy.
jpayne@69 144 The existence of this section does not imply that anything works or is even tested */
jpayne@69 145 #define CYTHON_COMPILING_IN_PYPY 0
jpayne@69 146 #define CYTHON_COMPILING_IN_CPYTHON 0
jpayne@69 147 #define CYTHON_COMPILING_IN_LIMITED_API 0
jpayne@69 148 #define CYTHON_COMPILING_IN_GRAAL 1
jpayne@69 149 #define CYTHON_COMPILING_IN_NOGIL 0
jpayne@69 150 #undef CYTHON_USE_TYPE_SLOTS
jpayne@69 151 #define CYTHON_USE_TYPE_SLOTS 0
jpayne@69 152 #undef CYTHON_USE_TYPE_SPECS
jpayne@69 153 #define CYTHON_USE_TYPE_SPECS 0
jpayne@69 154 #undef CYTHON_USE_PYTYPE_LOOKUP
jpayne@69 155 #define CYTHON_USE_PYTYPE_LOOKUP 0
jpayne@69 156 #if PY_VERSION_HEX < 0x03050000
jpayne@69 157 #undef CYTHON_USE_ASYNC_SLOTS
jpayne@69 158 #define CYTHON_USE_ASYNC_SLOTS 0
jpayne@69 159 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
jpayne@69 160 #define CYTHON_USE_ASYNC_SLOTS 1
jpayne@69 161 #endif
jpayne@69 162 #undef CYTHON_USE_PYLIST_INTERNALS
jpayne@69 163 #define CYTHON_USE_PYLIST_INTERNALS 0
jpayne@69 164 #undef CYTHON_USE_UNICODE_INTERNALS
jpayne@69 165 #define CYTHON_USE_UNICODE_INTERNALS 0
jpayne@69 166 #undef CYTHON_USE_UNICODE_WRITER
jpayne@69 167 #define CYTHON_USE_UNICODE_WRITER 0
jpayne@69 168 #undef CYTHON_USE_PYLONG_INTERNALS
jpayne@69 169 #define CYTHON_USE_PYLONG_INTERNALS 0
jpayne@69 170 #undef CYTHON_AVOID_BORROWED_REFS
jpayne@69 171 #define CYTHON_AVOID_BORROWED_REFS 1
jpayne@69 172 #undef CYTHON_ASSUME_SAFE_MACROS
jpayne@69 173 #define CYTHON_ASSUME_SAFE_MACROS 0
jpayne@69 174 #undef CYTHON_UNPACK_METHODS
jpayne@69 175 #define CYTHON_UNPACK_METHODS 0
jpayne@69 176 #undef CYTHON_FAST_THREAD_STATE
jpayne@69 177 #define CYTHON_FAST_THREAD_STATE 0
jpayne@69 178 #undef CYTHON_FAST_GIL
jpayne@69 179 #define CYTHON_FAST_GIL 0
jpayne@69 180 #undef CYTHON_METH_FASTCALL
jpayne@69 181 #define CYTHON_METH_FASTCALL 0
jpayne@69 182 #undef CYTHON_FAST_PYCALL
jpayne@69 183 #define CYTHON_FAST_PYCALL 0
jpayne@69 184 #ifndef CYTHON_PEP487_INIT_SUBCLASS
jpayne@69 185 #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3)
jpayne@69 186 #endif
jpayne@69 187 #undef CYTHON_PEP489_MULTI_PHASE_INIT
jpayne@69 188 #define CYTHON_PEP489_MULTI_PHASE_INIT 1
jpayne@69 189 #undef CYTHON_USE_MODULE_STATE
jpayne@69 190 #define CYTHON_USE_MODULE_STATE 0
jpayne@69 191 #undef CYTHON_USE_TP_FINALIZE
jpayne@69 192 #define CYTHON_USE_TP_FINALIZE 0
jpayne@69 193 #undef CYTHON_USE_DICT_VERSIONS
jpayne@69 194 #define CYTHON_USE_DICT_VERSIONS 0
jpayne@69 195 #undef CYTHON_USE_EXC_INFO_STACK
jpayne@69 196 #define CYTHON_USE_EXC_INFO_STACK 0
jpayne@69 197 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
jpayne@69 198 #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
jpayne@69 199 #endif
jpayne@69 200 #undef CYTHON_USE_FREELISTS
jpayne@69 201 #define CYTHON_USE_FREELISTS 0
jpayne@69 202 #elif defined(PYPY_VERSION)
jpayne@69 203 #define CYTHON_COMPILING_IN_PYPY 1
jpayne@69 204 #define CYTHON_COMPILING_IN_CPYTHON 0
jpayne@69 205 #define CYTHON_COMPILING_IN_LIMITED_API 0
jpayne@69 206 #define CYTHON_COMPILING_IN_GRAAL 0
jpayne@69 207 #define CYTHON_COMPILING_IN_NOGIL 0
jpayne@69 208 #undef CYTHON_USE_TYPE_SLOTS
jpayne@69 209 #define CYTHON_USE_TYPE_SLOTS 0
jpayne@69 210 #ifndef CYTHON_USE_TYPE_SPECS
jpayne@69 211 #define CYTHON_USE_TYPE_SPECS 0
jpayne@69 212 #endif
jpayne@69 213 #undef CYTHON_USE_PYTYPE_LOOKUP
jpayne@69 214 #define CYTHON_USE_PYTYPE_LOOKUP 0
jpayne@69 215 #if PY_VERSION_HEX < 0x03050000
jpayne@69 216 #undef CYTHON_USE_ASYNC_SLOTS
jpayne@69 217 #define CYTHON_USE_ASYNC_SLOTS 0
jpayne@69 218 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
jpayne@69 219 #define CYTHON_USE_ASYNC_SLOTS 1
jpayne@69 220 #endif
jpayne@69 221 #undef CYTHON_USE_PYLIST_INTERNALS
jpayne@69 222 #define CYTHON_USE_PYLIST_INTERNALS 0
jpayne@69 223 #undef CYTHON_USE_UNICODE_INTERNALS
jpayne@69 224 #define CYTHON_USE_UNICODE_INTERNALS 0
jpayne@69 225 #undef CYTHON_USE_UNICODE_WRITER
jpayne@69 226 #define CYTHON_USE_UNICODE_WRITER 0
jpayne@69 227 #undef CYTHON_USE_PYLONG_INTERNALS
jpayne@69 228 #define CYTHON_USE_PYLONG_INTERNALS 0
jpayne@69 229 #undef CYTHON_AVOID_BORROWED_REFS
jpayne@69 230 #define CYTHON_AVOID_BORROWED_REFS 1
jpayne@69 231 #undef CYTHON_ASSUME_SAFE_MACROS
jpayne@69 232 #define CYTHON_ASSUME_SAFE_MACROS 0
jpayne@69 233 #undef CYTHON_UNPACK_METHODS
jpayne@69 234 #define CYTHON_UNPACK_METHODS 0
jpayne@69 235 #undef CYTHON_FAST_THREAD_STATE
jpayne@69 236 #define CYTHON_FAST_THREAD_STATE 0
jpayne@69 237 #undef CYTHON_FAST_GIL
jpayne@69 238 #define CYTHON_FAST_GIL 0
jpayne@69 239 #undef CYTHON_METH_FASTCALL
jpayne@69 240 #define CYTHON_METH_FASTCALL 0
jpayne@69 241 #undef CYTHON_FAST_PYCALL
jpayne@69 242 #define CYTHON_FAST_PYCALL 0
jpayne@69 243 #ifndef CYTHON_PEP487_INIT_SUBCLASS
jpayne@69 244 #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3)
jpayne@69 245 #endif
jpayne@69 246 #if PY_VERSION_HEX < 0x03090000
jpayne@69 247 #undef CYTHON_PEP489_MULTI_PHASE_INIT
jpayne@69 248 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
jpayne@69 249 #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT)
jpayne@69 250 #define CYTHON_PEP489_MULTI_PHASE_INIT 1
jpayne@69 251 #endif
jpayne@69 252 #undef CYTHON_USE_MODULE_STATE
jpayne@69 253 #define CYTHON_USE_MODULE_STATE 0
jpayne@69 254 #undef CYTHON_USE_TP_FINALIZE
jpayne@69 255 #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1 && PYPY_VERSION_NUM >= 0x07030C00)
jpayne@69 256 #undef CYTHON_USE_DICT_VERSIONS
jpayne@69 257 #define CYTHON_USE_DICT_VERSIONS 0
jpayne@69 258 #undef CYTHON_USE_EXC_INFO_STACK
jpayne@69 259 #define CYTHON_USE_EXC_INFO_STACK 0
jpayne@69 260 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
jpayne@69 261 #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
jpayne@69 262 #endif
jpayne@69 263 #undef CYTHON_USE_FREELISTS
jpayne@69 264 #define CYTHON_USE_FREELISTS 0
jpayne@69 265 #elif defined(CYTHON_LIMITED_API)
jpayne@69 266 #ifdef Py_LIMITED_API
jpayne@69 267 #undef __PYX_LIMITED_VERSION_HEX
jpayne@69 268 #define __PYX_LIMITED_VERSION_HEX Py_LIMITED_API
jpayne@69 269 #endif
jpayne@69 270 #define CYTHON_COMPILING_IN_PYPY 0
jpayne@69 271 #define CYTHON_COMPILING_IN_CPYTHON 0
jpayne@69 272 #define CYTHON_COMPILING_IN_LIMITED_API 1
jpayne@69 273 #define CYTHON_COMPILING_IN_GRAAL 0
jpayne@69 274 #define CYTHON_COMPILING_IN_NOGIL 0
jpayne@69 275 #undef CYTHON_CLINE_IN_TRACEBACK
jpayne@69 276 #define CYTHON_CLINE_IN_TRACEBACK 0
jpayne@69 277 #undef CYTHON_USE_TYPE_SLOTS
jpayne@69 278 #define CYTHON_USE_TYPE_SLOTS 0
jpayne@69 279 #undef CYTHON_USE_TYPE_SPECS
jpayne@69 280 #define CYTHON_USE_TYPE_SPECS 1
jpayne@69 281 #undef CYTHON_USE_PYTYPE_LOOKUP
jpayne@69 282 #define CYTHON_USE_PYTYPE_LOOKUP 0
jpayne@69 283 #undef CYTHON_USE_ASYNC_SLOTS
jpayne@69 284 #define CYTHON_USE_ASYNC_SLOTS 0
jpayne@69 285 #undef CYTHON_USE_PYLIST_INTERNALS
jpayne@69 286 #define CYTHON_USE_PYLIST_INTERNALS 0
jpayne@69 287 #undef CYTHON_USE_UNICODE_INTERNALS
jpayne@69 288 #define CYTHON_USE_UNICODE_INTERNALS 0
jpayne@69 289 #ifndef CYTHON_USE_UNICODE_WRITER
jpayne@69 290 #define CYTHON_USE_UNICODE_WRITER 0
jpayne@69 291 #endif
jpayne@69 292 #undef CYTHON_USE_PYLONG_INTERNALS
jpayne@69 293 #define CYTHON_USE_PYLONG_INTERNALS 0
jpayne@69 294 #ifndef CYTHON_AVOID_BORROWED_REFS
jpayne@69 295 #define CYTHON_AVOID_BORROWED_REFS 0
jpayne@69 296 #endif
jpayne@69 297 #undef CYTHON_ASSUME_SAFE_MACROS
jpayne@69 298 #define CYTHON_ASSUME_SAFE_MACROS 0
jpayne@69 299 #undef CYTHON_UNPACK_METHODS
jpayne@69 300 #define CYTHON_UNPACK_METHODS 0
jpayne@69 301 #undef CYTHON_FAST_THREAD_STATE
jpayne@69 302 #define CYTHON_FAST_THREAD_STATE 0
jpayne@69 303 #undef CYTHON_FAST_GIL
jpayne@69 304 #define CYTHON_FAST_GIL 0
jpayne@69 305 #undef CYTHON_METH_FASTCALL
jpayne@69 306 #define CYTHON_METH_FASTCALL 0
jpayne@69 307 #undef CYTHON_FAST_PYCALL
jpayne@69 308 #define CYTHON_FAST_PYCALL 0
jpayne@69 309 #ifndef CYTHON_PEP487_INIT_SUBCLASS
jpayne@69 310 #define CYTHON_PEP487_INIT_SUBCLASS 1
jpayne@69 311 #endif
jpayne@69 312 #undef CYTHON_PEP489_MULTI_PHASE_INIT
jpayne@69 313 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
jpayne@69 314 #undef CYTHON_USE_MODULE_STATE
jpayne@69 315 #define CYTHON_USE_MODULE_STATE 1
jpayne@69 316 #ifndef CYTHON_USE_TP_FINALIZE
jpayne@69 317 #define CYTHON_USE_TP_FINALIZE 0
jpayne@69 318 #endif
jpayne@69 319 #undef CYTHON_USE_DICT_VERSIONS
jpayne@69 320 #define CYTHON_USE_DICT_VERSIONS 0
jpayne@69 321 #undef CYTHON_USE_EXC_INFO_STACK
jpayne@69 322 #define CYTHON_USE_EXC_INFO_STACK 0
jpayne@69 323 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
jpayne@69 324 #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
jpayne@69 325 #endif
jpayne@69 326 #undef CYTHON_USE_FREELISTS
jpayne@69 327 #define CYTHON_USE_FREELISTS 0
jpayne@69 328 #elif defined(Py_GIL_DISABLED) || defined(Py_NOGIL)
jpayne@69 329 #define CYTHON_COMPILING_IN_PYPY 0
jpayne@69 330 #define CYTHON_COMPILING_IN_CPYTHON 0
jpayne@69 331 #define CYTHON_COMPILING_IN_LIMITED_API 0
jpayne@69 332 #define CYTHON_COMPILING_IN_GRAAL 0
jpayne@69 333 #define CYTHON_COMPILING_IN_NOGIL 1
jpayne@69 334 #ifndef CYTHON_USE_TYPE_SLOTS
jpayne@69 335 #define CYTHON_USE_TYPE_SLOTS 1
jpayne@69 336 #endif
jpayne@69 337 #ifndef CYTHON_USE_TYPE_SPECS
jpayne@69 338 #define CYTHON_USE_TYPE_SPECS 0
jpayne@69 339 #endif
jpayne@69 340 #undef CYTHON_USE_PYTYPE_LOOKUP
jpayne@69 341 #define CYTHON_USE_PYTYPE_LOOKUP 0
jpayne@69 342 #ifndef CYTHON_USE_ASYNC_SLOTS
jpayne@69 343 #define CYTHON_USE_ASYNC_SLOTS 1
jpayne@69 344 #endif
jpayne@69 345 #ifndef CYTHON_USE_PYLONG_INTERNALS
jpayne@69 346 #define CYTHON_USE_PYLONG_INTERNALS 0
jpayne@69 347 #endif
jpayne@69 348 #undef CYTHON_USE_PYLIST_INTERNALS
jpayne@69 349 #define CYTHON_USE_PYLIST_INTERNALS 0
jpayne@69 350 #ifndef CYTHON_USE_UNICODE_INTERNALS
jpayne@69 351 #define CYTHON_USE_UNICODE_INTERNALS 1
jpayne@69 352 #endif
jpayne@69 353 #undef CYTHON_USE_UNICODE_WRITER
jpayne@69 354 #define CYTHON_USE_UNICODE_WRITER 0
jpayne@69 355 #ifndef CYTHON_AVOID_BORROWED_REFS
jpayne@69 356 #define CYTHON_AVOID_BORROWED_REFS 0
jpayne@69 357 #endif
jpayne@69 358 #ifndef CYTHON_ASSUME_SAFE_MACROS
jpayne@69 359 #define CYTHON_ASSUME_SAFE_MACROS 1
jpayne@69 360 #endif
jpayne@69 361 #ifndef CYTHON_UNPACK_METHODS
jpayne@69 362 #define CYTHON_UNPACK_METHODS 1
jpayne@69 363 #endif
jpayne@69 364 #undef CYTHON_FAST_THREAD_STATE
jpayne@69 365 #define CYTHON_FAST_THREAD_STATE 0
jpayne@69 366 #undef CYTHON_FAST_GIL
jpayne@69 367 #define CYTHON_FAST_GIL 0
jpayne@69 368 #ifndef CYTHON_METH_FASTCALL
jpayne@69 369 #define CYTHON_METH_FASTCALL 1
jpayne@69 370 #endif
jpayne@69 371 #undef CYTHON_FAST_PYCALL
jpayne@69 372 #define CYTHON_FAST_PYCALL 0
jpayne@69 373 #ifndef CYTHON_PEP487_INIT_SUBCLASS
jpayne@69 374 #define CYTHON_PEP487_INIT_SUBCLASS 1
jpayne@69 375 #endif
jpayne@69 376 #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
jpayne@69 377 #define CYTHON_PEP489_MULTI_PHASE_INIT 1
jpayne@69 378 #endif
jpayne@69 379 #ifndef CYTHON_USE_MODULE_STATE
jpayne@69 380 #define CYTHON_USE_MODULE_STATE 0
jpayne@69 381 #endif
jpayne@69 382 #ifndef CYTHON_USE_TP_FINALIZE
jpayne@69 383 #define CYTHON_USE_TP_FINALIZE 1
jpayne@69 384 #endif
jpayne@69 385 #undef CYTHON_USE_DICT_VERSIONS
jpayne@69 386 #define CYTHON_USE_DICT_VERSIONS 0
jpayne@69 387 #undef CYTHON_USE_EXC_INFO_STACK
jpayne@69 388 #define CYTHON_USE_EXC_INFO_STACK 0
jpayne@69 389 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
jpayne@69 390 #define CYTHON_UPDATE_DESCRIPTOR_DOC 1
jpayne@69 391 #endif
jpayne@69 392 #ifndef CYTHON_USE_FREELISTS
jpayne@69 393 #define CYTHON_USE_FREELISTS 0
jpayne@69 394 #endif
jpayne@69 395 #else
jpayne@69 396 #define CYTHON_COMPILING_IN_PYPY 0
jpayne@69 397 #define CYTHON_COMPILING_IN_CPYTHON 1
jpayne@69 398 #define CYTHON_COMPILING_IN_LIMITED_API 0
jpayne@69 399 #define CYTHON_COMPILING_IN_GRAAL 0
jpayne@69 400 #define CYTHON_COMPILING_IN_NOGIL 0
jpayne@69 401 #ifndef CYTHON_USE_TYPE_SLOTS
jpayne@69 402 #define CYTHON_USE_TYPE_SLOTS 1
jpayne@69 403 #endif
jpayne@69 404 #ifndef CYTHON_USE_TYPE_SPECS
jpayne@69 405 #define CYTHON_USE_TYPE_SPECS 0
jpayne@69 406 #endif
jpayne@69 407 #ifndef CYTHON_USE_PYTYPE_LOOKUP
jpayne@69 408 #define CYTHON_USE_PYTYPE_LOOKUP 1
jpayne@69 409 #endif
jpayne@69 410 #if PY_MAJOR_VERSION < 3
jpayne@69 411 #undef CYTHON_USE_ASYNC_SLOTS
jpayne@69 412 #define CYTHON_USE_ASYNC_SLOTS 0
jpayne@69 413 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
jpayne@69 414 #define CYTHON_USE_ASYNC_SLOTS 1
jpayne@69 415 #endif
jpayne@69 416 #ifndef CYTHON_USE_PYLONG_INTERNALS
jpayne@69 417 #define CYTHON_USE_PYLONG_INTERNALS 1
jpayne@69 418 #endif
jpayne@69 419 #ifndef CYTHON_USE_PYLIST_INTERNALS
jpayne@69 420 #define CYTHON_USE_PYLIST_INTERNALS 1
jpayne@69 421 #endif
jpayne@69 422 #ifndef CYTHON_USE_UNICODE_INTERNALS
jpayne@69 423 #define CYTHON_USE_UNICODE_INTERNALS 1
jpayne@69 424 #endif
jpayne@69 425 #if PY_VERSION_HEX < 0x030300F0 || PY_VERSION_HEX >= 0x030B00A2
jpayne@69 426 #undef CYTHON_USE_UNICODE_WRITER
jpayne@69 427 #define CYTHON_USE_UNICODE_WRITER 0
jpayne@69 428 #elif !defined(CYTHON_USE_UNICODE_WRITER)
jpayne@69 429 #define CYTHON_USE_UNICODE_WRITER 1
jpayne@69 430 #endif
jpayne@69 431 #ifndef CYTHON_AVOID_BORROWED_REFS
jpayne@69 432 #define CYTHON_AVOID_BORROWED_REFS 0
jpayne@69 433 #endif
jpayne@69 434 #ifndef CYTHON_ASSUME_SAFE_MACROS
jpayne@69 435 #define CYTHON_ASSUME_SAFE_MACROS 1
jpayne@69 436 #endif
jpayne@69 437 #ifndef CYTHON_UNPACK_METHODS
jpayne@69 438 #define CYTHON_UNPACK_METHODS 1
jpayne@69 439 #endif
jpayne@69 440 #ifndef CYTHON_FAST_THREAD_STATE
jpayne@69 441 #define CYTHON_FAST_THREAD_STATE 1
jpayne@69 442 #endif
jpayne@69 443 #ifndef CYTHON_FAST_GIL
jpayne@69 444 #define CYTHON_FAST_GIL (PY_MAJOR_VERSION < 3 || PY_VERSION_HEX >= 0x03060000 && PY_VERSION_HEX < 0x030C00A6)
jpayne@69 445 #endif
jpayne@69 446 #ifndef CYTHON_METH_FASTCALL
jpayne@69 447 #define CYTHON_METH_FASTCALL (PY_VERSION_HEX >= 0x030700A1)
jpayne@69 448 #endif
jpayne@69 449 #ifndef CYTHON_FAST_PYCALL
jpayne@69 450 #define CYTHON_FAST_PYCALL 1
jpayne@69 451 #endif
jpayne@69 452 #ifndef CYTHON_PEP487_INIT_SUBCLASS
jpayne@69 453 #define CYTHON_PEP487_INIT_SUBCLASS 1
jpayne@69 454 #endif
jpayne@69 455 #if PY_VERSION_HEX < 0x03050000
jpayne@69 456 #undef CYTHON_PEP489_MULTI_PHASE_INIT
jpayne@69 457 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
jpayne@69 458 #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT)
jpayne@69 459 #define CYTHON_PEP489_MULTI_PHASE_INIT 1
jpayne@69 460 #endif
jpayne@69 461 #ifndef CYTHON_USE_MODULE_STATE
jpayne@69 462 #define CYTHON_USE_MODULE_STATE 0
jpayne@69 463 #endif
jpayne@69 464 #if PY_VERSION_HEX < 0x030400a1
jpayne@69 465 #undef CYTHON_USE_TP_FINALIZE
jpayne@69 466 #define CYTHON_USE_TP_FINALIZE 0
jpayne@69 467 #elif !defined(CYTHON_USE_TP_FINALIZE)
jpayne@69 468 #define CYTHON_USE_TP_FINALIZE 1
jpayne@69 469 #endif
jpayne@69 470 #if PY_VERSION_HEX < 0x030600B1
jpayne@69 471 #undef CYTHON_USE_DICT_VERSIONS
jpayne@69 472 #define CYTHON_USE_DICT_VERSIONS 0
jpayne@69 473 #elif !defined(CYTHON_USE_DICT_VERSIONS)
jpayne@69 474 #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX < 0x030C00A5)
jpayne@69 475 #endif
jpayne@69 476 #if PY_VERSION_HEX < 0x030700A3
jpayne@69 477 #undef CYTHON_USE_EXC_INFO_STACK
jpayne@69 478 #define CYTHON_USE_EXC_INFO_STACK 0
jpayne@69 479 #elif !defined(CYTHON_USE_EXC_INFO_STACK)
jpayne@69 480 #define CYTHON_USE_EXC_INFO_STACK 1
jpayne@69 481 #endif
jpayne@69 482 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
jpayne@69 483 #define CYTHON_UPDATE_DESCRIPTOR_DOC 1
jpayne@69 484 #endif
jpayne@69 485 #ifndef CYTHON_USE_FREELISTS
jpayne@69 486 #define CYTHON_USE_FREELISTS 1
jpayne@69 487 #endif
jpayne@69 488 #endif
jpayne@69 489 #if !defined(CYTHON_FAST_PYCCALL)
jpayne@69 490 #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
jpayne@69 491 #endif
jpayne@69 492 #if !defined(CYTHON_VECTORCALL)
jpayne@69 493 #define CYTHON_VECTORCALL (CYTHON_FAST_PYCCALL && PY_VERSION_HEX >= 0x030800B1)
jpayne@69 494 #endif
jpayne@69 495 #define CYTHON_BACKPORT_VECTORCALL (CYTHON_METH_FASTCALL && PY_VERSION_HEX < 0x030800B1)
jpayne@69 496 #if CYTHON_USE_PYLONG_INTERNALS
jpayne@69 497 #if PY_MAJOR_VERSION < 3
jpayne@69 498 #include "longintrepr.h"
jpayne@69 499 #endif
jpayne@69 500 #undef SHIFT
jpayne@69 501 #undef BASE
jpayne@69 502 #undef MASK
jpayne@69 503 #ifdef SIZEOF_VOID_P
jpayne@69 504 enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
jpayne@69 505 #endif
jpayne@69 506 #endif
jpayne@69 507 #ifndef __has_attribute
jpayne@69 508 #define __has_attribute(x) 0
jpayne@69 509 #endif
jpayne@69 510 #ifndef __has_cpp_attribute
jpayne@69 511 #define __has_cpp_attribute(x) 0
jpayne@69 512 #endif
jpayne@69 513 #ifndef CYTHON_RESTRICT
jpayne@69 514 #if defined(__GNUC__)
jpayne@69 515 #define CYTHON_RESTRICT __restrict__
jpayne@69 516 #elif defined(_MSC_VER) && _MSC_VER >= 1400
jpayne@69 517 #define CYTHON_RESTRICT __restrict
jpayne@69 518 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
jpayne@69 519 #define CYTHON_RESTRICT restrict
jpayne@69 520 #else
jpayne@69 521 #define CYTHON_RESTRICT
jpayne@69 522 #endif
jpayne@69 523 #endif
jpayne@69 524 #ifndef CYTHON_UNUSED
jpayne@69 525 #if defined(__cplusplus)
jpayne@69 526 /* for clang __has_cpp_attribute(maybe_unused) is true even before C++17
jpayne@69 527 * but leads to warnings with -pedantic, since it is a C++17 feature */
jpayne@69 528 #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
jpayne@69 529 #if __has_cpp_attribute(maybe_unused)
jpayne@69 530 #define CYTHON_UNUSED [[maybe_unused]]
jpayne@69 531 #endif
jpayne@69 532 #endif
jpayne@69 533 #endif
jpayne@69 534 #endif
jpayne@69 535 #ifndef CYTHON_UNUSED
jpayne@69 536 # if defined(__GNUC__)
jpayne@69 537 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
jpayne@69 538 # define CYTHON_UNUSED __attribute__ ((__unused__))
jpayne@69 539 # else
jpayne@69 540 # define CYTHON_UNUSED
jpayne@69 541 # endif
jpayne@69 542 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
jpayne@69 543 # define CYTHON_UNUSED __attribute__ ((__unused__))
jpayne@69 544 # else
jpayne@69 545 # define CYTHON_UNUSED
jpayne@69 546 # endif
jpayne@69 547 #endif
jpayne@69 548 #ifndef CYTHON_UNUSED_VAR
jpayne@69 549 # if defined(__cplusplus)
jpayne@69 550 template<class T> void CYTHON_UNUSED_VAR( const T& ) { }
jpayne@69 551 # else
jpayne@69 552 # define CYTHON_UNUSED_VAR(x) (void)(x)
jpayne@69 553 # endif
jpayne@69 554 #endif
jpayne@69 555 #ifndef CYTHON_MAYBE_UNUSED_VAR
jpayne@69 556 #define CYTHON_MAYBE_UNUSED_VAR(x) CYTHON_UNUSED_VAR(x)
jpayne@69 557 #endif
jpayne@69 558 #ifndef CYTHON_NCP_UNUSED
jpayne@69 559 # if CYTHON_COMPILING_IN_CPYTHON
jpayne@69 560 # define CYTHON_NCP_UNUSED
jpayne@69 561 # else
jpayne@69 562 # define CYTHON_NCP_UNUSED CYTHON_UNUSED
jpayne@69 563 # endif
jpayne@69 564 #endif
jpayne@69 565 #ifndef CYTHON_USE_CPP_STD_MOVE
jpayne@69 566 #if defined(__cplusplus) && (\
jpayne@69 567 __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600))
jpayne@69 568 #define CYTHON_USE_CPP_STD_MOVE 1
jpayne@69 569 #else
jpayne@69 570 #define CYTHON_USE_CPP_STD_MOVE 0
jpayne@69 571 #endif
jpayne@69 572 #endif
jpayne@69 573 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
jpayne@69 574 #ifdef _MSC_VER
jpayne@69 575 #ifndef _MSC_STDINT_H_
jpayne@69 576 #if _MSC_VER < 1300
jpayne@69 577 typedef unsigned char uint8_t;
jpayne@69 578 typedef unsigned short uint16_t;
jpayne@69 579 typedef unsigned int uint32_t;
jpayne@69 580 #else
jpayne@69 581 typedef unsigned __int8 uint8_t;
jpayne@69 582 typedef unsigned __int16 uint16_t;
jpayne@69 583 typedef unsigned __int32 uint32_t;
jpayne@69 584 #endif
jpayne@69 585 #endif
jpayne@69 586 #if _MSC_VER < 1300
jpayne@69 587 #ifdef _WIN64
jpayne@69 588 typedef unsigned long long __pyx_uintptr_t;
jpayne@69 589 #else
jpayne@69 590 typedef unsigned int __pyx_uintptr_t;
jpayne@69 591 #endif
jpayne@69 592 #else
jpayne@69 593 #ifdef _WIN64
jpayne@69 594 typedef unsigned __int64 __pyx_uintptr_t;
jpayne@69 595 #else
jpayne@69 596 typedef unsigned __int32 __pyx_uintptr_t;
jpayne@69 597 #endif
jpayne@69 598 #endif
jpayne@69 599 #else
jpayne@69 600 #include <stdint.h>
jpayne@69 601 typedef uintptr_t __pyx_uintptr_t;
jpayne@69 602 #endif
jpayne@69 603 #ifndef CYTHON_FALLTHROUGH
jpayne@69 604 #if defined(__cplusplus)
jpayne@69 605 /* for clang __has_cpp_attribute(fallthrough) is true even before C++17
jpayne@69 606 * but leads to warnings with -pedantic, since it is a C++17 feature */
jpayne@69 607 #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
jpayne@69 608 #if __has_cpp_attribute(fallthrough)
jpayne@69 609 #define CYTHON_FALLTHROUGH [[fallthrough]]
jpayne@69 610 #endif
jpayne@69 611 #endif
jpayne@69 612 #ifndef CYTHON_FALLTHROUGH
jpayne@69 613 #if __has_cpp_attribute(clang::fallthrough)
jpayne@69 614 #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
jpayne@69 615 #elif __has_cpp_attribute(gnu::fallthrough)
jpayne@69 616 #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
jpayne@69 617 #endif
jpayne@69 618 #endif
jpayne@69 619 #endif
jpayne@69 620 #ifndef CYTHON_FALLTHROUGH
jpayne@69 621 #if __has_attribute(fallthrough)
jpayne@69 622 #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
jpayne@69 623 #else
jpayne@69 624 #define CYTHON_FALLTHROUGH
jpayne@69 625 #endif
jpayne@69 626 #endif
jpayne@69 627 #if defined(__clang__) && defined(__apple_build_version__)
jpayne@69 628 #if __apple_build_version__ < 7000000
jpayne@69 629 #undef CYTHON_FALLTHROUGH
jpayne@69 630 #define CYTHON_FALLTHROUGH
jpayne@69 631 #endif
jpayne@69 632 #endif
jpayne@69 633 #endif
jpayne@69 634 #ifdef __cplusplus
jpayne@69 635 template <typename T>
jpayne@69 636 struct __PYX_IS_UNSIGNED_IMPL {static const bool value = T(0) < T(-1);};
jpayne@69 637 #define __PYX_IS_UNSIGNED(type) (__PYX_IS_UNSIGNED_IMPL<type>::value)
jpayne@69 638 #else
jpayne@69 639 #define __PYX_IS_UNSIGNED(type) (((type)-1) > 0)
jpayne@69 640 #endif
jpayne@69 641 #if CYTHON_COMPILING_IN_PYPY == 1
jpayne@69 642 #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x030A0000)
jpayne@69 643 #else
jpayne@69 644 #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000)
jpayne@69 645 #endif
jpayne@69 646 #define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer))
jpayne@69 647
jpayne@69 648 #ifndef CYTHON_INLINE
jpayne@69 649 #if defined(__clang__)
jpayne@69 650 #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
jpayne@69 651 #elif defined(__GNUC__)
jpayne@69 652 #define CYTHON_INLINE __inline__
jpayne@69 653 #elif defined(_MSC_VER)
jpayne@69 654 #define CYTHON_INLINE __inline
jpayne@69 655 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
jpayne@69 656 #define CYTHON_INLINE inline
jpayne@69 657 #else
jpayne@69 658 #define CYTHON_INLINE
jpayne@69 659 #endif
jpayne@69 660 #endif
jpayne@69 661
jpayne@69 662 #define __PYX_BUILD_PY_SSIZE_T "n"
jpayne@69 663 #define CYTHON_FORMAT_SSIZE_T "z"
jpayne@69 664 #if PY_MAJOR_VERSION < 3
jpayne@69 665 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
jpayne@69 666 #define __Pyx_DefaultClassType PyClass_Type
jpayne@69 667 #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
jpayne@69 668 PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
jpayne@69 669 #else
jpayne@69 670 #define __Pyx_BUILTIN_MODULE_NAME "builtins"
jpayne@69 671 #define __Pyx_DefaultClassType PyType_Type
jpayne@69 672 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 673 static CYTHON_INLINE PyObject* __Pyx_PyCode_New(int a, int p, int k, int l, int s, int f,
jpayne@69 674 PyObject *code, PyObject *c, PyObject* n, PyObject *v,
jpayne@69 675 PyObject *fv, PyObject *cell, PyObject* fn,
jpayne@69 676 PyObject *name, int fline, PyObject *lnos) {
jpayne@69 677 PyObject *exception_table = NULL;
jpayne@69 678 PyObject *types_module=NULL, *code_type=NULL, *result=NULL;
jpayne@69 679 #if __PYX_LIMITED_VERSION_HEX < 0x030B0000
jpayne@69 680 PyObject *version_info;
jpayne@69 681 PyObject *py_minor_version = NULL;
jpayne@69 682 #endif
jpayne@69 683 long minor_version = 0;
jpayne@69 684 PyObject *type, *value, *traceback;
jpayne@69 685 PyErr_Fetch(&type, &value, &traceback);
jpayne@69 686 #if __PYX_LIMITED_VERSION_HEX >= 0x030B0000
jpayne@69 687 minor_version = 11;
jpayne@69 688 #else
jpayne@69 689 if (!(version_info = PySys_GetObject("version_info"))) goto end;
jpayne@69 690 if (!(py_minor_version = PySequence_GetItem(version_info, 1))) goto end;
jpayne@69 691 minor_version = PyLong_AsLong(py_minor_version);
jpayne@69 692 Py_DECREF(py_minor_version);
jpayne@69 693 if (minor_version == -1 && PyErr_Occurred()) goto end;
jpayne@69 694 #endif
jpayne@69 695 if (!(types_module = PyImport_ImportModule("types"))) goto end;
jpayne@69 696 if (!(code_type = PyObject_GetAttrString(types_module, "CodeType"))) goto end;
jpayne@69 697 if (minor_version <= 7) {
jpayne@69 698 (void)p;
jpayne@69 699 result = PyObject_CallFunction(code_type, "iiiiiOOOOOOiOO", a, k, l, s, f, code,
jpayne@69 700 c, n, v, fn, name, fline, lnos, fv, cell);
jpayne@69 701 } else if (minor_version <= 10) {
jpayne@69 702 result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOiOO", a,p, k, l, s, f, code,
jpayne@69 703 c, n, v, fn, name, fline, lnos, fv, cell);
jpayne@69 704 } else {
jpayne@69 705 if (!(exception_table = PyBytes_FromStringAndSize(NULL, 0))) goto end;
jpayne@69 706 result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOOiOO", a,p, k, l, s, f, code,
jpayne@69 707 c, n, v, fn, name, name, fline, lnos, exception_table, fv, cell);
jpayne@69 708 }
jpayne@69 709 end:
jpayne@69 710 Py_XDECREF(code_type);
jpayne@69 711 Py_XDECREF(exception_table);
jpayne@69 712 Py_XDECREF(types_module);
jpayne@69 713 if (type) {
jpayne@69 714 PyErr_Restore(type, value, traceback);
jpayne@69 715 }
jpayne@69 716 return result;
jpayne@69 717 }
jpayne@69 718 #ifndef CO_OPTIMIZED
jpayne@69 719 #define CO_OPTIMIZED 0x0001
jpayne@69 720 #endif
jpayne@69 721 #ifndef CO_NEWLOCALS
jpayne@69 722 #define CO_NEWLOCALS 0x0002
jpayne@69 723 #endif
jpayne@69 724 #ifndef CO_VARARGS
jpayne@69 725 #define CO_VARARGS 0x0004
jpayne@69 726 #endif
jpayne@69 727 #ifndef CO_VARKEYWORDS
jpayne@69 728 #define CO_VARKEYWORDS 0x0008
jpayne@69 729 #endif
jpayne@69 730 #ifndef CO_ASYNC_GENERATOR
jpayne@69 731 #define CO_ASYNC_GENERATOR 0x0200
jpayne@69 732 #endif
jpayne@69 733 #ifndef CO_GENERATOR
jpayne@69 734 #define CO_GENERATOR 0x0020
jpayne@69 735 #endif
jpayne@69 736 #ifndef CO_COROUTINE
jpayne@69 737 #define CO_COROUTINE 0x0080
jpayne@69 738 #endif
jpayne@69 739 #elif PY_VERSION_HEX >= 0x030B0000
jpayne@69 740 static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int p, int k, int l, int s, int f,
jpayne@69 741 PyObject *code, PyObject *c, PyObject* n, PyObject *v,
jpayne@69 742 PyObject *fv, PyObject *cell, PyObject* fn,
jpayne@69 743 PyObject *name, int fline, PyObject *lnos) {
jpayne@69 744 PyCodeObject *result;
jpayne@69 745 PyObject *empty_bytes = PyBytes_FromStringAndSize("", 0);
jpayne@69 746 if (!empty_bytes) return NULL;
jpayne@69 747 result =
jpayne@69 748 #if PY_VERSION_HEX >= 0x030C0000
jpayne@69 749 PyUnstable_Code_NewWithPosOnlyArgs
jpayne@69 750 #else
jpayne@69 751 PyCode_NewWithPosOnlyArgs
jpayne@69 752 #endif
jpayne@69 753 (a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, name, fline, lnos, empty_bytes);
jpayne@69 754 Py_DECREF(empty_bytes);
jpayne@69 755 return result;
jpayne@69 756 }
jpayne@69 757 #elif PY_VERSION_HEX >= 0x030800B2 && !CYTHON_COMPILING_IN_PYPY
jpayne@69 758 #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
jpayne@69 759 PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
jpayne@69 760 #else
jpayne@69 761 #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
jpayne@69 762 PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
jpayne@69 763 #endif
jpayne@69 764 #endif
jpayne@69 765 #if PY_VERSION_HEX >= 0x030900A4 || defined(Py_IS_TYPE)
jpayne@69 766 #define __Pyx_IS_TYPE(ob, type) Py_IS_TYPE(ob, type)
jpayne@69 767 #else
jpayne@69 768 #define __Pyx_IS_TYPE(ob, type) (((const PyObject*)ob)->ob_type == (type))
jpayne@69 769 #endif
jpayne@69 770 #if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_Is)
jpayne@69 771 #define __Pyx_Py_Is(x, y) Py_Is(x, y)
jpayne@69 772 #else
jpayne@69 773 #define __Pyx_Py_Is(x, y) ((x) == (y))
jpayne@69 774 #endif
jpayne@69 775 #if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsNone)
jpayne@69 776 #define __Pyx_Py_IsNone(ob) Py_IsNone(ob)
jpayne@69 777 #else
jpayne@69 778 #define __Pyx_Py_IsNone(ob) __Pyx_Py_Is((ob), Py_None)
jpayne@69 779 #endif
jpayne@69 780 #if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsTrue)
jpayne@69 781 #define __Pyx_Py_IsTrue(ob) Py_IsTrue(ob)
jpayne@69 782 #else
jpayne@69 783 #define __Pyx_Py_IsTrue(ob) __Pyx_Py_Is((ob), Py_True)
jpayne@69 784 #endif
jpayne@69 785 #if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsFalse)
jpayne@69 786 #define __Pyx_Py_IsFalse(ob) Py_IsFalse(ob)
jpayne@69 787 #else
jpayne@69 788 #define __Pyx_Py_IsFalse(ob) __Pyx_Py_Is((ob), Py_False)
jpayne@69 789 #endif
jpayne@69 790 #define __Pyx_NoneAsNull(obj) (__Pyx_Py_IsNone(obj) ? NULL : (obj))
jpayne@69 791 #if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY
jpayne@69 792 #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o)
jpayne@69 793 #else
jpayne@69 794 #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o)
jpayne@69 795 #endif
jpayne@69 796 #ifndef CO_COROUTINE
jpayne@69 797 #define CO_COROUTINE 0x80
jpayne@69 798 #endif
jpayne@69 799 #ifndef CO_ASYNC_GENERATOR
jpayne@69 800 #define CO_ASYNC_GENERATOR 0x200
jpayne@69 801 #endif
jpayne@69 802 #ifndef Py_TPFLAGS_CHECKTYPES
jpayne@69 803 #define Py_TPFLAGS_CHECKTYPES 0
jpayne@69 804 #endif
jpayne@69 805 #ifndef Py_TPFLAGS_HAVE_INDEX
jpayne@69 806 #define Py_TPFLAGS_HAVE_INDEX 0
jpayne@69 807 #endif
jpayne@69 808 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
jpayne@69 809 #define Py_TPFLAGS_HAVE_NEWBUFFER 0
jpayne@69 810 #endif
jpayne@69 811 #ifndef Py_TPFLAGS_HAVE_FINALIZE
jpayne@69 812 #define Py_TPFLAGS_HAVE_FINALIZE 0
jpayne@69 813 #endif
jpayne@69 814 #ifndef Py_TPFLAGS_SEQUENCE
jpayne@69 815 #define Py_TPFLAGS_SEQUENCE 0
jpayne@69 816 #endif
jpayne@69 817 #ifndef Py_TPFLAGS_MAPPING
jpayne@69 818 #define Py_TPFLAGS_MAPPING 0
jpayne@69 819 #endif
jpayne@69 820 #ifndef METH_STACKLESS
jpayne@69 821 #define METH_STACKLESS 0
jpayne@69 822 #endif
jpayne@69 823 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
jpayne@69 824 #ifndef METH_FASTCALL
jpayne@69 825 #define METH_FASTCALL 0x80
jpayne@69 826 #endif
jpayne@69 827 typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
jpayne@69 828 typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
jpayne@69 829 Py_ssize_t nargs, PyObject *kwnames);
jpayne@69 830 #else
jpayne@69 831 #if PY_VERSION_HEX >= 0x030d00A4
jpayne@69 832 # define __Pyx_PyCFunctionFast PyCFunctionFast
jpayne@69 833 # define __Pyx_PyCFunctionFastWithKeywords PyCFunctionFastWithKeywords
jpayne@69 834 #else
jpayne@69 835 # define __Pyx_PyCFunctionFast _PyCFunctionFast
jpayne@69 836 # define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
jpayne@69 837 #endif
jpayne@69 838 #endif
jpayne@69 839 #if CYTHON_METH_FASTCALL
jpayne@69 840 #define __Pyx_METH_FASTCALL METH_FASTCALL
jpayne@69 841 #define __Pyx_PyCFunction_FastCall __Pyx_PyCFunctionFast
jpayne@69 842 #define __Pyx_PyCFunction_FastCallWithKeywords __Pyx_PyCFunctionFastWithKeywords
jpayne@69 843 #else
jpayne@69 844 #define __Pyx_METH_FASTCALL METH_VARARGS
jpayne@69 845 #define __Pyx_PyCFunction_FastCall PyCFunction
jpayne@69 846 #define __Pyx_PyCFunction_FastCallWithKeywords PyCFunctionWithKeywords
jpayne@69 847 #endif
jpayne@69 848 #if CYTHON_VECTORCALL
jpayne@69 849 #define __pyx_vectorcallfunc vectorcallfunc
jpayne@69 850 #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET PY_VECTORCALL_ARGUMENTS_OFFSET
jpayne@69 851 #define __Pyx_PyVectorcall_NARGS(n) PyVectorcall_NARGS((size_t)(n))
jpayne@69 852 #elif CYTHON_BACKPORT_VECTORCALL
jpayne@69 853 typedef PyObject *(*__pyx_vectorcallfunc)(PyObject *callable, PyObject *const *args,
jpayne@69 854 size_t nargsf, PyObject *kwnames);
jpayne@69 855 #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET ((size_t)1 << (8 * sizeof(size_t) - 1))
jpayne@69 856 #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(((size_t)(n)) & ~__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET))
jpayne@69 857 #else
jpayne@69 858 #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET 0
jpayne@69 859 #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(n))
jpayne@69 860 #endif
jpayne@69 861 #if PY_MAJOR_VERSION >= 0x030900B1
jpayne@69 862 #define __Pyx_PyCFunction_CheckExact(func) PyCFunction_CheckExact(func)
jpayne@69 863 #else
jpayne@69 864 #define __Pyx_PyCFunction_CheckExact(func) PyCFunction_Check(func)
jpayne@69 865 #endif
jpayne@69 866 #define __Pyx_CyOrPyCFunction_Check(func) PyCFunction_Check(func)
jpayne@69 867 #if CYTHON_COMPILING_IN_CPYTHON
jpayne@69 868 #define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) (((PyCFunctionObject*)(func))->m_ml->ml_meth)
jpayne@69 869 #elif !CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 870 #define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) PyCFunction_GET_FUNCTION(func)
jpayne@69 871 #endif
jpayne@69 872 #if CYTHON_COMPILING_IN_CPYTHON
jpayne@69 873 #define __Pyx_CyOrPyCFunction_GET_FLAGS(func) (((PyCFunctionObject*)(func))->m_ml->ml_flags)
jpayne@69 874 static CYTHON_INLINE PyObject* __Pyx_CyOrPyCFunction_GET_SELF(PyObject *func) {
jpayne@69 875 return (__Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_STATIC) ? NULL : ((PyCFunctionObject*)func)->m_self;
jpayne@69 876 }
jpayne@69 877 #endif
jpayne@69 878 static CYTHON_INLINE int __Pyx__IsSameCFunction(PyObject *func, void *cfunc) {
jpayne@69 879 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 880 return PyCFunction_Check(func) && PyCFunction_GetFunction(func) == (PyCFunction) cfunc;
jpayne@69 881 #else
jpayne@69 882 return PyCFunction_Check(func) && PyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc;
jpayne@69 883 #endif
jpayne@69 884 }
jpayne@69 885 #define __Pyx_IsSameCFunction(func, cfunc) __Pyx__IsSameCFunction(func, cfunc)
jpayne@69 886 #if __PYX_LIMITED_VERSION_HEX < 0x030900B1
jpayne@69 887 #define __Pyx_PyType_FromModuleAndSpec(m, s, b) ((void)m, PyType_FromSpecWithBases(s, b))
jpayne@69 888 typedef PyObject *(*__Pyx_PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *, size_t, PyObject *);
jpayne@69 889 #else
jpayne@69 890 #define __Pyx_PyType_FromModuleAndSpec(m, s, b) PyType_FromModuleAndSpec(m, s, b)
jpayne@69 891 #define __Pyx_PyCMethod PyCMethod
jpayne@69 892 #endif
jpayne@69 893 #ifndef METH_METHOD
jpayne@69 894 #define METH_METHOD 0x200
jpayne@69 895 #endif
jpayne@69 896 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
jpayne@69 897 #define PyObject_Malloc(s) PyMem_Malloc(s)
jpayne@69 898 #define PyObject_Free(p) PyMem_Free(p)
jpayne@69 899 #define PyObject_Realloc(p) PyMem_Realloc(p)
jpayne@69 900 #endif
jpayne@69 901 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 902 #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
jpayne@69 903 #define __Pyx_PyFrame_SetLineNumber(frame, lineno)
jpayne@69 904 #else
jpayne@69 905 #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
jpayne@69 906 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
jpayne@69 907 #endif
jpayne@69 908 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 909 #define __Pyx_PyThreadState_Current PyThreadState_Get()
jpayne@69 910 #elif !CYTHON_FAST_THREAD_STATE
jpayne@69 911 #define __Pyx_PyThreadState_Current PyThreadState_GET()
jpayne@69 912 #elif PY_VERSION_HEX >= 0x030d00A1
jpayne@69 913 #define __Pyx_PyThreadState_Current PyThreadState_GetUnchecked()
jpayne@69 914 #elif PY_VERSION_HEX >= 0x03060000
jpayne@69 915 #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
jpayne@69 916 #elif PY_VERSION_HEX >= 0x03000000
jpayne@69 917 #define __Pyx_PyThreadState_Current PyThreadState_GET()
jpayne@69 918 #else
jpayne@69 919 #define __Pyx_PyThreadState_Current _PyThreadState_Current
jpayne@69 920 #endif
jpayne@69 921 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 922 static CYTHON_INLINE void *__Pyx_PyModule_GetState(PyObject *op)
jpayne@69 923 {
jpayne@69 924 void *result;
jpayne@69 925 result = PyModule_GetState(op);
jpayne@69 926 if (!result)
jpayne@69 927 Py_FatalError("Couldn't find the module state");
jpayne@69 928 return result;
jpayne@69 929 }
jpayne@69 930 #endif
jpayne@69 931 #define __Pyx_PyObject_GetSlot(obj, name, func_ctype) __Pyx_PyType_GetSlot(Py_TYPE(obj), name, func_ctype)
jpayne@69 932 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 933 #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((func_ctype) PyType_GetSlot((type), Py_##name))
jpayne@69 934 #else
jpayne@69 935 #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((type)->name)
jpayne@69 936 #endif
jpayne@69 937 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
jpayne@69 938 #include "pythread.h"
jpayne@69 939 #define Py_tss_NEEDS_INIT 0
jpayne@69 940 typedef int Py_tss_t;
jpayne@69 941 static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
jpayne@69 942 *key = PyThread_create_key();
jpayne@69 943 return 0;
jpayne@69 944 }
jpayne@69 945 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
jpayne@69 946 Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
jpayne@69 947 *key = Py_tss_NEEDS_INIT;
jpayne@69 948 return key;
jpayne@69 949 }
jpayne@69 950 static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
jpayne@69 951 PyObject_Free(key);
jpayne@69 952 }
jpayne@69 953 static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
jpayne@69 954 return *key != Py_tss_NEEDS_INIT;
jpayne@69 955 }
jpayne@69 956 static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
jpayne@69 957 PyThread_delete_key(*key);
jpayne@69 958 *key = Py_tss_NEEDS_INIT;
jpayne@69 959 }
jpayne@69 960 static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
jpayne@69 961 return PyThread_set_key_value(*key, value);
jpayne@69 962 }
jpayne@69 963 static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
jpayne@69 964 return PyThread_get_key_value(*key);
jpayne@69 965 }
jpayne@69 966 #endif
jpayne@69 967 #if PY_MAJOR_VERSION < 3
jpayne@69 968 #if CYTHON_COMPILING_IN_PYPY
jpayne@69 969 #if PYPY_VERSION_NUM < 0x07030600
jpayne@69 970 #if defined(__cplusplus) && __cplusplus >= 201402L
jpayne@69 971 [[deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")]]
jpayne@69 972 #elif defined(__GNUC__) || defined(__clang__)
jpayne@69 973 __attribute__ ((__deprecated__("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")))
jpayne@69 974 #elif defined(_MSC_VER)
jpayne@69 975 __declspec(deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6"))
jpayne@69 976 #endif
jpayne@69 977 static CYTHON_INLINE int PyGILState_Check(void) {
jpayne@69 978 return 0;
jpayne@69 979 }
jpayne@69 980 #else // PYPY_VERSION_NUM < 0x07030600
jpayne@69 981 #endif // PYPY_VERSION_NUM < 0x07030600
jpayne@69 982 #else
jpayne@69 983 static CYTHON_INLINE int PyGILState_Check(void) {
jpayne@69 984 PyThreadState * tstate = _PyThreadState_Current;
jpayne@69 985 return tstate && (tstate == PyGILState_GetThisThreadState());
jpayne@69 986 }
jpayne@69 987 #endif
jpayne@69 988 #endif
jpayne@69 989 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000 || defined(_PyDict_NewPresized)
jpayne@69 990 #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
jpayne@69 991 #else
jpayne@69 992 #define __Pyx_PyDict_NewPresized(n) PyDict_New()
jpayne@69 993 #endif
jpayne@69 994 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
jpayne@69 995 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
jpayne@69 996 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
jpayne@69 997 #else
jpayne@69 998 #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
jpayne@69 999 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
jpayne@69 1000 #endif
jpayne@69 1001 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX > 0x030600B4 && PY_VERSION_HEX < 0x030d0000 && CYTHON_USE_UNICODE_INTERNALS
jpayne@69 1002 #define __Pyx_PyDict_GetItemStrWithError(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
jpayne@69 1003 static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStr(PyObject *dict, PyObject *name) {
jpayne@69 1004 PyObject *res = __Pyx_PyDict_GetItemStrWithError(dict, name);
jpayne@69 1005 if (res == NULL) PyErr_Clear();
jpayne@69 1006 return res;
jpayne@69 1007 }
jpayne@69 1008 #elif PY_MAJOR_VERSION >= 3 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000)
jpayne@69 1009 #define __Pyx_PyDict_GetItemStrWithError PyDict_GetItemWithError
jpayne@69 1010 #define __Pyx_PyDict_GetItemStr PyDict_GetItem
jpayne@69 1011 #else
jpayne@69 1012 static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, PyObject *name) {
jpayne@69 1013 #if CYTHON_COMPILING_IN_PYPY
jpayne@69 1014 return PyDict_GetItem(dict, name);
jpayne@69 1015 #else
jpayne@69 1016 PyDictEntry *ep;
jpayne@69 1017 PyDictObject *mp = (PyDictObject*) dict;
jpayne@69 1018 long hash = ((PyStringObject *) name)->ob_shash;
jpayne@69 1019 assert(hash != -1);
jpayne@69 1020 ep = (mp->ma_lookup)(mp, name, hash);
jpayne@69 1021 if (ep == NULL) {
jpayne@69 1022 return NULL;
jpayne@69 1023 }
jpayne@69 1024 return ep->me_value;
jpayne@69 1025 #endif
jpayne@69 1026 }
jpayne@69 1027 #define __Pyx_PyDict_GetItemStr PyDict_GetItem
jpayne@69 1028 #endif
jpayne@69 1029 #if CYTHON_USE_TYPE_SLOTS
jpayne@69 1030 #define __Pyx_PyType_GetFlags(tp) (((PyTypeObject *)tp)->tp_flags)
jpayne@69 1031 #define __Pyx_PyType_HasFeature(type, feature) ((__Pyx_PyType_GetFlags(type) & (feature)) != 0)
jpayne@69 1032 #define __Pyx_PyObject_GetIterNextFunc(obj) (Py_TYPE(obj)->tp_iternext)
jpayne@69 1033 #else
jpayne@69 1034 #define __Pyx_PyType_GetFlags(tp) (PyType_GetFlags((PyTypeObject *)tp))
jpayne@69 1035 #define __Pyx_PyType_HasFeature(type, feature) PyType_HasFeature(type, feature)
jpayne@69 1036 #define __Pyx_PyObject_GetIterNextFunc(obj) PyIter_Next
jpayne@69 1037 #endif
jpayne@69 1038 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 1039 #define __Pyx_SetItemOnTypeDict(tp, k, v) PyObject_GenericSetAttr((PyObject*)tp, k, v)
jpayne@69 1040 #else
jpayne@69 1041 #define __Pyx_SetItemOnTypeDict(tp, k, v) PyDict_SetItem(tp->tp_dict, k, v)
jpayne@69 1042 #endif
jpayne@69 1043 #if CYTHON_USE_TYPE_SPECS && PY_VERSION_HEX >= 0x03080000
jpayne@69 1044 #define __Pyx_PyHeapTypeObject_GC_Del(obj) {\
jpayne@69 1045 PyTypeObject *type = Py_TYPE((PyObject*)obj);\
jpayne@69 1046 assert(__Pyx_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE));\
jpayne@69 1047 PyObject_GC_Del(obj);\
jpayne@69 1048 Py_DECREF(type);\
jpayne@69 1049 }
jpayne@69 1050 #else
jpayne@69 1051 #define __Pyx_PyHeapTypeObject_GC_Del(obj) PyObject_GC_Del(obj)
jpayne@69 1052 #endif
jpayne@69 1053 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 1054 #define CYTHON_PEP393_ENABLED 1
jpayne@69 1055 #define __Pyx_PyUnicode_READY(op) (0)
jpayne@69 1056 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GetLength(u)
jpayne@69 1057 #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_ReadChar(u, i)
jpayne@69 1058 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((void)u, 1114111U)
jpayne@69 1059 #define __Pyx_PyUnicode_KIND(u) ((void)u, (0))
jpayne@69 1060 #define __Pyx_PyUnicode_DATA(u) ((void*)u)
jpayne@69 1061 #define __Pyx_PyUnicode_READ(k, d, i) ((void)k, PyUnicode_ReadChar((PyObject*)(d), i))
jpayne@69 1062 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GetLength(u))
jpayne@69 1063 #elif PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
jpayne@69 1064 #define CYTHON_PEP393_ENABLED 1
jpayne@69 1065 #if PY_VERSION_HEX >= 0x030C0000
jpayne@69 1066 #define __Pyx_PyUnicode_READY(op) (0)
jpayne@69 1067 #else
jpayne@69 1068 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
jpayne@69 1069 0 : _PyUnicode_Ready((PyObject *)(op)))
jpayne@69 1070 #endif
jpayne@69 1071 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
jpayne@69 1072 #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
jpayne@69 1073 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
jpayne@69 1074 #define __Pyx_PyUnicode_KIND(u) ((int)PyUnicode_KIND(u))
jpayne@69 1075 #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
jpayne@69 1076 #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
jpayne@69 1077 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, (Py_UCS4) ch)
jpayne@69 1078 #if PY_VERSION_HEX >= 0x030C0000
jpayne@69 1079 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u))
jpayne@69 1080 #else
jpayne@69 1081 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000
jpayne@69 1082 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length))
jpayne@69 1083 #else
jpayne@69 1084 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
jpayne@69 1085 #endif
jpayne@69 1086 #endif
jpayne@69 1087 #else
jpayne@69 1088 #define CYTHON_PEP393_ENABLED 0
jpayne@69 1089 #define PyUnicode_1BYTE_KIND 1
jpayne@69 1090 #define PyUnicode_2BYTE_KIND 2
jpayne@69 1091 #define PyUnicode_4BYTE_KIND 4
jpayne@69 1092 #define __Pyx_PyUnicode_READY(op) (0)
jpayne@69 1093 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
jpayne@69 1094 #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
jpayne@69 1095 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535U : 1114111U)
jpayne@69 1096 #define __Pyx_PyUnicode_KIND(u) ((int)sizeof(Py_UNICODE))
jpayne@69 1097 #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
jpayne@69 1098 #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
jpayne@69 1099 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = (Py_UNICODE) ch)
jpayne@69 1100 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
jpayne@69 1101 #endif
jpayne@69 1102 #if CYTHON_COMPILING_IN_PYPY
jpayne@69 1103 #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
jpayne@69 1104 #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
jpayne@69 1105 #else
jpayne@69 1106 #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
jpayne@69 1107 #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
jpayne@69 1108 PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
jpayne@69 1109 #endif
jpayne@69 1110 #if CYTHON_COMPILING_IN_PYPY
jpayne@69 1111 #if !defined(PyUnicode_DecodeUnicodeEscape)
jpayne@69 1112 #define PyUnicode_DecodeUnicodeEscape(s, size, errors) PyUnicode_Decode(s, size, "unicode_escape", errors)
jpayne@69 1113 #endif
jpayne@69 1114 #if !defined(PyUnicode_Contains) || (PY_MAJOR_VERSION == 2 && PYPY_VERSION_NUM < 0x07030500)
jpayne@69 1115 #undef PyUnicode_Contains
jpayne@69 1116 #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
jpayne@69 1117 #endif
jpayne@69 1118 #if !defined(PyByteArray_Check)
jpayne@69 1119 #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
jpayne@69 1120 #endif
jpayne@69 1121 #if !defined(PyObject_Format)
jpayne@69 1122 #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
jpayne@69 1123 #endif
jpayne@69 1124 #endif
jpayne@69 1125 #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))
jpayne@69 1126 #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
jpayne@69 1127 #if PY_MAJOR_VERSION >= 3
jpayne@69 1128 #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
jpayne@69 1129 #else
jpayne@69 1130 #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
jpayne@69 1131 #endif
jpayne@69 1132 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
jpayne@69 1133 #define PyObject_ASCII(o) PyObject_Repr(o)
jpayne@69 1134 #endif
jpayne@69 1135 #if PY_MAJOR_VERSION >= 3
jpayne@69 1136 #define PyBaseString_Type PyUnicode_Type
jpayne@69 1137 #define PyStringObject PyUnicodeObject
jpayne@69 1138 #define PyString_Type PyUnicode_Type
jpayne@69 1139 #define PyString_Check PyUnicode_Check
jpayne@69 1140 #define PyString_CheckExact PyUnicode_CheckExact
jpayne@69 1141 #ifndef PyObject_Unicode
jpayne@69 1142 #define PyObject_Unicode PyObject_Str
jpayne@69 1143 #endif
jpayne@69 1144 #endif
jpayne@69 1145 #if PY_MAJOR_VERSION >= 3
jpayne@69 1146 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
jpayne@69 1147 #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
jpayne@69 1148 #else
jpayne@69 1149 #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
jpayne@69 1150 #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
jpayne@69 1151 #endif
jpayne@69 1152 #if CYTHON_COMPILING_IN_CPYTHON
jpayne@69 1153 #define __Pyx_PySequence_ListKeepNew(obj)\
jpayne@69 1154 (likely(PyList_CheckExact(obj) && Py_REFCNT(obj) == 1) ? __Pyx_NewRef(obj) : PySequence_List(obj))
jpayne@69 1155 #else
jpayne@69 1156 #define __Pyx_PySequence_ListKeepNew(obj) PySequence_List(obj)
jpayne@69 1157 #endif
jpayne@69 1158 #ifndef PySet_CheckExact
jpayne@69 1159 #define PySet_CheckExact(obj) __Pyx_IS_TYPE(obj, &PySet_Type)
jpayne@69 1160 #endif
jpayne@69 1161 #if PY_VERSION_HEX >= 0x030900A4
jpayne@69 1162 #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
jpayne@69 1163 #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
jpayne@69 1164 #else
jpayne@69 1165 #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
jpayne@69 1166 #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
jpayne@69 1167 #endif
jpayne@69 1168 #if CYTHON_ASSUME_SAFE_MACROS
jpayne@69 1169 #define __Pyx_PySequence_ITEM(o, i) PySequence_ITEM(o, i)
jpayne@69 1170 #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
jpayne@69 1171 #define __Pyx_PyTuple_SET_ITEM(o, i, v) (PyTuple_SET_ITEM(o, i, v), (0))
jpayne@69 1172 #define __Pyx_PyList_SET_ITEM(o, i, v) (PyList_SET_ITEM(o, i, v), (0))
jpayne@69 1173 #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_GET_SIZE(o)
jpayne@69 1174 #define __Pyx_PyList_GET_SIZE(o) PyList_GET_SIZE(o)
jpayne@69 1175 #define __Pyx_PySet_GET_SIZE(o) PySet_GET_SIZE(o)
jpayne@69 1176 #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_GET_SIZE(o)
jpayne@69 1177 #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_GET_SIZE(o)
jpayne@69 1178 #else
jpayne@69 1179 #define __Pyx_PySequence_ITEM(o, i) PySequence_GetItem(o, i)
jpayne@69 1180 #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
jpayne@69 1181 #define __Pyx_PyTuple_SET_ITEM(o, i, v) PyTuple_SetItem(o, i, v)
jpayne@69 1182 #define __Pyx_PyList_SET_ITEM(o, i, v) PyList_SetItem(o, i, v)
jpayne@69 1183 #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_Size(o)
jpayne@69 1184 #define __Pyx_PyList_GET_SIZE(o) PyList_Size(o)
jpayne@69 1185 #define __Pyx_PySet_GET_SIZE(o) PySet_Size(o)
jpayne@69 1186 #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_Size(o)
jpayne@69 1187 #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_Size(o)
jpayne@69 1188 #endif
jpayne@69 1189 #if __PYX_LIMITED_VERSION_HEX >= 0x030d00A1
jpayne@69 1190 #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name)
jpayne@69 1191 #else
jpayne@69 1192 static CYTHON_INLINE PyObject *__Pyx_PyImport_AddModuleRef(const char *name) {
jpayne@69 1193 PyObject *module = PyImport_AddModule(name);
jpayne@69 1194 Py_XINCREF(module);
jpayne@69 1195 return module;
jpayne@69 1196 }
jpayne@69 1197 #endif
jpayne@69 1198 #if PY_MAJOR_VERSION >= 3
jpayne@69 1199 #define PyIntObject PyLongObject
jpayne@69 1200 #define PyInt_Type PyLong_Type
jpayne@69 1201 #define PyInt_Check(op) PyLong_Check(op)
jpayne@69 1202 #define PyInt_CheckExact(op) PyLong_CheckExact(op)
jpayne@69 1203 #define __Pyx_Py3Int_Check(op) PyLong_Check(op)
jpayne@69 1204 #define __Pyx_Py3Int_CheckExact(op) PyLong_CheckExact(op)
jpayne@69 1205 #define PyInt_FromString PyLong_FromString
jpayne@69 1206 #define PyInt_FromUnicode PyLong_FromUnicode
jpayne@69 1207 #define PyInt_FromLong PyLong_FromLong
jpayne@69 1208 #define PyInt_FromSize_t PyLong_FromSize_t
jpayne@69 1209 #define PyInt_FromSsize_t PyLong_FromSsize_t
jpayne@69 1210 #define PyInt_AsLong PyLong_AsLong
jpayne@69 1211 #define PyInt_AS_LONG PyLong_AS_LONG
jpayne@69 1212 #define PyInt_AsSsize_t PyLong_AsSsize_t
jpayne@69 1213 #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
jpayne@69 1214 #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
jpayne@69 1215 #define PyNumber_Int PyNumber_Long
jpayne@69 1216 #else
jpayne@69 1217 #define __Pyx_Py3Int_Check(op) (PyLong_Check(op) || PyInt_Check(op))
jpayne@69 1218 #define __Pyx_Py3Int_CheckExact(op) (PyLong_CheckExact(op) || PyInt_CheckExact(op))
jpayne@69 1219 #endif
jpayne@69 1220 #if PY_MAJOR_VERSION >= 3
jpayne@69 1221 #define PyBoolObject PyLongObject
jpayne@69 1222 #endif
jpayne@69 1223 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
jpayne@69 1224 #ifndef PyUnicode_InternFromString
jpayne@69 1225 #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
jpayne@69 1226 #endif
jpayne@69 1227 #endif
jpayne@69 1228 #if PY_VERSION_HEX < 0x030200A4
jpayne@69 1229 typedef long Py_hash_t;
jpayne@69 1230 #define __Pyx_PyInt_FromHash_t PyInt_FromLong
jpayne@69 1231 #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsHash_t
jpayne@69 1232 #else
jpayne@69 1233 #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
jpayne@69 1234 #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t
jpayne@69 1235 #endif
jpayne@69 1236 #if CYTHON_USE_ASYNC_SLOTS
jpayne@69 1237 #if PY_VERSION_HEX >= 0x030500B1
jpayne@69 1238 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
jpayne@69 1239 #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
jpayne@69 1240 #else
jpayne@69 1241 #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
jpayne@69 1242 #endif
jpayne@69 1243 #else
jpayne@69 1244 #define __Pyx_PyType_AsAsync(obj) NULL
jpayne@69 1245 #endif
jpayne@69 1246 #ifndef __Pyx_PyAsyncMethodsStruct
jpayne@69 1247 typedef struct {
jpayne@69 1248 unaryfunc am_await;
jpayne@69 1249 unaryfunc am_aiter;
jpayne@69 1250 unaryfunc am_anext;
jpayne@69 1251 } __Pyx_PyAsyncMethodsStruct;
jpayne@69 1252 #endif
jpayne@69 1253
jpayne@69 1254 #if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)
jpayne@69 1255 #if !defined(_USE_MATH_DEFINES)
jpayne@69 1256 #define _USE_MATH_DEFINES
jpayne@69 1257 #endif
jpayne@69 1258 #endif
jpayne@69 1259 #include <math.h>
jpayne@69 1260 #ifdef NAN
jpayne@69 1261 #define __PYX_NAN() ((float) NAN)
jpayne@69 1262 #else
jpayne@69 1263 static CYTHON_INLINE float __PYX_NAN() {
jpayne@69 1264 float value;
jpayne@69 1265 memset(&value, 0xFF, sizeof(value));
jpayne@69 1266 return value;
jpayne@69 1267 }
jpayne@69 1268 #endif
jpayne@69 1269 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
jpayne@69 1270 #define __Pyx_truncl trunc
jpayne@69 1271 #else
jpayne@69 1272 #define __Pyx_truncl truncl
jpayne@69 1273 #endif
jpayne@69 1274
jpayne@69 1275 #define __PYX_MARK_ERR_POS(f_index, lineno) \
jpayne@69 1276 { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
jpayne@69 1277 #define __PYX_ERR(f_index, lineno, Ln_error) \
jpayne@69 1278 { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }
jpayne@69 1279
jpayne@69 1280 #ifdef CYTHON_EXTERN_C
jpayne@69 1281 #undef __PYX_EXTERN_C
jpayne@69 1282 #define __PYX_EXTERN_C CYTHON_EXTERN_C
jpayne@69 1283 #elif defined(__PYX_EXTERN_C)
jpayne@69 1284 #ifdef _MSC_VER
jpayne@69 1285 #pragma message ("Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.")
jpayne@69 1286 #else
jpayne@69 1287 #warning Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.
jpayne@69 1288 #endif
jpayne@69 1289 #else
jpayne@69 1290 #ifdef __cplusplus
jpayne@69 1291 #define __PYX_EXTERN_C extern "C"
jpayne@69 1292 #else
jpayne@69 1293 #define __PYX_EXTERN_C extern
jpayne@69 1294 #endif
jpayne@69 1295 #endif
jpayne@69 1296
jpayne@69 1297 #define __PYX_HAVE__pysam__libcutils
jpayne@69 1298 #define __PYX_HAVE_API__pysam__libcutils
jpayne@69 1299 /* Early includes */
jpayne@69 1300 #include <string.h>
jpayne@69 1301 #include <stdio.h>
jpayne@69 1302 #include <stddef.h>
jpayne@69 1303 #include "pythread.h"
jpayne@69 1304
jpayne@69 1305 #if CYTHON_COMPILING_IN_PYPY
jpayne@69 1306 #ifdef _MSC_VER
jpayne@69 1307 #pragma message ("This module uses CPython specific internals of 'array.array', which are not available in PyPy.")
jpayne@69 1308 #else
jpayne@69 1309 #warning This module uses CPython specific internals of 'array.array', which are not available in PyPy.
jpayne@69 1310 #endif
jpayne@69 1311 #endif
jpayne@69 1312
jpayne@69 1313 #include <errno.h>
jpayne@69 1314 #include <stdlib.h>
jpayne@69 1315 #include <stdint.h>
jpayne@69 1316 #include <sys/types.h>
jpayne@69 1317 #include <fcntl.h>
jpayne@69 1318 #include <unistd.h>
jpayne@69 1319 #include "samtools.pysam.h"
jpayne@69 1320 #include "bcftools.pysam.h"
jpayne@69 1321 #ifdef _OPENMP
jpayne@69 1322 #include <omp.h>
jpayne@69 1323 #endif /* _OPENMP */
jpayne@69 1324
jpayne@69 1325 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
jpayne@69 1326 #define CYTHON_WITHOUT_ASSERTIONS
jpayne@69 1327 #endif
jpayne@69 1328
jpayne@69 1329 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
jpayne@69 1330 const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
jpayne@69 1331
jpayne@69 1332 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
jpayne@69 1333 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
jpayne@69 1334 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
jpayne@69 1335 #define __PYX_DEFAULT_STRING_ENCODING ""
jpayne@69 1336 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
jpayne@69 1337 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
jpayne@69 1338 #define __Pyx_uchar_cast(c) ((unsigned char)c)
jpayne@69 1339 #define __Pyx_long_cast(x) ((long)x)
jpayne@69 1340 #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
jpayne@69 1341 (sizeof(type) < sizeof(Py_ssize_t)) ||\
jpayne@69 1342 (sizeof(type) > sizeof(Py_ssize_t) &&\
jpayne@69 1343 likely(v < (type)PY_SSIZE_T_MAX ||\
jpayne@69 1344 v == (type)PY_SSIZE_T_MAX) &&\
jpayne@69 1345 (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
jpayne@69 1346 v == (type)PY_SSIZE_T_MIN))) ||\
jpayne@69 1347 (sizeof(type) == sizeof(Py_ssize_t) &&\
jpayne@69 1348 (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
jpayne@69 1349 v == (type)PY_SSIZE_T_MAX))) )
jpayne@69 1350 static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
jpayne@69 1351 return (size_t) i < (size_t) limit;
jpayne@69 1352 }
jpayne@69 1353 #if defined (__cplusplus) && __cplusplus >= 201103L
jpayne@69 1354 #include <cstdlib>
jpayne@69 1355 #define __Pyx_sst_abs(value) std::abs(value)
jpayne@69 1356 #elif SIZEOF_INT >= SIZEOF_SIZE_T
jpayne@69 1357 #define __Pyx_sst_abs(value) abs(value)
jpayne@69 1358 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
jpayne@69 1359 #define __Pyx_sst_abs(value) labs(value)
jpayne@69 1360 #elif defined (_MSC_VER)
jpayne@69 1361 #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
jpayne@69 1362 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
jpayne@69 1363 #define __Pyx_sst_abs(value) llabs(value)
jpayne@69 1364 #elif defined (__GNUC__)
jpayne@69 1365 #define __Pyx_sst_abs(value) __builtin_llabs(value)
jpayne@69 1366 #else
jpayne@69 1367 #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
jpayne@69 1368 #endif
jpayne@69 1369 static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s);
jpayne@69 1370 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
jpayne@69 1371 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
jpayne@69 1372 static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char*);
jpayne@69 1373 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
jpayne@69 1374 #define __Pyx_PyBytes_FromString PyBytes_FromString
jpayne@69 1375 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
jpayne@69 1376 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
jpayne@69 1377 #if PY_MAJOR_VERSION < 3
jpayne@69 1378 #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
jpayne@69 1379 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
jpayne@69 1380 #else
jpayne@69 1381 #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
jpayne@69 1382 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
jpayne@69 1383 #endif
jpayne@69 1384 #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
jpayne@69 1385 #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
jpayne@69 1386 #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
jpayne@69 1387 #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
jpayne@69 1388 #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
jpayne@69 1389 #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
jpayne@69 1390 #define __Pyx_PyObject_AsWritableString(s) ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
jpayne@69 1391 #define __Pyx_PyObject_AsWritableSString(s) ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
jpayne@69 1392 #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
jpayne@69 1393 #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
jpayne@69 1394 #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
jpayne@69 1395 #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
jpayne@69 1396 #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
jpayne@69 1397 #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
jpayne@69 1398 #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
jpayne@69 1399 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
jpayne@69 1400 #define __Pyx_PyUnicode_FromOrdinal(o) PyUnicode_FromOrdinal((int)o)
jpayne@69 1401 #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
jpayne@69 1402 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
jpayne@69 1403 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
jpayne@69 1404 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
jpayne@69 1405 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
jpayne@69 1406 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
jpayne@69 1407 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
jpayne@69 1408 #define __Pyx_PySequence_Tuple(obj)\
jpayne@69 1409 (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
jpayne@69 1410 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
jpayne@69 1411 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
jpayne@69 1412 static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*);
jpayne@69 1413 #if CYTHON_ASSUME_SAFE_MACROS
jpayne@69 1414 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
jpayne@69 1415 #else
jpayne@69 1416 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
jpayne@69 1417 #endif
jpayne@69 1418 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
jpayne@69 1419 #if PY_MAJOR_VERSION >= 3
jpayne@69 1420 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
jpayne@69 1421 #else
jpayne@69 1422 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
jpayne@69 1423 #endif
jpayne@69 1424 #if CYTHON_USE_PYLONG_INTERNALS
jpayne@69 1425 #if PY_VERSION_HEX >= 0x030C00A7
jpayne@69 1426 #ifndef _PyLong_SIGN_MASK
jpayne@69 1427 #define _PyLong_SIGN_MASK 3
jpayne@69 1428 #endif
jpayne@69 1429 #ifndef _PyLong_NON_SIZE_BITS
jpayne@69 1430 #define _PyLong_NON_SIZE_BITS 3
jpayne@69 1431 #endif
jpayne@69 1432 #define __Pyx_PyLong_Sign(x) (((PyLongObject*)x)->long_value.lv_tag & _PyLong_SIGN_MASK)
jpayne@69 1433 #define __Pyx_PyLong_IsNeg(x) ((__Pyx_PyLong_Sign(x) & 2) != 0)
jpayne@69 1434 #define __Pyx_PyLong_IsNonNeg(x) (!__Pyx_PyLong_IsNeg(x))
jpayne@69 1435 #define __Pyx_PyLong_IsZero(x) (__Pyx_PyLong_Sign(x) & 1)
jpayne@69 1436 #define __Pyx_PyLong_IsPos(x) (__Pyx_PyLong_Sign(x) == 0)
jpayne@69 1437 #define __Pyx_PyLong_CompactValueUnsigned(x) (__Pyx_PyLong_Digits(x)[0])
jpayne@69 1438 #define __Pyx_PyLong_DigitCount(x) ((Py_ssize_t) (((PyLongObject*)x)->long_value.lv_tag >> _PyLong_NON_SIZE_BITS))
jpayne@69 1439 #define __Pyx_PyLong_SignedDigitCount(x)\
jpayne@69 1440 ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * __Pyx_PyLong_DigitCount(x))
jpayne@69 1441 #if defined(PyUnstable_Long_IsCompact) && defined(PyUnstable_Long_CompactValue)
jpayne@69 1442 #define __Pyx_PyLong_IsCompact(x) PyUnstable_Long_IsCompact((PyLongObject*) x)
jpayne@69 1443 #define __Pyx_PyLong_CompactValue(x) PyUnstable_Long_CompactValue((PyLongObject*) x)
jpayne@69 1444 #else
jpayne@69 1445 #define __Pyx_PyLong_IsCompact(x) (((PyLongObject*)x)->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS))
jpayne@69 1446 #define __Pyx_PyLong_CompactValue(x) ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0])
jpayne@69 1447 #endif
jpayne@69 1448 typedef Py_ssize_t __Pyx_compact_pylong;
jpayne@69 1449 typedef size_t __Pyx_compact_upylong;
jpayne@69 1450 #else
jpayne@69 1451 #define __Pyx_PyLong_IsNeg(x) (Py_SIZE(x) < 0)
jpayne@69 1452 #define __Pyx_PyLong_IsNonNeg(x) (Py_SIZE(x) >= 0)
jpayne@69 1453 #define __Pyx_PyLong_IsZero(x) (Py_SIZE(x) == 0)
jpayne@69 1454 #define __Pyx_PyLong_IsPos(x) (Py_SIZE(x) > 0)
jpayne@69 1455 #define __Pyx_PyLong_CompactValueUnsigned(x) ((Py_SIZE(x) == 0) ? 0 : __Pyx_PyLong_Digits(x)[0])
jpayne@69 1456 #define __Pyx_PyLong_DigitCount(x) __Pyx_sst_abs(Py_SIZE(x))
jpayne@69 1457 #define __Pyx_PyLong_SignedDigitCount(x) Py_SIZE(x)
jpayne@69 1458 #define __Pyx_PyLong_IsCompact(x) (Py_SIZE(x) == 0 || Py_SIZE(x) == 1 || Py_SIZE(x) == -1)
jpayne@69 1459 #define __Pyx_PyLong_CompactValue(x)\
jpayne@69 1460 ((Py_SIZE(x) == 0) ? (sdigit) 0 : ((Py_SIZE(x) < 0) ? -(sdigit)__Pyx_PyLong_Digits(x)[0] : (sdigit)__Pyx_PyLong_Digits(x)[0]))
jpayne@69 1461 typedef sdigit __Pyx_compact_pylong;
jpayne@69 1462 typedef digit __Pyx_compact_upylong;
jpayne@69 1463 #endif
jpayne@69 1464 #if PY_VERSION_HEX >= 0x030C00A5
jpayne@69 1465 #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->long_value.ob_digit)
jpayne@69 1466 #else
jpayne@69 1467 #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->ob_digit)
jpayne@69 1468 #endif
jpayne@69 1469 #endif
jpayne@69 1470 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
jpayne@69 1471 #include <string.h>
jpayne@69 1472 static int __Pyx_sys_getdefaultencoding_not_ascii;
jpayne@69 1473 static int __Pyx_init_sys_getdefaultencoding_params(void) {
jpayne@69 1474 PyObject* sys;
jpayne@69 1475 PyObject* default_encoding = NULL;
jpayne@69 1476 PyObject* ascii_chars_u = NULL;
jpayne@69 1477 PyObject* ascii_chars_b = NULL;
jpayne@69 1478 const char* default_encoding_c;
jpayne@69 1479 sys = PyImport_ImportModule("sys");
jpayne@69 1480 if (!sys) goto bad;
jpayne@69 1481 default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
jpayne@69 1482 Py_DECREF(sys);
jpayne@69 1483 if (!default_encoding) goto bad;
jpayne@69 1484 default_encoding_c = PyBytes_AsString(default_encoding);
jpayne@69 1485 if (!default_encoding_c) goto bad;
jpayne@69 1486 if (strcmp(default_encoding_c, "ascii") == 0) {
jpayne@69 1487 __Pyx_sys_getdefaultencoding_not_ascii = 0;
jpayne@69 1488 } else {
jpayne@69 1489 char ascii_chars[128];
jpayne@69 1490 int c;
jpayne@69 1491 for (c = 0; c < 128; c++) {
jpayne@69 1492 ascii_chars[c] = (char) c;
jpayne@69 1493 }
jpayne@69 1494 __Pyx_sys_getdefaultencoding_not_ascii = 1;
jpayne@69 1495 ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
jpayne@69 1496 if (!ascii_chars_u) goto bad;
jpayne@69 1497 ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
jpayne@69 1498 if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
jpayne@69 1499 PyErr_Format(
jpayne@69 1500 PyExc_ValueError,
jpayne@69 1501 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
jpayne@69 1502 default_encoding_c);
jpayne@69 1503 goto bad;
jpayne@69 1504 }
jpayne@69 1505 Py_DECREF(ascii_chars_u);
jpayne@69 1506 Py_DECREF(ascii_chars_b);
jpayne@69 1507 }
jpayne@69 1508 Py_DECREF(default_encoding);
jpayne@69 1509 return 0;
jpayne@69 1510 bad:
jpayne@69 1511 Py_XDECREF(default_encoding);
jpayne@69 1512 Py_XDECREF(ascii_chars_u);
jpayne@69 1513 Py_XDECREF(ascii_chars_b);
jpayne@69 1514 return -1;
jpayne@69 1515 }
jpayne@69 1516 #endif
jpayne@69 1517 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
jpayne@69 1518 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
jpayne@69 1519 #else
jpayne@69 1520 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
jpayne@69 1521 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
jpayne@69 1522 #include <string.h>
jpayne@69 1523 static char* __PYX_DEFAULT_STRING_ENCODING;
jpayne@69 1524 static int __Pyx_init_sys_getdefaultencoding_params(void) {
jpayne@69 1525 PyObject* sys;
jpayne@69 1526 PyObject* default_encoding = NULL;
jpayne@69 1527 char* default_encoding_c;
jpayne@69 1528 sys = PyImport_ImportModule("sys");
jpayne@69 1529 if (!sys) goto bad;
jpayne@69 1530 default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
jpayne@69 1531 Py_DECREF(sys);
jpayne@69 1532 if (!default_encoding) goto bad;
jpayne@69 1533 default_encoding_c = PyBytes_AsString(default_encoding);
jpayne@69 1534 if (!default_encoding_c) goto bad;
jpayne@69 1535 __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
jpayne@69 1536 if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
jpayne@69 1537 strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
jpayne@69 1538 Py_DECREF(default_encoding);
jpayne@69 1539 return 0;
jpayne@69 1540 bad:
jpayne@69 1541 Py_XDECREF(default_encoding);
jpayne@69 1542 return -1;
jpayne@69 1543 }
jpayne@69 1544 #endif
jpayne@69 1545 #endif
jpayne@69 1546
jpayne@69 1547
jpayne@69 1548 /* Test for GCC > 2.95 */
jpayne@69 1549 #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
jpayne@69 1550 #define likely(x) __builtin_expect(!!(x), 1)
jpayne@69 1551 #define unlikely(x) __builtin_expect(!!(x), 0)
jpayne@69 1552 #else /* !__GNUC__ or GCC < 2.95 */
jpayne@69 1553 #define likely(x) (x)
jpayne@69 1554 #define unlikely(x) (x)
jpayne@69 1555 #endif /* __GNUC__ */
jpayne@69 1556 static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
jpayne@69 1557
jpayne@69 1558 #if !CYTHON_USE_MODULE_STATE
jpayne@69 1559 static PyObject *__pyx_m = NULL;
jpayne@69 1560 #endif
jpayne@69 1561 static int __pyx_lineno;
jpayne@69 1562 static int __pyx_clineno = 0;
jpayne@69 1563 static const char * __pyx_cfilenm = __FILE__;
jpayne@69 1564 static const char *__pyx_filename;
jpayne@69 1565
jpayne@69 1566 /* #### Code section: filename_table ### */
jpayne@69 1567
jpayne@69 1568 static const char *__pyx_f[] = {
jpayne@69 1569 "pysam/libcutils.pyx",
jpayne@69 1570 "contextvars.pxd",
jpayne@69 1571 "array.pxd",
jpayne@69 1572 "type.pxd",
jpayne@69 1573 "bool.pxd",
jpayne@69 1574 "complex.pxd",
jpayne@69 1575 };
jpayne@69 1576 /* #### Code section: utility_code_proto_before_types ### */
jpayne@69 1577 /* ForceInitThreads.proto */
jpayne@69 1578 #ifndef __PYX_FORCE_INIT_THREADS
jpayne@69 1579 #define __PYX_FORCE_INIT_THREADS 0
jpayne@69 1580 #endif
jpayne@69 1581
jpayne@69 1582 /* #### Code section: numeric_typedefs ### */
jpayne@69 1583 /* #### Code section: complex_type_declarations ### */
jpayne@69 1584 /* #### Code section: type_declarations ### */
jpayne@69 1585
jpayne@69 1586 /*--- Type declarations ---*/
jpayne@69 1587 #ifndef _ARRAYARRAY_H
jpayne@69 1588 struct arrayobject;
jpayne@69 1589 typedef struct arrayobject arrayobject;
jpayne@69 1590 #endif
jpayne@69 1591 struct __pyx_opt_args_7cpython_11contextvars_get_value;
jpayne@69 1592 struct __pyx_opt_args_7cpython_11contextvars_get_value_no_default;
jpayne@69 1593
jpayne@69 1594 /* "cpython/contextvars.pxd":112
jpayne@69 1595 *
jpayne@69 1596 *
jpayne@69 1597 * cdef inline object get_value(var, default_value=None): # <<<<<<<<<<<<<<
jpayne@69 1598 * """Return a new reference to the value of the context variable,
jpayne@69 1599 * or the default value of the context variable,
jpayne@69 1600 */
jpayne@69 1601 struct __pyx_opt_args_7cpython_11contextvars_get_value {
jpayne@69 1602 int __pyx_n;
jpayne@69 1603 PyObject *default_value;
jpayne@69 1604 };
jpayne@69 1605
jpayne@69 1606 /* "cpython/contextvars.pxd":129
jpayne@69 1607 *
jpayne@69 1608 *
jpayne@69 1609 * cdef inline object get_value_no_default(var, default_value=None): # <<<<<<<<<<<<<<
jpayne@69 1610 * """Return a new reference to the value of the context variable,
jpayne@69 1611 * or the provided default value if no such value was found.
jpayne@69 1612 */
jpayne@69 1613 struct __pyx_opt_args_7cpython_11contextvars_get_value_no_default {
jpayne@69 1614 int __pyx_n;
jpayne@69 1615 PyObject *default_value;
jpayne@69 1616 };
jpayne@69 1617 struct __pyx_opt_args_5pysam_9libcutils_parse_region;
jpayne@69 1618 struct __pyx_opt_args_5pysam_9libcutils_qualitystring_to_array;
jpayne@69 1619 struct __pyx_opt_args_5pysam_9libcutils_array_to_qualitystring;
jpayne@69 1620 struct __pyx_opt_args_5pysam_9libcutils_qualities_to_qualitystring;
jpayne@69 1621 struct __pyx_opt_args_5pysam_9libcutils_charptr_to_str;
jpayne@69 1622 struct __pyx_opt_args_5pysam_9libcutils_charptr_to_bytes;
jpayne@69 1623 struct __pyx_opt_args_5pysam_9libcutils_charptr_to_str_w_len;
jpayne@69 1624 struct __pyx_opt_args_5pysam_9libcutils_force_str;
jpayne@69 1625 struct __pyx_opt_args_5pysam_9libcutils_force_bytes;
jpayne@69 1626 struct __pyx_opt_args_5pysam_9libcutils_decode_bytes;
jpayne@69 1627
jpayne@69 1628 /* "pysam/libcutils.pxd":8
jpayne@69 1629 * from cpython cimport array as c_array
jpayne@69 1630 *
jpayne@69 1631 * cpdef parse_region(contig=*, start=*, stop=*, region=*, reference=*, end=*) # <<<<<<<<<<<<<<
jpayne@69 1632 *
jpayne@69 1633 * cdef int libc_whence_from_io(int whence)
jpayne@69 1634 */
jpayne@69 1635 struct __pyx_opt_args_5pysam_9libcutils_parse_region {
jpayne@69 1636 int __pyx_n;
jpayne@69 1637 PyObject *contig;
jpayne@69 1638 PyObject *start;
jpayne@69 1639 PyObject *stop;
jpayne@69 1640 PyObject *region;
jpayne@69 1641 PyObject *reference;
jpayne@69 1642 PyObject *end;
jpayne@69 1643 };
jpayne@69 1644
jpayne@69 1645 /* "pysam/libcutils.pxd":15
jpayne@69 1646 * # Utility functions for quality string conversions
jpayne@69 1647 *
jpayne@69 1648 * cpdef c_array.array qualitystring_to_array(input_str, int offset=*) # <<<<<<<<<<<<<<
jpayne@69 1649 * cpdef array_to_qualitystring(c_array.array arr, int offset=*)
jpayne@69 1650 * cpdef qualities_to_qualitystring(qualities, int offset=*)
jpayne@69 1651 */
jpayne@69 1652 struct __pyx_opt_args_5pysam_9libcutils_qualitystring_to_array {
jpayne@69 1653 int __pyx_n;
jpayne@69 1654 int offset;
jpayne@69 1655 };
jpayne@69 1656
jpayne@69 1657 /* "pysam/libcutils.pxd":16
jpayne@69 1658 *
jpayne@69 1659 * cpdef c_array.array qualitystring_to_array(input_str, int offset=*)
jpayne@69 1660 * cpdef array_to_qualitystring(c_array.array arr, int offset=*) # <<<<<<<<<<<<<<
jpayne@69 1661 * cpdef qualities_to_qualitystring(qualities, int offset=*)
jpayne@69 1662 *
jpayne@69 1663 */
jpayne@69 1664 struct __pyx_opt_args_5pysam_9libcutils_array_to_qualitystring {
jpayne@69 1665 int __pyx_n;
jpayne@69 1666 int offset;
jpayne@69 1667 };
jpayne@69 1668
jpayne@69 1669 /* "pysam/libcutils.pxd":17
jpayne@69 1670 * cpdef c_array.array qualitystring_to_array(input_str, int offset=*)
jpayne@69 1671 * cpdef array_to_qualitystring(c_array.array arr, int offset=*)
jpayne@69 1672 * cpdef qualities_to_qualitystring(qualities, int offset=*) # <<<<<<<<<<<<<<
jpayne@69 1673 *
jpayne@69 1674 * ########################################################################
jpayne@69 1675 */
jpayne@69 1676 struct __pyx_opt_args_5pysam_9libcutils_qualities_to_qualitystring {
jpayne@69 1677 int __pyx_n;
jpayne@69 1678 int offset;
jpayne@69 1679 };
jpayne@69 1680
jpayne@69 1681 /* "pysam/libcutils.pxd":29
jpayne@69 1682 * ## Python 3 compatibility functions
jpayne@69 1683 * ########################################################################
jpayne@69 1684 * cdef charptr_to_str(const char *s, encoding=*, errors=*) # <<<<<<<<<<<<<<
jpayne@69 1685 * cdef bytes charptr_to_bytes(const char *s, encoding=*, errors=*)
jpayne@69 1686 * cdef charptr_to_str_w_len(const char* s, size_t n, encoding=*, errors=*)
jpayne@69 1687 */
jpayne@69 1688 struct __pyx_opt_args_5pysam_9libcutils_charptr_to_str {
jpayne@69 1689 int __pyx_n;
jpayne@69 1690 PyObject *encoding;
jpayne@69 1691 PyObject *errors;
jpayne@69 1692 };
jpayne@69 1693
jpayne@69 1694 /* "pysam/libcutils.pxd":30
jpayne@69 1695 * ########################################################################
jpayne@69 1696 * cdef charptr_to_str(const char *s, encoding=*, errors=*)
jpayne@69 1697 * cdef bytes charptr_to_bytes(const char *s, encoding=*, errors=*) # <<<<<<<<<<<<<<
jpayne@69 1698 * cdef charptr_to_str_w_len(const char* s, size_t n, encoding=*, errors=*)
jpayne@69 1699 * cdef force_str(object s, encoding=*, errors=*)
jpayne@69 1700 */
jpayne@69 1701 struct __pyx_opt_args_5pysam_9libcutils_charptr_to_bytes {
jpayne@69 1702 int __pyx_n;
jpayne@69 1703 PyObject *encoding;
jpayne@69 1704 PyObject *errors;
jpayne@69 1705 };
jpayne@69 1706
jpayne@69 1707 /* "pysam/libcutils.pxd":31
jpayne@69 1708 * cdef charptr_to_str(const char *s, encoding=*, errors=*)
jpayne@69 1709 * cdef bytes charptr_to_bytes(const char *s, encoding=*, errors=*)
jpayne@69 1710 * cdef charptr_to_str_w_len(const char* s, size_t n, encoding=*, errors=*) # <<<<<<<<<<<<<<
jpayne@69 1711 * cdef force_str(object s, encoding=*, errors=*)
jpayne@69 1712 * cdef bytes force_bytes(object s, encoding=*, errors=*)
jpayne@69 1713 */
jpayne@69 1714 struct __pyx_opt_args_5pysam_9libcutils_charptr_to_str_w_len {
jpayne@69 1715 int __pyx_n;
jpayne@69 1716 PyObject *encoding;
jpayne@69 1717 PyObject *errors;
jpayne@69 1718 };
jpayne@69 1719
jpayne@69 1720 /* "pysam/libcutils.pxd":32
jpayne@69 1721 * cdef bytes charptr_to_bytes(const char *s, encoding=*, errors=*)
jpayne@69 1722 * cdef charptr_to_str_w_len(const char* s, size_t n, encoding=*, errors=*)
jpayne@69 1723 * cdef force_str(object s, encoding=*, errors=*) # <<<<<<<<<<<<<<
jpayne@69 1724 * cdef bytes force_bytes(object s, encoding=*, errors=*)
jpayne@69 1725 * cdef decode_bytes(bytes s, encoding=*, errors=*)
jpayne@69 1726 */
jpayne@69 1727 struct __pyx_opt_args_5pysam_9libcutils_force_str {
jpayne@69 1728 int __pyx_n;
jpayne@69 1729 PyObject *encoding;
jpayne@69 1730 PyObject *errors;
jpayne@69 1731 };
jpayne@69 1732
jpayne@69 1733 /* "pysam/libcutils.pxd":33
jpayne@69 1734 * cdef charptr_to_str_w_len(const char* s, size_t n, encoding=*, errors=*)
jpayne@69 1735 * cdef force_str(object s, encoding=*, errors=*)
jpayne@69 1736 * cdef bytes force_bytes(object s, encoding=*, errors=*) # <<<<<<<<<<<<<<
jpayne@69 1737 * cdef decode_bytes(bytes s, encoding=*, errors=*)
jpayne@69 1738 * cdef bytes encode_filename(object filename)
jpayne@69 1739 */
jpayne@69 1740 struct __pyx_opt_args_5pysam_9libcutils_force_bytes {
jpayne@69 1741 int __pyx_n;
jpayne@69 1742 PyObject *encoding;
jpayne@69 1743 PyObject *errors;
jpayne@69 1744 };
jpayne@69 1745
jpayne@69 1746 /* "pysam/libcutils.pxd":34
jpayne@69 1747 * cdef force_str(object s, encoding=*, errors=*)
jpayne@69 1748 * cdef bytes force_bytes(object s, encoding=*, errors=*)
jpayne@69 1749 * cdef decode_bytes(bytes s, encoding=*, errors=*) # <<<<<<<<<<<<<<
jpayne@69 1750 * cdef bytes encode_filename(object filename)
jpayne@69 1751 * cdef from_string_and_size(const char *s, size_t length)
jpayne@69 1752 */
jpayne@69 1753 struct __pyx_opt_args_5pysam_9libcutils_decode_bytes {
jpayne@69 1754 int __pyx_n;
jpayne@69 1755 PyObject *encoding;
jpayne@69 1756 PyObject *errors;
jpayne@69 1757 };
jpayne@69 1758 /* #### Code section: utility_code_proto ### */
jpayne@69 1759
jpayne@69 1760 /* --- Runtime support code (head) --- */
jpayne@69 1761 /* Refnanny.proto */
jpayne@69 1762 #ifndef CYTHON_REFNANNY
jpayne@69 1763 #define CYTHON_REFNANNY 0
jpayne@69 1764 #endif
jpayne@69 1765 #if CYTHON_REFNANNY
jpayne@69 1766 typedef struct {
jpayne@69 1767 void (*INCREF)(void*, PyObject*, Py_ssize_t);
jpayne@69 1768 void (*DECREF)(void*, PyObject*, Py_ssize_t);
jpayne@69 1769 void (*GOTREF)(void*, PyObject*, Py_ssize_t);
jpayne@69 1770 void (*GIVEREF)(void*, PyObject*, Py_ssize_t);
jpayne@69 1771 void* (*SetupContext)(const char*, Py_ssize_t, const char*);
jpayne@69 1772 void (*FinishContext)(void**);
jpayne@69 1773 } __Pyx_RefNannyAPIStruct;
jpayne@69 1774 static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
jpayne@69 1775 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
jpayne@69 1776 #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
jpayne@69 1777 #ifdef WITH_THREAD
jpayne@69 1778 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
jpayne@69 1779 if (acquire_gil) {\
jpayne@69 1780 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
jpayne@69 1781 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\
jpayne@69 1782 PyGILState_Release(__pyx_gilstate_save);\
jpayne@69 1783 } else {\
jpayne@69 1784 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\
jpayne@69 1785 }
jpayne@69 1786 #define __Pyx_RefNannyFinishContextNogil() {\
jpayne@69 1787 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
jpayne@69 1788 __Pyx_RefNannyFinishContext();\
jpayne@69 1789 PyGILState_Release(__pyx_gilstate_save);\
jpayne@69 1790 }
jpayne@69 1791 #else
jpayne@69 1792 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
jpayne@69 1793 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__))
jpayne@69 1794 #define __Pyx_RefNannyFinishContextNogil() __Pyx_RefNannyFinishContext()
jpayne@69 1795 #endif
jpayne@69 1796 #define __Pyx_RefNannyFinishContextNogil() {\
jpayne@69 1797 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
jpayne@69 1798 __Pyx_RefNannyFinishContext();\
jpayne@69 1799 PyGILState_Release(__pyx_gilstate_save);\
jpayne@69 1800 }
jpayne@69 1801 #define __Pyx_RefNannyFinishContext()\
jpayne@69 1802 __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
jpayne@69 1803 #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
jpayne@69 1804 #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
jpayne@69 1805 #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
jpayne@69 1806 #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
jpayne@69 1807 #define __Pyx_XINCREF(r) do { if((r) == NULL); else {__Pyx_INCREF(r); }} while(0)
jpayne@69 1808 #define __Pyx_XDECREF(r) do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0)
jpayne@69 1809 #define __Pyx_XGOTREF(r) do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0)
jpayne@69 1810 #define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0)
jpayne@69 1811 #else
jpayne@69 1812 #define __Pyx_RefNannyDeclarations
jpayne@69 1813 #define __Pyx_RefNannySetupContext(name, acquire_gil)
jpayne@69 1814 #define __Pyx_RefNannyFinishContextNogil()
jpayne@69 1815 #define __Pyx_RefNannyFinishContext()
jpayne@69 1816 #define __Pyx_INCREF(r) Py_INCREF(r)
jpayne@69 1817 #define __Pyx_DECREF(r) Py_DECREF(r)
jpayne@69 1818 #define __Pyx_GOTREF(r)
jpayne@69 1819 #define __Pyx_GIVEREF(r)
jpayne@69 1820 #define __Pyx_XINCREF(r) Py_XINCREF(r)
jpayne@69 1821 #define __Pyx_XDECREF(r) Py_XDECREF(r)
jpayne@69 1822 #define __Pyx_XGOTREF(r)
jpayne@69 1823 #define __Pyx_XGIVEREF(r)
jpayne@69 1824 #endif
jpayne@69 1825 #define __Pyx_Py_XDECREF_SET(r, v) do {\
jpayne@69 1826 PyObject *tmp = (PyObject *) r;\
jpayne@69 1827 r = v; Py_XDECREF(tmp);\
jpayne@69 1828 } while (0)
jpayne@69 1829 #define __Pyx_XDECREF_SET(r, v) do {\
jpayne@69 1830 PyObject *tmp = (PyObject *) r;\
jpayne@69 1831 r = v; __Pyx_XDECREF(tmp);\
jpayne@69 1832 } while (0)
jpayne@69 1833 #define __Pyx_DECREF_SET(r, v) do {\
jpayne@69 1834 PyObject *tmp = (PyObject *) r;\
jpayne@69 1835 r = v; __Pyx_DECREF(tmp);\
jpayne@69 1836 } while (0)
jpayne@69 1837 #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
jpayne@69 1838 #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
jpayne@69 1839
jpayne@69 1840 /* PyErrExceptionMatches.proto */
jpayne@69 1841 #if CYTHON_FAST_THREAD_STATE
jpayne@69 1842 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
jpayne@69 1843 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
jpayne@69 1844 #else
jpayne@69 1845 #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
jpayne@69 1846 #endif
jpayne@69 1847
jpayne@69 1848 /* PyThreadStateGet.proto */
jpayne@69 1849 #if CYTHON_FAST_THREAD_STATE
jpayne@69 1850 #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
jpayne@69 1851 #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
jpayne@69 1852 #if PY_VERSION_HEX >= 0x030C00A6
jpayne@69 1853 #define __Pyx_PyErr_Occurred() (__pyx_tstate->current_exception != NULL)
jpayne@69 1854 #define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->current_exception ? (PyObject*) Py_TYPE(__pyx_tstate->current_exception) : (PyObject*) NULL)
jpayne@69 1855 #else
jpayne@69 1856 #define __Pyx_PyErr_Occurred() (__pyx_tstate->curexc_type != NULL)
jpayne@69 1857 #define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->curexc_type)
jpayne@69 1858 #endif
jpayne@69 1859 #else
jpayne@69 1860 #define __Pyx_PyThreadState_declare
jpayne@69 1861 #define __Pyx_PyThreadState_assign
jpayne@69 1862 #define __Pyx_PyErr_Occurred() (PyErr_Occurred() != NULL)
jpayne@69 1863 #define __Pyx_PyErr_CurrentExceptionType() PyErr_Occurred()
jpayne@69 1864 #endif
jpayne@69 1865
jpayne@69 1866 /* PyErrFetchRestore.proto */
jpayne@69 1867 #if CYTHON_FAST_THREAD_STATE
jpayne@69 1868 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
jpayne@69 1869 #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
jpayne@69 1870 #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
jpayne@69 1871 #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
jpayne@69 1872 #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
jpayne@69 1873 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
jpayne@69 1874 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
jpayne@69 1875 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A6
jpayne@69 1876 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
jpayne@69 1877 #else
jpayne@69 1878 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
jpayne@69 1879 #endif
jpayne@69 1880 #else
jpayne@69 1881 #define __Pyx_PyErr_Clear() PyErr_Clear()
jpayne@69 1882 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
jpayne@69 1883 #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
jpayne@69 1884 #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
jpayne@69 1885 #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
jpayne@69 1886 #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
jpayne@69 1887 #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
jpayne@69 1888 #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
jpayne@69 1889 #endif
jpayne@69 1890
jpayne@69 1891 /* PyObjectGetAttrStr.proto */
jpayne@69 1892 #if CYTHON_USE_TYPE_SLOTS
jpayne@69 1893 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
jpayne@69 1894 #else
jpayne@69 1895 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
jpayne@69 1896 #endif
jpayne@69 1897
jpayne@69 1898 /* PyObjectGetAttrStrNoError.proto */
jpayne@69 1899 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);
jpayne@69 1900
jpayne@69 1901 /* GetBuiltinName.proto */
jpayne@69 1902 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
jpayne@69 1903
jpayne@69 1904 /* TupleAndListFromArray.proto */
jpayne@69 1905 #if CYTHON_COMPILING_IN_CPYTHON
jpayne@69 1906 static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n);
jpayne@69 1907 static CYTHON_INLINE PyObject* __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n);
jpayne@69 1908 #endif
jpayne@69 1909
jpayne@69 1910 /* IncludeStringH.proto */
jpayne@69 1911 #include <string.h>
jpayne@69 1912
jpayne@69 1913 /* BytesEquals.proto */
jpayne@69 1914 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);
jpayne@69 1915
jpayne@69 1916 /* UnicodeEquals.proto */
jpayne@69 1917 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);
jpayne@69 1918
jpayne@69 1919 /* fastcall.proto */
jpayne@69 1920 #if CYTHON_AVOID_BORROWED_REFS
jpayne@69 1921 #define __Pyx_Arg_VARARGS(args, i) PySequence_GetItem(args, i)
jpayne@69 1922 #elif CYTHON_ASSUME_SAFE_MACROS
jpayne@69 1923 #define __Pyx_Arg_VARARGS(args, i) PyTuple_GET_ITEM(args, i)
jpayne@69 1924 #else
jpayne@69 1925 #define __Pyx_Arg_VARARGS(args, i) PyTuple_GetItem(args, i)
jpayne@69 1926 #endif
jpayne@69 1927 #if CYTHON_AVOID_BORROWED_REFS
jpayne@69 1928 #define __Pyx_Arg_NewRef_VARARGS(arg) __Pyx_NewRef(arg)
jpayne@69 1929 #define __Pyx_Arg_XDECREF_VARARGS(arg) Py_XDECREF(arg)
jpayne@69 1930 #else
jpayne@69 1931 #define __Pyx_Arg_NewRef_VARARGS(arg) arg
jpayne@69 1932 #define __Pyx_Arg_XDECREF_VARARGS(arg)
jpayne@69 1933 #endif
jpayne@69 1934 #define __Pyx_NumKwargs_VARARGS(kwds) PyDict_Size(kwds)
jpayne@69 1935 #define __Pyx_KwValues_VARARGS(args, nargs) NULL
jpayne@69 1936 #define __Pyx_GetKwValue_VARARGS(kw, kwvalues, s) __Pyx_PyDict_GetItemStrWithError(kw, s)
jpayne@69 1937 #define __Pyx_KwargsAsDict_VARARGS(kw, kwvalues) PyDict_Copy(kw)
jpayne@69 1938 #if CYTHON_METH_FASTCALL
jpayne@69 1939 #define __Pyx_Arg_FASTCALL(args, i) args[i]
jpayne@69 1940 #define __Pyx_NumKwargs_FASTCALL(kwds) PyTuple_GET_SIZE(kwds)
jpayne@69 1941 #define __Pyx_KwValues_FASTCALL(args, nargs) ((args) + (nargs))
jpayne@69 1942 static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s);
jpayne@69 1943 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000
jpayne@69 1944 CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues);
jpayne@69 1945 #else
jpayne@69 1946 #define __Pyx_KwargsAsDict_FASTCALL(kw, kwvalues) _PyStack_AsDict(kwvalues, kw)
jpayne@69 1947 #endif
jpayne@69 1948 #define __Pyx_Arg_NewRef_FASTCALL(arg) arg /* no-op, __Pyx_Arg_FASTCALL is direct and this needs
jpayne@69 1949 to have the same reference counting */
jpayne@69 1950 #define __Pyx_Arg_XDECREF_FASTCALL(arg)
jpayne@69 1951 #else
jpayne@69 1952 #define __Pyx_Arg_FASTCALL __Pyx_Arg_VARARGS
jpayne@69 1953 #define __Pyx_NumKwargs_FASTCALL __Pyx_NumKwargs_VARARGS
jpayne@69 1954 #define __Pyx_KwValues_FASTCALL __Pyx_KwValues_VARARGS
jpayne@69 1955 #define __Pyx_GetKwValue_FASTCALL __Pyx_GetKwValue_VARARGS
jpayne@69 1956 #define __Pyx_KwargsAsDict_FASTCALL __Pyx_KwargsAsDict_VARARGS
jpayne@69 1957 #define __Pyx_Arg_NewRef_FASTCALL(arg) __Pyx_Arg_NewRef_VARARGS(arg)
jpayne@69 1958 #define __Pyx_Arg_XDECREF_FASTCALL(arg) __Pyx_Arg_XDECREF_VARARGS(arg)
jpayne@69 1959 #endif
jpayne@69 1960 #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
jpayne@69 1961 #define __Pyx_ArgsSlice_VARARGS(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_VARARGS(args, start), stop - start)
jpayne@69 1962 #define __Pyx_ArgsSlice_FASTCALL(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_FASTCALL(args, start), stop - start)
jpayne@69 1963 #else
jpayne@69 1964 #define __Pyx_ArgsSlice_VARARGS(args, start, stop) PyTuple_GetSlice(args, start, stop)
jpayne@69 1965 #define __Pyx_ArgsSlice_FASTCALL(args, start, stop) PyTuple_GetSlice(args, start, stop)
jpayne@69 1966 #endif
jpayne@69 1967
jpayne@69 1968 /* ListCompAppend.proto */
jpayne@69 1969 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
jpayne@69 1970 static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
jpayne@69 1971 PyListObject* L = (PyListObject*) list;
jpayne@69 1972 Py_ssize_t len = Py_SIZE(list);
jpayne@69 1973 if (likely(L->allocated > len)) {
jpayne@69 1974 Py_INCREF(x);
jpayne@69 1975 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000
jpayne@69 1976 L->ob_item[len] = x;
jpayne@69 1977 #else
jpayne@69 1978 PyList_SET_ITEM(list, len, x);
jpayne@69 1979 #endif
jpayne@69 1980 __Pyx_SET_SIZE(list, len + 1);
jpayne@69 1981 return 0;
jpayne@69 1982 }
jpayne@69 1983 return PyList_Append(list, x);
jpayne@69 1984 }
jpayne@69 1985 #else
jpayne@69 1986 #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
jpayne@69 1987 #endif
jpayne@69 1988
jpayne@69 1989 /* PyObjectCall.proto */
jpayne@69 1990 #if CYTHON_COMPILING_IN_CPYTHON
jpayne@69 1991 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
jpayne@69 1992 #else
jpayne@69 1993 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
jpayne@69 1994 #endif
jpayne@69 1995
jpayne@69 1996 /* RaiseDoubleKeywords.proto */
jpayne@69 1997 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
jpayne@69 1998
jpayne@69 1999 /* ParseKeywords.proto */
jpayne@69 2000 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject *const *kwvalues,
jpayne@69 2001 PyObject **argnames[],
jpayne@69 2002 PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,
jpayne@69 2003 const char* function_name);
jpayne@69 2004
jpayne@69 2005 /* RaiseArgTupleInvalid.proto */
jpayne@69 2006 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
jpayne@69 2007 Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
jpayne@69 2008
jpayne@69 2009 /* GetItemInt.proto */
jpayne@69 2010 #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
jpayne@69 2011 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
jpayne@69 2012 __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
jpayne@69 2013 (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
jpayne@69 2014 __Pyx_GetItemInt_Generic(o, to_py_func(i))))
jpayne@69 2015 #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
jpayne@69 2016 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
jpayne@69 2017 __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
jpayne@69 2018 (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
jpayne@69 2019 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
jpayne@69 2020 int wraparound, int boundscheck);
jpayne@69 2021 #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
jpayne@69 2022 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
jpayne@69 2023 __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
jpayne@69 2024 (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
jpayne@69 2025 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
jpayne@69 2026 int wraparound, int boundscheck);
jpayne@69 2027 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
jpayne@69 2028 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
jpayne@69 2029 int is_list, int wraparound, int boundscheck);
jpayne@69 2030
jpayne@69 2031 /* SetItemInt.proto */
jpayne@69 2032 #define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
jpayne@69 2033 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
jpayne@69 2034 __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck) :\
jpayne@69 2035 (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\
jpayne@69 2036 __Pyx_SetItemInt_Generic(o, to_py_func(i), v)))
jpayne@69 2037 static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v);
jpayne@69 2038 static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v,
jpayne@69 2039 int is_list, int wraparound, int boundscheck);
jpayne@69 2040
jpayne@69 2041 /* PyFunctionFastCall.proto */
jpayne@69 2042 #if CYTHON_FAST_PYCALL
jpayne@69 2043 #if !CYTHON_VECTORCALL
jpayne@69 2044 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
jpayne@69 2045 __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
jpayne@69 2046 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
jpayne@69 2047 #endif
jpayne@69 2048 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
jpayne@69 2049 (sizeof(char [1 - 2*!(cond)]) - 1)
jpayne@69 2050 #ifndef Py_MEMBER_SIZE
jpayne@69 2051 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
jpayne@69 2052 #endif
jpayne@69 2053 #if !CYTHON_VECTORCALL
jpayne@69 2054 #if PY_VERSION_HEX >= 0x03080000
jpayne@69 2055 #include "frameobject.h"
jpayne@69 2056 #if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 2057 #ifndef Py_BUILD_CORE
jpayne@69 2058 #define Py_BUILD_CORE 1
jpayne@69 2059 #endif
jpayne@69 2060 #include "internal/pycore_frame.h"
jpayne@69 2061 #endif
jpayne@69 2062 #define __Pxy_PyFrame_Initialize_Offsets()
jpayne@69 2063 #define __Pyx_PyFrame_GetLocalsplus(frame) ((frame)->f_localsplus)
jpayne@69 2064 #else
jpayne@69 2065 static size_t __pyx_pyframe_localsplus_offset = 0;
jpayne@69 2066 #include "frameobject.h"
jpayne@69 2067 #define __Pxy_PyFrame_Initialize_Offsets()\
jpayne@69 2068 ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
jpayne@69 2069 (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
jpayne@69 2070 #define __Pyx_PyFrame_GetLocalsplus(frame)\
jpayne@69 2071 (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
jpayne@69 2072 #endif
jpayne@69 2073 #endif
jpayne@69 2074 #endif
jpayne@69 2075
jpayne@69 2076 /* PyObjectCallMethO.proto */
jpayne@69 2077 #if CYTHON_COMPILING_IN_CPYTHON
jpayne@69 2078 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
jpayne@69 2079 #endif
jpayne@69 2080
jpayne@69 2081 /* PyObjectFastCall.proto */
jpayne@69 2082 #define __Pyx_PyObject_FastCall(func, args, nargs) __Pyx_PyObject_FastCallDict(func, args, (size_t)(nargs), NULL)
jpayne@69 2083 static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs);
jpayne@69 2084
jpayne@69 2085 /* ArgTypeTest.proto */
jpayne@69 2086 #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
jpayne@69 2087 ((likely(__Pyx_IS_TYPE(obj, type) | (none_allowed && (obj == Py_None)))) ? 1 :\
jpayne@69 2088 __Pyx__ArgTypeTest(obj, type, name, exact))
jpayne@69 2089 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);
jpayne@69 2090
jpayne@69 2091 /* ExtTypeTest.proto */
jpayne@69 2092 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
jpayne@69 2093
jpayne@69 2094 /* PyObjectCallOneArg.proto */
jpayne@69 2095 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
jpayne@69 2096
jpayne@69 2097 /* ObjectGetItem.proto */
jpayne@69 2098 #if CYTHON_USE_TYPE_SLOTS
jpayne@69 2099 static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key);
jpayne@69 2100 #else
jpayne@69 2101 #define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key)
jpayne@69 2102 #endif
jpayne@69 2103
jpayne@69 2104 /* RaiseUnexpectedTypeError.proto */
jpayne@69 2105 static int __Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj);
jpayne@69 2106
jpayne@69 2107 /* PyDictVersioning.proto */
jpayne@69 2108 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
jpayne@69 2109 #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
jpayne@69 2110 #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
jpayne@69 2111 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
jpayne@69 2112 (version_var) = __PYX_GET_DICT_VERSION(dict);\
jpayne@69 2113 (cache_var) = (value);
jpayne@69 2114 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
jpayne@69 2115 static PY_UINT64_T __pyx_dict_version = 0;\
jpayne@69 2116 static PyObject *__pyx_dict_cached_value = NULL;\
jpayne@69 2117 if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
jpayne@69 2118 (VAR) = __pyx_dict_cached_value;\
jpayne@69 2119 } else {\
jpayne@69 2120 (VAR) = __pyx_dict_cached_value = (LOOKUP);\
jpayne@69 2121 __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
jpayne@69 2122 }\
jpayne@69 2123 }
jpayne@69 2124 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
jpayne@69 2125 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
jpayne@69 2126 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
jpayne@69 2127 #else
jpayne@69 2128 #define __PYX_GET_DICT_VERSION(dict) (0)
jpayne@69 2129 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
jpayne@69 2130 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
jpayne@69 2131 #endif
jpayne@69 2132
jpayne@69 2133 /* GetModuleGlobalName.proto */
jpayne@69 2134 #if CYTHON_USE_DICT_VERSIONS
jpayne@69 2135 #define __Pyx_GetModuleGlobalName(var, name) do {\
jpayne@69 2136 static PY_UINT64_T __pyx_dict_version = 0;\
jpayne@69 2137 static PyObject *__pyx_dict_cached_value = NULL;\
jpayne@69 2138 (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
jpayne@69 2139 (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
jpayne@69 2140 __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
jpayne@69 2141 } while(0)
jpayne@69 2142 #define __Pyx_GetModuleGlobalNameUncached(var, name) do {\
jpayne@69 2143 PY_UINT64_T __pyx_dict_version;\
jpayne@69 2144 PyObject *__pyx_dict_cached_value;\
jpayne@69 2145 (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
jpayne@69 2146 } while(0)
jpayne@69 2147 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
jpayne@69 2148 #else
jpayne@69 2149 #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name)
jpayne@69 2150 #define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name)
jpayne@69 2151 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
jpayne@69 2152 #endif
jpayne@69 2153
jpayne@69 2154 /* RaiseException.proto */
jpayne@69 2155 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
jpayne@69 2156
jpayne@69 2157 /* GetTopmostException.proto */
jpayne@69 2158 #if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE
jpayne@69 2159 static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
jpayne@69 2160 #endif
jpayne@69 2161
jpayne@69 2162 /* SaveResetException.proto */
jpayne@69 2163 #if CYTHON_FAST_THREAD_STATE
jpayne@69 2164 #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
jpayne@69 2165 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
jpayne@69 2166 #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
jpayne@69 2167 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
jpayne@69 2168 #else
jpayne@69 2169 #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
jpayne@69 2170 #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
jpayne@69 2171 #endif
jpayne@69 2172
jpayne@69 2173 /* GetException.proto */
jpayne@69 2174 #if CYTHON_FAST_THREAD_STATE
jpayne@69 2175 #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
jpayne@69 2176 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
jpayne@69 2177 #else
jpayne@69 2178 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
jpayne@69 2179 #endif
jpayne@69 2180
jpayne@69 2181 /* PySequenceContains.proto */
jpayne@69 2182 static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) {
jpayne@69 2183 int result = PySequence_Contains(seq, item);
jpayne@69 2184 return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
jpayne@69 2185 }
jpayne@69 2186
jpayne@69 2187 /* RaiseTooManyValuesToUnpack.proto */
jpayne@69 2188 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
jpayne@69 2189
jpayne@69 2190 /* RaiseNeedMoreValuesToUnpack.proto */
jpayne@69 2191 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
jpayne@69 2192
jpayne@69 2193 /* IterFinish.proto */
jpayne@69 2194 static CYTHON_INLINE int __Pyx_IterFinish(void);
jpayne@69 2195
jpayne@69 2196 /* UnpackItemEndCheck.proto */
jpayne@69 2197 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);
jpayne@69 2198
jpayne@69 2199 /* PyIntBinop.proto */
jpayne@69 2200 #if !CYTHON_COMPILING_IN_PYPY
jpayne@69 2201 static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
jpayne@69 2202 #else
jpayne@69 2203 #define __Pyx_PyInt_SubtractObjC(op1, op2, intval, inplace, zerodivision_check)\
jpayne@69 2204 (inplace ? PyNumber_InPlaceSubtract(op1, op2) : PyNumber_Subtract(op1, op2))
jpayne@69 2205 #endif
jpayne@69 2206
jpayne@69 2207 /* PyObjectLookupSpecial.proto */
jpayne@69 2208 #if CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
jpayne@69 2209 #define __Pyx_PyObject_LookupSpecialNoError(obj, attr_name) __Pyx__PyObject_LookupSpecial(obj, attr_name, 0)
jpayne@69 2210 #define __Pyx_PyObject_LookupSpecial(obj, attr_name) __Pyx__PyObject_LookupSpecial(obj, attr_name, 1)
jpayne@69 2211 static CYTHON_INLINE PyObject* __Pyx__PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name, int with_error);
jpayne@69 2212 #else
jpayne@69 2213 #define __Pyx_PyObject_LookupSpecialNoError(o,n) __Pyx_PyObject_GetAttrStrNoError(o,n)
jpayne@69 2214 #define __Pyx_PyObject_LookupSpecial(o,n) __Pyx_PyObject_GetAttrStr(o,n)
jpayne@69 2215 #endif
jpayne@69 2216
jpayne@69 2217 /* SwapException.proto */
jpayne@69 2218 #if CYTHON_FAST_THREAD_STATE
jpayne@69 2219 #define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
jpayne@69 2220 static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
jpayne@69 2221 #else
jpayne@69 2222 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
jpayne@69 2223 #endif
jpayne@69 2224
jpayne@69 2225 /* PyIntCompare.proto */
jpayne@69 2226 static CYTHON_INLINE int __Pyx_PyInt_BoolEqObjC(PyObject *op1, PyObject *op2, long intval, long inplace);
jpayne@69 2227
jpayne@69 2228 /* DictGetItem.proto */
jpayne@69 2229 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
jpayne@69 2230 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
jpayne@69 2231 #define __Pyx_PyObject_Dict_GetItem(obj, name)\
jpayne@69 2232 (likely(PyDict_CheckExact(obj)) ?\
jpayne@69 2233 __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
jpayne@69 2234 #else
jpayne@69 2235 #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
jpayne@69 2236 #define __Pyx_PyObject_Dict_GetItem(obj, name) PyObject_GetItem(obj, name)
jpayne@69 2237 #endif
jpayne@69 2238
jpayne@69 2239 /* IncludeStructmemberH.proto */
jpayne@69 2240 #include <structmember.h>
jpayne@69 2241
jpayne@69 2242 /* FixUpExtensionType.proto */
jpayne@69 2243 #if CYTHON_USE_TYPE_SPECS
jpayne@69 2244 static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type);
jpayne@69 2245 #endif
jpayne@69 2246
jpayne@69 2247 /* FetchSharedCythonModule.proto */
jpayne@69 2248 static PyObject *__Pyx_FetchSharedCythonABIModule(void);
jpayne@69 2249
jpayne@69 2250 /* FetchCommonType.proto */
jpayne@69 2251 #if !CYTHON_USE_TYPE_SPECS
jpayne@69 2252 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);
jpayne@69 2253 #else
jpayne@69 2254 static PyTypeObject* __Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases);
jpayne@69 2255 #endif
jpayne@69 2256
jpayne@69 2257 /* PyMethodNew.proto */
jpayne@69 2258 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 2259 static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) {
jpayne@69 2260 PyObject *typesModule=NULL, *methodType=NULL, *result=NULL;
jpayne@69 2261 CYTHON_UNUSED_VAR(typ);
jpayne@69 2262 if (!self)
jpayne@69 2263 return __Pyx_NewRef(func);
jpayne@69 2264 typesModule = PyImport_ImportModule("types");
jpayne@69 2265 if (!typesModule) return NULL;
jpayne@69 2266 methodType = PyObject_GetAttrString(typesModule, "MethodType");
jpayne@69 2267 Py_DECREF(typesModule);
jpayne@69 2268 if (!methodType) return NULL;
jpayne@69 2269 result = PyObject_CallFunctionObjArgs(methodType, func, self, NULL);
jpayne@69 2270 Py_DECREF(methodType);
jpayne@69 2271 return result;
jpayne@69 2272 }
jpayne@69 2273 #elif PY_MAJOR_VERSION >= 3
jpayne@69 2274 static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) {
jpayne@69 2275 CYTHON_UNUSED_VAR(typ);
jpayne@69 2276 if (!self)
jpayne@69 2277 return __Pyx_NewRef(func);
jpayne@69 2278 return PyMethod_New(func, self);
jpayne@69 2279 }
jpayne@69 2280 #else
jpayne@69 2281 #define __Pyx_PyMethod_New PyMethod_New
jpayne@69 2282 #endif
jpayne@69 2283
jpayne@69 2284 /* PyVectorcallFastCallDict.proto */
jpayne@69 2285 #if CYTHON_METH_FASTCALL
jpayne@69 2286 static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw);
jpayne@69 2287 #endif
jpayne@69 2288
jpayne@69 2289 /* CythonFunctionShared.proto */
jpayne@69 2290 #define __Pyx_CyFunction_USED
jpayne@69 2291 #define __Pyx_CYFUNCTION_STATICMETHOD 0x01
jpayne@69 2292 #define __Pyx_CYFUNCTION_CLASSMETHOD 0x02
jpayne@69 2293 #define __Pyx_CYFUNCTION_CCLASS 0x04
jpayne@69 2294 #define __Pyx_CYFUNCTION_COROUTINE 0x08
jpayne@69 2295 #define __Pyx_CyFunction_GetClosure(f)\
jpayne@69 2296 (((__pyx_CyFunctionObject *) (f))->func_closure)
jpayne@69 2297 #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 2298 #define __Pyx_CyFunction_GetClassObj(f)\
jpayne@69 2299 (((__pyx_CyFunctionObject *) (f))->func_classobj)
jpayne@69 2300 #else
jpayne@69 2301 #define __Pyx_CyFunction_GetClassObj(f)\
jpayne@69 2302 ((PyObject*) ((PyCMethodObject *) (f))->mm_class)
jpayne@69 2303 #endif
jpayne@69 2304 #define __Pyx_CyFunction_SetClassObj(f, classobj)\
jpayne@69 2305 __Pyx__CyFunction_SetClassObj((__pyx_CyFunctionObject *) (f), (classobj))
jpayne@69 2306 #define __Pyx_CyFunction_Defaults(type, f)\
jpayne@69 2307 ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
jpayne@69 2308 #define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
jpayne@69 2309 ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
jpayne@69 2310 typedef struct {
jpayne@69 2311 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 2312 PyObject_HEAD
jpayne@69 2313 PyObject *func;
jpayne@69 2314 #elif PY_VERSION_HEX < 0x030900B1
jpayne@69 2315 PyCFunctionObject func;
jpayne@69 2316 #else
jpayne@69 2317 PyCMethodObject func;
jpayne@69 2318 #endif
jpayne@69 2319 #if CYTHON_BACKPORT_VECTORCALL
jpayne@69 2320 __pyx_vectorcallfunc func_vectorcall;
jpayne@69 2321 #endif
jpayne@69 2322 #if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 2323 PyObject *func_weakreflist;
jpayne@69 2324 #endif
jpayne@69 2325 PyObject *func_dict;
jpayne@69 2326 PyObject *func_name;
jpayne@69 2327 PyObject *func_qualname;
jpayne@69 2328 PyObject *func_doc;
jpayne@69 2329 PyObject *func_globals;
jpayne@69 2330 PyObject *func_code;
jpayne@69 2331 PyObject *func_closure;
jpayne@69 2332 #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 2333 PyObject *func_classobj;
jpayne@69 2334 #endif
jpayne@69 2335 void *defaults;
jpayne@69 2336 int defaults_pyobjects;
jpayne@69 2337 size_t defaults_size;
jpayne@69 2338 int flags;
jpayne@69 2339 PyObject *defaults_tuple;
jpayne@69 2340 PyObject *defaults_kwdict;
jpayne@69 2341 PyObject *(*defaults_getter)(PyObject *);
jpayne@69 2342 PyObject *func_annotations;
jpayne@69 2343 PyObject *func_is_coroutine;
jpayne@69 2344 } __pyx_CyFunctionObject;
jpayne@69 2345 #undef __Pyx_CyOrPyCFunction_Check
jpayne@69 2346 #define __Pyx_CyFunction_Check(obj) __Pyx_TypeCheck(obj, __pyx_CyFunctionType)
jpayne@69 2347 #define __Pyx_CyOrPyCFunction_Check(obj) __Pyx_TypeCheck2(obj, __pyx_CyFunctionType, &PyCFunction_Type)
jpayne@69 2348 #define __Pyx_CyFunction_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_CyFunctionType)
jpayne@69 2349 static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void *cfunc);
jpayne@69 2350 #undef __Pyx_IsSameCFunction
jpayne@69 2351 #define __Pyx_IsSameCFunction(func, cfunc) __Pyx__IsSameCyOrCFunction(func, cfunc)
jpayne@69 2352 static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml,
jpayne@69 2353 int flags, PyObject* qualname,
jpayne@69 2354 PyObject *closure,
jpayne@69 2355 PyObject *module, PyObject *globals,
jpayne@69 2356 PyObject* code);
jpayne@69 2357 static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj);
jpayne@69 2358 static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
jpayne@69 2359 size_t size,
jpayne@69 2360 int pyobjects);
jpayne@69 2361 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
jpayne@69 2362 PyObject *tuple);
jpayne@69 2363 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
jpayne@69 2364 PyObject *dict);
jpayne@69 2365 static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
jpayne@69 2366 PyObject *dict);
jpayne@69 2367 static int __pyx_CyFunction_init(PyObject *module);
jpayne@69 2368 #if CYTHON_METH_FASTCALL
jpayne@69 2369 static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
jpayne@69 2370 static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
jpayne@69 2371 static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
jpayne@69 2372 static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
jpayne@69 2373 #if CYTHON_BACKPORT_VECTORCALL
jpayne@69 2374 #define __Pyx_CyFunction_func_vectorcall(f) (((__pyx_CyFunctionObject*)f)->func_vectorcall)
jpayne@69 2375 #else
jpayne@69 2376 #define __Pyx_CyFunction_func_vectorcall(f) (((PyCFunctionObject*)f)->vectorcall)
jpayne@69 2377 #endif
jpayne@69 2378 #endif
jpayne@69 2379
jpayne@69 2380 /* CythonFunction.proto */
jpayne@69 2381 static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml,
jpayne@69 2382 int flags, PyObject* qualname,
jpayne@69 2383 PyObject *closure,
jpayne@69 2384 PyObject *module, PyObject *globals,
jpayne@69 2385 PyObject* code);
jpayne@69 2386
jpayne@69 2387 /* RaiseUnboundLocalError.proto */
jpayne@69 2388 static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);
jpayne@69 2389
jpayne@69 2390 /* TypeImport.proto */
jpayne@69 2391 #ifndef __PYX_HAVE_RT_ImportType_proto_3_0_11
jpayne@69 2392 #define __PYX_HAVE_RT_ImportType_proto_3_0_11
jpayne@69 2393 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
jpayne@69 2394 #include <stdalign.h>
jpayne@69 2395 #endif
jpayne@69 2396 #if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || __cplusplus >= 201103L
jpayne@69 2397 #define __PYX_GET_STRUCT_ALIGNMENT_3_0_11(s) alignof(s)
jpayne@69 2398 #else
jpayne@69 2399 #define __PYX_GET_STRUCT_ALIGNMENT_3_0_11(s) sizeof(void*)
jpayne@69 2400 #endif
jpayne@69 2401 enum __Pyx_ImportType_CheckSize_3_0_11 {
jpayne@69 2402 __Pyx_ImportType_CheckSize_Error_3_0_11 = 0,
jpayne@69 2403 __Pyx_ImportType_CheckSize_Warn_3_0_11 = 1,
jpayne@69 2404 __Pyx_ImportType_CheckSize_Ignore_3_0_11 = 2
jpayne@69 2405 };
jpayne@69 2406 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);
jpayne@69 2407 #endif
jpayne@69 2408
jpayne@69 2409 /* Import.proto */
jpayne@69 2410 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
jpayne@69 2411
jpayne@69 2412 /* ImportDottedModule.proto */
jpayne@69 2413 static PyObject *__Pyx_ImportDottedModule(PyObject *name, PyObject *parts_tuple);
jpayne@69 2414 #if PY_MAJOR_VERSION >= 3
jpayne@69 2415 static PyObject *__Pyx_ImportDottedModule_WalkParts(PyObject *module, PyObject *name, PyObject *parts_tuple);
jpayne@69 2416 #endif
jpayne@69 2417
jpayne@69 2418 /* ImportFrom.proto */
jpayne@69 2419 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
jpayne@69 2420
jpayne@69 2421 /* PyObjectCallNoArg.proto */
jpayne@69 2422 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
jpayne@69 2423
jpayne@69 2424 /* CLineInTraceback.proto */
jpayne@69 2425 #ifdef CYTHON_CLINE_IN_TRACEBACK
jpayne@69 2426 #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
jpayne@69 2427 #else
jpayne@69 2428 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
jpayne@69 2429 #endif
jpayne@69 2430
jpayne@69 2431 /* CodeObjectCache.proto */
jpayne@69 2432 #if !CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 2433 typedef struct {
jpayne@69 2434 PyCodeObject* code_object;
jpayne@69 2435 int code_line;
jpayne@69 2436 } __Pyx_CodeObjectCacheEntry;
jpayne@69 2437 struct __Pyx_CodeObjectCache {
jpayne@69 2438 int count;
jpayne@69 2439 int max_count;
jpayne@69 2440 __Pyx_CodeObjectCacheEntry* entries;
jpayne@69 2441 };
jpayne@69 2442 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
jpayne@69 2443 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
jpayne@69 2444 static PyCodeObject *__pyx_find_code_object(int code_line);
jpayne@69 2445 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
jpayne@69 2446 #endif
jpayne@69 2447
jpayne@69 2448 /* AddTraceback.proto */
jpayne@69 2449 static void __Pyx_AddTraceback(const char *funcname, int c_line,
jpayne@69 2450 int py_line, const char *filename);
jpayne@69 2451
jpayne@69 2452 /* ArrayAPI.proto */
jpayne@69 2453 #ifndef _ARRAYARRAY_H
jpayne@69 2454 #define _ARRAYARRAY_H
jpayne@69 2455 typedef struct arraydescr {
jpayne@69 2456 int typecode;
jpayne@69 2457 int itemsize;
jpayne@69 2458 PyObject * (*getitem)(struct arrayobject *, Py_ssize_t);
jpayne@69 2459 int (*setitem)(struct arrayobject *, Py_ssize_t, PyObject *);
jpayne@69 2460 #if PY_MAJOR_VERSION >= 3
jpayne@69 2461 char *formats;
jpayne@69 2462 #endif
jpayne@69 2463 } arraydescr;
jpayne@69 2464 struct arrayobject {
jpayne@69 2465 PyObject_HEAD
jpayne@69 2466 Py_ssize_t ob_size;
jpayne@69 2467 union {
jpayne@69 2468 char *ob_item;
jpayne@69 2469 float *as_floats;
jpayne@69 2470 double *as_doubles;
jpayne@69 2471 int *as_ints;
jpayne@69 2472 unsigned int *as_uints;
jpayne@69 2473 unsigned char *as_uchars;
jpayne@69 2474 signed char *as_schars;
jpayne@69 2475 char *as_chars;
jpayne@69 2476 unsigned long *as_ulongs;
jpayne@69 2477 long *as_longs;
jpayne@69 2478 #if PY_MAJOR_VERSION >= 3
jpayne@69 2479 unsigned long long *as_ulonglongs;
jpayne@69 2480 long long *as_longlongs;
jpayne@69 2481 #endif
jpayne@69 2482 short *as_shorts;
jpayne@69 2483 unsigned short *as_ushorts;
jpayne@69 2484 Py_UNICODE *as_pyunicodes;
jpayne@69 2485 void *as_voidptr;
jpayne@69 2486 } data;
jpayne@69 2487 Py_ssize_t allocated;
jpayne@69 2488 struct arraydescr *ob_descr;
jpayne@69 2489 PyObject *weakreflist;
jpayne@69 2490 #if PY_MAJOR_VERSION >= 3
jpayne@69 2491 int ob_exports;
jpayne@69 2492 #endif
jpayne@69 2493 };
jpayne@69 2494 #ifndef NO_NEWARRAY_INLINE
jpayne@69 2495 static CYTHON_INLINE PyObject * newarrayobject(PyTypeObject *type, Py_ssize_t size,
jpayne@69 2496 struct arraydescr *descr) {
jpayne@69 2497 arrayobject *op;
jpayne@69 2498 size_t nbytes;
jpayne@69 2499 if (size < 0) {
jpayne@69 2500 PyErr_BadInternalCall();
jpayne@69 2501 return NULL;
jpayne@69 2502 }
jpayne@69 2503 nbytes = size * descr->itemsize;
jpayne@69 2504 if (nbytes / descr->itemsize != (size_t)size) {
jpayne@69 2505 return PyErr_NoMemory();
jpayne@69 2506 }
jpayne@69 2507 op = (arrayobject *) type->tp_alloc(type, 0);
jpayne@69 2508 if (op == NULL) {
jpayne@69 2509 return NULL;
jpayne@69 2510 }
jpayne@69 2511 op->ob_descr = descr;
jpayne@69 2512 op->allocated = size;
jpayne@69 2513 op->weakreflist = NULL;
jpayne@69 2514 __Pyx_SET_SIZE(op, size);
jpayne@69 2515 if (size <= 0) {
jpayne@69 2516 op->data.ob_item = NULL;
jpayne@69 2517 }
jpayne@69 2518 else {
jpayne@69 2519 op->data.ob_item = PyMem_NEW(char, nbytes);
jpayne@69 2520 if (op->data.ob_item == NULL) {
jpayne@69 2521 Py_DECREF(op);
jpayne@69 2522 return PyErr_NoMemory();
jpayne@69 2523 }
jpayne@69 2524 }
jpayne@69 2525 return (PyObject *) op;
jpayne@69 2526 }
jpayne@69 2527 #else
jpayne@69 2528 PyObject* newarrayobject(PyTypeObject *type, Py_ssize_t size,
jpayne@69 2529 struct arraydescr *descr);
jpayne@69 2530 #endif
jpayne@69 2531 static CYTHON_INLINE int resize(arrayobject *self, Py_ssize_t n) {
jpayne@69 2532 void *items = (void*) self->data.ob_item;
jpayne@69 2533 PyMem_Resize(items, char, (size_t)(n * self->ob_descr->itemsize));
jpayne@69 2534 if (items == NULL) {
jpayne@69 2535 PyErr_NoMemory();
jpayne@69 2536 return -1;
jpayne@69 2537 }
jpayne@69 2538 self->data.ob_item = (char*) items;
jpayne@69 2539 __Pyx_SET_SIZE(self, n);
jpayne@69 2540 self->allocated = n;
jpayne@69 2541 return 0;
jpayne@69 2542 }
jpayne@69 2543 static CYTHON_INLINE int resize_smart(arrayobject *self, Py_ssize_t n) {
jpayne@69 2544 void *items = (void*) self->data.ob_item;
jpayne@69 2545 Py_ssize_t newsize;
jpayne@69 2546 if (n < self->allocated && n*4 > self->allocated) {
jpayne@69 2547 __Pyx_SET_SIZE(self, n);
jpayne@69 2548 return 0;
jpayne@69 2549 }
jpayne@69 2550 newsize = n + (n / 2) + 1;
jpayne@69 2551 if (newsize <= n) {
jpayne@69 2552 PyErr_NoMemory();
jpayne@69 2553 return -1;
jpayne@69 2554 }
jpayne@69 2555 PyMem_Resize(items, char, (size_t)(newsize * self->ob_descr->itemsize));
jpayne@69 2556 if (items == NULL) {
jpayne@69 2557 PyErr_NoMemory();
jpayne@69 2558 return -1;
jpayne@69 2559 }
jpayne@69 2560 self->data.ob_item = (char*) items;
jpayne@69 2561 __Pyx_SET_SIZE(self, n);
jpayne@69 2562 self->allocated = newsize;
jpayne@69 2563 return 0;
jpayne@69 2564 }
jpayne@69 2565 #endif
jpayne@69 2566
jpayne@69 2567 /* GCCDiagnostics.proto */
jpayne@69 2568 #if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
jpayne@69 2569 #define __Pyx_HAS_GCC_DIAGNOSTIC
jpayne@69 2570 #endif
jpayne@69 2571
jpayne@69 2572 /* CIntFromPy.proto */
jpayne@69 2573 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
jpayne@69 2574
jpayne@69 2575 /* CIntFromPy.proto */
jpayne@69 2576 static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *);
jpayne@69 2577
jpayne@69 2578 /* CIntToPy.proto */
jpayne@69 2579 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
jpayne@69 2580
jpayne@69 2581 /* CIntFromPy.proto */
jpayne@69 2582 static CYTHON_INLINE int32_t __Pyx_PyInt_As_int32_t(PyObject *);
jpayne@69 2583
jpayne@69 2584 /* CIntToPy.proto */
jpayne@69 2585 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
jpayne@69 2586
jpayne@69 2587 /* CIntToPy.proto */
jpayne@69 2588 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int32_t(int32_t value);
jpayne@69 2589
jpayne@69 2590 /* FormatTypeName.proto */
jpayne@69 2591 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 2592 typedef PyObject *__Pyx_TypeName;
jpayne@69 2593 #define __Pyx_FMT_TYPENAME "%U"
jpayne@69 2594 static __Pyx_TypeName __Pyx_PyType_GetName(PyTypeObject* tp);
jpayne@69 2595 #define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj)
jpayne@69 2596 #else
jpayne@69 2597 typedef const char *__Pyx_TypeName;
jpayne@69 2598 #define __Pyx_FMT_TYPENAME "%.200s"
jpayne@69 2599 #define __Pyx_PyType_GetName(tp) ((tp)->tp_name)
jpayne@69 2600 #define __Pyx_DECREF_TypeName(obj)
jpayne@69 2601 #endif
jpayne@69 2602
jpayne@69 2603 /* CIntFromPy.proto */
jpayne@69 2604 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
jpayne@69 2605
jpayne@69 2606 /* FastTypeChecks.proto */
jpayne@69 2607 #if CYTHON_COMPILING_IN_CPYTHON
jpayne@69 2608 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
jpayne@69 2609 #define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2)
jpayne@69 2610 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
jpayne@69 2611 static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b);
jpayne@69 2612 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
jpayne@69 2613 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
jpayne@69 2614 #else
jpayne@69 2615 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
jpayne@69 2616 #define __Pyx_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2))
jpayne@69 2617 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
jpayne@69 2618 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
jpayne@69 2619 #endif
jpayne@69 2620 #define __Pyx_PyErr_ExceptionMatches2(err1, err2) __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_CurrentExceptionType(), err1, err2)
jpayne@69 2621 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
jpayne@69 2622
jpayne@69 2623 /* CheckBinaryVersion.proto */
jpayne@69 2624 static unsigned long __Pyx_get_runtime_version(void);
jpayne@69 2625 static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer);
jpayne@69 2626
jpayne@69 2627 /* FunctionExport.proto */
jpayne@69 2628 static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig);
jpayne@69 2629
jpayne@69 2630 /* InitStrings.proto */
jpayne@69 2631 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
jpayne@69 2632
jpayne@69 2633 /* #### Code section: module_declarations ### */
jpayne@69 2634 static CYTHON_INLINE double __pyx_f_7cpython_7complex_7complex_4real_real(PyComplexObject *__pyx_v_self); /* proto*/
jpayne@69 2635 static CYTHON_INLINE double __pyx_f_7cpython_7complex_7complex_4imag_imag(PyComplexObject *__pyx_v_self); /* proto*/
jpayne@69 2636
jpayne@69 2637 /* Module declarations from "cython" */
jpayne@69 2638
jpayne@69 2639 /* Module declarations from "cpython.version" */
jpayne@69 2640
jpayne@69 2641 /* Module declarations from "__builtin__" */
jpayne@69 2642
jpayne@69 2643 /* Module declarations from "cpython.type" */
jpayne@69 2644
jpayne@69 2645 /* Module declarations from "libc.string" */
jpayne@69 2646
jpayne@69 2647 /* Module declarations from "libc.stdio" */
jpayne@69 2648
jpayne@69 2649 /* Module declarations from "cpython.object" */
jpayne@69 2650
jpayne@69 2651 /* Module declarations from "cpython.ref" */
jpayne@69 2652
jpayne@69 2653 /* Module declarations from "cpython.exc" */
jpayne@69 2654
jpayne@69 2655 /* Module declarations from "cpython.module" */
jpayne@69 2656
jpayne@69 2657 /* Module declarations from "cpython.mem" */
jpayne@69 2658
jpayne@69 2659 /* Module declarations from "cpython.tuple" */
jpayne@69 2660
jpayne@69 2661 /* Module declarations from "cpython.list" */
jpayne@69 2662
jpayne@69 2663 /* Module declarations from "cpython.sequence" */
jpayne@69 2664
jpayne@69 2665 /* Module declarations from "cpython.mapping" */
jpayne@69 2666
jpayne@69 2667 /* Module declarations from "cpython.iterator" */
jpayne@69 2668
jpayne@69 2669 /* Module declarations from "cpython.number" */
jpayne@69 2670
jpayne@69 2671 /* Module declarations from "cpython.int" */
jpayne@69 2672
jpayne@69 2673 /* Module declarations from "__builtin__" */
jpayne@69 2674
jpayne@69 2675 /* Module declarations from "cpython.bool" */
jpayne@69 2676
jpayne@69 2677 /* Module declarations from "cpython.long" */
jpayne@69 2678
jpayne@69 2679 /* Module declarations from "cpython.float" */
jpayne@69 2680
jpayne@69 2681 /* Module declarations from "__builtin__" */
jpayne@69 2682
jpayne@69 2683 /* Module declarations from "cpython.complex" */
jpayne@69 2684
jpayne@69 2685 /* Module declarations from "cpython.string" */
jpayne@69 2686
jpayne@69 2687 /* Module declarations from "libc.stddef" */
jpayne@69 2688
jpayne@69 2689 /* Module declarations from "cpython.unicode" */
jpayne@69 2690
jpayne@69 2691 /* Module declarations from "cpython.pyport" */
jpayne@69 2692
jpayne@69 2693 /* Module declarations from "cpython.dict" */
jpayne@69 2694
jpayne@69 2695 /* Module declarations from "cpython.instance" */
jpayne@69 2696
jpayne@69 2697 /* Module declarations from "cpython.function" */
jpayne@69 2698
jpayne@69 2699 /* Module declarations from "cpython.method" */
jpayne@69 2700
jpayne@69 2701 /* Module declarations from "cpython.weakref" */
jpayne@69 2702
jpayne@69 2703 /* Module declarations from "cpython.getargs" */
jpayne@69 2704
jpayne@69 2705 /* Module declarations from "cpython.pythread" */
jpayne@69 2706
jpayne@69 2707 /* Module declarations from "cpython.pystate" */
jpayne@69 2708
jpayne@69 2709 /* Module declarations from "cpython.cobject" */
jpayne@69 2710
jpayne@69 2711 /* Module declarations from "cpython.oldbuffer" */
jpayne@69 2712
jpayne@69 2713 /* Module declarations from "cpython.set" */
jpayne@69 2714
jpayne@69 2715 /* Module declarations from "cpython.buffer" */
jpayne@69 2716
jpayne@69 2717 /* Module declarations from "cpython.bytes" */
jpayne@69 2718
jpayne@69 2719 /* Module declarations from "cpython.pycapsule" */
jpayne@69 2720
jpayne@69 2721 /* Module declarations from "cpython.contextvars" */
jpayne@69 2722
jpayne@69 2723 /* Module declarations from "cpython" */
jpayne@69 2724
jpayne@69 2725 /* Module declarations from "array" */
jpayne@69 2726
jpayne@69 2727 /* Module declarations from "cpython.array" */
jpayne@69 2728 static CYTHON_INLINE arrayobject *__pyx_f_7cpython_5array_clone(arrayobject *, Py_ssize_t, int); /*proto*/
jpayne@69 2729 static CYTHON_INLINE int __pyx_f_7cpython_5array_extend_buffer(arrayobject *, char *, Py_ssize_t); /*proto*/
jpayne@69 2730
jpayne@69 2731 /* Module declarations from "libc.errno" */
jpayne@69 2732
jpayne@69 2733 /* Module declarations from "libc.stdlib" */
jpayne@69 2734
jpayne@69 2735 /* Module declarations from "libc.stdint" */
jpayne@69 2736
jpayne@69 2737 /* Module declarations from "posix.types" */
jpayne@69 2738
jpayne@69 2739 /* Module declarations from "posix.fcntl" */
jpayne@69 2740
jpayne@69 2741 /* Module declarations from "posix.unistd" */
jpayne@69 2742
jpayne@69 2743 /* Module declarations from "pysam.libcsamtools" */
jpayne@69 2744
jpayne@69 2745 /* Module declarations from "pysam.libcbcftools" */
jpayne@69 2746
jpayne@69 2747 /* Module declarations from "pysam.libcutils" */
jpayne@69 2748 static int __pyx_v_5pysam_9libcutils_MAX_POS;
jpayne@69 2749 static PyObject *__pyx_v_5pysam_9libcutils_ERROR_HANDLER = 0;
jpayne@69 2750 static PyObject *__pyx_v_5pysam_9libcutils_FILENAME_ENCODING = 0;
jpayne@69 2751 static PyObject *__pyx_v_5pysam_9libcutils_TEXT_ENCODING = 0;
jpayne@69 2752 static PyObject *__pyx_f_5pysam_9libcutils_parse_region(int __pyx_skip_dispatch, struct __pyx_opt_args_5pysam_9libcutils_parse_region *__pyx_optional_args); /*proto*/
jpayne@69 2753 static arrayobject *__pyx_f_5pysam_9libcutils_qualitystring_to_array(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_5pysam_9libcutils_qualitystring_to_array *__pyx_optional_args); /*proto*/
jpayne@69 2754 static PyObject *__pyx_f_5pysam_9libcutils_array_to_qualitystring(arrayobject *, int __pyx_skip_dispatch, struct __pyx_opt_args_5pysam_9libcutils_array_to_qualitystring *__pyx_optional_args); /*proto*/
jpayne@69 2755 static PyObject *__pyx_f_5pysam_9libcutils_qualities_to_qualitystring(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_5pysam_9libcutils_qualities_to_qualitystring *__pyx_optional_args); /*proto*/
jpayne@69 2756 static PyObject *__pyx_f_5pysam_9libcutils_get_encoding_error_handler(int __pyx_skip_dispatch); /*proto*/
jpayne@69 2757 static PyObject *__pyx_f_5pysam_9libcutils_set_encoding_error_handler(PyObject *, int __pyx_skip_dispatch); /*proto*/
jpayne@69 2758 static PyObject *__pyx_f_5pysam_9libcutils_force_str(PyObject *, struct __pyx_opt_args_5pysam_9libcutils_force_str *__pyx_optional_args); /*proto*/
jpayne@69 2759 static PyObject *__pyx_f_5pysam_9libcutils_force_bytes(PyObject *, struct __pyx_opt_args_5pysam_9libcutils_force_bytes *__pyx_optional_args); /*proto*/
jpayne@69 2760 /* #### Code section: typeinfo ### */
jpayne@69 2761 /* #### Code section: before_global_var ### */
jpayne@69 2762 #define __Pyx_MODULE_NAME "pysam.libcutils"
jpayne@69 2763 extern int __pyx_module_is_main_pysam__libcutils;
jpayne@69 2764 int __pyx_module_is_main_pysam__libcutils = 0;
jpayne@69 2765
jpayne@69 2766 /* Implementation of "pysam.libcutils" */
jpayne@69 2767 /* #### Code section: global_var ### */
jpayne@69 2768 static PyObject *__pyx_builtin_chr;
jpayne@69 2769 static PyObject *__pyx_builtin_TypeError;
jpayne@69 2770 static PyObject *__pyx_builtin_ValueError;
jpayne@69 2771 static PyObject *__pyx_builtin_OverflowError;
jpayne@69 2772 static PyObject *__pyx_builtin_IOError;
jpayne@69 2773 static PyObject *__pyx_builtin_OSError;
jpayne@69 2774 static PyObject *__pyx_builtin_open;
jpayne@69 2775 static PyObject *__pyx_builtin_UnicodeDecodeError;
jpayne@69 2776 static PyObject *__pyx_builtin_MemoryError;
jpayne@69 2777 /* #### Code section: string_decls ### */
jpayne@69 2778 static const char __pyx_k_[] = "";
jpayne@69 2779 static const char __pyx_k_B[] = "B";
jpayne@69 2780 static const char __pyx_k_a[] = "a";
jpayne@69 2781 static const char __pyx_k_c[] = "-c";
jpayne@69 2782 static const char __pyx_k_i[] = "i";
jpayne@69 2783 static const char __pyx_k_l[] = "l";
jpayne@69 2784 static const char __pyx_k_m[] = "-m";
jpayne@69 2785 static const char __pyx_k_n[] = "n";
jpayne@69 2786 static const char __pyx_k_o[] = "-o";
jpayne@69 2787 static const char __pyx_k_r[] = "r";
jpayne@69 2788 static const char __pyx_k__7[] = ":";
jpayne@69 2789 static const char __pyx_k__8[] = "-";
jpayne@69 2790 static const char __pyx_k_fn[] = "fn";
jpayne@69 2791 static const char __pyx_k_io[] = "io";
jpayne@69 2792 static const char __pyx_k_os[] = "os";
jpayne@69 2793 static const char __pyx_k_rb[] = "rb";
jpayne@69 2794 static const char __pyx_k_re[] = "re";
jpayne@69 2795 static const char __pyx_k__10[] = "-@";
jpayne@69 2796 static const char __pyx_k__11[] = " ";
jpayne@69 2797 static const char __pyx_k__14[] = "*";
jpayne@69 2798 static const char __pyx_k__15[] = ".";
jpayne@69 2799 static const char __pyx_k__33[] = "?";
jpayne@69 2800 static const char __pyx_k_all[] = "__all__";
jpayne@69 2801 static const char __pyx_k_arg[] = "arg";
jpayne@69 2802 static const char __pyx_k_chr[] = "chr";
jpayne@69 2803 static const char __pyx_k_end[] = "end";
jpayne@69 2804 static const char __pyx_k_inf[] = "inf";
jpayne@69 2805 static const char __pyx_k_o_2[] = "-o {}";
jpayne@69 2806 static const char __pyx_k_out[] = "out";
jpayne@69 2807 static const char __pyx_k_roh[] = "roh";
jpayne@69 2808 static const char __pyx_k_sys[] = "sys";
jpayne@69 2809 static const char __pyx_k_args[] = "args";
jpayne@69 2810 static const char __pyx_k_exit[] = "__exit__";
jpayne@69 2811 static const char __pyx_k_head[] = "head";
jpayne@69 2812 static const char __pyx_k_main[] = "__main__";
jpayne@69 2813 static const char __pyx_k_name[] = "name";
jpayne@69 2814 static const char __pyx_k_open[] = "open";
jpayne@69 2815 static const char __pyx_k_path[] = "path";
jpayne@69 2816 static const char __pyx_k_read[] = "read";
jpayne@69 2817 static const char __pyx_k_spec[] = "__spec__";
jpayne@69 2818 static const char __pyx_k_stop[] = "stop";
jpayne@69 2819 static const char __pyx_k_test[] = "__test__";
jpayne@69 2820 static const char __pyx_k_view[] = "view";
jpayne@69 2821 static const char __pyx_k_ascii[] = "ascii";
jpayne@69 2822 static const char __pyx_k_calmd[] = "calmd";
jpayne@69 2823 static const char __pyx_k_cargs[] = "cargs";
jpayne@69 2824 static const char __pyx_k_close[] = "close";
jpayne@69 2825 static const char __pyx_k_depad[] = "depad";
jpayne@69 2826 static const char __pyx_k_enter[] = "__enter__";
jpayne@69 2827 static const char __pyx_k_index[] = "index";
jpayne@69 2828 static const char __pyx_k_split[] = "split";
jpayne@69 2829 static const char __pyx_k_start[] = "start";
jpayne@69 2830 static const char __pyx_k_stats[] = "stats";
jpayne@69 2831 static const char __pyx_k_types[] = "types";
jpayne@69 2832 static const char __pyx_k_utf_8[] = "utf-8";
jpayne@69 2833 static const char __pyx_k_codecs[] = "codecs";
jpayne@69 2834 static const char __pyx_k_contig[] = "contig";
jpayne@69 2835 static const char __pyx_k_decode[] = "decode";
jpayne@69 2836 static const char __pyx_k_encode[] = "encode";
jpayne@69 2837 static const char __pyx_k_exists[] = "exists";
jpayne@69 2838 static const char __pyx_k_extend[] = "extend";
jpayne@69 2839 static const char __pyx_k_format[] = "format";
jpayne@69 2840 static const char __pyx_k_import[] = "__import__";
jpayne@69 2841 static const char __pyx_k_method[] = "method";
jpayne@69 2842 static const char __pyx_k_name_2[] = "__name__";
jpayne@69 2843 static const char __pyx_k_object[] = "object";
jpayne@69 2844 static const char __pyx_k_offset[] = "offset";
jpayne@69 2845 static const char __pyx_k_output[] = "--output";
jpayne@69 2846 static const char __pyx_k_region[] = "region";
jpayne@69 2847 static const char __pyx_k_remove[] = "remove";
jpayne@69 2848 static const char __pyx_k_retval[] = "retval";
jpayne@69 2849 static const char __pyx_k_strict[] = "strict";
jpayne@69 2850 static const char __pyx_k_string[] = "string";
jpayne@69 2851 static const char __pyx_k_IOError[] = "IOError";
jpayne@69 2852 static const char __pyx_k_OSError[] = "OSError";
jpayne@69 2853 static const char __pyx_k_collect[] = "_collect";
jpayne@69 2854 static const char __pyx_k_mkstemp[] = "mkstemp";
jpayne@69 2855 static const char __pyx_k_mpileup[] = "mpileup";
jpayne@69 2856 static const char __pyx_k_threads[] = "--threads";
jpayne@69 2857 static const char __pyx_k_tobytes[] = "tobytes";
jpayne@69 2858 static const char __pyx_k_bcftools[] = "bcftools";
jpayne@69 2859 static const char __pyx_k_fsencode[] = "fsencode";
jpayne@69 2860 static const char __pyx_k_is_usage[] = "is_usage";
jpayne@69 2861 static const char __pyx_k_samtools[] = "samtools";
jpayne@69 2862 static const char __pyx_k_stderr_f[] = "stderr_f";
jpayne@69 2863 static const char __pyx_k_stderr_h[] = "stderr_h";
jpayne@69 2864 static const char __pyx_k_stdout_f[] = "stdout_f";
jpayne@69 2865 static const char __pyx_k_stdout_h[] = "stdout_h";
jpayne@69 2866 static const char __pyx_k_tempfile[] = "tempfile";
jpayne@69 2867 static const char __pyx_k_ARGUMENTS[] = "ARGUMENTS";
jpayne@69 2868 static const char __pyx_k_TypeError[] = "TypeError";
jpayne@69 2869 static const char __pyx_k_exception[] = "exception";
jpayne@69 2870 static const char __pyx_k_input_str[] = "input_str";
jpayne@69 2871 static const char __pyx_k_min_shift[] = "--min-shift";
jpayne@69 2872 static const char __pyx_k_qualities[] = "qualities";
jpayne@69 2873 static const char __pyx_k_reference[] = "reference";
jpayne@69 2874 static const char __pyx_k_skip_next[] = "skip_next";
jpayne@69 2875 static const char __pyx_k_ValueError[] = "ValueError";
jpayne@69 2876 static const char __pyx_k_collection[] = "collection";
jpayne@69 2877 static const char __pyx_k_contextlib[] = "contextlib";
jpayne@69 2878 static const char __pyx_k_extra_args[] = "extra_args";
jpayne@69 2879 static const char __pyx_k_out_stderr[] = "out_stderr";
jpayne@69 2880 static const char __pyx_k_out_stdout[] = "out_stdout";
jpayne@69 2881 static const char __pyx_k_startswith[] = "startswith";
jpayne@69 2882 static const char __pyx_k_MemoryError[] = "MemoryError";
jpayne@69 2883 static const char __pyx_k_output_file[] = "--output-file";
jpayne@69 2884 static const char __pyx_k_save_stdout[] = "save_stdout";
jpayne@69 2885 static const char __pyx_k_catch_stdout[] = "catch_stdout";
jpayne@69 2886 static const char __pyx_k_initializing[] = "_initializing";
jpayne@69 2887 static const char __pyx_k_is_coroutine[] = "_is_coroutine";
jpayne@69 2888 static const char __pyx_k_parse_region[] = "parse_region";
jpayne@69 2889 static const char __pyx_k_OverflowError[] = "OverflowError";
jpayne@69 2890 static const char __pyx_k_class_getitem[] = "__class_getitem__";
jpayne@69 2891 static const char __pyx_k_stdout_option[] = "stdout_option";
jpayne@69 2892 static const char __pyx_k_contextmanager[] = "contextmanager";
jpayne@69 2893 static const char __pyx_k_latin1_replace[] = "latin1_replace";
jpayne@69 2894 static const char __pyx_k_pysam_dispatch[] = "_pysam_dispatch";
jpayne@69 2895 static const char __pyx_k_register_error[] = "register_error";
jpayne@69 2896 static const char __pyx_k_pysam_libcutils[] = "pysam.libcutils";
jpayne@69 2897 static const char __pyx_k_MAP_STDOUT_OPTIONS[] = "MAP_STDOUT_OPTIONS";
jpayne@69 2898 static const char __pyx_k_UnicodeDecodeError[] = "UnicodeDecodeError";
jpayne@69 2899 static const char __pyx_k_asyncio_coroutines[] = "asyncio.coroutines";
jpayne@69 2900 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
jpayne@69 2901 static const char __pyx_k_getdefaultencoding[] = "getdefaultencoding";
jpayne@69 2902 static const char __pyx_k_pysam_latin1replace[] = "pysam.latin1replace";
jpayne@69 2903 static const char __pyx_k_pysam_libcutils_pyx[] = "pysam/libcutils.pyx";
jpayne@69 2904 static const char __pyx_k_stop_out_of_range_i[] = "stop out of range (%i)";
jpayne@69 2905 static const char __pyx_k_start_out_of_range_i[] = "start out of range (%i)";
jpayne@69 2906 static const char __pyx_k_getfilesystemencoding[] = "getfilesystemencoding";
jpayne@69 2907 static const char __pyx_k_array_to_qualitystring[] = "array_to_qualitystring";
jpayne@69 2908 static const char __pyx_k_qualitystring_to_array[] = "qualitystring_to_array";
jpayne@69 2909 static const char __pyx_k_get_encoding_error_handler[] = "get_encoding_error_handler";
jpayne@69 2910 static const char __pyx_k_qualities_to_qualitystring[] = "qualities_to_qualitystring";
jpayne@69 2911 static const char __pyx_k_set_encoding_error_handler[] = "set_encoding_error_handler";
jpayne@69 2912 static const char __pyx_k_No_such_file_or_directory_s[] = "No such file or directory: '%s'";
jpayne@69 2913 static const char __pyx_k_pysam_dispatch_locals__collect[] = "_pysam_dispatch.<locals>._collect";
jpayne@69 2914 static const char __pyx_k_contig_and_reference_should_not[] = "contig and reference should not both be specified";
jpayne@69 2915 static const char __pyx_k_stop_and_end_should_not_both_be[] = "stop and end should not both be specified";
jpayne@69 2916 static const char __pyx_k_Argument_must_be_string_bytes_or[] = "Argument must be string, bytes or unicode.";
jpayne@69 2917 static const char __pyx_k_contig_reference_and_region_shou[] = "contig/reference and region should not both be specified";
jpayne@69 2918 static const char __pyx_k_error_while_opening_file_for_wri[] = "error while opening file for writing";
jpayne@69 2919 static const char __pyx_k_invalid_coordinates_start_i_stop[] = "invalid coordinates: start (%i) > stop (%i)";
jpayne@69 2920 static const char __pyx_k_neither_contig_nor_region_are_gi[] = "neither contig nor region are given";
jpayne@69 2921 /* #### Code section: decls ### */
jpayne@69 2922 static int __pyx_pf_7cpython_5array_5array___getbuffer__(arrayobject *__pyx_v_self, Py_buffer *__pyx_v_info, CYTHON_UNUSED int __pyx_v_flags); /* proto */
jpayne@69 2923 static void __pyx_pf_7cpython_5array_5array_2__releasebuffer__(CYTHON_UNUSED arrayobject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */
jpayne@69 2924 static PyObject *__pyx_pf_5pysam_9libcutils_qualitystring_to_array(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_input_str, int __pyx_v_offset); /* proto */
jpayne@69 2925 static PyObject *__pyx_pf_5pysam_9libcutils_2array_to_qualitystring(CYTHON_UNUSED PyObject *__pyx_self, arrayobject *__pyx_v_qualities, int __pyx_v_offset); /* proto */
jpayne@69 2926 static PyObject *__pyx_pf_5pysam_9libcutils_4qualities_to_qualitystring(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_qualities, int __pyx_v_offset); /* proto */
jpayne@69 2927 static PyObject *__pyx_pf_5pysam_9libcutils_6latin1_replace(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_exception); /* proto */
jpayne@69 2928 static PyObject *__pyx_pf_5pysam_9libcutils_8get_encoding_error_handler(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
jpayne@69 2929 static PyObject *__pyx_pf_5pysam_9libcutils_10set_encoding_error_handler(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_name); /* proto */
jpayne@69 2930 static PyObject *__pyx_pf_5pysam_9libcutils_12parse_region(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_contig, PyObject *__pyx_v_start, PyObject *__pyx_v_stop, PyObject *__pyx_v_region, PyObject *__pyx_v_reference, PyObject *__pyx_v_end); /* proto */
jpayne@69 2931 static PyObject *__pyx_pf_5pysam_9libcutils_15_pysam_dispatch__collect(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fn); /* proto */
jpayne@69 2932 static PyObject *__pyx_pf_5pysam_9libcutils_14_pysam_dispatch(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_collection, PyObject *__pyx_v_method, PyObject *__pyx_v_args, PyObject *__pyx_v_catch_stdout, PyObject *__pyx_v_is_usage, PyObject *__pyx_v_save_stdout); /* proto */
jpayne@69 2933 /* #### Code section: late_includes ### */
jpayne@69 2934 /* #### Code section: module_state ### */
jpayne@69 2935 typedef struct {
jpayne@69 2936 PyObject *__pyx_d;
jpayne@69 2937 PyObject *__pyx_b;
jpayne@69 2938 PyObject *__pyx_cython_runtime;
jpayne@69 2939 PyObject *__pyx_empty_tuple;
jpayne@69 2940 PyObject *__pyx_empty_bytes;
jpayne@69 2941 PyObject *__pyx_empty_unicode;
jpayne@69 2942 #ifdef __Pyx_CyFunction_USED
jpayne@69 2943 PyTypeObject *__pyx_CyFunctionType;
jpayne@69 2944 #endif
jpayne@69 2945 #ifdef __Pyx_FusedFunction_USED
jpayne@69 2946 PyTypeObject *__pyx_FusedFunctionType;
jpayne@69 2947 #endif
jpayne@69 2948 #ifdef __Pyx_Generator_USED
jpayne@69 2949 PyTypeObject *__pyx_GeneratorType;
jpayne@69 2950 #endif
jpayne@69 2951 #ifdef __Pyx_IterableCoroutine_USED
jpayne@69 2952 PyTypeObject *__pyx_IterableCoroutineType;
jpayne@69 2953 #endif
jpayne@69 2954 #ifdef __Pyx_Coroutine_USED
jpayne@69 2955 PyTypeObject *__pyx_CoroutineAwaitType;
jpayne@69 2956 #endif
jpayne@69 2957 #ifdef __Pyx_Coroutine_USED
jpayne@69 2958 PyTypeObject *__pyx_CoroutineType;
jpayne@69 2959 #endif
jpayne@69 2960 #if CYTHON_USE_MODULE_STATE
jpayne@69 2961 #endif
jpayne@69 2962 #if CYTHON_USE_MODULE_STATE
jpayne@69 2963 #endif
jpayne@69 2964 #if CYTHON_USE_MODULE_STATE
jpayne@69 2965 #endif
jpayne@69 2966 #if CYTHON_USE_MODULE_STATE
jpayne@69 2967 #endif
jpayne@69 2968 PyTypeObject *__pyx_ptype_7cpython_4type_type;
jpayne@69 2969 #if CYTHON_USE_MODULE_STATE
jpayne@69 2970 #endif
jpayne@69 2971 #if CYTHON_USE_MODULE_STATE
jpayne@69 2972 #endif
jpayne@69 2973 #if CYTHON_USE_MODULE_STATE
jpayne@69 2974 #endif
jpayne@69 2975 #if CYTHON_USE_MODULE_STATE
jpayne@69 2976 #endif
jpayne@69 2977 #if CYTHON_USE_MODULE_STATE
jpayne@69 2978 #endif
jpayne@69 2979 #if CYTHON_USE_MODULE_STATE
jpayne@69 2980 #endif
jpayne@69 2981 #if CYTHON_USE_MODULE_STATE
jpayne@69 2982 #endif
jpayne@69 2983 #if CYTHON_USE_MODULE_STATE
jpayne@69 2984 #endif
jpayne@69 2985 #if CYTHON_USE_MODULE_STATE
jpayne@69 2986 #endif
jpayne@69 2987 #if CYTHON_USE_MODULE_STATE
jpayne@69 2988 #endif
jpayne@69 2989 #if CYTHON_USE_MODULE_STATE
jpayne@69 2990 #endif
jpayne@69 2991 #if CYTHON_USE_MODULE_STATE
jpayne@69 2992 #endif
jpayne@69 2993 #if CYTHON_USE_MODULE_STATE
jpayne@69 2994 #endif
jpayne@69 2995 #if CYTHON_USE_MODULE_STATE
jpayne@69 2996 #endif
jpayne@69 2997 #if CYTHON_USE_MODULE_STATE
jpayne@69 2998 #endif
jpayne@69 2999 #if CYTHON_USE_MODULE_STATE
jpayne@69 3000 #endif
jpayne@69 3001 PyTypeObject *__pyx_ptype_7cpython_4bool_bool;
jpayne@69 3002 #if CYTHON_USE_MODULE_STATE
jpayne@69 3003 #endif
jpayne@69 3004 #if CYTHON_USE_MODULE_STATE
jpayne@69 3005 #endif
jpayne@69 3006 #if CYTHON_USE_MODULE_STATE
jpayne@69 3007 #endif
jpayne@69 3008 #if CYTHON_USE_MODULE_STATE
jpayne@69 3009 #endif
jpayne@69 3010 PyTypeObject *__pyx_ptype_7cpython_7complex_complex;
jpayne@69 3011 #if CYTHON_USE_MODULE_STATE
jpayne@69 3012 #endif
jpayne@69 3013 #if CYTHON_USE_MODULE_STATE
jpayne@69 3014 #endif
jpayne@69 3015 #if CYTHON_USE_MODULE_STATE
jpayne@69 3016 #endif
jpayne@69 3017 #if CYTHON_USE_MODULE_STATE
jpayne@69 3018 #endif
jpayne@69 3019 #if CYTHON_USE_MODULE_STATE
jpayne@69 3020 #endif
jpayne@69 3021 #if CYTHON_USE_MODULE_STATE
jpayne@69 3022 #endif
jpayne@69 3023 #if CYTHON_USE_MODULE_STATE
jpayne@69 3024 #endif
jpayne@69 3025 #if CYTHON_USE_MODULE_STATE
jpayne@69 3026 #endif
jpayne@69 3027 #if CYTHON_USE_MODULE_STATE
jpayne@69 3028 #endif
jpayne@69 3029 #if CYTHON_USE_MODULE_STATE
jpayne@69 3030 #endif
jpayne@69 3031 #if CYTHON_USE_MODULE_STATE
jpayne@69 3032 #endif
jpayne@69 3033 #if CYTHON_USE_MODULE_STATE
jpayne@69 3034 #endif
jpayne@69 3035 #if CYTHON_USE_MODULE_STATE
jpayne@69 3036 #endif
jpayne@69 3037 #if CYTHON_USE_MODULE_STATE
jpayne@69 3038 #endif
jpayne@69 3039 #if CYTHON_USE_MODULE_STATE
jpayne@69 3040 #endif
jpayne@69 3041 #if CYTHON_USE_MODULE_STATE
jpayne@69 3042 #endif
jpayne@69 3043 #if CYTHON_USE_MODULE_STATE
jpayne@69 3044 #endif
jpayne@69 3045 #if CYTHON_USE_MODULE_STATE
jpayne@69 3046 #endif
jpayne@69 3047 #if CYTHON_USE_MODULE_STATE
jpayne@69 3048 #endif
jpayne@69 3049 #if CYTHON_USE_MODULE_STATE
jpayne@69 3050 #endif
jpayne@69 3051 #if CYTHON_USE_MODULE_STATE
jpayne@69 3052 #endif
jpayne@69 3053 #if CYTHON_USE_MODULE_STATE
jpayne@69 3054 #endif
jpayne@69 3055 PyTypeObject *__pyx_ptype_7cpython_5array_array;
jpayne@69 3056 #if CYTHON_USE_MODULE_STATE
jpayne@69 3057 #endif
jpayne@69 3058 #if CYTHON_USE_MODULE_STATE
jpayne@69 3059 #endif
jpayne@69 3060 #if CYTHON_USE_MODULE_STATE
jpayne@69 3061 #endif
jpayne@69 3062 #if CYTHON_USE_MODULE_STATE
jpayne@69 3063 #endif
jpayne@69 3064 #if CYTHON_USE_MODULE_STATE
jpayne@69 3065 #endif
jpayne@69 3066 #if CYTHON_USE_MODULE_STATE
jpayne@69 3067 #endif
jpayne@69 3068 #if CYTHON_USE_MODULE_STATE
jpayne@69 3069 #endif
jpayne@69 3070 #if CYTHON_USE_MODULE_STATE
jpayne@69 3071 #endif
jpayne@69 3072 #if CYTHON_USE_MODULE_STATE
jpayne@69 3073 #endif
jpayne@69 3074 PyObject *__pyx_kp_u_;
jpayne@69 3075 PyObject *__pyx_n_s_ARGUMENTS;
jpayne@69 3076 PyObject *__pyx_kp_u_Argument_must_be_string_bytes_or;
jpayne@69 3077 PyObject *__pyx_n_u_B;
jpayne@69 3078 PyObject *__pyx_n_s_IOError;
jpayne@69 3079 PyObject *__pyx_n_s_MAP_STDOUT_OPTIONS;
jpayne@69 3080 PyObject *__pyx_n_s_MemoryError;
jpayne@69 3081 PyObject *__pyx_kp_u_No_such_file_or_directory_s;
jpayne@69 3082 PyObject *__pyx_n_s_OSError;
jpayne@69 3083 PyObject *__pyx_n_s_OverflowError;
jpayne@69 3084 PyObject *__pyx_n_s_TypeError;
jpayne@69 3085 PyObject *__pyx_n_s_UnicodeDecodeError;
jpayne@69 3086 PyObject *__pyx_n_s_ValueError;
jpayne@69 3087 PyObject *__pyx_kp_u__10;
jpayne@69 3088 PyObject *__pyx_kp_u__11;
jpayne@69 3089 PyObject *__pyx_n_s__14;
jpayne@69 3090 PyObject *__pyx_kp_u__15;
jpayne@69 3091 PyObject *__pyx_n_s__33;
jpayne@69 3092 PyObject *__pyx_kp_u__7;
jpayne@69 3093 PyObject *__pyx_kp_u__8;
jpayne@69 3094 PyObject *__pyx_n_s_a;
jpayne@69 3095 PyObject *__pyx_n_s_all;
jpayne@69 3096 PyObject *__pyx_n_s_arg;
jpayne@69 3097 PyObject *__pyx_n_s_args;
jpayne@69 3098 PyObject *__pyx_n_s_array_to_qualitystring;
jpayne@69 3099 PyObject *__pyx_n_u_array_to_qualitystring;
jpayne@69 3100 PyObject *__pyx_n_u_ascii;
jpayne@69 3101 PyObject *__pyx_n_s_asyncio_coroutines;
jpayne@69 3102 PyObject *__pyx_n_b_bcftools;
jpayne@69 3103 PyObject *__pyx_n_u_bcftools;
jpayne@69 3104 PyObject *__pyx_kp_u_c;
jpayne@69 3105 PyObject *__pyx_n_u_calmd;
jpayne@69 3106 PyObject *__pyx_n_s_cargs;
jpayne@69 3107 PyObject *__pyx_n_s_catch_stdout;
jpayne@69 3108 PyObject *__pyx_n_s_chr;
jpayne@69 3109 PyObject *__pyx_n_s_class_getitem;
jpayne@69 3110 PyObject *__pyx_n_s_cline_in_traceback;
jpayne@69 3111 PyObject *__pyx_n_s_close;
jpayne@69 3112 PyObject *__pyx_n_s_codecs;
jpayne@69 3113 PyObject *__pyx_n_s_collect;
jpayne@69 3114 PyObject *__pyx_n_s_collection;
jpayne@69 3115 PyObject *__pyx_n_s_contextlib;
jpayne@69 3116 PyObject *__pyx_n_s_contextmanager;
jpayne@69 3117 PyObject *__pyx_n_s_contig;
jpayne@69 3118 PyObject *__pyx_kp_u_contig_and_reference_should_not;
jpayne@69 3119 PyObject *__pyx_kp_u_contig_reference_and_region_shou;
jpayne@69 3120 PyObject *__pyx_n_s_decode;
jpayne@69 3121 PyObject *__pyx_n_u_depad;
jpayne@69 3122 PyObject *__pyx_n_s_encode;
jpayne@69 3123 PyObject *__pyx_n_s_end;
jpayne@69 3124 PyObject *__pyx_n_s_enter;
jpayne@69 3125 PyObject *__pyx_kp_u_error_while_opening_file_for_wri;
jpayne@69 3126 PyObject *__pyx_n_s_exception;
jpayne@69 3127 PyObject *__pyx_n_s_exists;
jpayne@69 3128 PyObject *__pyx_n_s_exit;
jpayne@69 3129 PyObject *__pyx_n_s_extend;
jpayne@69 3130 PyObject *__pyx_n_s_extra_args;
jpayne@69 3131 PyObject *__pyx_n_s_fn;
jpayne@69 3132 PyObject *__pyx_n_s_format;
jpayne@69 3133 PyObject *__pyx_n_s_fsencode;
jpayne@69 3134 PyObject *__pyx_n_s_get_encoding_error_handler;
jpayne@69 3135 PyObject *__pyx_n_u_get_encoding_error_handler;
jpayne@69 3136 PyObject *__pyx_n_s_getdefaultencoding;
jpayne@69 3137 PyObject *__pyx_n_s_getfilesystemencoding;
jpayne@69 3138 PyObject *__pyx_n_u_head;
jpayne@69 3139 PyObject *__pyx_n_s_i;
jpayne@69 3140 PyObject *__pyx_n_s_import;
jpayne@69 3141 PyObject *__pyx_n_b_index;
jpayne@69 3142 PyObject *__pyx_n_u_index;
jpayne@69 3143 PyObject *__pyx_n_s_inf;
jpayne@69 3144 PyObject *__pyx_n_s_initializing;
jpayne@69 3145 PyObject *__pyx_n_s_input_str;
jpayne@69 3146 PyObject *__pyx_kp_u_invalid_coordinates_start_i_stop;
jpayne@69 3147 PyObject *__pyx_n_s_io;
jpayne@69 3148 PyObject *__pyx_n_s_is_coroutine;
jpayne@69 3149 PyObject *__pyx_n_s_is_usage;
jpayne@69 3150 PyObject *__pyx_n_s_l;
jpayne@69 3151 PyObject *__pyx_n_s_latin1_replace;
jpayne@69 3152 PyObject *__pyx_kp_u_m;
jpayne@69 3153 PyObject *__pyx_n_s_main;
jpayne@69 3154 PyObject *__pyx_n_s_method;
jpayne@69 3155 PyObject *__pyx_kp_u_min_shift;
jpayne@69 3156 PyObject *__pyx_n_s_mkstemp;
jpayne@69 3157 PyObject *__pyx_n_u_mpileup;
jpayne@69 3158 PyObject *__pyx_n_s_n;
jpayne@69 3159 PyObject *__pyx_n_s_name;
jpayne@69 3160 PyObject *__pyx_n_s_name_2;
jpayne@69 3161 PyObject *__pyx_kp_u_neither_contig_nor_region_are_gi;
jpayne@69 3162 PyObject *__pyx_kp_u_o;
jpayne@69 3163 PyObject *__pyx_kp_u_o_2;
jpayne@69 3164 PyObject *__pyx_n_s_object;
jpayne@69 3165 PyObject *__pyx_n_s_offset;
jpayne@69 3166 PyObject *__pyx_n_s_open;
jpayne@69 3167 PyObject *__pyx_n_s_os;
jpayne@69 3168 PyObject *__pyx_n_s_out;
jpayne@69 3169 PyObject *__pyx_n_s_out_stderr;
jpayne@69 3170 PyObject *__pyx_n_s_out_stdout;
jpayne@69 3171 PyObject *__pyx_kp_u_output;
jpayne@69 3172 PyObject *__pyx_kp_u_output_file;
jpayne@69 3173 PyObject *__pyx_n_s_parse_region;
jpayne@69 3174 PyObject *__pyx_n_s_path;
jpayne@69 3175 PyObject *__pyx_n_s_pysam_dispatch;
jpayne@69 3176 PyObject *__pyx_n_s_pysam_dispatch_locals__collect;
jpayne@69 3177 PyObject *__pyx_kp_u_pysam_latin1replace;
jpayne@69 3178 PyObject *__pyx_n_s_pysam_libcutils;
jpayne@69 3179 PyObject *__pyx_kp_s_pysam_libcutils_pyx;
jpayne@69 3180 PyObject *__pyx_n_s_qualities;
jpayne@69 3181 PyObject *__pyx_n_s_qualities_to_qualitystring;
jpayne@69 3182 PyObject *__pyx_n_u_qualities_to_qualitystring;
jpayne@69 3183 PyObject *__pyx_n_s_qualitystring_to_array;
jpayne@69 3184 PyObject *__pyx_n_u_qualitystring_to_array;
jpayne@69 3185 PyObject *__pyx_n_u_r;
jpayne@69 3186 PyObject *__pyx_n_u_rb;
jpayne@69 3187 PyObject *__pyx_n_s_re;
jpayne@69 3188 PyObject *__pyx_n_s_read;
jpayne@69 3189 PyObject *__pyx_n_s_reference;
jpayne@69 3190 PyObject *__pyx_n_s_region;
jpayne@69 3191 PyObject *__pyx_n_s_register_error;
jpayne@69 3192 PyObject *__pyx_n_s_remove;
jpayne@69 3193 PyObject *__pyx_n_s_retval;
jpayne@69 3194 PyObject *__pyx_n_u_roh;
jpayne@69 3195 PyObject *__pyx_n_b_samtools;
jpayne@69 3196 PyObject *__pyx_n_u_samtools;
jpayne@69 3197 PyObject *__pyx_n_s_save_stdout;
jpayne@69 3198 PyObject *__pyx_n_s_set_encoding_error_handler;
jpayne@69 3199 PyObject *__pyx_n_u_set_encoding_error_handler;
jpayne@69 3200 PyObject *__pyx_n_s_skip_next;
jpayne@69 3201 PyObject *__pyx_n_s_spec;
jpayne@69 3202 PyObject *__pyx_n_s_split;
jpayne@69 3203 PyObject *__pyx_n_s_start;
jpayne@69 3204 PyObject *__pyx_kp_u_start_out_of_range_i;
jpayne@69 3205 PyObject *__pyx_n_s_startswith;
jpayne@69 3206 PyObject *__pyx_n_u_stats;
jpayne@69 3207 PyObject *__pyx_n_s_stderr_f;
jpayne@69 3208 PyObject *__pyx_n_s_stderr_h;
jpayne@69 3209 PyObject *__pyx_n_s_stdout_f;
jpayne@69 3210 PyObject *__pyx_n_s_stdout_h;
jpayne@69 3211 PyObject *__pyx_n_s_stdout_option;
jpayne@69 3212 PyObject *__pyx_n_s_stop;
jpayne@69 3213 PyObject *__pyx_kp_u_stop_and_end_should_not_both_be;
jpayne@69 3214 PyObject *__pyx_kp_u_stop_out_of_range_i;
jpayne@69 3215 PyObject *__pyx_n_u_strict;
jpayne@69 3216 PyObject *__pyx_n_s_string;
jpayne@69 3217 PyObject *__pyx_n_s_sys;
jpayne@69 3218 PyObject *__pyx_n_s_tempfile;
jpayne@69 3219 PyObject *__pyx_n_s_test;
jpayne@69 3220 PyObject *__pyx_kp_u_threads;
jpayne@69 3221 PyObject *__pyx_n_s_tobytes;
jpayne@69 3222 PyObject *__pyx_n_s_types;
jpayne@69 3223 PyObject *__pyx_kp_u_utf_8;
jpayne@69 3224 PyObject *__pyx_n_u_view;
jpayne@69 3225 PyObject *__pyx_int_1;
jpayne@69 3226 PyObject *__pyx_int_33;
jpayne@69 3227 PyObject *__pyx_int_neg_1;
jpayne@69 3228 PyObject *__pyx_tuple__2;
jpayne@69 3229 PyObject *__pyx_tuple__3;
jpayne@69 3230 PyObject *__pyx_tuple__4;
jpayne@69 3231 PyObject *__pyx_tuple__5;
jpayne@69 3232 PyObject *__pyx_tuple__6;
jpayne@69 3233 PyObject *__pyx_tuple__9;
jpayne@69 3234 PyObject *__pyx_tuple__12;
jpayne@69 3235 PyObject *__pyx_tuple__16;
jpayne@69 3236 PyObject *__pyx_tuple__18;
jpayne@69 3237 PyObject *__pyx_tuple__19;
jpayne@69 3238 PyObject *__pyx_tuple__22;
jpayne@69 3239 PyObject *__pyx_tuple__25;
jpayne@69 3240 PyObject *__pyx_tuple__27;
jpayne@69 3241 PyObject *__pyx_tuple__29;
jpayne@69 3242 PyObject *__pyx_tuple__30;
jpayne@69 3243 PyObject *__pyx_tuple__32;
jpayne@69 3244 PyObject *__pyx_codeobj__13;
jpayne@69 3245 PyObject *__pyx_codeobj__17;
jpayne@69 3246 PyObject *__pyx_codeobj__20;
jpayne@69 3247 PyObject *__pyx_codeobj__21;
jpayne@69 3248 PyObject *__pyx_codeobj__23;
jpayne@69 3249 PyObject *__pyx_codeobj__24;
jpayne@69 3250 PyObject *__pyx_codeobj__26;
jpayne@69 3251 PyObject *__pyx_codeobj__28;
jpayne@69 3252 PyObject *__pyx_codeobj__31;
jpayne@69 3253 } __pyx_mstate;
jpayne@69 3254
jpayne@69 3255 #if CYTHON_USE_MODULE_STATE
jpayne@69 3256 #ifdef __cplusplus
jpayne@69 3257 namespace {
jpayne@69 3258 extern struct PyModuleDef __pyx_moduledef;
jpayne@69 3259 } /* anonymous namespace */
jpayne@69 3260 #else
jpayne@69 3261 static struct PyModuleDef __pyx_moduledef;
jpayne@69 3262 #endif
jpayne@69 3263
jpayne@69 3264 #define __pyx_mstate(o) ((__pyx_mstate *)__Pyx_PyModule_GetState(o))
jpayne@69 3265
jpayne@69 3266 #define __pyx_mstate_global (__pyx_mstate(PyState_FindModule(&__pyx_moduledef)))
jpayne@69 3267
jpayne@69 3268 #define __pyx_m (PyState_FindModule(&__pyx_moduledef))
jpayne@69 3269 #else
jpayne@69 3270 static __pyx_mstate __pyx_mstate_global_static =
jpayne@69 3271 #ifdef __cplusplus
jpayne@69 3272 {};
jpayne@69 3273 #else
jpayne@69 3274 {0};
jpayne@69 3275 #endif
jpayne@69 3276 static __pyx_mstate *__pyx_mstate_global = &__pyx_mstate_global_static;
jpayne@69 3277 #endif
jpayne@69 3278 /* #### Code section: module_state_clear ### */
jpayne@69 3279 #if CYTHON_USE_MODULE_STATE
jpayne@69 3280 static int __pyx_m_clear(PyObject *m) {
jpayne@69 3281 __pyx_mstate *clear_module_state = __pyx_mstate(m);
jpayne@69 3282 if (!clear_module_state) return 0;
jpayne@69 3283 Py_CLEAR(clear_module_state->__pyx_d);
jpayne@69 3284 Py_CLEAR(clear_module_state->__pyx_b);
jpayne@69 3285 Py_CLEAR(clear_module_state->__pyx_cython_runtime);
jpayne@69 3286 Py_CLEAR(clear_module_state->__pyx_empty_tuple);
jpayne@69 3287 Py_CLEAR(clear_module_state->__pyx_empty_bytes);
jpayne@69 3288 Py_CLEAR(clear_module_state->__pyx_empty_unicode);
jpayne@69 3289 #ifdef __Pyx_CyFunction_USED
jpayne@69 3290 Py_CLEAR(clear_module_state->__pyx_CyFunctionType);
jpayne@69 3291 #endif
jpayne@69 3292 #ifdef __Pyx_FusedFunction_USED
jpayne@69 3293 Py_CLEAR(clear_module_state->__pyx_FusedFunctionType);
jpayne@69 3294 #endif
jpayne@69 3295 Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_4type_type);
jpayne@69 3296 Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_4bool_bool);
jpayne@69 3297 Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_7complex_complex);
jpayne@69 3298 Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_5array_array);
jpayne@69 3299 Py_CLEAR(clear_module_state->__pyx_kp_u_);
jpayne@69 3300 Py_CLEAR(clear_module_state->__pyx_n_s_ARGUMENTS);
jpayne@69 3301 Py_CLEAR(clear_module_state->__pyx_kp_u_Argument_must_be_string_bytes_or);
jpayne@69 3302 Py_CLEAR(clear_module_state->__pyx_n_u_B);
jpayne@69 3303 Py_CLEAR(clear_module_state->__pyx_n_s_IOError);
jpayne@69 3304 Py_CLEAR(clear_module_state->__pyx_n_s_MAP_STDOUT_OPTIONS);
jpayne@69 3305 Py_CLEAR(clear_module_state->__pyx_n_s_MemoryError);
jpayne@69 3306 Py_CLEAR(clear_module_state->__pyx_kp_u_No_such_file_or_directory_s);
jpayne@69 3307 Py_CLEAR(clear_module_state->__pyx_n_s_OSError);
jpayne@69 3308 Py_CLEAR(clear_module_state->__pyx_n_s_OverflowError);
jpayne@69 3309 Py_CLEAR(clear_module_state->__pyx_n_s_TypeError);
jpayne@69 3310 Py_CLEAR(clear_module_state->__pyx_n_s_UnicodeDecodeError);
jpayne@69 3311 Py_CLEAR(clear_module_state->__pyx_n_s_ValueError);
jpayne@69 3312 Py_CLEAR(clear_module_state->__pyx_kp_u__10);
jpayne@69 3313 Py_CLEAR(clear_module_state->__pyx_kp_u__11);
jpayne@69 3314 Py_CLEAR(clear_module_state->__pyx_n_s__14);
jpayne@69 3315 Py_CLEAR(clear_module_state->__pyx_kp_u__15);
jpayne@69 3316 Py_CLEAR(clear_module_state->__pyx_n_s__33);
jpayne@69 3317 Py_CLEAR(clear_module_state->__pyx_kp_u__7);
jpayne@69 3318 Py_CLEAR(clear_module_state->__pyx_kp_u__8);
jpayne@69 3319 Py_CLEAR(clear_module_state->__pyx_n_s_a);
jpayne@69 3320 Py_CLEAR(clear_module_state->__pyx_n_s_all);
jpayne@69 3321 Py_CLEAR(clear_module_state->__pyx_n_s_arg);
jpayne@69 3322 Py_CLEAR(clear_module_state->__pyx_n_s_args);
jpayne@69 3323 Py_CLEAR(clear_module_state->__pyx_n_s_array_to_qualitystring);
jpayne@69 3324 Py_CLEAR(clear_module_state->__pyx_n_u_array_to_qualitystring);
jpayne@69 3325 Py_CLEAR(clear_module_state->__pyx_n_u_ascii);
jpayne@69 3326 Py_CLEAR(clear_module_state->__pyx_n_s_asyncio_coroutines);
jpayne@69 3327 Py_CLEAR(clear_module_state->__pyx_n_b_bcftools);
jpayne@69 3328 Py_CLEAR(clear_module_state->__pyx_n_u_bcftools);
jpayne@69 3329 Py_CLEAR(clear_module_state->__pyx_kp_u_c);
jpayne@69 3330 Py_CLEAR(clear_module_state->__pyx_n_u_calmd);
jpayne@69 3331 Py_CLEAR(clear_module_state->__pyx_n_s_cargs);
jpayne@69 3332 Py_CLEAR(clear_module_state->__pyx_n_s_catch_stdout);
jpayne@69 3333 Py_CLEAR(clear_module_state->__pyx_n_s_chr);
jpayne@69 3334 Py_CLEAR(clear_module_state->__pyx_n_s_class_getitem);
jpayne@69 3335 Py_CLEAR(clear_module_state->__pyx_n_s_cline_in_traceback);
jpayne@69 3336 Py_CLEAR(clear_module_state->__pyx_n_s_close);
jpayne@69 3337 Py_CLEAR(clear_module_state->__pyx_n_s_codecs);
jpayne@69 3338 Py_CLEAR(clear_module_state->__pyx_n_s_collect);
jpayne@69 3339 Py_CLEAR(clear_module_state->__pyx_n_s_collection);
jpayne@69 3340 Py_CLEAR(clear_module_state->__pyx_n_s_contextlib);
jpayne@69 3341 Py_CLEAR(clear_module_state->__pyx_n_s_contextmanager);
jpayne@69 3342 Py_CLEAR(clear_module_state->__pyx_n_s_contig);
jpayne@69 3343 Py_CLEAR(clear_module_state->__pyx_kp_u_contig_and_reference_should_not);
jpayne@69 3344 Py_CLEAR(clear_module_state->__pyx_kp_u_contig_reference_and_region_shou);
jpayne@69 3345 Py_CLEAR(clear_module_state->__pyx_n_s_decode);
jpayne@69 3346 Py_CLEAR(clear_module_state->__pyx_n_u_depad);
jpayne@69 3347 Py_CLEAR(clear_module_state->__pyx_n_s_encode);
jpayne@69 3348 Py_CLEAR(clear_module_state->__pyx_n_s_end);
jpayne@69 3349 Py_CLEAR(clear_module_state->__pyx_n_s_enter);
jpayne@69 3350 Py_CLEAR(clear_module_state->__pyx_kp_u_error_while_opening_file_for_wri);
jpayne@69 3351 Py_CLEAR(clear_module_state->__pyx_n_s_exception);
jpayne@69 3352 Py_CLEAR(clear_module_state->__pyx_n_s_exists);
jpayne@69 3353 Py_CLEAR(clear_module_state->__pyx_n_s_exit);
jpayne@69 3354 Py_CLEAR(clear_module_state->__pyx_n_s_extend);
jpayne@69 3355 Py_CLEAR(clear_module_state->__pyx_n_s_extra_args);
jpayne@69 3356 Py_CLEAR(clear_module_state->__pyx_n_s_fn);
jpayne@69 3357 Py_CLEAR(clear_module_state->__pyx_n_s_format);
jpayne@69 3358 Py_CLEAR(clear_module_state->__pyx_n_s_fsencode);
jpayne@69 3359 Py_CLEAR(clear_module_state->__pyx_n_s_get_encoding_error_handler);
jpayne@69 3360 Py_CLEAR(clear_module_state->__pyx_n_u_get_encoding_error_handler);
jpayne@69 3361 Py_CLEAR(clear_module_state->__pyx_n_s_getdefaultencoding);
jpayne@69 3362 Py_CLEAR(clear_module_state->__pyx_n_s_getfilesystemencoding);
jpayne@69 3363 Py_CLEAR(clear_module_state->__pyx_n_u_head);
jpayne@69 3364 Py_CLEAR(clear_module_state->__pyx_n_s_i);
jpayne@69 3365 Py_CLEAR(clear_module_state->__pyx_n_s_import);
jpayne@69 3366 Py_CLEAR(clear_module_state->__pyx_n_b_index);
jpayne@69 3367 Py_CLEAR(clear_module_state->__pyx_n_u_index);
jpayne@69 3368 Py_CLEAR(clear_module_state->__pyx_n_s_inf);
jpayne@69 3369 Py_CLEAR(clear_module_state->__pyx_n_s_initializing);
jpayne@69 3370 Py_CLEAR(clear_module_state->__pyx_n_s_input_str);
jpayne@69 3371 Py_CLEAR(clear_module_state->__pyx_kp_u_invalid_coordinates_start_i_stop);
jpayne@69 3372 Py_CLEAR(clear_module_state->__pyx_n_s_io);
jpayne@69 3373 Py_CLEAR(clear_module_state->__pyx_n_s_is_coroutine);
jpayne@69 3374 Py_CLEAR(clear_module_state->__pyx_n_s_is_usage);
jpayne@69 3375 Py_CLEAR(clear_module_state->__pyx_n_s_l);
jpayne@69 3376 Py_CLEAR(clear_module_state->__pyx_n_s_latin1_replace);
jpayne@69 3377 Py_CLEAR(clear_module_state->__pyx_kp_u_m);
jpayne@69 3378 Py_CLEAR(clear_module_state->__pyx_n_s_main);
jpayne@69 3379 Py_CLEAR(clear_module_state->__pyx_n_s_method);
jpayne@69 3380 Py_CLEAR(clear_module_state->__pyx_kp_u_min_shift);
jpayne@69 3381 Py_CLEAR(clear_module_state->__pyx_n_s_mkstemp);
jpayne@69 3382 Py_CLEAR(clear_module_state->__pyx_n_u_mpileup);
jpayne@69 3383 Py_CLEAR(clear_module_state->__pyx_n_s_n);
jpayne@69 3384 Py_CLEAR(clear_module_state->__pyx_n_s_name);
jpayne@69 3385 Py_CLEAR(clear_module_state->__pyx_n_s_name_2);
jpayne@69 3386 Py_CLEAR(clear_module_state->__pyx_kp_u_neither_contig_nor_region_are_gi);
jpayne@69 3387 Py_CLEAR(clear_module_state->__pyx_kp_u_o);
jpayne@69 3388 Py_CLEAR(clear_module_state->__pyx_kp_u_o_2);
jpayne@69 3389 Py_CLEAR(clear_module_state->__pyx_n_s_object);
jpayne@69 3390 Py_CLEAR(clear_module_state->__pyx_n_s_offset);
jpayne@69 3391 Py_CLEAR(clear_module_state->__pyx_n_s_open);
jpayne@69 3392 Py_CLEAR(clear_module_state->__pyx_n_s_os);
jpayne@69 3393 Py_CLEAR(clear_module_state->__pyx_n_s_out);
jpayne@69 3394 Py_CLEAR(clear_module_state->__pyx_n_s_out_stderr);
jpayne@69 3395 Py_CLEAR(clear_module_state->__pyx_n_s_out_stdout);
jpayne@69 3396 Py_CLEAR(clear_module_state->__pyx_kp_u_output);
jpayne@69 3397 Py_CLEAR(clear_module_state->__pyx_kp_u_output_file);
jpayne@69 3398 Py_CLEAR(clear_module_state->__pyx_n_s_parse_region);
jpayne@69 3399 Py_CLEAR(clear_module_state->__pyx_n_s_path);
jpayne@69 3400 Py_CLEAR(clear_module_state->__pyx_n_s_pysam_dispatch);
jpayne@69 3401 Py_CLEAR(clear_module_state->__pyx_n_s_pysam_dispatch_locals__collect);
jpayne@69 3402 Py_CLEAR(clear_module_state->__pyx_kp_u_pysam_latin1replace);
jpayne@69 3403 Py_CLEAR(clear_module_state->__pyx_n_s_pysam_libcutils);
jpayne@69 3404 Py_CLEAR(clear_module_state->__pyx_kp_s_pysam_libcutils_pyx);
jpayne@69 3405 Py_CLEAR(clear_module_state->__pyx_n_s_qualities);
jpayne@69 3406 Py_CLEAR(clear_module_state->__pyx_n_s_qualities_to_qualitystring);
jpayne@69 3407 Py_CLEAR(clear_module_state->__pyx_n_u_qualities_to_qualitystring);
jpayne@69 3408 Py_CLEAR(clear_module_state->__pyx_n_s_qualitystring_to_array);
jpayne@69 3409 Py_CLEAR(clear_module_state->__pyx_n_u_qualitystring_to_array);
jpayne@69 3410 Py_CLEAR(clear_module_state->__pyx_n_u_r);
jpayne@69 3411 Py_CLEAR(clear_module_state->__pyx_n_u_rb);
jpayne@69 3412 Py_CLEAR(clear_module_state->__pyx_n_s_re);
jpayne@69 3413 Py_CLEAR(clear_module_state->__pyx_n_s_read);
jpayne@69 3414 Py_CLEAR(clear_module_state->__pyx_n_s_reference);
jpayne@69 3415 Py_CLEAR(clear_module_state->__pyx_n_s_region);
jpayne@69 3416 Py_CLEAR(clear_module_state->__pyx_n_s_register_error);
jpayne@69 3417 Py_CLEAR(clear_module_state->__pyx_n_s_remove);
jpayne@69 3418 Py_CLEAR(clear_module_state->__pyx_n_s_retval);
jpayne@69 3419 Py_CLEAR(clear_module_state->__pyx_n_u_roh);
jpayne@69 3420 Py_CLEAR(clear_module_state->__pyx_n_b_samtools);
jpayne@69 3421 Py_CLEAR(clear_module_state->__pyx_n_u_samtools);
jpayne@69 3422 Py_CLEAR(clear_module_state->__pyx_n_s_save_stdout);
jpayne@69 3423 Py_CLEAR(clear_module_state->__pyx_n_s_set_encoding_error_handler);
jpayne@69 3424 Py_CLEAR(clear_module_state->__pyx_n_u_set_encoding_error_handler);
jpayne@69 3425 Py_CLEAR(clear_module_state->__pyx_n_s_skip_next);
jpayne@69 3426 Py_CLEAR(clear_module_state->__pyx_n_s_spec);
jpayne@69 3427 Py_CLEAR(clear_module_state->__pyx_n_s_split);
jpayne@69 3428 Py_CLEAR(clear_module_state->__pyx_n_s_start);
jpayne@69 3429 Py_CLEAR(clear_module_state->__pyx_kp_u_start_out_of_range_i);
jpayne@69 3430 Py_CLEAR(clear_module_state->__pyx_n_s_startswith);
jpayne@69 3431 Py_CLEAR(clear_module_state->__pyx_n_u_stats);
jpayne@69 3432 Py_CLEAR(clear_module_state->__pyx_n_s_stderr_f);
jpayne@69 3433 Py_CLEAR(clear_module_state->__pyx_n_s_stderr_h);
jpayne@69 3434 Py_CLEAR(clear_module_state->__pyx_n_s_stdout_f);
jpayne@69 3435 Py_CLEAR(clear_module_state->__pyx_n_s_stdout_h);
jpayne@69 3436 Py_CLEAR(clear_module_state->__pyx_n_s_stdout_option);
jpayne@69 3437 Py_CLEAR(clear_module_state->__pyx_n_s_stop);
jpayne@69 3438 Py_CLEAR(clear_module_state->__pyx_kp_u_stop_and_end_should_not_both_be);
jpayne@69 3439 Py_CLEAR(clear_module_state->__pyx_kp_u_stop_out_of_range_i);
jpayne@69 3440 Py_CLEAR(clear_module_state->__pyx_n_u_strict);
jpayne@69 3441 Py_CLEAR(clear_module_state->__pyx_n_s_string);
jpayne@69 3442 Py_CLEAR(clear_module_state->__pyx_n_s_sys);
jpayne@69 3443 Py_CLEAR(clear_module_state->__pyx_n_s_tempfile);
jpayne@69 3444 Py_CLEAR(clear_module_state->__pyx_n_s_test);
jpayne@69 3445 Py_CLEAR(clear_module_state->__pyx_kp_u_threads);
jpayne@69 3446 Py_CLEAR(clear_module_state->__pyx_n_s_tobytes);
jpayne@69 3447 Py_CLEAR(clear_module_state->__pyx_n_s_types);
jpayne@69 3448 Py_CLEAR(clear_module_state->__pyx_kp_u_utf_8);
jpayne@69 3449 Py_CLEAR(clear_module_state->__pyx_n_u_view);
jpayne@69 3450 Py_CLEAR(clear_module_state->__pyx_int_1);
jpayne@69 3451 Py_CLEAR(clear_module_state->__pyx_int_33);
jpayne@69 3452 Py_CLEAR(clear_module_state->__pyx_int_neg_1);
jpayne@69 3453 Py_CLEAR(clear_module_state->__pyx_tuple__2);
jpayne@69 3454 Py_CLEAR(clear_module_state->__pyx_tuple__3);
jpayne@69 3455 Py_CLEAR(clear_module_state->__pyx_tuple__4);
jpayne@69 3456 Py_CLEAR(clear_module_state->__pyx_tuple__5);
jpayne@69 3457 Py_CLEAR(clear_module_state->__pyx_tuple__6);
jpayne@69 3458 Py_CLEAR(clear_module_state->__pyx_tuple__9);
jpayne@69 3459 Py_CLEAR(clear_module_state->__pyx_tuple__12);
jpayne@69 3460 Py_CLEAR(clear_module_state->__pyx_tuple__16);
jpayne@69 3461 Py_CLEAR(clear_module_state->__pyx_tuple__18);
jpayne@69 3462 Py_CLEAR(clear_module_state->__pyx_tuple__19);
jpayne@69 3463 Py_CLEAR(clear_module_state->__pyx_tuple__22);
jpayne@69 3464 Py_CLEAR(clear_module_state->__pyx_tuple__25);
jpayne@69 3465 Py_CLEAR(clear_module_state->__pyx_tuple__27);
jpayne@69 3466 Py_CLEAR(clear_module_state->__pyx_tuple__29);
jpayne@69 3467 Py_CLEAR(clear_module_state->__pyx_tuple__30);
jpayne@69 3468 Py_CLEAR(clear_module_state->__pyx_tuple__32);
jpayne@69 3469 Py_CLEAR(clear_module_state->__pyx_codeobj__13);
jpayne@69 3470 Py_CLEAR(clear_module_state->__pyx_codeobj__17);
jpayne@69 3471 Py_CLEAR(clear_module_state->__pyx_codeobj__20);
jpayne@69 3472 Py_CLEAR(clear_module_state->__pyx_codeobj__21);
jpayne@69 3473 Py_CLEAR(clear_module_state->__pyx_codeobj__23);
jpayne@69 3474 Py_CLEAR(clear_module_state->__pyx_codeobj__24);
jpayne@69 3475 Py_CLEAR(clear_module_state->__pyx_codeobj__26);
jpayne@69 3476 Py_CLEAR(clear_module_state->__pyx_codeobj__28);
jpayne@69 3477 Py_CLEAR(clear_module_state->__pyx_codeobj__31);
jpayne@69 3478 return 0;
jpayne@69 3479 }
jpayne@69 3480 #endif
jpayne@69 3481 /* #### Code section: module_state_traverse ### */
jpayne@69 3482 #if CYTHON_USE_MODULE_STATE
jpayne@69 3483 static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) {
jpayne@69 3484 __pyx_mstate *traverse_module_state = __pyx_mstate(m);
jpayne@69 3485 if (!traverse_module_state) return 0;
jpayne@69 3486 Py_VISIT(traverse_module_state->__pyx_d);
jpayne@69 3487 Py_VISIT(traverse_module_state->__pyx_b);
jpayne@69 3488 Py_VISIT(traverse_module_state->__pyx_cython_runtime);
jpayne@69 3489 Py_VISIT(traverse_module_state->__pyx_empty_tuple);
jpayne@69 3490 Py_VISIT(traverse_module_state->__pyx_empty_bytes);
jpayne@69 3491 Py_VISIT(traverse_module_state->__pyx_empty_unicode);
jpayne@69 3492 #ifdef __Pyx_CyFunction_USED
jpayne@69 3493 Py_VISIT(traverse_module_state->__pyx_CyFunctionType);
jpayne@69 3494 #endif
jpayne@69 3495 #ifdef __Pyx_FusedFunction_USED
jpayne@69 3496 Py_VISIT(traverse_module_state->__pyx_FusedFunctionType);
jpayne@69 3497 #endif
jpayne@69 3498 Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_4type_type);
jpayne@69 3499 Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_4bool_bool);
jpayne@69 3500 Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_7complex_complex);
jpayne@69 3501 Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_5array_array);
jpayne@69 3502 Py_VISIT(traverse_module_state->__pyx_kp_u_);
jpayne@69 3503 Py_VISIT(traverse_module_state->__pyx_n_s_ARGUMENTS);
jpayne@69 3504 Py_VISIT(traverse_module_state->__pyx_kp_u_Argument_must_be_string_bytes_or);
jpayne@69 3505 Py_VISIT(traverse_module_state->__pyx_n_u_B);
jpayne@69 3506 Py_VISIT(traverse_module_state->__pyx_n_s_IOError);
jpayne@69 3507 Py_VISIT(traverse_module_state->__pyx_n_s_MAP_STDOUT_OPTIONS);
jpayne@69 3508 Py_VISIT(traverse_module_state->__pyx_n_s_MemoryError);
jpayne@69 3509 Py_VISIT(traverse_module_state->__pyx_kp_u_No_such_file_or_directory_s);
jpayne@69 3510 Py_VISIT(traverse_module_state->__pyx_n_s_OSError);
jpayne@69 3511 Py_VISIT(traverse_module_state->__pyx_n_s_OverflowError);
jpayne@69 3512 Py_VISIT(traverse_module_state->__pyx_n_s_TypeError);
jpayne@69 3513 Py_VISIT(traverse_module_state->__pyx_n_s_UnicodeDecodeError);
jpayne@69 3514 Py_VISIT(traverse_module_state->__pyx_n_s_ValueError);
jpayne@69 3515 Py_VISIT(traverse_module_state->__pyx_kp_u__10);
jpayne@69 3516 Py_VISIT(traverse_module_state->__pyx_kp_u__11);
jpayne@69 3517 Py_VISIT(traverse_module_state->__pyx_n_s__14);
jpayne@69 3518 Py_VISIT(traverse_module_state->__pyx_kp_u__15);
jpayne@69 3519 Py_VISIT(traverse_module_state->__pyx_n_s__33);
jpayne@69 3520 Py_VISIT(traverse_module_state->__pyx_kp_u__7);
jpayne@69 3521 Py_VISIT(traverse_module_state->__pyx_kp_u__8);
jpayne@69 3522 Py_VISIT(traverse_module_state->__pyx_n_s_a);
jpayne@69 3523 Py_VISIT(traverse_module_state->__pyx_n_s_all);
jpayne@69 3524 Py_VISIT(traverse_module_state->__pyx_n_s_arg);
jpayne@69 3525 Py_VISIT(traverse_module_state->__pyx_n_s_args);
jpayne@69 3526 Py_VISIT(traverse_module_state->__pyx_n_s_array_to_qualitystring);
jpayne@69 3527 Py_VISIT(traverse_module_state->__pyx_n_u_array_to_qualitystring);
jpayne@69 3528 Py_VISIT(traverse_module_state->__pyx_n_u_ascii);
jpayne@69 3529 Py_VISIT(traverse_module_state->__pyx_n_s_asyncio_coroutines);
jpayne@69 3530 Py_VISIT(traverse_module_state->__pyx_n_b_bcftools);
jpayne@69 3531 Py_VISIT(traverse_module_state->__pyx_n_u_bcftools);
jpayne@69 3532 Py_VISIT(traverse_module_state->__pyx_kp_u_c);
jpayne@69 3533 Py_VISIT(traverse_module_state->__pyx_n_u_calmd);
jpayne@69 3534 Py_VISIT(traverse_module_state->__pyx_n_s_cargs);
jpayne@69 3535 Py_VISIT(traverse_module_state->__pyx_n_s_catch_stdout);
jpayne@69 3536 Py_VISIT(traverse_module_state->__pyx_n_s_chr);
jpayne@69 3537 Py_VISIT(traverse_module_state->__pyx_n_s_class_getitem);
jpayne@69 3538 Py_VISIT(traverse_module_state->__pyx_n_s_cline_in_traceback);
jpayne@69 3539 Py_VISIT(traverse_module_state->__pyx_n_s_close);
jpayne@69 3540 Py_VISIT(traverse_module_state->__pyx_n_s_codecs);
jpayne@69 3541 Py_VISIT(traverse_module_state->__pyx_n_s_collect);
jpayne@69 3542 Py_VISIT(traverse_module_state->__pyx_n_s_collection);
jpayne@69 3543 Py_VISIT(traverse_module_state->__pyx_n_s_contextlib);
jpayne@69 3544 Py_VISIT(traverse_module_state->__pyx_n_s_contextmanager);
jpayne@69 3545 Py_VISIT(traverse_module_state->__pyx_n_s_contig);
jpayne@69 3546 Py_VISIT(traverse_module_state->__pyx_kp_u_contig_and_reference_should_not);
jpayne@69 3547 Py_VISIT(traverse_module_state->__pyx_kp_u_contig_reference_and_region_shou);
jpayne@69 3548 Py_VISIT(traverse_module_state->__pyx_n_s_decode);
jpayne@69 3549 Py_VISIT(traverse_module_state->__pyx_n_u_depad);
jpayne@69 3550 Py_VISIT(traverse_module_state->__pyx_n_s_encode);
jpayne@69 3551 Py_VISIT(traverse_module_state->__pyx_n_s_end);
jpayne@69 3552 Py_VISIT(traverse_module_state->__pyx_n_s_enter);
jpayne@69 3553 Py_VISIT(traverse_module_state->__pyx_kp_u_error_while_opening_file_for_wri);
jpayne@69 3554 Py_VISIT(traverse_module_state->__pyx_n_s_exception);
jpayne@69 3555 Py_VISIT(traverse_module_state->__pyx_n_s_exists);
jpayne@69 3556 Py_VISIT(traverse_module_state->__pyx_n_s_exit);
jpayne@69 3557 Py_VISIT(traverse_module_state->__pyx_n_s_extend);
jpayne@69 3558 Py_VISIT(traverse_module_state->__pyx_n_s_extra_args);
jpayne@69 3559 Py_VISIT(traverse_module_state->__pyx_n_s_fn);
jpayne@69 3560 Py_VISIT(traverse_module_state->__pyx_n_s_format);
jpayne@69 3561 Py_VISIT(traverse_module_state->__pyx_n_s_fsencode);
jpayne@69 3562 Py_VISIT(traverse_module_state->__pyx_n_s_get_encoding_error_handler);
jpayne@69 3563 Py_VISIT(traverse_module_state->__pyx_n_u_get_encoding_error_handler);
jpayne@69 3564 Py_VISIT(traverse_module_state->__pyx_n_s_getdefaultencoding);
jpayne@69 3565 Py_VISIT(traverse_module_state->__pyx_n_s_getfilesystemencoding);
jpayne@69 3566 Py_VISIT(traverse_module_state->__pyx_n_u_head);
jpayne@69 3567 Py_VISIT(traverse_module_state->__pyx_n_s_i);
jpayne@69 3568 Py_VISIT(traverse_module_state->__pyx_n_s_import);
jpayne@69 3569 Py_VISIT(traverse_module_state->__pyx_n_b_index);
jpayne@69 3570 Py_VISIT(traverse_module_state->__pyx_n_u_index);
jpayne@69 3571 Py_VISIT(traverse_module_state->__pyx_n_s_inf);
jpayne@69 3572 Py_VISIT(traverse_module_state->__pyx_n_s_initializing);
jpayne@69 3573 Py_VISIT(traverse_module_state->__pyx_n_s_input_str);
jpayne@69 3574 Py_VISIT(traverse_module_state->__pyx_kp_u_invalid_coordinates_start_i_stop);
jpayne@69 3575 Py_VISIT(traverse_module_state->__pyx_n_s_io);
jpayne@69 3576 Py_VISIT(traverse_module_state->__pyx_n_s_is_coroutine);
jpayne@69 3577 Py_VISIT(traverse_module_state->__pyx_n_s_is_usage);
jpayne@69 3578 Py_VISIT(traverse_module_state->__pyx_n_s_l);
jpayne@69 3579 Py_VISIT(traverse_module_state->__pyx_n_s_latin1_replace);
jpayne@69 3580 Py_VISIT(traverse_module_state->__pyx_kp_u_m);
jpayne@69 3581 Py_VISIT(traverse_module_state->__pyx_n_s_main);
jpayne@69 3582 Py_VISIT(traverse_module_state->__pyx_n_s_method);
jpayne@69 3583 Py_VISIT(traverse_module_state->__pyx_kp_u_min_shift);
jpayne@69 3584 Py_VISIT(traverse_module_state->__pyx_n_s_mkstemp);
jpayne@69 3585 Py_VISIT(traverse_module_state->__pyx_n_u_mpileup);
jpayne@69 3586 Py_VISIT(traverse_module_state->__pyx_n_s_n);
jpayne@69 3587 Py_VISIT(traverse_module_state->__pyx_n_s_name);
jpayne@69 3588 Py_VISIT(traverse_module_state->__pyx_n_s_name_2);
jpayne@69 3589 Py_VISIT(traverse_module_state->__pyx_kp_u_neither_contig_nor_region_are_gi);
jpayne@69 3590 Py_VISIT(traverse_module_state->__pyx_kp_u_o);
jpayne@69 3591 Py_VISIT(traverse_module_state->__pyx_kp_u_o_2);
jpayne@69 3592 Py_VISIT(traverse_module_state->__pyx_n_s_object);
jpayne@69 3593 Py_VISIT(traverse_module_state->__pyx_n_s_offset);
jpayne@69 3594 Py_VISIT(traverse_module_state->__pyx_n_s_open);
jpayne@69 3595 Py_VISIT(traverse_module_state->__pyx_n_s_os);
jpayne@69 3596 Py_VISIT(traverse_module_state->__pyx_n_s_out);
jpayne@69 3597 Py_VISIT(traverse_module_state->__pyx_n_s_out_stderr);
jpayne@69 3598 Py_VISIT(traverse_module_state->__pyx_n_s_out_stdout);
jpayne@69 3599 Py_VISIT(traverse_module_state->__pyx_kp_u_output);
jpayne@69 3600 Py_VISIT(traverse_module_state->__pyx_kp_u_output_file);
jpayne@69 3601 Py_VISIT(traverse_module_state->__pyx_n_s_parse_region);
jpayne@69 3602 Py_VISIT(traverse_module_state->__pyx_n_s_path);
jpayne@69 3603 Py_VISIT(traverse_module_state->__pyx_n_s_pysam_dispatch);
jpayne@69 3604 Py_VISIT(traverse_module_state->__pyx_n_s_pysam_dispatch_locals__collect);
jpayne@69 3605 Py_VISIT(traverse_module_state->__pyx_kp_u_pysam_latin1replace);
jpayne@69 3606 Py_VISIT(traverse_module_state->__pyx_n_s_pysam_libcutils);
jpayne@69 3607 Py_VISIT(traverse_module_state->__pyx_kp_s_pysam_libcutils_pyx);
jpayne@69 3608 Py_VISIT(traverse_module_state->__pyx_n_s_qualities);
jpayne@69 3609 Py_VISIT(traverse_module_state->__pyx_n_s_qualities_to_qualitystring);
jpayne@69 3610 Py_VISIT(traverse_module_state->__pyx_n_u_qualities_to_qualitystring);
jpayne@69 3611 Py_VISIT(traverse_module_state->__pyx_n_s_qualitystring_to_array);
jpayne@69 3612 Py_VISIT(traverse_module_state->__pyx_n_u_qualitystring_to_array);
jpayne@69 3613 Py_VISIT(traverse_module_state->__pyx_n_u_r);
jpayne@69 3614 Py_VISIT(traverse_module_state->__pyx_n_u_rb);
jpayne@69 3615 Py_VISIT(traverse_module_state->__pyx_n_s_re);
jpayne@69 3616 Py_VISIT(traverse_module_state->__pyx_n_s_read);
jpayne@69 3617 Py_VISIT(traverse_module_state->__pyx_n_s_reference);
jpayne@69 3618 Py_VISIT(traverse_module_state->__pyx_n_s_region);
jpayne@69 3619 Py_VISIT(traverse_module_state->__pyx_n_s_register_error);
jpayne@69 3620 Py_VISIT(traverse_module_state->__pyx_n_s_remove);
jpayne@69 3621 Py_VISIT(traverse_module_state->__pyx_n_s_retval);
jpayne@69 3622 Py_VISIT(traverse_module_state->__pyx_n_u_roh);
jpayne@69 3623 Py_VISIT(traverse_module_state->__pyx_n_b_samtools);
jpayne@69 3624 Py_VISIT(traverse_module_state->__pyx_n_u_samtools);
jpayne@69 3625 Py_VISIT(traverse_module_state->__pyx_n_s_save_stdout);
jpayne@69 3626 Py_VISIT(traverse_module_state->__pyx_n_s_set_encoding_error_handler);
jpayne@69 3627 Py_VISIT(traverse_module_state->__pyx_n_u_set_encoding_error_handler);
jpayne@69 3628 Py_VISIT(traverse_module_state->__pyx_n_s_skip_next);
jpayne@69 3629 Py_VISIT(traverse_module_state->__pyx_n_s_spec);
jpayne@69 3630 Py_VISIT(traverse_module_state->__pyx_n_s_split);
jpayne@69 3631 Py_VISIT(traverse_module_state->__pyx_n_s_start);
jpayne@69 3632 Py_VISIT(traverse_module_state->__pyx_kp_u_start_out_of_range_i);
jpayne@69 3633 Py_VISIT(traverse_module_state->__pyx_n_s_startswith);
jpayne@69 3634 Py_VISIT(traverse_module_state->__pyx_n_u_stats);
jpayne@69 3635 Py_VISIT(traverse_module_state->__pyx_n_s_stderr_f);
jpayne@69 3636 Py_VISIT(traverse_module_state->__pyx_n_s_stderr_h);
jpayne@69 3637 Py_VISIT(traverse_module_state->__pyx_n_s_stdout_f);
jpayne@69 3638 Py_VISIT(traverse_module_state->__pyx_n_s_stdout_h);
jpayne@69 3639 Py_VISIT(traverse_module_state->__pyx_n_s_stdout_option);
jpayne@69 3640 Py_VISIT(traverse_module_state->__pyx_n_s_stop);
jpayne@69 3641 Py_VISIT(traverse_module_state->__pyx_kp_u_stop_and_end_should_not_both_be);
jpayne@69 3642 Py_VISIT(traverse_module_state->__pyx_kp_u_stop_out_of_range_i);
jpayne@69 3643 Py_VISIT(traverse_module_state->__pyx_n_u_strict);
jpayne@69 3644 Py_VISIT(traverse_module_state->__pyx_n_s_string);
jpayne@69 3645 Py_VISIT(traverse_module_state->__pyx_n_s_sys);
jpayne@69 3646 Py_VISIT(traverse_module_state->__pyx_n_s_tempfile);
jpayne@69 3647 Py_VISIT(traverse_module_state->__pyx_n_s_test);
jpayne@69 3648 Py_VISIT(traverse_module_state->__pyx_kp_u_threads);
jpayne@69 3649 Py_VISIT(traverse_module_state->__pyx_n_s_tobytes);
jpayne@69 3650 Py_VISIT(traverse_module_state->__pyx_n_s_types);
jpayne@69 3651 Py_VISIT(traverse_module_state->__pyx_kp_u_utf_8);
jpayne@69 3652 Py_VISIT(traverse_module_state->__pyx_n_u_view);
jpayne@69 3653 Py_VISIT(traverse_module_state->__pyx_int_1);
jpayne@69 3654 Py_VISIT(traverse_module_state->__pyx_int_33);
jpayne@69 3655 Py_VISIT(traverse_module_state->__pyx_int_neg_1);
jpayne@69 3656 Py_VISIT(traverse_module_state->__pyx_tuple__2);
jpayne@69 3657 Py_VISIT(traverse_module_state->__pyx_tuple__3);
jpayne@69 3658 Py_VISIT(traverse_module_state->__pyx_tuple__4);
jpayne@69 3659 Py_VISIT(traverse_module_state->__pyx_tuple__5);
jpayne@69 3660 Py_VISIT(traverse_module_state->__pyx_tuple__6);
jpayne@69 3661 Py_VISIT(traverse_module_state->__pyx_tuple__9);
jpayne@69 3662 Py_VISIT(traverse_module_state->__pyx_tuple__12);
jpayne@69 3663 Py_VISIT(traverse_module_state->__pyx_tuple__16);
jpayne@69 3664 Py_VISIT(traverse_module_state->__pyx_tuple__18);
jpayne@69 3665 Py_VISIT(traverse_module_state->__pyx_tuple__19);
jpayne@69 3666 Py_VISIT(traverse_module_state->__pyx_tuple__22);
jpayne@69 3667 Py_VISIT(traverse_module_state->__pyx_tuple__25);
jpayne@69 3668 Py_VISIT(traverse_module_state->__pyx_tuple__27);
jpayne@69 3669 Py_VISIT(traverse_module_state->__pyx_tuple__29);
jpayne@69 3670 Py_VISIT(traverse_module_state->__pyx_tuple__30);
jpayne@69 3671 Py_VISIT(traverse_module_state->__pyx_tuple__32);
jpayne@69 3672 Py_VISIT(traverse_module_state->__pyx_codeobj__13);
jpayne@69 3673 Py_VISIT(traverse_module_state->__pyx_codeobj__17);
jpayne@69 3674 Py_VISIT(traverse_module_state->__pyx_codeobj__20);
jpayne@69 3675 Py_VISIT(traverse_module_state->__pyx_codeobj__21);
jpayne@69 3676 Py_VISIT(traverse_module_state->__pyx_codeobj__23);
jpayne@69 3677 Py_VISIT(traverse_module_state->__pyx_codeobj__24);
jpayne@69 3678 Py_VISIT(traverse_module_state->__pyx_codeobj__26);
jpayne@69 3679 Py_VISIT(traverse_module_state->__pyx_codeobj__28);
jpayne@69 3680 Py_VISIT(traverse_module_state->__pyx_codeobj__31);
jpayne@69 3681 return 0;
jpayne@69 3682 }
jpayne@69 3683 #endif
jpayne@69 3684 /* #### Code section: module_state_defines ### */
jpayne@69 3685 #define __pyx_d __pyx_mstate_global->__pyx_d
jpayne@69 3686 #define __pyx_b __pyx_mstate_global->__pyx_b
jpayne@69 3687 #define __pyx_cython_runtime __pyx_mstate_global->__pyx_cython_runtime
jpayne@69 3688 #define __pyx_empty_tuple __pyx_mstate_global->__pyx_empty_tuple
jpayne@69 3689 #define __pyx_empty_bytes __pyx_mstate_global->__pyx_empty_bytes
jpayne@69 3690 #define __pyx_empty_unicode __pyx_mstate_global->__pyx_empty_unicode
jpayne@69 3691 #ifdef __Pyx_CyFunction_USED
jpayne@69 3692 #define __pyx_CyFunctionType __pyx_mstate_global->__pyx_CyFunctionType
jpayne@69 3693 #endif
jpayne@69 3694 #ifdef __Pyx_FusedFunction_USED
jpayne@69 3695 #define __pyx_FusedFunctionType __pyx_mstate_global->__pyx_FusedFunctionType
jpayne@69 3696 #endif
jpayne@69 3697 #ifdef __Pyx_Generator_USED
jpayne@69 3698 #define __pyx_GeneratorType __pyx_mstate_global->__pyx_GeneratorType
jpayne@69 3699 #endif
jpayne@69 3700 #ifdef __Pyx_IterableCoroutine_USED
jpayne@69 3701 #define __pyx_IterableCoroutineType __pyx_mstate_global->__pyx_IterableCoroutineType
jpayne@69 3702 #endif
jpayne@69 3703 #ifdef __Pyx_Coroutine_USED
jpayne@69 3704 #define __pyx_CoroutineAwaitType __pyx_mstate_global->__pyx_CoroutineAwaitType
jpayne@69 3705 #endif
jpayne@69 3706 #ifdef __Pyx_Coroutine_USED
jpayne@69 3707 #define __pyx_CoroutineType __pyx_mstate_global->__pyx_CoroutineType
jpayne@69 3708 #endif
jpayne@69 3709 #if CYTHON_USE_MODULE_STATE
jpayne@69 3710 #endif
jpayne@69 3711 #if CYTHON_USE_MODULE_STATE
jpayne@69 3712 #endif
jpayne@69 3713 #if CYTHON_USE_MODULE_STATE
jpayne@69 3714 #endif
jpayne@69 3715 #if CYTHON_USE_MODULE_STATE
jpayne@69 3716 #endif
jpayne@69 3717 #define __pyx_ptype_7cpython_4type_type __pyx_mstate_global->__pyx_ptype_7cpython_4type_type
jpayne@69 3718 #if CYTHON_USE_MODULE_STATE
jpayne@69 3719 #endif
jpayne@69 3720 #if CYTHON_USE_MODULE_STATE
jpayne@69 3721 #endif
jpayne@69 3722 #if CYTHON_USE_MODULE_STATE
jpayne@69 3723 #endif
jpayne@69 3724 #if CYTHON_USE_MODULE_STATE
jpayne@69 3725 #endif
jpayne@69 3726 #if CYTHON_USE_MODULE_STATE
jpayne@69 3727 #endif
jpayne@69 3728 #if CYTHON_USE_MODULE_STATE
jpayne@69 3729 #endif
jpayne@69 3730 #if CYTHON_USE_MODULE_STATE
jpayne@69 3731 #endif
jpayne@69 3732 #if CYTHON_USE_MODULE_STATE
jpayne@69 3733 #endif
jpayne@69 3734 #if CYTHON_USE_MODULE_STATE
jpayne@69 3735 #endif
jpayne@69 3736 #if CYTHON_USE_MODULE_STATE
jpayne@69 3737 #endif
jpayne@69 3738 #if CYTHON_USE_MODULE_STATE
jpayne@69 3739 #endif
jpayne@69 3740 #if CYTHON_USE_MODULE_STATE
jpayne@69 3741 #endif
jpayne@69 3742 #if CYTHON_USE_MODULE_STATE
jpayne@69 3743 #endif
jpayne@69 3744 #if CYTHON_USE_MODULE_STATE
jpayne@69 3745 #endif
jpayne@69 3746 #if CYTHON_USE_MODULE_STATE
jpayne@69 3747 #endif
jpayne@69 3748 #if CYTHON_USE_MODULE_STATE
jpayne@69 3749 #endif
jpayne@69 3750 #define __pyx_ptype_7cpython_4bool_bool __pyx_mstate_global->__pyx_ptype_7cpython_4bool_bool
jpayne@69 3751 #if CYTHON_USE_MODULE_STATE
jpayne@69 3752 #endif
jpayne@69 3753 #if CYTHON_USE_MODULE_STATE
jpayne@69 3754 #endif
jpayne@69 3755 #if CYTHON_USE_MODULE_STATE
jpayne@69 3756 #endif
jpayne@69 3757 #if CYTHON_USE_MODULE_STATE
jpayne@69 3758 #endif
jpayne@69 3759 #define __pyx_ptype_7cpython_7complex_complex __pyx_mstate_global->__pyx_ptype_7cpython_7complex_complex
jpayne@69 3760 #if CYTHON_USE_MODULE_STATE
jpayne@69 3761 #endif
jpayne@69 3762 #if CYTHON_USE_MODULE_STATE
jpayne@69 3763 #endif
jpayne@69 3764 #if CYTHON_USE_MODULE_STATE
jpayne@69 3765 #endif
jpayne@69 3766 #if CYTHON_USE_MODULE_STATE
jpayne@69 3767 #endif
jpayne@69 3768 #if CYTHON_USE_MODULE_STATE
jpayne@69 3769 #endif
jpayne@69 3770 #if CYTHON_USE_MODULE_STATE
jpayne@69 3771 #endif
jpayne@69 3772 #if CYTHON_USE_MODULE_STATE
jpayne@69 3773 #endif
jpayne@69 3774 #if CYTHON_USE_MODULE_STATE
jpayne@69 3775 #endif
jpayne@69 3776 #if CYTHON_USE_MODULE_STATE
jpayne@69 3777 #endif
jpayne@69 3778 #if CYTHON_USE_MODULE_STATE
jpayne@69 3779 #endif
jpayne@69 3780 #if CYTHON_USE_MODULE_STATE
jpayne@69 3781 #endif
jpayne@69 3782 #if CYTHON_USE_MODULE_STATE
jpayne@69 3783 #endif
jpayne@69 3784 #if CYTHON_USE_MODULE_STATE
jpayne@69 3785 #endif
jpayne@69 3786 #if CYTHON_USE_MODULE_STATE
jpayne@69 3787 #endif
jpayne@69 3788 #if CYTHON_USE_MODULE_STATE
jpayne@69 3789 #endif
jpayne@69 3790 #if CYTHON_USE_MODULE_STATE
jpayne@69 3791 #endif
jpayne@69 3792 #if CYTHON_USE_MODULE_STATE
jpayne@69 3793 #endif
jpayne@69 3794 #if CYTHON_USE_MODULE_STATE
jpayne@69 3795 #endif
jpayne@69 3796 #if CYTHON_USE_MODULE_STATE
jpayne@69 3797 #endif
jpayne@69 3798 #if CYTHON_USE_MODULE_STATE
jpayne@69 3799 #endif
jpayne@69 3800 #if CYTHON_USE_MODULE_STATE
jpayne@69 3801 #endif
jpayne@69 3802 #if CYTHON_USE_MODULE_STATE
jpayne@69 3803 #endif
jpayne@69 3804 #define __pyx_ptype_7cpython_5array_array __pyx_mstate_global->__pyx_ptype_7cpython_5array_array
jpayne@69 3805 #if CYTHON_USE_MODULE_STATE
jpayne@69 3806 #endif
jpayne@69 3807 #if CYTHON_USE_MODULE_STATE
jpayne@69 3808 #endif
jpayne@69 3809 #if CYTHON_USE_MODULE_STATE
jpayne@69 3810 #endif
jpayne@69 3811 #if CYTHON_USE_MODULE_STATE
jpayne@69 3812 #endif
jpayne@69 3813 #if CYTHON_USE_MODULE_STATE
jpayne@69 3814 #endif
jpayne@69 3815 #if CYTHON_USE_MODULE_STATE
jpayne@69 3816 #endif
jpayne@69 3817 #if CYTHON_USE_MODULE_STATE
jpayne@69 3818 #endif
jpayne@69 3819 #if CYTHON_USE_MODULE_STATE
jpayne@69 3820 #endif
jpayne@69 3821 #if CYTHON_USE_MODULE_STATE
jpayne@69 3822 #endif
jpayne@69 3823 #define __pyx_kp_u_ __pyx_mstate_global->__pyx_kp_u_
jpayne@69 3824 #define __pyx_n_s_ARGUMENTS __pyx_mstate_global->__pyx_n_s_ARGUMENTS
jpayne@69 3825 #define __pyx_kp_u_Argument_must_be_string_bytes_or __pyx_mstate_global->__pyx_kp_u_Argument_must_be_string_bytes_or
jpayne@69 3826 #define __pyx_n_u_B __pyx_mstate_global->__pyx_n_u_B
jpayne@69 3827 #define __pyx_n_s_IOError __pyx_mstate_global->__pyx_n_s_IOError
jpayne@69 3828 #define __pyx_n_s_MAP_STDOUT_OPTIONS __pyx_mstate_global->__pyx_n_s_MAP_STDOUT_OPTIONS
jpayne@69 3829 #define __pyx_n_s_MemoryError __pyx_mstate_global->__pyx_n_s_MemoryError
jpayne@69 3830 #define __pyx_kp_u_No_such_file_or_directory_s __pyx_mstate_global->__pyx_kp_u_No_such_file_or_directory_s
jpayne@69 3831 #define __pyx_n_s_OSError __pyx_mstate_global->__pyx_n_s_OSError
jpayne@69 3832 #define __pyx_n_s_OverflowError __pyx_mstate_global->__pyx_n_s_OverflowError
jpayne@69 3833 #define __pyx_n_s_TypeError __pyx_mstate_global->__pyx_n_s_TypeError
jpayne@69 3834 #define __pyx_n_s_UnicodeDecodeError __pyx_mstate_global->__pyx_n_s_UnicodeDecodeError
jpayne@69 3835 #define __pyx_n_s_ValueError __pyx_mstate_global->__pyx_n_s_ValueError
jpayne@69 3836 #define __pyx_kp_u__10 __pyx_mstate_global->__pyx_kp_u__10
jpayne@69 3837 #define __pyx_kp_u__11 __pyx_mstate_global->__pyx_kp_u__11
jpayne@69 3838 #define __pyx_n_s__14 __pyx_mstate_global->__pyx_n_s__14
jpayne@69 3839 #define __pyx_kp_u__15 __pyx_mstate_global->__pyx_kp_u__15
jpayne@69 3840 #define __pyx_n_s__33 __pyx_mstate_global->__pyx_n_s__33
jpayne@69 3841 #define __pyx_kp_u__7 __pyx_mstate_global->__pyx_kp_u__7
jpayne@69 3842 #define __pyx_kp_u__8 __pyx_mstate_global->__pyx_kp_u__8
jpayne@69 3843 #define __pyx_n_s_a __pyx_mstate_global->__pyx_n_s_a
jpayne@69 3844 #define __pyx_n_s_all __pyx_mstate_global->__pyx_n_s_all
jpayne@69 3845 #define __pyx_n_s_arg __pyx_mstate_global->__pyx_n_s_arg
jpayne@69 3846 #define __pyx_n_s_args __pyx_mstate_global->__pyx_n_s_args
jpayne@69 3847 #define __pyx_n_s_array_to_qualitystring __pyx_mstate_global->__pyx_n_s_array_to_qualitystring
jpayne@69 3848 #define __pyx_n_u_array_to_qualitystring __pyx_mstate_global->__pyx_n_u_array_to_qualitystring
jpayne@69 3849 #define __pyx_n_u_ascii __pyx_mstate_global->__pyx_n_u_ascii
jpayne@69 3850 #define __pyx_n_s_asyncio_coroutines __pyx_mstate_global->__pyx_n_s_asyncio_coroutines
jpayne@69 3851 #define __pyx_n_b_bcftools __pyx_mstate_global->__pyx_n_b_bcftools
jpayne@69 3852 #define __pyx_n_u_bcftools __pyx_mstate_global->__pyx_n_u_bcftools
jpayne@69 3853 #define __pyx_kp_u_c __pyx_mstate_global->__pyx_kp_u_c
jpayne@69 3854 #define __pyx_n_u_calmd __pyx_mstate_global->__pyx_n_u_calmd
jpayne@69 3855 #define __pyx_n_s_cargs __pyx_mstate_global->__pyx_n_s_cargs
jpayne@69 3856 #define __pyx_n_s_catch_stdout __pyx_mstate_global->__pyx_n_s_catch_stdout
jpayne@69 3857 #define __pyx_n_s_chr __pyx_mstate_global->__pyx_n_s_chr
jpayne@69 3858 #define __pyx_n_s_class_getitem __pyx_mstate_global->__pyx_n_s_class_getitem
jpayne@69 3859 #define __pyx_n_s_cline_in_traceback __pyx_mstate_global->__pyx_n_s_cline_in_traceback
jpayne@69 3860 #define __pyx_n_s_close __pyx_mstate_global->__pyx_n_s_close
jpayne@69 3861 #define __pyx_n_s_codecs __pyx_mstate_global->__pyx_n_s_codecs
jpayne@69 3862 #define __pyx_n_s_collect __pyx_mstate_global->__pyx_n_s_collect
jpayne@69 3863 #define __pyx_n_s_collection __pyx_mstate_global->__pyx_n_s_collection
jpayne@69 3864 #define __pyx_n_s_contextlib __pyx_mstate_global->__pyx_n_s_contextlib
jpayne@69 3865 #define __pyx_n_s_contextmanager __pyx_mstate_global->__pyx_n_s_contextmanager
jpayne@69 3866 #define __pyx_n_s_contig __pyx_mstate_global->__pyx_n_s_contig
jpayne@69 3867 #define __pyx_kp_u_contig_and_reference_should_not __pyx_mstate_global->__pyx_kp_u_contig_and_reference_should_not
jpayne@69 3868 #define __pyx_kp_u_contig_reference_and_region_shou __pyx_mstate_global->__pyx_kp_u_contig_reference_and_region_shou
jpayne@69 3869 #define __pyx_n_s_decode __pyx_mstate_global->__pyx_n_s_decode
jpayne@69 3870 #define __pyx_n_u_depad __pyx_mstate_global->__pyx_n_u_depad
jpayne@69 3871 #define __pyx_n_s_encode __pyx_mstate_global->__pyx_n_s_encode
jpayne@69 3872 #define __pyx_n_s_end __pyx_mstate_global->__pyx_n_s_end
jpayne@69 3873 #define __pyx_n_s_enter __pyx_mstate_global->__pyx_n_s_enter
jpayne@69 3874 #define __pyx_kp_u_error_while_opening_file_for_wri __pyx_mstate_global->__pyx_kp_u_error_while_opening_file_for_wri
jpayne@69 3875 #define __pyx_n_s_exception __pyx_mstate_global->__pyx_n_s_exception
jpayne@69 3876 #define __pyx_n_s_exists __pyx_mstate_global->__pyx_n_s_exists
jpayne@69 3877 #define __pyx_n_s_exit __pyx_mstate_global->__pyx_n_s_exit
jpayne@69 3878 #define __pyx_n_s_extend __pyx_mstate_global->__pyx_n_s_extend
jpayne@69 3879 #define __pyx_n_s_extra_args __pyx_mstate_global->__pyx_n_s_extra_args
jpayne@69 3880 #define __pyx_n_s_fn __pyx_mstate_global->__pyx_n_s_fn
jpayne@69 3881 #define __pyx_n_s_format __pyx_mstate_global->__pyx_n_s_format
jpayne@69 3882 #define __pyx_n_s_fsencode __pyx_mstate_global->__pyx_n_s_fsencode
jpayne@69 3883 #define __pyx_n_s_get_encoding_error_handler __pyx_mstate_global->__pyx_n_s_get_encoding_error_handler
jpayne@69 3884 #define __pyx_n_u_get_encoding_error_handler __pyx_mstate_global->__pyx_n_u_get_encoding_error_handler
jpayne@69 3885 #define __pyx_n_s_getdefaultencoding __pyx_mstate_global->__pyx_n_s_getdefaultencoding
jpayne@69 3886 #define __pyx_n_s_getfilesystemencoding __pyx_mstate_global->__pyx_n_s_getfilesystemencoding
jpayne@69 3887 #define __pyx_n_u_head __pyx_mstate_global->__pyx_n_u_head
jpayne@69 3888 #define __pyx_n_s_i __pyx_mstate_global->__pyx_n_s_i
jpayne@69 3889 #define __pyx_n_s_import __pyx_mstate_global->__pyx_n_s_import
jpayne@69 3890 #define __pyx_n_b_index __pyx_mstate_global->__pyx_n_b_index
jpayne@69 3891 #define __pyx_n_u_index __pyx_mstate_global->__pyx_n_u_index
jpayne@69 3892 #define __pyx_n_s_inf __pyx_mstate_global->__pyx_n_s_inf
jpayne@69 3893 #define __pyx_n_s_initializing __pyx_mstate_global->__pyx_n_s_initializing
jpayne@69 3894 #define __pyx_n_s_input_str __pyx_mstate_global->__pyx_n_s_input_str
jpayne@69 3895 #define __pyx_kp_u_invalid_coordinates_start_i_stop __pyx_mstate_global->__pyx_kp_u_invalid_coordinates_start_i_stop
jpayne@69 3896 #define __pyx_n_s_io __pyx_mstate_global->__pyx_n_s_io
jpayne@69 3897 #define __pyx_n_s_is_coroutine __pyx_mstate_global->__pyx_n_s_is_coroutine
jpayne@69 3898 #define __pyx_n_s_is_usage __pyx_mstate_global->__pyx_n_s_is_usage
jpayne@69 3899 #define __pyx_n_s_l __pyx_mstate_global->__pyx_n_s_l
jpayne@69 3900 #define __pyx_n_s_latin1_replace __pyx_mstate_global->__pyx_n_s_latin1_replace
jpayne@69 3901 #define __pyx_kp_u_m __pyx_mstate_global->__pyx_kp_u_m
jpayne@69 3902 #define __pyx_n_s_main __pyx_mstate_global->__pyx_n_s_main
jpayne@69 3903 #define __pyx_n_s_method __pyx_mstate_global->__pyx_n_s_method
jpayne@69 3904 #define __pyx_kp_u_min_shift __pyx_mstate_global->__pyx_kp_u_min_shift
jpayne@69 3905 #define __pyx_n_s_mkstemp __pyx_mstate_global->__pyx_n_s_mkstemp
jpayne@69 3906 #define __pyx_n_u_mpileup __pyx_mstate_global->__pyx_n_u_mpileup
jpayne@69 3907 #define __pyx_n_s_n __pyx_mstate_global->__pyx_n_s_n
jpayne@69 3908 #define __pyx_n_s_name __pyx_mstate_global->__pyx_n_s_name
jpayne@69 3909 #define __pyx_n_s_name_2 __pyx_mstate_global->__pyx_n_s_name_2
jpayne@69 3910 #define __pyx_kp_u_neither_contig_nor_region_are_gi __pyx_mstate_global->__pyx_kp_u_neither_contig_nor_region_are_gi
jpayne@69 3911 #define __pyx_kp_u_o __pyx_mstate_global->__pyx_kp_u_o
jpayne@69 3912 #define __pyx_kp_u_o_2 __pyx_mstate_global->__pyx_kp_u_o_2
jpayne@69 3913 #define __pyx_n_s_object __pyx_mstate_global->__pyx_n_s_object
jpayne@69 3914 #define __pyx_n_s_offset __pyx_mstate_global->__pyx_n_s_offset
jpayne@69 3915 #define __pyx_n_s_open __pyx_mstate_global->__pyx_n_s_open
jpayne@69 3916 #define __pyx_n_s_os __pyx_mstate_global->__pyx_n_s_os
jpayne@69 3917 #define __pyx_n_s_out __pyx_mstate_global->__pyx_n_s_out
jpayne@69 3918 #define __pyx_n_s_out_stderr __pyx_mstate_global->__pyx_n_s_out_stderr
jpayne@69 3919 #define __pyx_n_s_out_stdout __pyx_mstate_global->__pyx_n_s_out_stdout
jpayne@69 3920 #define __pyx_kp_u_output __pyx_mstate_global->__pyx_kp_u_output
jpayne@69 3921 #define __pyx_kp_u_output_file __pyx_mstate_global->__pyx_kp_u_output_file
jpayne@69 3922 #define __pyx_n_s_parse_region __pyx_mstate_global->__pyx_n_s_parse_region
jpayne@69 3923 #define __pyx_n_s_path __pyx_mstate_global->__pyx_n_s_path
jpayne@69 3924 #define __pyx_n_s_pysam_dispatch __pyx_mstate_global->__pyx_n_s_pysam_dispatch
jpayne@69 3925 #define __pyx_n_s_pysam_dispatch_locals__collect __pyx_mstate_global->__pyx_n_s_pysam_dispatch_locals__collect
jpayne@69 3926 #define __pyx_kp_u_pysam_latin1replace __pyx_mstate_global->__pyx_kp_u_pysam_latin1replace
jpayne@69 3927 #define __pyx_n_s_pysam_libcutils __pyx_mstate_global->__pyx_n_s_pysam_libcutils
jpayne@69 3928 #define __pyx_kp_s_pysam_libcutils_pyx __pyx_mstate_global->__pyx_kp_s_pysam_libcutils_pyx
jpayne@69 3929 #define __pyx_n_s_qualities __pyx_mstate_global->__pyx_n_s_qualities
jpayne@69 3930 #define __pyx_n_s_qualities_to_qualitystring __pyx_mstate_global->__pyx_n_s_qualities_to_qualitystring
jpayne@69 3931 #define __pyx_n_u_qualities_to_qualitystring __pyx_mstate_global->__pyx_n_u_qualities_to_qualitystring
jpayne@69 3932 #define __pyx_n_s_qualitystring_to_array __pyx_mstate_global->__pyx_n_s_qualitystring_to_array
jpayne@69 3933 #define __pyx_n_u_qualitystring_to_array __pyx_mstate_global->__pyx_n_u_qualitystring_to_array
jpayne@69 3934 #define __pyx_n_u_r __pyx_mstate_global->__pyx_n_u_r
jpayne@69 3935 #define __pyx_n_u_rb __pyx_mstate_global->__pyx_n_u_rb
jpayne@69 3936 #define __pyx_n_s_re __pyx_mstate_global->__pyx_n_s_re
jpayne@69 3937 #define __pyx_n_s_read __pyx_mstate_global->__pyx_n_s_read
jpayne@69 3938 #define __pyx_n_s_reference __pyx_mstate_global->__pyx_n_s_reference
jpayne@69 3939 #define __pyx_n_s_region __pyx_mstate_global->__pyx_n_s_region
jpayne@69 3940 #define __pyx_n_s_register_error __pyx_mstate_global->__pyx_n_s_register_error
jpayne@69 3941 #define __pyx_n_s_remove __pyx_mstate_global->__pyx_n_s_remove
jpayne@69 3942 #define __pyx_n_s_retval __pyx_mstate_global->__pyx_n_s_retval
jpayne@69 3943 #define __pyx_n_u_roh __pyx_mstate_global->__pyx_n_u_roh
jpayne@69 3944 #define __pyx_n_b_samtools __pyx_mstate_global->__pyx_n_b_samtools
jpayne@69 3945 #define __pyx_n_u_samtools __pyx_mstate_global->__pyx_n_u_samtools
jpayne@69 3946 #define __pyx_n_s_save_stdout __pyx_mstate_global->__pyx_n_s_save_stdout
jpayne@69 3947 #define __pyx_n_s_set_encoding_error_handler __pyx_mstate_global->__pyx_n_s_set_encoding_error_handler
jpayne@69 3948 #define __pyx_n_u_set_encoding_error_handler __pyx_mstate_global->__pyx_n_u_set_encoding_error_handler
jpayne@69 3949 #define __pyx_n_s_skip_next __pyx_mstate_global->__pyx_n_s_skip_next
jpayne@69 3950 #define __pyx_n_s_spec __pyx_mstate_global->__pyx_n_s_spec
jpayne@69 3951 #define __pyx_n_s_split __pyx_mstate_global->__pyx_n_s_split
jpayne@69 3952 #define __pyx_n_s_start __pyx_mstate_global->__pyx_n_s_start
jpayne@69 3953 #define __pyx_kp_u_start_out_of_range_i __pyx_mstate_global->__pyx_kp_u_start_out_of_range_i
jpayne@69 3954 #define __pyx_n_s_startswith __pyx_mstate_global->__pyx_n_s_startswith
jpayne@69 3955 #define __pyx_n_u_stats __pyx_mstate_global->__pyx_n_u_stats
jpayne@69 3956 #define __pyx_n_s_stderr_f __pyx_mstate_global->__pyx_n_s_stderr_f
jpayne@69 3957 #define __pyx_n_s_stderr_h __pyx_mstate_global->__pyx_n_s_stderr_h
jpayne@69 3958 #define __pyx_n_s_stdout_f __pyx_mstate_global->__pyx_n_s_stdout_f
jpayne@69 3959 #define __pyx_n_s_stdout_h __pyx_mstate_global->__pyx_n_s_stdout_h
jpayne@69 3960 #define __pyx_n_s_stdout_option __pyx_mstate_global->__pyx_n_s_stdout_option
jpayne@69 3961 #define __pyx_n_s_stop __pyx_mstate_global->__pyx_n_s_stop
jpayne@69 3962 #define __pyx_kp_u_stop_and_end_should_not_both_be __pyx_mstate_global->__pyx_kp_u_stop_and_end_should_not_both_be
jpayne@69 3963 #define __pyx_kp_u_stop_out_of_range_i __pyx_mstate_global->__pyx_kp_u_stop_out_of_range_i
jpayne@69 3964 #define __pyx_n_u_strict __pyx_mstate_global->__pyx_n_u_strict
jpayne@69 3965 #define __pyx_n_s_string __pyx_mstate_global->__pyx_n_s_string
jpayne@69 3966 #define __pyx_n_s_sys __pyx_mstate_global->__pyx_n_s_sys
jpayne@69 3967 #define __pyx_n_s_tempfile __pyx_mstate_global->__pyx_n_s_tempfile
jpayne@69 3968 #define __pyx_n_s_test __pyx_mstate_global->__pyx_n_s_test
jpayne@69 3969 #define __pyx_kp_u_threads __pyx_mstate_global->__pyx_kp_u_threads
jpayne@69 3970 #define __pyx_n_s_tobytes __pyx_mstate_global->__pyx_n_s_tobytes
jpayne@69 3971 #define __pyx_n_s_types __pyx_mstate_global->__pyx_n_s_types
jpayne@69 3972 #define __pyx_kp_u_utf_8 __pyx_mstate_global->__pyx_kp_u_utf_8
jpayne@69 3973 #define __pyx_n_u_view __pyx_mstate_global->__pyx_n_u_view
jpayne@69 3974 #define __pyx_int_1 __pyx_mstate_global->__pyx_int_1
jpayne@69 3975 #define __pyx_int_33 __pyx_mstate_global->__pyx_int_33
jpayne@69 3976 #define __pyx_int_neg_1 __pyx_mstate_global->__pyx_int_neg_1
jpayne@69 3977 #define __pyx_tuple__2 __pyx_mstate_global->__pyx_tuple__2
jpayne@69 3978 #define __pyx_tuple__3 __pyx_mstate_global->__pyx_tuple__3
jpayne@69 3979 #define __pyx_tuple__4 __pyx_mstate_global->__pyx_tuple__4
jpayne@69 3980 #define __pyx_tuple__5 __pyx_mstate_global->__pyx_tuple__5
jpayne@69 3981 #define __pyx_tuple__6 __pyx_mstate_global->__pyx_tuple__6
jpayne@69 3982 #define __pyx_tuple__9 __pyx_mstate_global->__pyx_tuple__9
jpayne@69 3983 #define __pyx_tuple__12 __pyx_mstate_global->__pyx_tuple__12
jpayne@69 3984 #define __pyx_tuple__16 __pyx_mstate_global->__pyx_tuple__16
jpayne@69 3985 #define __pyx_tuple__18 __pyx_mstate_global->__pyx_tuple__18
jpayne@69 3986 #define __pyx_tuple__19 __pyx_mstate_global->__pyx_tuple__19
jpayne@69 3987 #define __pyx_tuple__22 __pyx_mstate_global->__pyx_tuple__22
jpayne@69 3988 #define __pyx_tuple__25 __pyx_mstate_global->__pyx_tuple__25
jpayne@69 3989 #define __pyx_tuple__27 __pyx_mstate_global->__pyx_tuple__27
jpayne@69 3990 #define __pyx_tuple__29 __pyx_mstate_global->__pyx_tuple__29
jpayne@69 3991 #define __pyx_tuple__30 __pyx_mstate_global->__pyx_tuple__30
jpayne@69 3992 #define __pyx_tuple__32 __pyx_mstate_global->__pyx_tuple__32
jpayne@69 3993 #define __pyx_codeobj__13 __pyx_mstate_global->__pyx_codeobj__13
jpayne@69 3994 #define __pyx_codeobj__17 __pyx_mstate_global->__pyx_codeobj__17
jpayne@69 3995 #define __pyx_codeobj__20 __pyx_mstate_global->__pyx_codeobj__20
jpayne@69 3996 #define __pyx_codeobj__21 __pyx_mstate_global->__pyx_codeobj__21
jpayne@69 3997 #define __pyx_codeobj__23 __pyx_mstate_global->__pyx_codeobj__23
jpayne@69 3998 #define __pyx_codeobj__24 __pyx_mstate_global->__pyx_codeobj__24
jpayne@69 3999 #define __pyx_codeobj__26 __pyx_mstate_global->__pyx_codeobj__26
jpayne@69 4000 #define __pyx_codeobj__28 __pyx_mstate_global->__pyx_codeobj__28
jpayne@69 4001 #define __pyx_codeobj__31 __pyx_mstate_global->__pyx_codeobj__31
jpayne@69 4002 /* #### Code section: module_code ### */
jpayne@69 4003
jpayne@69 4004 /* "cpython/complex.pxd":19
jpayne@69 4005 *
jpayne@69 4006 * @property
jpayne@69 4007 * cdef inline double real(self) noexcept: # <<<<<<<<<<<<<<
jpayne@69 4008 * return self.cval.real
jpayne@69 4009 *
jpayne@69 4010 */
jpayne@69 4011
jpayne@69 4012 static CYTHON_INLINE double __pyx_f_7cpython_7complex_7complex_4real_real(PyComplexObject *__pyx_v_self) {
jpayne@69 4013 double __pyx_r;
jpayne@69 4014
jpayne@69 4015 /* "cpython/complex.pxd":20
jpayne@69 4016 * @property
jpayne@69 4017 * cdef inline double real(self) noexcept:
jpayne@69 4018 * return self.cval.real # <<<<<<<<<<<<<<
jpayne@69 4019 *
jpayne@69 4020 * @property
jpayne@69 4021 */
jpayne@69 4022 __pyx_r = __pyx_v_self->cval.real;
jpayne@69 4023 goto __pyx_L0;
jpayne@69 4024
jpayne@69 4025 /* "cpython/complex.pxd":19
jpayne@69 4026 *
jpayne@69 4027 * @property
jpayne@69 4028 * cdef inline double real(self) noexcept: # <<<<<<<<<<<<<<
jpayne@69 4029 * return self.cval.real
jpayne@69 4030 *
jpayne@69 4031 */
jpayne@69 4032
jpayne@69 4033 /* function exit code */
jpayne@69 4034 __pyx_L0:;
jpayne@69 4035 return __pyx_r;
jpayne@69 4036 }
jpayne@69 4037
jpayne@69 4038 /* "cpython/complex.pxd":23
jpayne@69 4039 *
jpayne@69 4040 * @property
jpayne@69 4041 * cdef inline double imag(self) noexcept: # <<<<<<<<<<<<<<
jpayne@69 4042 * return self.cval.imag
jpayne@69 4043 *
jpayne@69 4044 */
jpayne@69 4045
jpayne@69 4046 static CYTHON_INLINE double __pyx_f_7cpython_7complex_7complex_4imag_imag(PyComplexObject *__pyx_v_self) {
jpayne@69 4047 double __pyx_r;
jpayne@69 4048
jpayne@69 4049 /* "cpython/complex.pxd":24
jpayne@69 4050 * @property
jpayne@69 4051 * cdef inline double imag(self) noexcept:
jpayne@69 4052 * return self.cval.imag # <<<<<<<<<<<<<<
jpayne@69 4053 *
jpayne@69 4054 * # PyTypeObject PyComplex_Type
jpayne@69 4055 */
jpayne@69 4056 __pyx_r = __pyx_v_self->cval.imag;
jpayne@69 4057 goto __pyx_L0;
jpayne@69 4058
jpayne@69 4059 /* "cpython/complex.pxd":23
jpayne@69 4060 *
jpayne@69 4061 * @property
jpayne@69 4062 * cdef inline double imag(self) noexcept: # <<<<<<<<<<<<<<
jpayne@69 4063 * return self.cval.imag
jpayne@69 4064 *
jpayne@69 4065 */
jpayne@69 4066
jpayne@69 4067 /* function exit code */
jpayne@69 4068 __pyx_L0:;
jpayne@69 4069 return __pyx_r;
jpayne@69 4070 }
jpayne@69 4071
jpayne@69 4072 /* "cpython/contextvars.pxd":112
jpayne@69 4073 *
jpayne@69 4074 *
jpayne@69 4075 * cdef inline object get_value(var, default_value=None): # <<<<<<<<<<<<<<
jpayne@69 4076 * """Return a new reference to the value of the context variable,
jpayne@69 4077 * or the default value of the context variable,
jpayne@69 4078 */
jpayne@69 4079
jpayne@69 4080 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) {
jpayne@69 4081 PyObject *__pyx_v_default_value = ((PyObject *)Py_None);
jpayne@69 4082 PyObject *__pyx_v_value;
jpayne@69 4083 PyObject *__pyx_v_pyvalue = NULL;
jpayne@69 4084 PyObject *__pyx_r = NULL;
jpayne@69 4085 __Pyx_RefNannyDeclarations
jpayne@69 4086 int __pyx_t_1;
jpayne@69 4087 int __pyx_t_2;
jpayne@69 4088 PyObject *__pyx_t_3 = NULL;
jpayne@69 4089 int __pyx_lineno = 0;
jpayne@69 4090 const char *__pyx_filename = NULL;
jpayne@69 4091 int __pyx_clineno = 0;
jpayne@69 4092 __Pyx_RefNannySetupContext("get_value", 1);
jpayne@69 4093 if (__pyx_optional_args) {
jpayne@69 4094 if (__pyx_optional_args->__pyx_n > 0) {
jpayne@69 4095 __pyx_v_default_value = __pyx_optional_args->default_value;
jpayne@69 4096 }
jpayne@69 4097 }
jpayne@69 4098
jpayne@69 4099 /* "cpython/contextvars.pxd":117
jpayne@69 4100 * or None if no such value or default was found.
jpayne@69 4101 * """
jpayne@69 4102 * cdef PyObject *value = NULL # <<<<<<<<<<<<<<
jpayne@69 4103 * PyContextVar_Get(var, NULL, &value)
jpayne@69 4104 * if value is NULL:
jpayne@69 4105 */
jpayne@69 4106 __pyx_v_value = NULL;
jpayne@69 4107
jpayne@69 4108 /* "cpython/contextvars.pxd":118
jpayne@69 4109 * """
jpayne@69 4110 * cdef PyObject *value = NULL
jpayne@69 4111 * PyContextVar_Get(var, NULL, &value) # <<<<<<<<<<<<<<
jpayne@69 4112 * if value is NULL:
jpayne@69 4113 * # context variable does not have a default
jpayne@69 4114 */
jpayne@69 4115 __pyx_t_1 = PyContextVar_Get(__pyx_v_var, NULL, (&__pyx_v_value)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(1, 118, __pyx_L1_error)
jpayne@69 4116
jpayne@69 4117 /* "cpython/contextvars.pxd":119
jpayne@69 4118 * cdef PyObject *value = NULL
jpayne@69 4119 * PyContextVar_Get(var, NULL, &value)
jpayne@69 4120 * if value is NULL: # <<<<<<<<<<<<<<
jpayne@69 4121 * # context variable does not have a default
jpayne@69 4122 * pyvalue = default_value
jpayne@69 4123 */
jpayne@69 4124 __pyx_t_2 = (__pyx_v_value == NULL);
jpayne@69 4125 if (__pyx_t_2) {
jpayne@69 4126
jpayne@69 4127 /* "cpython/contextvars.pxd":121
jpayne@69 4128 * if value is NULL:
jpayne@69 4129 * # context variable does not have a default
jpayne@69 4130 * pyvalue = default_value # <<<<<<<<<<<<<<
jpayne@69 4131 * else:
jpayne@69 4132 * # value or default value of context variable
jpayne@69 4133 */
jpayne@69 4134 __Pyx_INCREF(__pyx_v_default_value);
jpayne@69 4135 __pyx_v_pyvalue = __pyx_v_default_value;
jpayne@69 4136
jpayne@69 4137 /* "cpython/contextvars.pxd":119
jpayne@69 4138 * cdef PyObject *value = NULL
jpayne@69 4139 * PyContextVar_Get(var, NULL, &value)
jpayne@69 4140 * if value is NULL: # <<<<<<<<<<<<<<
jpayne@69 4141 * # context variable does not have a default
jpayne@69 4142 * pyvalue = default_value
jpayne@69 4143 */
jpayne@69 4144 goto __pyx_L3;
jpayne@69 4145 }
jpayne@69 4146
jpayne@69 4147 /* "cpython/contextvars.pxd":124
jpayne@69 4148 * else:
jpayne@69 4149 * # value or default value of context variable
jpayne@69 4150 * pyvalue = <object>value # <<<<<<<<<<<<<<
jpayne@69 4151 * Py_XDECREF(value) # PyContextVar_Get() returned an owned reference as 'PyObject*'
jpayne@69 4152 * return pyvalue
jpayne@69 4153 */
jpayne@69 4154 /*else*/ {
jpayne@69 4155 __pyx_t_3 = ((PyObject *)__pyx_v_value);
jpayne@69 4156 __Pyx_INCREF(__pyx_t_3);
jpayne@69 4157 __pyx_v_pyvalue = __pyx_t_3;
jpayne@69 4158 __pyx_t_3 = 0;
jpayne@69 4159
jpayne@69 4160 /* "cpython/contextvars.pxd":125
jpayne@69 4161 * # value or default value of context variable
jpayne@69 4162 * pyvalue = <object>value
jpayne@69 4163 * Py_XDECREF(value) # PyContextVar_Get() returned an owned reference as 'PyObject*' # <<<<<<<<<<<<<<
jpayne@69 4164 * return pyvalue
jpayne@69 4165 *
jpayne@69 4166 */
jpayne@69 4167 Py_XDECREF(__pyx_v_value);
jpayne@69 4168 }
jpayne@69 4169 __pyx_L3:;
jpayne@69 4170
jpayne@69 4171 /* "cpython/contextvars.pxd":126
jpayne@69 4172 * pyvalue = <object>value
jpayne@69 4173 * Py_XDECREF(value) # PyContextVar_Get() returned an owned reference as 'PyObject*'
jpayne@69 4174 * return pyvalue # <<<<<<<<<<<<<<
jpayne@69 4175 *
jpayne@69 4176 *
jpayne@69 4177 */
jpayne@69 4178 __Pyx_XDECREF(__pyx_r);
jpayne@69 4179 __Pyx_INCREF(__pyx_v_pyvalue);
jpayne@69 4180 __pyx_r = __pyx_v_pyvalue;
jpayne@69 4181 goto __pyx_L0;
jpayne@69 4182
jpayne@69 4183 /* "cpython/contextvars.pxd":112
jpayne@69 4184 *
jpayne@69 4185 *
jpayne@69 4186 * cdef inline object get_value(var, default_value=None): # <<<<<<<<<<<<<<
jpayne@69 4187 * """Return a new reference to the value of the context variable,
jpayne@69 4188 * or the default value of the context variable,
jpayne@69 4189 */
jpayne@69 4190
jpayne@69 4191 /* function exit code */
jpayne@69 4192 __pyx_L1_error:;
jpayne@69 4193 __Pyx_XDECREF(__pyx_t_3);
jpayne@69 4194 __Pyx_AddTraceback("cpython.contextvars.get_value", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@69 4195 __pyx_r = 0;
jpayne@69 4196 __pyx_L0:;
jpayne@69 4197 __Pyx_XDECREF(__pyx_v_pyvalue);
jpayne@69 4198 __Pyx_XGIVEREF(__pyx_r);
jpayne@69 4199 __Pyx_RefNannyFinishContext();
jpayne@69 4200 return __pyx_r;
jpayne@69 4201 }
jpayne@69 4202
jpayne@69 4203 /* "cpython/contextvars.pxd":129
jpayne@69 4204 *
jpayne@69 4205 *
jpayne@69 4206 * cdef inline object get_value_no_default(var, default_value=None): # <<<<<<<<<<<<<<
jpayne@69 4207 * """Return a new reference to the value of the context variable,
jpayne@69 4208 * or the provided default value if no such value was found.
jpayne@69 4209 */
jpayne@69 4210
jpayne@69 4211 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) {
jpayne@69 4212 PyObject *__pyx_v_default_value = ((PyObject *)Py_None);
jpayne@69 4213 PyObject *__pyx_v_value;
jpayne@69 4214 PyObject *__pyx_v_pyvalue = NULL;
jpayne@69 4215 PyObject *__pyx_r = NULL;
jpayne@69 4216 __Pyx_RefNannyDeclarations
jpayne@69 4217 int __pyx_t_1;
jpayne@69 4218 PyObject *__pyx_t_2 = NULL;
jpayne@69 4219 int __pyx_lineno = 0;
jpayne@69 4220 const char *__pyx_filename = NULL;
jpayne@69 4221 int __pyx_clineno = 0;
jpayne@69 4222 __Pyx_RefNannySetupContext("get_value_no_default", 1);
jpayne@69 4223 if (__pyx_optional_args) {
jpayne@69 4224 if (__pyx_optional_args->__pyx_n > 0) {
jpayne@69 4225 __pyx_v_default_value = __pyx_optional_args->default_value;
jpayne@69 4226 }
jpayne@69 4227 }
jpayne@69 4228
jpayne@69 4229 /* "cpython/contextvars.pxd":135
jpayne@69 4230 * Ignores the default value of the context variable, if any.
jpayne@69 4231 * """
jpayne@69 4232 * cdef PyObject *value = NULL # <<<<<<<<<<<<<<
jpayne@69 4233 * PyContextVar_Get(var, <PyObject*>default_value, &value)
jpayne@69 4234 * # value of context variable or 'default_value'
jpayne@69 4235 */
jpayne@69 4236 __pyx_v_value = NULL;
jpayne@69 4237
jpayne@69 4238 /* "cpython/contextvars.pxd":136
jpayne@69 4239 * """
jpayne@69 4240 * cdef PyObject *value = NULL
jpayne@69 4241 * PyContextVar_Get(var, <PyObject*>default_value, &value) # <<<<<<<<<<<<<<
jpayne@69 4242 * # value of context variable or 'default_value'
jpayne@69 4243 * pyvalue = <object>value
jpayne@69 4244 */
jpayne@69 4245 __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(1, 136, __pyx_L1_error)
jpayne@69 4246
jpayne@69 4247 /* "cpython/contextvars.pxd":138
jpayne@69 4248 * PyContextVar_Get(var, <PyObject*>default_value, &value)
jpayne@69 4249 * # value of context variable or 'default_value'
jpayne@69 4250 * pyvalue = <object>value # <<<<<<<<<<<<<<
jpayne@69 4251 * Py_XDECREF(value) # PyContextVar_Get() returned an owned reference as 'PyObject*'
jpayne@69 4252 * return pyvalue
jpayne@69 4253 */
jpayne@69 4254 __pyx_t_2 = ((PyObject *)__pyx_v_value);
jpayne@69 4255 __Pyx_INCREF(__pyx_t_2);
jpayne@69 4256 __pyx_v_pyvalue = __pyx_t_2;
jpayne@69 4257 __pyx_t_2 = 0;
jpayne@69 4258
jpayne@69 4259 /* "cpython/contextvars.pxd":139
jpayne@69 4260 * # value of context variable or 'default_value'
jpayne@69 4261 * pyvalue = <object>value
jpayne@69 4262 * Py_XDECREF(value) # PyContextVar_Get() returned an owned reference as 'PyObject*' # <<<<<<<<<<<<<<
jpayne@69 4263 * return pyvalue
jpayne@69 4264 */
jpayne@69 4265 Py_XDECREF(__pyx_v_value);
jpayne@69 4266
jpayne@69 4267 /* "cpython/contextvars.pxd":140
jpayne@69 4268 * pyvalue = <object>value
jpayne@69 4269 * Py_XDECREF(value) # PyContextVar_Get() returned an owned reference as 'PyObject*'
jpayne@69 4270 * return pyvalue # <<<<<<<<<<<<<<
jpayne@69 4271 */
jpayne@69 4272 __Pyx_XDECREF(__pyx_r);
jpayne@69 4273 __Pyx_INCREF(__pyx_v_pyvalue);
jpayne@69 4274 __pyx_r = __pyx_v_pyvalue;
jpayne@69 4275 goto __pyx_L0;
jpayne@69 4276
jpayne@69 4277 /* "cpython/contextvars.pxd":129
jpayne@69 4278 *
jpayne@69 4279 *
jpayne@69 4280 * cdef inline object get_value_no_default(var, default_value=None): # <<<<<<<<<<<<<<
jpayne@69 4281 * """Return a new reference to the value of the context variable,
jpayne@69 4282 * or the provided default value if no such value was found.
jpayne@69 4283 */
jpayne@69 4284
jpayne@69 4285 /* function exit code */
jpayne@69 4286 __pyx_L1_error:;
jpayne@69 4287 __Pyx_XDECREF(__pyx_t_2);
jpayne@69 4288 __Pyx_AddTraceback("cpython.contextvars.get_value_no_default", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@69 4289 __pyx_r = 0;
jpayne@69 4290 __pyx_L0:;
jpayne@69 4291 __Pyx_XDECREF(__pyx_v_pyvalue);
jpayne@69 4292 __Pyx_XGIVEREF(__pyx_r);
jpayne@69 4293 __Pyx_RefNannyFinishContext();
jpayne@69 4294 return __pyx_r;
jpayne@69 4295 }
jpayne@69 4296
jpayne@69 4297 /* "array.pxd":104
jpayne@69 4298 * __data_union data
jpayne@69 4299 *
jpayne@69 4300 * def __getbuffer__(self, Py_buffer* info, int flags): # <<<<<<<<<<<<<<
jpayne@69 4301 * # This implementation of getbuffer is geared towards Cython
jpayne@69 4302 * # requirements, and does not yet fulfill the PEP.
jpayne@69 4303 */
jpayne@69 4304
jpayne@69 4305 /* Python wrapper */
jpayne@69 4306 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*/
jpayne@69 4307 CYTHON_UNUSED static int __pyx_pw_7cpython_5array_5array_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
jpayne@69 4308 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
jpayne@69 4309 int __pyx_r;
jpayne@69 4310 __Pyx_RefNannyDeclarations
jpayne@69 4311 __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
jpayne@69 4312 __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
jpayne@69 4313 __pyx_r = __pyx_pf_7cpython_5array_5array___getbuffer__(((arrayobject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));
jpayne@69 4314
jpayne@69 4315 /* function exit code */
jpayne@69 4316 __Pyx_RefNannyFinishContext();
jpayne@69 4317 return __pyx_r;
jpayne@69 4318 }
jpayne@69 4319
jpayne@69 4320 static int __pyx_pf_7cpython_5array_5array___getbuffer__(arrayobject *__pyx_v_self, Py_buffer *__pyx_v_info, CYTHON_UNUSED int __pyx_v_flags) {
jpayne@69 4321 PyObject *__pyx_v_item_count = NULL;
jpayne@69 4322 int __pyx_r;
jpayne@69 4323 __Pyx_RefNannyDeclarations
jpayne@69 4324 PyObject *__pyx_t_1 = NULL;
jpayne@69 4325 char *__pyx_t_2;
jpayne@69 4326 int __pyx_t_3;
jpayne@69 4327 PyObject *__pyx_t_4 = NULL;
jpayne@69 4328 Py_ssize_t __pyx_t_5;
jpayne@69 4329 int __pyx_t_6;
jpayne@69 4330 char __pyx_t_7;
jpayne@69 4331 int __pyx_lineno = 0;
jpayne@69 4332 const char *__pyx_filename = NULL;
jpayne@69 4333 int __pyx_clineno = 0;
jpayne@69 4334 if (unlikely(__pyx_v_info == NULL)) {
jpayne@69 4335 PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
jpayne@69 4336 return -1;
jpayne@69 4337 }
jpayne@69 4338 __Pyx_RefNannySetupContext("__getbuffer__", 0);
jpayne@69 4339 __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
jpayne@69 4340 __Pyx_GIVEREF(__pyx_v_info->obj);
jpayne@69 4341
jpayne@69 4342 /* "array.pxd":109
jpayne@69 4343 * # In particular strided access is always provided regardless
jpayne@69 4344 * # of flags
jpayne@69 4345 * item_count = Py_SIZE(self) # <<<<<<<<<<<<<<
jpayne@69 4346 *
jpayne@69 4347 * info.suboffsets = NULL
jpayne@69 4348 */
jpayne@69 4349 __pyx_t_1 = PyInt_FromSsize_t(Py_SIZE(((PyObject *)__pyx_v_self))); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 109, __pyx_L1_error)
jpayne@69 4350 __Pyx_GOTREF(__pyx_t_1);
jpayne@69 4351 __pyx_v_item_count = __pyx_t_1;
jpayne@69 4352 __pyx_t_1 = 0;
jpayne@69 4353
jpayne@69 4354 /* "array.pxd":111
jpayne@69 4355 * item_count = Py_SIZE(self)
jpayne@69 4356 *
jpayne@69 4357 * info.suboffsets = NULL # <<<<<<<<<<<<<<
jpayne@69 4358 * info.buf = self.data.as_chars
jpayne@69 4359 * info.readonly = 0
jpayne@69 4360 */
jpayne@69 4361 __pyx_v_info->suboffsets = NULL;
jpayne@69 4362
jpayne@69 4363 /* "array.pxd":112
jpayne@69 4364 *
jpayne@69 4365 * info.suboffsets = NULL
jpayne@69 4366 * info.buf = self.data.as_chars # <<<<<<<<<<<<<<
jpayne@69 4367 * info.readonly = 0
jpayne@69 4368 * info.ndim = 1
jpayne@69 4369 */
jpayne@69 4370 __pyx_t_2 = __pyx_v_self->data.as_chars;
jpayne@69 4371 __pyx_v_info->buf = __pyx_t_2;
jpayne@69 4372
jpayne@69 4373 /* "array.pxd":113
jpayne@69 4374 * info.suboffsets = NULL
jpayne@69 4375 * info.buf = self.data.as_chars
jpayne@69 4376 * info.readonly = 0 # <<<<<<<<<<<<<<
jpayne@69 4377 * info.ndim = 1
jpayne@69 4378 * info.itemsize = self.ob_descr.itemsize # e.g. sizeof(float)
jpayne@69 4379 */
jpayne@69 4380 __pyx_v_info->readonly = 0;
jpayne@69 4381
jpayne@69 4382 /* "array.pxd":114
jpayne@69 4383 * info.buf = self.data.as_chars
jpayne@69 4384 * info.readonly = 0
jpayne@69 4385 * info.ndim = 1 # <<<<<<<<<<<<<<
jpayne@69 4386 * info.itemsize = self.ob_descr.itemsize # e.g. sizeof(float)
jpayne@69 4387 * info.len = info.itemsize * item_count
jpayne@69 4388 */
jpayne@69 4389 __pyx_v_info->ndim = 1;
jpayne@69 4390
jpayne@69 4391 /* "array.pxd":115
jpayne@69 4392 * info.readonly = 0
jpayne@69 4393 * info.ndim = 1
jpayne@69 4394 * info.itemsize = self.ob_descr.itemsize # e.g. sizeof(float) # <<<<<<<<<<<<<<
jpayne@69 4395 * info.len = info.itemsize * item_count
jpayne@69 4396 *
jpayne@69 4397 */
jpayne@69 4398 __pyx_t_3 = __pyx_v_self->ob_descr->itemsize;
jpayne@69 4399 __pyx_v_info->itemsize = __pyx_t_3;
jpayne@69 4400
jpayne@69 4401 /* "array.pxd":116
jpayne@69 4402 * info.ndim = 1
jpayne@69 4403 * info.itemsize = self.ob_descr.itemsize # e.g. sizeof(float)
jpayne@69 4404 * info.len = info.itemsize * item_count # <<<<<<<<<<<<<<
jpayne@69 4405 *
jpayne@69 4406 * info.shape = <Py_ssize_t*> PyObject_Malloc(sizeof(Py_ssize_t) + 2)
jpayne@69 4407 */
jpayne@69 4408 __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_info->itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 116, __pyx_L1_error)
jpayne@69 4409 __Pyx_GOTREF(__pyx_t_1);
jpayne@69 4410 __pyx_t_4 = PyNumber_Multiply(__pyx_t_1, __pyx_v_item_count); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 116, __pyx_L1_error)
jpayne@69 4411 __Pyx_GOTREF(__pyx_t_4);
jpayne@69 4412 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
jpayne@69 4413 __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_4); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 116, __pyx_L1_error)
jpayne@69 4414 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
jpayne@69 4415 __pyx_v_info->len = __pyx_t_5;
jpayne@69 4416
jpayne@69 4417 /* "array.pxd":118
jpayne@69 4418 * info.len = info.itemsize * item_count
jpayne@69 4419 *
jpayne@69 4420 * info.shape = <Py_ssize_t*> PyObject_Malloc(sizeof(Py_ssize_t) + 2) # <<<<<<<<<<<<<<
jpayne@69 4421 * if not info.shape:
jpayne@69 4422 * raise MemoryError()
jpayne@69 4423 */
jpayne@69 4424 __pyx_v_info->shape = ((Py_ssize_t *)PyObject_Malloc(((sizeof(Py_ssize_t)) + 2)));
jpayne@69 4425
jpayne@69 4426 /* "array.pxd":119
jpayne@69 4427 *
jpayne@69 4428 * info.shape = <Py_ssize_t*> PyObject_Malloc(sizeof(Py_ssize_t) + 2)
jpayne@69 4429 * if not info.shape: # <<<<<<<<<<<<<<
jpayne@69 4430 * raise MemoryError()
jpayne@69 4431 * info.shape[0] = item_count # constant regardless of resizing
jpayne@69 4432 */
jpayne@69 4433 __pyx_t_6 = (!(__pyx_v_info->shape != 0));
jpayne@69 4434 if (unlikely(__pyx_t_6)) {
jpayne@69 4435
jpayne@69 4436 /* "array.pxd":120
jpayne@69 4437 * info.shape = <Py_ssize_t*> PyObject_Malloc(sizeof(Py_ssize_t) + 2)
jpayne@69 4438 * if not info.shape:
jpayne@69 4439 * raise MemoryError() # <<<<<<<<<<<<<<
jpayne@69 4440 * info.shape[0] = item_count # constant regardless of resizing
jpayne@69 4441 * info.strides = &info.itemsize
jpayne@69 4442 */
jpayne@69 4443 PyErr_NoMemory(); __PYX_ERR(2, 120, __pyx_L1_error)
jpayne@69 4444
jpayne@69 4445 /* "array.pxd":119
jpayne@69 4446 *
jpayne@69 4447 * info.shape = <Py_ssize_t*> PyObject_Malloc(sizeof(Py_ssize_t) + 2)
jpayne@69 4448 * if not info.shape: # <<<<<<<<<<<<<<
jpayne@69 4449 * raise MemoryError()
jpayne@69 4450 * info.shape[0] = item_count # constant regardless of resizing
jpayne@69 4451 */
jpayne@69 4452 }
jpayne@69 4453
jpayne@69 4454 /* "array.pxd":121
jpayne@69 4455 * if not info.shape:
jpayne@69 4456 * raise MemoryError()
jpayne@69 4457 * info.shape[0] = item_count # constant regardless of resizing # <<<<<<<<<<<<<<
jpayne@69 4458 * info.strides = &info.itemsize
jpayne@69 4459 *
jpayne@69 4460 */
jpayne@69 4461 __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_v_item_count); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 121, __pyx_L1_error)
jpayne@69 4462 (__pyx_v_info->shape[0]) = __pyx_t_5;
jpayne@69 4463
jpayne@69 4464 /* "array.pxd":122
jpayne@69 4465 * raise MemoryError()
jpayne@69 4466 * info.shape[0] = item_count # constant regardless of resizing
jpayne@69 4467 * info.strides = &info.itemsize # <<<<<<<<<<<<<<
jpayne@69 4468 *
jpayne@69 4469 * info.format = <char*> (info.shape + 1)
jpayne@69 4470 */
jpayne@69 4471 __pyx_v_info->strides = (&__pyx_v_info->itemsize);
jpayne@69 4472
jpayne@69 4473 /* "array.pxd":124
jpayne@69 4474 * info.strides = &info.itemsize
jpayne@69 4475 *
jpayne@69 4476 * info.format = <char*> (info.shape + 1) # <<<<<<<<<<<<<<
jpayne@69 4477 * info.format[0] = self.ob_descr.typecode
jpayne@69 4478 * info.format[1] = 0
jpayne@69 4479 */
jpayne@69 4480 __pyx_v_info->format = ((char *)(__pyx_v_info->shape + 1));
jpayne@69 4481
jpayne@69 4482 /* "array.pxd":125
jpayne@69 4483 *
jpayne@69 4484 * info.format = <char*> (info.shape + 1)
jpayne@69 4485 * info.format[0] = self.ob_descr.typecode # <<<<<<<<<<<<<<
jpayne@69 4486 * info.format[1] = 0
jpayne@69 4487 * info.obj = self
jpayne@69 4488 */
jpayne@69 4489 __pyx_t_7 = __pyx_v_self->ob_descr->typecode;
jpayne@69 4490 (__pyx_v_info->format[0]) = __pyx_t_7;
jpayne@69 4491
jpayne@69 4492 /* "array.pxd":126
jpayne@69 4493 * info.format = <char*> (info.shape + 1)
jpayne@69 4494 * info.format[0] = self.ob_descr.typecode
jpayne@69 4495 * info.format[1] = 0 # <<<<<<<<<<<<<<
jpayne@69 4496 * info.obj = self
jpayne@69 4497 *
jpayne@69 4498 */
jpayne@69 4499 (__pyx_v_info->format[1]) = 0;
jpayne@69 4500
jpayne@69 4501 /* "array.pxd":127
jpayne@69 4502 * info.format[0] = self.ob_descr.typecode
jpayne@69 4503 * info.format[1] = 0
jpayne@69 4504 * info.obj = self # <<<<<<<<<<<<<<
jpayne@69 4505 *
jpayne@69 4506 * def __releasebuffer__(self, Py_buffer* info):
jpayne@69 4507 */
jpayne@69 4508 __Pyx_INCREF((PyObject *)__pyx_v_self);
jpayne@69 4509 __Pyx_GIVEREF((PyObject *)__pyx_v_self);
jpayne@69 4510 __Pyx_GOTREF(__pyx_v_info->obj);
jpayne@69 4511 __Pyx_DECREF(__pyx_v_info->obj);
jpayne@69 4512 __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
jpayne@69 4513
jpayne@69 4514 /* "array.pxd":104
jpayne@69 4515 * __data_union data
jpayne@69 4516 *
jpayne@69 4517 * def __getbuffer__(self, Py_buffer* info, int flags): # <<<<<<<<<<<<<<
jpayne@69 4518 * # This implementation of getbuffer is geared towards Cython
jpayne@69 4519 * # requirements, and does not yet fulfill the PEP.
jpayne@69 4520 */
jpayne@69 4521
jpayne@69 4522 /* function exit code */
jpayne@69 4523 __pyx_r = 0;
jpayne@69 4524 goto __pyx_L0;
jpayne@69 4525 __pyx_L1_error:;
jpayne@69 4526 __Pyx_XDECREF(__pyx_t_1);
jpayne@69 4527 __Pyx_XDECREF(__pyx_t_4);
jpayne@69 4528 __Pyx_AddTraceback("cpython.array.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@69 4529 __pyx_r = -1;
jpayne@69 4530 if (__pyx_v_info->obj != NULL) {
jpayne@69 4531 __Pyx_GOTREF(__pyx_v_info->obj);
jpayne@69 4532 __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
jpayne@69 4533 }
jpayne@69 4534 goto __pyx_L2;
jpayne@69 4535 __pyx_L0:;
jpayne@69 4536 if (__pyx_v_info->obj == Py_None) {
jpayne@69 4537 __Pyx_GOTREF(__pyx_v_info->obj);
jpayne@69 4538 __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
jpayne@69 4539 }
jpayne@69 4540 __pyx_L2:;
jpayne@69 4541 __Pyx_XDECREF(__pyx_v_item_count);
jpayne@69 4542 __Pyx_RefNannyFinishContext();
jpayne@69 4543 return __pyx_r;
jpayne@69 4544 }
jpayne@69 4545
jpayne@69 4546 /* "array.pxd":129
jpayne@69 4547 * info.obj = self
jpayne@69 4548 *
jpayne@69 4549 * def __releasebuffer__(self, Py_buffer* info): # <<<<<<<<<<<<<<
jpayne@69 4550 * PyObject_Free(info.shape)
jpayne@69 4551 *
jpayne@69 4552 */
jpayne@69 4553
jpayne@69 4554 /* Python wrapper */
jpayne@69 4555 CYTHON_UNUSED static void __pyx_pw_7cpython_5array_5array_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
jpayne@69 4556 CYTHON_UNUSED static void __pyx_pw_7cpython_5array_5array_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
jpayne@69 4557 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
jpayne@69 4558 __Pyx_RefNannyDeclarations
jpayne@69 4559 __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0);
jpayne@69 4560 __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
jpayne@69 4561 __pyx_pf_7cpython_5array_5array_2__releasebuffer__(((arrayobject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info));
jpayne@69 4562
jpayne@69 4563 /* function exit code */
jpayne@69 4564 __Pyx_RefNannyFinishContext();
jpayne@69 4565 }
jpayne@69 4566
jpayne@69 4567 static void __pyx_pf_7cpython_5array_5array_2__releasebuffer__(CYTHON_UNUSED arrayobject *__pyx_v_self, Py_buffer *__pyx_v_info) {
jpayne@69 4568
jpayne@69 4569 /* "array.pxd":130
jpayne@69 4570 *
jpayne@69 4571 * def __releasebuffer__(self, Py_buffer* info):
jpayne@69 4572 * PyObject_Free(info.shape) # <<<<<<<<<<<<<<
jpayne@69 4573 *
jpayne@69 4574 * array newarrayobject(PyTypeObject* type, Py_ssize_t size, arraydescr *descr)
jpayne@69 4575 */
jpayne@69 4576 PyObject_Free(__pyx_v_info->shape);
jpayne@69 4577
jpayne@69 4578 /* "array.pxd":129
jpayne@69 4579 * info.obj = self
jpayne@69 4580 *
jpayne@69 4581 * def __releasebuffer__(self, Py_buffer* info): # <<<<<<<<<<<<<<
jpayne@69 4582 * PyObject_Free(info.shape)
jpayne@69 4583 *
jpayne@69 4584 */
jpayne@69 4585
jpayne@69 4586 /* function exit code */
jpayne@69 4587 }
jpayne@69 4588
jpayne@69 4589 /* "array.pxd":141
jpayne@69 4590 *
jpayne@69 4591 *
jpayne@69 4592 * cdef inline array clone(array template, Py_ssize_t length, bint zero): # <<<<<<<<<<<<<<
jpayne@69 4593 * """ fast creation of a new array, given a template array.
jpayne@69 4594 * type will be same as template.
jpayne@69 4595 */
jpayne@69 4596
jpayne@69 4597 static CYTHON_INLINE arrayobject *__pyx_f_7cpython_5array_clone(arrayobject *__pyx_v_template, Py_ssize_t __pyx_v_length, int __pyx_v_zero) {
jpayne@69 4598 arrayobject *__pyx_v_op = 0;
jpayne@69 4599 arrayobject *__pyx_r = NULL;
jpayne@69 4600 __Pyx_RefNannyDeclarations
jpayne@69 4601 PyObject *__pyx_t_1 = NULL;
jpayne@69 4602 int __pyx_t_2;
jpayne@69 4603 int __pyx_t_3;
jpayne@69 4604 int __pyx_lineno = 0;
jpayne@69 4605 const char *__pyx_filename = NULL;
jpayne@69 4606 int __pyx_clineno = 0;
jpayne@69 4607 __Pyx_RefNannySetupContext("clone", 1);
jpayne@69 4608
jpayne@69 4609 /* "array.pxd":145
jpayne@69 4610 * type will be same as template.
jpayne@69 4611 * if zero is true, new array will be initialized with zeroes."""
jpayne@69 4612 * cdef array op = newarrayobject(Py_TYPE(template), length, template.ob_descr) # <<<<<<<<<<<<<<
jpayne@69 4613 * if zero and op is not None:
jpayne@69 4614 * memset(op.data.as_chars, 0, length * op.ob_descr.itemsize)
jpayne@69 4615 */
jpayne@69 4616 __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(2, 145, __pyx_L1_error)
jpayne@69 4617 __Pyx_GOTREF(__pyx_t_1);
jpayne@69 4618 __pyx_v_op = ((arrayobject *)__pyx_t_1);
jpayne@69 4619 __pyx_t_1 = 0;
jpayne@69 4620
jpayne@69 4621 /* "array.pxd":146
jpayne@69 4622 * if zero is true, new array will be initialized with zeroes."""
jpayne@69 4623 * cdef array op = newarrayobject(Py_TYPE(template), length, template.ob_descr)
jpayne@69 4624 * if zero and op is not None: # <<<<<<<<<<<<<<
jpayne@69 4625 * memset(op.data.as_chars, 0, length * op.ob_descr.itemsize)
jpayne@69 4626 * return op
jpayne@69 4627 */
jpayne@69 4628 if (__pyx_v_zero) {
jpayne@69 4629 } else {
jpayne@69 4630 __pyx_t_2 = __pyx_v_zero;
jpayne@69 4631 goto __pyx_L4_bool_binop_done;
jpayne@69 4632 }
jpayne@69 4633 __pyx_t_3 = (((PyObject *)__pyx_v_op) != Py_None);
jpayne@69 4634 __pyx_t_2 = __pyx_t_3;
jpayne@69 4635 __pyx_L4_bool_binop_done:;
jpayne@69 4636 if (__pyx_t_2) {
jpayne@69 4637
jpayne@69 4638 /* "array.pxd":147
jpayne@69 4639 * cdef array op = newarrayobject(Py_TYPE(template), length, template.ob_descr)
jpayne@69 4640 * if zero and op is not None:
jpayne@69 4641 * memset(op.data.as_chars, 0, length * op.ob_descr.itemsize) # <<<<<<<<<<<<<<
jpayne@69 4642 * return op
jpayne@69 4643 *
jpayne@69 4644 */
jpayne@69 4645 (void)(memset(__pyx_v_op->data.as_chars, 0, (__pyx_v_length * __pyx_v_op->ob_descr->itemsize)));
jpayne@69 4646
jpayne@69 4647 /* "array.pxd":146
jpayne@69 4648 * if zero is true, new array will be initialized with zeroes."""
jpayne@69 4649 * cdef array op = newarrayobject(Py_TYPE(template), length, template.ob_descr)
jpayne@69 4650 * if zero and op is not None: # <<<<<<<<<<<<<<
jpayne@69 4651 * memset(op.data.as_chars, 0, length * op.ob_descr.itemsize)
jpayne@69 4652 * return op
jpayne@69 4653 */
jpayne@69 4654 }
jpayne@69 4655
jpayne@69 4656 /* "array.pxd":148
jpayne@69 4657 * if zero and op is not None:
jpayne@69 4658 * memset(op.data.as_chars, 0, length * op.ob_descr.itemsize)
jpayne@69 4659 * return op # <<<<<<<<<<<<<<
jpayne@69 4660 *
jpayne@69 4661 * cdef inline array copy(array self):
jpayne@69 4662 */
jpayne@69 4663 __Pyx_XDECREF((PyObject *)__pyx_r);
jpayne@69 4664 __Pyx_INCREF((PyObject *)__pyx_v_op);
jpayne@69 4665 __pyx_r = __pyx_v_op;
jpayne@69 4666 goto __pyx_L0;
jpayne@69 4667
jpayne@69 4668 /* "array.pxd":141
jpayne@69 4669 *
jpayne@69 4670 *
jpayne@69 4671 * cdef inline array clone(array template, Py_ssize_t length, bint zero): # <<<<<<<<<<<<<<
jpayne@69 4672 * """ fast creation of a new array, given a template array.
jpayne@69 4673 * type will be same as template.
jpayne@69 4674 */
jpayne@69 4675
jpayne@69 4676 /* function exit code */
jpayne@69 4677 __pyx_L1_error:;
jpayne@69 4678 __Pyx_XDECREF(__pyx_t_1);
jpayne@69 4679 __Pyx_AddTraceback("cpython.array.clone", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@69 4680 __pyx_r = 0;
jpayne@69 4681 __pyx_L0:;
jpayne@69 4682 __Pyx_XDECREF((PyObject *)__pyx_v_op);
jpayne@69 4683 __Pyx_XGIVEREF((PyObject *)__pyx_r);
jpayne@69 4684 __Pyx_RefNannyFinishContext();
jpayne@69 4685 return __pyx_r;
jpayne@69 4686 }
jpayne@69 4687
jpayne@69 4688 /* "array.pxd":150
jpayne@69 4689 * return op
jpayne@69 4690 *
jpayne@69 4691 * cdef inline array copy(array self): # <<<<<<<<<<<<<<
jpayne@69 4692 * """ make a copy of an array. """
jpayne@69 4693 * cdef array op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr)
jpayne@69 4694 */
jpayne@69 4695
jpayne@69 4696 static CYTHON_INLINE arrayobject *__pyx_f_7cpython_5array_copy(arrayobject *__pyx_v_self) {
jpayne@69 4697 arrayobject *__pyx_v_op = 0;
jpayne@69 4698 arrayobject *__pyx_r = NULL;
jpayne@69 4699 __Pyx_RefNannyDeclarations
jpayne@69 4700 PyObject *__pyx_t_1 = NULL;
jpayne@69 4701 int __pyx_lineno = 0;
jpayne@69 4702 const char *__pyx_filename = NULL;
jpayne@69 4703 int __pyx_clineno = 0;
jpayne@69 4704 __Pyx_RefNannySetupContext("copy", 1);
jpayne@69 4705
jpayne@69 4706 /* "array.pxd":152
jpayne@69 4707 * cdef inline array copy(array self):
jpayne@69 4708 * """ make a copy of an array. """
jpayne@69 4709 * cdef array op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr) # <<<<<<<<<<<<<<
jpayne@69 4710 * memcpy(op.data.as_chars, self.data.as_chars, Py_SIZE(op) * op.ob_descr.itemsize)
jpayne@69 4711 * return op
jpayne@69 4712 */
jpayne@69 4713 __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(2, 152, __pyx_L1_error)
jpayne@69 4714 __Pyx_GOTREF(__pyx_t_1);
jpayne@69 4715 __pyx_v_op = ((arrayobject *)__pyx_t_1);
jpayne@69 4716 __pyx_t_1 = 0;
jpayne@69 4717
jpayne@69 4718 /* "array.pxd":153
jpayne@69 4719 * """ make a copy of an array. """
jpayne@69 4720 * cdef array op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr)
jpayne@69 4721 * memcpy(op.data.as_chars, self.data.as_chars, Py_SIZE(op) * op.ob_descr.itemsize) # <<<<<<<<<<<<<<
jpayne@69 4722 * return op
jpayne@69 4723 *
jpayne@69 4724 */
jpayne@69 4725 (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)));
jpayne@69 4726
jpayne@69 4727 /* "array.pxd":154
jpayne@69 4728 * cdef array op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr)
jpayne@69 4729 * memcpy(op.data.as_chars, self.data.as_chars, Py_SIZE(op) * op.ob_descr.itemsize)
jpayne@69 4730 * return op # <<<<<<<<<<<<<<
jpayne@69 4731 *
jpayne@69 4732 * cdef inline int extend_buffer(array self, char* stuff, Py_ssize_t n) except -1:
jpayne@69 4733 */
jpayne@69 4734 __Pyx_XDECREF((PyObject *)__pyx_r);
jpayne@69 4735 __Pyx_INCREF((PyObject *)__pyx_v_op);
jpayne@69 4736 __pyx_r = __pyx_v_op;
jpayne@69 4737 goto __pyx_L0;
jpayne@69 4738
jpayne@69 4739 /* "array.pxd":150
jpayne@69 4740 * return op
jpayne@69 4741 *
jpayne@69 4742 * cdef inline array copy(array self): # <<<<<<<<<<<<<<
jpayne@69 4743 * """ make a copy of an array. """
jpayne@69 4744 * cdef array op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr)
jpayne@69 4745 */
jpayne@69 4746
jpayne@69 4747 /* function exit code */
jpayne@69 4748 __pyx_L1_error:;
jpayne@69 4749 __Pyx_XDECREF(__pyx_t_1);
jpayne@69 4750 __Pyx_AddTraceback("cpython.array.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@69 4751 __pyx_r = 0;
jpayne@69 4752 __pyx_L0:;
jpayne@69 4753 __Pyx_XDECREF((PyObject *)__pyx_v_op);
jpayne@69 4754 __Pyx_XGIVEREF((PyObject *)__pyx_r);
jpayne@69 4755 __Pyx_RefNannyFinishContext();
jpayne@69 4756 return __pyx_r;
jpayne@69 4757 }
jpayne@69 4758
jpayne@69 4759 /* "array.pxd":156
jpayne@69 4760 * return op
jpayne@69 4761 *
jpayne@69 4762 * cdef inline int extend_buffer(array self, char* stuff, Py_ssize_t n) except -1: # <<<<<<<<<<<<<<
jpayne@69 4763 * """ efficient appending of new stuff of same type
jpayne@69 4764 * (e.g. of same array type)
jpayne@69 4765 */
jpayne@69 4766
jpayne@69 4767 static CYTHON_INLINE int __pyx_f_7cpython_5array_extend_buffer(arrayobject *__pyx_v_self, char *__pyx_v_stuff, Py_ssize_t __pyx_v_n) {
jpayne@69 4768 Py_ssize_t __pyx_v_itemsize;
jpayne@69 4769 Py_ssize_t __pyx_v_origsize;
jpayne@69 4770 int __pyx_r;
jpayne@69 4771 int __pyx_t_1;
jpayne@69 4772 int __pyx_lineno = 0;
jpayne@69 4773 const char *__pyx_filename = NULL;
jpayne@69 4774 int __pyx_clineno = 0;
jpayne@69 4775
jpayne@69 4776 /* "array.pxd":160
jpayne@69 4777 * (e.g. of same array type)
jpayne@69 4778 * n: number of elements (not number of bytes!) """
jpayne@69 4779 * cdef Py_ssize_t itemsize = self.ob_descr.itemsize # <<<<<<<<<<<<<<
jpayne@69 4780 * cdef Py_ssize_t origsize = Py_SIZE(self)
jpayne@69 4781 * resize_smart(self, origsize + n)
jpayne@69 4782 */
jpayne@69 4783 __pyx_t_1 = __pyx_v_self->ob_descr->itemsize;
jpayne@69 4784 __pyx_v_itemsize = __pyx_t_1;
jpayne@69 4785
jpayne@69 4786 /* "array.pxd":161
jpayne@69 4787 * n: number of elements (not number of bytes!) """
jpayne@69 4788 * cdef Py_ssize_t itemsize = self.ob_descr.itemsize
jpayne@69 4789 * cdef Py_ssize_t origsize = Py_SIZE(self) # <<<<<<<<<<<<<<
jpayne@69 4790 * resize_smart(self, origsize + n)
jpayne@69 4791 * memcpy(self.data.as_chars + origsize * itemsize, stuff, n * itemsize)
jpayne@69 4792 */
jpayne@69 4793 __pyx_v_origsize = Py_SIZE(((PyObject *)__pyx_v_self));
jpayne@69 4794
jpayne@69 4795 /* "array.pxd":162
jpayne@69 4796 * cdef Py_ssize_t itemsize = self.ob_descr.itemsize
jpayne@69 4797 * cdef Py_ssize_t origsize = Py_SIZE(self)
jpayne@69 4798 * resize_smart(self, origsize + n) # <<<<<<<<<<<<<<
jpayne@69 4799 * memcpy(self.data.as_chars + origsize * itemsize, stuff, n * itemsize)
jpayne@69 4800 * return 0
jpayne@69 4801 */
jpayne@69 4802 __pyx_t_1 = resize_smart(__pyx_v_self, (__pyx_v_origsize + __pyx_v_n)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(2, 162, __pyx_L1_error)
jpayne@69 4803
jpayne@69 4804 /* "array.pxd":163
jpayne@69 4805 * cdef Py_ssize_t origsize = Py_SIZE(self)
jpayne@69 4806 * resize_smart(self, origsize + n)
jpayne@69 4807 * memcpy(self.data.as_chars + origsize * itemsize, stuff, n * itemsize) # <<<<<<<<<<<<<<
jpayne@69 4808 * return 0
jpayne@69 4809 *
jpayne@69 4810 */
jpayne@69 4811 (void)(memcpy((__pyx_v_self->data.as_chars + (__pyx_v_origsize * __pyx_v_itemsize)), __pyx_v_stuff, (__pyx_v_n * __pyx_v_itemsize)));
jpayne@69 4812
jpayne@69 4813 /* "array.pxd":164
jpayne@69 4814 * resize_smart(self, origsize + n)
jpayne@69 4815 * memcpy(self.data.as_chars + origsize * itemsize, stuff, n * itemsize)
jpayne@69 4816 * return 0 # <<<<<<<<<<<<<<
jpayne@69 4817 *
jpayne@69 4818 * cdef inline int extend(array self, array other) except -1:
jpayne@69 4819 */
jpayne@69 4820 __pyx_r = 0;
jpayne@69 4821 goto __pyx_L0;
jpayne@69 4822
jpayne@69 4823 /* "array.pxd":156
jpayne@69 4824 * return op
jpayne@69 4825 *
jpayne@69 4826 * cdef inline int extend_buffer(array self, char* stuff, Py_ssize_t n) except -1: # <<<<<<<<<<<<<<
jpayne@69 4827 * """ efficient appending of new stuff of same type
jpayne@69 4828 * (e.g. of same array type)
jpayne@69 4829 */
jpayne@69 4830
jpayne@69 4831 /* function exit code */
jpayne@69 4832 __pyx_L1_error:;
jpayne@69 4833 __Pyx_AddTraceback("cpython.array.extend_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@69 4834 __pyx_r = -1;
jpayne@69 4835 __pyx_L0:;
jpayne@69 4836 return __pyx_r;
jpayne@69 4837 }
jpayne@69 4838
jpayne@69 4839 /* "array.pxd":166
jpayne@69 4840 * return 0
jpayne@69 4841 *
jpayne@69 4842 * cdef inline int extend(array self, array other) except -1: # <<<<<<<<<<<<<<
jpayne@69 4843 * """ extend array with data from another array; types must match. """
jpayne@69 4844 * if self.ob_descr.typecode != other.ob_descr.typecode:
jpayne@69 4845 */
jpayne@69 4846
jpayne@69 4847 static CYTHON_INLINE int __pyx_f_7cpython_5array_extend(arrayobject *__pyx_v_self, arrayobject *__pyx_v_other) {
jpayne@69 4848 int __pyx_r;
jpayne@69 4849 int __pyx_t_1;
jpayne@69 4850 int __pyx_t_2;
jpayne@69 4851 int __pyx_lineno = 0;
jpayne@69 4852 const char *__pyx_filename = NULL;
jpayne@69 4853 int __pyx_clineno = 0;
jpayne@69 4854
jpayne@69 4855 /* "array.pxd":168
jpayne@69 4856 * cdef inline int extend(array self, array other) except -1:
jpayne@69 4857 * """ extend array with data from another array; types must match. """
jpayne@69 4858 * if self.ob_descr.typecode != other.ob_descr.typecode: # <<<<<<<<<<<<<<
jpayne@69 4859 * PyErr_BadArgument()
jpayne@69 4860 * return extend_buffer(self, other.data.as_chars, Py_SIZE(other))
jpayne@69 4861 */
jpayne@69 4862 __pyx_t_1 = (__pyx_v_self->ob_descr->typecode != __pyx_v_other->ob_descr->typecode);
jpayne@69 4863 if (__pyx_t_1) {
jpayne@69 4864
jpayne@69 4865 /* "array.pxd":169
jpayne@69 4866 * """ extend array with data from another array; types must match. """
jpayne@69 4867 * if self.ob_descr.typecode != other.ob_descr.typecode:
jpayne@69 4868 * PyErr_BadArgument() # <<<<<<<<<<<<<<
jpayne@69 4869 * return extend_buffer(self, other.data.as_chars, Py_SIZE(other))
jpayne@69 4870 *
jpayne@69 4871 */
jpayne@69 4872 __pyx_t_2 = PyErr_BadArgument(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(2, 169, __pyx_L1_error)
jpayne@69 4873
jpayne@69 4874 /* "array.pxd":168
jpayne@69 4875 * cdef inline int extend(array self, array other) except -1:
jpayne@69 4876 * """ extend array with data from another array; types must match. """
jpayne@69 4877 * if self.ob_descr.typecode != other.ob_descr.typecode: # <<<<<<<<<<<<<<
jpayne@69 4878 * PyErr_BadArgument()
jpayne@69 4879 * return extend_buffer(self, other.data.as_chars, Py_SIZE(other))
jpayne@69 4880 */
jpayne@69 4881 }
jpayne@69 4882
jpayne@69 4883 /* "array.pxd":170
jpayne@69 4884 * if self.ob_descr.typecode != other.ob_descr.typecode:
jpayne@69 4885 * PyErr_BadArgument()
jpayne@69 4886 * return extend_buffer(self, other.data.as_chars, Py_SIZE(other)) # <<<<<<<<<<<<<<
jpayne@69 4887 *
jpayne@69 4888 * cdef inline void zero(array self) noexcept:
jpayne@69 4889 */
jpayne@69 4890 __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(2, 170, __pyx_L1_error)
jpayne@69 4891 __pyx_r = __pyx_t_2;
jpayne@69 4892 goto __pyx_L0;
jpayne@69 4893
jpayne@69 4894 /* "array.pxd":166
jpayne@69 4895 * return 0
jpayne@69 4896 *
jpayne@69 4897 * cdef inline int extend(array self, array other) except -1: # <<<<<<<<<<<<<<
jpayne@69 4898 * """ extend array with data from another array; types must match. """
jpayne@69 4899 * if self.ob_descr.typecode != other.ob_descr.typecode:
jpayne@69 4900 */
jpayne@69 4901
jpayne@69 4902 /* function exit code */
jpayne@69 4903 __pyx_L1_error:;
jpayne@69 4904 __Pyx_AddTraceback("cpython.array.extend", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@69 4905 __pyx_r = -1;
jpayne@69 4906 __pyx_L0:;
jpayne@69 4907 return __pyx_r;
jpayne@69 4908 }
jpayne@69 4909
jpayne@69 4910 /* "array.pxd":172
jpayne@69 4911 * return extend_buffer(self, other.data.as_chars, Py_SIZE(other))
jpayne@69 4912 *
jpayne@69 4913 * cdef inline void zero(array self) noexcept: # <<<<<<<<<<<<<<
jpayne@69 4914 * """ set all elements of array to zero. """
jpayne@69 4915 * memset(self.data.as_chars, 0, Py_SIZE(self) * self.ob_descr.itemsize)
jpayne@69 4916 */
jpayne@69 4917
jpayne@69 4918 static CYTHON_INLINE void __pyx_f_7cpython_5array_zero(arrayobject *__pyx_v_self) {
jpayne@69 4919
jpayne@69 4920 /* "array.pxd":174
jpayne@69 4921 * cdef inline void zero(array self) noexcept:
jpayne@69 4922 * """ set all elements of array to zero. """
jpayne@69 4923 * memset(self.data.as_chars, 0, Py_SIZE(self) * self.ob_descr.itemsize) # <<<<<<<<<<<<<<
jpayne@69 4924 */
jpayne@69 4925 (void)(memset(__pyx_v_self->data.as_chars, 0, (Py_SIZE(((PyObject *)__pyx_v_self)) * __pyx_v_self->ob_descr->itemsize)));
jpayne@69 4926
jpayne@69 4927 /* "array.pxd":172
jpayne@69 4928 * return extend_buffer(self, other.data.as_chars, Py_SIZE(other))
jpayne@69 4929 *
jpayne@69 4930 * cdef inline void zero(array self) noexcept: # <<<<<<<<<<<<<<
jpayne@69 4931 * """ set all elements of array to zero. """
jpayne@69 4932 * memset(self.data.as_chars, 0, Py_SIZE(self) * self.ob_descr.itemsize)
jpayne@69 4933 */
jpayne@69 4934
jpayne@69 4935 /* function exit code */
jpayne@69 4936 }
jpayne@69 4937
jpayne@69 4938 /* "pysam/libcutils.pyx":36
jpayne@69 4939 * #################################################################
jpayne@69 4940 * # Utility functions for quality string conversions
jpayne@69 4941 * cpdef c_array.array qualitystring_to_array(input_str, int offset=33): # <<<<<<<<<<<<<<
jpayne@69 4942 * """convert a qualitystring to an array of quality values."""
jpayne@69 4943 * if input_str is None:
jpayne@69 4944 */
jpayne@69 4945
jpayne@69 4946 static PyObject *__pyx_pw_5pysam_9libcutils_1qualitystring_to_array(PyObject *__pyx_self,
jpayne@69 4947 #if CYTHON_METH_FASTCALL
jpayne@69 4948 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
jpayne@69 4949 #else
jpayne@69 4950 PyObject *__pyx_args, PyObject *__pyx_kwds
jpayne@69 4951 #endif
jpayne@69 4952 ); /*proto*/
jpayne@69 4953 static arrayobject *__pyx_f_5pysam_9libcutils_qualitystring_to_array(PyObject *__pyx_v_input_str, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_5pysam_9libcutils_qualitystring_to_array *__pyx_optional_args) {
jpayne@69 4954 int __pyx_v_offset = ((int)33);
jpayne@69 4955 PyObject *__pyx_v_qs = NULL;
jpayne@69 4956 char __pyx_7genexpr__pyx_v_i;
jpayne@69 4957 arrayobject *__pyx_r = NULL;
jpayne@69 4958 __Pyx_RefNannyDeclarations
jpayne@69 4959 int __pyx_t_1;
jpayne@69 4960 PyObject *__pyx_t_2 = NULL;
jpayne@69 4961 PyObject *__pyx_t_3 = NULL;
jpayne@69 4962 char *__pyx_t_4;
jpayne@69 4963 char *__pyx_t_5;
jpayne@69 4964 char *__pyx_t_6;
jpayne@69 4965 char *__pyx_t_7;
jpayne@69 4966 PyObject *__pyx_t_8 = NULL;
jpayne@69 4967 int __pyx_lineno = 0;
jpayne@69 4968 const char *__pyx_filename = NULL;
jpayne@69 4969 int __pyx_clineno = 0;
jpayne@69 4970 __Pyx_RefNannySetupContext("qualitystring_to_array", 1);
jpayne@69 4971 if (__pyx_optional_args) {
jpayne@69 4972 if (__pyx_optional_args->__pyx_n > 0) {
jpayne@69 4973 __pyx_v_offset = __pyx_optional_args->offset;
jpayne@69 4974 }
jpayne@69 4975 }
jpayne@69 4976
jpayne@69 4977 /* "pysam/libcutils.pyx":38
jpayne@69 4978 * cpdef c_array.array qualitystring_to_array(input_str, int offset=33):
jpayne@69 4979 * """convert a qualitystring to an array of quality values."""
jpayne@69 4980 * if input_str is None: # <<<<<<<<<<<<<<
jpayne@69 4981 * return None
jpayne@69 4982 * qs = force_bytes(input_str)
jpayne@69 4983 */
jpayne@69 4984 __pyx_t_1 = (__pyx_v_input_str == Py_None);
jpayne@69 4985 if (__pyx_t_1) {
jpayne@69 4986
jpayne@69 4987 /* "pysam/libcutils.pyx":39
jpayne@69 4988 * """convert a qualitystring to an array of quality values."""
jpayne@69 4989 * if input_str is None:
jpayne@69 4990 * return None # <<<<<<<<<<<<<<
jpayne@69 4991 * qs = force_bytes(input_str)
jpayne@69 4992 * cdef char i
jpayne@69 4993 */
jpayne@69 4994 __Pyx_XDECREF((PyObject *)__pyx_r);
jpayne@69 4995 __pyx_r = ((arrayobject *)Py_None); __Pyx_INCREF(Py_None);
jpayne@69 4996 goto __pyx_L0;
jpayne@69 4997
jpayne@69 4998 /* "pysam/libcutils.pyx":38
jpayne@69 4999 * cpdef c_array.array qualitystring_to_array(input_str, int offset=33):
jpayne@69 5000 * """convert a qualitystring to an array of quality values."""
jpayne@69 5001 * if input_str is None: # <<<<<<<<<<<<<<
jpayne@69 5002 * return None
jpayne@69 5003 * qs = force_bytes(input_str)
jpayne@69 5004 */
jpayne@69 5005 }
jpayne@69 5006
jpayne@69 5007 /* "pysam/libcutils.pyx":40
jpayne@69 5008 * if input_str is None:
jpayne@69 5009 * return None
jpayne@69 5010 * qs = force_bytes(input_str) # <<<<<<<<<<<<<<
jpayne@69 5011 * cdef char i
jpayne@69 5012 * return c_array.array('B', [i - offset for i in qs])
jpayne@69 5013 */
jpayne@69 5014 __pyx_t_2 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_v_input_str, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 40, __pyx_L1_error)
jpayne@69 5015 __Pyx_GOTREF(__pyx_t_2);
jpayne@69 5016 __pyx_v_qs = ((PyObject*)__pyx_t_2);
jpayne@69 5017 __pyx_t_2 = 0;
jpayne@69 5018
jpayne@69 5019 /* "pysam/libcutils.pyx":42
jpayne@69 5020 * qs = force_bytes(input_str)
jpayne@69 5021 * cdef char i
jpayne@69 5022 * return c_array.array('B', [i - offset for i in qs]) # <<<<<<<<<<<<<<
jpayne@69 5023 *
jpayne@69 5024 *
jpayne@69 5025 */
jpayne@69 5026 __Pyx_XDECREF((PyObject *)__pyx_r);
jpayne@69 5027 { /* enter inner scope */
jpayne@69 5028 __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 42, __pyx_L1_error)
jpayne@69 5029 __Pyx_GOTREF(__pyx_t_2);
jpayne@69 5030 if (unlikely(__pyx_v_qs == Py_None)) {
jpayne@69 5031 PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable");
jpayne@69 5032 __PYX_ERR(0, 42, __pyx_L1_error)
jpayne@69 5033 }
jpayne@69 5034 __Pyx_INCREF(__pyx_v_qs);
jpayne@69 5035 __pyx_t_3 = __pyx_v_qs;
jpayne@69 5036 __pyx_t_5 = PyBytes_AS_STRING(__pyx_t_3);
jpayne@69 5037 __pyx_t_6 = (__pyx_t_5 + PyBytes_GET_SIZE(__pyx_t_3));
jpayne@69 5038 for (__pyx_t_7 = __pyx_t_5; __pyx_t_7 < __pyx_t_6; __pyx_t_7++) {
jpayne@69 5039 __pyx_t_4 = __pyx_t_7;
jpayne@69 5040 __pyx_7genexpr__pyx_v_i = (__pyx_t_4[0]);
jpayne@69 5041 __pyx_t_8 = __Pyx_PyInt_From_int((__pyx_7genexpr__pyx_v_i - __pyx_v_offset)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 42, __pyx_L1_error)
jpayne@69 5042 __Pyx_GOTREF(__pyx_t_8);
jpayne@69 5043 if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_8))) __PYX_ERR(0, 42, __pyx_L1_error)
jpayne@69 5044 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
jpayne@69 5045 }
jpayne@69 5046 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@69 5047 } /* exit inner scope */
jpayne@69 5048 __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 42, __pyx_L1_error)
jpayne@69 5049 __Pyx_GOTREF(__pyx_t_8);
jpayne@69 5050 __Pyx_INCREF(__pyx_n_u_B);
jpayne@69 5051 __Pyx_GIVEREF(__pyx_n_u_B);
jpayne@69 5052 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_n_u_B)) __PYX_ERR(0, 42, __pyx_L1_error);
jpayne@69 5053 __Pyx_GIVEREF(__pyx_t_2);
jpayne@69 5054 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_2)) __PYX_ERR(0, 42, __pyx_L1_error);
jpayne@69 5055 __pyx_t_2 = 0;
jpayne@69 5056 __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_7cpython_5array_array), __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 42, __pyx_L1_error)
jpayne@69 5057 __Pyx_GOTREF(__pyx_t_2);
jpayne@69 5058 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
jpayne@69 5059 __pyx_r = ((arrayobject *)__pyx_t_2);
jpayne@69 5060 __pyx_t_2 = 0;
jpayne@69 5061 goto __pyx_L0;
jpayne@69 5062
jpayne@69 5063 /* "pysam/libcutils.pyx":36
jpayne@69 5064 * #################################################################
jpayne@69 5065 * # Utility functions for quality string conversions
jpayne@69 5066 * cpdef c_array.array qualitystring_to_array(input_str, int offset=33): # <<<<<<<<<<<<<<
jpayne@69 5067 * """convert a qualitystring to an array of quality values."""
jpayne@69 5068 * if input_str is None:
jpayne@69 5069 */
jpayne@69 5070
jpayne@69 5071 /* function exit code */
jpayne@69 5072 __pyx_L1_error:;
jpayne@69 5073 __Pyx_XDECREF(__pyx_t_2);
jpayne@69 5074 __Pyx_XDECREF(__pyx_t_3);
jpayne@69 5075 __Pyx_XDECREF(__pyx_t_8);
jpayne@69 5076 __Pyx_AddTraceback("pysam.libcutils.qualitystring_to_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@69 5077 __pyx_r = 0;
jpayne@69 5078 __pyx_L0:;
jpayne@69 5079 __Pyx_XDECREF(__pyx_v_qs);
jpayne@69 5080 __Pyx_XGIVEREF((PyObject *)__pyx_r);
jpayne@69 5081 __Pyx_RefNannyFinishContext();
jpayne@69 5082 return __pyx_r;
jpayne@69 5083 }
jpayne@69 5084
jpayne@69 5085 /* Python wrapper */
jpayne@69 5086 static PyObject *__pyx_pw_5pysam_9libcutils_1qualitystring_to_array(PyObject *__pyx_self,
jpayne@69 5087 #if CYTHON_METH_FASTCALL
jpayne@69 5088 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
jpayne@69 5089 #else
jpayne@69 5090 PyObject *__pyx_args, PyObject *__pyx_kwds
jpayne@69 5091 #endif
jpayne@69 5092 ); /*proto*/
jpayne@69 5093 PyDoc_STRVAR(__pyx_doc_5pysam_9libcutils_qualitystring_to_array, "convert a qualitystring to an array of quality values.");
jpayne@69 5094 static PyMethodDef __pyx_mdef_5pysam_9libcutils_1qualitystring_to_array = {"qualitystring_to_array", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_9libcutils_1qualitystring_to_array, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_9libcutils_qualitystring_to_array};
jpayne@69 5095 static PyObject *__pyx_pw_5pysam_9libcutils_1qualitystring_to_array(PyObject *__pyx_self,
jpayne@69 5096 #if CYTHON_METH_FASTCALL
jpayne@69 5097 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
jpayne@69 5098 #else
jpayne@69 5099 PyObject *__pyx_args, PyObject *__pyx_kwds
jpayne@69 5100 #endif
jpayne@69 5101 ) {
jpayne@69 5102 PyObject *__pyx_v_input_str = 0;
jpayne@69 5103 int __pyx_v_offset;
jpayne@69 5104 #if !CYTHON_METH_FASTCALL
jpayne@69 5105 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
jpayne@69 5106 #endif
jpayne@69 5107 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
jpayne@69 5108 PyObject* values[2] = {0,0};
jpayne@69 5109 int __pyx_lineno = 0;
jpayne@69 5110 const char *__pyx_filename = NULL;
jpayne@69 5111 int __pyx_clineno = 0;
jpayne@69 5112 PyObject *__pyx_r = 0;
jpayne@69 5113 __Pyx_RefNannyDeclarations
jpayne@69 5114 __Pyx_RefNannySetupContext("qualitystring_to_array (wrapper)", 0);
jpayne@69 5115 #if !CYTHON_METH_FASTCALL
jpayne@69 5116 #if CYTHON_ASSUME_SAFE_MACROS
jpayne@69 5117 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
jpayne@69 5118 #else
jpayne@69 5119 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
jpayne@69 5120 #endif
jpayne@69 5121 #endif
jpayne@69 5122 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
jpayne@69 5123 {
jpayne@69 5124 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_input_str,&__pyx_n_s_offset,0};
jpayne@69 5125 if (__pyx_kwds) {
jpayne@69 5126 Py_ssize_t kw_args;
jpayne@69 5127 switch (__pyx_nargs) {
jpayne@69 5128 case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
jpayne@69 5129 CYTHON_FALLTHROUGH;
jpayne@69 5130 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
jpayne@69 5131 CYTHON_FALLTHROUGH;
jpayne@69 5132 case 0: break;
jpayne@69 5133 default: goto __pyx_L5_argtuple_error;
jpayne@69 5134 }
jpayne@69 5135 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
jpayne@69 5136 switch (__pyx_nargs) {
jpayne@69 5137 case 0:
jpayne@69 5138 if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_input_str)) != 0)) {
jpayne@69 5139 (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
jpayne@69 5140 kw_args--;
jpayne@69 5141 }
jpayne@69 5142 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 36, __pyx_L3_error)
jpayne@69 5143 else goto __pyx_L5_argtuple_error;
jpayne@69 5144 CYTHON_FALLTHROUGH;
jpayne@69 5145 case 1:
jpayne@69 5146 if (kw_args > 0) {
jpayne@69 5147 PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_offset);
jpayne@69 5148 if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
jpayne@69 5149 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 36, __pyx_L3_error)
jpayne@69 5150 }
jpayne@69 5151 }
jpayne@69 5152 if (unlikely(kw_args > 0)) {
jpayne@69 5153 const Py_ssize_t kwd_pos_args = __pyx_nargs;
jpayne@69 5154 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "qualitystring_to_array") < 0)) __PYX_ERR(0, 36, __pyx_L3_error)
jpayne@69 5155 }
jpayne@69 5156 } else {
jpayne@69 5157 switch (__pyx_nargs) {
jpayne@69 5158 case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
jpayne@69 5159 CYTHON_FALLTHROUGH;
jpayne@69 5160 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
jpayne@69 5161 break;
jpayne@69 5162 default: goto __pyx_L5_argtuple_error;
jpayne@69 5163 }
jpayne@69 5164 }
jpayne@69 5165 __pyx_v_input_str = values[0];
jpayne@69 5166 if (values[1]) {
jpayne@69 5167 __pyx_v_offset = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_offset == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 36, __pyx_L3_error)
jpayne@69 5168 } else {
jpayne@69 5169 __pyx_v_offset = ((int)33);
jpayne@69 5170 }
jpayne@69 5171 }
jpayne@69 5172 goto __pyx_L6_skip;
jpayne@69 5173 __pyx_L5_argtuple_error:;
jpayne@69 5174 __Pyx_RaiseArgtupleInvalid("qualitystring_to_array", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 36, __pyx_L3_error)
jpayne@69 5175 __pyx_L6_skip:;
jpayne@69 5176 goto __pyx_L4_argument_unpacking_done;
jpayne@69 5177 __pyx_L3_error:;
jpayne@69 5178 {
jpayne@69 5179 Py_ssize_t __pyx_temp;
jpayne@69 5180 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
jpayne@69 5181 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
jpayne@69 5182 }
jpayne@69 5183 }
jpayne@69 5184 __Pyx_AddTraceback("pysam.libcutils.qualitystring_to_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@69 5185 __Pyx_RefNannyFinishContext();
jpayne@69 5186 return NULL;
jpayne@69 5187 __pyx_L4_argument_unpacking_done:;
jpayne@69 5188 __pyx_r = __pyx_pf_5pysam_9libcutils_qualitystring_to_array(__pyx_self, __pyx_v_input_str, __pyx_v_offset);
jpayne@69 5189
jpayne@69 5190 /* function exit code */
jpayne@69 5191 {
jpayne@69 5192 Py_ssize_t __pyx_temp;
jpayne@69 5193 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
jpayne@69 5194 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
jpayne@69 5195 }
jpayne@69 5196 }
jpayne@69 5197 __Pyx_RefNannyFinishContext();
jpayne@69 5198 return __pyx_r;
jpayne@69 5199 }
jpayne@69 5200
jpayne@69 5201 static PyObject *__pyx_pf_5pysam_9libcutils_qualitystring_to_array(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_input_str, int __pyx_v_offset) {
jpayne@69 5202 PyObject *__pyx_r = NULL;
jpayne@69 5203 __Pyx_RefNannyDeclarations
jpayne@69 5204 PyObject *__pyx_t_1 = NULL;
jpayne@69 5205 struct __pyx_opt_args_5pysam_9libcutils_qualitystring_to_array __pyx_t_2;
jpayne@69 5206 int __pyx_lineno = 0;
jpayne@69 5207 const char *__pyx_filename = NULL;
jpayne@69 5208 int __pyx_clineno = 0;
jpayne@69 5209 __Pyx_RefNannySetupContext("qualitystring_to_array", 1);
jpayne@69 5210 __Pyx_XDECREF(__pyx_r);
jpayne@69 5211 __pyx_t_2.__pyx_n = 1;
jpayne@69 5212 __pyx_t_2.offset = __pyx_v_offset;
jpayne@69 5213 __pyx_t_1 = ((PyObject *)__pyx_f_5pysam_9libcutils_qualitystring_to_array(__pyx_v_input_str, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 36, __pyx_L1_error)
jpayne@69 5214 __Pyx_GOTREF(__pyx_t_1);
jpayne@69 5215 __pyx_r = __pyx_t_1;
jpayne@69 5216 __pyx_t_1 = 0;
jpayne@69 5217 goto __pyx_L0;
jpayne@69 5218
jpayne@69 5219 /* function exit code */
jpayne@69 5220 __pyx_L1_error:;
jpayne@69 5221 __Pyx_XDECREF(__pyx_t_1);
jpayne@69 5222 __Pyx_AddTraceback("pysam.libcutils.qualitystring_to_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@69 5223 __pyx_r = NULL;
jpayne@69 5224 __pyx_L0:;
jpayne@69 5225 __Pyx_XGIVEREF(__pyx_r);
jpayne@69 5226 __Pyx_RefNannyFinishContext();
jpayne@69 5227 return __pyx_r;
jpayne@69 5228 }
jpayne@69 5229
jpayne@69 5230 /* "pysam/libcutils.pyx":45
jpayne@69 5231 *
jpayne@69 5232 *
jpayne@69 5233 * cpdef array_to_qualitystring(c_array.array qualities, int offset=33): # <<<<<<<<<<<<<<
jpayne@69 5234 * """convert an array of quality values to a string."""
jpayne@69 5235 * if qualities is None:
jpayne@69 5236 */
jpayne@69 5237
jpayne@69 5238 static PyObject *__pyx_pw_5pysam_9libcutils_3array_to_qualitystring(PyObject *__pyx_self,
jpayne@69 5239 #if CYTHON_METH_FASTCALL
jpayne@69 5240 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
jpayne@69 5241 #else
jpayne@69 5242 PyObject *__pyx_args, PyObject *__pyx_kwds
jpayne@69 5243 #endif
jpayne@69 5244 ); /*proto*/
jpayne@69 5245 static PyObject *__pyx_f_5pysam_9libcutils_array_to_qualitystring(arrayobject *__pyx_v_qualities, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_5pysam_9libcutils_array_to_qualitystring *__pyx_optional_args) {
jpayne@69 5246 int __pyx_v_offset = ((int)33);
jpayne@69 5247 int __pyx_v_x;
jpayne@69 5248 arrayobject *__pyx_v_result = 0;
jpayne@69 5249 PyObject *__pyx_r = NULL;
jpayne@69 5250 __Pyx_RefNannyDeclarations
jpayne@69 5251 int __pyx_t_1;
jpayne@69 5252 Py_ssize_t __pyx_t_2;
jpayne@69 5253 PyObject *__pyx_t_3 = NULL;
jpayne@69 5254 PyObject *__pyx_t_4 = NULL;
jpayne@69 5255 PyObject *__pyx_t_5 = NULL;
jpayne@69 5256 unsigned int __pyx_t_6;
jpayne@69 5257 int __pyx_lineno = 0;
jpayne@69 5258 const char *__pyx_filename = NULL;
jpayne@69 5259 int __pyx_clineno = 0;
jpayne@69 5260 __Pyx_RefNannySetupContext("array_to_qualitystring", 1);
jpayne@69 5261 if (__pyx_optional_args) {
jpayne@69 5262 if (__pyx_optional_args->__pyx_n > 0) {
jpayne@69 5263 __pyx_v_offset = __pyx_optional_args->offset;
jpayne@69 5264 }
jpayne@69 5265 }
jpayne@69 5266
jpayne@69 5267 /* "pysam/libcutils.pyx":47
jpayne@69 5268 * cpdef array_to_qualitystring(c_array.array qualities, int offset=33):
jpayne@69 5269 * """convert an array of quality values to a string."""
jpayne@69 5270 * if qualities is None: # <<<<<<<<<<<<<<
jpayne@69 5271 * return None
jpayne@69 5272 * cdef int x
jpayne@69 5273 */
jpayne@69 5274 __pyx_t_1 = (((PyObject *)__pyx_v_qualities) == Py_None);
jpayne@69 5275 if (__pyx_t_1) {
jpayne@69 5276
jpayne@69 5277 /* "pysam/libcutils.pyx":48
jpayne@69 5278 * """convert an array of quality values to a string."""
jpayne@69 5279 * if qualities is None:
jpayne@69 5280 * return None # <<<<<<<<<<<<<<
jpayne@69 5281 * cdef int x
jpayne@69 5282 *
jpayne@69 5283 */
jpayne@69 5284 __Pyx_XDECREF(__pyx_r);
jpayne@69 5285 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
jpayne@69 5286 goto __pyx_L0;
jpayne@69 5287
jpayne@69 5288 /* "pysam/libcutils.pyx":47
jpayne@69 5289 * cpdef array_to_qualitystring(c_array.array qualities, int offset=33):
jpayne@69 5290 * """convert an array of quality values to a string."""
jpayne@69 5291 * if qualities is None: # <<<<<<<<<<<<<<
jpayne@69 5292 * return None
jpayne@69 5293 * cdef int x
jpayne@69 5294 */
jpayne@69 5295 }
jpayne@69 5296
jpayne@69 5297 /* "pysam/libcutils.pyx":52
jpayne@69 5298 *
jpayne@69 5299 * cdef c_array.array result
jpayne@69 5300 * result = c_array.clone(qualities, len(qualities), zero=False) # <<<<<<<<<<<<<<
jpayne@69 5301 *
jpayne@69 5302 * for x from 0 <= x < len(qualities):
jpayne@69 5303 */
jpayne@69 5304 if (unlikely(((PyObject *)__pyx_v_qualities) == Py_None)) {
jpayne@69 5305 PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
jpayne@69 5306 __PYX_ERR(0, 52, __pyx_L1_error)
jpayne@69 5307 }
jpayne@69 5308 __pyx_t_2 = Py_SIZE(((PyObject *)__pyx_v_qualities)); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 52, __pyx_L1_error)
jpayne@69 5309 __pyx_t_3 = ((PyObject *)__pyx_f_7cpython_5array_clone(__pyx_v_qualities, __pyx_t_2, 0)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 52, __pyx_L1_error)
jpayne@69 5310 __Pyx_GOTREF(__pyx_t_3);
jpayne@69 5311 __pyx_v_result = ((arrayobject *)__pyx_t_3);
jpayne@69 5312 __pyx_t_3 = 0;
jpayne@69 5313
jpayne@69 5314 /* "pysam/libcutils.pyx":54
jpayne@69 5315 * result = c_array.clone(qualities, len(qualities), zero=False)
jpayne@69 5316 *
jpayne@69 5317 * for x from 0 <= x < len(qualities): # <<<<<<<<<<<<<<
jpayne@69 5318 * result[x] = qualities[x] + offset
jpayne@69 5319 * return force_str(result.tobytes())
jpayne@69 5320 */
jpayne@69 5321 if (unlikely(((PyObject *)__pyx_v_qualities) == Py_None)) {
jpayne@69 5322 PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
jpayne@69 5323 __PYX_ERR(0, 54, __pyx_L1_error)
jpayne@69 5324 }
jpayne@69 5325 __pyx_t_2 = Py_SIZE(((PyObject *)__pyx_v_qualities)); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 54, __pyx_L1_error)
jpayne@69 5326 for (__pyx_v_x = 0; __pyx_v_x < __pyx_t_2; __pyx_v_x++) {
jpayne@69 5327
jpayne@69 5328 /* "pysam/libcutils.pyx":55
jpayne@69 5329 *
jpayne@69 5330 * for x from 0 <= x < len(qualities):
jpayne@69 5331 * result[x] = qualities[x] + offset # <<<<<<<<<<<<<<
jpayne@69 5332 * return force_str(result.tobytes())
jpayne@69 5333 *
jpayne@69 5334 */
jpayne@69 5335 __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_qualities), __pyx_v_x, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 55, __pyx_L1_error)
jpayne@69 5336 __Pyx_GOTREF(__pyx_t_3);
jpayne@69 5337 __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_offset); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 55, __pyx_L1_error)
jpayne@69 5338 __Pyx_GOTREF(__pyx_t_4);
jpayne@69 5339 __pyx_t_5 = PyNumber_Add(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 55, __pyx_L1_error)
jpayne@69 5340 __Pyx_GOTREF(__pyx_t_5);
jpayne@69 5341 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@69 5342 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
jpayne@69 5343 if (unlikely((__Pyx_SetItemInt(((PyObject *)__pyx_v_result), __pyx_v_x, __pyx_t_5, int, 1, __Pyx_PyInt_From_int, 0, 1, 1) < 0))) __PYX_ERR(0, 55, __pyx_L1_error)
jpayne@69 5344 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
jpayne@69 5345 }
jpayne@69 5346
jpayne@69 5347 /* "pysam/libcutils.pyx":56
jpayne@69 5348 * for x from 0 <= x < len(qualities):
jpayne@69 5349 * result[x] = qualities[x] + offset
jpayne@69 5350 * return force_str(result.tobytes()) # <<<<<<<<<<<<<<
jpayne@69 5351 *
jpayne@69 5352 *
jpayne@69 5353 */
jpayne@69 5354 __Pyx_XDECREF(__pyx_r);
jpayne@69 5355 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_result), __pyx_n_s_tobytes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 56, __pyx_L1_error)
jpayne@69 5356 __Pyx_GOTREF(__pyx_t_4);
jpayne@69 5357 __pyx_t_3 = NULL;
jpayne@69 5358 __pyx_t_6 = 0;
jpayne@69 5359 #if CYTHON_UNPACK_METHODS
jpayne@69 5360 if (likely(PyMethod_Check(__pyx_t_4))) {
jpayne@69 5361 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
jpayne@69 5362 if (likely(__pyx_t_3)) {
jpayne@69 5363 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
jpayne@69 5364 __Pyx_INCREF(__pyx_t_3);
jpayne@69 5365 __Pyx_INCREF(function);
jpayne@69 5366 __Pyx_DECREF_SET(__pyx_t_4, function);
jpayne@69 5367 __pyx_t_6 = 1;
jpayne@69 5368 }
jpayne@69 5369 }
jpayne@69 5370 #endif
jpayne@69 5371 {
jpayne@69 5372 PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
jpayne@69 5373 __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 0+__pyx_t_6);
jpayne@69 5374 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@69 5375 if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 56, __pyx_L1_error)
jpayne@69 5376 __Pyx_GOTREF(__pyx_t_5);
jpayne@69 5377 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
jpayne@69 5378 }
jpayne@69 5379 __pyx_t_4 = __pyx_f_5pysam_9libcutils_force_str(__pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 56, __pyx_L1_error)
jpayne@69 5380 __Pyx_GOTREF(__pyx_t_4);
jpayne@69 5381 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
jpayne@69 5382 __pyx_r = __pyx_t_4;
jpayne@69 5383 __pyx_t_4 = 0;
jpayne@69 5384 goto __pyx_L0;
jpayne@69 5385
jpayne@69 5386 /* "pysam/libcutils.pyx":45
jpayne@69 5387 *
jpayne@69 5388 *
jpayne@69 5389 * cpdef array_to_qualitystring(c_array.array qualities, int offset=33): # <<<<<<<<<<<<<<
jpayne@69 5390 * """convert an array of quality values to a string."""
jpayne@69 5391 * if qualities is None:
jpayne@69 5392 */
jpayne@69 5393
jpayne@69 5394 /* function exit code */
jpayne@69 5395 __pyx_L1_error:;
jpayne@69 5396 __Pyx_XDECREF(__pyx_t_3);
jpayne@69 5397 __Pyx_XDECREF(__pyx_t_4);
jpayne@69 5398 __Pyx_XDECREF(__pyx_t_5);
jpayne@69 5399 __Pyx_AddTraceback("pysam.libcutils.array_to_qualitystring", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@69 5400 __pyx_r = 0;
jpayne@69 5401 __pyx_L0:;
jpayne@69 5402 __Pyx_XDECREF((PyObject *)__pyx_v_result);
jpayne@69 5403 __Pyx_XGIVEREF(__pyx_r);
jpayne@69 5404 __Pyx_RefNannyFinishContext();
jpayne@69 5405 return __pyx_r;
jpayne@69 5406 }
jpayne@69 5407
jpayne@69 5408 /* Python wrapper */
jpayne@69 5409 static PyObject *__pyx_pw_5pysam_9libcutils_3array_to_qualitystring(PyObject *__pyx_self,
jpayne@69 5410 #if CYTHON_METH_FASTCALL
jpayne@69 5411 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
jpayne@69 5412 #else
jpayne@69 5413 PyObject *__pyx_args, PyObject *__pyx_kwds
jpayne@69 5414 #endif
jpayne@69 5415 ); /*proto*/
jpayne@69 5416 PyDoc_STRVAR(__pyx_doc_5pysam_9libcutils_2array_to_qualitystring, "convert an array of quality values to a string.");
jpayne@69 5417 static PyMethodDef __pyx_mdef_5pysam_9libcutils_3array_to_qualitystring = {"array_to_qualitystring", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_9libcutils_3array_to_qualitystring, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_9libcutils_2array_to_qualitystring};
jpayne@69 5418 static PyObject *__pyx_pw_5pysam_9libcutils_3array_to_qualitystring(PyObject *__pyx_self,
jpayne@69 5419 #if CYTHON_METH_FASTCALL
jpayne@69 5420 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
jpayne@69 5421 #else
jpayne@69 5422 PyObject *__pyx_args, PyObject *__pyx_kwds
jpayne@69 5423 #endif
jpayne@69 5424 ) {
jpayne@69 5425 arrayobject *__pyx_v_qualities = 0;
jpayne@69 5426 int __pyx_v_offset;
jpayne@69 5427 #if !CYTHON_METH_FASTCALL
jpayne@69 5428 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
jpayne@69 5429 #endif
jpayne@69 5430 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
jpayne@69 5431 PyObject* values[2] = {0,0};
jpayne@69 5432 int __pyx_lineno = 0;
jpayne@69 5433 const char *__pyx_filename = NULL;
jpayne@69 5434 int __pyx_clineno = 0;
jpayne@69 5435 PyObject *__pyx_r = 0;
jpayne@69 5436 __Pyx_RefNannyDeclarations
jpayne@69 5437 __Pyx_RefNannySetupContext("array_to_qualitystring (wrapper)", 0);
jpayne@69 5438 #if !CYTHON_METH_FASTCALL
jpayne@69 5439 #if CYTHON_ASSUME_SAFE_MACROS
jpayne@69 5440 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
jpayne@69 5441 #else
jpayne@69 5442 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
jpayne@69 5443 #endif
jpayne@69 5444 #endif
jpayne@69 5445 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
jpayne@69 5446 {
jpayne@69 5447 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_qualities,&__pyx_n_s_offset,0};
jpayne@69 5448 if (__pyx_kwds) {
jpayne@69 5449 Py_ssize_t kw_args;
jpayne@69 5450 switch (__pyx_nargs) {
jpayne@69 5451 case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
jpayne@69 5452 CYTHON_FALLTHROUGH;
jpayne@69 5453 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
jpayne@69 5454 CYTHON_FALLTHROUGH;
jpayne@69 5455 case 0: break;
jpayne@69 5456 default: goto __pyx_L5_argtuple_error;
jpayne@69 5457 }
jpayne@69 5458 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
jpayne@69 5459 switch (__pyx_nargs) {
jpayne@69 5460 case 0:
jpayne@69 5461 if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_qualities)) != 0)) {
jpayne@69 5462 (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
jpayne@69 5463 kw_args--;
jpayne@69 5464 }
jpayne@69 5465 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 45, __pyx_L3_error)
jpayne@69 5466 else goto __pyx_L5_argtuple_error;
jpayne@69 5467 CYTHON_FALLTHROUGH;
jpayne@69 5468 case 1:
jpayne@69 5469 if (kw_args > 0) {
jpayne@69 5470 PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_offset);
jpayne@69 5471 if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
jpayne@69 5472 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 45, __pyx_L3_error)
jpayne@69 5473 }
jpayne@69 5474 }
jpayne@69 5475 if (unlikely(kw_args > 0)) {
jpayne@69 5476 const Py_ssize_t kwd_pos_args = __pyx_nargs;
jpayne@69 5477 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "array_to_qualitystring") < 0)) __PYX_ERR(0, 45, __pyx_L3_error)
jpayne@69 5478 }
jpayne@69 5479 } else {
jpayne@69 5480 switch (__pyx_nargs) {
jpayne@69 5481 case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
jpayne@69 5482 CYTHON_FALLTHROUGH;
jpayne@69 5483 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
jpayne@69 5484 break;
jpayne@69 5485 default: goto __pyx_L5_argtuple_error;
jpayne@69 5486 }
jpayne@69 5487 }
jpayne@69 5488 __pyx_v_qualities = ((arrayobject *)values[0]);
jpayne@69 5489 if (values[1]) {
jpayne@69 5490 __pyx_v_offset = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_offset == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 45, __pyx_L3_error)
jpayne@69 5491 } else {
jpayne@69 5492 __pyx_v_offset = ((int)33);
jpayne@69 5493 }
jpayne@69 5494 }
jpayne@69 5495 goto __pyx_L6_skip;
jpayne@69 5496 __pyx_L5_argtuple_error:;
jpayne@69 5497 __Pyx_RaiseArgtupleInvalid("array_to_qualitystring", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 45, __pyx_L3_error)
jpayne@69 5498 __pyx_L6_skip:;
jpayne@69 5499 goto __pyx_L4_argument_unpacking_done;
jpayne@69 5500 __pyx_L3_error:;
jpayne@69 5501 {
jpayne@69 5502 Py_ssize_t __pyx_temp;
jpayne@69 5503 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
jpayne@69 5504 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
jpayne@69 5505 }
jpayne@69 5506 }
jpayne@69 5507 __Pyx_AddTraceback("pysam.libcutils.array_to_qualitystring", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@69 5508 __Pyx_RefNannyFinishContext();
jpayne@69 5509 return NULL;
jpayne@69 5510 __pyx_L4_argument_unpacking_done:;
jpayne@69 5511 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_qualities), __pyx_ptype_7cpython_5array_array, 1, "qualities", 0))) __PYX_ERR(0, 45, __pyx_L1_error)
jpayne@69 5512 __pyx_r = __pyx_pf_5pysam_9libcutils_2array_to_qualitystring(__pyx_self, __pyx_v_qualities, __pyx_v_offset);
jpayne@69 5513
jpayne@69 5514 /* function exit code */
jpayne@69 5515 goto __pyx_L0;
jpayne@69 5516 __pyx_L1_error:;
jpayne@69 5517 __pyx_r = NULL;
jpayne@69 5518 __pyx_L0:;
jpayne@69 5519 {
jpayne@69 5520 Py_ssize_t __pyx_temp;
jpayne@69 5521 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
jpayne@69 5522 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
jpayne@69 5523 }
jpayne@69 5524 }
jpayne@69 5525 __Pyx_RefNannyFinishContext();
jpayne@69 5526 return __pyx_r;
jpayne@69 5527 }
jpayne@69 5528
jpayne@69 5529 static PyObject *__pyx_pf_5pysam_9libcutils_2array_to_qualitystring(CYTHON_UNUSED PyObject *__pyx_self, arrayobject *__pyx_v_qualities, int __pyx_v_offset) {
jpayne@69 5530 PyObject *__pyx_r = NULL;
jpayne@69 5531 __Pyx_RefNannyDeclarations
jpayne@69 5532 PyObject *__pyx_t_1 = NULL;
jpayne@69 5533 struct __pyx_opt_args_5pysam_9libcutils_array_to_qualitystring __pyx_t_2;
jpayne@69 5534 int __pyx_lineno = 0;
jpayne@69 5535 const char *__pyx_filename = NULL;
jpayne@69 5536 int __pyx_clineno = 0;
jpayne@69 5537 __Pyx_RefNannySetupContext("array_to_qualitystring", 1);
jpayne@69 5538 __Pyx_XDECREF(__pyx_r);
jpayne@69 5539 __pyx_t_2.__pyx_n = 1;
jpayne@69 5540 __pyx_t_2.offset = __pyx_v_offset;
jpayne@69 5541 __pyx_t_1 = __pyx_f_5pysam_9libcutils_array_to_qualitystring(__pyx_v_qualities, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error)
jpayne@69 5542 __Pyx_GOTREF(__pyx_t_1);
jpayne@69 5543 __pyx_r = __pyx_t_1;
jpayne@69 5544 __pyx_t_1 = 0;
jpayne@69 5545 goto __pyx_L0;
jpayne@69 5546
jpayne@69 5547 /* function exit code */
jpayne@69 5548 __pyx_L1_error:;
jpayne@69 5549 __Pyx_XDECREF(__pyx_t_1);
jpayne@69 5550 __Pyx_AddTraceback("pysam.libcutils.array_to_qualitystring", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@69 5551 __pyx_r = NULL;
jpayne@69 5552 __pyx_L0:;
jpayne@69 5553 __Pyx_XGIVEREF(__pyx_r);
jpayne@69 5554 __Pyx_RefNannyFinishContext();
jpayne@69 5555 return __pyx_r;
jpayne@69 5556 }
jpayne@69 5557
jpayne@69 5558 /* "pysam/libcutils.pyx":59
jpayne@69 5559 *
jpayne@69 5560 *
jpayne@69 5561 * cpdef qualities_to_qualitystring(qualities, int offset=33): # <<<<<<<<<<<<<<
jpayne@69 5562 * """convert a list or array of quality scores to the string
jpayne@69 5563 * representation used in the SAM format.
jpayne@69 5564 */
jpayne@69 5565
jpayne@69 5566 static PyObject *__pyx_pw_5pysam_9libcutils_5qualities_to_qualitystring(PyObject *__pyx_self,
jpayne@69 5567 #if CYTHON_METH_FASTCALL
jpayne@69 5568 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
jpayne@69 5569 #else
jpayne@69 5570 PyObject *__pyx_args, PyObject *__pyx_kwds
jpayne@69 5571 #endif
jpayne@69 5572 ); /*proto*/
jpayne@69 5573 static PyObject *__pyx_f_5pysam_9libcutils_qualities_to_qualitystring(PyObject *__pyx_v_qualities, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_5pysam_9libcutils_qualities_to_qualitystring *__pyx_optional_args) {
jpayne@69 5574 int __pyx_v_offset = ((int)33);
jpayne@69 5575 char __pyx_8genexpr1__pyx_v_x;
jpayne@69 5576 PyObject *__pyx_r = NULL;
jpayne@69 5577 __Pyx_RefNannyDeclarations
jpayne@69 5578 int __pyx_t_1;
jpayne@69 5579 PyObject *__pyx_t_2 = NULL;
jpayne@69 5580 struct __pyx_opt_args_5pysam_9libcutils_array_to_qualitystring __pyx_t_3;
jpayne@69 5581 PyObject *__pyx_t_4 = NULL;
jpayne@69 5582 Py_ssize_t __pyx_t_5;
jpayne@69 5583 PyObject *(*__pyx_t_6)(PyObject *);
jpayne@69 5584 PyObject *__pyx_t_7 = NULL;
jpayne@69 5585 char __pyx_t_8;
jpayne@69 5586 PyObject *__pyx_t_9 = NULL;
jpayne@69 5587 int __pyx_lineno = 0;
jpayne@69 5588 const char *__pyx_filename = NULL;
jpayne@69 5589 int __pyx_clineno = 0;
jpayne@69 5590 __Pyx_RefNannySetupContext("qualities_to_qualitystring", 1);
jpayne@69 5591 if (__pyx_optional_args) {
jpayne@69 5592 if (__pyx_optional_args->__pyx_n > 0) {
jpayne@69 5593 __pyx_v_offset = __pyx_optional_args->offset;
jpayne@69 5594 }
jpayne@69 5595 }
jpayne@69 5596
jpayne@69 5597 /* "pysam/libcutils.pyx":76
jpayne@69 5598 * """
jpayne@69 5599 * cdef char x
jpayne@69 5600 * if qualities is None: # <<<<<<<<<<<<<<
jpayne@69 5601 * return None
jpayne@69 5602 * elif isinstance(qualities, c_array.array):
jpayne@69 5603 */
jpayne@69 5604 __pyx_t_1 = (__pyx_v_qualities == Py_None);
jpayne@69 5605 if (__pyx_t_1) {
jpayne@69 5606
jpayne@69 5607 /* "pysam/libcutils.pyx":77
jpayne@69 5608 * cdef char x
jpayne@69 5609 * if qualities is None:
jpayne@69 5610 * return None # <<<<<<<<<<<<<<
jpayne@69 5611 * elif isinstance(qualities, c_array.array):
jpayne@69 5612 * return array_to_qualitystring(qualities, offset=offset)
jpayne@69 5613 */
jpayne@69 5614 __Pyx_XDECREF(__pyx_r);
jpayne@69 5615 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
jpayne@69 5616 goto __pyx_L0;
jpayne@69 5617
jpayne@69 5618 /* "pysam/libcutils.pyx":76
jpayne@69 5619 * """
jpayne@69 5620 * cdef char x
jpayne@69 5621 * if qualities is None: # <<<<<<<<<<<<<<
jpayne@69 5622 * return None
jpayne@69 5623 * elif isinstance(qualities, c_array.array):
jpayne@69 5624 */
jpayne@69 5625 }
jpayne@69 5626
jpayne@69 5627 /* "pysam/libcutils.pyx":78
jpayne@69 5628 * if qualities is None:
jpayne@69 5629 * return None
jpayne@69 5630 * elif isinstance(qualities, c_array.array): # <<<<<<<<<<<<<<
jpayne@69 5631 * return array_to_qualitystring(qualities, offset=offset)
jpayne@69 5632 * else:
jpayne@69 5633 */
jpayne@69 5634 __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_qualities, __pyx_ptype_7cpython_5array_array);
jpayne@69 5635 if (__pyx_t_1) {
jpayne@69 5636
jpayne@69 5637 /* "pysam/libcutils.pyx":79
jpayne@69 5638 * return None
jpayne@69 5639 * elif isinstance(qualities, c_array.array):
jpayne@69 5640 * return array_to_qualitystring(qualities, offset=offset) # <<<<<<<<<<<<<<
jpayne@69 5641 * else:
jpayne@69 5642 * # tuples and lists
jpayne@69 5643 */
jpayne@69 5644 __Pyx_XDECREF(__pyx_r);
jpayne@69 5645 if (!(likely(((__pyx_v_qualities) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_qualities, __pyx_ptype_7cpython_5array_array))))) __PYX_ERR(0, 79, __pyx_L1_error)
jpayne@69 5646 __pyx_t_3.__pyx_n = 1;
jpayne@69 5647 __pyx_t_3.offset = __pyx_v_offset;
jpayne@69 5648 __pyx_t_2 = __pyx_f_5pysam_9libcutils_array_to_qualitystring(((arrayobject *)__pyx_v_qualities), 0, &__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 79, __pyx_L1_error)
jpayne@69 5649 __Pyx_GOTREF(__pyx_t_2);
jpayne@69 5650 __pyx_r = __pyx_t_2;
jpayne@69 5651 __pyx_t_2 = 0;
jpayne@69 5652 goto __pyx_L0;
jpayne@69 5653
jpayne@69 5654 /* "pysam/libcutils.pyx":78
jpayne@69 5655 * if qualities is None:
jpayne@69 5656 * return None
jpayne@69 5657 * elif isinstance(qualities, c_array.array): # <<<<<<<<<<<<<<
jpayne@69 5658 * return array_to_qualitystring(qualities, offset=offset)
jpayne@69 5659 * else:
jpayne@69 5660 */
jpayne@69 5661 }
jpayne@69 5662
jpayne@69 5663 /* "pysam/libcutils.pyx":82
jpayne@69 5664 * else:
jpayne@69 5665 * # tuples and lists
jpayne@69 5666 * return force_str("".join([chr(x + offset) for x in qualities])) # <<<<<<<<<<<<<<
jpayne@69 5667 *
jpayne@69 5668 *
jpayne@69 5669 */
jpayne@69 5670 /*else*/ {
jpayne@69 5671 __Pyx_XDECREF(__pyx_r);
jpayne@69 5672 { /* enter inner scope */
jpayne@69 5673 __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 82, __pyx_L1_error)
jpayne@69 5674 __Pyx_GOTREF(__pyx_t_2);
jpayne@69 5675 if (likely(PyList_CheckExact(__pyx_v_qualities)) || PyTuple_CheckExact(__pyx_v_qualities)) {
jpayne@69 5676 __pyx_t_4 = __pyx_v_qualities; __Pyx_INCREF(__pyx_t_4);
jpayne@69 5677 __pyx_t_5 = 0;
jpayne@69 5678 __pyx_t_6 = NULL;
jpayne@69 5679 } else {
jpayne@69 5680 __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_qualities); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 82, __pyx_L1_error)
jpayne@69 5681 __Pyx_GOTREF(__pyx_t_4);
jpayne@69 5682 __pyx_t_6 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 82, __pyx_L1_error)
jpayne@69 5683 }
jpayne@69 5684 for (;;) {
jpayne@69 5685 if (likely(!__pyx_t_6)) {
jpayne@69 5686 if (likely(PyList_CheckExact(__pyx_t_4))) {
jpayne@69 5687 {
jpayne@69 5688 Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_4);
jpayne@69 5689 #if !CYTHON_ASSUME_SAFE_MACROS
jpayne@69 5690 if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 82, __pyx_L1_error)
jpayne@69 5691 #endif
jpayne@69 5692 if (__pyx_t_5 >= __pyx_temp) break;
jpayne@69 5693 }
jpayne@69 5694 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
jpayne@69 5695 __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely((0 < 0))) __PYX_ERR(0, 82, __pyx_L1_error)
jpayne@69 5696 #else
jpayne@69 5697 __pyx_t_7 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 82, __pyx_L1_error)
jpayne@69 5698 __Pyx_GOTREF(__pyx_t_7);
jpayne@69 5699 #endif
jpayne@69 5700 } else {
jpayne@69 5701 {
jpayne@69 5702 Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4);
jpayne@69 5703 #if !CYTHON_ASSUME_SAFE_MACROS
jpayne@69 5704 if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 82, __pyx_L1_error)
jpayne@69 5705 #endif
jpayne@69 5706 if (__pyx_t_5 >= __pyx_temp) break;
jpayne@69 5707 }
jpayne@69 5708 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
jpayne@69 5709 __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely((0 < 0))) __PYX_ERR(0, 82, __pyx_L1_error)
jpayne@69 5710 #else
jpayne@69 5711 __pyx_t_7 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 82, __pyx_L1_error)
jpayne@69 5712 __Pyx_GOTREF(__pyx_t_7);
jpayne@69 5713 #endif
jpayne@69 5714 }
jpayne@69 5715 } else {
jpayne@69 5716 __pyx_t_7 = __pyx_t_6(__pyx_t_4);
jpayne@69 5717 if (unlikely(!__pyx_t_7)) {
jpayne@69 5718 PyObject* exc_type = PyErr_Occurred();
jpayne@69 5719 if (exc_type) {
jpayne@69 5720 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
jpayne@69 5721 else __PYX_ERR(0, 82, __pyx_L1_error)
jpayne@69 5722 }
jpayne@69 5723 break;
jpayne@69 5724 }
jpayne@69 5725 __Pyx_GOTREF(__pyx_t_7);
jpayne@69 5726 }
jpayne@69 5727 __pyx_t_8 = __Pyx_PyInt_As_char(__pyx_t_7); if (unlikely((__pyx_t_8 == (char)-1) && PyErr_Occurred())) __PYX_ERR(0, 82, __pyx_L1_error)
jpayne@69 5728 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
jpayne@69 5729 __pyx_8genexpr1__pyx_v_x = __pyx_t_8;
jpayne@69 5730 __pyx_t_7 = __Pyx_PyInt_From_int((__pyx_8genexpr1__pyx_v_x + __pyx_v_offset)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 82, __pyx_L1_error)
jpayne@69 5731 __Pyx_GOTREF(__pyx_t_7);
jpayne@69 5732 __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_builtin_chr, __pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 82, __pyx_L1_error)
jpayne@69 5733 __Pyx_GOTREF(__pyx_t_9);
jpayne@69 5734 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
jpayne@69 5735 if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_9))) __PYX_ERR(0, 82, __pyx_L1_error)
jpayne@69 5736 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
jpayne@69 5737 }
jpayne@69 5738 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
jpayne@69 5739 } /* exit inner scope */
jpayne@69 5740 __pyx_t_4 = PyUnicode_Join(__pyx_kp_u_, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 82, __pyx_L1_error)
jpayne@69 5741 __Pyx_GOTREF(__pyx_t_4);
jpayne@69 5742 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@69 5743 __pyx_t_2 = __pyx_f_5pysam_9libcutils_force_str(__pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 82, __pyx_L1_error)
jpayne@69 5744 __Pyx_GOTREF(__pyx_t_2);
jpayne@69 5745 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
jpayne@69 5746 __pyx_r = __pyx_t_2;
jpayne@69 5747 __pyx_t_2 = 0;
jpayne@69 5748 goto __pyx_L0;
jpayne@69 5749 }
jpayne@69 5750
jpayne@69 5751 /* "pysam/libcutils.pyx":59
jpayne@69 5752 *
jpayne@69 5753 *
jpayne@69 5754 * cpdef qualities_to_qualitystring(qualities, int offset=33): # <<<<<<<<<<<<<<
jpayne@69 5755 * """convert a list or array of quality scores to the string
jpayne@69 5756 * representation used in the SAM format.
jpayne@69 5757 */
jpayne@69 5758
jpayne@69 5759 /* function exit code */
jpayne@69 5760 __pyx_L1_error:;
jpayne@69 5761 __Pyx_XDECREF(__pyx_t_2);
jpayne@69 5762 __Pyx_XDECREF(__pyx_t_4);
jpayne@69 5763 __Pyx_XDECREF(__pyx_t_7);
jpayne@69 5764 __Pyx_XDECREF(__pyx_t_9);
jpayne@69 5765 __Pyx_AddTraceback("pysam.libcutils.qualities_to_qualitystring", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@69 5766 __pyx_r = 0;
jpayne@69 5767 __pyx_L0:;
jpayne@69 5768 __Pyx_XGIVEREF(__pyx_r);
jpayne@69 5769 __Pyx_RefNannyFinishContext();
jpayne@69 5770 return __pyx_r;
jpayne@69 5771 }
jpayne@69 5772
jpayne@69 5773 /* Python wrapper */
jpayne@69 5774 static PyObject *__pyx_pw_5pysam_9libcutils_5qualities_to_qualitystring(PyObject *__pyx_self,
jpayne@69 5775 #if CYTHON_METH_FASTCALL
jpayne@69 5776 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
jpayne@69 5777 #else
jpayne@69 5778 PyObject *__pyx_args, PyObject *__pyx_kwds
jpayne@69 5779 #endif
jpayne@69 5780 ); /*proto*/
jpayne@69 5781 PyDoc_STRVAR(__pyx_doc_5pysam_9libcutils_4qualities_to_qualitystring, "convert a list or array of quality scores to the string\n representation used in the SAM format.\n\n Parameters\n ----------\n offset : int\n offset to be added to the quality scores to arrive at\n the characters of the quality string (default=33).\n\n Returns\n -------\n string\n a quality string\n\n ");
jpayne@69 5782 static PyMethodDef __pyx_mdef_5pysam_9libcutils_5qualities_to_qualitystring = {"qualities_to_qualitystring", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_9libcutils_5qualities_to_qualitystring, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_9libcutils_4qualities_to_qualitystring};
jpayne@69 5783 static PyObject *__pyx_pw_5pysam_9libcutils_5qualities_to_qualitystring(PyObject *__pyx_self,
jpayne@69 5784 #if CYTHON_METH_FASTCALL
jpayne@69 5785 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
jpayne@69 5786 #else
jpayne@69 5787 PyObject *__pyx_args, PyObject *__pyx_kwds
jpayne@69 5788 #endif
jpayne@69 5789 ) {
jpayne@69 5790 PyObject *__pyx_v_qualities = 0;
jpayne@69 5791 int __pyx_v_offset;
jpayne@69 5792 #if !CYTHON_METH_FASTCALL
jpayne@69 5793 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
jpayne@69 5794 #endif
jpayne@69 5795 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
jpayne@69 5796 PyObject* values[2] = {0,0};
jpayne@69 5797 int __pyx_lineno = 0;
jpayne@69 5798 const char *__pyx_filename = NULL;
jpayne@69 5799 int __pyx_clineno = 0;
jpayne@69 5800 PyObject *__pyx_r = 0;
jpayne@69 5801 __Pyx_RefNannyDeclarations
jpayne@69 5802 __Pyx_RefNannySetupContext("qualities_to_qualitystring (wrapper)", 0);
jpayne@69 5803 #if !CYTHON_METH_FASTCALL
jpayne@69 5804 #if CYTHON_ASSUME_SAFE_MACROS
jpayne@69 5805 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
jpayne@69 5806 #else
jpayne@69 5807 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
jpayne@69 5808 #endif
jpayne@69 5809 #endif
jpayne@69 5810 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
jpayne@69 5811 {
jpayne@69 5812 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_qualities,&__pyx_n_s_offset,0};
jpayne@69 5813 if (__pyx_kwds) {
jpayne@69 5814 Py_ssize_t kw_args;
jpayne@69 5815 switch (__pyx_nargs) {
jpayne@69 5816 case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
jpayne@69 5817 CYTHON_FALLTHROUGH;
jpayne@69 5818 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
jpayne@69 5819 CYTHON_FALLTHROUGH;
jpayne@69 5820 case 0: break;
jpayne@69 5821 default: goto __pyx_L5_argtuple_error;
jpayne@69 5822 }
jpayne@69 5823 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
jpayne@69 5824 switch (__pyx_nargs) {
jpayne@69 5825 case 0:
jpayne@69 5826 if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_qualities)) != 0)) {
jpayne@69 5827 (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
jpayne@69 5828 kw_args--;
jpayne@69 5829 }
jpayne@69 5830 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 59, __pyx_L3_error)
jpayne@69 5831 else goto __pyx_L5_argtuple_error;
jpayne@69 5832 CYTHON_FALLTHROUGH;
jpayne@69 5833 case 1:
jpayne@69 5834 if (kw_args > 0) {
jpayne@69 5835 PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_offset);
jpayne@69 5836 if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
jpayne@69 5837 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 59, __pyx_L3_error)
jpayne@69 5838 }
jpayne@69 5839 }
jpayne@69 5840 if (unlikely(kw_args > 0)) {
jpayne@69 5841 const Py_ssize_t kwd_pos_args = __pyx_nargs;
jpayne@69 5842 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "qualities_to_qualitystring") < 0)) __PYX_ERR(0, 59, __pyx_L3_error)
jpayne@69 5843 }
jpayne@69 5844 } else {
jpayne@69 5845 switch (__pyx_nargs) {
jpayne@69 5846 case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
jpayne@69 5847 CYTHON_FALLTHROUGH;
jpayne@69 5848 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
jpayne@69 5849 break;
jpayne@69 5850 default: goto __pyx_L5_argtuple_error;
jpayne@69 5851 }
jpayne@69 5852 }
jpayne@69 5853 __pyx_v_qualities = values[0];
jpayne@69 5854 if (values[1]) {
jpayne@69 5855 __pyx_v_offset = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_offset == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 59, __pyx_L3_error)
jpayne@69 5856 } else {
jpayne@69 5857 __pyx_v_offset = ((int)33);
jpayne@69 5858 }
jpayne@69 5859 }
jpayne@69 5860 goto __pyx_L6_skip;
jpayne@69 5861 __pyx_L5_argtuple_error:;
jpayne@69 5862 __Pyx_RaiseArgtupleInvalid("qualities_to_qualitystring", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 59, __pyx_L3_error)
jpayne@69 5863 __pyx_L6_skip:;
jpayne@69 5864 goto __pyx_L4_argument_unpacking_done;
jpayne@69 5865 __pyx_L3_error:;
jpayne@69 5866 {
jpayne@69 5867 Py_ssize_t __pyx_temp;
jpayne@69 5868 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
jpayne@69 5869 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
jpayne@69 5870 }
jpayne@69 5871 }
jpayne@69 5872 __Pyx_AddTraceback("pysam.libcutils.qualities_to_qualitystring", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@69 5873 __Pyx_RefNannyFinishContext();
jpayne@69 5874 return NULL;
jpayne@69 5875 __pyx_L4_argument_unpacking_done:;
jpayne@69 5876 __pyx_r = __pyx_pf_5pysam_9libcutils_4qualities_to_qualitystring(__pyx_self, __pyx_v_qualities, __pyx_v_offset);
jpayne@69 5877
jpayne@69 5878 /* function exit code */
jpayne@69 5879 {
jpayne@69 5880 Py_ssize_t __pyx_temp;
jpayne@69 5881 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
jpayne@69 5882 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
jpayne@69 5883 }
jpayne@69 5884 }
jpayne@69 5885 __Pyx_RefNannyFinishContext();
jpayne@69 5886 return __pyx_r;
jpayne@69 5887 }
jpayne@69 5888
jpayne@69 5889 static PyObject *__pyx_pf_5pysam_9libcutils_4qualities_to_qualitystring(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_qualities, int __pyx_v_offset) {
jpayne@69 5890 PyObject *__pyx_r = NULL;
jpayne@69 5891 __Pyx_RefNannyDeclarations
jpayne@69 5892 PyObject *__pyx_t_1 = NULL;
jpayne@69 5893 struct __pyx_opt_args_5pysam_9libcutils_qualities_to_qualitystring __pyx_t_2;
jpayne@69 5894 int __pyx_lineno = 0;
jpayne@69 5895 const char *__pyx_filename = NULL;
jpayne@69 5896 int __pyx_clineno = 0;
jpayne@69 5897 __Pyx_RefNannySetupContext("qualities_to_qualitystring", 1);
jpayne@69 5898 __Pyx_XDECREF(__pyx_r);
jpayne@69 5899 __pyx_t_2.__pyx_n = 1;
jpayne@69 5900 __pyx_t_2.offset = __pyx_v_offset;
jpayne@69 5901 __pyx_t_1 = __pyx_f_5pysam_9libcutils_qualities_to_qualitystring(__pyx_v_qualities, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 59, __pyx_L1_error)
jpayne@69 5902 __Pyx_GOTREF(__pyx_t_1);
jpayne@69 5903 __pyx_r = __pyx_t_1;
jpayne@69 5904 __pyx_t_1 = 0;
jpayne@69 5905 goto __pyx_L0;
jpayne@69 5906
jpayne@69 5907 /* function exit code */
jpayne@69 5908 __pyx_L1_error:;
jpayne@69 5909 __Pyx_XDECREF(__pyx_t_1);
jpayne@69 5910 __Pyx_AddTraceback("pysam.libcutils.qualities_to_qualitystring", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@69 5911 __pyx_r = NULL;
jpayne@69 5912 __pyx_L0:;
jpayne@69 5913 __Pyx_XGIVEREF(__pyx_r);
jpayne@69 5914 __Pyx_RefNannyFinishContext();
jpayne@69 5915 return __pyx_r;
jpayne@69 5916 }
jpayne@69 5917
jpayne@69 5918 /* "pysam/libcutils.pyx":90
jpayne@69 5919 *
jpayne@69 5920 * # Codec error handler that just interprets each bad byte as ISO-8859-1.
jpayne@69 5921 * def latin1_replace(exception): # <<<<<<<<<<<<<<
jpayne@69 5922 * return (chr(exception.object[exception.start]), exception.end)
jpayne@69 5923 *
jpayne@69 5924 */
jpayne@69 5925
jpayne@69 5926 /* Python wrapper */
jpayne@69 5927 static PyObject *__pyx_pw_5pysam_9libcutils_7latin1_replace(PyObject *__pyx_self,
jpayne@69 5928 #if CYTHON_METH_FASTCALL
jpayne@69 5929 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
jpayne@69 5930 #else
jpayne@69 5931 PyObject *__pyx_args, PyObject *__pyx_kwds
jpayne@69 5932 #endif
jpayne@69 5933 ); /*proto*/
jpayne@69 5934 static PyMethodDef __pyx_mdef_5pysam_9libcutils_7latin1_replace = {"latin1_replace", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_9libcutils_7latin1_replace, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
jpayne@69 5935 static PyObject *__pyx_pw_5pysam_9libcutils_7latin1_replace(PyObject *__pyx_self,
jpayne@69 5936 #if CYTHON_METH_FASTCALL
jpayne@69 5937 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
jpayne@69 5938 #else
jpayne@69 5939 PyObject *__pyx_args, PyObject *__pyx_kwds
jpayne@69 5940 #endif
jpayne@69 5941 ) {
jpayne@69 5942 PyObject *__pyx_v_exception = 0;
jpayne@69 5943 #if !CYTHON_METH_FASTCALL
jpayne@69 5944 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
jpayne@69 5945 #endif
jpayne@69 5946 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
jpayne@69 5947 PyObject* values[1] = {0};
jpayne@69 5948 int __pyx_lineno = 0;
jpayne@69 5949 const char *__pyx_filename = NULL;
jpayne@69 5950 int __pyx_clineno = 0;
jpayne@69 5951 PyObject *__pyx_r = 0;
jpayne@69 5952 __Pyx_RefNannyDeclarations
jpayne@69 5953 __Pyx_RefNannySetupContext("latin1_replace (wrapper)", 0);
jpayne@69 5954 #if !CYTHON_METH_FASTCALL
jpayne@69 5955 #if CYTHON_ASSUME_SAFE_MACROS
jpayne@69 5956 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
jpayne@69 5957 #else
jpayne@69 5958 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
jpayne@69 5959 #endif
jpayne@69 5960 #endif
jpayne@69 5961 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
jpayne@69 5962 {
jpayne@69 5963 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_exception,0};
jpayne@69 5964 if (__pyx_kwds) {
jpayne@69 5965 Py_ssize_t kw_args;
jpayne@69 5966 switch (__pyx_nargs) {
jpayne@69 5967 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
jpayne@69 5968 CYTHON_FALLTHROUGH;
jpayne@69 5969 case 0: break;
jpayne@69 5970 default: goto __pyx_L5_argtuple_error;
jpayne@69 5971 }
jpayne@69 5972 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
jpayne@69 5973 switch (__pyx_nargs) {
jpayne@69 5974 case 0:
jpayne@69 5975 if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_exception)) != 0)) {
jpayne@69 5976 (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
jpayne@69 5977 kw_args--;
jpayne@69 5978 }
jpayne@69 5979 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 90, __pyx_L3_error)
jpayne@69 5980 else goto __pyx_L5_argtuple_error;
jpayne@69 5981 }
jpayne@69 5982 if (unlikely(kw_args > 0)) {
jpayne@69 5983 const Py_ssize_t kwd_pos_args = __pyx_nargs;
jpayne@69 5984 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "latin1_replace") < 0)) __PYX_ERR(0, 90, __pyx_L3_error)
jpayne@69 5985 }
jpayne@69 5986 } else if (unlikely(__pyx_nargs != 1)) {
jpayne@69 5987 goto __pyx_L5_argtuple_error;
jpayne@69 5988 } else {
jpayne@69 5989 values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
jpayne@69 5990 }
jpayne@69 5991 __pyx_v_exception = values[0];
jpayne@69 5992 }
jpayne@69 5993 goto __pyx_L6_skip;
jpayne@69 5994 __pyx_L5_argtuple_error:;
jpayne@69 5995 __Pyx_RaiseArgtupleInvalid("latin1_replace", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 90, __pyx_L3_error)
jpayne@69 5996 __pyx_L6_skip:;
jpayne@69 5997 goto __pyx_L4_argument_unpacking_done;
jpayne@69 5998 __pyx_L3_error:;
jpayne@69 5999 {
jpayne@69 6000 Py_ssize_t __pyx_temp;
jpayne@69 6001 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
jpayne@69 6002 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
jpayne@69 6003 }
jpayne@69 6004 }
jpayne@69 6005 __Pyx_AddTraceback("pysam.libcutils.latin1_replace", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@69 6006 __Pyx_RefNannyFinishContext();
jpayne@69 6007 return NULL;
jpayne@69 6008 __pyx_L4_argument_unpacking_done:;
jpayne@69 6009 __pyx_r = __pyx_pf_5pysam_9libcutils_6latin1_replace(__pyx_self, __pyx_v_exception);
jpayne@69 6010
jpayne@69 6011 /* function exit code */
jpayne@69 6012 {
jpayne@69 6013 Py_ssize_t __pyx_temp;
jpayne@69 6014 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
jpayne@69 6015 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
jpayne@69 6016 }
jpayne@69 6017 }
jpayne@69 6018 __Pyx_RefNannyFinishContext();
jpayne@69 6019 return __pyx_r;
jpayne@69 6020 }
jpayne@69 6021
jpayne@69 6022 static PyObject *__pyx_pf_5pysam_9libcutils_6latin1_replace(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_exception) {
jpayne@69 6023 PyObject *__pyx_r = NULL;
jpayne@69 6024 __Pyx_RefNannyDeclarations
jpayne@69 6025 PyObject *__pyx_t_1 = NULL;
jpayne@69 6026 PyObject *__pyx_t_2 = NULL;
jpayne@69 6027 PyObject *__pyx_t_3 = NULL;
jpayne@69 6028 int __pyx_lineno = 0;
jpayne@69 6029 const char *__pyx_filename = NULL;
jpayne@69 6030 int __pyx_clineno = 0;
jpayne@69 6031 __Pyx_RefNannySetupContext("latin1_replace", 1);
jpayne@69 6032
jpayne@69 6033 /* "pysam/libcutils.pyx":91
jpayne@69 6034 * # Codec error handler that just interprets each bad byte as ISO-8859-1.
jpayne@69 6035 * def latin1_replace(exception):
jpayne@69 6036 * return (chr(exception.object[exception.start]), exception.end) # <<<<<<<<<<<<<<
jpayne@69 6037 *
jpayne@69 6038 * register_error('pysam.latin1replace', latin1_replace)
jpayne@69 6039 */
jpayne@69 6040 __Pyx_XDECREF(__pyx_r);
jpayne@69 6041 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception, __pyx_n_s_object); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 91, __pyx_L1_error)
jpayne@69 6042 __Pyx_GOTREF(__pyx_t_1);
jpayne@69 6043 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception, __pyx_n_s_start); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 91, __pyx_L1_error)
jpayne@69 6044 __Pyx_GOTREF(__pyx_t_2);
jpayne@69 6045 __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 91, __pyx_L1_error)
jpayne@69 6046 __Pyx_GOTREF(__pyx_t_3);
jpayne@69 6047 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
jpayne@69 6048 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@69 6049 __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_chr, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 91, __pyx_L1_error)
jpayne@69 6050 __Pyx_GOTREF(__pyx_t_2);
jpayne@69 6051 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@69 6052 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_exception, __pyx_n_s_end); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 91, __pyx_L1_error)
jpayne@69 6053 __Pyx_GOTREF(__pyx_t_3);
jpayne@69 6054 __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 91, __pyx_L1_error)
jpayne@69 6055 __Pyx_GOTREF(__pyx_t_1);
jpayne@69 6056 __Pyx_GIVEREF(__pyx_t_2);
jpayne@69 6057 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2)) __PYX_ERR(0, 91, __pyx_L1_error);
jpayne@69 6058 __Pyx_GIVEREF(__pyx_t_3);
jpayne@69 6059 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3)) __PYX_ERR(0, 91, __pyx_L1_error);
jpayne@69 6060 __pyx_t_2 = 0;
jpayne@69 6061 __pyx_t_3 = 0;
jpayne@69 6062 __pyx_r = __pyx_t_1;
jpayne@69 6063 __pyx_t_1 = 0;
jpayne@69 6064 goto __pyx_L0;
jpayne@69 6065
jpayne@69 6066 /* "pysam/libcutils.pyx":90
jpayne@69 6067 *
jpayne@69 6068 * # Codec error handler that just interprets each bad byte as ISO-8859-1.
jpayne@69 6069 * def latin1_replace(exception): # <<<<<<<<<<<<<<
jpayne@69 6070 * return (chr(exception.object[exception.start]), exception.end)
jpayne@69 6071 *
jpayne@69 6072 */
jpayne@69 6073
jpayne@69 6074 /* function exit code */
jpayne@69 6075 __pyx_L1_error:;
jpayne@69 6076 __Pyx_XDECREF(__pyx_t_1);
jpayne@69 6077 __Pyx_XDECREF(__pyx_t_2);
jpayne@69 6078 __Pyx_XDECREF(__pyx_t_3);
jpayne@69 6079 __Pyx_AddTraceback("pysam.libcutils.latin1_replace", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@69 6080 __pyx_r = NULL;
jpayne@69 6081 __pyx_L0:;
jpayne@69 6082 __Pyx_XGIVEREF(__pyx_r);
jpayne@69 6083 __Pyx_RefNannyFinishContext();
jpayne@69 6084 return __pyx_r;
jpayne@69 6085 }
jpayne@69 6086
jpayne@69 6087 /* "pysam/libcutils.pyx":98
jpayne@69 6088 * cdef str ERROR_HANDLER = 'strict'
jpayne@69 6089 *
jpayne@69 6090 * cpdef get_encoding_error_handler(): # <<<<<<<<<<<<<<
jpayne@69 6091 * return ERROR_HANDLER
jpayne@69 6092 *
jpayne@69 6093 */
jpayne@69 6094
jpayne@69 6095 static PyObject *__pyx_pw_5pysam_9libcutils_9get_encoding_error_handler(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
jpayne@69 6096 static PyObject *__pyx_f_5pysam_9libcutils_get_encoding_error_handler(CYTHON_UNUSED int __pyx_skip_dispatch) {
jpayne@69 6097 PyObject *__pyx_r = NULL;
jpayne@69 6098 __Pyx_RefNannyDeclarations
jpayne@69 6099 __Pyx_RefNannySetupContext("get_encoding_error_handler", 1);
jpayne@69 6100
jpayne@69 6101 /* "pysam/libcutils.pyx":99
jpayne@69 6102 *
jpayne@69 6103 * cpdef get_encoding_error_handler():
jpayne@69 6104 * return ERROR_HANDLER # <<<<<<<<<<<<<<
jpayne@69 6105 *
jpayne@69 6106 * cpdef set_encoding_error_handler(name):
jpayne@69 6107 */
jpayne@69 6108 __Pyx_XDECREF(__pyx_r);
jpayne@69 6109 __Pyx_INCREF(__pyx_v_5pysam_9libcutils_ERROR_HANDLER);
jpayne@69 6110 __pyx_r = __pyx_v_5pysam_9libcutils_ERROR_HANDLER;
jpayne@69 6111 goto __pyx_L0;
jpayne@69 6112
jpayne@69 6113 /* "pysam/libcutils.pyx":98
jpayne@69 6114 * cdef str ERROR_HANDLER = 'strict'
jpayne@69 6115 *
jpayne@69 6116 * cpdef get_encoding_error_handler(): # <<<<<<<<<<<<<<
jpayne@69 6117 * return ERROR_HANDLER
jpayne@69 6118 *
jpayne@69 6119 */
jpayne@69 6120
jpayne@69 6121 /* function exit code */
jpayne@69 6122 __pyx_L0:;
jpayne@69 6123 __Pyx_XGIVEREF(__pyx_r);
jpayne@69 6124 __Pyx_RefNannyFinishContext();
jpayne@69 6125 return __pyx_r;
jpayne@69 6126 }
jpayne@69 6127
jpayne@69 6128 /* Python wrapper */
jpayne@69 6129 static PyObject *__pyx_pw_5pysam_9libcutils_9get_encoding_error_handler(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
jpayne@69 6130 static PyMethodDef __pyx_mdef_5pysam_9libcutils_9get_encoding_error_handler = {"get_encoding_error_handler", (PyCFunction)__pyx_pw_5pysam_9libcutils_9get_encoding_error_handler, METH_NOARGS, 0};
jpayne@69 6131 static PyObject *__pyx_pw_5pysam_9libcutils_9get_encoding_error_handler(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
jpayne@69 6132 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
jpayne@69 6133 PyObject *__pyx_r = 0;
jpayne@69 6134 __Pyx_RefNannyDeclarations
jpayne@69 6135 __Pyx_RefNannySetupContext("get_encoding_error_handler (wrapper)", 0);
jpayne@69 6136 __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
jpayne@69 6137 __pyx_r = __pyx_pf_5pysam_9libcutils_8get_encoding_error_handler(__pyx_self);
jpayne@69 6138
jpayne@69 6139 /* function exit code */
jpayne@69 6140 __Pyx_RefNannyFinishContext();
jpayne@69 6141 return __pyx_r;
jpayne@69 6142 }
jpayne@69 6143
jpayne@69 6144 static PyObject *__pyx_pf_5pysam_9libcutils_8get_encoding_error_handler(CYTHON_UNUSED PyObject *__pyx_self) {
jpayne@69 6145 PyObject *__pyx_r = NULL;
jpayne@69 6146 __Pyx_RefNannyDeclarations
jpayne@69 6147 PyObject *__pyx_t_1 = NULL;
jpayne@69 6148 int __pyx_lineno = 0;
jpayne@69 6149 const char *__pyx_filename = NULL;
jpayne@69 6150 int __pyx_clineno = 0;
jpayne@69 6151 __Pyx_RefNannySetupContext("get_encoding_error_handler", 1);
jpayne@69 6152 __Pyx_XDECREF(__pyx_r);
jpayne@69 6153 __pyx_t_1 = __pyx_f_5pysam_9libcutils_get_encoding_error_handler(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 98, __pyx_L1_error)
jpayne@69 6154 __Pyx_GOTREF(__pyx_t_1);
jpayne@69 6155 __pyx_r = __pyx_t_1;
jpayne@69 6156 __pyx_t_1 = 0;
jpayne@69 6157 goto __pyx_L0;
jpayne@69 6158
jpayne@69 6159 /* function exit code */
jpayne@69 6160 __pyx_L1_error:;
jpayne@69 6161 __Pyx_XDECREF(__pyx_t_1);
jpayne@69 6162 __Pyx_AddTraceback("pysam.libcutils.get_encoding_error_handler", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@69 6163 __pyx_r = NULL;
jpayne@69 6164 __pyx_L0:;
jpayne@69 6165 __Pyx_XGIVEREF(__pyx_r);
jpayne@69 6166 __Pyx_RefNannyFinishContext();
jpayne@69 6167 return __pyx_r;
jpayne@69 6168 }
jpayne@69 6169
jpayne@69 6170 /* "pysam/libcutils.pyx":101
jpayne@69 6171 * return ERROR_HANDLER
jpayne@69 6172 *
jpayne@69 6173 * cpdef set_encoding_error_handler(name): # <<<<<<<<<<<<<<
jpayne@69 6174 * global ERROR_HANDLER
jpayne@69 6175 * previous = ERROR_HANDLER
jpayne@69 6176 */
jpayne@69 6177
jpayne@69 6178 static PyObject *__pyx_pw_5pysam_9libcutils_11set_encoding_error_handler(PyObject *__pyx_self,
jpayne@69 6179 #if CYTHON_METH_FASTCALL
jpayne@69 6180 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
jpayne@69 6181 #else
jpayne@69 6182 PyObject *__pyx_args, PyObject *__pyx_kwds
jpayne@69 6183 #endif
jpayne@69 6184 ); /*proto*/
jpayne@69 6185 static PyObject *__pyx_f_5pysam_9libcutils_set_encoding_error_handler(PyObject *__pyx_v_name, CYTHON_UNUSED int __pyx_skip_dispatch) {
jpayne@69 6186 PyObject *__pyx_v_previous = NULL;
jpayne@69 6187 PyObject *__pyx_r = NULL;
jpayne@69 6188 __Pyx_RefNannyDeclarations
jpayne@69 6189 PyObject *__pyx_t_1 = NULL;
jpayne@69 6190 int __pyx_lineno = 0;
jpayne@69 6191 const char *__pyx_filename = NULL;
jpayne@69 6192 int __pyx_clineno = 0;
jpayne@69 6193 __Pyx_RefNannySetupContext("set_encoding_error_handler", 1);
jpayne@69 6194
jpayne@69 6195 /* "pysam/libcutils.pyx":103
jpayne@69 6196 * cpdef set_encoding_error_handler(name):
jpayne@69 6197 * global ERROR_HANDLER
jpayne@69 6198 * previous = ERROR_HANDLER # <<<<<<<<<<<<<<
jpayne@69 6199 * ERROR_HANDLER = name
jpayne@69 6200 * return previous
jpayne@69 6201 */
jpayne@69 6202 __Pyx_INCREF(__pyx_v_5pysam_9libcutils_ERROR_HANDLER);
jpayne@69 6203 __pyx_v_previous = __pyx_v_5pysam_9libcutils_ERROR_HANDLER;
jpayne@69 6204
jpayne@69 6205 /* "pysam/libcutils.pyx":104
jpayne@69 6206 * global ERROR_HANDLER
jpayne@69 6207 * previous = ERROR_HANDLER
jpayne@69 6208 * ERROR_HANDLER = name # <<<<<<<<<<<<<<
jpayne@69 6209 * return previous
jpayne@69 6210 *
jpayne@69 6211 */
jpayne@69 6212 if (!(likely(PyUnicode_CheckExact(__pyx_v_name))||((__pyx_v_name) == Py_None) || __Pyx_RaiseUnexpectedTypeError("unicode", __pyx_v_name))) __PYX_ERR(0, 104, __pyx_L1_error)
jpayne@69 6213 __pyx_t_1 = __pyx_v_name;
jpayne@69 6214 __Pyx_INCREF(__pyx_t_1);
jpayne@69 6215 __Pyx_XGOTREF(__pyx_v_5pysam_9libcutils_ERROR_HANDLER);
jpayne@69 6216 __Pyx_DECREF_SET(__pyx_v_5pysam_9libcutils_ERROR_HANDLER, ((PyObject*)__pyx_t_1));
jpayne@69 6217 __Pyx_GIVEREF(__pyx_t_1);
jpayne@69 6218 __pyx_t_1 = 0;
jpayne@69 6219
jpayne@69 6220 /* "pysam/libcutils.pyx":105
jpayne@69 6221 * previous = ERROR_HANDLER
jpayne@69 6222 * ERROR_HANDLER = name
jpayne@69 6223 * return previous # <<<<<<<<<<<<<<
jpayne@69 6224 *
jpayne@69 6225 * ########################################################################
jpayne@69 6226 */
jpayne@69 6227 __Pyx_XDECREF(__pyx_r);
jpayne@69 6228 __Pyx_INCREF(__pyx_v_previous);
jpayne@69 6229 __pyx_r = __pyx_v_previous;
jpayne@69 6230 goto __pyx_L0;
jpayne@69 6231
jpayne@69 6232 /* "pysam/libcutils.pyx":101
jpayne@69 6233 * return ERROR_HANDLER
jpayne@69 6234 *
jpayne@69 6235 * cpdef set_encoding_error_handler(name): # <<<<<<<<<<<<<<
jpayne@69 6236 * global ERROR_HANDLER
jpayne@69 6237 * previous = ERROR_HANDLER
jpayne@69 6238 */
jpayne@69 6239
jpayne@69 6240 /* function exit code */
jpayne@69 6241 __pyx_L1_error:;
jpayne@69 6242 __Pyx_XDECREF(__pyx_t_1);
jpayne@69 6243 __Pyx_AddTraceback("pysam.libcutils.set_encoding_error_handler", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@69 6244 __pyx_r = 0;
jpayne@69 6245 __pyx_L0:;
jpayne@69 6246 __Pyx_XDECREF(__pyx_v_previous);
jpayne@69 6247 __Pyx_XGIVEREF(__pyx_r);
jpayne@69 6248 __Pyx_RefNannyFinishContext();
jpayne@69 6249 return __pyx_r;
jpayne@69 6250 }
jpayne@69 6251
jpayne@69 6252 /* Python wrapper */
jpayne@69 6253 static PyObject *__pyx_pw_5pysam_9libcutils_11set_encoding_error_handler(PyObject *__pyx_self,
jpayne@69 6254 #if CYTHON_METH_FASTCALL
jpayne@69 6255 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
jpayne@69 6256 #else
jpayne@69 6257 PyObject *__pyx_args, PyObject *__pyx_kwds
jpayne@69 6258 #endif
jpayne@69 6259 ); /*proto*/
jpayne@69 6260 static PyMethodDef __pyx_mdef_5pysam_9libcutils_11set_encoding_error_handler = {"set_encoding_error_handler", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_9libcutils_11set_encoding_error_handler, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
jpayne@69 6261 static PyObject *__pyx_pw_5pysam_9libcutils_11set_encoding_error_handler(PyObject *__pyx_self,
jpayne@69 6262 #if CYTHON_METH_FASTCALL
jpayne@69 6263 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
jpayne@69 6264 #else
jpayne@69 6265 PyObject *__pyx_args, PyObject *__pyx_kwds
jpayne@69 6266 #endif
jpayne@69 6267 ) {
jpayne@69 6268 PyObject *__pyx_v_name = 0;
jpayne@69 6269 #if !CYTHON_METH_FASTCALL
jpayne@69 6270 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
jpayne@69 6271 #endif
jpayne@69 6272 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
jpayne@69 6273 PyObject* values[1] = {0};
jpayne@69 6274 int __pyx_lineno = 0;
jpayne@69 6275 const char *__pyx_filename = NULL;
jpayne@69 6276 int __pyx_clineno = 0;
jpayne@69 6277 PyObject *__pyx_r = 0;
jpayne@69 6278 __Pyx_RefNannyDeclarations
jpayne@69 6279 __Pyx_RefNannySetupContext("set_encoding_error_handler (wrapper)", 0);
jpayne@69 6280 #if !CYTHON_METH_FASTCALL
jpayne@69 6281 #if CYTHON_ASSUME_SAFE_MACROS
jpayne@69 6282 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
jpayne@69 6283 #else
jpayne@69 6284 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
jpayne@69 6285 #endif
jpayne@69 6286 #endif
jpayne@69 6287 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
jpayne@69 6288 {
jpayne@69 6289 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,0};
jpayne@69 6290 if (__pyx_kwds) {
jpayne@69 6291 Py_ssize_t kw_args;
jpayne@69 6292 switch (__pyx_nargs) {
jpayne@69 6293 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
jpayne@69 6294 CYTHON_FALLTHROUGH;
jpayne@69 6295 case 0: break;
jpayne@69 6296 default: goto __pyx_L5_argtuple_error;
jpayne@69 6297 }
jpayne@69 6298 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
jpayne@69 6299 switch (__pyx_nargs) {
jpayne@69 6300 case 0:
jpayne@69 6301 if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_name)) != 0)) {
jpayne@69 6302 (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
jpayne@69 6303 kw_args--;
jpayne@69 6304 }
jpayne@69 6305 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 101, __pyx_L3_error)
jpayne@69 6306 else goto __pyx_L5_argtuple_error;
jpayne@69 6307 }
jpayne@69 6308 if (unlikely(kw_args > 0)) {
jpayne@69 6309 const Py_ssize_t kwd_pos_args = __pyx_nargs;
jpayne@69 6310 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "set_encoding_error_handler") < 0)) __PYX_ERR(0, 101, __pyx_L3_error)
jpayne@69 6311 }
jpayne@69 6312 } else if (unlikely(__pyx_nargs != 1)) {
jpayne@69 6313 goto __pyx_L5_argtuple_error;
jpayne@69 6314 } else {
jpayne@69 6315 values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
jpayne@69 6316 }
jpayne@69 6317 __pyx_v_name = values[0];
jpayne@69 6318 }
jpayne@69 6319 goto __pyx_L6_skip;
jpayne@69 6320 __pyx_L5_argtuple_error:;
jpayne@69 6321 __Pyx_RaiseArgtupleInvalid("set_encoding_error_handler", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 101, __pyx_L3_error)
jpayne@69 6322 __pyx_L6_skip:;
jpayne@69 6323 goto __pyx_L4_argument_unpacking_done;
jpayne@69 6324 __pyx_L3_error:;
jpayne@69 6325 {
jpayne@69 6326 Py_ssize_t __pyx_temp;
jpayne@69 6327 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
jpayne@69 6328 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
jpayne@69 6329 }
jpayne@69 6330 }
jpayne@69 6331 __Pyx_AddTraceback("pysam.libcutils.set_encoding_error_handler", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@69 6332 __Pyx_RefNannyFinishContext();
jpayne@69 6333 return NULL;
jpayne@69 6334 __pyx_L4_argument_unpacking_done:;
jpayne@69 6335 __pyx_r = __pyx_pf_5pysam_9libcutils_10set_encoding_error_handler(__pyx_self, __pyx_v_name);
jpayne@69 6336
jpayne@69 6337 /* function exit code */
jpayne@69 6338 {
jpayne@69 6339 Py_ssize_t __pyx_temp;
jpayne@69 6340 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
jpayne@69 6341 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
jpayne@69 6342 }
jpayne@69 6343 }
jpayne@69 6344 __Pyx_RefNannyFinishContext();
jpayne@69 6345 return __pyx_r;
jpayne@69 6346 }
jpayne@69 6347
jpayne@69 6348 static PyObject *__pyx_pf_5pysam_9libcutils_10set_encoding_error_handler(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_name) {
jpayne@69 6349 PyObject *__pyx_r = NULL;
jpayne@69 6350 __Pyx_RefNannyDeclarations
jpayne@69 6351 PyObject *__pyx_t_1 = NULL;
jpayne@69 6352 int __pyx_lineno = 0;
jpayne@69 6353 const char *__pyx_filename = NULL;
jpayne@69 6354 int __pyx_clineno = 0;
jpayne@69 6355 __Pyx_RefNannySetupContext("set_encoding_error_handler", 1);
jpayne@69 6356 __Pyx_XDECREF(__pyx_r);
jpayne@69 6357 __pyx_t_1 = __pyx_f_5pysam_9libcutils_set_encoding_error_handler(__pyx_v_name, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 101, __pyx_L1_error)
jpayne@69 6358 __Pyx_GOTREF(__pyx_t_1);
jpayne@69 6359 __pyx_r = __pyx_t_1;
jpayne@69 6360 __pyx_t_1 = 0;
jpayne@69 6361 goto __pyx_L0;
jpayne@69 6362
jpayne@69 6363 /* function exit code */
jpayne@69 6364 __pyx_L1_error:;
jpayne@69 6365 __Pyx_XDECREF(__pyx_t_1);
jpayne@69 6366 __Pyx_AddTraceback("pysam.libcutils.set_encoding_error_handler", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@69 6367 __pyx_r = NULL;
jpayne@69 6368 __pyx_L0:;
jpayne@69 6369 __Pyx_XGIVEREF(__pyx_r);
jpayne@69 6370 __Pyx_RefNannyFinishContext();
jpayne@69 6371 return __pyx_r;
jpayne@69 6372 }
jpayne@69 6373
jpayne@69 6374 /* "pysam/libcutils.pyx":111
jpayne@69 6375 * ########################################################################
jpayne@69 6376 *
jpayne@69 6377 * cdef from_string_and_size(const char* s, size_t length): # <<<<<<<<<<<<<<
jpayne@69 6378 * return s[:length].decode('utf-8', ERROR_HANDLER)
jpayne@69 6379 *
jpayne@69 6380 */
jpayne@69 6381
jpayne@69 6382 static PyObject *__pyx_f_5pysam_9libcutils_from_string_and_size(char const *__pyx_v_s, size_t __pyx_v_length) {
jpayne@69 6383 PyObject *__pyx_r = NULL;
jpayne@69 6384 __Pyx_RefNannyDeclarations
jpayne@69 6385 PyObject *__pyx_t_1 = NULL;
jpayne@69 6386 PyObject *__pyx_t_2 = NULL;
jpayne@69 6387 PyObject *__pyx_t_3 = NULL;
jpayne@69 6388 unsigned int __pyx_t_4;
jpayne@69 6389 int __pyx_lineno = 0;
jpayne@69 6390 const char *__pyx_filename = NULL;
jpayne@69 6391 int __pyx_clineno = 0;
jpayne@69 6392 __Pyx_RefNannySetupContext("from_string_and_size", 1);
jpayne@69 6393
jpayne@69 6394 /* "pysam/libcutils.pyx":112
jpayne@69 6395 *
jpayne@69 6396 * cdef from_string_and_size(const char* s, size_t length):
jpayne@69 6397 * return s[:length].decode('utf-8', ERROR_HANDLER) # <<<<<<<<<<<<<<
jpayne@69 6398 *
jpayne@69 6399 * # filename encoding (adapted from lxml.etree.pyx)
jpayne@69 6400 */
jpayne@69 6401 __Pyx_XDECREF(__pyx_r);
jpayne@69 6402 __pyx_t_2 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_s + 0, __pyx_v_length - 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 112, __pyx_L1_error)
jpayne@69 6403 __Pyx_GOTREF(__pyx_t_2);
jpayne@69 6404 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_decode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 112, __pyx_L1_error)
jpayne@69 6405 __Pyx_GOTREF(__pyx_t_3);
jpayne@69 6406 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@69 6407 __pyx_t_2 = NULL;
jpayne@69 6408 __pyx_t_4 = 0;
jpayne@69 6409 #if CYTHON_UNPACK_METHODS
jpayne@69 6410 if (likely(PyMethod_Check(__pyx_t_3))) {
jpayne@69 6411 __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
jpayne@69 6412 if (likely(__pyx_t_2)) {
jpayne@69 6413 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
jpayne@69 6414 __Pyx_INCREF(__pyx_t_2);
jpayne@69 6415 __Pyx_INCREF(function);
jpayne@69 6416 __Pyx_DECREF_SET(__pyx_t_3, function);
jpayne@69 6417 __pyx_t_4 = 1;
jpayne@69 6418 }
jpayne@69 6419 }
jpayne@69 6420 #endif
jpayne@69 6421 {
jpayne@69 6422 PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_kp_u_utf_8, __pyx_v_5pysam_9libcutils_ERROR_HANDLER};
jpayne@69 6423 __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_4, 2+__pyx_t_4);
jpayne@69 6424 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@69 6425 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 112, __pyx_L1_error)
jpayne@69 6426 __Pyx_GOTREF(__pyx_t_1);
jpayne@69 6427 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@69 6428 }
jpayne@69 6429 __pyx_r = __pyx_t_1;
jpayne@69 6430 __pyx_t_1 = 0;
jpayne@69 6431 goto __pyx_L0;
jpayne@69 6432
jpayne@69 6433 /* "pysam/libcutils.pyx":111
jpayne@69 6434 * ########################################################################
jpayne@69 6435 *
jpayne@69 6436 * cdef from_string_and_size(const char* s, size_t length): # <<<<<<<<<<<<<<
jpayne@69 6437 * return s[:length].decode('utf-8', ERROR_HANDLER)
jpayne@69 6438 *
jpayne@69 6439 */
jpayne@69 6440
jpayne@69 6441 /* function exit code */
jpayne@69 6442 __pyx_L1_error:;
jpayne@69 6443 __Pyx_XDECREF(__pyx_t_1);
jpayne@69 6444 __Pyx_XDECREF(__pyx_t_2);
jpayne@69 6445 __Pyx_XDECREF(__pyx_t_3);
jpayne@69 6446 __Pyx_AddTraceback("pysam.libcutils.from_string_and_size", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@69 6447 __pyx_r = 0;
jpayne@69 6448 __pyx_L0:;
jpayne@69 6449 __Pyx_XGIVEREF(__pyx_r);
jpayne@69 6450 __Pyx_RefNannyFinishContext();
jpayne@69 6451 return __pyx_r;
jpayne@69 6452 }
jpayne@69 6453
jpayne@69 6454 /* "pysam/libcutils.pyx":118
jpayne@69 6455 * cdef str TEXT_ENCODING = 'utf-8'
jpayne@69 6456 *
jpayne@69 6457 * cdef bytes encode_filename(object filename): # <<<<<<<<<<<<<<
jpayne@69 6458 * """Make sure a filename is 8-bit encoded (or None)."""
jpayne@69 6459 * if filename is None:
jpayne@69 6460 */
jpayne@69 6461
jpayne@69 6462 static PyObject *__pyx_f_5pysam_9libcutils_encode_filename(PyObject *__pyx_v_filename) {
jpayne@69 6463 PyObject *__pyx_r = NULL;
jpayne@69 6464 __Pyx_RefNannyDeclarations
jpayne@69 6465 int __pyx_t_1;
jpayne@69 6466 PyObject *__pyx_t_2 = NULL;
jpayne@69 6467 PyObject *__pyx_t_3 = NULL;
jpayne@69 6468 PyObject *__pyx_t_4 = NULL;
jpayne@69 6469 unsigned int __pyx_t_5;
jpayne@69 6470 int __pyx_lineno = 0;
jpayne@69 6471 const char *__pyx_filename = NULL;
jpayne@69 6472 int __pyx_clineno = 0;
jpayne@69 6473 __Pyx_RefNannySetupContext("encode_filename", 1);
jpayne@69 6474
jpayne@69 6475 /* "pysam/libcutils.pyx":120
jpayne@69 6476 * cdef bytes encode_filename(object filename):
jpayne@69 6477 * """Make sure a filename is 8-bit encoded (or None)."""
jpayne@69 6478 * if filename is None: # <<<<<<<<<<<<<<
jpayne@69 6479 * return None
jpayne@69 6480 * return os.fsencode(filename)
jpayne@69 6481 */
jpayne@69 6482 __pyx_t_1 = (__pyx_v_filename == Py_None);
jpayne@69 6483 if (__pyx_t_1) {
jpayne@69 6484
jpayne@69 6485 /* "pysam/libcutils.pyx":121
jpayne@69 6486 * """Make sure a filename is 8-bit encoded (or None)."""
jpayne@69 6487 * if filename is None:
jpayne@69 6488 * return None # <<<<<<<<<<<<<<
jpayne@69 6489 * return os.fsencode(filename)
jpayne@69 6490 *
jpayne@69 6491 */
jpayne@69 6492 __Pyx_XDECREF(__pyx_r);
jpayne@69 6493 __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
jpayne@69 6494 goto __pyx_L0;
jpayne@69 6495
jpayne@69 6496 /* "pysam/libcutils.pyx":120
jpayne@69 6497 * cdef bytes encode_filename(object filename):
jpayne@69 6498 * """Make sure a filename is 8-bit encoded (or None)."""
jpayne@69 6499 * if filename is None: # <<<<<<<<<<<<<<
jpayne@69 6500 * return None
jpayne@69 6501 * return os.fsencode(filename)
jpayne@69 6502 */
jpayne@69 6503 }
jpayne@69 6504
jpayne@69 6505 /* "pysam/libcutils.pyx":122
jpayne@69 6506 * if filename is None:
jpayne@69 6507 * return None
jpayne@69 6508 * return os.fsencode(filename) # <<<<<<<<<<<<<<
jpayne@69 6509 *
jpayne@69 6510 *
jpayne@69 6511 */
jpayne@69 6512 __Pyx_XDECREF(__pyx_r);
jpayne@69 6513 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_os); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 122, __pyx_L1_error)
jpayne@69 6514 __Pyx_GOTREF(__pyx_t_3);
jpayne@69 6515 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_fsencode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 122, __pyx_L1_error)
jpayne@69 6516 __Pyx_GOTREF(__pyx_t_4);
jpayne@69 6517 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@69 6518 __pyx_t_3 = NULL;
jpayne@69 6519 __pyx_t_5 = 0;
jpayne@69 6520 #if CYTHON_UNPACK_METHODS
jpayne@69 6521 if (unlikely(PyMethod_Check(__pyx_t_4))) {
jpayne@69 6522 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
jpayne@69 6523 if (likely(__pyx_t_3)) {
jpayne@69 6524 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
jpayne@69 6525 __Pyx_INCREF(__pyx_t_3);
jpayne@69 6526 __Pyx_INCREF(function);
jpayne@69 6527 __Pyx_DECREF_SET(__pyx_t_4, function);
jpayne@69 6528 __pyx_t_5 = 1;
jpayne@69 6529 }
jpayne@69 6530 }
jpayne@69 6531 #endif
jpayne@69 6532 {
jpayne@69 6533 PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_filename};
jpayne@69 6534 __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
jpayne@69 6535 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@69 6536 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 122, __pyx_L1_error)
jpayne@69 6537 __Pyx_GOTREF(__pyx_t_2);
jpayne@69 6538 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
jpayne@69 6539 }
jpayne@69 6540 if (!(likely(PyBytes_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_2))) __PYX_ERR(0, 122, __pyx_L1_error)
jpayne@69 6541 __pyx_r = ((PyObject*)__pyx_t_2);
jpayne@69 6542 __pyx_t_2 = 0;
jpayne@69 6543 goto __pyx_L0;
jpayne@69 6544
jpayne@69 6545 /* "pysam/libcutils.pyx":118
jpayne@69 6546 * cdef str TEXT_ENCODING = 'utf-8'
jpayne@69 6547 *
jpayne@69 6548 * cdef bytes encode_filename(object filename): # <<<<<<<<<<<<<<
jpayne@69 6549 * """Make sure a filename is 8-bit encoded (or None)."""
jpayne@69 6550 * if filename is None:
jpayne@69 6551 */
jpayne@69 6552
jpayne@69 6553 /* function exit code */
jpayne@69 6554 __pyx_L1_error:;
jpayne@69 6555 __Pyx_XDECREF(__pyx_t_2);
jpayne@69 6556 __Pyx_XDECREF(__pyx_t_3);
jpayne@69 6557 __Pyx_XDECREF(__pyx_t_4);
jpayne@69 6558 __Pyx_AddTraceback("pysam.libcutils.encode_filename", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@69 6559 __pyx_r = 0;
jpayne@69 6560 __pyx_L0:;
jpayne@69 6561 __Pyx_XGIVEREF(__pyx_r);
jpayne@69 6562 __Pyx_RefNannyFinishContext();
jpayne@69 6563 return __pyx_r;
jpayne@69 6564 }
jpayne@69 6565
jpayne@69 6566 /* "pysam/libcutils.pyx":125
jpayne@69 6567 *
jpayne@69 6568 *
jpayne@69 6569 * cdef bytes force_bytes(object s, encoding=None, errors=None): # <<<<<<<<<<<<<<
jpayne@69 6570 * """convert string or unicode object to bytes, assuming
jpayne@69 6571 * utf8 encoding.
jpayne@69 6572 */
jpayne@69 6573
jpayne@69 6574 static PyObject *__pyx_f_5pysam_9libcutils_force_bytes(PyObject *__pyx_v_s, struct __pyx_opt_args_5pysam_9libcutils_force_bytes *__pyx_optional_args) {
jpayne@69 6575 PyObject *__pyx_v_encoding = ((PyObject *)Py_None);
jpayne@69 6576 PyObject *__pyx_v_errors = ((PyObject *)Py_None);
jpayne@69 6577 PyObject *__pyx_r = NULL;
jpayne@69 6578 __Pyx_RefNannyDeclarations
jpayne@69 6579 int __pyx_t_1;
jpayne@69 6580 PyObject *__pyx_t_2 = NULL;
jpayne@69 6581 PyObject *__pyx_t_3 = NULL;
jpayne@69 6582 PyObject *__pyx_t_4 = NULL;
jpayne@69 6583 PyObject *__pyx_t_5 = NULL;
jpayne@69 6584 PyObject *__pyx_t_6 = NULL;
jpayne@69 6585 unsigned int __pyx_t_7;
jpayne@69 6586 int __pyx_lineno = 0;
jpayne@69 6587 const char *__pyx_filename = NULL;
jpayne@69 6588 int __pyx_clineno = 0;
jpayne@69 6589 __Pyx_RefNannySetupContext("force_bytes", 1);
jpayne@69 6590 if (__pyx_optional_args) {
jpayne@69 6591 if (__pyx_optional_args->__pyx_n > 0) {
jpayne@69 6592 __pyx_v_encoding = __pyx_optional_args->encoding;
jpayne@69 6593 if (__pyx_optional_args->__pyx_n > 1) {
jpayne@69 6594 __pyx_v_errors = __pyx_optional_args->errors;
jpayne@69 6595 }
jpayne@69 6596 }
jpayne@69 6597 }
jpayne@69 6598
jpayne@69 6599 /* "pysam/libcutils.pyx":129
jpayne@69 6600 * utf8 encoding.
jpayne@69 6601 * """
jpayne@69 6602 * if s is None: # <<<<<<<<<<<<<<
jpayne@69 6603 * return None
jpayne@69 6604 * elif PyBytes_Check(s):
jpayne@69 6605 */
jpayne@69 6606 __pyx_t_1 = (__pyx_v_s == Py_None);
jpayne@69 6607 if (__pyx_t_1) {
jpayne@69 6608
jpayne@69 6609 /* "pysam/libcutils.pyx":130
jpayne@69 6610 * """
jpayne@69 6611 * if s is None:
jpayne@69 6612 * return None # <<<<<<<<<<<<<<
jpayne@69 6613 * elif PyBytes_Check(s):
jpayne@69 6614 * return s
jpayne@69 6615 */
jpayne@69 6616 __Pyx_XDECREF(__pyx_r);
jpayne@69 6617 __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
jpayne@69 6618 goto __pyx_L0;
jpayne@69 6619
jpayne@69 6620 /* "pysam/libcutils.pyx":129
jpayne@69 6621 * utf8 encoding.
jpayne@69 6622 * """
jpayne@69 6623 * if s is None: # <<<<<<<<<<<<<<
jpayne@69 6624 * return None
jpayne@69 6625 * elif PyBytes_Check(s):
jpayne@69 6626 */
jpayne@69 6627 }
jpayne@69 6628
jpayne@69 6629 /* "pysam/libcutils.pyx":131
jpayne@69 6630 * if s is None:
jpayne@69 6631 * return None
jpayne@69 6632 * elif PyBytes_Check(s): # <<<<<<<<<<<<<<
jpayne@69 6633 * return s
jpayne@69 6634 * elif PyUnicode_Check(s):
jpayne@69 6635 */
jpayne@69 6636 __pyx_t_1 = PyBytes_Check(__pyx_v_s);
jpayne@69 6637 if (__pyx_t_1) {
jpayne@69 6638
jpayne@69 6639 /* "pysam/libcutils.pyx":132
jpayne@69 6640 * return None
jpayne@69 6641 * elif PyBytes_Check(s):
jpayne@69 6642 * return s # <<<<<<<<<<<<<<
jpayne@69 6643 * elif PyUnicode_Check(s):
jpayne@69 6644 * return s.encode(encoding or TEXT_ENCODING, errors or ERROR_HANDLER)
jpayne@69 6645 */
jpayne@69 6646 __Pyx_XDECREF(__pyx_r);
jpayne@69 6647 if (!(likely(PyBytes_CheckExact(__pyx_v_s))||((__pyx_v_s) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_v_s))) __PYX_ERR(0, 132, __pyx_L1_error)
jpayne@69 6648 __Pyx_INCREF(__pyx_v_s);
jpayne@69 6649 __pyx_r = ((PyObject*)__pyx_v_s);
jpayne@69 6650 goto __pyx_L0;
jpayne@69 6651
jpayne@69 6652 /* "pysam/libcutils.pyx":131
jpayne@69 6653 * if s is None:
jpayne@69 6654 * return None
jpayne@69 6655 * elif PyBytes_Check(s): # <<<<<<<<<<<<<<
jpayne@69 6656 * return s
jpayne@69 6657 * elif PyUnicode_Check(s):
jpayne@69 6658 */
jpayne@69 6659 }
jpayne@69 6660
jpayne@69 6661 /* "pysam/libcutils.pyx":133
jpayne@69 6662 * elif PyBytes_Check(s):
jpayne@69 6663 * return s
jpayne@69 6664 * elif PyUnicode_Check(s): # <<<<<<<<<<<<<<
jpayne@69 6665 * return s.encode(encoding or TEXT_ENCODING, errors or ERROR_HANDLER)
jpayne@69 6666 * else:
jpayne@69 6667 */
jpayne@69 6668 __pyx_t_1 = PyUnicode_Check(__pyx_v_s);
jpayne@69 6669 if (likely(__pyx_t_1)) {
jpayne@69 6670
jpayne@69 6671 /* "pysam/libcutils.pyx":134
jpayne@69 6672 * return s
jpayne@69 6673 * elif PyUnicode_Check(s):
jpayne@69 6674 * return s.encode(encoding or TEXT_ENCODING, errors or ERROR_HANDLER) # <<<<<<<<<<<<<<
jpayne@69 6675 * else:
jpayne@69 6676 * raise TypeError("Argument must be string, bytes or unicode.")
jpayne@69 6677 */
jpayne@69 6678 __Pyx_XDECREF(__pyx_r);
jpayne@69 6679 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_s, __pyx_n_s_encode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 134, __pyx_L1_error)
jpayne@69 6680 __Pyx_GOTREF(__pyx_t_3);
jpayne@69 6681 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_encoding); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 134, __pyx_L1_error)
jpayne@69 6682 if (!__pyx_t_1) {
jpayne@69 6683 } else {
jpayne@69 6684 __Pyx_INCREF(__pyx_v_encoding);
jpayne@69 6685 __pyx_t_4 = __pyx_v_encoding;
jpayne@69 6686 goto __pyx_L4_bool_binop_done;
jpayne@69 6687 }
jpayne@69 6688 __Pyx_INCREF(__pyx_v_5pysam_9libcutils_TEXT_ENCODING);
jpayne@69 6689 __pyx_t_4 = __pyx_v_5pysam_9libcutils_TEXT_ENCODING;
jpayne@69 6690 __pyx_L4_bool_binop_done:;
jpayne@69 6691 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_errors); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 134, __pyx_L1_error)
jpayne@69 6692 if (!__pyx_t_1) {
jpayne@69 6693 } else {
jpayne@69 6694 __Pyx_INCREF(__pyx_v_errors);
jpayne@69 6695 __pyx_t_5 = __pyx_v_errors;
jpayne@69 6696 goto __pyx_L6_bool_binop_done;
jpayne@69 6697 }
jpayne@69 6698 __Pyx_INCREF(__pyx_v_5pysam_9libcutils_ERROR_HANDLER);
jpayne@69 6699 __pyx_t_5 = __pyx_v_5pysam_9libcutils_ERROR_HANDLER;
jpayne@69 6700 __pyx_L6_bool_binop_done:;
jpayne@69 6701 __pyx_t_6 = NULL;
jpayne@69 6702 __pyx_t_7 = 0;
jpayne@69 6703 #if CYTHON_UNPACK_METHODS
jpayne@69 6704 if (likely(PyMethod_Check(__pyx_t_3))) {
jpayne@69 6705 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
jpayne@69 6706 if (likely(__pyx_t_6)) {
jpayne@69 6707 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
jpayne@69 6708 __Pyx_INCREF(__pyx_t_6);
jpayne@69 6709 __Pyx_INCREF(function);
jpayne@69 6710 __Pyx_DECREF_SET(__pyx_t_3, function);
jpayne@69 6711 __pyx_t_7 = 1;
jpayne@69 6712 }
jpayne@69 6713 }
jpayne@69 6714 #endif
jpayne@69 6715 {
jpayne@69 6716 PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_t_4, __pyx_t_5};
jpayne@69 6717 __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_7, 2+__pyx_t_7);
jpayne@69 6718 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
jpayne@69 6719 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
jpayne@69 6720 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
jpayne@69 6721 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 134, __pyx_L1_error)
jpayne@69 6722 __Pyx_GOTREF(__pyx_t_2);
jpayne@69 6723 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@69 6724 }
jpayne@69 6725 if (!(likely(PyBytes_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_2))) __PYX_ERR(0, 134, __pyx_L1_error)
jpayne@69 6726 __pyx_r = ((PyObject*)__pyx_t_2);
jpayne@69 6727 __pyx_t_2 = 0;
jpayne@69 6728 goto __pyx_L0;
jpayne@69 6729
jpayne@69 6730 /* "pysam/libcutils.pyx":133
jpayne@69 6731 * elif PyBytes_Check(s):
jpayne@69 6732 * return s
jpayne@69 6733 * elif PyUnicode_Check(s): # <<<<<<<<<<<<<<
jpayne@69 6734 * return s.encode(encoding or TEXT_ENCODING, errors or ERROR_HANDLER)
jpayne@69 6735 * else:
jpayne@69 6736 */
jpayne@69 6737 }
jpayne@69 6738
jpayne@69 6739 /* "pysam/libcutils.pyx":136
jpayne@69 6740 * return s.encode(encoding or TEXT_ENCODING, errors or ERROR_HANDLER)
jpayne@69 6741 * else:
jpayne@69 6742 * raise TypeError("Argument must be string, bytes or unicode.") # <<<<<<<<<<<<<<
jpayne@69 6743 *
jpayne@69 6744 *
jpayne@69 6745 */
jpayne@69 6746 /*else*/ {
jpayne@69 6747 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 136, __pyx_L1_error)
jpayne@69 6748 __Pyx_GOTREF(__pyx_t_2);
jpayne@69 6749 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
jpayne@69 6750 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@69 6751 __PYX_ERR(0, 136, __pyx_L1_error)
jpayne@69 6752 }
jpayne@69 6753
jpayne@69 6754 /* "pysam/libcutils.pyx":125
jpayne@69 6755 *
jpayne@69 6756 *
jpayne@69 6757 * cdef bytes force_bytes(object s, encoding=None, errors=None): # <<<<<<<<<<<<<<
jpayne@69 6758 * """convert string or unicode object to bytes, assuming
jpayne@69 6759 * utf8 encoding.
jpayne@69 6760 */
jpayne@69 6761
jpayne@69 6762 /* function exit code */
jpayne@69 6763 __pyx_L1_error:;
jpayne@69 6764 __Pyx_XDECREF(__pyx_t_2);
jpayne@69 6765 __Pyx_XDECREF(__pyx_t_3);
jpayne@69 6766 __Pyx_XDECREF(__pyx_t_4);
jpayne@69 6767 __Pyx_XDECREF(__pyx_t_5);
jpayne@69 6768 __Pyx_XDECREF(__pyx_t_6);
jpayne@69 6769 __Pyx_AddTraceback("pysam.libcutils.force_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@69 6770 __pyx_r = 0;
jpayne@69 6771 __pyx_L0:;
jpayne@69 6772 __Pyx_XGIVEREF(__pyx_r);
jpayne@69 6773 __Pyx_RefNannyFinishContext();
jpayne@69 6774 return __pyx_r;
jpayne@69 6775 }
jpayne@69 6776
jpayne@69 6777 /* "pysam/libcutils.pyx":139
jpayne@69 6778 *
jpayne@69 6779 *
jpayne@69 6780 * cdef charptr_to_str(const char* s, encoding=None, errors=None): # <<<<<<<<<<<<<<
jpayne@69 6781 * if s == NULL:
jpayne@69 6782 * return None
jpayne@69 6783 */
jpayne@69 6784
jpayne@69 6785 static PyObject *__pyx_f_5pysam_9libcutils_charptr_to_str(char const *__pyx_v_s, struct __pyx_opt_args_5pysam_9libcutils_charptr_to_str *__pyx_optional_args) {
jpayne@69 6786 PyObject *__pyx_v_encoding = ((PyObject *)Py_None);
jpayne@69 6787 PyObject *__pyx_v_errors = ((PyObject *)Py_None);
jpayne@69 6788 PyObject *__pyx_r = NULL;
jpayne@69 6789 __Pyx_RefNannyDeclarations
jpayne@69 6790 int __pyx_t_1;
jpayne@69 6791 PyObject *__pyx_t_2 = NULL;
jpayne@69 6792 PyObject *__pyx_t_3 = NULL;
jpayne@69 6793 PyObject *__pyx_t_4 = NULL;
jpayne@69 6794 PyObject *__pyx_t_5 = NULL;
jpayne@69 6795 PyObject *__pyx_t_6 = NULL;
jpayne@69 6796 unsigned int __pyx_t_7;
jpayne@69 6797 int __pyx_lineno = 0;
jpayne@69 6798 const char *__pyx_filename = NULL;
jpayne@69 6799 int __pyx_clineno = 0;
jpayne@69 6800 __Pyx_RefNannySetupContext("charptr_to_str", 1);
jpayne@69 6801 if (__pyx_optional_args) {
jpayne@69 6802 if (__pyx_optional_args->__pyx_n > 0) {
jpayne@69 6803 __pyx_v_encoding = __pyx_optional_args->encoding;
jpayne@69 6804 if (__pyx_optional_args->__pyx_n > 1) {
jpayne@69 6805 __pyx_v_errors = __pyx_optional_args->errors;
jpayne@69 6806 }
jpayne@69 6807 }
jpayne@69 6808 }
jpayne@69 6809
jpayne@69 6810 /* "pysam/libcutils.pyx":140
jpayne@69 6811 *
jpayne@69 6812 * cdef charptr_to_str(const char* s, encoding=None, errors=None):
jpayne@69 6813 * if s == NULL: # <<<<<<<<<<<<<<
jpayne@69 6814 * return None
jpayne@69 6815 * return s.decode(encoding or TEXT_ENCODING, errors or ERROR_HANDLER)
jpayne@69 6816 */
jpayne@69 6817 __pyx_t_1 = (__pyx_v_s == NULL);
jpayne@69 6818 if (__pyx_t_1) {
jpayne@69 6819
jpayne@69 6820 /* "pysam/libcutils.pyx":141
jpayne@69 6821 * cdef charptr_to_str(const char* s, encoding=None, errors=None):
jpayne@69 6822 * if s == NULL:
jpayne@69 6823 * return None # <<<<<<<<<<<<<<
jpayne@69 6824 * return s.decode(encoding or TEXT_ENCODING, errors or ERROR_HANDLER)
jpayne@69 6825 *
jpayne@69 6826 */
jpayne@69 6827 __Pyx_XDECREF(__pyx_r);
jpayne@69 6828 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
jpayne@69 6829 goto __pyx_L0;
jpayne@69 6830
jpayne@69 6831 /* "pysam/libcutils.pyx":140
jpayne@69 6832 *
jpayne@69 6833 * cdef charptr_to_str(const char* s, encoding=None, errors=None):
jpayne@69 6834 * if s == NULL: # <<<<<<<<<<<<<<
jpayne@69 6835 * return None
jpayne@69 6836 * return s.decode(encoding or TEXT_ENCODING, errors or ERROR_HANDLER)
jpayne@69 6837 */
jpayne@69 6838 }
jpayne@69 6839
jpayne@69 6840 /* "pysam/libcutils.pyx":142
jpayne@69 6841 * if s == NULL:
jpayne@69 6842 * return None
jpayne@69 6843 * return s.decode(encoding or TEXT_ENCODING, errors or ERROR_HANDLER) # <<<<<<<<<<<<<<
jpayne@69 6844 *
jpayne@69 6845 *
jpayne@69 6846 */
jpayne@69 6847 __Pyx_XDECREF(__pyx_r);
jpayne@69 6848 __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_s); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 142, __pyx_L1_error)
jpayne@69 6849 __Pyx_GOTREF(__pyx_t_3);
jpayne@69 6850 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_decode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 142, __pyx_L1_error)
jpayne@69 6851 __Pyx_GOTREF(__pyx_t_4);
jpayne@69 6852 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@69 6853 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_encoding); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 142, __pyx_L1_error)
jpayne@69 6854 if (!__pyx_t_1) {
jpayne@69 6855 } else {
jpayne@69 6856 __Pyx_INCREF(__pyx_v_encoding);
jpayne@69 6857 __pyx_t_3 = __pyx_v_encoding;
jpayne@69 6858 goto __pyx_L4_bool_binop_done;
jpayne@69 6859 }
jpayne@69 6860 __Pyx_INCREF(__pyx_v_5pysam_9libcutils_TEXT_ENCODING);
jpayne@69 6861 __pyx_t_3 = __pyx_v_5pysam_9libcutils_TEXT_ENCODING;
jpayne@69 6862 __pyx_L4_bool_binop_done:;
jpayne@69 6863 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_errors); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 142, __pyx_L1_error)
jpayne@69 6864 if (!__pyx_t_1) {
jpayne@69 6865 } else {
jpayne@69 6866 __Pyx_INCREF(__pyx_v_errors);
jpayne@69 6867 __pyx_t_5 = __pyx_v_errors;
jpayne@69 6868 goto __pyx_L6_bool_binop_done;
jpayne@69 6869 }
jpayne@69 6870 __Pyx_INCREF(__pyx_v_5pysam_9libcutils_ERROR_HANDLER);
jpayne@69 6871 __pyx_t_5 = __pyx_v_5pysam_9libcutils_ERROR_HANDLER;
jpayne@69 6872 __pyx_L6_bool_binop_done:;
jpayne@69 6873 __pyx_t_6 = NULL;
jpayne@69 6874 __pyx_t_7 = 0;
jpayne@69 6875 #if CYTHON_UNPACK_METHODS
jpayne@69 6876 if (likely(PyMethod_Check(__pyx_t_4))) {
jpayne@69 6877 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
jpayne@69 6878 if (likely(__pyx_t_6)) {
jpayne@69 6879 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
jpayne@69 6880 __Pyx_INCREF(__pyx_t_6);
jpayne@69 6881 __Pyx_INCREF(function);
jpayne@69 6882 __Pyx_DECREF_SET(__pyx_t_4, function);
jpayne@69 6883 __pyx_t_7 = 1;
jpayne@69 6884 }
jpayne@69 6885 }
jpayne@69 6886 #endif
jpayne@69 6887 {
jpayne@69 6888 PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_t_3, __pyx_t_5};
jpayne@69 6889 __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_7, 2+__pyx_t_7);
jpayne@69 6890 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
jpayne@69 6891 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@69 6892 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
jpayne@69 6893 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 142, __pyx_L1_error)
jpayne@69 6894 __Pyx_GOTREF(__pyx_t_2);
jpayne@69 6895 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
jpayne@69 6896 }
jpayne@69 6897 __pyx_r = __pyx_t_2;
jpayne@69 6898 __pyx_t_2 = 0;
jpayne@69 6899 goto __pyx_L0;
jpayne@69 6900
jpayne@69 6901 /* "pysam/libcutils.pyx":139
jpayne@69 6902 *
jpayne@69 6903 *
jpayne@69 6904 * cdef charptr_to_str(const char* s, encoding=None, errors=None): # <<<<<<<<<<<<<<
jpayne@69 6905 * if s == NULL:
jpayne@69 6906 * return None
jpayne@69 6907 */
jpayne@69 6908
jpayne@69 6909 /* function exit code */
jpayne@69 6910 __pyx_L1_error:;
jpayne@69 6911 __Pyx_XDECREF(__pyx_t_2);
jpayne@69 6912 __Pyx_XDECREF(__pyx_t_3);
jpayne@69 6913 __Pyx_XDECREF(__pyx_t_4);
jpayne@69 6914 __Pyx_XDECREF(__pyx_t_5);
jpayne@69 6915 __Pyx_XDECREF(__pyx_t_6);
jpayne@69 6916 __Pyx_AddTraceback("pysam.libcutils.charptr_to_str", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@69 6917 __pyx_r = 0;
jpayne@69 6918 __pyx_L0:;
jpayne@69 6919 __Pyx_XGIVEREF(__pyx_r);
jpayne@69 6920 __Pyx_RefNannyFinishContext();
jpayne@69 6921 return __pyx_r;
jpayne@69 6922 }
jpayne@69 6923
jpayne@69 6924 /* "pysam/libcutils.pyx":145
jpayne@69 6925 *
jpayne@69 6926 *
jpayne@69 6927 * cdef charptr_to_str_w_len(const char* s, size_t n, encoding=None, errors=None): # <<<<<<<<<<<<<<
jpayne@69 6928 * if s == NULL:
jpayne@69 6929 * return None
jpayne@69 6930 */
jpayne@69 6931
jpayne@69 6932 static PyObject *__pyx_f_5pysam_9libcutils_charptr_to_str_w_len(char const *__pyx_v_s, size_t __pyx_v_n, struct __pyx_opt_args_5pysam_9libcutils_charptr_to_str_w_len *__pyx_optional_args) {
jpayne@69 6933 PyObject *__pyx_v_encoding = ((PyObject *)Py_None);
jpayne@69 6934 PyObject *__pyx_v_errors = ((PyObject *)Py_None);
jpayne@69 6935 PyObject *__pyx_r = NULL;
jpayne@69 6936 __Pyx_RefNannyDeclarations
jpayne@69 6937 int __pyx_t_1;
jpayne@69 6938 PyObject *__pyx_t_2 = NULL;
jpayne@69 6939 PyObject *__pyx_t_3 = NULL;
jpayne@69 6940 PyObject *__pyx_t_4 = NULL;
jpayne@69 6941 PyObject *__pyx_t_5 = NULL;
jpayne@69 6942 PyObject *__pyx_t_6 = NULL;
jpayne@69 6943 unsigned int __pyx_t_7;
jpayne@69 6944 int __pyx_lineno = 0;
jpayne@69 6945 const char *__pyx_filename = NULL;
jpayne@69 6946 int __pyx_clineno = 0;
jpayne@69 6947 __Pyx_RefNannySetupContext("charptr_to_str_w_len", 1);
jpayne@69 6948 if (__pyx_optional_args) {
jpayne@69 6949 if (__pyx_optional_args->__pyx_n > 0) {
jpayne@69 6950 __pyx_v_encoding = __pyx_optional_args->encoding;
jpayne@69 6951 if (__pyx_optional_args->__pyx_n > 1) {
jpayne@69 6952 __pyx_v_errors = __pyx_optional_args->errors;
jpayne@69 6953 }
jpayne@69 6954 }
jpayne@69 6955 }
jpayne@69 6956
jpayne@69 6957 /* "pysam/libcutils.pyx":146
jpayne@69 6958 *
jpayne@69 6959 * cdef charptr_to_str_w_len(const char* s, size_t n, encoding=None, errors=None):
jpayne@69 6960 * if s == NULL: # <<<<<<<<<<<<<<
jpayne@69 6961 * return None
jpayne@69 6962 * return s[:n].decode(encoding or TEXT_ENCODING, errors or ERROR_HANDLER)
jpayne@69 6963 */
jpayne@69 6964 __pyx_t_1 = (__pyx_v_s == NULL);
jpayne@69 6965 if (__pyx_t_1) {
jpayne@69 6966
jpayne@69 6967 /* "pysam/libcutils.pyx":147
jpayne@69 6968 * cdef charptr_to_str_w_len(const char* s, size_t n, encoding=None, errors=None):
jpayne@69 6969 * if s == NULL:
jpayne@69 6970 * return None # <<<<<<<<<<<<<<
jpayne@69 6971 * return s[:n].decode(encoding or TEXT_ENCODING, errors or ERROR_HANDLER)
jpayne@69 6972 *
jpayne@69 6973 */
jpayne@69 6974 __Pyx_XDECREF(__pyx_r);
jpayne@69 6975 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
jpayne@69 6976 goto __pyx_L0;
jpayne@69 6977
jpayne@69 6978 /* "pysam/libcutils.pyx":146
jpayne@69 6979 *
jpayne@69 6980 * cdef charptr_to_str_w_len(const char* s, size_t n, encoding=None, errors=None):
jpayne@69 6981 * if s == NULL: # <<<<<<<<<<<<<<
jpayne@69 6982 * return None
jpayne@69 6983 * return s[:n].decode(encoding or TEXT_ENCODING, errors or ERROR_HANDLER)
jpayne@69 6984 */
jpayne@69 6985 }
jpayne@69 6986
jpayne@69 6987 /* "pysam/libcutils.pyx":148
jpayne@69 6988 * if s == NULL:
jpayne@69 6989 * return None
jpayne@69 6990 * return s[:n].decode(encoding or TEXT_ENCODING, errors or ERROR_HANDLER) # <<<<<<<<<<<<<<
jpayne@69 6991 *
jpayne@69 6992 *
jpayne@69 6993 */
jpayne@69 6994 __Pyx_XDECREF(__pyx_r);
jpayne@69 6995 __pyx_t_3 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_s + 0, __pyx_v_n - 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 148, __pyx_L1_error)
jpayne@69 6996 __Pyx_GOTREF(__pyx_t_3);
jpayne@69 6997 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_decode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 148, __pyx_L1_error)
jpayne@69 6998 __Pyx_GOTREF(__pyx_t_4);
jpayne@69 6999 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@69 7000 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_encoding); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 148, __pyx_L1_error)
jpayne@69 7001 if (!__pyx_t_1) {
jpayne@69 7002 } else {
jpayne@69 7003 __Pyx_INCREF(__pyx_v_encoding);
jpayne@69 7004 __pyx_t_3 = __pyx_v_encoding;
jpayne@69 7005 goto __pyx_L4_bool_binop_done;
jpayne@69 7006 }
jpayne@69 7007 __Pyx_INCREF(__pyx_v_5pysam_9libcutils_TEXT_ENCODING);
jpayne@69 7008 __pyx_t_3 = __pyx_v_5pysam_9libcutils_TEXT_ENCODING;
jpayne@69 7009 __pyx_L4_bool_binop_done:;
jpayne@69 7010 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_errors); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 148, __pyx_L1_error)
jpayne@69 7011 if (!__pyx_t_1) {
jpayne@69 7012 } else {
jpayne@69 7013 __Pyx_INCREF(__pyx_v_errors);
jpayne@69 7014 __pyx_t_5 = __pyx_v_errors;
jpayne@69 7015 goto __pyx_L6_bool_binop_done;
jpayne@69 7016 }
jpayne@69 7017 __Pyx_INCREF(__pyx_v_5pysam_9libcutils_ERROR_HANDLER);
jpayne@69 7018 __pyx_t_5 = __pyx_v_5pysam_9libcutils_ERROR_HANDLER;
jpayne@69 7019 __pyx_L6_bool_binop_done:;
jpayne@69 7020 __pyx_t_6 = NULL;
jpayne@69 7021 __pyx_t_7 = 0;
jpayne@69 7022 #if CYTHON_UNPACK_METHODS
jpayne@69 7023 if (likely(PyMethod_Check(__pyx_t_4))) {
jpayne@69 7024 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
jpayne@69 7025 if (likely(__pyx_t_6)) {
jpayne@69 7026 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
jpayne@69 7027 __Pyx_INCREF(__pyx_t_6);
jpayne@69 7028 __Pyx_INCREF(function);
jpayne@69 7029 __Pyx_DECREF_SET(__pyx_t_4, function);
jpayne@69 7030 __pyx_t_7 = 1;
jpayne@69 7031 }
jpayne@69 7032 }
jpayne@69 7033 #endif
jpayne@69 7034 {
jpayne@69 7035 PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_t_3, __pyx_t_5};
jpayne@69 7036 __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_7, 2+__pyx_t_7);
jpayne@69 7037 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
jpayne@69 7038 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@69 7039 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
jpayne@69 7040 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 148, __pyx_L1_error)
jpayne@69 7041 __Pyx_GOTREF(__pyx_t_2);
jpayne@69 7042 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
jpayne@69 7043 }
jpayne@69 7044 __pyx_r = __pyx_t_2;
jpayne@69 7045 __pyx_t_2 = 0;
jpayne@69 7046 goto __pyx_L0;
jpayne@69 7047
jpayne@69 7048 /* "pysam/libcutils.pyx":145
jpayne@69 7049 *
jpayne@69 7050 *
jpayne@69 7051 * cdef charptr_to_str_w_len(const char* s, size_t n, encoding=None, errors=None): # <<<<<<<<<<<<<<
jpayne@69 7052 * if s == NULL:
jpayne@69 7053 * return None
jpayne@69 7054 */
jpayne@69 7055
jpayne@69 7056 /* function exit code */
jpayne@69 7057 __pyx_L1_error:;
jpayne@69 7058 __Pyx_XDECREF(__pyx_t_2);
jpayne@69 7059 __Pyx_XDECREF(__pyx_t_3);
jpayne@69 7060 __Pyx_XDECREF(__pyx_t_4);
jpayne@69 7061 __Pyx_XDECREF(__pyx_t_5);
jpayne@69 7062 __Pyx_XDECREF(__pyx_t_6);
jpayne@69 7063 __Pyx_AddTraceback("pysam.libcutils.charptr_to_str_w_len", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@69 7064 __pyx_r = 0;
jpayne@69 7065 __pyx_L0:;
jpayne@69 7066 __Pyx_XGIVEREF(__pyx_r);
jpayne@69 7067 __Pyx_RefNannyFinishContext();
jpayne@69 7068 return __pyx_r;
jpayne@69 7069 }
jpayne@69 7070
jpayne@69 7071 /* "pysam/libcutils.pyx":151
jpayne@69 7072 *
jpayne@69 7073 *
jpayne@69 7074 * cdef bytes charptr_to_bytes(const char* s, encoding=None, errors=None): # <<<<<<<<<<<<<<
jpayne@69 7075 * if s == NULL:
jpayne@69 7076 * return None
jpayne@69 7077 */
jpayne@69 7078
jpayne@69 7079 static PyObject *__pyx_f_5pysam_9libcutils_charptr_to_bytes(char const *__pyx_v_s, struct __pyx_opt_args_5pysam_9libcutils_charptr_to_bytes *__pyx_optional_args) {
jpayne@69 7080 PyObject *__pyx_r = NULL;
jpayne@69 7081 __Pyx_RefNannyDeclarations
jpayne@69 7082 int __pyx_t_1;
jpayne@69 7083 PyObject *__pyx_t_2 = NULL;
jpayne@69 7084 int __pyx_lineno = 0;
jpayne@69 7085 const char *__pyx_filename = NULL;
jpayne@69 7086 int __pyx_clineno = 0;
jpayne@69 7087 __Pyx_RefNannySetupContext("charptr_to_bytes", 1);
jpayne@69 7088 if (__pyx_optional_args) {
jpayne@69 7089 }
jpayne@69 7090
jpayne@69 7091 /* "pysam/libcutils.pyx":152
jpayne@69 7092 *
jpayne@69 7093 * cdef bytes charptr_to_bytes(const char* s, encoding=None, errors=None):
jpayne@69 7094 * if s == NULL: # <<<<<<<<<<<<<<
jpayne@69 7095 * return None
jpayne@69 7096 * else:
jpayne@69 7097 */
jpayne@69 7098 __pyx_t_1 = (__pyx_v_s == NULL);
jpayne@69 7099 if (__pyx_t_1) {
jpayne@69 7100
jpayne@69 7101 /* "pysam/libcutils.pyx":153
jpayne@69 7102 * cdef bytes charptr_to_bytes(const char* s, encoding=None, errors=None):
jpayne@69 7103 * if s == NULL:
jpayne@69 7104 * return None # <<<<<<<<<<<<<<
jpayne@69 7105 * else:
jpayne@69 7106 * return s
jpayne@69 7107 */
jpayne@69 7108 __Pyx_XDECREF(__pyx_r);
jpayne@69 7109 __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
jpayne@69 7110 goto __pyx_L0;
jpayne@69 7111
jpayne@69 7112 /* "pysam/libcutils.pyx":152
jpayne@69 7113 *
jpayne@69 7114 * cdef bytes charptr_to_bytes(const char* s, encoding=None, errors=None):
jpayne@69 7115 * if s == NULL: # <<<<<<<<<<<<<<
jpayne@69 7116 * return None
jpayne@69 7117 * else:
jpayne@69 7118 */
jpayne@69 7119 }
jpayne@69 7120
jpayne@69 7121 /* "pysam/libcutils.pyx":155
jpayne@69 7122 * return None
jpayne@69 7123 * else:
jpayne@69 7124 * return s # <<<<<<<<<<<<<<
jpayne@69 7125 *
jpayne@69 7126 *
jpayne@69 7127 */
jpayne@69 7128 /*else*/ {
jpayne@69 7129 __Pyx_XDECREF(__pyx_r);
jpayne@69 7130 __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v_s); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 155, __pyx_L1_error)
jpayne@69 7131 __Pyx_GOTREF(__pyx_t_2);
jpayne@69 7132 __pyx_r = ((PyObject*)__pyx_t_2);
jpayne@69 7133 __pyx_t_2 = 0;
jpayne@69 7134 goto __pyx_L0;
jpayne@69 7135 }
jpayne@69 7136
jpayne@69 7137 /* "pysam/libcutils.pyx":151
jpayne@69 7138 *
jpayne@69 7139 *
jpayne@69 7140 * cdef bytes charptr_to_bytes(const char* s, encoding=None, errors=None): # <<<<<<<<<<<<<<
jpayne@69 7141 * if s == NULL:
jpayne@69 7142 * return None
jpayne@69 7143 */
jpayne@69 7144
jpayne@69 7145 /* function exit code */
jpayne@69 7146 __pyx_L1_error:;
jpayne@69 7147 __Pyx_XDECREF(__pyx_t_2);
jpayne@69 7148 __Pyx_AddTraceback("pysam.libcutils.charptr_to_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@69 7149 __pyx_r = 0;
jpayne@69 7150 __pyx_L0:;
jpayne@69 7151 __Pyx_XGIVEREF(__pyx_r);
jpayne@69 7152 __Pyx_RefNannyFinishContext();
jpayne@69 7153 return __pyx_r;
jpayne@69 7154 }
jpayne@69 7155
jpayne@69 7156 /* "pysam/libcutils.pyx":158
jpayne@69 7157 *
jpayne@69 7158 *
jpayne@69 7159 * cdef force_str(object s, encoding=None, errors=None): # <<<<<<<<<<<<<<
jpayne@69 7160 * """Return s converted to str type of current Python
jpayne@69 7161 * (bytes in Py2, unicode in Py3)"""
jpayne@69 7162 */
jpayne@69 7163
jpayne@69 7164 static PyObject *__pyx_f_5pysam_9libcutils_force_str(PyObject *__pyx_v_s, struct __pyx_opt_args_5pysam_9libcutils_force_str *__pyx_optional_args) {
jpayne@69 7165 PyObject *__pyx_v_encoding = ((PyObject *)Py_None);
jpayne@69 7166 PyObject *__pyx_v_errors = ((PyObject *)Py_None);
jpayne@69 7167 PyObject *__pyx_r = NULL;
jpayne@69 7168 __Pyx_RefNannyDeclarations
jpayne@69 7169 int __pyx_t_1;
jpayne@69 7170 PyObject *__pyx_t_2 = NULL;
jpayne@69 7171 PyObject *__pyx_t_3 = NULL;
jpayne@69 7172 PyObject *__pyx_t_4 = NULL;
jpayne@69 7173 PyObject *__pyx_t_5 = NULL;
jpayne@69 7174 PyObject *__pyx_t_6 = NULL;
jpayne@69 7175 unsigned int __pyx_t_7;
jpayne@69 7176 int __pyx_lineno = 0;
jpayne@69 7177 const char *__pyx_filename = NULL;
jpayne@69 7178 int __pyx_clineno = 0;
jpayne@69 7179 __Pyx_RefNannySetupContext("force_str", 1);
jpayne@69 7180 if (__pyx_optional_args) {
jpayne@69 7181 if (__pyx_optional_args->__pyx_n > 0) {
jpayne@69 7182 __pyx_v_encoding = __pyx_optional_args->encoding;
jpayne@69 7183 if (__pyx_optional_args->__pyx_n > 1) {
jpayne@69 7184 __pyx_v_errors = __pyx_optional_args->errors;
jpayne@69 7185 }
jpayne@69 7186 }
jpayne@69 7187 }
jpayne@69 7188
jpayne@69 7189 /* "pysam/libcutils.pyx":161
jpayne@69 7190 * """Return s converted to str type of current Python
jpayne@69 7191 * (bytes in Py2, unicode in Py3)"""
jpayne@69 7192 * if s is None: # <<<<<<<<<<<<<<
jpayne@69 7193 * return None
jpayne@69 7194 * if PyBytes_Check(s):
jpayne@69 7195 */
jpayne@69 7196 __pyx_t_1 = (__pyx_v_s == Py_None);
jpayne@69 7197 if (__pyx_t_1) {
jpayne@69 7198
jpayne@69 7199 /* "pysam/libcutils.pyx":162
jpayne@69 7200 * (bytes in Py2, unicode in Py3)"""
jpayne@69 7201 * if s is None:
jpayne@69 7202 * return None # <<<<<<<<<<<<<<
jpayne@69 7203 * if PyBytes_Check(s):
jpayne@69 7204 * return s.decode(encoding or TEXT_ENCODING, errors or ERROR_HANDLER)
jpayne@69 7205 */
jpayne@69 7206 __Pyx_XDECREF(__pyx_r);
jpayne@69 7207 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
jpayne@69 7208 goto __pyx_L0;
jpayne@69 7209
jpayne@69 7210 /* "pysam/libcutils.pyx":161
jpayne@69 7211 * """Return s converted to str type of current Python
jpayne@69 7212 * (bytes in Py2, unicode in Py3)"""
jpayne@69 7213 * if s is None: # <<<<<<<<<<<<<<
jpayne@69 7214 * return None
jpayne@69 7215 * if PyBytes_Check(s):
jpayne@69 7216 */
jpayne@69 7217 }
jpayne@69 7218
jpayne@69 7219 /* "pysam/libcutils.pyx":163
jpayne@69 7220 * if s is None:
jpayne@69 7221 * return None
jpayne@69 7222 * if PyBytes_Check(s): # <<<<<<<<<<<<<<
jpayne@69 7223 * return s.decode(encoding or TEXT_ENCODING, errors or ERROR_HANDLER)
jpayne@69 7224 * # assume unicode
jpayne@69 7225 */
jpayne@69 7226 __pyx_t_1 = PyBytes_Check(__pyx_v_s);
jpayne@69 7227 if (__pyx_t_1) {
jpayne@69 7228
jpayne@69 7229 /* "pysam/libcutils.pyx":164
jpayne@69 7230 * return None
jpayne@69 7231 * if PyBytes_Check(s):
jpayne@69 7232 * return s.decode(encoding or TEXT_ENCODING, errors or ERROR_HANDLER) # <<<<<<<<<<<<<<
jpayne@69 7233 * # assume unicode
jpayne@69 7234 * return s
jpayne@69 7235 */
jpayne@69 7236 __Pyx_XDECREF(__pyx_r);
jpayne@69 7237 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_s, __pyx_n_s_decode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 164, __pyx_L1_error)
jpayne@69 7238 __Pyx_GOTREF(__pyx_t_3);
jpayne@69 7239 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_encoding); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 164, __pyx_L1_error)
jpayne@69 7240 if (!__pyx_t_1) {
jpayne@69 7241 } else {
jpayne@69 7242 __Pyx_INCREF(__pyx_v_encoding);
jpayne@69 7243 __pyx_t_4 = __pyx_v_encoding;
jpayne@69 7244 goto __pyx_L5_bool_binop_done;
jpayne@69 7245 }
jpayne@69 7246 __Pyx_INCREF(__pyx_v_5pysam_9libcutils_TEXT_ENCODING);
jpayne@69 7247 __pyx_t_4 = __pyx_v_5pysam_9libcutils_TEXT_ENCODING;
jpayne@69 7248 __pyx_L5_bool_binop_done:;
jpayne@69 7249 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_errors); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 164, __pyx_L1_error)
jpayne@69 7250 if (!__pyx_t_1) {
jpayne@69 7251 } else {
jpayne@69 7252 __Pyx_INCREF(__pyx_v_errors);
jpayne@69 7253 __pyx_t_5 = __pyx_v_errors;
jpayne@69 7254 goto __pyx_L7_bool_binop_done;
jpayne@69 7255 }
jpayne@69 7256 __Pyx_INCREF(__pyx_v_5pysam_9libcutils_ERROR_HANDLER);
jpayne@69 7257 __pyx_t_5 = __pyx_v_5pysam_9libcutils_ERROR_HANDLER;
jpayne@69 7258 __pyx_L7_bool_binop_done:;
jpayne@69 7259 __pyx_t_6 = NULL;
jpayne@69 7260 __pyx_t_7 = 0;
jpayne@69 7261 #if CYTHON_UNPACK_METHODS
jpayne@69 7262 if (likely(PyMethod_Check(__pyx_t_3))) {
jpayne@69 7263 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
jpayne@69 7264 if (likely(__pyx_t_6)) {
jpayne@69 7265 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
jpayne@69 7266 __Pyx_INCREF(__pyx_t_6);
jpayne@69 7267 __Pyx_INCREF(function);
jpayne@69 7268 __Pyx_DECREF_SET(__pyx_t_3, function);
jpayne@69 7269 __pyx_t_7 = 1;
jpayne@69 7270 }
jpayne@69 7271 }
jpayne@69 7272 #endif
jpayne@69 7273 {
jpayne@69 7274 PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_t_4, __pyx_t_5};
jpayne@69 7275 __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_7, 2+__pyx_t_7);
jpayne@69 7276 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
jpayne@69 7277 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
jpayne@69 7278 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
jpayne@69 7279 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 164, __pyx_L1_error)
jpayne@69 7280 __Pyx_GOTREF(__pyx_t_2);
jpayne@69 7281 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@69 7282 }
jpayne@69 7283 __pyx_r = __pyx_t_2;
jpayne@69 7284 __pyx_t_2 = 0;
jpayne@69 7285 goto __pyx_L0;
jpayne@69 7286
jpayne@69 7287 /* "pysam/libcutils.pyx":163
jpayne@69 7288 * if s is None:
jpayne@69 7289 * return None
jpayne@69 7290 * if PyBytes_Check(s): # <<<<<<<<<<<<<<
jpayne@69 7291 * return s.decode(encoding or TEXT_ENCODING, errors or ERROR_HANDLER)
jpayne@69 7292 * # assume unicode
jpayne@69 7293 */
jpayne@69 7294 }
jpayne@69 7295
jpayne@69 7296 /* "pysam/libcutils.pyx":166
jpayne@69 7297 * return s.decode(encoding or TEXT_ENCODING, errors or ERROR_HANDLER)
jpayne@69 7298 * # assume unicode
jpayne@69 7299 * return s # <<<<<<<<<<<<<<
jpayne@69 7300 *
jpayne@69 7301 *
jpayne@69 7302 */
jpayne@69 7303 __Pyx_XDECREF(__pyx_r);
jpayne@69 7304 __Pyx_INCREF(__pyx_v_s);
jpayne@69 7305 __pyx_r = __pyx_v_s;
jpayne@69 7306 goto __pyx_L0;
jpayne@69 7307
jpayne@69 7308 /* "pysam/libcutils.pyx":158
jpayne@69 7309 *
jpayne@69 7310 *
jpayne@69 7311 * cdef force_str(object s, encoding=None, errors=None): # <<<<<<<<<<<<<<
jpayne@69 7312 * """Return s converted to str type of current Python
jpayne@69 7313 * (bytes in Py2, unicode in Py3)"""
jpayne@69 7314 */
jpayne@69 7315
jpayne@69 7316 /* function exit code */
jpayne@69 7317 __pyx_L1_error:;
jpayne@69 7318 __Pyx_XDECREF(__pyx_t_2);
jpayne@69 7319 __Pyx_XDECREF(__pyx_t_3);
jpayne@69 7320 __Pyx_XDECREF(__pyx_t_4);
jpayne@69 7321 __Pyx_XDECREF(__pyx_t_5);
jpayne@69 7322 __Pyx_XDECREF(__pyx_t_6);
jpayne@69 7323 __Pyx_AddTraceback("pysam.libcutils.force_str", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@69 7324 __pyx_r = 0;
jpayne@69 7325 __pyx_L0:;
jpayne@69 7326 __Pyx_XGIVEREF(__pyx_r);
jpayne@69 7327 __Pyx_RefNannyFinishContext();
jpayne@69 7328 return __pyx_r;
jpayne@69 7329 }
jpayne@69 7330
jpayne@69 7331 /* "pysam/libcutils.pyx":169
jpayne@69 7332 *
jpayne@69 7333 *
jpayne@69 7334 * cdef decode_bytes(bytes s, encoding=None, errors=None): # <<<<<<<<<<<<<<
jpayne@69 7335 * """Return s converted to current Python's str type,
jpayne@69 7336 * always decoding even in Python 2"""
jpayne@69 7337 */
jpayne@69 7338
jpayne@69 7339 static PyObject *__pyx_f_5pysam_9libcutils_decode_bytes(PyObject *__pyx_v_s, struct __pyx_opt_args_5pysam_9libcutils_decode_bytes *__pyx_optional_args) {
jpayne@69 7340 PyObject *__pyx_v_encoding = ((PyObject *)Py_None);
jpayne@69 7341 PyObject *__pyx_v_errors = ((PyObject *)Py_None);
jpayne@69 7342 PyObject *__pyx_r = NULL;
jpayne@69 7343 __Pyx_RefNannyDeclarations
jpayne@69 7344 int __pyx_t_1;
jpayne@69 7345 PyObject *__pyx_t_2 = NULL;
jpayne@69 7346 PyObject *__pyx_t_3 = NULL;
jpayne@69 7347 PyObject *__pyx_t_4 = NULL;
jpayne@69 7348 PyObject *__pyx_t_5 = NULL;
jpayne@69 7349 PyObject *__pyx_t_6 = NULL;
jpayne@69 7350 unsigned int __pyx_t_7;
jpayne@69 7351 int __pyx_lineno = 0;
jpayne@69 7352 const char *__pyx_filename = NULL;
jpayne@69 7353 int __pyx_clineno = 0;
jpayne@69 7354 __Pyx_RefNannySetupContext("decode_bytes", 1);
jpayne@69 7355 if (__pyx_optional_args) {
jpayne@69 7356 if (__pyx_optional_args->__pyx_n > 0) {
jpayne@69 7357 __pyx_v_encoding = __pyx_optional_args->encoding;
jpayne@69 7358 if (__pyx_optional_args->__pyx_n > 1) {
jpayne@69 7359 __pyx_v_errors = __pyx_optional_args->errors;
jpayne@69 7360 }
jpayne@69 7361 }
jpayne@69 7362 }
jpayne@69 7363
jpayne@69 7364 /* "pysam/libcutils.pyx":172
jpayne@69 7365 * """Return s converted to current Python's str type,
jpayne@69 7366 * always decoding even in Python 2"""
jpayne@69 7367 * if s is None: # <<<<<<<<<<<<<<
jpayne@69 7368 * return None
jpayne@69 7369 * else:
jpayne@69 7370 */
jpayne@69 7371 __pyx_t_1 = (__pyx_v_s == ((PyObject*)Py_None));
jpayne@69 7372 if (__pyx_t_1) {
jpayne@69 7373
jpayne@69 7374 /* "pysam/libcutils.pyx":173
jpayne@69 7375 * always decoding even in Python 2"""
jpayne@69 7376 * if s is None:
jpayne@69 7377 * return None # <<<<<<<<<<<<<<
jpayne@69 7378 * else:
jpayne@69 7379 * return s.decode(encoding or TEXT_ENCODING, errors or ERROR_HANDLER)
jpayne@69 7380 */
jpayne@69 7381 __Pyx_XDECREF(__pyx_r);
jpayne@69 7382 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
jpayne@69 7383 goto __pyx_L0;
jpayne@69 7384
jpayne@69 7385 /* "pysam/libcutils.pyx":172
jpayne@69 7386 * """Return s converted to current Python's str type,
jpayne@69 7387 * always decoding even in Python 2"""
jpayne@69 7388 * if s is None: # <<<<<<<<<<<<<<
jpayne@69 7389 * return None
jpayne@69 7390 * else:
jpayne@69 7391 */
jpayne@69 7392 }
jpayne@69 7393
jpayne@69 7394 /* "pysam/libcutils.pyx":175
jpayne@69 7395 * return None
jpayne@69 7396 * else:
jpayne@69 7397 * return s.decode(encoding or TEXT_ENCODING, errors or ERROR_HANDLER) # <<<<<<<<<<<<<<
jpayne@69 7398 *
jpayne@69 7399 *
jpayne@69 7400 */
jpayne@69 7401 /*else*/ {
jpayne@69 7402 __Pyx_XDECREF(__pyx_r);
jpayne@69 7403 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_s, __pyx_n_s_decode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 175, __pyx_L1_error)
jpayne@69 7404 __Pyx_GOTREF(__pyx_t_3);
jpayne@69 7405 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_encoding); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 175, __pyx_L1_error)
jpayne@69 7406 if (!__pyx_t_1) {
jpayne@69 7407 } else {
jpayne@69 7408 __Pyx_INCREF(__pyx_v_encoding);
jpayne@69 7409 __pyx_t_4 = __pyx_v_encoding;
jpayne@69 7410 goto __pyx_L4_bool_binop_done;
jpayne@69 7411 }
jpayne@69 7412 __Pyx_INCREF(__pyx_v_5pysam_9libcutils_TEXT_ENCODING);
jpayne@69 7413 __pyx_t_4 = __pyx_v_5pysam_9libcutils_TEXT_ENCODING;
jpayne@69 7414 __pyx_L4_bool_binop_done:;
jpayne@69 7415 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_errors); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 175, __pyx_L1_error)
jpayne@69 7416 if (!__pyx_t_1) {
jpayne@69 7417 } else {
jpayne@69 7418 __Pyx_INCREF(__pyx_v_errors);
jpayne@69 7419 __pyx_t_5 = __pyx_v_errors;
jpayne@69 7420 goto __pyx_L6_bool_binop_done;
jpayne@69 7421 }
jpayne@69 7422 __Pyx_INCREF(__pyx_v_5pysam_9libcutils_ERROR_HANDLER);
jpayne@69 7423 __pyx_t_5 = __pyx_v_5pysam_9libcutils_ERROR_HANDLER;
jpayne@69 7424 __pyx_L6_bool_binop_done:;
jpayne@69 7425 __pyx_t_6 = NULL;
jpayne@69 7426 __pyx_t_7 = 0;
jpayne@69 7427 #if CYTHON_UNPACK_METHODS
jpayne@69 7428 if (likely(PyMethod_Check(__pyx_t_3))) {
jpayne@69 7429 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
jpayne@69 7430 if (likely(__pyx_t_6)) {
jpayne@69 7431 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
jpayne@69 7432 __Pyx_INCREF(__pyx_t_6);
jpayne@69 7433 __Pyx_INCREF(function);
jpayne@69 7434 __Pyx_DECREF_SET(__pyx_t_3, function);
jpayne@69 7435 __pyx_t_7 = 1;
jpayne@69 7436 }
jpayne@69 7437 }
jpayne@69 7438 #endif
jpayne@69 7439 {
jpayne@69 7440 PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_t_4, __pyx_t_5};
jpayne@69 7441 __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_7, 2+__pyx_t_7);
jpayne@69 7442 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
jpayne@69 7443 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
jpayne@69 7444 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
jpayne@69 7445 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 175, __pyx_L1_error)
jpayne@69 7446 __Pyx_GOTREF(__pyx_t_2);
jpayne@69 7447 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@69 7448 }
jpayne@69 7449 __pyx_r = __pyx_t_2;
jpayne@69 7450 __pyx_t_2 = 0;
jpayne@69 7451 goto __pyx_L0;
jpayne@69 7452 }
jpayne@69 7453
jpayne@69 7454 /* "pysam/libcutils.pyx":169
jpayne@69 7455 *
jpayne@69 7456 *
jpayne@69 7457 * cdef decode_bytes(bytes s, encoding=None, errors=None): # <<<<<<<<<<<<<<
jpayne@69 7458 * """Return s converted to current Python's str type,
jpayne@69 7459 * always decoding even in Python 2"""
jpayne@69 7460 */
jpayne@69 7461
jpayne@69 7462 /* function exit code */
jpayne@69 7463 __pyx_L1_error:;
jpayne@69 7464 __Pyx_XDECREF(__pyx_t_2);
jpayne@69 7465 __Pyx_XDECREF(__pyx_t_3);
jpayne@69 7466 __Pyx_XDECREF(__pyx_t_4);
jpayne@69 7467 __Pyx_XDECREF(__pyx_t_5);
jpayne@69 7468 __Pyx_XDECREF(__pyx_t_6);
jpayne@69 7469 __Pyx_AddTraceback("pysam.libcutils.decode_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@69 7470 __pyx_r = 0;
jpayne@69 7471 __pyx_L0:;
jpayne@69 7472 __Pyx_XGIVEREF(__pyx_r);
jpayne@69 7473 __Pyx_RefNannyFinishContext();
jpayne@69 7474 return __pyx_r;
jpayne@69 7475 }
jpayne@69 7476
jpayne@69 7477 /* "pysam/libcutils.pyx":178
jpayne@69 7478 *
jpayne@69 7479 *
jpayne@69 7480 * cpdef parse_region(contig=None, # <<<<<<<<<<<<<<
jpayne@69 7481 * start=None,
jpayne@69 7482 * stop=None,
jpayne@69 7483 */
jpayne@69 7484
jpayne@69 7485 static PyObject *__pyx_pw_5pysam_9libcutils_13parse_region(PyObject *__pyx_self,
jpayne@69 7486 #if CYTHON_METH_FASTCALL
jpayne@69 7487 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
jpayne@69 7488 #else
jpayne@69 7489 PyObject *__pyx_args, PyObject *__pyx_kwds
jpayne@69 7490 #endif
jpayne@69 7491 ); /*proto*/
jpayne@69 7492 static PyObject *__pyx_f_5pysam_9libcutils_parse_region(CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_5pysam_9libcutils_parse_region *__pyx_optional_args) {
jpayne@69 7493 PyObject *__pyx_v_contig = ((PyObject *)Py_None);
jpayne@69 7494
jpayne@69 7495 /* "pysam/libcutils.pyx":179
jpayne@69 7496 *
jpayne@69 7497 * cpdef parse_region(contig=None,
jpayne@69 7498 * start=None, # <<<<<<<<<<<<<<
jpayne@69 7499 * stop=None,
jpayne@69 7500 * region=None,
jpayne@69 7501 */
jpayne@69 7502 PyObject *__pyx_v_start = ((PyObject *)Py_None);
jpayne@69 7503
jpayne@69 7504 /* "pysam/libcutils.pyx":180
jpayne@69 7505 * cpdef parse_region(contig=None,
jpayne@69 7506 * start=None,
jpayne@69 7507 * stop=None, # <<<<<<<<<<<<<<
jpayne@69 7508 * region=None,
jpayne@69 7509 * reference=None,
jpayne@69 7510 */
jpayne@69 7511 PyObject *__pyx_v_stop = ((PyObject *)Py_None);
jpayne@69 7512
jpayne@69 7513 /* "pysam/libcutils.pyx":181
jpayne@69 7514 * start=None,
jpayne@69 7515 * stop=None,
jpayne@69 7516 * region=None, # <<<<<<<<<<<<<<
jpayne@69 7517 * reference=None,
jpayne@69 7518 * end=None):
jpayne@69 7519 */
jpayne@69 7520 PyObject *__pyx_v_region = ((PyObject *)Py_None);
jpayne@69 7521
jpayne@69 7522 /* "pysam/libcutils.pyx":182
jpayne@69 7523 * stop=None,
jpayne@69 7524 * region=None,
jpayne@69 7525 * reference=None, # <<<<<<<<<<<<<<
jpayne@69 7526 * end=None):
jpayne@69 7527 * """parse alternative ways to specify a genomic region. A region can
jpayne@69 7528 */
jpayne@69 7529 PyObject *__pyx_v_reference = ((PyObject *)Py_None);
jpayne@69 7530
jpayne@69 7531 /* "pysam/libcutils.pyx":183
jpayne@69 7532 * region=None,
jpayne@69 7533 * reference=None,
jpayne@69 7534 * end=None): # <<<<<<<<<<<<<<
jpayne@69 7535 * """parse alternative ways to specify a genomic region. A region can
jpayne@69 7536 * either be specified by :term:`reference`, `start` and
jpayne@69 7537 */
jpayne@69 7538 PyObject *__pyx_v_end = ((PyObject *)Py_None);
jpayne@69 7539 int32_t __pyx_v_rstart;
jpayne@69 7540 int32_t __pyx_v_rstop;
jpayne@69 7541 PyObject *__pyx_v_coord = NULL;
jpayne@69 7542 PyObject *__pyx_v_parts = NULL;
jpayne@69 7543 PyObject *__pyx_r = NULL;
jpayne@69 7544 __Pyx_RefNannyDeclarations
jpayne@69 7545 int __pyx_t_1;
jpayne@69 7546 PyObject *__pyx_t_2 = NULL;
jpayne@69 7547 int __pyx_t_3;
jpayne@69 7548 PyObject *__pyx_t_4 = NULL;
jpayne@69 7549 PyObject *__pyx_t_5 = NULL;
jpayne@69 7550 PyObject *__pyx_t_6 = NULL;
jpayne@69 7551 int32_t __pyx_t_7;
jpayne@69 7552 int __pyx_t_8;
jpayne@69 7553 PyObject *__pyx_t_9 = NULL;
jpayne@69 7554 PyObject *__pyx_t_10 = NULL;
jpayne@69 7555 PyObject *__pyx_t_11 = NULL;
jpayne@69 7556 PyObject *__pyx_t_12 = NULL;
jpayne@69 7557 unsigned int __pyx_t_13;
jpayne@69 7558 PyObject *(*__pyx_t_14)(PyObject *);
jpayne@69 7559 Py_ssize_t __pyx_t_15;
jpayne@69 7560 int __pyx_lineno = 0;
jpayne@69 7561 const char *__pyx_filename = NULL;
jpayne@69 7562 int __pyx_clineno = 0;
jpayne@69 7563 __Pyx_RefNannySetupContext("parse_region", 0);
jpayne@69 7564 if (__pyx_optional_args) {
jpayne@69 7565 if (__pyx_optional_args->__pyx_n > 0) {
jpayne@69 7566 __pyx_v_contig = __pyx_optional_args->contig;
jpayne@69 7567 if (__pyx_optional_args->__pyx_n > 1) {
jpayne@69 7568 __pyx_v_start = __pyx_optional_args->start;
jpayne@69 7569 if (__pyx_optional_args->__pyx_n > 2) {
jpayne@69 7570 __pyx_v_stop = __pyx_optional_args->stop;
jpayne@69 7571 if (__pyx_optional_args->__pyx_n > 3) {
jpayne@69 7572 __pyx_v_region = __pyx_optional_args->region;
jpayne@69 7573 if (__pyx_optional_args->__pyx_n > 4) {
jpayne@69 7574 __pyx_v_reference = __pyx_optional_args->reference;
jpayne@69 7575 if (__pyx_optional_args->__pyx_n > 5) {
jpayne@69 7576 __pyx_v_end = __pyx_optional_args->end;
jpayne@69 7577 }
jpayne@69 7578 }
jpayne@69 7579 }
jpayne@69 7580 }
jpayne@69 7581 }
jpayne@69 7582 }
jpayne@69 7583 }
jpayne@69 7584 __Pyx_INCREF(__pyx_v_contig);
jpayne@69 7585 __Pyx_INCREF(__pyx_v_stop);
jpayne@69 7586
jpayne@69 7587 /* "pysam/libcutils.pyx":216
jpayne@69 7588 *
jpayne@69 7589 *
jpayne@69 7590 * if reference is not None: # <<<<<<<<<<<<<<
jpayne@69 7591 * if contig is not None:
jpayne@69 7592 * raise ValueError('contig and reference should not both be specified')
jpayne@69 7593 */
jpayne@69 7594 __pyx_t_1 = (__pyx_v_reference != Py_None);
jpayne@69 7595 if (__pyx_t_1) {
jpayne@69 7596
jpayne@69 7597 /* "pysam/libcutils.pyx":217
jpayne@69 7598 *
jpayne@69 7599 * if reference is not None:
jpayne@69 7600 * if contig is not None: # <<<<<<<<<<<<<<
jpayne@69 7601 * raise ValueError('contig and reference should not both be specified')
jpayne@69 7602 * contig = reference
jpayne@69 7603 */
jpayne@69 7604 __pyx_t_1 = (__pyx_v_contig != Py_None);
jpayne@69 7605 if (unlikely(__pyx_t_1)) {
jpayne@69 7606
jpayne@69 7607 /* "pysam/libcutils.pyx":218
jpayne@69 7608 * if reference is not None:
jpayne@69 7609 * if contig is not None:
jpayne@69 7610 * raise ValueError('contig and reference should not both be specified') # <<<<<<<<<<<<<<
jpayne@69 7611 * contig = reference
jpayne@69 7612 *
jpayne@69 7613 */
jpayne@69 7614 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 218, __pyx_L1_error)
jpayne@69 7615 __Pyx_GOTREF(__pyx_t_2);
jpayne@69 7616 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
jpayne@69 7617 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@69 7618 __PYX_ERR(0, 218, __pyx_L1_error)
jpayne@69 7619
jpayne@69 7620 /* "pysam/libcutils.pyx":217
jpayne@69 7621 *
jpayne@69 7622 * if reference is not None:
jpayne@69 7623 * if contig is not None: # <<<<<<<<<<<<<<
jpayne@69 7624 * raise ValueError('contig and reference should not both be specified')
jpayne@69 7625 * contig = reference
jpayne@69 7626 */
jpayne@69 7627 }
jpayne@69 7628
jpayne@69 7629 /* "pysam/libcutils.pyx":219
jpayne@69 7630 * if contig is not None:
jpayne@69 7631 * raise ValueError('contig and reference should not both be specified')
jpayne@69 7632 * contig = reference # <<<<<<<<<<<<<<
jpayne@69 7633 *
jpayne@69 7634 * if contig is not None and region is not None:
jpayne@69 7635 */
jpayne@69 7636 __Pyx_INCREF(__pyx_v_reference);
jpayne@69 7637 __Pyx_DECREF_SET(__pyx_v_contig, __pyx_v_reference);
jpayne@69 7638
jpayne@69 7639 /* "pysam/libcutils.pyx":216
jpayne@69 7640 *
jpayne@69 7641 *
jpayne@69 7642 * if reference is not None: # <<<<<<<<<<<<<<
jpayne@69 7643 * if contig is not None:
jpayne@69 7644 * raise ValueError('contig and reference should not both be specified')
jpayne@69 7645 */
jpayne@69 7646 }
jpayne@69 7647
jpayne@69 7648 /* "pysam/libcutils.pyx":221
jpayne@69 7649 * contig = reference
jpayne@69 7650 *
jpayne@69 7651 * if contig is not None and region is not None: # <<<<<<<<<<<<<<
jpayne@69 7652 * raise ValueError('contig/reference and region should not both be specified')
jpayne@69 7653 *
jpayne@69 7654 */
jpayne@69 7655 __pyx_t_3 = (__pyx_v_contig != Py_None);
jpayne@69 7656 if (__pyx_t_3) {
jpayne@69 7657 } else {
jpayne@69 7658 __pyx_t_1 = __pyx_t_3;
jpayne@69 7659 goto __pyx_L6_bool_binop_done;
jpayne@69 7660 }
jpayne@69 7661 __pyx_t_3 = (__pyx_v_region != Py_None);
jpayne@69 7662 __pyx_t_1 = __pyx_t_3;
jpayne@69 7663 __pyx_L6_bool_binop_done:;
jpayne@69 7664 if (unlikely(__pyx_t_1)) {
jpayne@69 7665
jpayne@69 7666 /* "pysam/libcutils.pyx":222
jpayne@69 7667 *
jpayne@69 7668 * if contig is not None and region is not None:
jpayne@69 7669 * raise ValueError('contig/reference and region should not both be specified') # <<<<<<<<<<<<<<
jpayne@69 7670 *
jpayne@69 7671 * if end is not None:
jpayne@69 7672 */
jpayne@69 7673 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 222, __pyx_L1_error)
jpayne@69 7674 __Pyx_GOTREF(__pyx_t_2);
jpayne@69 7675 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
jpayne@69 7676 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@69 7677 __PYX_ERR(0, 222, __pyx_L1_error)
jpayne@69 7678
jpayne@69 7679 /* "pysam/libcutils.pyx":221
jpayne@69 7680 * contig = reference
jpayne@69 7681 *
jpayne@69 7682 * if contig is not None and region is not None: # <<<<<<<<<<<<<<
jpayne@69 7683 * raise ValueError('contig/reference and region should not both be specified')
jpayne@69 7684 *
jpayne@69 7685 */
jpayne@69 7686 }
jpayne@69 7687
jpayne@69 7688 /* "pysam/libcutils.pyx":224
jpayne@69 7689 * raise ValueError('contig/reference and region should not both be specified')
jpayne@69 7690 *
jpayne@69 7691 * if end is not None: # <<<<<<<<<<<<<<
jpayne@69 7692 * if stop is not None:
jpayne@69 7693 * raise ValueError('stop and end should not both be specified')
jpayne@69 7694 */
jpayne@69 7695 __pyx_t_1 = (__pyx_v_end != Py_None);
jpayne@69 7696 if (__pyx_t_1) {
jpayne@69 7697
jpayne@69 7698 /* "pysam/libcutils.pyx":225
jpayne@69 7699 *
jpayne@69 7700 * if end is not None:
jpayne@69 7701 * if stop is not None: # <<<<<<<<<<<<<<
jpayne@69 7702 * raise ValueError('stop and end should not both be specified')
jpayne@69 7703 * stop = end
jpayne@69 7704 */
jpayne@69 7705 __pyx_t_1 = (__pyx_v_stop != Py_None);
jpayne@69 7706 if (unlikely(__pyx_t_1)) {
jpayne@69 7707
jpayne@69 7708 /* "pysam/libcutils.pyx":226
jpayne@69 7709 * if end is not None:
jpayne@69 7710 * if stop is not None:
jpayne@69 7711 * raise ValueError('stop and end should not both be specified') # <<<<<<<<<<<<<<
jpayne@69 7712 * stop = end
jpayne@69 7713 *
jpayne@69 7714 */
jpayne@69 7715 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 226, __pyx_L1_error)
jpayne@69 7716 __Pyx_GOTREF(__pyx_t_2);
jpayne@69 7717 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
jpayne@69 7718 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@69 7719 __PYX_ERR(0, 226, __pyx_L1_error)
jpayne@69 7720
jpayne@69 7721 /* "pysam/libcutils.pyx":225
jpayne@69 7722 *
jpayne@69 7723 * if end is not None:
jpayne@69 7724 * if stop is not None: # <<<<<<<<<<<<<<
jpayne@69 7725 * raise ValueError('stop and end should not both be specified')
jpayne@69 7726 * stop = end
jpayne@69 7727 */
jpayne@69 7728 }
jpayne@69 7729
jpayne@69 7730 /* "pysam/libcutils.pyx":227
jpayne@69 7731 * if stop is not None:
jpayne@69 7732 * raise ValueError('stop and end should not both be specified')
jpayne@69 7733 * stop = end # <<<<<<<<<<<<<<
jpayne@69 7734 *
jpayne@69 7735 * if contig is None and region is None:
jpayne@69 7736 */
jpayne@69 7737 __Pyx_INCREF(__pyx_v_end);
jpayne@69 7738 __Pyx_DECREF_SET(__pyx_v_stop, __pyx_v_end);
jpayne@69 7739
jpayne@69 7740 /* "pysam/libcutils.pyx":224
jpayne@69 7741 * raise ValueError('contig/reference and region should not both be specified')
jpayne@69 7742 *
jpayne@69 7743 * if end is not None: # <<<<<<<<<<<<<<
jpayne@69 7744 * if stop is not None:
jpayne@69 7745 * raise ValueError('stop and end should not both be specified')
jpayne@69 7746 */
jpayne@69 7747 }
jpayne@69 7748
jpayne@69 7749 /* "pysam/libcutils.pyx":229
jpayne@69 7750 * stop = end
jpayne@69 7751 *
jpayne@69 7752 * if contig is None and region is None: # <<<<<<<<<<<<<<
jpayne@69 7753 * raise ValueError("neither contig nor region are given")
jpayne@69 7754 *
jpayne@69 7755 */
jpayne@69 7756 __pyx_t_3 = (__pyx_v_contig == Py_None);
jpayne@69 7757 if (__pyx_t_3) {
jpayne@69 7758 } else {
jpayne@69 7759 __pyx_t_1 = __pyx_t_3;
jpayne@69 7760 goto __pyx_L11_bool_binop_done;
jpayne@69 7761 }
jpayne@69 7762 __pyx_t_3 = (__pyx_v_region == Py_None);
jpayne@69 7763 __pyx_t_1 = __pyx_t_3;
jpayne@69 7764 __pyx_L11_bool_binop_done:;
jpayne@69 7765 if (unlikely(__pyx_t_1)) {
jpayne@69 7766
jpayne@69 7767 /* "pysam/libcutils.pyx":230
jpayne@69 7768 *
jpayne@69 7769 * if contig is None and region is None:
jpayne@69 7770 * raise ValueError("neither contig nor region are given") # <<<<<<<<<<<<<<
jpayne@69 7771 *
jpayne@69 7772 * rstart = 0
jpayne@69 7773 */
jpayne@69 7774 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 230, __pyx_L1_error)
jpayne@69 7775 __Pyx_GOTREF(__pyx_t_2);
jpayne@69 7776 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
jpayne@69 7777 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@69 7778 __PYX_ERR(0, 230, __pyx_L1_error)
jpayne@69 7779
jpayne@69 7780 /* "pysam/libcutils.pyx":229
jpayne@69 7781 * stop = end
jpayne@69 7782 *
jpayne@69 7783 * if contig is None and region is None: # <<<<<<<<<<<<<<
jpayne@69 7784 * raise ValueError("neither contig nor region are given")
jpayne@69 7785 *
jpayne@69 7786 */
jpayne@69 7787 }
jpayne@69 7788
jpayne@69 7789 /* "pysam/libcutils.pyx":232
jpayne@69 7790 * raise ValueError("neither contig nor region are given")
jpayne@69 7791 *
jpayne@69 7792 * rstart = 0 # <<<<<<<<<<<<<<
jpayne@69 7793 * rstop = MAX_POS
jpayne@69 7794 * if start is not None:
jpayne@69 7795 */
jpayne@69 7796 __pyx_v_rstart = 0;
jpayne@69 7797
jpayne@69 7798 /* "pysam/libcutils.pyx":233
jpayne@69 7799 *
jpayne@69 7800 * rstart = 0
jpayne@69 7801 * rstop = MAX_POS # <<<<<<<<<<<<<<
jpayne@69 7802 * if start is not None:
jpayne@69 7803 * try:
jpayne@69 7804 */
jpayne@69 7805 __pyx_v_rstop = __pyx_v_5pysam_9libcutils_MAX_POS;
jpayne@69 7806
jpayne@69 7807 /* "pysam/libcutils.pyx":234
jpayne@69 7808 * rstart = 0
jpayne@69 7809 * rstop = MAX_POS
jpayne@69 7810 * if start is not None: # <<<<<<<<<<<<<<
jpayne@69 7811 * try:
jpayne@69 7812 * rstart = start
jpayne@69 7813 */
jpayne@69 7814 __pyx_t_1 = (__pyx_v_start != Py_None);
jpayne@69 7815 if (__pyx_t_1) {
jpayne@69 7816
jpayne@69 7817 /* "pysam/libcutils.pyx":235
jpayne@69 7818 * rstop = MAX_POS
jpayne@69 7819 * if start is not None:
jpayne@69 7820 * try: # <<<<<<<<<<<<<<
jpayne@69 7821 * rstart = start
jpayne@69 7822 * except OverflowError:
jpayne@69 7823 */
jpayne@69 7824 {
jpayne@69 7825 __Pyx_PyThreadState_declare
jpayne@69 7826 __Pyx_PyThreadState_assign
jpayne@69 7827 __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
jpayne@69 7828 __Pyx_XGOTREF(__pyx_t_4);
jpayne@69 7829 __Pyx_XGOTREF(__pyx_t_5);
jpayne@69 7830 __Pyx_XGOTREF(__pyx_t_6);
jpayne@69 7831 /*try:*/ {
jpayne@69 7832
jpayne@69 7833 /* "pysam/libcutils.pyx":236
jpayne@69 7834 * if start is not None:
jpayne@69 7835 * try:
jpayne@69 7836 * rstart = start # <<<<<<<<<<<<<<
jpayne@69 7837 * except OverflowError:
jpayne@69 7838 * raise ValueError('start out of range (%i)' % start)
jpayne@69 7839 */
jpayne@69 7840 __pyx_t_7 = __Pyx_PyInt_As_int32_t(__pyx_v_start); if (unlikely((__pyx_t_7 == ((int32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 236, __pyx_L14_error)
jpayne@69 7841 __pyx_v_rstart = __pyx_t_7;
jpayne@69 7842
jpayne@69 7843 /* "pysam/libcutils.pyx":235
jpayne@69 7844 * rstop = MAX_POS
jpayne@69 7845 * if start is not None:
jpayne@69 7846 * try: # <<<<<<<<<<<<<<
jpayne@69 7847 * rstart = start
jpayne@69 7848 * except OverflowError:
jpayne@69 7849 */
jpayne@69 7850 }
jpayne@69 7851 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
jpayne@69 7852 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
jpayne@69 7853 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
jpayne@69 7854 goto __pyx_L19_try_end;
jpayne@69 7855 __pyx_L14_error:;
jpayne@69 7856 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@69 7857
jpayne@69 7858 /* "pysam/libcutils.pyx":237
jpayne@69 7859 * try:
jpayne@69 7860 * rstart = start
jpayne@69 7861 * except OverflowError: # <<<<<<<<<<<<<<
jpayne@69 7862 * raise ValueError('start out of range (%i)' % start)
jpayne@69 7863 *
jpayne@69 7864 */
jpayne@69 7865 __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_OverflowError);
jpayne@69 7866 if (__pyx_t_8) {
jpayne@69 7867 __Pyx_AddTraceback("pysam.libcutils.parse_region", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@69 7868 if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_9, &__pyx_t_10) < 0) __PYX_ERR(0, 237, __pyx_L16_except_error)
jpayne@69 7869 __Pyx_XGOTREF(__pyx_t_2);
jpayne@69 7870 __Pyx_XGOTREF(__pyx_t_9);
jpayne@69 7871 __Pyx_XGOTREF(__pyx_t_10);
jpayne@69 7872
jpayne@69 7873 /* "pysam/libcutils.pyx":238
jpayne@69 7874 * rstart = start
jpayne@69 7875 * except OverflowError:
jpayne@69 7876 * raise ValueError('start out of range (%i)' % start) # <<<<<<<<<<<<<<
jpayne@69 7877 *
jpayne@69 7878 * if stop is not None:
jpayne@69 7879 */
jpayne@69 7880 __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, 238, __pyx_L16_except_error)
jpayne@69 7881 __Pyx_GOTREF(__pyx_t_11);
jpayne@69 7882 __pyx_t_12 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_11); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 238, __pyx_L16_except_error)
jpayne@69 7883 __Pyx_GOTREF(__pyx_t_12);
jpayne@69 7884 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
jpayne@69 7885 __Pyx_Raise(__pyx_t_12, 0, 0, 0);
jpayne@69 7886 __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
jpayne@69 7887 __PYX_ERR(0, 238, __pyx_L16_except_error)
jpayne@69 7888 }
jpayne@69 7889 goto __pyx_L16_except_error;
jpayne@69 7890
jpayne@69 7891 /* "pysam/libcutils.pyx":235
jpayne@69 7892 * rstop = MAX_POS
jpayne@69 7893 * if start is not None:
jpayne@69 7894 * try: # <<<<<<<<<<<<<<
jpayne@69 7895 * rstart = start
jpayne@69 7896 * except OverflowError:
jpayne@69 7897 */
jpayne@69 7898 __pyx_L16_except_error:;
jpayne@69 7899 __Pyx_XGIVEREF(__pyx_t_4);
jpayne@69 7900 __Pyx_XGIVEREF(__pyx_t_5);
jpayne@69 7901 __Pyx_XGIVEREF(__pyx_t_6);
jpayne@69 7902 __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
jpayne@69 7903 goto __pyx_L1_error;
jpayne@69 7904 __pyx_L19_try_end:;
jpayne@69 7905 }
jpayne@69 7906
jpayne@69 7907 /* "pysam/libcutils.pyx":234
jpayne@69 7908 * rstart = 0
jpayne@69 7909 * rstop = MAX_POS
jpayne@69 7910 * if start is not None: # <<<<<<<<<<<<<<
jpayne@69 7911 * try:
jpayne@69 7912 * rstart = start
jpayne@69 7913 */
jpayne@69 7914 }
jpayne@69 7915
jpayne@69 7916 /* "pysam/libcutils.pyx":240
jpayne@69 7917 * raise ValueError('start out of range (%i)' % start)
jpayne@69 7918 *
jpayne@69 7919 * if stop is not None: # <<<<<<<<<<<<<<
jpayne@69 7920 * try:
jpayne@69 7921 * rstop = stop
jpayne@69 7922 */
jpayne@69 7923 __pyx_t_1 = (__pyx_v_stop != Py_None);
jpayne@69 7924 if (__pyx_t_1) {
jpayne@69 7925
jpayne@69 7926 /* "pysam/libcutils.pyx":241
jpayne@69 7927 *
jpayne@69 7928 * if stop is not None:
jpayne@69 7929 * try: # <<<<<<<<<<<<<<
jpayne@69 7930 * rstop = stop
jpayne@69 7931 * except OverflowError:
jpayne@69 7932 */
jpayne@69 7933 {
jpayne@69 7934 __Pyx_PyThreadState_declare
jpayne@69 7935 __Pyx_PyThreadState_assign
jpayne@69 7936 __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4);
jpayne@69 7937 __Pyx_XGOTREF(__pyx_t_6);
jpayne@69 7938 __Pyx_XGOTREF(__pyx_t_5);
jpayne@69 7939 __Pyx_XGOTREF(__pyx_t_4);
jpayne@69 7940 /*try:*/ {
jpayne@69 7941
jpayne@69 7942 /* "pysam/libcutils.pyx":242
jpayne@69 7943 * if stop is not None:
jpayne@69 7944 * try:
jpayne@69 7945 * rstop = stop # <<<<<<<<<<<<<<
jpayne@69 7946 * except OverflowError:
jpayne@69 7947 * raise ValueError('stop out of range (%i)' % stop)
jpayne@69 7948 */
jpayne@69 7949 __pyx_t_7 = __Pyx_PyInt_As_int32_t(__pyx_v_stop); if (unlikely((__pyx_t_7 == ((int32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 242, __pyx_L23_error)
jpayne@69 7950 __pyx_v_rstop = __pyx_t_7;
jpayne@69 7951
jpayne@69 7952 /* "pysam/libcutils.pyx":241
jpayne@69 7953 *
jpayne@69 7954 * if stop is not None:
jpayne@69 7955 * try: # <<<<<<<<<<<<<<
jpayne@69 7956 * rstop = stop
jpayne@69 7957 * except OverflowError:
jpayne@69 7958 */
jpayne@69 7959 }
jpayne@69 7960 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
jpayne@69 7961 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
jpayne@69 7962 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
jpayne@69 7963 goto __pyx_L28_try_end;
jpayne@69 7964 __pyx_L23_error:;
jpayne@69 7965 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
jpayne@69 7966 __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
jpayne@69 7967 __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
jpayne@69 7968 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@69 7969 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
jpayne@69 7970
jpayne@69 7971 /* "pysam/libcutils.pyx":243
jpayne@69 7972 * try:
jpayne@69 7973 * rstop = stop
jpayne@69 7974 * except OverflowError: # <<<<<<<<<<<<<<
jpayne@69 7975 * raise ValueError('stop out of range (%i)' % stop)
jpayne@69 7976 *
jpayne@69 7977 */
jpayne@69 7978 __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_OverflowError);
jpayne@69 7979 if (__pyx_t_8) {
jpayne@69 7980 __Pyx_AddTraceback("pysam.libcutils.parse_region", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@69 7981 if (__Pyx_GetException(&__pyx_t_10, &__pyx_t_9, &__pyx_t_2) < 0) __PYX_ERR(0, 243, __pyx_L25_except_error)
jpayne@69 7982 __Pyx_XGOTREF(__pyx_t_10);
jpayne@69 7983 __Pyx_XGOTREF(__pyx_t_9);
jpayne@69 7984 __Pyx_XGOTREF(__pyx_t_2);
jpayne@69 7985
jpayne@69 7986 /* "pysam/libcutils.pyx":244
jpayne@69 7987 * rstop = stop
jpayne@69 7988 * except OverflowError:
jpayne@69 7989 * raise ValueError('stop out of range (%i)' % stop) # <<<<<<<<<<<<<<
jpayne@69 7990 *
jpayne@69 7991 * if region:
jpayne@69 7992 */
jpayne@69 7993 __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, 244, __pyx_L25_except_error)
jpayne@69 7994 __Pyx_GOTREF(__pyx_t_12);
jpayne@69 7995 __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_12); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 244, __pyx_L25_except_error)
jpayne@69 7996 __Pyx_GOTREF(__pyx_t_11);
jpayne@69 7997 __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
jpayne@69 7998 __Pyx_Raise(__pyx_t_11, 0, 0, 0);
jpayne@69 7999 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
jpayne@69 8000 __PYX_ERR(0, 244, __pyx_L25_except_error)
jpayne@69 8001 }
jpayne@69 8002 goto __pyx_L25_except_error;
jpayne@69 8003
jpayne@69 8004 /* "pysam/libcutils.pyx":241
jpayne@69 8005 *
jpayne@69 8006 * if stop is not None:
jpayne@69 8007 * try: # <<<<<<<<<<<<<<
jpayne@69 8008 * rstop = stop
jpayne@69 8009 * except OverflowError:
jpayne@69 8010 */
jpayne@69 8011 __pyx_L25_except_error:;
jpayne@69 8012 __Pyx_XGIVEREF(__pyx_t_6);
jpayne@69 8013 __Pyx_XGIVEREF(__pyx_t_5);
jpayne@69 8014 __Pyx_XGIVEREF(__pyx_t_4);
jpayne@69 8015 __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_5, __pyx_t_4);
jpayne@69 8016 goto __pyx_L1_error;
jpayne@69 8017 __pyx_L28_try_end:;
jpayne@69 8018 }
jpayne@69 8019
jpayne@69 8020 /* "pysam/libcutils.pyx":240
jpayne@69 8021 * raise ValueError('start out of range (%i)' % start)
jpayne@69 8022 *
jpayne@69 8023 * if stop is not None: # <<<<<<<<<<<<<<
jpayne@69 8024 * try:
jpayne@69 8025 * rstop = stop
jpayne@69 8026 */
jpayne@69 8027 }
jpayne@69 8028
jpayne@69 8029 /* "pysam/libcutils.pyx":246
jpayne@69 8030 * raise ValueError('stop out of range (%i)' % stop)
jpayne@69 8031 *
jpayne@69 8032 * if region: # <<<<<<<<<<<<<<
jpayne@69 8033 * if ":" in region:
jpayne@69 8034 * contig, coord = region.split(":")
jpayne@69 8035 */
jpayne@69 8036 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_region); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 246, __pyx_L1_error)
jpayne@69 8037 if (__pyx_t_1) {
jpayne@69 8038
jpayne@69 8039 /* "pysam/libcutils.pyx":247
jpayne@69 8040 *
jpayne@69 8041 * if region:
jpayne@69 8042 * if ":" in region: # <<<<<<<<<<<<<<
jpayne@69 8043 * contig, coord = region.split(":")
jpayne@69 8044 * parts = coord.split("-")
jpayne@69 8045 */
jpayne@69 8046 __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_kp_u__7, __pyx_v_region, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 247, __pyx_L1_error)
jpayne@69 8047 if (__pyx_t_1) {
jpayne@69 8048
jpayne@69 8049 /* "pysam/libcutils.pyx":248
jpayne@69 8050 * if region:
jpayne@69 8051 * if ":" in region:
jpayne@69 8052 * contig, coord = region.split(":") # <<<<<<<<<<<<<<
jpayne@69 8053 * parts = coord.split("-")
jpayne@69 8054 * rstart = int(parts[0]) - 1
jpayne@69 8055 */
jpayne@69 8056 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_region, __pyx_n_s_split); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 248, __pyx_L1_error)
jpayne@69 8057 __Pyx_GOTREF(__pyx_t_9);
jpayne@69 8058 __pyx_t_10 = NULL;
jpayne@69 8059 __pyx_t_13 = 0;
jpayne@69 8060 #if CYTHON_UNPACK_METHODS
jpayne@69 8061 if (likely(PyMethod_Check(__pyx_t_9))) {
jpayne@69 8062 __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9);
jpayne@69 8063 if (likely(__pyx_t_10)) {
jpayne@69 8064 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
jpayne@69 8065 __Pyx_INCREF(__pyx_t_10);
jpayne@69 8066 __Pyx_INCREF(function);
jpayne@69 8067 __Pyx_DECREF_SET(__pyx_t_9, function);
jpayne@69 8068 __pyx_t_13 = 1;
jpayne@69 8069 }
jpayne@69 8070 }
jpayne@69 8071 #endif
jpayne@69 8072 {
jpayne@69 8073 PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_kp_u__7};
jpayne@69 8074 __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_13, 1+__pyx_t_13);
jpayne@69 8075 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
jpayne@69 8076 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 248, __pyx_L1_error)
jpayne@69 8077 __Pyx_GOTREF(__pyx_t_2);
jpayne@69 8078 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
jpayne@69 8079 }
jpayne@69 8080 if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
jpayne@69 8081 PyObject* sequence = __pyx_t_2;
jpayne@69 8082 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
jpayne@69 8083 if (unlikely(size != 2)) {
jpayne@69 8084 if (size > 2) __Pyx_RaiseTooManyValuesError(2);
jpayne@69 8085 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
jpayne@69 8086 __PYX_ERR(0, 248, __pyx_L1_error)
jpayne@69 8087 }
jpayne@69 8088 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
jpayne@69 8089 if (likely(PyTuple_CheckExact(sequence))) {
jpayne@69 8090 __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0);
jpayne@69 8091 __pyx_t_10 = PyTuple_GET_ITEM(sequence, 1);
jpayne@69 8092 } else {
jpayne@69 8093 __pyx_t_9 = PyList_GET_ITEM(sequence, 0);
jpayne@69 8094 __pyx_t_10 = PyList_GET_ITEM(sequence, 1);
jpayne@69 8095 }
jpayne@69 8096 __Pyx_INCREF(__pyx_t_9);
jpayne@69 8097 __Pyx_INCREF(__pyx_t_10);
jpayne@69 8098 #else
jpayne@69 8099 __pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 248, __pyx_L1_error)
jpayne@69 8100 __Pyx_GOTREF(__pyx_t_9);
jpayne@69 8101 __pyx_t_10 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 248, __pyx_L1_error)
jpayne@69 8102 __Pyx_GOTREF(__pyx_t_10);
jpayne@69 8103 #endif
jpayne@69 8104 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@69 8105 } else {
jpayne@69 8106 Py_ssize_t index = -1;
jpayne@69 8107 __pyx_t_11 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 248, __pyx_L1_error)
jpayne@69 8108 __Pyx_GOTREF(__pyx_t_11);
jpayne@69 8109 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@69 8110 __pyx_t_14 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_11);
jpayne@69 8111 index = 0; __pyx_t_9 = __pyx_t_14(__pyx_t_11); if (unlikely(!__pyx_t_9)) goto __pyx_L33_unpacking_failed;
jpayne@69 8112 __Pyx_GOTREF(__pyx_t_9);
jpayne@69 8113 index = 1; __pyx_t_10 = __pyx_t_14(__pyx_t_11); if (unlikely(!__pyx_t_10)) goto __pyx_L33_unpacking_failed;
jpayne@69 8114 __Pyx_GOTREF(__pyx_t_10);
jpayne@69 8115 if (__Pyx_IternextUnpackEndCheck(__pyx_t_14(__pyx_t_11), 2) < 0) __PYX_ERR(0, 248, __pyx_L1_error)
jpayne@69 8116 __pyx_t_14 = NULL;
jpayne@69 8117 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
jpayne@69 8118 goto __pyx_L34_unpacking_done;
jpayne@69 8119 __pyx_L33_unpacking_failed:;
jpayne@69 8120 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
jpayne@69 8121 __pyx_t_14 = NULL;
jpayne@69 8122 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
jpayne@69 8123 __PYX_ERR(0, 248, __pyx_L1_error)
jpayne@69 8124 __pyx_L34_unpacking_done:;
jpayne@69 8125 }
jpayne@69 8126 __Pyx_DECREF_SET(__pyx_v_contig, __pyx_t_9);
jpayne@69 8127 __pyx_t_9 = 0;
jpayne@69 8128 __pyx_v_coord = __pyx_t_10;
jpayne@69 8129 __pyx_t_10 = 0;
jpayne@69 8130
jpayne@69 8131 /* "pysam/libcutils.pyx":249
jpayne@69 8132 * if ":" in region:
jpayne@69 8133 * contig, coord = region.split(":")
jpayne@69 8134 * parts = coord.split("-") # <<<<<<<<<<<<<<
jpayne@69 8135 * rstart = int(parts[0]) - 1
jpayne@69 8136 * if len(parts) >= 1:
jpayne@69 8137 */
jpayne@69 8138 __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_coord, __pyx_n_s_split); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 249, __pyx_L1_error)
jpayne@69 8139 __Pyx_GOTREF(__pyx_t_10);
jpayne@69 8140 __pyx_t_9 = NULL;
jpayne@69 8141 __pyx_t_13 = 0;
jpayne@69 8142 #if CYTHON_UNPACK_METHODS
jpayne@69 8143 if (likely(PyMethod_Check(__pyx_t_10))) {
jpayne@69 8144 __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_10);
jpayne@69 8145 if (likely(__pyx_t_9)) {
jpayne@69 8146 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
jpayne@69 8147 __Pyx_INCREF(__pyx_t_9);
jpayne@69 8148 __Pyx_INCREF(function);
jpayne@69 8149 __Pyx_DECREF_SET(__pyx_t_10, function);
jpayne@69 8150 __pyx_t_13 = 1;
jpayne@69 8151 }
jpayne@69 8152 }
jpayne@69 8153 #endif
jpayne@69 8154 {
jpayne@69 8155 PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_kp_u__8};
jpayne@69 8156 __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_10, __pyx_callargs+1-__pyx_t_13, 1+__pyx_t_13);
jpayne@69 8157 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
jpayne@69 8158 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 249, __pyx_L1_error)
jpayne@69 8159 __Pyx_GOTREF(__pyx_t_2);
jpayne@69 8160 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
jpayne@69 8161 }
jpayne@69 8162 __pyx_v_parts = __pyx_t_2;
jpayne@69 8163 __pyx_t_2 = 0;
jpayne@69 8164
jpayne@69 8165 /* "pysam/libcutils.pyx":250
jpayne@69 8166 * contig, coord = region.split(":")
jpayne@69 8167 * parts = coord.split("-")
jpayne@69 8168 * rstart = int(parts[0]) - 1 # <<<<<<<<<<<<<<
jpayne@69 8169 * if len(parts) >= 1:
jpayne@69 8170 * rstop = int(parts[1])
jpayne@69 8171 */
jpayne@69 8172 __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_parts, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 250, __pyx_L1_error)
jpayne@69 8173 __Pyx_GOTREF(__pyx_t_2);
jpayne@69 8174 __pyx_t_10 = __Pyx_PyNumber_Int(__pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 250, __pyx_L1_error)
jpayne@69 8175 __Pyx_GOTREF(__pyx_t_10);
jpayne@69 8176 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@69 8177 __pyx_t_2 = __Pyx_PyInt_SubtractObjC(__pyx_t_10, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 250, __pyx_L1_error)
jpayne@69 8178 __Pyx_GOTREF(__pyx_t_2);
jpayne@69 8179 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
jpayne@69 8180 __pyx_t_7 = __Pyx_PyInt_As_int32_t(__pyx_t_2); if (unlikely((__pyx_t_7 == ((int32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 250, __pyx_L1_error)
jpayne@69 8181 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@69 8182 __pyx_v_rstart = __pyx_t_7;
jpayne@69 8183
jpayne@69 8184 /* "pysam/libcutils.pyx":251
jpayne@69 8185 * parts = coord.split("-")
jpayne@69 8186 * rstart = int(parts[0]) - 1
jpayne@69 8187 * if len(parts) >= 1: # <<<<<<<<<<<<<<
jpayne@69 8188 * rstop = int(parts[1])
jpayne@69 8189 * else:
jpayne@69 8190 */
jpayne@69 8191 __pyx_t_15 = PyObject_Length(__pyx_v_parts); if (unlikely(__pyx_t_15 == ((Py_ssize_t)-1))) __PYX_ERR(0, 251, __pyx_L1_error)
jpayne@69 8192 __pyx_t_1 = (__pyx_t_15 >= 1);
jpayne@69 8193 if (__pyx_t_1) {
jpayne@69 8194
jpayne@69 8195 /* "pysam/libcutils.pyx":252
jpayne@69 8196 * rstart = int(parts[0]) - 1
jpayne@69 8197 * if len(parts) >= 1:
jpayne@69 8198 * rstop = int(parts[1]) # <<<<<<<<<<<<<<
jpayne@69 8199 * else:
jpayne@69 8200 * contig = region
jpayne@69 8201 */
jpayne@69 8202 __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_parts, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 252, __pyx_L1_error)
jpayne@69 8203 __Pyx_GOTREF(__pyx_t_2);
jpayne@69 8204 __pyx_t_10 = __Pyx_PyNumber_Int(__pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 252, __pyx_L1_error)
jpayne@69 8205 __Pyx_GOTREF(__pyx_t_10);
jpayne@69 8206 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@69 8207 __pyx_t_7 = __Pyx_PyInt_As_int32_t(__pyx_t_10); if (unlikely((__pyx_t_7 == ((int32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 252, __pyx_L1_error)
jpayne@69 8208 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
jpayne@69 8209 __pyx_v_rstop = __pyx_t_7;
jpayne@69 8210
jpayne@69 8211 /* "pysam/libcutils.pyx":251
jpayne@69 8212 * parts = coord.split("-")
jpayne@69 8213 * rstart = int(parts[0]) - 1
jpayne@69 8214 * if len(parts) >= 1: # <<<<<<<<<<<<<<
jpayne@69 8215 * rstop = int(parts[1])
jpayne@69 8216 * else:
jpayne@69 8217 */
jpayne@69 8218 }
jpayne@69 8219
jpayne@69 8220 /* "pysam/libcutils.pyx":247
jpayne@69 8221 *
jpayne@69 8222 * if region:
jpayne@69 8223 * if ":" in region: # <<<<<<<<<<<<<<
jpayne@69 8224 * contig, coord = region.split(":")
jpayne@69 8225 * parts = coord.split("-")
jpayne@69 8226 */
jpayne@69 8227 goto __pyx_L32;
jpayne@69 8228 }
jpayne@69 8229
jpayne@69 8230 /* "pysam/libcutils.pyx":254
jpayne@69 8231 * rstop = int(parts[1])
jpayne@69 8232 * else:
jpayne@69 8233 * contig = region # <<<<<<<<<<<<<<
jpayne@69 8234 *
jpayne@69 8235 * if rstart > rstop:
jpayne@69 8236 */
jpayne@69 8237 /*else*/ {
jpayne@69 8238 __Pyx_INCREF(__pyx_v_region);
jpayne@69 8239 __Pyx_DECREF_SET(__pyx_v_contig, __pyx_v_region);
jpayne@69 8240 }
jpayne@69 8241 __pyx_L32:;
jpayne@69 8242
jpayne@69 8243 /* "pysam/libcutils.pyx":246
jpayne@69 8244 * raise ValueError('stop out of range (%i)' % stop)
jpayne@69 8245 *
jpayne@69 8246 * if region: # <<<<<<<<<<<<<<
jpayne@69 8247 * if ":" in region:
jpayne@69 8248 * contig, coord = region.split(":")
jpayne@69 8249 */
jpayne@69 8250 }
jpayne@69 8251
jpayne@69 8252 /* "pysam/libcutils.pyx":256
jpayne@69 8253 * contig = region
jpayne@69 8254 *
jpayne@69 8255 * if rstart > rstop: # <<<<<<<<<<<<<<
jpayne@69 8256 * raise ValueError('invalid coordinates: start (%i) > stop (%i)' % (rstart, rstop))
jpayne@69 8257 * if not 0 <= rstart < MAX_POS:
jpayne@69 8258 */
jpayne@69 8259 __pyx_t_1 = (__pyx_v_rstart > __pyx_v_rstop);
jpayne@69 8260 if (unlikely(__pyx_t_1)) {
jpayne@69 8261
jpayne@69 8262 /* "pysam/libcutils.pyx":257
jpayne@69 8263 *
jpayne@69 8264 * if rstart > rstop:
jpayne@69 8265 * raise ValueError('invalid coordinates: start (%i) > stop (%i)' % (rstart, rstop)) # <<<<<<<<<<<<<<
jpayne@69 8266 * if not 0 <= rstart < MAX_POS:
jpayne@69 8267 * raise ValueError('start out of range (%i)' % rstart)
jpayne@69 8268 */
jpayne@69 8269 __pyx_t_10 = __Pyx_PyInt_From_int32_t(__pyx_v_rstart); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 257, __pyx_L1_error)
jpayne@69 8270 __Pyx_GOTREF(__pyx_t_10);
jpayne@69 8271 __pyx_t_2 = __Pyx_PyInt_From_int32_t(__pyx_v_rstop); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 257, __pyx_L1_error)
jpayne@69 8272 __Pyx_GOTREF(__pyx_t_2);
jpayne@69 8273 __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 257, __pyx_L1_error)
jpayne@69 8274 __Pyx_GOTREF(__pyx_t_9);
jpayne@69 8275 __Pyx_GIVEREF(__pyx_t_10);
jpayne@69 8276 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_10)) __PYX_ERR(0, 257, __pyx_L1_error);
jpayne@69 8277 __Pyx_GIVEREF(__pyx_t_2);
jpayne@69 8278 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_2)) __PYX_ERR(0, 257, __pyx_L1_error);
jpayne@69 8279 __pyx_t_10 = 0;
jpayne@69 8280 __pyx_t_2 = 0;
jpayne@69 8281 __pyx_t_2 = PyUnicode_Format(__pyx_kp_u_invalid_coordinates_start_i_stop, __pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 257, __pyx_L1_error)
jpayne@69 8282 __Pyx_GOTREF(__pyx_t_2);
jpayne@69 8283 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
jpayne@69 8284 __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 257, __pyx_L1_error)
jpayne@69 8285 __Pyx_GOTREF(__pyx_t_9);
jpayne@69 8286 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@69 8287 __Pyx_Raise(__pyx_t_9, 0, 0, 0);
jpayne@69 8288 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
jpayne@69 8289 __PYX_ERR(0, 257, __pyx_L1_error)
jpayne@69 8290
jpayne@69 8291 /* "pysam/libcutils.pyx":256
jpayne@69 8292 * contig = region
jpayne@69 8293 *
jpayne@69 8294 * if rstart > rstop: # <<<<<<<<<<<<<<
jpayne@69 8295 * raise ValueError('invalid coordinates: start (%i) > stop (%i)' % (rstart, rstop))
jpayne@69 8296 * if not 0 <= rstart < MAX_POS:
jpayne@69 8297 */
jpayne@69 8298 }
jpayne@69 8299
jpayne@69 8300 /* "pysam/libcutils.pyx":258
jpayne@69 8301 * if rstart > rstop:
jpayne@69 8302 * raise ValueError('invalid coordinates: start (%i) > stop (%i)' % (rstart, rstop))
jpayne@69 8303 * if not 0 <= rstart < MAX_POS: # <<<<<<<<<<<<<<
jpayne@69 8304 * raise ValueError('start out of range (%i)' % rstart)
jpayne@69 8305 * if not 0 <= rstop <= MAX_POS:
jpayne@69 8306 */
jpayne@69 8307 __pyx_t_1 = (0 <= __pyx_v_rstart);
jpayne@69 8308 if (__pyx_t_1) {
jpayne@69 8309 __pyx_t_1 = (__pyx_v_rstart < __pyx_v_5pysam_9libcutils_MAX_POS);
jpayne@69 8310 }
jpayne@69 8311 __pyx_t_3 = (!__pyx_t_1);
jpayne@69 8312 if (unlikely(__pyx_t_3)) {
jpayne@69 8313
jpayne@69 8314 /* "pysam/libcutils.pyx":259
jpayne@69 8315 * raise ValueError('invalid coordinates: start (%i) > stop (%i)' % (rstart, rstop))
jpayne@69 8316 * if not 0 <= rstart < MAX_POS:
jpayne@69 8317 * raise ValueError('start out of range (%i)' % rstart) # <<<<<<<<<<<<<<
jpayne@69 8318 * if not 0 <= rstop <= MAX_POS:
jpayne@69 8319 * raise ValueError('stop out of range (%i)' % rstop)
jpayne@69 8320 */
jpayne@69 8321 __pyx_t_9 = __Pyx_PyInt_From_int32_t(__pyx_v_rstart); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 259, __pyx_L1_error)
jpayne@69 8322 __Pyx_GOTREF(__pyx_t_9);
jpayne@69 8323 __pyx_t_2 = PyUnicode_Format(__pyx_kp_u_start_out_of_range_i, __pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 259, __pyx_L1_error)
jpayne@69 8324 __Pyx_GOTREF(__pyx_t_2);
jpayne@69 8325 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
jpayne@69 8326 __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 259, __pyx_L1_error)
jpayne@69 8327 __Pyx_GOTREF(__pyx_t_9);
jpayne@69 8328 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@69 8329 __Pyx_Raise(__pyx_t_9, 0, 0, 0);
jpayne@69 8330 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
jpayne@69 8331 __PYX_ERR(0, 259, __pyx_L1_error)
jpayne@69 8332
jpayne@69 8333 /* "pysam/libcutils.pyx":258
jpayne@69 8334 * if rstart > rstop:
jpayne@69 8335 * raise ValueError('invalid coordinates: start (%i) > stop (%i)' % (rstart, rstop))
jpayne@69 8336 * if not 0 <= rstart < MAX_POS: # <<<<<<<<<<<<<<
jpayne@69 8337 * raise ValueError('start out of range (%i)' % rstart)
jpayne@69 8338 * if not 0 <= rstop <= MAX_POS:
jpayne@69 8339 */
jpayne@69 8340 }
jpayne@69 8341
jpayne@69 8342 /* "pysam/libcutils.pyx":260
jpayne@69 8343 * if not 0 <= rstart < MAX_POS:
jpayne@69 8344 * raise ValueError('start out of range (%i)' % rstart)
jpayne@69 8345 * if not 0 <= rstop <= MAX_POS: # <<<<<<<<<<<<<<
jpayne@69 8346 * raise ValueError('stop out of range (%i)' % rstop)
jpayne@69 8347 *
jpayne@69 8348 */
jpayne@69 8349 __pyx_t_3 = (0 <= __pyx_v_rstop);
jpayne@69 8350 if (__pyx_t_3) {
jpayne@69 8351 __pyx_t_3 = (__pyx_v_rstop <= __pyx_v_5pysam_9libcutils_MAX_POS);
jpayne@69 8352 }
jpayne@69 8353 __pyx_t_1 = (!__pyx_t_3);
jpayne@69 8354 if (unlikely(__pyx_t_1)) {
jpayne@69 8355
jpayne@69 8356 /* "pysam/libcutils.pyx":261
jpayne@69 8357 * raise ValueError('start out of range (%i)' % rstart)
jpayne@69 8358 * if not 0 <= rstop <= MAX_POS:
jpayne@69 8359 * raise ValueError('stop out of range (%i)' % rstop) # <<<<<<<<<<<<<<
jpayne@69 8360 *
jpayne@69 8361 * return contig, rstart, rstop
jpayne@69 8362 */
jpayne@69 8363 __pyx_t_9 = __Pyx_PyInt_From_int32_t(__pyx_v_rstop); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 261, __pyx_L1_error)
jpayne@69 8364 __Pyx_GOTREF(__pyx_t_9);
jpayne@69 8365 __pyx_t_2 = PyUnicode_Format(__pyx_kp_u_stop_out_of_range_i, __pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 261, __pyx_L1_error)
jpayne@69 8366 __Pyx_GOTREF(__pyx_t_2);
jpayne@69 8367 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
jpayne@69 8368 __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 261, __pyx_L1_error)
jpayne@69 8369 __Pyx_GOTREF(__pyx_t_9);
jpayne@69 8370 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@69 8371 __Pyx_Raise(__pyx_t_9, 0, 0, 0);
jpayne@69 8372 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
jpayne@69 8373 __PYX_ERR(0, 261, __pyx_L1_error)
jpayne@69 8374
jpayne@69 8375 /* "pysam/libcutils.pyx":260
jpayne@69 8376 * if not 0 <= rstart < MAX_POS:
jpayne@69 8377 * raise ValueError('start out of range (%i)' % rstart)
jpayne@69 8378 * if not 0 <= rstop <= MAX_POS: # <<<<<<<<<<<<<<
jpayne@69 8379 * raise ValueError('stop out of range (%i)' % rstop)
jpayne@69 8380 *
jpayne@69 8381 */
jpayne@69 8382 }
jpayne@69 8383
jpayne@69 8384 /* "pysam/libcutils.pyx":263
jpayne@69 8385 * raise ValueError('stop out of range (%i)' % rstop)
jpayne@69 8386 *
jpayne@69 8387 * return contig, rstart, rstop # <<<<<<<<<<<<<<
jpayne@69 8388 *
jpayne@69 8389 *
jpayne@69 8390 */
jpayne@69 8391 __Pyx_XDECREF(__pyx_r);
jpayne@69 8392 __pyx_t_9 = __Pyx_PyInt_From_int32_t(__pyx_v_rstart); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 263, __pyx_L1_error)
jpayne@69 8393 __Pyx_GOTREF(__pyx_t_9);
jpayne@69 8394 __pyx_t_2 = __Pyx_PyInt_From_int32_t(__pyx_v_rstop); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 263, __pyx_L1_error)
jpayne@69 8395 __Pyx_GOTREF(__pyx_t_2);
jpayne@69 8396 __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 263, __pyx_L1_error)
jpayne@69 8397 __Pyx_GOTREF(__pyx_t_10);
jpayne@69 8398 __Pyx_INCREF(__pyx_v_contig);
jpayne@69 8399 __Pyx_GIVEREF(__pyx_v_contig);
jpayne@69 8400 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_contig)) __PYX_ERR(0, 263, __pyx_L1_error);
jpayne@69 8401 __Pyx_GIVEREF(__pyx_t_9);
jpayne@69 8402 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_9)) __PYX_ERR(0, 263, __pyx_L1_error);
jpayne@69 8403 __Pyx_GIVEREF(__pyx_t_2);
jpayne@69 8404 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_2)) __PYX_ERR(0, 263, __pyx_L1_error);
jpayne@69 8405 __pyx_t_9 = 0;
jpayne@69 8406 __pyx_t_2 = 0;
jpayne@69 8407 __pyx_r = __pyx_t_10;
jpayne@69 8408 __pyx_t_10 = 0;
jpayne@69 8409 goto __pyx_L0;
jpayne@69 8410
jpayne@69 8411 /* "pysam/libcutils.pyx":178
jpayne@69 8412 *
jpayne@69 8413 *
jpayne@69 8414 * cpdef parse_region(contig=None, # <<<<<<<<<<<<<<
jpayne@69 8415 * start=None,
jpayne@69 8416 * stop=None,
jpayne@69 8417 */
jpayne@69 8418
jpayne@69 8419 /* function exit code */
jpayne@69 8420 __pyx_L1_error:;
jpayne@69 8421 __Pyx_XDECREF(__pyx_t_2);
jpayne@69 8422 __Pyx_XDECREF(__pyx_t_9);
jpayne@69 8423 __Pyx_XDECREF(__pyx_t_10);
jpayne@69 8424 __Pyx_XDECREF(__pyx_t_11);
jpayne@69 8425 __Pyx_XDECREF(__pyx_t_12);
jpayne@69 8426 __Pyx_AddTraceback("pysam.libcutils.parse_region", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@69 8427 __pyx_r = 0;
jpayne@69 8428 __pyx_L0:;
jpayne@69 8429 __Pyx_XDECREF(__pyx_v_coord);
jpayne@69 8430 __Pyx_XDECREF(__pyx_v_parts);
jpayne@69 8431 __Pyx_XDECREF(__pyx_v_contig);
jpayne@69 8432 __Pyx_XDECREF(__pyx_v_stop);
jpayne@69 8433 __Pyx_XGIVEREF(__pyx_r);
jpayne@69 8434 __Pyx_RefNannyFinishContext();
jpayne@69 8435 return __pyx_r;
jpayne@69 8436 }
jpayne@69 8437
jpayne@69 8438 /* Python wrapper */
jpayne@69 8439 static PyObject *__pyx_pw_5pysam_9libcutils_13parse_region(PyObject *__pyx_self,
jpayne@69 8440 #if CYTHON_METH_FASTCALL
jpayne@69 8441 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
jpayne@69 8442 #else
jpayne@69 8443 PyObject *__pyx_args, PyObject *__pyx_kwds
jpayne@69 8444 #endif
jpayne@69 8445 ); /*proto*/
jpayne@69 8446 PyDoc_STRVAR(__pyx_doc_5pysam_9libcutils_12parse_region, "parse alternative ways to specify a genomic region. A region can\n either be specified by :term:`reference`, `start` and\n `end`. `start` and `end` denote 0-based, half-open intervals.\n \n :term:`reference` and `end` are also accepted for backward\n compatibility as synonyms for :term:`contig` and `stop`,\n respectively.\n\n Alternatively, a samtools :term:`region` string can be supplied.\n\n If any of the coordinates are missing they will be replaced by the\n minimum (`start`) or maximum (`end`) coordinate.\n\n Note that region strings are 1-based, while `start` and `end`\n denote an interval in python coordinates.\n\n Returns\n -------\n\n tuple : a tuple of `reference`, `start` and `end`.\n\n Raises\n ------\n\n ValueError\n for invalid or out of bounds regions.\n\n ");
jpayne@69 8447 static PyMethodDef __pyx_mdef_5pysam_9libcutils_13parse_region = {"parse_region", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_9libcutils_13parse_region, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_9libcutils_12parse_region};
jpayne@69 8448 static PyObject *__pyx_pw_5pysam_9libcutils_13parse_region(PyObject *__pyx_self,
jpayne@69 8449 #if CYTHON_METH_FASTCALL
jpayne@69 8450 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
jpayne@69 8451 #else
jpayne@69 8452 PyObject *__pyx_args, PyObject *__pyx_kwds
jpayne@69 8453 #endif
jpayne@69 8454 ) {
jpayne@69 8455 PyObject *__pyx_v_contig = 0;
jpayne@69 8456 PyObject *__pyx_v_start = 0;
jpayne@69 8457 PyObject *__pyx_v_stop = 0;
jpayne@69 8458 PyObject *__pyx_v_region = 0;
jpayne@69 8459 PyObject *__pyx_v_reference = 0;
jpayne@69 8460 PyObject *__pyx_v_end = 0;
jpayne@69 8461 #if !CYTHON_METH_FASTCALL
jpayne@69 8462 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
jpayne@69 8463 #endif
jpayne@69 8464 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
jpayne@69 8465 PyObject* values[6] = {0,0,0,0,0,0};
jpayne@69 8466 int __pyx_lineno = 0;
jpayne@69 8467 const char *__pyx_filename = NULL;
jpayne@69 8468 int __pyx_clineno = 0;
jpayne@69 8469 PyObject *__pyx_r = 0;
jpayne@69 8470 __Pyx_RefNannyDeclarations
jpayne@69 8471 __Pyx_RefNannySetupContext("parse_region (wrapper)", 0);
jpayne@69 8472 #if !CYTHON_METH_FASTCALL
jpayne@69 8473 #if CYTHON_ASSUME_SAFE_MACROS
jpayne@69 8474 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
jpayne@69 8475 #else
jpayne@69 8476 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
jpayne@69 8477 #endif
jpayne@69 8478 #endif
jpayne@69 8479 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
jpayne@69 8480 {
jpayne@69 8481 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_contig,&__pyx_n_s_start,&__pyx_n_s_stop,&__pyx_n_s_region,&__pyx_n_s_reference,&__pyx_n_s_end,0};
jpayne@69 8482 values[0] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
jpayne@69 8483
jpayne@69 8484 /* "pysam/libcutils.pyx":179
jpayne@69 8485 *
jpayne@69 8486 * cpdef parse_region(contig=None,
jpayne@69 8487 * start=None, # <<<<<<<<<<<<<<
jpayne@69 8488 * stop=None,
jpayne@69 8489 * region=None,
jpayne@69 8490 */
jpayne@69 8491 values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
jpayne@69 8492
jpayne@69 8493 /* "pysam/libcutils.pyx":180
jpayne@69 8494 * cpdef parse_region(contig=None,
jpayne@69 8495 * start=None,
jpayne@69 8496 * stop=None, # <<<<<<<<<<<<<<
jpayne@69 8497 * region=None,
jpayne@69 8498 * reference=None,
jpayne@69 8499 */
jpayne@69 8500 values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
jpayne@69 8501
jpayne@69 8502 /* "pysam/libcutils.pyx":181
jpayne@69 8503 * start=None,
jpayne@69 8504 * stop=None,
jpayne@69 8505 * region=None, # <<<<<<<<<<<<<<
jpayne@69 8506 * reference=None,
jpayne@69 8507 * end=None):
jpayne@69 8508 */
jpayne@69 8509 values[3] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
jpayne@69 8510
jpayne@69 8511 /* "pysam/libcutils.pyx":182
jpayne@69 8512 * stop=None,
jpayne@69 8513 * region=None,
jpayne@69 8514 * reference=None, # <<<<<<<<<<<<<<
jpayne@69 8515 * end=None):
jpayne@69 8516 * """parse alternative ways to specify a genomic region. A region can
jpayne@69 8517 */
jpayne@69 8518 values[4] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
jpayne@69 8519
jpayne@69 8520 /* "pysam/libcutils.pyx":183
jpayne@69 8521 * region=None,
jpayne@69 8522 * reference=None,
jpayne@69 8523 * end=None): # <<<<<<<<<<<<<<
jpayne@69 8524 * """parse alternative ways to specify a genomic region. A region can
jpayne@69 8525 * either be specified by :term:`reference`, `start` and
jpayne@69 8526 */
jpayne@69 8527 values[5] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
jpayne@69 8528 if (__pyx_kwds) {
jpayne@69 8529 Py_ssize_t kw_args;
jpayne@69 8530 switch (__pyx_nargs) {
jpayne@69 8531 case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5);
jpayne@69 8532 CYTHON_FALLTHROUGH;
jpayne@69 8533 case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
jpayne@69 8534 CYTHON_FALLTHROUGH;
jpayne@69 8535 case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
jpayne@69 8536 CYTHON_FALLTHROUGH;
jpayne@69 8537 case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
jpayne@69 8538 CYTHON_FALLTHROUGH;
jpayne@69 8539 case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
jpayne@69 8540 CYTHON_FALLTHROUGH;
jpayne@69 8541 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
jpayne@69 8542 CYTHON_FALLTHROUGH;
jpayne@69 8543 case 0: break;
jpayne@69 8544 default: goto __pyx_L5_argtuple_error;
jpayne@69 8545 }
jpayne@69 8546 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
jpayne@69 8547 switch (__pyx_nargs) {
jpayne@69 8548 case 0:
jpayne@69 8549 if (kw_args > 0) {
jpayne@69 8550 PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_contig);
jpayne@69 8551 if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
jpayne@69 8552 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 178, __pyx_L3_error)
jpayne@69 8553 }
jpayne@69 8554 CYTHON_FALLTHROUGH;
jpayne@69 8555 case 1:
jpayne@69 8556 if (kw_args > 0) {
jpayne@69 8557 PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_start);
jpayne@69 8558 if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
jpayne@69 8559 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 178, __pyx_L3_error)
jpayne@69 8560 }
jpayne@69 8561 CYTHON_FALLTHROUGH;
jpayne@69 8562 case 2:
jpayne@69 8563 if (kw_args > 0) {
jpayne@69 8564 PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_stop);
jpayne@69 8565 if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
jpayne@69 8566 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 178, __pyx_L3_error)
jpayne@69 8567 }
jpayne@69 8568 CYTHON_FALLTHROUGH;
jpayne@69 8569 case 3:
jpayne@69 8570 if (kw_args > 0) {
jpayne@69 8571 PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_region);
jpayne@69 8572 if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
jpayne@69 8573 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 178, __pyx_L3_error)
jpayne@69 8574 }
jpayne@69 8575 CYTHON_FALLTHROUGH;
jpayne@69 8576 case 4:
jpayne@69 8577 if (kw_args > 0) {
jpayne@69 8578 PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_reference);
jpayne@69 8579 if (value) { values[4] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
jpayne@69 8580 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 178, __pyx_L3_error)
jpayne@69 8581 }
jpayne@69 8582 CYTHON_FALLTHROUGH;
jpayne@69 8583 case 5:
jpayne@69 8584 if (kw_args > 0) {
jpayne@69 8585 PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_end);
jpayne@69 8586 if (value) { values[5] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
jpayne@69 8587 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 178, __pyx_L3_error)
jpayne@69 8588 }
jpayne@69 8589 }
jpayne@69 8590 if (unlikely(kw_args > 0)) {
jpayne@69 8591 const Py_ssize_t kwd_pos_args = __pyx_nargs;
jpayne@69 8592 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "parse_region") < 0)) __PYX_ERR(0, 178, __pyx_L3_error)
jpayne@69 8593 }
jpayne@69 8594 } else {
jpayne@69 8595 switch (__pyx_nargs) {
jpayne@69 8596 case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5);
jpayne@69 8597 CYTHON_FALLTHROUGH;
jpayne@69 8598 case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
jpayne@69 8599 CYTHON_FALLTHROUGH;
jpayne@69 8600 case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
jpayne@69 8601 CYTHON_FALLTHROUGH;
jpayne@69 8602 case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
jpayne@69 8603 CYTHON_FALLTHROUGH;
jpayne@69 8604 case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
jpayne@69 8605 CYTHON_FALLTHROUGH;
jpayne@69 8606 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
jpayne@69 8607 CYTHON_FALLTHROUGH;
jpayne@69 8608 case 0: break;
jpayne@69 8609 default: goto __pyx_L5_argtuple_error;
jpayne@69 8610 }
jpayne@69 8611 }
jpayne@69 8612 __pyx_v_contig = values[0];
jpayne@69 8613 __pyx_v_start = values[1];
jpayne@69 8614 __pyx_v_stop = values[2];
jpayne@69 8615 __pyx_v_region = values[3];
jpayne@69 8616 __pyx_v_reference = values[4];
jpayne@69 8617 __pyx_v_end = values[5];
jpayne@69 8618 }
jpayne@69 8619 goto __pyx_L6_skip;
jpayne@69 8620 __pyx_L5_argtuple_error:;
jpayne@69 8621 __Pyx_RaiseArgtupleInvalid("parse_region", 0, 0, 6, __pyx_nargs); __PYX_ERR(0, 178, __pyx_L3_error)
jpayne@69 8622 __pyx_L6_skip:;
jpayne@69 8623 goto __pyx_L4_argument_unpacking_done;
jpayne@69 8624 __pyx_L3_error:;
jpayne@69 8625 {
jpayne@69 8626 Py_ssize_t __pyx_temp;
jpayne@69 8627 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
jpayne@69 8628 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
jpayne@69 8629 }
jpayne@69 8630 }
jpayne@69 8631 __Pyx_AddTraceback("pysam.libcutils.parse_region", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@69 8632 __Pyx_RefNannyFinishContext();
jpayne@69 8633 return NULL;
jpayne@69 8634 __pyx_L4_argument_unpacking_done:;
jpayne@69 8635 __pyx_r = __pyx_pf_5pysam_9libcutils_12parse_region(__pyx_self, __pyx_v_contig, __pyx_v_start, __pyx_v_stop, __pyx_v_region, __pyx_v_reference, __pyx_v_end);
jpayne@69 8636
jpayne@69 8637 /* "pysam/libcutils.pyx":178
jpayne@69 8638 *
jpayne@69 8639 *
jpayne@69 8640 * cpdef parse_region(contig=None, # <<<<<<<<<<<<<<
jpayne@69 8641 * start=None,
jpayne@69 8642 * stop=None,
jpayne@69 8643 */
jpayne@69 8644
jpayne@69 8645 /* function exit code */
jpayne@69 8646 {
jpayne@69 8647 Py_ssize_t __pyx_temp;
jpayne@69 8648 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
jpayne@69 8649 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
jpayne@69 8650 }
jpayne@69 8651 }
jpayne@69 8652 __Pyx_RefNannyFinishContext();
jpayne@69 8653 return __pyx_r;
jpayne@69 8654 }
jpayne@69 8655
jpayne@69 8656 static PyObject *__pyx_pf_5pysam_9libcutils_12parse_region(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_contig, PyObject *__pyx_v_start, PyObject *__pyx_v_stop, PyObject *__pyx_v_region, PyObject *__pyx_v_reference, PyObject *__pyx_v_end) {
jpayne@69 8657 PyObject *__pyx_r = NULL;
jpayne@69 8658 __Pyx_RefNannyDeclarations
jpayne@69 8659 PyObject *__pyx_t_1 = NULL;
jpayne@69 8660 struct __pyx_opt_args_5pysam_9libcutils_parse_region __pyx_t_2;
jpayne@69 8661 int __pyx_lineno = 0;
jpayne@69 8662 const char *__pyx_filename = NULL;
jpayne@69 8663 int __pyx_clineno = 0;
jpayne@69 8664 __Pyx_RefNannySetupContext("parse_region", 1);
jpayne@69 8665 __Pyx_XDECREF(__pyx_r);
jpayne@69 8666 __pyx_t_2.__pyx_n = 6;
jpayne@69 8667 __pyx_t_2.contig = __pyx_v_contig;
jpayne@69 8668 __pyx_t_2.start = __pyx_v_start;
jpayne@69 8669 __pyx_t_2.stop = __pyx_v_stop;
jpayne@69 8670 __pyx_t_2.region = __pyx_v_region;
jpayne@69 8671 __pyx_t_2.reference = __pyx_v_reference;
jpayne@69 8672 __pyx_t_2.end = __pyx_v_end;
jpayne@69 8673 __pyx_t_1 = __pyx_f_5pysam_9libcutils_parse_region(0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 178, __pyx_L1_error)
jpayne@69 8674 __Pyx_GOTREF(__pyx_t_1);
jpayne@69 8675 __pyx_r = __pyx_t_1;
jpayne@69 8676 __pyx_t_1 = 0;
jpayne@69 8677 goto __pyx_L0;
jpayne@69 8678
jpayne@69 8679 /* function exit code */
jpayne@69 8680 __pyx_L1_error:;
jpayne@69 8681 __Pyx_XDECREF(__pyx_t_1);
jpayne@69 8682 __Pyx_AddTraceback("pysam.libcutils.parse_region", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@69 8683 __pyx_r = NULL;
jpayne@69 8684 __pyx_L0:;
jpayne@69 8685 __Pyx_XGIVEREF(__pyx_r);
jpayne@69 8686 __Pyx_RefNannyFinishContext();
jpayne@69 8687 return __pyx_r;
jpayne@69 8688 }
jpayne@69 8689
jpayne@69 8690 /* "pysam/libcutils.pyx":266
jpayne@69 8691 *
jpayne@69 8692 *
jpayne@69 8693 * cdef int libc_whence_from_io(int whence): # <<<<<<<<<<<<<<
jpayne@69 8694 * # io.SEEK_SET/_CUR/_END are by definition 0/1/2 but C/POSIX's equivalents
jpayne@69 8695 * # have unspecified values. So we must translate, but checking for 0/1/2
jpayne@69 8696 */
jpayne@69 8697
jpayne@69 8698 static int __pyx_f_5pysam_9libcutils_libc_whence_from_io(int __pyx_v_whence) {
jpayne@69 8699 int __pyx_r;
jpayne@69 8700 int __pyx_t_1;
jpayne@69 8701
jpayne@69 8702 /* "pysam/libcutils.pyx":270
jpayne@69 8703 * # have unspecified values. So we must translate, but checking for 0/1/2
jpayne@69 8704 * # rather than io.SEEK_SET/etc suffices.
jpayne@69 8705 * if whence == 0: return SEEK_SET # <<<<<<<<<<<<<<
jpayne@69 8706 * if whence == 1: return SEEK_CUR
jpayne@69 8707 * if whence == 2: return SEEK_END
jpayne@69 8708 */
jpayne@69 8709 __pyx_t_1 = (__pyx_v_whence == 0);
jpayne@69 8710 if (__pyx_t_1) {
jpayne@69 8711 __pyx_r = SEEK_SET;
jpayne@69 8712 goto __pyx_L0;
jpayne@69 8713 }
jpayne@69 8714
jpayne@69 8715 /* "pysam/libcutils.pyx":271
jpayne@69 8716 * # rather than io.SEEK_SET/etc suffices.
jpayne@69 8717 * if whence == 0: return SEEK_SET
jpayne@69 8718 * if whence == 1: return SEEK_CUR # <<<<<<<<<<<<<<
jpayne@69 8719 * if whence == 2: return SEEK_END
jpayne@69 8720 * return whence # Otherwise likely invalid, but let HTSlib or OS report it
jpayne@69 8721 */
jpayne@69 8722 __pyx_t_1 = (__pyx_v_whence == 1);
jpayne@69 8723 if (__pyx_t_1) {
jpayne@69 8724 __pyx_r = SEEK_CUR;
jpayne@69 8725 goto __pyx_L0;
jpayne@69 8726 }
jpayne@69 8727
jpayne@69 8728 /* "pysam/libcutils.pyx":272
jpayne@69 8729 * if whence == 0: return SEEK_SET
jpayne@69 8730 * if whence == 1: return SEEK_CUR
jpayne@69 8731 * if whence == 2: return SEEK_END # <<<<<<<<<<<<<<
jpayne@69 8732 * return whence # Otherwise likely invalid, but let HTSlib or OS report it
jpayne@69 8733 *
jpayne@69 8734 */
jpayne@69 8735 __pyx_t_1 = (__pyx_v_whence == 2);
jpayne@69 8736 if (__pyx_t_1) {
jpayne@69 8737 __pyx_r = SEEK_END;
jpayne@69 8738 goto __pyx_L0;
jpayne@69 8739 }
jpayne@69 8740
jpayne@69 8741 /* "pysam/libcutils.pyx":273
jpayne@69 8742 * if whence == 1: return SEEK_CUR
jpayne@69 8743 * if whence == 2: return SEEK_END
jpayne@69 8744 * return whence # Otherwise likely invalid, but let HTSlib or OS report it # <<<<<<<<<<<<<<
jpayne@69 8745 *
jpayne@69 8746 *
jpayne@69 8747 */
jpayne@69 8748 __pyx_r = __pyx_v_whence;
jpayne@69 8749 goto __pyx_L0;
jpayne@69 8750
jpayne@69 8751 /* "pysam/libcutils.pyx":266
jpayne@69 8752 *
jpayne@69 8753 *
jpayne@69 8754 * cdef int libc_whence_from_io(int whence): # <<<<<<<<<<<<<<
jpayne@69 8755 * # io.SEEK_SET/_CUR/_END are by definition 0/1/2 but C/POSIX's equivalents
jpayne@69 8756 * # have unspecified values. So we must translate, but checking for 0/1/2
jpayne@69 8757 */
jpayne@69 8758
jpayne@69 8759 /* function exit code */
jpayne@69 8760 __pyx_L0:;
jpayne@69 8761 return __pyx_r;
jpayne@69 8762 }
jpayne@69 8763
jpayne@69 8764 /* "pysam/libcutils.pyx":276
jpayne@69 8765 *
jpayne@69 8766 *
jpayne@69 8767 * def _pysam_dispatch(collection, # <<<<<<<<<<<<<<
jpayne@69 8768 * method,
jpayne@69 8769 * args=None,
jpayne@69 8770 */
jpayne@69 8771
jpayne@69 8772 /* Python wrapper */
jpayne@69 8773 static PyObject *__pyx_pw_5pysam_9libcutils_15_pysam_dispatch(PyObject *__pyx_self,
jpayne@69 8774 #if CYTHON_METH_FASTCALL
jpayne@69 8775 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
jpayne@69 8776 #else
jpayne@69 8777 PyObject *__pyx_args, PyObject *__pyx_kwds
jpayne@69 8778 #endif
jpayne@69 8779 ); /*proto*/
jpayne@69 8780 PyDoc_STRVAR(__pyx_doc_5pysam_9libcutils_14_pysam_dispatch, "call ``method`` in samtools/bcftools providing arguments in args.\n \n By default, stdout is redirected to a temporary file using the patched\n C sources except for a few commands that have an explicit output option\n (typically: -o). In these commands (such as samtools view), this explicit\n option is used. If *is_usage* is True, then these explicit output options\n will not be used.\n\n Catching of stdout can be turned off by setting *catch_stdout* to\n False.\n ");
jpayne@69 8781 static PyMethodDef __pyx_mdef_5pysam_9libcutils_15_pysam_dispatch = {"_pysam_dispatch", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_9libcutils_15_pysam_dispatch, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_5pysam_9libcutils_14_pysam_dispatch};
jpayne@69 8782 static PyObject *__pyx_pw_5pysam_9libcutils_15_pysam_dispatch(PyObject *__pyx_self,
jpayne@69 8783 #if CYTHON_METH_FASTCALL
jpayne@69 8784 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
jpayne@69 8785 #else
jpayne@69 8786 PyObject *__pyx_args, PyObject *__pyx_kwds
jpayne@69 8787 #endif
jpayne@69 8788 ) {
jpayne@69 8789 PyObject *__pyx_v_collection = 0;
jpayne@69 8790 PyObject *__pyx_v_method = 0;
jpayne@69 8791 PyObject *__pyx_v_args = 0;
jpayne@69 8792 PyObject *__pyx_v_catch_stdout = 0;
jpayne@69 8793 PyObject *__pyx_v_is_usage = 0;
jpayne@69 8794 PyObject *__pyx_v_save_stdout = 0;
jpayne@69 8795 #if !CYTHON_METH_FASTCALL
jpayne@69 8796 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
jpayne@69 8797 #endif
jpayne@69 8798 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
jpayne@69 8799 PyObject* values[6] = {0,0,0,0,0,0};
jpayne@69 8800 int __pyx_lineno = 0;
jpayne@69 8801 const char *__pyx_filename = NULL;
jpayne@69 8802 int __pyx_clineno = 0;
jpayne@69 8803 PyObject *__pyx_r = 0;
jpayne@69 8804 __Pyx_RefNannyDeclarations
jpayne@69 8805 __Pyx_RefNannySetupContext("_pysam_dispatch (wrapper)", 0);
jpayne@69 8806 #if !CYTHON_METH_FASTCALL
jpayne@69 8807 #if CYTHON_ASSUME_SAFE_MACROS
jpayne@69 8808 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
jpayne@69 8809 #else
jpayne@69 8810 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
jpayne@69 8811 #endif
jpayne@69 8812 #endif
jpayne@69 8813 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
jpayne@69 8814 {
jpayne@69 8815 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_collection,&__pyx_n_s_method,&__pyx_n_s_args,&__pyx_n_s_catch_stdout,&__pyx_n_s_is_usage,&__pyx_n_s_save_stdout,0};
jpayne@69 8816
jpayne@69 8817 /* "pysam/libcutils.pyx":278
jpayne@69 8818 * def _pysam_dispatch(collection,
jpayne@69 8819 * method,
jpayne@69 8820 * args=None, # <<<<<<<<<<<<<<
jpayne@69 8821 * catch_stdout=True,
jpayne@69 8822 * is_usage=False,
jpayne@69 8823 */
jpayne@69 8824 values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
jpayne@69 8825
jpayne@69 8826 /* "pysam/libcutils.pyx":279
jpayne@69 8827 * method,
jpayne@69 8828 * args=None,
jpayne@69 8829 * catch_stdout=True, # <<<<<<<<<<<<<<
jpayne@69 8830 * is_usage=False,
jpayne@69 8831 * save_stdout=None):
jpayne@69 8832 */
jpayne@69 8833 values[3] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)((PyObject *)Py_True)));
jpayne@69 8834
jpayne@69 8835 /* "pysam/libcutils.pyx":280
jpayne@69 8836 * args=None,
jpayne@69 8837 * catch_stdout=True,
jpayne@69 8838 * is_usage=False, # <<<<<<<<<<<<<<
jpayne@69 8839 * save_stdout=None):
jpayne@69 8840 * '''call ``method`` in samtools/bcftools providing arguments in args.
jpayne@69 8841 */
jpayne@69 8842 values[4] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)((PyObject *)Py_False)));
jpayne@69 8843
jpayne@69 8844 /* "pysam/libcutils.pyx":281
jpayne@69 8845 * catch_stdout=True,
jpayne@69 8846 * is_usage=False,
jpayne@69 8847 * save_stdout=None): # <<<<<<<<<<<<<<
jpayne@69 8848 * '''call ``method`` in samtools/bcftools providing arguments in args.
jpayne@69 8849 *
jpayne@69 8850 */
jpayne@69 8851 values[5] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
jpayne@69 8852 if (__pyx_kwds) {
jpayne@69 8853 Py_ssize_t kw_args;
jpayne@69 8854 switch (__pyx_nargs) {
jpayne@69 8855 case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5);
jpayne@69 8856 CYTHON_FALLTHROUGH;
jpayne@69 8857 case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
jpayne@69 8858 CYTHON_FALLTHROUGH;
jpayne@69 8859 case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
jpayne@69 8860 CYTHON_FALLTHROUGH;
jpayne@69 8861 case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
jpayne@69 8862 CYTHON_FALLTHROUGH;
jpayne@69 8863 case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
jpayne@69 8864 CYTHON_FALLTHROUGH;
jpayne@69 8865 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
jpayne@69 8866 CYTHON_FALLTHROUGH;
jpayne@69 8867 case 0: break;
jpayne@69 8868 default: goto __pyx_L5_argtuple_error;
jpayne@69 8869 }
jpayne@69 8870 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
jpayne@69 8871 switch (__pyx_nargs) {
jpayne@69 8872 case 0:
jpayne@69 8873 if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_collection)) != 0)) {
jpayne@69 8874 (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
jpayne@69 8875 kw_args--;
jpayne@69 8876 }
jpayne@69 8877 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 276, __pyx_L3_error)
jpayne@69 8878 else goto __pyx_L5_argtuple_error;
jpayne@69 8879 CYTHON_FALLTHROUGH;
jpayne@69 8880 case 1:
jpayne@69 8881 if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_method)) != 0)) {
jpayne@69 8882 (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
jpayne@69 8883 kw_args--;
jpayne@69 8884 }
jpayne@69 8885 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 276, __pyx_L3_error)
jpayne@69 8886 else {
jpayne@69 8887 __Pyx_RaiseArgtupleInvalid("_pysam_dispatch", 0, 2, 6, 1); __PYX_ERR(0, 276, __pyx_L3_error)
jpayne@69 8888 }
jpayne@69 8889 CYTHON_FALLTHROUGH;
jpayne@69 8890 case 2:
jpayne@69 8891 if (kw_args > 0) {
jpayne@69 8892 PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_args);
jpayne@69 8893 if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
jpayne@69 8894 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 276, __pyx_L3_error)
jpayne@69 8895 }
jpayne@69 8896 CYTHON_FALLTHROUGH;
jpayne@69 8897 case 3:
jpayne@69 8898 if (kw_args > 0) {
jpayne@69 8899 PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_catch_stdout);
jpayne@69 8900 if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
jpayne@69 8901 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 276, __pyx_L3_error)
jpayne@69 8902 }
jpayne@69 8903 CYTHON_FALLTHROUGH;
jpayne@69 8904 case 4:
jpayne@69 8905 if (kw_args > 0) {
jpayne@69 8906 PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_is_usage);
jpayne@69 8907 if (value) { values[4] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
jpayne@69 8908 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 276, __pyx_L3_error)
jpayne@69 8909 }
jpayne@69 8910 CYTHON_FALLTHROUGH;
jpayne@69 8911 case 5:
jpayne@69 8912 if (kw_args > 0) {
jpayne@69 8913 PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_save_stdout);
jpayne@69 8914 if (value) { values[5] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
jpayne@69 8915 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 276, __pyx_L3_error)
jpayne@69 8916 }
jpayne@69 8917 }
jpayne@69 8918 if (unlikely(kw_args > 0)) {
jpayne@69 8919 const Py_ssize_t kwd_pos_args = __pyx_nargs;
jpayne@69 8920 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "_pysam_dispatch") < 0)) __PYX_ERR(0, 276, __pyx_L3_error)
jpayne@69 8921 }
jpayne@69 8922 } else {
jpayne@69 8923 switch (__pyx_nargs) {
jpayne@69 8924 case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5);
jpayne@69 8925 CYTHON_FALLTHROUGH;
jpayne@69 8926 case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
jpayne@69 8927 CYTHON_FALLTHROUGH;
jpayne@69 8928 case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
jpayne@69 8929 CYTHON_FALLTHROUGH;
jpayne@69 8930 case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
jpayne@69 8931 CYTHON_FALLTHROUGH;
jpayne@69 8932 case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
jpayne@69 8933 values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
jpayne@69 8934 break;
jpayne@69 8935 default: goto __pyx_L5_argtuple_error;
jpayne@69 8936 }
jpayne@69 8937 }
jpayne@69 8938 __pyx_v_collection = values[0];
jpayne@69 8939 __pyx_v_method = values[1];
jpayne@69 8940 __pyx_v_args = values[2];
jpayne@69 8941 __pyx_v_catch_stdout = values[3];
jpayne@69 8942 __pyx_v_is_usage = values[4];
jpayne@69 8943 __pyx_v_save_stdout = values[5];
jpayne@69 8944 }
jpayne@69 8945 goto __pyx_L6_skip;
jpayne@69 8946 __pyx_L5_argtuple_error:;
jpayne@69 8947 __Pyx_RaiseArgtupleInvalid("_pysam_dispatch", 0, 2, 6, __pyx_nargs); __PYX_ERR(0, 276, __pyx_L3_error)
jpayne@69 8948 __pyx_L6_skip:;
jpayne@69 8949 goto __pyx_L4_argument_unpacking_done;
jpayne@69 8950 __pyx_L3_error:;
jpayne@69 8951 {
jpayne@69 8952 Py_ssize_t __pyx_temp;
jpayne@69 8953 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
jpayne@69 8954 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
jpayne@69 8955 }
jpayne@69 8956 }
jpayne@69 8957 __Pyx_AddTraceback("pysam.libcutils._pysam_dispatch", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@69 8958 __Pyx_RefNannyFinishContext();
jpayne@69 8959 return NULL;
jpayne@69 8960 __pyx_L4_argument_unpacking_done:;
jpayne@69 8961 __pyx_r = __pyx_pf_5pysam_9libcutils_14_pysam_dispatch(__pyx_self, __pyx_v_collection, __pyx_v_method, __pyx_v_args, __pyx_v_catch_stdout, __pyx_v_is_usage, __pyx_v_save_stdout);
jpayne@69 8962
jpayne@69 8963 /* "pysam/libcutils.pyx":276
jpayne@69 8964 *
jpayne@69 8965 *
jpayne@69 8966 * def _pysam_dispatch(collection, # <<<<<<<<<<<<<<
jpayne@69 8967 * method,
jpayne@69 8968 * args=None,
jpayne@69 8969 */
jpayne@69 8970
jpayne@69 8971 /* function exit code */
jpayne@69 8972 {
jpayne@69 8973 Py_ssize_t __pyx_temp;
jpayne@69 8974 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
jpayne@69 8975 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
jpayne@69 8976 }
jpayne@69 8977 }
jpayne@69 8978 __Pyx_RefNannyFinishContext();
jpayne@69 8979 return __pyx_r;
jpayne@69 8980 }
jpayne@69 8981
jpayne@69 8982 /* "pysam/libcutils.pyx":413
jpayne@69 8983 *
jpayne@69 8984 * # get error messages
jpayne@69 8985 * def _collect(fn): # <<<<<<<<<<<<<<
jpayne@69 8986 * out = []
jpayne@69 8987 * try:
jpayne@69 8988 */
jpayne@69 8989
jpayne@69 8990 /* Python wrapper */
jpayne@69 8991 static PyObject *__pyx_pw_5pysam_9libcutils_15_pysam_dispatch_1_collect(PyObject *__pyx_self,
jpayne@69 8992 #if CYTHON_METH_FASTCALL
jpayne@69 8993 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
jpayne@69 8994 #else
jpayne@69 8995 PyObject *__pyx_args, PyObject *__pyx_kwds
jpayne@69 8996 #endif
jpayne@69 8997 ); /*proto*/
jpayne@69 8998 static PyMethodDef __pyx_mdef_5pysam_9libcutils_15_pysam_dispatch_1_collect = {"_collect", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_5pysam_9libcutils_15_pysam_dispatch_1_collect, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0};
jpayne@69 8999 static PyObject *__pyx_pw_5pysam_9libcutils_15_pysam_dispatch_1_collect(PyObject *__pyx_self,
jpayne@69 9000 #if CYTHON_METH_FASTCALL
jpayne@69 9001 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
jpayne@69 9002 #else
jpayne@69 9003 PyObject *__pyx_args, PyObject *__pyx_kwds
jpayne@69 9004 #endif
jpayne@69 9005 ) {
jpayne@69 9006 PyObject *__pyx_v_fn = 0;
jpayne@69 9007 #if !CYTHON_METH_FASTCALL
jpayne@69 9008 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
jpayne@69 9009 #endif
jpayne@69 9010 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
jpayne@69 9011 PyObject* values[1] = {0};
jpayne@69 9012 int __pyx_lineno = 0;
jpayne@69 9013 const char *__pyx_filename = NULL;
jpayne@69 9014 int __pyx_clineno = 0;
jpayne@69 9015 PyObject *__pyx_r = 0;
jpayne@69 9016 __Pyx_RefNannyDeclarations
jpayne@69 9017 __Pyx_RefNannySetupContext("_collect (wrapper)", 0);
jpayne@69 9018 #if !CYTHON_METH_FASTCALL
jpayne@69 9019 #if CYTHON_ASSUME_SAFE_MACROS
jpayne@69 9020 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
jpayne@69 9021 #else
jpayne@69 9022 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
jpayne@69 9023 #endif
jpayne@69 9024 #endif
jpayne@69 9025 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
jpayne@69 9026 {
jpayne@69 9027 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fn,0};
jpayne@69 9028 if (__pyx_kwds) {
jpayne@69 9029 Py_ssize_t kw_args;
jpayne@69 9030 switch (__pyx_nargs) {
jpayne@69 9031 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
jpayne@69 9032 CYTHON_FALLTHROUGH;
jpayne@69 9033 case 0: break;
jpayne@69 9034 default: goto __pyx_L5_argtuple_error;
jpayne@69 9035 }
jpayne@69 9036 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
jpayne@69 9037 switch (__pyx_nargs) {
jpayne@69 9038 case 0:
jpayne@69 9039 if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_fn)) != 0)) {
jpayne@69 9040 (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
jpayne@69 9041 kw_args--;
jpayne@69 9042 }
jpayne@69 9043 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 413, __pyx_L3_error)
jpayne@69 9044 else goto __pyx_L5_argtuple_error;
jpayne@69 9045 }
jpayne@69 9046 if (unlikely(kw_args > 0)) {
jpayne@69 9047 const Py_ssize_t kwd_pos_args = __pyx_nargs;
jpayne@69 9048 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "_collect") < 0)) __PYX_ERR(0, 413, __pyx_L3_error)
jpayne@69 9049 }
jpayne@69 9050 } else if (unlikely(__pyx_nargs != 1)) {
jpayne@69 9051 goto __pyx_L5_argtuple_error;
jpayne@69 9052 } else {
jpayne@69 9053 values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
jpayne@69 9054 }
jpayne@69 9055 __pyx_v_fn = values[0];
jpayne@69 9056 }
jpayne@69 9057 goto __pyx_L6_skip;
jpayne@69 9058 __pyx_L5_argtuple_error:;
jpayne@69 9059 __Pyx_RaiseArgtupleInvalid("_collect", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 413, __pyx_L3_error)
jpayne@69 9060 __pyx_L6_skip:;
jpayne@69 9061 goto __pyx_L4_argument_unpacking_done;
jpayne@69 9062 __pyx_L3_error:;
jpayne@69 9063 {
jpayne@69 9064 Py_ssize_t __pyx_temp;
jpayne@69 9065 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
jpayne@69 9066 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
jpayne@69 9067 }
jpayne@69 9068 }
jpayne@69 9069 __Pyx_AddTraceback("pysam.libcutils._pysam_dispatch._collect", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@69 9070 __Pyx_RefNannyFinishContext();
jpayne@69 9071 return NULL;
jpayne@69 9072 __pyx_L4_argument_unpacking_done:;
jpayne@69 9073 __pyx_r = __pyx_pf_5pysam_9libcutils_15_pysam_dispatch__collect(__pyx_self, __pyx_v_fn);
jpayne@69 9074
jpayne@69 9075 /* function exit code */
jpayne@69 9076 {
jpayne@69 9077 Py_ssize_t __pyx_temp;
jpayne@69 9078 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
jpayne@69 9079 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
jpayne@69 9080 }
jpayne@69 9081 }
jpayne@69 9082 __Pyx_RefNannyFinishContext();
jpayne@69 9083 return __pyx_r;
jpayne@69 9084 }
jpayne@69 9085
jpayne@69 9086 static PyObject *__pyx_pf_5pysam_9libcutils_15_pysam_dispatch__collect(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fn) {
jpayne@69 9087 PyObject *__pyx_v_out = NULL;
jpayne@69 9088 PyObject *__pyx_v_inf = NULL;
jpayne@69 9089 PyObject *__pyx_r = NULL;
jpayne@69 9090 __Pyx_RefNannyDeclarations
jpayne@69 9091 PyObject *__pyx_t_1 = NULL;
jpayne@69 9092 PyObject *__pyx_t_2 = NULL;
jpayne@69 9093 PyObject *__pyx_t_3 = NULL;
jpayne@69 9094 PyObject *__pyx_t_4 = NULL;
jpayne@69 9095 PyObject *__pyx_t_5 = NULL;
jpayne@69 9096 PyObject *__pyx_t_6 = NULL;
jpayne@69 9097 PyObject *__pyx_t_7 = NULL;
jpayne@69 9098 PyObject *__pyx_t_8 = NULL;
jpayne@69 9099 unsigned int __pyx_t_9;
jpayne@69 9100 PyObject *__pyx_t_10 = NULL;
jpayne@69 9101 PyObject *__pyx_t_11 = NULL;
jpayne@69 9102 PyObject *__pyx_t_12 = NULL;
jpayne@69 9103 PyObject *__pyx_t_13 = NULL;
jpayne@69 9104 int __pyx_t_14;
jpayne@69 9105 int __pyx_t_15;
jpayne@69 9106 int __pyx_t_16;
jpayne@69 9107 PyObject *__pyx_t_17 = NULL;
jpayne@69 9108 PyObject *__pyx_t_18 = NULL;
jpayne@69 9109 PyObject *__pyx_t_19 = NULL;
jpayne@69 9110 int __pyx_t_20;
jpayne@69 9111 char const *__pyx_t_21;
jpayne@69 9112 int __pyx_lineno = 0;
jpayne@69 9113 const char *__pyx_filename = NULL;
jpayne@69 9114 int __pyx_clineno = 0;
jpayne@69 9115 __Pyx_RefNannySetupContext("_collect", 1);
jpayne@69 9116
jpayne@69 9117 /* "pysam/libcutils.pyx":414
jpayne@69 9118 * # get error messages
jpayne@69 9119 * def _collect(fn):
jpayne@69 9120 * out = [] # <<<<<<<<<<<<<<
jpayne@69 9121 * try:
jpayne@69 9122 * with open(fn, "r") as inf:
jpayne@69 9123 */
jpayne@69 9124 __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 414, __pyx_L1_error)
jpayne@69 9125 __Pyx_GOTREF(__pyx_t_1);
jpayne@69 9126 __pyx_v_out = __pyx_t_1;
jpayne@69 9127 __pyx_t_1 = 0;
jpayne@69 9128
jpayne@69 9129 /* "pysam/libcutils.pyx":415
jpayne@69 9130 * def _collect(fn):
jpayne@69 9131 * out = []
jpayne@69 9132 * try: # <<<<<<<<<<<<<<
jpayne@69 9133 * with open(fn, "r") as inf:
jpayne@69 9134 * out = inf.read()
jpayne@69 9135 */
jpayne@69 9136 /*try:*/ {
jpayne@69 9137 {
jpayne@69 9138 __Pyx_PyThreadState_declare
jpayne@69 9139 __Pyx_PyThreadState_assign
jpayne@69 9140 __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
jpayne@69 9141 __Pyx_XGOTREF(__pyx_t_2);
jpayne@69 9142 __Pyx_XGOTREF(__pyx_t_3);
jpayne@69 9143 __Pyx_XGOTREF(__pyx_t_4);
jpayne@69 9144 /*try:*/ {
jpayne@69 9145
jpayne@69 9146 /* "pysam/libcutils.pyx":416
jpayne@69 9147 * out = []
jpayne@69 9148 * try:
jpayne@69 9149 * with open(fn, "r") as inf: # <<<<<<<<<<<<<<
jpayne@69 9150 * out = inf.read()
jpayne@69 9151 * except UnicodeDecodeError:
jpayne@69 9152 */
jpayne@69 9153 /*with:*/ {
jpayne@69 9154 __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 416, __pyx_L6_error)
jpayne@69 9155 __Pyx_GOTREF(__pyx_t_1);
jpayne@69 9156 __Pyx_INCREF(__pyx_v_fn);
jpayne@69 9157 __Pyx_GIVEREF(__pyx_v_fn);
jpayne@69 9158 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_fn)) __PYX_ERR(0, 416, __pyx_L6_error);
jpayne@69 9159 __Pyx_INCREF(__pyx_n_u_r);
jpayne@69 9160 __Pyx_GIVEREF(__pyx_n_u_r);
jpayne@69 9161 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_n_u_r)) __PYX_ERR(0, 416, __pyx_L6_error);
jpayne@69 9162 __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 416, __pyx_L6_error)
jpayne@69 9163 __Pyx_GOTREF(__pyx_t_5);
jpayne@69 9164 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
jpayne@69 9165 __pyx_t_6 = __Pyx_PyObject_LookupSpecial(__pyx_t_5, __pyx_n_s_exit); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 416, __pyx_L6_error)
jpayne@69 9166 __Pyx_GOTREF(__pyx_t_6);
jpayne@69 9167 __pyx_t_7 = __Pyx_PyObject_LookupSpecial(__pyx_t_5, __pyx_n_s_enter); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 416, __pyx_L12_error)
jpayne@69 9168 __Pyx_GOTREF(__pyx_t_7);
jpayne@69 9169 __pyx_t_8 = NULL;
jpayne@69 9170 __pyx_t_9 = 0;
jpayne@69 9171 #if CYTHON_UNPACK_METHODS
jpayne@69 9172 if (likely(PyMethod_Check(__pyx_t_7))) {
jpayne@69 9173 __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
jpayne@69 9174 if (likely(__pyx_t_8)) {
jpayne@69 9175 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
jpayne@69 9176 __Pyx_INCREF(__pyx_t_8);
jpayne@69 9177 __Pyx_INCREF(function);
jpayne@69 9178 __Pyx_DECREF_SET(__pyx_t_7, function);
jpayne@69 9179 __pyx_t_9 = 1;
jpayne@69 9180 }
jpayne@69 9181 }
jpayne@69 9182 #endif
jpayne@69 9183 {
jpayne@69 9184 PyObject *__pyx_callargs[2] = {__pyx_t_8, NULL};
jpayne@69 9185 __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_9, 0+__pyx_t_9);
jpayne@69 9186 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
jpayne@69 9187 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 416, __pyx_L12_error)
jpayne@69 9188 __Pyx_GOTREF(__pyx_t_1);
jpayne@69 9189 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
jpayne@69 9190 }
jpayne@69 9191 __pyx_t_7 = __pyx_t_1;
jpayne@69 9192 __pyx_t_1 = 0;
jpayne@69 9193 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
jpayne@69 9194 /*try:*/ {
jpayne@69 9195 {
jpayne@69 9196 __Pyx_PyThreadState_declare
jpayne@69 9197 __Pyx_PyThreadState_assign
jpayne@69 9198 __Pyx_ExceptionSave(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
jpayne@69 9199 __Pyx_XGOTREF(__pyx_t_10);
jpayne@69 9200 __Pyx_XGOTREF(__pyx_t_11);
jpayne@69 9201 __Pyx_XGOTREF(__pyx_t_12);
jpayne@69 9202 /*try:*/ {
jpayne@69 9203 __pyx_v_inf = __pyx_t_7;
jpayne@69 9204 __pyx_t_7 = 0;
jpayne@69 9205
jpayne@69 9206 /* "pysam/libcutils.pyx":417
jpayne@69 9207 * try:
jpayne@69 9208 * with open(fn, "r") as inf:
jpayne@69 9209 * out = inf.read() # <<<<<<<<<<<<<<
jpayne@69 9210 * except UnicodeDecodeError:
jpayne@69 9211 * with open(fn, "rb") as inf:
jpayne@69 9212 */
jpayne@69 9213 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_inf, __pyx_n_s_read); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 417, __pyx_L16_error)
jpayne@69 9214 __Pyx_GOTREF(__pyx_t_5);
jpayne@69 9215 __pyx_t_1 = NULL;
jpayne@69 9216 __pyx_t_9 = 0;
jpayne@69 9217 #if CYTHON_UNPACK_METHODS
jpayne@69 9218 if (likely(PyMethod_Check(__pyx_t_5))) {
jpayne@69 9219 __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5);
jpayne@69 9220 if (likely(__pyx_t_1)) {
jpayne@69 9221 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
jpayne@69 9222 __Pyx_INCREF(__pyx_t_1);
jpayne@69 9223 __Pyx_INCREF(function);
jpayne@69 9224 __Pyx_DECREF_SET(__pyx_t_5, function);
jpayne@69 9225 __pyx_t_9 = 1;
jpayne@69 9226 }
jpayne@69 9227 }
jpayne@69 9228 #endif
jpayne@69 9229 {
jpayne@69 9230 PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL};
jpayne@69 9231 __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_9, 0+__pyx_t_9);
jpayne@69 9232 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
jpayne@69 9233 if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 417, __pyx_L16_error)
jpayne@69 9234 __Pyx_GOTREF(__pyx_t_7);
jpayne@69 9235 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
jpayne@69 9236 }
jpayne@69 9237 __Pyx_DECREF_SET(__pyx_v_out, __pyx_t_7);
jpayne@69 9238 __pyx_t_7 = 0;
jpayne@69 9239
jpayne@69 9240 /* "pysam/libcutils.pyx":416
jpayne@69 9241 * out = []
jpayne@69 9242 * try:
jpayne@69 9243 * with open(fn, "r") as inf: # <<<<<<<<<<<<<<
jpayne@69 9244 * out = inf.read()
jpayne@69 9245 * except UnicodeDecodeError:
jpayne@69 9246 */
jpayne@69 9247 }
jpayne@69 9248 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
jpayne@69 9249 __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
jpayne@69 9250 __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
jpayne@69 9251 goto __pyx_L21_try_end;
jpayne@69 9252 __pyx_L16_error:;
jpayne@69 9253 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
jpayne@69 9254 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
jpayne@69 9255 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
jpayne@69 9256 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
jpayne@69 9257 /*except:*/ {
jpayne@69 9258 __Pyx_AddTraceback("pysam.libcutils._pysam_dispatch._collect", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@69 9259 if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(0, 416, __pyx_L18_except_error)
jpayne@69 9260 __Pyx_XGOTREF(__pyx_t_7);
jpayne@69 9261 __Pyx_XGOTREF(__pyx_t_5);
jpayne@69 9262 __Pyx_XGOTREF(__pyx_t_1);
jpayne@69 9263 __pyx_t_8 = PyTuple_Pack(3, __pyx_t_7, __pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 416, __pyx_L18_except_error)
jpayne@69 9264 __Pyx_GOTREF(__pyx_t_8);
jpayne@69 9265 __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL);
jpayne@69 9266 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
jpayne@69 9267 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
jpayne@69 9268 if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 416, __pyx_L18_except_error)
jpayne@69 9269 __Pyx_GOTREF(__pyx_t_13);
jpayne@69 9270 __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_13);
jpayne@69 9271 __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
jpayne@69 9272 if (__pyx_t_14 < 0) __PYX_ERR(0, 416, __pyx_L18_except_error)
jpayne@69 9273 __pyx_t_15 = (!__pyx_t_14);
jpayne@69 9274 if (unlikely(__pyx_t_15)) {
jpayne@69 9275 __Pyx_GIVEREF(__pyx_t_7);
jpayne@69 9276 __Pyx_GIVEREF(__pyx_t_5);
jpayne@69 9277 __Pyx_XGIVEREF(__pyx_t_1);
jpayne@69 9278 __Pyx_ErrRestoreWithState(__pyx_t_7, __pyx_t_5, __pyx_t_1);
jpayne@69 9279 __pyx_t_7 = 0; __pyx_t_5 = 0; __pyx_t_1 = 0;
jpayne@69 9280 __PYX_ERR(0, 416, __pyx_L18_except_error)
jpayne@69 9281 }
jpayne@69 9282 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
jpayne@69 9283 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
jpayne@69 9284 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
jpayne@69 9285 goto __pyx_L17_exception_handled;
jpayne@69 9286 }
jpayne@69 9287 __pyx_L18_except_error:;
jpayne@69 9288 __Pyx_XGIVEREF(__pyx_t_10);
jpayne@69 9289 __Pyx_XGIVEREF(__pyx_t_11);
jpayne@69 9290 __Pyx_XGIVEREF(__pyx_t_12);
jpayne@69 9291 __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
jpayne@69 9292 goto __pyx_L6_error;
jpayne@69 9293 __pyx_L17_exception_handled:;
jpayne@69 9294 __Pyx_XGIVEREF(__pyx_t_10);
jpayne@69 9295 __Pyx_XGIVEREF(__pyx_t_11);
jpayne@69 9296 __Pyx_XGIVEREF(__pyx_t_12);
jpayne@69 9297 __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
jpayne@69 9298 __pyx_L21_try_end:;
jpayne@69 9299 }
jpayne@69 9300 }
jpayne@69 9301 /*finally:*/ {
jpayne@69 9302 /*normal exit:*/{
jpayne@69 9303 if (__pyx_t_6) {
jpayne@69 9304 __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__9, NULL);
jpayne@69 9305 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
jpayne@69 9306 if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 416, __pyx_L6_error)
jpayne@69 9307 __Pyx_GOTREF(__pyx_t_12);
jpayne@69 9308 __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
jpayne@69 9309 }
jpayne@69 9310 goto __pyx_L15;
jpayne@69 9311 }
jpayne@69 9312 __pyx_L15:;
jpayne@69 9313 }
jpayne@69 9314 goto __pyx_L25;
jpayne@69 9315 __pyx_L12_error:;
jpayne@69 9316 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
jpayne@69 9317 goto __pyx_L6_error;
jpayne@69 9318 __pyx_L25:;
jpayne@69 9319 }
jpayne@69 9320
jpayne@69 9321 /* "pysam/libcutils.pyx":415
jpayne@69 9322 * def _collect(fn):
jpayne@69 9323 * out = []
jpayne@69 9324 * try: # <<<<<<<<<<<<<<
jpayne@69 9325 * with open(fn, "r") as inf:
jpayne@69 9326 * out = inf.read()
jpayne@69 9327 */
jpayne@69 9328 }
jpayne@69 9329 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@69 9330 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@69 9331 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
jpayne@69 9332 goto __pyx_L11_try_end;
jpayne@69 9333 __pyx_L6_error:;
jpayne@69 9334 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
jpayne@69 9335 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
jpayne@69 9336 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
jpayne@69 9337 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
jpayne@69 9338
jpayne@69 9339 /* "pysam/libcutils.pyx":418
jpayne@69 9340 * with open(fn, "r") as inf:
jpayne@69 9341 * out = inf.read()
jpayne@69 9342 * except UnicodeDecodeError: # <<<<<<<<<<<<<<
jpayne@69 9343 * with open(fn, "rb") as inf:
jpayne@69 9344 * # read binary output
jpayne@69 9345 */
jpayne@69 9346 __pyx_t_16 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_UnicodeDecodeError);
jpayne@69 9347 if (__pyx_t_16) {
jpayne@69 9348 __Pyx_AddTraceback("pysam.libcutils._pysam_dispatch._collect", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@69 9349 if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_5, &__pyx_t_7) < 0) __PYX_ERR(0, 418, __pyx_L8_except_error)
jpayne@69 9350 __Pyx_XGOTREF(__pyx_t_1);
jpayne@69 9351 __Pyx_XGOTREF(__pyx_t_5);
jpayne@69 9352 __Pyx_XGOTREF(__pyx_t_7);
jpayne@69 9353
jpayne@69 9354 /* "pysam/libcutils.pyx":419
jpayne@69 9355 * out = inf.read()
jpayne@69 9356 * except UnicodeDecodeError:
jpayne@69 9357 * with open(fn, "rb") as inf: # <<<<<<<<<<<<<<
jpayne@69 9358 * # read binary output
jpayne@69 9359 * out = inf.read()
jpayne@69 9360 */
jpayne@69 9361 /*with:*/ {
jpayne@69 9362 __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 419, __pyx_L8_except_error)
jpayne@69 9363 __Pyx_GOTREF(__pyx_t_8);
jpayne@69 9364 __Pyx_INCREF(__pyx_v_fn);
jpayne@69 9365 __Pyx_GIVEREF(__pyx_v_fn);
jpayne@69 9366 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_fn)) __PYX_ERR(0, 419, __pyx_L8_except_error);
jpayne@69 9367 __Pyx_INCREF(__pyx_n_u_rb);
jpayne@69 9368 __Pyx_GIVEREF(__pyx_n_u_rb);
jpayne@69 9369 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_n_u_rb)) __PYX_ERR(0, 419, __pyx_L8_except_error);
jpayne@69 9370 __pyx_t_17 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_8, NULL); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 419, __pyx_L8_except_error)
jpayne@69 9371 __Pyx_GOTREF(__pyx_t_17);
jpayne@69 9372 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
jpayne@69 9373 __pyx_t_6 = __Pyx_PyObject_LookupSpecial(__pyx_t_17, __pyx_n_s_exit); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 419, __pyx_L8_except_error)
jpayne@69 9374 __Pyx_GOTREF(__pyx_t_6);
jpayne@69 9375 __pyx_t_18 = __Pyx_PyObject_LookupSpecial(__pyx_t_17, __pyx_n_s_enter); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 419, __pyx_L28_error)
jpayne@69 9376 __Pyx_GOTREF(__pyx_t_18);
jpayne@69 9377 __pyx_t_19 = NULL;
jpayne@69 9378 __pyx_t_9 = 0;
jpayne@69 9379 #if CYTHON_UNPACK_METHODS
jpayne@69 9380 if (likely(PyMethod_Check(__pyx_t_18))) {
jpayne@69 9381 __pyx_t_19 = PyMethod_GET_SELF(__pyx_t_18);
jpayne@69 9382 if (likely(__pyx_t_19)) {
jpayne@69 9383 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_18);
jpayne@69 9384 __Pyx_INCREF(__pyx_t_19);
jpayne@69 9385 __Pyx_INCREF(function);
jpayne@69 9386 __Pyx_DECREF_SET(__pyx_t_18, function);
jpayne@69 9387 __pyx_t_9 = 1;
jpayne@69 9388 }
jpayne@69 9389 }
jpayne@69 9390 #endif
jpayne@69 9391 {
jpayne@69 9392 PyObject *__pyx_callargs[2] = {__pyx_t_19, NULL};
jpayne@69 9393 __pyx_t_8 = __Pyx_PyObject_FastCall(__pyx_t_18, __pyx_callargs+1-__pyx_t_9, 0+__pyx_t_9);
jpayne@69 9394 __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
jpayne@69 9395 if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 419, __pyx_L28_error)
jpayne@69 9396 __Pyx_GOTREF(__pyx_t_8);
jpayne@69 9397 __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
jpayne@69 9398 }
jpayne@69 9399 __pyx_t_18 = __pyx_t_8;
jpayne@69 9400 __pyx_t_8 = 0;
jpayne@69 9401 __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
jpayne@69 9402 /*try:*/ {
jpayne@69 9403 {
jpayne@69 9404 __Pyx_PyThreadState_declare
jpayne@69 9405 __Pyx_PyThreadState_assign
jpayne@69 9406 __Pyx_ExceptionSave(&__pyx_t_12, &__pyx_t_11, &__pyx_t_10);
jpayne@69 9407 __Pyx_XGOTREF(__pyx_t_12);
jpayne@69 9408 __Pyx_XGOTREF(__pyx_t_11);
jpayne@69 9409 __Pyx_XGOTREF(__pyx_t_10);
jpayne@69 9410 /*try:*/ {
jpayne@69 9411 __Pyx_XDECREF_SET(__pyx_v_inf, __pyx_t_18);
jpayne@69 9412 __pyx_t_18 = 0;
jpayne@69 9413
jpayne@69 9414 /* "pysam/libcutils.pyx":421
jpayne@69 9415 * with open(fn, "rb") as inf:
jpayne@69 9416 * # read binary output
jpayne@69 9417 * out = inf.read() # <<<<<<<<<<<<<<
jpayne@69 9418 * finally:
jpayne@69 9419 * os.remove(fn)
jpayne@69 9420 */
jpayne@69 9421 __pyx_t_17 = __Pyx_PyObject_GetAttrStr(__pyx_v_inf, __pyx_n_s_read); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 421, __pyx_L34_error)
jpayne@69 9422 __Pyx_GOTREF(__pyx_t_17);
jpayne@69 9423 __pyx_t_8 = NULL;
jpayne@69 9424 __pyx_t_9 = 0;
jpayne@69 9425 #if CYTHON_UNPACK_METHODS
jpayne@69 9426 if (likely(PyMethod_Check(__pyx_t_17))) {
jpayne@69 9427 __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_17);
jpayne@69 9428 if (likely(__pyx_t_8)) {
jpayne@69 9429 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_17);
jpayne@69 9430 __Pyx_INCREF(__pyx_t_8);
jpayne@69 9431 __Pyx_INCREF(function);
jpayne@69 9432 __Pyx_DECREF_SET(__pyx_t_17, function);
jpayne@69 9433 __pyx_t_9 = 1;
jpayne@69 9434 }
jpayne@69 9435 }
jpayne@69 9436 #endif
jpayne@69 9437 {
jpayne@69 9438 PyObject *__pyx_callargs[2] = {__pyx_t_8, NULL};
jpayne@69 9439 __pyx_t_18 = __Pyx_PyObject_FastCall(__pyx_t_17, __pyx_callargs+1-__pyx_t_9, 0+__pyx_t_9);
jpayne@69 9440 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
jpayne@69 9441 if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 421, __pyx_L34_error)
jpayne@69 9442 __Pyx_GOTREF(__pyx_t_18);
jpayne@69 9443 __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
jpayne@69 9444 }
jpayne@69 9445 __Pyx_DECREF_SET(__pyx_v_out, __pyx_t_18);
jpayne@69 9446 __pyx_t_18 = 0;
jpayne@69 9447
jpayne@69 9448 /* "pysam/libcutils.pyx":419
jpayne@69 9449 * out = inf.read()
jpayne@69 9450 * except UnicodeDecodeError:
jpayne@69 9451 * with open(fn, "rb") as inf: # <<<<<<<<<<<<<<
jpayne@69 9452 * # read binary output
jpayne@69 9453 * out = inf.read()
jpayne@69 9454 */
jpayne@69 9455 }
jpayne@69 9456 __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
jpayne@69 9457 __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
jpayne@69 9458 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
jpayne@69 9459 goto __pyx_L41_try_end;
jpayne@69 9460 __pyx_L34_error:;
jpayne@69 9461 __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
jpayne@69 9462 __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
jpayne@69 9463 __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
jpayne@69 9464 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
jpayne@69 9465 /*except:*/ {
jpayne@69 9466 __Pyx_AddTraceback("pysam.libcutils._pysam_dispatch._collect", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@69 9467 if (__Pyx_GetException(&__pyx_t_18, &__pyx_t_17, &__pyx_t_8) < 0) __PYX_ERR(0, 419, __pyx_L36_except_error)
jpayne@69 9468 __Pyx_XGOTREF(__pyx_t_18);
jpayne@69 9469 __Pyx_XGOTREF(__pyx_t_17);
jpayne@69 9470 __Pyx_XGOTREF(__pyx_t_8);
jpayne@69 9471 __pyx_t_19 = PyTuple_Pack(3, __pyx_t_18, __pyx_t_17, __pyx_t_8); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 419, __pyx_L36_except_error)
jpayne@69 9472 __Pyx_GOTREF(__pyx_t_19);
jpayne@69 9473 __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_19, NULL);
jpayne@69 9474 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
jpayne@69 9475 __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
jpayne@69 9476 if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 419, __pyx_L36_except_error)
jpayne@69 9477 __Pyx_GOTREF(__pyx_t_13);
jpayne@69 9478 __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_13);
jpayne@69 9479 __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
jpayne@69 9480 if (__pyx_t_15 < 0) __PYX_ERR(0, 419, __pyx_L36_except_error)
jpayne@69 9481 __pyx_t_14 = (!__pyx_t_15);
jpayne@69 9482 if (unlikely(__pyx_t_14)) {
jpayne@69 9483 __Pyx_GIVEREF(__pyx_t_18);
jpayne@69 9484 __Pyx_GIVEREF(__pyx_t_17);
jpayne@69 9485 __Pyx_XGIVEREF(__pyx_t_8);
jpayne@69 9486 __Pyx_ErrRestoreWithState(__pyx_t_18, __pyx_t_17, __pyx_t_8);
jpayne@69 9487 __pyx_t_18 = 0; __pyx_t_17 = 0; __pyx_t_8 = 0;
jpayne@69 9488 __PYX_ERR(0, 419, __pyx_L36_except_error)
jpayne@69 9489 }
jpayne@69 9490 __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
jpayne@69 9491 __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
jpayne@69 9492 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
jpayne@69 9493 goto __pyx_L35_exception_handled;
jpayne@69 9494 }
jpayne@69 9495 __pyx_L36_except_error:;
jpayne@69 9496 __Pyx_XGIVEREF(__pyx_t_12);
jpayne@69 9497 __Pyx_XGIVEREF(__pyx_t_11);
jpayne@69 9498 __Pyx_XGIVEREF(__pyx_t_10);
jpayne@69 9499 __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_11, __pyx_t_10);
jpayne@69 9500 goto __pyx_L8_except_error;
jpayne@69 9501 __pyx_L35_exception_handled:;
jpayne@69 9502 __Pyx_XGIVEREF(__pyx_t_12);
jpayne@69 9503 __Pyx_XGIVEREF(__pyx_t_11);
jpayne@69 9504 __Pyx_XGIVEREF(__pyx_t_10);
jpayne@69 9505 __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_11, __pyx_t_10);
jpayne@69 9506 __pyx_L41_try_end:;
jpayne@69 9507 }
jpayne@69 9508 }
jpayne@69 9509 /*finally:*/ {
jpayne@69 9510 /*normal exit:*/{
jpayne@69 9511 if (__pyx_t_6) {
jpayne@69 9512 __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__9, NULL);
jpayne@69 9513 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
jpayne@69 9514 if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 419, __pyx_L8_except_error)
jpayne@69 9515 __Pyx_GOTREF(__pyx_t_10);
jpayne@69 9516 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
jpayne@69 9517 }
jpayne@69 9518 goto __pyx_L33;
jpayne@69 9519 }
jpayne@69 9520 __pyx_L33:;
jpayne@69 9521 }
jpayne@69 9522 goto __pyx_L45;
jpayne@69 9523 __pyx_L28_error:;
jpayne@69 9524 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
jpayne@69 9525 goto __pyx_L8_except_error;
jpayne@69 9526 __pyx_L45:;
jpayne@69 9527 }
jpayne@69 9528 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
jpayne@69 9529 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
jpayne@69 9530 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
jpayne@69 9531 goto __pyx_L7_exception_handled;
jpayne@69 9532 }
jpayne@69 9533 goto __pyx_L8_except_error;
jpayne@69 9534
jpayne@69 9535 /* "pysam/libcutils.pyx":415
jpayne@69 9536 * def _collect(fn):
jpayne@69 9537 * out = []
jpayne@69 9538 * try: # <<<<<<<<<<<<<<
jpayne@69 9539 * with open(fn, "r") as inf:
jpayne@69 9540 * out = inf.read()
jpayne@69 9541 */
jpayne@69 9542 __pyx_L8_except_error:;
jpayne@69 9543 __Pyx_XGIVEREF(__pyx_t_2);
jpayne@69 9544 __Pyx_XGIVEREF(__pyx_t_3);
jpayne@69 9545 __Pyx_XGIVEREF(__pyx_t_4);
jpayne@69 9546 __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
jpayne@69 9547 goto __pyx_L4_error;
jpayne@69 9548 __pyx_L7_exception_handled:;
jpayne@69 9549 __Pyx_XGIVEREF(__pyx_t_2);
jpayne@69 9550 __Pyx_XGIVEREF(__pyx_t_3);
jpayne@69 9551 __Pyx_XGIVEREF(__pyx_t_4);
jpayne@69 9552 __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
jpayne@69 9553 __pyx_L11_try_end:;
jpayne@69 9554 }
jpayne@69 9555 }
jpayne@69 9556
jpayne@69 9557 /* "pysam/libcutils.pyx":423
jpayne@69 9558 * out = inf.read()
jpayne@69 9559 * finally:
jpayne@69 9560 * os.remove(fn) # <<<<<<<<<<<<<<
jpayne@69 9561 * return out
jpayne@69 9562 *
jpayne@69 9563 */
jpayne@69 9564 /*finally:*/ {
jpayne@69 9565 /*normal exit:*/{
jpayne@69 9566 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_os); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 423, __pyx_L1_error)
jpayne@69 9567 __Pyx_GOTREF(__pyx_t_5);
jpayne@69 9568 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_remove); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 423, __pyx_L1_error)
jpayne@69 9569 __Pyx_GOTREF(__pyx_t_1);
jpayne@69 9570 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
jpayne@69 9571 __pyx_t_5 = NULL;
jpayne@69 9572 __pyx_t_9 = 0;
jpayne@69 9573 #if CYTHON_UNPACK_METHODS
jpayne@69 9574 if (unlikely(PyMethod_Check(__pyx_t_1))) {
jpayne@69 9575 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
jpayne@69 9576 if (likely(__pyx_t_5)) {
jpayne@69 9577 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
jpayne@69 9578 __Pyx_INCREF(__pyx_t_5);
jpayne@69 9579 __Pyx_INCREF(function);
jpayne@69 9580 __Pyx_DECREF_SET(__pyx_t_1, function);
jpayne@69 9581 __pyx_t_9 = 1;
jpayne@69 9582 }
jpayne@69 9583 }
jpayne@69 9584 #endif
jpayne@69 9585 {
jpayne@69 9586 PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_fn};
jpayne@69 9587 __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9);
jpayne@69 9588 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
jpayne@69 9589 if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 423, __pyx_L1_error)
jpayne@69 9590 __Pyx_GOTREF(__pyx_t_7);
jpayne@69 9591 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
jpayne@69 9592 }
jpayne@69 9593 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
jpayne@69 9594 goto __pyx_L5;
jpayne@69 9595 }
jpayne@69 9596 __pyx_L4_error:;
jpayne@69 9597 /*exception exit:*/{
jpayne@69 9598 __Pyx_PyThreadState_declare
jpayne@69 9599 __Pyx_PyThreadState_assign
jpayne@69 9600 __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_6 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
jpayne@69 9601 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
jpayne@69 9602 __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
jpayne@69 9603 __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
jpayne@69 9604 __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
jpayne@69 9605 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
jpayne@69 9606 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
jpayne@69 9607 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
jpayne@69 9608 if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_6, &__pyx_t_10, &__pyx_t_11);
jpayne@69 9609 if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2) < 0)) __Pyx_ErrFetch(&__pyx_t_4, &__pyx_t_3, &__pyx_t_2);
jpayne@69 9610 __Pyx_XGOTREF(__pyx_t_4);
jpayne@69 9611 __Pyx_XGOTREF(__pyx_t_3);
jpayne@69 9612 __Pyx_XGOTREF(__pyx_t_2);
jpayne@69 9613 __Pyx_XGOTREF(__pyx_t_6);
jpayne@69 9614 __Pyx_XGOTREF(__pyx_t_10);
jpayne@69 9615 __Pyx_XGOTREF(__pyx_t_11);
jpayne@69 9616 __pyx_t_16 = __pyx_lineno; __pyx_t_20 = __pyx_clineno; __pyx_t_21 = __pyx_filename;
jpayne@69 9617 {
jpayne@69 9618 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_os); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 423, __pyx_L47_error)
jpayne@69 9619 __Pyx_GOTREF(__pyx_t_1);
jpayne@69 9620 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_remove); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 423, __pyx_L47_error)
jpayne@69 9621 __Pyx_GOTREF(__pyx_t_5);
jpayne@69 9622 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
jpayne@69 9623 __pyx_t_1 = NULL;
jpayne@69 9624 __pyx_t_9 = 0;
jpayne@69 9625 #if CYTHON_UNPACK_METHODS
jpayne@69 9626 if (unlikely(PyMethod_Check(__pyx_t_5))) {
jpayne@69 9627 __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5);
jpayne@69 9628 if (likely(__pyx_t_1)) {
jpayne@69 9629 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
jpayne@69 9630 __Pyx_INCREF(__pyx_t_1);
jpayne@69 9631 __Pyx_INCREF(function);
jpayne@69 9632 __Pyx_DECREF_SET(__pyx_t_5, function);
jpayne@69 9633 __pyx_t_9 = 1;
jpayne@69 9634 }
jpayne@69 9635 }
jpayne@69 9636 #endif
jpayne@69 9637 {
jpayne@69 9638 PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_v_fn};
jpayne@69 9639 __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9);
jpayne@69 9640 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
jpayne@69 9641 if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 423, __pyx_L47_error)
jpayne@69 9642 __Pyx_GOTREF(__pyx_t_7);
jpayne@69 9643 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
jpayne@69 9644 }
jpayne@69 9645 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
jpayne@69 9646 }
jpayne@69 9647 if (PY_MAJOR_VERSION >= 3) {
jpayne@69 9648 __Pyx_XGIVEREF(__pyx_t_6);
jpayne@69 9649 __Pyx_XGIVEREF(__pyx_t_10);
jpayne@69 9650 __Pyx_XGIVEREF(__pyx_t_11);
jpayne@69 9651 __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_10, __pyx_t_11);
jpayne@69 9652 }
jpayne@69 9653 __Pyx_XGIVEREF(__pyx_t_4);
jpayne@69 9654 __Pyx_XGIVEREF(__pyx_t_3);
jpayne@69 9655 __Pyx_XGIVEREF(__pyx_t_2);
jpayne@69 9656 __Pyx_ErrRestore(__pyx_t_4, __pyx_t_3, __pyx_t_2);
jpayne@69 9657 __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_6 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
jpayne@69 9658 __pyx_lineno = __pyx_t_16; __pyx_clineno = __pyx_t_20; __pyx_filename = __pyx_t_21;
jpayne@69 9659 goto __pyx_L1_error;
jpayne@69 9660 __pyx_L47_error:;
jpayne@69 9661 if (PY_MAJOR_VERSION >= 3) {
jpayne@69 9662 __Pyx_XGIVEREF(__pyx_t_6);
jpayne@69 9663 __Pyx_XGIVEREF(__pyx_t_10);
jpayne@69 9664 __Pyx_XGIVEREF(__pyx_t_11);
jpayne@69 9665 __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_10, __pyx_t_11);
jpayne@69 9666 }
jpayne@69 9667 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
jpayne@69 9668 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@69 9669 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@69 9670 __pyx_t_6 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
jpayne@69 9671 goto __pyx_L1_error;
jpayne@69 9672 }
jpayne@69 9673 __pyx_L5:;
jpayne@69 9674 }
jpayne@69 9675
jpayne@69 9676 /* "pysam/libcutils.pyx":424
jpayne@69 9677 * finally:
jpayne@69 9678 * os.remove(fn)
jpayne@69 9679 * return out # <<<<<<<<<<<<<<
jpayne@69 9680 *
jpayne@69 9681 * out_stderr = _collect(stderr_f)
jpayne@69 9682 */
jpayne@69 9683 __Pyx_XDECREF(__pyx_r);
jpayne@69 9684 __Pyx_INCREF(__pyx_v_out);
jpayne@69 9685 __pyx_r = __pyx_v_out;
jpayne@69 9686 goto __pyx_L0;
jpayne@69 9687
jpayne@69 9688 /* "pysam/libcutils.pyx":413
jpayne@69 9689 *
jpayne@69 9690 * # get error messages
jpayne@69 9691 * def _collect(fn): # <<<<<<<<<<<<<<
jpayne@69 9692 * out = []
jpayne@69 9693 * try:
jpayne@69 9694 */
jpayne@69 9695
jpayne@69 9696 /* function exit code */
jpayne@69 9697 __pyx_L1_error:;
jpayne@69 9698 __Pyx_XDECREF(__pyx_t_1);
jpayne@69 9699 __Pyx_XDECREF(__pyx_t_5);
jpayne@69 9700 __Pyx_XDECREF(__pyx_t_7);
jpayne@69 9701 __Pyx_XDECREF(__pyx_t_8);
jpayne@69 9702 __Pyx_XDECREF(__pyx_t_17);
jpayne@69 9703 __Pyx_XDECREF(__pyx_t_18);
jpayne@69 9704 __Pyx_XDECREF(__pyx_t_19);
jpayne@69 9705 __Pyx_AddTraceback("pysam.libcutils._pysam_dispatch._collect", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@69 9706 __pyx_r = NULL;
jpayne@69 9707 __pyx_L0:;
jpayne@69 9708 __Pyx_XDECREF(__pyx_v_out);
jpayne@69 9709 __Pyx_XDECREF(__pyx_v_inf);
jpayne@69 9710 __Pyx_XGIVEREF(__pyx_r);
jpayne@69 9711 __Pyx_RefNannyFinishContext();
jpayne@69 9712 return __pyx_r;
jpayne@69 9713 }
jpayne@69 9714
jpayne@69 9715 /* "pysam/libcutils.pyx":276
jpayne@69 9716 *
jpayne@69 9717 *
jpayne@69 9718 * def _pysam_dispatch(collection, # <<<<<<<<<<<<<<
jpayne@69 9719 * method,
jpayne@69 9720 * args=None,
jpayne@69 9721 */
jpayne@69 9722
jpayne@69 9723 static PyObject *__pyx_pf_5pysam_9libcutils_14_pysam_dispatch(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_collection, PyObject *__pyx_v_method, PyObject *__pyx_v_args, PyObject *__pyx_v_catch_stdout, PyObject *__pyx_v_is_usage, PyObject *__pyx_v_save_stdout) {
jpayne@69 9724 PyObject *__pyx_v_ARGUMENTS = NULL;
jpayne@69 9725 int __pyx_v_skip_next;
jpayne@69 9726 PyObject *__pyx_v_arg = NULL;
jpayne@69 9727 PyObject *__pyx_v_stderr_h = NULL;
jpayne@69 9728 PyObject *__pyx_v_stderr_f = NULL;
jpayne@69 9729 PyObject *__pyx_v_stdout_f = NULL;
jpayne@69 9730 PyObject *__pyx_v_stdout_h = NULL;
jpayne@69 9731 PyObject *__pyx_v_MAP_STDOUT_OPTIONS = NULL;
jpayne@69 9732 PyObject *__pyx_v_stdout_option = NULL;
jpayne@69 9733 char **__pyx_v_cargs;
jpayne@69 9734 int __pyx_v_i;
jpayne@69 9735 int __pyx_v_n;
jpayne@69 9736 int __pyx_v_retval;
jpayne@69 9737 int __pyx_v_l;
jpayne@69 9738 int __pyx_v_extra_args;
jpayne@69 9739 PyObject *__pyx_v__collect = 0;
jpayne@69 9740 PyObject *__pyx_v_out_stderr = NULL;
jpayne@69 9741 PyObject *__pyx_v_out_stdout = NULL;
jpayne@69 9742 PyObject *__pyx_8genexpr2__pyx_v_a = NULL;
jpayne@69 9743 PyObject *__pyx_r = NULL;
jpayne@69 9744 __Pyx_RefNannyDeclarations
jpayne@69 9745 int __pyx_t_1;
jpayne@69 9746 int __pyx_t_2;
jpayne@69 9747 PyObject *__pyx_t_3 = NULL;
jpayne@69 9748 Py_ssize_t __pyx_t_4;
jpayne@69 9749 PyObject *(*__pyx_t_5)(PyObject *);
jpayne@69 9750 PyObject *__pyx_t_6 = NULL;
jpayne@69 9751 PyObject *__pyx_t_7 = NULL;
jpayne@69 9752 PyObject *__pyx_t_8 = NULL;
jpayne@69 9753 unsigned int __pyx_t_9;
jpayne@69 9754 PyObject *(*__pyx_t_10)(PyObject *);
jpayne@69 9755 char const *__pyx_t_11;
jpayne@69 9756 char const *__pyx_t_12;
jpayne@69 9757 char const *__pyx_t_13;
jpayne@69 9758 int __pyx_t_14;
jpayne@69 9759 PyObject *__pyx_t_15 = NULL;
jpayne@69 9760 PyObject *__pyx_t_16 = NULL;
jpayne@69 9761 char *__pyx_t_17;
jpayne@69 9762 int __pyx_t_18;
jpayne@69 9763 char const *__pyx_t_19;
jpayne@69 9764 int __pyx_lineno = 0;
jpayne@69 9765 const char *__pyx_filename = NULL;
jpayne@69 9766 int __pyx_clineno = 0;
jpayne@69 9767 __Pyx_RefNannySetupContext("_pysam_dispatch", 0);
jpayne@69 9768 __Pyx_INCREF(__pyx_v_collection);
jpayne@69 9769 __Pyx_INCREF(__pyx_v_method);
jpayne@69 9770 __Pyx_INCREF(__pyx_v_args);
jpayne@69 9771
jpayne@69 9772 /* "pysam/libcutils.pyx":294
jpayne@69 9773 * '''
jpayne@69 9774 *
jpayne@69 9775 * if method == "index" and args: # <<<<<<<<<<<<<<
jpayne@69 9776 * # We make sure that at least the first specified input file exists,
jpayne@69 9777 * # and if it doesn't we raise an IOError.
jpayne@69 9778 */
jpayne@69 9779 __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_method, __pyx_n_u_index, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 294, __pyx_L1_error)
jpayne@69 9780 if (__pyx_t_2) {
jpayne@69 9781 } else {
jpayne@69 9782 __pyx_t_1 = __pyx_t_2;
jpayne@69 9783 goto __pyx_L4_bool_binop_done;
jpayne@69 9784 }
jpayne@69 9785 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_args); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 294, __pyx_L1_error)
jpayne@69 9786 __pyx_t_1 = __pyx_t_2;
jpayne@69 9787 __pyx_L4_bool_binop_done:;
jpayne@69 9788 if (__pyx_t_1) {
jpayne@69 9789
jpayne@69 9790 /* "pysam/libcutils.pyx":297
jpayne@69 9791 * # We make sure that at least the first specified input file exists,
jpayne@69 9792 * # and if it doesn't we raise an IOError.
jpayne@69 9793 * ARGUMENTS = ['-m', '--min-shift', '-o', '--output', '--output-file', '-@', '--threads'] # <<<<<<<<<<<<<<
jpayne@69 9794 * skip_next = False
jpayne@69 9795 * for arg in args:
jpayne@69 9796 */
jpayne@69 9797 __pyx_t_3 = PyList_New(7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 297, __pyx_L1_error)
jpayne@69 9798 __Pyx_GOTREF(__pyx_t_3);
jpayne@69 9799 __Pyx_INCREF(__pyx_kp_u_m);
jpayne@69 9800 __Pyx_GIVEREF(__pyx_kp_u_m);
jpayne@69 9801 if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_m)) __PYX_ERR(0, 297, __pyx_L1_error);
jpayne@69 9802 __Pyx_INCREF(__pyx_kp_u_min_shift);
jpayne@69 9803 __Pyx_GIVEREF(__pyx_kp_u_min_shift);
jpayne@69 9804 if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 1, __pyx_kp_u_min_shift)) __PYX_ERR(0, 297, __pyx_L1_error);
jpayne@69 9805 __Pyx_INCREF(__pyx_kp_u_o);
jpayne@69 9806 __Pyx_GIVEREF(__pyx_kp_u_o);
jpayne@69 9807 if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u_o)) __PYX_ERR(0, 297, __pyx_L1_error);
jpayne@69 9808 __Pyx_INCREF(__pyx_kp_u_output);
jpayne@69 9809 __Pyx_GIVEREF(__pyx_kp_u_output);
jpayne@69 9810 if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 3, __pyx_kp_u_output)) __PYX_ERR(0, 297, __pyx_L1_error);
jpayne@69 9811 __Pyx_INCREF(__pyx_kp_u_output_file);
jpayne@69 9812 __Pyx_GIVEREF(__pyx_kp_u_output_file);
jpayne@69 9813 if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 4, __pyx_kp_u_output_file)) __PYX_ERR(0, 297, __pyx_L1_error);
jpayne@69 9814 __Pyx_INCREF(__pyx_kp_u__10);
jpayne@69 9815 __Pyx_GIVEREF(__pyx_kp_u__10);
jpayne@69 9816 if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 5, __pyx_kp_u__10)) __PYX_ERR(0, 297, __pyx_L1_error);
jpayne@69 9817 __Pyx_INCREF(__pyx_kp_u_threads);
jpayne@69 9818 __Pyx_GIVEREF(__pyx_kp_u_threads);
jpayne@69 9819 if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 6, __pyx_kp_u_threads)) __PYX_ERR(0, 297, __pyx_L1_error);
jpayne@69 9820 __pyx_v_ARGUMENTS = ((PyObject*)__pyx_t_3);
jpayne@69 9821 __pyx_t_3 = 0;
jpayne@69 9822
jpayne@69 9823 /* "pysam/libcutils.pyx":298
jpayne@69 9824 * # and if it doesn't we raise an IOError.
jpayne@69 9825 * ARGUMENTS = ['-m', '--min-shift', '-o', '--output', '--output-file', '-@', '--threads']
jpayne@69 9826 * skip_next = False # <<<<<<<<<<<<<<
jpayne@69 9827 * for arg in args:
jpayne@69 9828 * if skip_next:
jpayne@69 9829 */
jpayne@69 9830 __pyx_v_skip_next = 0;
jpayne@69 9831
jpayne@69 9832 /* "pysam/libcutils.pyx":299
jpayne@69 9833 * ARGUMENTS = ['-m', '--min-shift', '-o', '--output', '--output-file', '-@', '--threads']
jpayne@69 9834 * skip_next = False
jpayne@69 9835 * for arg in args: # <<<<<<<<<<<<<<
jpayne@69 9836 * if skip_next:
jpayne@69 9837 * skip_next = False
jpayne@69 9838 */
jpayne@69 9839 if (likely(PyList_CheckExact(__pyx_v_args)) || PyTuple_CheckExact(__pyx_v_args)) {
jpayne@69 9840 __pyx_t_3 = __pyx_v_args; __Pyx_INCREF(__pyx_t_3);
jpayne@69 9841 __pyx_t_4 = 0;
jpayne@69 9842 __pyx_t_5 = NULL;
jpayne@69 9843 } else {
jpayne@69 9844 __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_args); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 299, __pyx_L1_error)
jpayne@69 9845 __Pyx_GOTREF(__pyx_t_3);
jpayne@69 9846 __pyx_t_5 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 299, __pyx_L1_error)
jpayne@69 9847 }
jpayne@69 9848 for (;;) {
jpayne@69 9849 if (likely(!__pyx_t_5)) {
jpayne@69 9850 if (likely(PyList_CheckExact(__pyx_t_3))) {
jpayne@69 9851 {
jpayne@69 9852 Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
jpayne@69 9853 #if !CYTHON_ASSUME_SAFE_MACROS
jpayne@69 9854 if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 299, __pyx_L1_error)
jpayne@69 9855 #endif
jpayne@69 9856 if (__pyx_t_4 >= __pyx_temp) break;
jpayne@69 9857 }
jpayne@69 9858 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
jpayne@69 9859 __pyx_t_6 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(0, 299, __pyx_L1_error)
jpayne@69 9860 #else
jpayne@69 9861 __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 299, __pyx_L1_error)
jpayne@69 9862 __Pyx_GOTREF(__pyx_t_6);
jpayne@69 9863 #endif
jpayne@69 9864 } else {
jpayne@69 9865 {
jpayne@69 9866 Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3);
jpayne@69 9867 #if !CYTHON_ASSUME_SAFE_MACROS
jpayne@69 9868 if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 299, __pyx_L1_error)
jpayne@69 9869 #endif
jpayne@69 9870 if (__pyx_t_4 >= __pyx_temp) break;
jpayne@69 9871 }
jpayne@69 9872 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
jpayne@69 9873 __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_6); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(0, 299, __pyx_L1_error)
jpayne@69 9874 #else
jpayne@69 9875 __pyx_t_6 = __Pyx_PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 299, __pyx_L1_error)
jpayne@69 9876 __Pyx_GOTREF(__pyx_t_6);
jpayne@69 9877 #endif
jpayne@69 9878 }
jpayne@69 9879 } else {
jpayne@69 9880 __pyx_t_6 = __pyx_t_5(__pyx_t_3);
jpayne@69 9881 if (unlikely(!__pyx_t_6)) {
jpayne@69 9882 PyObject* exc_type = PyErr_Occurred();
jpayne@69 9883 if (exc_type) {
jpayne@69 9884 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
jpayne@69 9885 else __PYX_ERR(0, 299, __pyx_L1_error)
jpayne@69 9886 }
jpayne@69 9887 break;
jpayne@69 9888 }
jpayne@69 9889 __Pyx_GOTREF(__pyx_t_6);
jpayne@69 9890 }
jpayne@69 9891 __Pyx_XDECREF_SET(__pyx_v_arg, __pyx_t_6);
jpayne@69 9892 __pyx_t_6 = 0;
jpayne@69 9893
jpayne@69 9894 /* "pysam/libcutils.pyx":300
jpayne@69 9895 * skip_next = False
jpayne@69 9896 * for arg in args:
jpayne@69 9897 * if skip_next: # <<<<<<<<<<<<<<
jpayne@69 9898 * skip_next = False
jpayne@69 9899 * continue
jpayne@69 9900 */
jpayne@69 9901 if (__pyx_v_skip_next) {
jpayne@69 9902
jpayne@69 9903 /* "pysam/libcutils.pyx":301
jpayne@69 9904 * for arg in args:
jpayne@69 9905 * if skip_next:
jpayne@69 9906 * skip_next = False # <<<<<<<<<<<<<<
jpayne@69 9907 * continue
jpayne@69 9908 * if arg.startswith('-'):
jpayne@69 9909 */
jpayne@69 9910 __pyx_v_skip_next = 0;
jpayne@69 9911
jpayne@69 9912 /* "pysam/libcutils.pyx":302
jpayne@69 9913 * if skip_next:
jpayne@69 9914 * skip_next = False
jpayne@69 9915 * continue # <<<<<<<<<<<<<<
jpayne@69 9916 * if arg.startswith('-'):
jpayne@69 9917 * # Skip next argument for e.g. '--min-shift' '12' or '-m' '12' but not '-m12'
jpayne@69 9918 */
jpayne@69 9919 goto __pyx_L6_continue;
jpayne@69 9920
jpayne@69 9921 /* "pysam/libcutils.pyx":300
jpayne@69 9922 * skip_next = False
jpayne@69 9923 * for arg in args:
jpayne@69 9924 * if skip_next: # <<<<<<<<<<<<<<
jpayne@69 9925 * skip_next = False
jpayne@69 9926 * continue
jpayne@69 9927 */
jpayne@69 9928 }
jpayne@69 9929
jpayne@69 9930 /* "pysam/libcutils.pyx":303
jpayne@69 9931 * skip_next = False
jpayne@69 9932 * continue
jpayne@69 9933 * if arg.startswith('-'): # <<<<<<<<<<<<<<
jpayne@69 9934 * # Skip next argument for e.g. '--min-shift' '12' or '-m' '12' but not '-m12'
jpayne@69 9935 * if arg in ARGUMENTS:
jpayne@69 9936 */
jpayne@69 9937 __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_arg, __pyx_n_s_startswith); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 303, __pyx_L1_error)
jpayne@69 9938 __Pyx_GOTREF(__pyx_t_7);
jpayne@69 9939 __pyx_t_8 = NULL;
jpayne@69 9940 __pyx_t_9 = 0;
jpayne@69 9941 #if CYTHON_UNPACK_METHODS
jpayne@69 9942 if (likely(PyMethod_Check(__pyx_t_7))) {
jpayne@69 9943 __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
jpayne@69 9944 if (likely(__pyx_t_8)) {
jpayne@69 9945 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
jpayne@69 9946 __Pyx_INCREF(__pyx_t_8);
jpayne@69 9947 __Pyx_INCREF(function);
jpayne@69 9948 __Pyx_DECREF_SET(__pyx_t_7, function);
jpayne@69 9949 __pyx_t_9 = 1;
jpayne@69 9950 }
jpayne@69 9951 }
jpayne@69 9952 #endif
jpayne@69 9953 {
jpayne@69 9954 PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_kp_u__8};
jpayne@69 9955 __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9);
jpayne@69 9956 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
jpayne@69 9957 if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 303, __pyx_L1_error)
jpayne@69 9958 __Pyx_GOTREF(__pyx_t_6);
jpayne@69 9959 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
jpayne@69 9960 }
jpayne@69 9961 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 303, __pyx_L1_error)
jpayne@69 9962 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
jpayne@69 9963 if (__pyx_t_1) {
jpayne@69 9964
jpayne@69 9965 /* "pysam/libcutils.pyx":305
jpayne@69 9966 * if arg.startswith('-'):
jpayne@69 9967 * # Skip next argument for e.g. '--min-shift' '12' or '-m' '12' but not '-m12'
jpayne@69 9968 * if arg in ARGUMENTS: # <<<<<<<<<<<<<<
jpayne@69 9969 * skip_next = True
jpayne@69 9970 * continue
jpayne@69 9971 */
jpayne@69 9972 __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_v_arg, __pyx_v_ARGUMENTS, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 305, __pyx_L1_error)
jpayne@69 9973 if (__pyx_t_1) {
jpayne@69 9974
jpayne@69 9975 /* "pysam/libcutils.pyx":306
jpayne@69 9976 * # Skip next argument for e.g. '--min-shift' '12' or '-m' '12' but not '-m12'
jpayne@69 9977 * if arg in ARGUMENTS:
jpayne@69 9978 * skip_next = True # <<<<<<<<<<<<<<
jpayne@69 9979 * continue
jpayne@69 9980 * if not os.path.exists(arg):
jpayne@69 9981 */
jpayne@69 9982 __pyx_v_skip_next = 1;
jpayne@69 9983
jpayne@69 9984 /* "pysam/libcutils.pyx":305
jpayne@69 9985 * if arg.startswith('-'):
jpayne@69 9986 * # Skip next argument for e.g. '--min-shift' '12' or '-m' '12' but not '-m12'
jpayne@69 9987 * if arg in ARGUMENTS: # <<<<<<<<<<<<<<
jpayne@69 9988 * skip_next = True
jpayne@69 9989 * continue
jpayne@69 9990 */
jpayne@69 9991 }
jpayne@69 9992
jpayne@69 9993 /* "pysam/libcutils.pyx":307
jpayne@69 9994 * if arg in ARGUMENTS:
jpayne@69 9995 * skip_next = True
jpayne@69 9996 * continue # <<<<<<<<<<<<<<
jpayne@69 9997 * if not os.path.exists(arg):
jpayne@69 9998 * raise IOError("No such file or directory: '%s'" % arg)
jpayne@69 9999 */
jpayne@69 10000 goto __pyx_L6_continue;
jpayne@69 10001
jpayne@69 10002 /* "pysam/libcutils.pyx":303
jpayne@69 10003 * skip_next = False
jpayne@69 10004 * continue
jpayne@69 10005 * if arg.startswith('-'): # <<<<<<<<<<<<<<
jpayne@69 10006 * # Skip next argument for e.g. '--min-shift' '12' or '-m' '12' but not '-m12'
jpayne@69 10007 * if arg in ARGUMENTS:
jpayne@69 10008 */
jpayne@69 10009 }
jpayne@69 10010
jpayne@69 10011 /* "pysam/libcutils.pyx":308
jpayne@69 10012 * skip_next = True
jpayne@69 10013 * continue
jpayne@69 10014 * if not os.path.exists(arg): # <<<<<<<<<<<<<<
jpayne@69 10015 * raise IOError("No such file or directory: '%s'" % arg)
jpayne@69 10016 * else:
jpayne@69 10017 */
jpayne@69 10018 __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_os); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 308, __pyx_L1_error)
jpayne@69 10019 __Pyx_GOTREF(__pyx_t_7);
jpayne@69 10020 __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_path); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 308, __pyx_L1_error)
jpayne@69 10021 __Pyx_GOTREF(__pyx_t_8);
jpayne@69 10022 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
jpayne@69 10023 __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_exists); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 308, __pyx_L1_error)
jpayne@69 10024 __Pyx_GOTREF(__pyx_t_7);
jpayne@69 10025 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
jpayne@69 10026 __pyx_t_8 = NULL;
jpayne@69 10027 __pyx_t_9 = 0;
jpayne@69 10028 #if CYTHON_UNPACK_METHODS
jpayne@69 10029 if (likely(PyMethod_Check(__pyx_t_7))) {
jpayne@69 10030 __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
jpayne@69 10031 if (likely(__pyx_t_8)) {
jpayne@69 10032 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
jpayne@69 10033 __Pyx_INCREF(__pyx_t_8);
jpayne@69 10034 __Pyx_INCREF(function);
jpayne@69 10035 __Pyx_DECREF_SET(__pyx_t_7, function);
jpayne@69 10036 __pyx_t_9 = 1;
jpayne@69 10037 }
jpayne@69 10038 }
jpayne@69 10039 #endif
jpayne@69 10040 {
jpayne@69 10041 PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_v_arg};
jpayne@69 10042 __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9);
jpayne@69 10043 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
jpayne@69 10044 if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 308, __pyx_L1_error)
jpayne@69 10045 __Pyx_GOTREF(__pyx_t_6);
jpayne@69 10046 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
jpayne@69 10047 }
jpayne@69 10048 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 308, __pyx_L1_error)
jpayne@69 10049 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
jpayne@69 10050 __pyx_t_2 = (!__pyx_t_1);
jpayne@69 10051 if (unlikely(__pyx_t_2)) {
jpayne@69 10052
jpayne@69 10053 /* "pysam/libcutils.pyx":309
jpayne@69 10054 * continue
jpayne@69 10055 * if not os.path.exists(arg):
jpayne@69 10056 * raise IOError("No such file or directory: '%s'" % arg) # <<<<<<<<<<<<<<
jpayne@69 10057 * else:
jpayne@69 10058 * break
jpayne@69 10059 */
jpayne@69 10060 __pyx_t_6 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_No_such_file_or_directory_s, __pyx_v_arg); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 309, __pyx_L1_error)
jpayne@69 10061 __Pyx_GOTREF(__pyx_t_6);
jpayne@69 10062 __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IOError, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 309, __pyx_L1_error)
jpayne@69 10063 __Pyx_GOTREF(__pyx_t_7);
jpayne@69 10064 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
jpayne@69 10065 __Pyx_Raise(__pyx_t_7, 0, 0, 0);
jpayne@69 10066 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
jpayne@69 10067 __PYX_ERR(0, 309, __pyx_L1_error)
jpayne@69 10068
jpayne@69 10069 /* "pysam/libcutils.pyx":308
jpayne@69 10070 * skip_next = True
jpayne@69 10071 * continue
jpayne@69 10072 * if not os.path.exists(arg): # <<<<<<<<<<<<<<
jpayne@69 10073 * raise IOError("No such file or directory: '%s'" % arg)
jpayne@69 10074 * else:
jpayne@69 10075 */
jpayne@69 10076 }
jpayne@69 10077
jpayne@69 10078 /* "pysam/libcutils.pyx":311
jpayne@69 10079 * raise IOError("No such file or directory: '%s'" % arg)
jpayne@69 10080 * else:
jpayne@69 10081 * break # <<<<<<<<<<<<<<
jpayne@69 10082 *
jpayne@69 10083 * if args is None:
jpayne@69 10084 */
jpayne@69 10085 /*else*/ {
jpayne@69 10086 goto __pyx_L7_break;
jpayne@69 10087 }
jpayne@69 10088
jpayne@69 10089 /* "pysam/libcutils.pyx":299
jpayne@69 10090 * ARGUMENTS = ['-m', '--min-shift', '-o', '--output', '--output-file', '-@', '--threads']
jpayne@69 10091 * skip_next = False
jpayne@69 10092 * for arg in args: # <<<<<<<<<<<<<<
jpayne@69 10093 * if skip_next:
jpayne@69 10094 * skip_next = False
jpayne@69 10095 */
jpayne@69 10096 __pyx_L6_continue:;
jpayne@69 10097 }
jpayne@69 10098 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@69 10099 goto __pyx_L12_for_end;
jpayne@69 10100 __pyx_L7_break:;
jpayne@69 10101 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@69 10102 goto __pyx_L12_for_end;
jpayne@69 10103 __pyx_L12_for_end:;
jpayne@69 10104
jpayne@69 10105 /* "pysam/libcutils.pyx":294
jpayne@69 10106 * '''
jpayne@69 10107 *
jpayne@69 10108 * if method == "index" and args: # <<<<<<<<<<<<<<
jpayne@69 10109 * # We make sure that at least the first specified input file exists,
jpayne@69 10110 * # and if it doesn't we raise an IOError.
jpayne@69 10111 */
jpayne@69 10112 }
jpayne@69 10113
jpayne@69 10114 /* "pysam/libcutils.pyx":313
jpayne@69 10115 * break
jpayne@69 10116 *
jpayne@69 10117 * if args is None: # <<<<<<<<<<<<<<
jpayne@69 10118 * args = []
jpayne@69 10119 * else:
jpayne@69 10120 */
jpayne@69 10121 __pyx_t_2 = (__pyx_v_args == Py_None);
jpayne@69 10122 if (__pyx_t_2) {
jpayne@69 10123
jpayne@69 10124 /* "pysam/libcutils.pyx":314
jpayne@69 10125 *
jpayne@69 10126 * if args is None:
jpayne@69 10127 * args = [] # <<<<<<<<<<<<<<
jpayne@69 10128 * else:
jpayne@69 10129 * args = list(args)
jpayne@69 10130 */
jpayne@69 10131 __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 314, __pyx_L1_error)
jpayne@69 10132 __Pyx_GOTREF(__pyx_t_3);
jpayne@69 10133 __Pyx_DECREF_SET(__pyx_v_args, __pyx_t_3);
jpayne@69 10134 __pyx_t_3 = 0;
jpayne@69 10135
jpayne@69 10136 /* "pysam/libcutils.pyx":313
jpayne@69 10137 * break
jpayne@69 10138 *
jpayne@69 10139 * if args is None: # <<<<<<<<<<<<<<
jpayne@69 10140 * args = []
jpayne@69 10141 * else:
jpayne@69 10142 */
jpayne@69 10143 goto __pyx_L13;
jpayne@69 10144 }
jpayne@69 10145
jpayne@69 10146 /* "pysam/libcutils.pyx":316
jpayne@69 10147 * args = []
jpayne@69 10148 * else:
jpayne@69 10149 * args = list(args) # <<<<<<<<<<<<<<
jpayne@69 10150 *
jpayne@69 10151 * # redirect stderr to file
jpayne@69 10152 */
jpayne@69 10153 /*else*/ {
jpayne@69 10154 __pyx_t_3 = PySequence_List(__pyx_v_args); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 316, __pyx_L1_error)
jpayne@69 10155 __Pyx_GOTREF(__pyx_t_3);
jpayne@69 10156 __Pyx_DECREF_SET(__pyx_v_args, __pyx_t_3);
jpayne@69 10157 __pyx_t_3 = 0;
jpayne@69 10158 }
jpayne@69 10159 __pyx_L13:;
jpayne@69 10160
jpayne@69 10161 /* "pysam/libcutils.pyx":319
jpayne@69 10162 *
jpayne@69 10163 * # redirect stderr to file
jpayne@69 10164 * stderr_h, stderr_f = tempfile.mkstemp() # <<<<<<<<<<<<<<
jpayne@69 10165 *
jpayne@69 10166 * # redirect stdout to file
jpayne@69 10167 */
jpayne@69 10168 __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_tempfile); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 319, __pyx_L1_error)
jpayne@69 10169 __Pyx_GOTREF(__pyx_t_7);
jpayne@69 10170 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_mkstemp); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 319, __pyx_L1_error)
jpayne@69 10171 __Pyx_GOTREF(__pyx_t_6);
jpayne@69 10172 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
jpayne@69 10173 __pyx_t_7 = NULL;
jpayne@69 10174 __pyx_t_9 = 0;
jpayne@69 10175 #if CYTHON_UNPACK_METHODS
jpayne@69 10176 if (unlikely(PyMethod_Check(__pyx_t_6))) {
jpayne@69 10177 __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
jpayne@69 10178 if (likely(__pyx_t_7)) {
jpayne@69 10179 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
jpayne@69 10180 __Pyx_INCREF(__pyx_t_7);
jpayne@69 10181 __Pyx_INCREF(function);
jpayne@69 10182 __Pyx_DECREF_SET(__pyx_t_6, function);
jpayne@69 10183 __pyx_t_9 = 1;
jpayne@69 10184 }
jpayne@69 10185 }
jpayne@69 10186 #endif
jpayne@69 10187 {
jpayne@69 10188 PyObject *__pyx_callargs[2] = {__pyx_t_7, NULL};
jpayne@69 10189 __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_9, 0+__pyx_t_9);
jpayne@69 10190 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
jpayne@69 10191 if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 319, __pyx_L1_error)
jpayne@69 10192 __Pyx_GOTREF(__pyx_t_3);
jpayne@69 10193 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
jpayne@69 10194 }
jpayne@69 10195 if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
jpayne@69 10196 PyObject* sequence = __pyx_t_3;
jpayne@69 10197 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
jpayne@69 10198 if (unlikely(size != 2)) {
jpayne@69 10199 if (size > 2) __Pyx_RaiseTooManyValuesError(2);
jpayne@69 10200 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
jpayne@69 10201 __PYX_ERR(0, 319, __pyx_L1_error)
jpayne@69 10202 }
jpayne@69 10203 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
jpayne@69 10204 if (likely(PyTuple_CheckExact(sequence))) {
jpayne@69 10205 __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0);
jpayne@69 10206 __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1);
jpayne@69 10207 } else {
jpayne@69 10208 __pyx_t_6 = PyList_GET_ITEM(sequence, 0);
jpayne@69 10209 __pyx_t_7 = PyList_GET_ITEM(sequence, 1);
jpayne@69 10210 }
jpayne@69 10211 __Pyx_INCREF(__pyx_t_6);
jpayne@69 10212 __Pyx_INCREF(__pyx_t_7);
jpayne@69 10213 #else
jpayne@69 10214 __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 319, __pyx_L1_error)
jpayne@69 10215 __Pyx_GOTREF(__pyx_t_6);
jpayne@69 10216 __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 319, __pyx_L1_error)
jpayne@69 10217 __Pyx_GOTREF(__pyx_t_7);
jpayne@69 10218 #endif
jpayne@69 10219 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@69 10220 } else {
jpayne@69 10221 Py_ssize_t index = -1;
jpayne@69 10222 __pyx_t_8 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 319, __pyx_L1_error)
jpayne@69 10223 __Pyx_GOTREF(__pyx_t_8);
jpayne@69 10224 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@69 10225 __pyx_t_10 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_8);
jpayne@69 10226 index = 0; __pyx_t_6 = __pyx_t_10(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L14_unpacking_failed;
jpayne@69 10227 __Pyx_GOTREF(__pyx_t_6);
jpayne@69 10228 index = 1; __pyx_t_7 = __pyx_t_10(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L14_unpacking_failed;
jpayne@69 10229 __Pyx_GOTREF(__pyx_t_7);
jpayne@69 10230 if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_8), 2) < 0) __PYX_ERR(0, 319, __pyx_L1_error)
jpayne@69 10231 __pyx_t_10 = NULL;
jpayne@69 10232 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
jpayne@69 10233 goto __pyx_L15_unpacking_done;
jpayne@69 10234 __pyx_L14_unpacking_failed:;
jpayne@69 10235 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
jpayne@69 10236 __pyx_t_10 = NULL;
jpayne@69 10237 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
jpayne@69 10238 __PYX_ERR(0, 319, __pyx_L1_error)
jpayne@69 10239 __pyx_L15_unpacking_done:;
jpayne@69 10240 }
jpayne@69 10241 __pyx_v_stderr_h = __pyx_t_6;
jpayne@69 10242 __pyx_t_6 = 0;
jpayne@69 10243 __pyx_v_stderr_f = __pyx_t_7;
jpayne@69 10244 __pyx_t_7 = 0;
jpayne@69 10245
jpayne@69 10246 /* "pysam/libcutils.pyx":322
jpayne@69 10247 *
jpayne@69 10248 * # redirect stdout to file
jpayne@69 10249 * if save_stdout: # <<<<<<<<<<<<<<
jpayne@69 10250 * stdout_f = save_stdout
jpayne@69 10251 * stdout_h = c_open(force_bytes(stdout_f),
jpayne@69 10252 */
jpayne@69 10253 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_save_stdout); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 322, __pyx_L1_error)
jpayne@69 10254 if (__pyx_t_2) {
jpayne@69 10255
jpayne@69 10256 /* "pysam/libcutils.pyx":323
jpayne@69 10257 * # redirect stdout to file
jpayne@69 10258 * if save_stdout:
jpayne@69 10259 * stdout_f = save_stdout # <<<<<<<<<<<<<<
jpayne@69 10260 * stdout_h = c_open(force_bytes(stdout_f),
jpayne@69 10261 * O_WRONLY|O_CREAT|O_TRUNC, 0666)
jpayne@69 10262 */
jpayne@69 10263 __Pyx_INCREF(__pyx_v_save_stdout);
jpayne@69 10264 __pyx_v_stdout_f = __pyx_v_save_stdout;
jpayne@69 10265
jpayne@69 10266 /* "pysam/libcutils.pyx":324
jpayne@69 10267 * if save_stdout:
jpayne@69 10268 * stdout_f = save_stdout
jpayne@69 10269 * stdout_h = c_open(force_bytes(stdout_f), # <<<<<<<<<<<<<<
jpayne@69 10270 * O_WRONLY|O_CREAT|O_TRUNC, 0666)
jpayne@69 10271 * if stdout_h == -1:
jpayne@69 10272 */
jpayne@69 10273 __pyx_t_3 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_v_stdout_f, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 324, __pyx_L1_error)
jpayne@69 10274 __Pyx_GOTREF(__pyx_t_3);
jpayne@69 10275 if (unlikely(__pyx_t_3 == Py_None)) {
jpayne@69 10276 PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
jpayne@69 10277 __PYX_ERR(0, 324, __pyx_L1_error)
jpayne@69 10278 }
jpayne@69 10279 __pyx_t_11 = __Pyx_PyBytes_AsString(__pyx_t_3); if (unlikely((!__pyx_t_11) && PyErr_Occurred())) __PYX_ERR(0, 324, __pyx_L1_error)
jpayne@69 10280
jpayne@69 10281 /* "pysam/libcutils.pyx":325
jpayne@69 10282 * stdout_f = save_stdout
jpayne@69 10283 * stdout_h = c_open(force_bytes(stdout_f),
jpayne@69 10284 * O_WRONLY|O_CREAT|O_TRUNC, 0666) # <<<<<<<<<<<<<<
jpayne@69 10285 * if stdout_h == -1:
jpayne@69 10286 * raise OSError(errno, "error while opening file for writing", stdout_f)
jpayne@69 10287 */
jpayne@69 10288 __pyx_t_7 = __Pyx_PyInt_From_int(open(__pyx_t_11, ((O_WRONLY | O_CREAT) | O_TRUNC), 0666)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 324, __pyx_L1_error)
jpayne@69 10289 __Pyx_GOTREF(__pyx_t_7);
jpayne@69 10290 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@69 10291 __pyx_v_stdout_h = __pyx_t_7;
jpayne@69 10292 __pyx_t_7 = 0;
jpayne@69 10293
jpayne@69 10294 /* "pysam/libcutils.pyx":326
jpayne@69 10295 * stdout_h = c_open(force_bytes(stdout_f),
jpayne@69 10296 * O_WRONLY|O_CREAT|O_TRUNC, 0666)
jpayne@69 10297 * if stdout_h == -1: # <<<<<<<<<<<<<<
jpayne@69 10298 * raise OSError(errno, "error while opening file for writing", stdout_f)
jpayne@69 10299 *
jpayne@69 10300 */
jpayne@69 10301 __pyx_t_2 = (__Pyx_PyInt_BoolEqObjC(__pyx_v_stdout_h, __pyx_int_neg_1, -1L, 0)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 326, __pyx_L1_error)
jpayne@69 10302 if (unlikely(__pyx_t_2)) {
jpayne@69 10303
jpayne@69 10304 /* "pysam/libcutils.pyx":327
jpayne@69 10305 * O_WRONLY|O_CREAT|O_TRUNC, 0666)
jpayne@69 10306 * if stdout_h == -1:
jpayne@69 10307 * raise OSError(errno, "error while opening file for writing", stdout_f) # <<<<<<<<<<<<<<
jpayne@69 10308 *
jpayne@69 10309 * samtools_set_stdout_fn(force_bytes(stdout_f))
jpayne@69 10310 */
jpayne@69 10311 __pyx_t_7 = __Pyx_PyInt_From_int(errno); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 327, __pyx_L1_error)
jpayne@69 10312 __Pyx_GOTREF(__pyx_t_7);
jpayne@69 10313 __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 327, __pyx_L1_error)
jpayne@69 10314 __Pyx_GOTREF(__pyx_t_3);
jpayne@69 10315 __Pyx_GIVEREF(__pyx_t_7);
jpayne@69 10316 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_7)) __PYX_ERR(0, 327, __pyx_L1_error);
jpayne@69 10317 __Pyx_INCREF(__pyx_kp_u_error_while_opening_file_for_wri);
jpayne@69 10318 __Pyx_GIVEREF(__pyx_kp_u_error_while_opening_file_for_wri);
jpayne@69 10319 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_kp_u_error_while_opening_file_for_wri)) __PYX_ERR(0, 327, __pyx_L1_error);
jpayne@69 10320 __Pyx_INCREF(__pyx_v_stdout_f);
jpayne@69 10321 __Pyx_GIVEREF(__pyx_v_stdout_f);
jpayne@69 10322 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_stdout_f)) __PYX_ERR(0, 327, __pyx_L1_error);
jpayne@69 10323 __pyx_t_7 = 0;
jpayne@69 10324 __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_OSError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 327, __pyx_L1_error)
jpayne@69 10325 __Pyx_GOTREF(__pyx_t_7);
jpayne@69 10326 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@69 10327 __Pyx_Raise(__pyx_t_7, 0, 0, 0);
jpayne@69 10328 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
jpayne@69 10329 __PYX_ERR(0, 327, __pyx_L1_error)
jpayne@69 10330
jpayne@69 10331 /* "pysam/libcutils.pyx":326
jpayne@69 10332 * stdout_h = c_open(force_bytes(stdout_f),
jpayne@69 10333 * O_WRONLY|O_CREAT|O_TRUNC, 0666)
jpayne@69 10334 * if stdout_h == -1: # <<<<<<<<<<<<<<
jpayne@69 10335 * raise OSError(errno, "error while opening file for writing", stdout_f)
jpayne@69 10336 *
jpayne@69 10337 */
jpayne@69 10338 }
jpayne@69 10339
jpayne@69 10340 /* "pysam/libcutils.pyx":329
jpayne@69 10341 * raise OSError(errno, "error while opening file for writing", stdout_f)
jpayne@69 10342 *
jpayne@69 10343 * samtools_set_stdout_fn(force_bytes(stdout_f)) # <<<<<<<<<<<<<<
jpayne@69 10344 * bcftools_set_stdout_fn(force_bytes(stdout_f))
jpayne@69 10345 *
jpayne@69 10346 */
jpayne@69 10347 __pyx_t_7 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_v_stdout_f, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 329, __pyx_L1_error)
jpayne@69 10348 __Pyx_GOTREF(__pyx_t_7);
jpayne@69 10349 if (unlikely(__pyx_t_7 == Py_None)) {
jpayne@69 10350 PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
jpayne@69 10351 __PYX_ERR(0, 329, __pyx_L1_error)
jpayne@69 10352 }
jpayne@69 10353 __pyx_t_12 = __Pyx_PyBytes_AsString(__pyx_t_7); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) __PYX_ERR(0, 329, __pyx_L1_error)
jpayne@69 10354 samtools_set_stdout_fn(__pyx_t_12);
jpayne@69 10355 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
jpayne@69 10356
jpayne@69 10357 /* "pysam/libcutils.pyx":330
jpayne@69 10358 *
jpayne@69 10359 * samtools_set_stdout_fn(force_bytes(stdout_f))
jpayne@69 10360 * bcftools_set_stdout_fn(force_bytes(stdout_f)) # <<<<<<<<<<<<<<
jpayne@69 10361 *
jpayne@69 10362 * elif catch_stdout:
jpayne@69 10363 */
jpayne@69 10364 __pyx_t_7 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_v_stdout_f, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 330, __pyx_L1_error)
jpayne@69 10365 __Pyx_GOTREF(__pyx_t_7);
jpayne@69 10366 if (unlikely(__pyx_t_7 == Py_None)) {
jpayne@69 10367 PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
jpayne@69 10368 __PYX_ERR(0, 330, __pyx_L1_error)
jpayne@69 10369 }
jpayne@69 10370 __pyx_t_13 = __Pyx_PyBytes_AsString(__pyx_t_7); if (unlikely((!__pyx_t_13) && PyErr_Occurred())) __PYX_ERR(0, 330, __pyx_L1_error)
jpayne@69 10371 bcftools_set_stdout_fn(__pyx_t_13);
jpayne@69 10372 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
jpayne@69 10373
jpayne@69 10374 /* "pysam/libcutils.pyx":322
jpayne@69 10375 *
jpayne@69 10376 * # redirect stdout to file
jpayne@69 10377 * if save_stdout: # <<<<<<<<<<<<<<
jpayne@69 10378 * stdout_f = save_stdout
jpayne@69 10379 * stdout_h = c_open(force_bytes(stdout_f),
jpayne@69 10380 */
jpayne@69 10381 goto __pyx_L16;
jpayne@69 10382 }
jpayne@69 10383
jpayne@69 10384 /* "pysam/libcutils.pyx":332
jpayne@69 10385 * bcftools_set_stdout_fn(force_bytes(stdout_f))
jpayne@69 10386 *
jpayne@69 10387 * elif catch_stdout: # <<<<<<<<<<<<<<
jpayne@69 10388 * stdout_h, stdout_f = tempfile.mkstemp()
jpayne@69 10389 * MAP_STDOUT_OPTIONS = {
jpayne@69 10390 */
jpayne@69 10391 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_catch_stdout); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 332, __pyx_L1_error)
jpayne@69 10392 if (__pyx_t_2) {
jpayne@69 10393
jpayne@69 10394 /* "pysam/libcutils.pyx":333
jpayne@69 10395 *
jpayne@69 10396 * elif catch_stdout:
jpayne@69 10397 * stdout_h, stdout_f = tempfile.mkstemp() # <<<<<<<<<<<<<<
jpayne@69 10398 * MAP_STDOUT_OPTIONS = {
jpayne@69 10399 * "samtools": {
jpayne@69 10400 */
jpayne@69 10401 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_tempfile); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 333, __pyx_L1_error)
jpayne@69 10402 __Pyx_GOTREF(__pyx_t_3);
jpayne@69 10403 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_mkstemp); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 333, __pyx_L1_error)
jpayne@69 10404 __Pyx_GOTREF(__pyx_t_6);
jpayne@69 10405 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@69 10406 __pyx_t_3 = NULL;
jpayne@69 10407 __pyx_t_9 = 0;
jpayne@69 10408 #if CYTHON_UNPACK_METHODS
jpayne@69 10409 if (unlikely(PyMethod_Check(__pyx_t_6))) {
jpayne@69 10410 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6);
jpayne@69 10411 if (likely(__pyx_t_3)) {
jpayne@69 10412 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
jpayne@69 10413 __Pyx_INCREF(__pyx_t_3);
jpayne@69 10414 __Pyx_INCREF(function);
jpayne@69 10415 __Pyx_DECREF_SET(__pyx_t_6, function);
jpayne@69 10416 __pyx_t_9 = 1;
jpayne@69 10417 }
jpayne@69 10418 }
jpayne@69 10419 #endif
jpayne@69 10420 {
jpayne@69 10421 PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
jpayne@69 10422 __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_9, 0+__pyx_t_9);
jpayne@69 10423 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@69 10424 if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 333, __pyx_L1_error)
jpayne@69 10425 __Pyx_GOTREF(__pyx_t_7);
jpayne@69 10426 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
jpayne@69 10427 }
jpayne@69 10428 if ((likely(PyTuple_CheckExact(__pyx_t_7))) || (PyList_CheckExact(__pyx_t_7))) {
jpayne@69 10429 PyObject* sequence = __pyx_t_7;
jpayne@69 10430 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
jpayne@69 10431 if (unlikely(size != 2)) {
jpayne@69 10432 if (size > 2) __Pyx_RaiseTooManyValuesError(2);
jpayne@69 10433 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
jpayne@69 10434 __PYX_ERR(0, 333, __pyx_L1_error)
jpayne@69 10435 }
jpayne@69 10436 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
jpayne@69 10437 if (likely(PyTuple_CheckExact(sequence))) {
jpayne@69 10438 __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0);
jpayne@69 10439 __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
jpayne@69 10440 } else {
jpayne@69 10441 __pyx_t_6 = PyList_GET_ITEM(sequence, 0);
jpayne@69 10442 __pyx_t_3 = PyList_GET_ITEM(sequence, 1);
jpayne@69 10443 }
jpayne@69 10444 __Pyx_INCREF(__pyx_t_6);
jpayne@69 10445 __Pyx_INCREF(__pyx_t_3);
jpayne@69 10446 #else
jpayne@69 10447 __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 333, __pyx_L1_error)
jpayne@69 10448 __Pyx_GOTREF(__pyx_t_6);
jpayne@69 10449 __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 333, __pyx_L1_error)
jpayne@69 10450 __Pyx_GOTREF(__pyx_t_3);
jpayne@69 10451 #endif
jpayne@69 10452 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
jpayne@69 10453 } else {
jpayne@69 10454 Py_ssize_t index = -1;
jpayne@69 10455 __pyx_t_8 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 333, __pyx_L1_error)
jpayne@69 10456 __Pyx_GOTREF(__pyx_t_8);
jpayne@69 10457 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
jpayne@69 10458 __pyx_t_10 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_8);
jpayne@69 10459 index = 0; __pyx_t_6 = __pyx_t_10(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L18_unpacking_failed;
jpayne@69 10460 __Pyx_GOTREF(__pyx_t_6);
jpayne@69 10461 index = 1; __pyx_t_3 = __pyx_t_10(__pyx_t_8); if (unlikely(!__pyx_t_3)) goto __pyx_L18_unpacking_failed;
jpayne@69 10462 __Pyx_GOTREF(__pyx_t_3);
jpayne@69 10463 if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_8), 2) < 0) __PYX_ERR(0, 333, __pyx_L1_error)
jpayne@69 10464 __pyx_t_10 = NULL;
jpayne@69 10465 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
jpayne@69 10466 goto __pyx_L19_unpacking_done;
jpayne@69 10467 __pyx_L18_unpacking_failed:;
jpayne@69 10468 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
jpayne@69 10469 __pyx_t_10 = NULL;
jpayne@69 10470 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
jpayne@69 10471 __PYX_ERR(0, 333, __pyx_L1_error)
jpayne@69 10472 __pyx_L19_unpacking_done:;
jpayne@69 10473 }
jpayne@69 10474 __pyx_v_stdout_h = __pyx_t_6;
jpayne@69 10475 __pyx_t_6 = 0;
jpayne@69 10476 __pyx_v_stdout_f = __pyx_t_3;
jpayne@69 10477 __pyx_t_3 = 0;
jpayne@69 10478
jpayne@69 10479 /* "pysam/libcutils.pyx":335
jpayne@69 10480 * stdout_h, stdout_f = tempfile.mkstemp()
jpayne@69 10481 * MAP_STDOUT_OPTIONS = {
jpayne@69 10482 * "samtools": { # <<<<<<<<<<<<<<
jpayne@69 10483 * "view": "-o {}",
jpayne@69 10484 * "mpileup": "-o {}",
jpayne@69 10485 */
jpayne@69 10486 __pyx_t_7 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 335, __pyx_L1_error)
jpayne@69 10487 __Pyx_GOTREF(__pyx_t_7);
jpayne@69 10488
jpayne@69 10489 /* "pysam/libcutils.pyx":336
jpayne@69 10490 * MAP_STDOUT_OPTIONS = {
jpayne@69 10491 * "samtools": {
jpayne@69 10492 * "view": "-o {}", # <<<<<<<<<<<<<<
jpayne@69 10493 * "mpileup": "-o {}",
jpayne@69 10494 * "depad": "-o {}",
jpayne@69 10495 */
jpayne@69 10496 __pyx_t_3 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 336, __pyx_L1_error)
jpayne@69 10497 __Pyx_GOTREF(__pyx_t_3);
jpayne@69 10498 if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_view, __pyx_kp_u_o_2) < 0) __PYX_ERR(0, 336, __pyx_L1_error)
jpayne@69 10499 if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_mpileup, __pyx_kp_u_o_2) < 0) __PYX_ERR(0, 336, __pyx_L1_error)
jpayne@69 10500 if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_depad, __pyx_kp_u_o_2) < 0) __PYX_ERR(0, 336, __pyx_L1_error)
jpayne@69 10501 if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_calmd, __pyx_kp_u_) < 0) __PYX_ERR(0, 336, __pyx_L1_error)
jpayne@69 10502 if (PyDict_SetItem(__pyx_t_7, __pyx_n_u_samtools, __pyx_t_3) < 0) __PYX_ERR(0, 335, __pyx_L1_error)
jpayne@69 10503 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@69 10504
jpayne@69 10505 /* "pysam/libcutils.pyx":341
jpayne@69 10506 * "calmd": "", # uses pysam_stdout_fn
jpayne@69 10507 * },
jpayne@69 10508 * "bcftools": {} # <<<<<<<<<<<<<<
jpayne@69 10509 * }
jpayne@69 10510 *
jpayne@69 10511 */
jpayne@69 10512 __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 341, __pyx_L1_error)
jpayne@69 10513 __Pyx_GOTREF(__pyx_t_3);
jpayne@69 10514 if (PyDict_SetItem(__pyx_t_7, __pyx_n_u_bcftools, __pyx_t_3) < 0) __PYX_ERR(0, 335, __pyx_L1_error)
jpayne@69 10515 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@69 10516 __pyx_v_MAP_STDOUT_OPTIONS = ((PyObject*)__pyx_t_7);
jpayne@69 10517 __pyx_t_7 = 0;
jpayne@69 10518
jpayne@69 10519 /* "pysam/libcutils.pyx":344
jpayne@69 10520 * }
jpayne@69 10521 *
jpayne@69 10522 * stdout_option = None # <<<<<<<<<<<<<<
jpayne@69 10523 * if collection == "bcftools":
jpayne@69 10524 * # in bcftools, most methods accept -o, the exceptions
jpayne@69 10525 */
jpayne@69 10526 __Pyx_INCREF(Py_None);
jpayne@69 10527 __pyx_v_stdout_option = Py_None;
jpayne@69 10528
jpayne@69 10529 /* "pysam/libcutils.pyx":345
jpayne@69 10530 *
jpayne@69 10531 * stdout_option = None
jpayne@69 10532 * if collection == "bcftools": # <<<<<<<<<<<<<<
jpayne@69 10533 * # in bcftools, most methods accept -o, the exceptions
jpayne@69 10534 * # are below:
jpayne@69 10535 */
jpayne@69 10536 __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_collection, __pyx_n_u_bcftools, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 345, __pyx_L1_error)
jpayne@69 10537 if (__pyx_t_2) {
jpayne@69 10538
jpayne@69 10539 /* "pysam/libcutils.pyx":348
jpayne@69 10540 * # in bcftools, most methods accept -o, the exceptions
jpayne@69 10541 * # are below:
jpayne@69 10542 * if method not in ("head", "index", "roh", "stats"): # <<<<<<<<<<<<<<
jpayne@69 10543 * stdout_option = "-o {}"
jpayne@69 10544 * elif method in MAP_STDOUT_OPTIONS[collection]:
jpayne@69 10545 */
jpayne@69 10546 __Pyx_INCREF(__pyx_v_method);
jpayne@69 10547 __pyx_t_7 = __pyx_v_method;
jpayne@69 10548 __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_t_7, __pyx_n_u_head, Py_NE)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 348, __pyx_L1_error)
jpayne@69 10549 if (__pyx_t_1) {
jpayne@69 10550 } else {
jpayne@69 10551 __pyx_t_2 = __pyx_t_1;
jpayne@69 10552 goto __pyx_L22_bool_binop_done;
jpayne@69 10553 }
jpayne@69 10554 __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_t_7, __pyx_n_u_index, Py_NE)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 348, __pyx_L1_error)
jpayne@69 10555 if (__pyx_t_1) {
jpayne@69 10556 } else {
jpayne@69 10557 __pyx_t_2 = __pyx_t_1;
jpayne@69 10558 goto __pyx_L22_bool_binop_done;
jpayne@69 10559 }
jpayne@69 10560 __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_t_7, __pyx_n_u_roh, Py_NE)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 348, __pyx_L1_error)
jpayne@69 10561 if (__pyx_t_1) {
jpayne@69 10562 } else {
jpayne@69 10563 __pyx_t_2 = __pyx_t_1;
jpayne@69 10564 goto __pyx_L22_bool_binop_done;
jpayne@69 10565 }
jpayne@69 10566 __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_t_7, __pyx_n_u_stats, Py_NE)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 348, __pyx_L1_error)
jpayne@69 10567 __pyx_t_2 = __pyx_t_1;
jpayne@69 10568 __pyx_L22_bool_binop_done:;
jpayne@69 10569 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
jpayne@69 10570 __pyx_t_1 = __pyx_t_2;
jpayne@69 10571 if (__pyx_t_1) {
jpayne@69 10572
jpayne@69 10573 /* "pysam/libcutils.pyx":349
jpayne@69 10574 * # are below:
jpayne@69 10575 * if method not in ("head", "index", "roh", "stats"):
jpayne@69 10576 * stdout_option = "-o {}" # <<<<<<<<<<<<<<
jpayne@69 10577 * elif method in MAP_STDOUT_OPTIONS[collection]:
jpayne@69 10578 * # special case - samtools view -c outputs on stdout
jpayne@69 10579 */
jpayne@69 10580 __Pyx_INCREF(__pyx_kp_u_o_2);
jpayne@69 10581 __Pyx_DECREF_SET(__pyx_v_stdout_option, __pyx_kp_u_o_2);
jpayne@69 10582
jpayne@69 10583 /* "pysam/libcutils.pyx":348
jpayne@69 10584 * # in bcftools, most methods accept -o, the exceptions
jpayne@69 10585 * # are below:
jpayne@69 10586 * if method not in ("head", "index", "roh", "stats"): # <<<<<<<<<<<<<<
jpayne@69 10587 * stdout_option = "-o {}"
jpayne@69 10588 * elif method in MAP_STDOUT_OPTIONS[collection]:
jpayne@69 10589 */
jpayne@69 10590 }
jpayne@69 10591
jpayne@69 10592 /* "pysam/libcutils.pyx":345
jpayne@69 10593 *
jpayne@69 10594 * stdout_option = None
jpayne@69 10595 * if collection == "bcftools": # <<<<<<<<<<<<<<
jpayne@69 10596 * # in bcftools, most methods accept -o, the exceptions
jpayne@69 10597 * # are below:
jpayne@69 10598 */
jpayne@69 10599 goto __pyx_L20;
jpayne@69 10600 }
jpayne@69 10601
jpayne@69 10602 /* "pysam/libcutils.pyx":350
jpayne@69 10603 * if method not in ("head", "index", "roh", "stats"):
jpayne@69 10604 * stdout_option = "-o {}"
jpayne@69 10605 * elif method in MAP_STDOUT_OPTIONS[collection]: # <<<<<<<<<<<<<<
jpayne@69 10606 * # special case - samtools view -c outputs on stdout
jpayne@69 10607 * if not(method == "view" and "-c" in args):
jpayne@69 10608 */
jpayne@69 10609 __pyx_t_7 = __Pyx_PyDict_GetItem(__pyx_v_MAP_STDOUT_OPTIONS, __pyx_v_collection); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 350, __pyx_L1_error)
jpayne@69 10610 __Pyx_GOTREF(__pyx_t_7);
jpayne@69 10611 __pyx_t_1 = (__Pyx_PySequence_ContainsTF(__pyx_v_method, __pyx_t_7, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 350, __pyx_L1_error)
jpayne@69 10612 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
jpayne@69 10613 if (__pyx_t_1) {
jpayne@69 10614
jpayne@69 10615 /* "pysam/libcutils.pyx":352
jpayne@69 10616 * elif method in MAP_STDOUT_OPTIONS[collection]:
jpayne@69 10617 * # special case - samtools view -c outputs on stdout
jpayne@69 10618 * if not(method == "view" and "-c" in args): # <<<<<<<<<<<<<<
jpayne@69 10619 * stdout_option = MAP_STDOUT_OPTIONS[collection][method]
jpayne@69 10620 *
jpayne@69 10621 */
jpayne@69 10622 __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_method, __pyx_n_u_view, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 352, __pyx_L1_error)
jpayne@69 10623 if (__pyx_t_2) {
jpayne@69 10624 } else {
jpayne@69 10625 __pyx_t_1 = __pyx_t_2;
jpayne@69 10626 goto __pyx_L27_bool_binop_done;
jpayne@69 10627 }
jpayne@69 10628 __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_kp_u_c, __pyx_v_args, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 352, __pyx_L1_error)
jpayne@69 10629 __pyx_t_1 = __pyx_t_2;
jpayne@69 10630 __pyx_L27_bool_binop_done:;
jpayne@69 10631 __pyx_t_2 = (!__pyx_t_1);
jpayne@69 10632 if (__pyx_t_2) {
jpayne@69 10633
jpayne@69 10634 /* "pysam/libcutils.pyx":353
jpayne@69 10635 * # special case - samtools view -c outputs on stdout
jpayne@69 10636 * if not(method == "view" and "-c" in args):
jpayne@69 10637 * stdout_option = MAP_STDOUT_OPTIONS[collection][method] # <<<<<<<<<<<<<<
jpayne@69 10638 *
jpayne@69 10639 * if stdout_option is not None and not is_usage:
jpayne@69 10640 */
jpayne@69 10641 __pyx_t_7 = __Pyx_PyDict_GetItem(__pyx_v_MAP_STDOUT_OPTIONS, __pyx_v_collection); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 353, __pyx_L1_error)
jpayne@69 10642 __Pyx_GOTREF(__pyx_t_7);
jpayne@69 10643 __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_t_7, __pyx_v_method); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 353, __pyx_L1_error)
jpayne@69 10644 __Pyx_GOTREF(__pyx_t_3);
jpayne@69 10645 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
jpayne@69 10646 __Pyx_DECREF_SET(__pyx_v_stdout_option, __pyx_t_3);
jpayne@69 10647 __pyx_t_3 = 0;
jpayne@69 10648
jpayne@69 10649 /* "pysam/libcutils.pyx":352
jpayne@69 10650 * elif method in MAP_STDOUT_OPTIONS[collection]:
jpayne@69 10651 * # special case - samtools view -c outputs on stdout
jpayne@69 10652 * if not(method == "view" and "-c" in args): # <<<<<<<<<<<<<<
jpayne@69 10653 * stdout_option = MAP_STDOUT_OPTIONS[collection][method]
jpayne@69 10654 *
jpayne@69 10655 */
jpayne@69 10656 }
jpayne@69 10657
jpayne@69 10658 /* "pysam/libcutils.pyx":350
jpayne@69 10659 * if method not in ("head", "index", "roh", "stats"):
jpayne@69 10660 * stdout_option = "-o {}"
jpayne@69 10661 * elif method in MAP_STDOUT_OPTIONS[collection]: # <<<<<<<<<<<<<<
jpayne@69 10662 * # special case - samtools view -c outputs on stdout
jpayne@69 10663 * if not(method == "view" and "-c" in args):
jpayne@69 10664 */
jpayne@69 10665 }
jpayne@69 10666 __pyx_L20:;
jpayne@69 10667
jpayne@69 10668 /* "pysam/libcutils.pyx":355
jpayne@69 10669 * stdout_option = MAP_STDOUT_OPTIONS[collection][method]
jpayne@69 10670 *
jpayne@69 10671 * if stdout_option is not None and not is_usage: # <<<<<<<<<<<<<<
jpayne@69 10672 * os.close(stdout_h)
jpayne@69 10673 * samtools_set_stdout_fn(force_bytes(stdout_f))
jpayne@69 10674 */
jpayne@69 10675 __pyx_t_1 = (__pyx_v_stdout_option != Py_None);
jpayne@69 10676 if (__pyx_t_1) {
jpayne@69 10677 } else {
jpayne@69 10678 __pyx_t_2 = __pyx_t_1;
jpayne@69 10679 goto __pyx_L30_bool_binop_done;
jpayne@69 10680 }
jpayne@69 10681 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_is_usage); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 355, __pyx_L1_error)
jpayne@69 10682 __pyx_t_14 = (!__pyx_t_1);
jpayne@69 10683 __pyx_t_2 = __pyx_t_14;
jpayne@69 10684 __pyx_L30_bool_binop_done:;
jpayne@69 10685 if (__pyx_t_2) {
jpayne@69 10686
jpayne@69 10687 /* "pysam/libcutils.pyx":356
jpayne@69 10688 *
jpayne@69 10689 * if stdout_option is not None and not is_usage:
jpayne@69 10690 * os.close(stdout_h) # <<<<<<<<<<<<<<
jpayne@69 10691 * samtools_set_stdout_fn(force_bytes(stdout_f))
jpayne@69 10692 * bcftools_set_stdout_fn(force_bytes(stdout_f))
jpayne@69 10693 */
jpayne@69 10694 __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_os); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 356, __pyx_L1_error)
jpayne@69 10695 __Pyx_GOTREF(__pyx_t_7);
jpayne@69 10696 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_close); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 356, __pyx_L1_error)
jpayne@69 10697 __Pyx_GOTREF(__pyx_t_6);
jpayne@69 10698 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
jpayne@69 10699 __pyx_t_7 = NULL;
jpayne@69 10700 __pyx_t_9 = 0;
jpayne@69 10701 #if CYTHON_UNPACK_METHODS
jpayne@69 10702 if (unlikely(PyMethod_Check(__pyx_t_6))) {
jpayne@69 10703 __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
jpayne@69 10704 if (likely(__pyx_t_7)) {
jpayne@69 10705 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
jpayne@69 10706 __Pyx_INCREF(__pyx_t_7);
jpayne@69 10707 __Pyx_INCREF(function);
jpayne@69 10708 __Pyx_DECREF_SET(__pyx_t_6, function);
jpayne@69 10709 __pyx_t_9 = 1;
jpayne@69 10710 }
jpayne@69 10711 }
jpayne@69 10712 #endif
jpayne@69 10713 {
jpayne@69 10714 PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_v_stdout_h};
jpayne@69 10715 __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9);
jpayne@69 10716 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
jpayne@69 10717 if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 356, __pyx_L1_error)
jpayne@69 10718 __Pyx_GOTREF(__pyx_t_3);
jpayne@69 10719 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
jpayne@69 10720 }
jpayne@69 10721 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@69 10722
jpayne@69 10723 /* "pysam/libcutils.pyx":357
jpayne@69 10724 * if stdout_option is not None and not is_usage:
jpayne@69 10725 * os.close(stdout_h)
jpayne@69 10726 * samtools_set_stdout_fn(force_bytes(stdout_f)) # <<<<<<<<<<<<<<
jpayne@69 10727 * bcftools_set_stdout_fn(force_bytes(stdout_f))
jpayne@69 10728 * args.extend(stdout_option.format(stdout_f).split(" "))
jpayne@69 10729 */
jpayne@69 10730 __pyx_t_3 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_v_stdout_f, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 357, __pyx_L1_error)
jpayne@69 10731 __Pyx_GOTREF(__pyx_t_3);
jpayne@69 10732 if (unlikely(__pyx_t_3 == Py_None)) {
jpayne@69 10733 PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
jpayne@69 10734 __PYX_ERR(0, 357, __pyx_L1_error)
jpayne@69 10735 }
jpayne@69 10736 __pyx_t_12 = __Pyx_PyBytes_AsString(__pyx_t_3); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) __PYX_ERR(0, 357, __pyx_L1_error)
jpayne@69 10737 samtools_set_stdout_fn(__pyx_t_12);
jpayne@69 10738 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@69 10739
jpayne@69 10740 /* "pysam/libcutils.pyx":358
jpayne@69 10741 * os.close(stdout_h)
jpayne@69 10742 * samtools_set_stdout_fn(force_bytes(stdout_f))
jpayne@69 10743 * bcftools_set_stdout_fn(force_bytes(stdout_f)) # <<<<<<<<<<<<<<
jpayne@69 10744 * args.extend(stdout_option.format(stdout_f).split(" "))
jpayne@69 10745 * stdout_h = c_open(b"/dev/null", O_WRONLY)
jpayne@69 10746 */
jpayne@69 10747 __pyx_t_3 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_v_stdout_f, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 358, __pyx_L1_error)
jpayne@69 10748 __Pyx_GOTREF(__pyx_t_3);
jpayne@69 10749 if (unlikely(__pyx_t_3 == Py_None)) {
jpayne@69 10750 PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
jpayne@69 10751 __PYX_ERR(0, 358, __pyx_L1_error)
jpayne@69 10752 }
jpayne@69 10753 __pyx_t_13 = __Pyx_PyBytes_AsString(__pyx_t_3); if (unlikely((!__pyx_t_13) && PyErr_Occurred())) __PYX_ERR(0, 358, __pyx_L1_error)
jpayne@69 10754 bcftools_set_stdout_fn(__pyx_t_13);
jpayne@69 10755 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@69 10756
jpayne@69 10757 /* "pysam/libcutils.pyx":359
jpayne@69 10758 * samtools_set_stdout_fn(force_bytes(stdout_f))
jpayne@69 10759 * bcftools_set_stdout_fn(force_bytes(stdout_f))
jpayne@69 10760 * args.extend(stdout_option.format(stdout_f).split(" ")) # <<<<<<<<<<<<<<
jpayne@69 10761 * stdout_h = c_open(b"/dev/null", O_WRONLY)
jpayne@69 10762 * else:
jpayne@69 10763 */
jpayne@69 10764 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_args, __pyx_n_s_extend); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 359, __pyx_L1_error)
jpayne@69 10765 __Pyx_GOTREF(__pyx_t_6);
jpayne@69 10766 __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_v_stdout_option, __pyx_n_s_format); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 359, __pyx_L1_error)
jpayne@69 10767 __Pyx_GOTREF(__pyx_t_15);
jpayne@69 10768 __pyx_t_16 = NULL;
jpayne@69 10769 __pyx_t_9 = 0;
jpayne@69 10770 #if CYTHON_UNPACK_METHODS
jpayne@69 10771 if (likely(PyMethod_Check(__pyx_t_15))) {
jpayne@69 10772 __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_15);
jpayne@69 10773 if (likely(__pyx_t_16)) {
jpayne@69 10774 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
jpayne@69 10775 __Pyx_INCREF(__pyx_t_16);
jpayne@69 10776 __Pyx_INCREF(function);
jpayne@69 10777 __Pyx_DECREF_SET(__pyx_t_15, function);
jpayne@69 10778 __pyx_t_9 = 1;
jpayne@69 10779 }
jpayne@69 10780 }
jpayne@69 10781 #endif
jpayne@69 10782 {
jpayne@69 10783 PyObject *__pyx_callargs[2] = {__pyx_t_16, __pyx_v_stdout_f};
jpayne@69 10784 __pyx_t_8 = __Pyx_PyObject_FastCall(__pyx_t_15, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9);
jpayne@69 10785 __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
jpayne@69 10786 if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 359, __pyx_L1_error)
jpayne@69 10787 __Pyx_GOTREF(__pyx_t_8);
jpayne@69 10788 __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
jpayne@69 10789 }
jpayne@69 10790 __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_split); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 359, __pyx_L1_error)
jpayne@69 10791 __Pyx_GOTREF(__pyx_t_15);
jpayne@69 10792 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
jpayne@69 10793 __pyx_t_8 = NULL;
jpayne@69 10794 __pyx_t_9 = 0;
jpayne@69 10795 #if CYTHON_UNPACK_METHODS
jpayne@69 10796 if (likely(PyMethod_Check(__pyx_t_15))) {
jpayne@69 10797 __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_15);
jpayne@69 10798 if (likely(__pyx_t_8)) {
jpayne@69 10799 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
jpayne@69 10800 __Pyx_INCREF(__pyx_t_8);
jpayne@69 10801 __Pyx_INCREF(function);
jpayne@69 10802 __Pyx_DECREF_SET(__pyx_t_15, function);
jpayne@69 10803 __pyx_t_9 = 1;
jpayne@69 10804 }
jpayne@69 10805 }
jpayne@69 10806 #endif
jpayne@69 10807 {
jpayne@69 10808 PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_kp_u__11};
jpayne@69 10809 __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_15, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9);
jpayne@69 10810 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
jpayne@69 10811 if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 359, __pyx_L1_error)
jpayne@69 10812 __Pyx_GOTREF(__pyx_t_7);
jpayne@69 10813 __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
jpayne@69 10814 }
jpayne@69 10815 __pyx_t_15 = NULL;
jpayne@69 10816 __pyx_t_9 = 0;
jpayne@69 10817 #if CYTHON_UNPACK_METHODS
jpayne@69 10818 if (likely(PyMethod_Check(__pyx_t_6))) {
jpayne@69 10819 __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_6);
jpayne@69 10820 if (likely(__pyx_t_15)) {
jpayne@69 10821 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
jpayne@69 10822 __Pyx_INCREF(__pyx_t_15);
jpayne@69 10823 __Pyx_INCREF(function);
jpayne@69 10824 __Pyx_DECREF_SET(__pyx_t_6, function);
jpayne@69 10825 __pyx_t_9 = 1;
jpayne@69 10826 }
jpayne@69 10827 }
jpayne@69 10828 #endif
jpayne@69 10829 {
jpayne@69 10830 PyObject *__pyx_callargs[2] = {__pyx_t_15, __pyx_t_7};
jpayne@69 10831 __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9);
jpayne@69 10832 __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
jpayne@69 10833 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
jpayne@69 10834 if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 359, __pyx_L1_error)
jpayne@69 10835 __Pyx_GOTREF(__pyx_t_3);
jpayne@69 10836 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
jpayne@69 10837 }
jpayne@69 10838 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@69 10839
jpayne@69 10840 /* "pysam/libcutils.pyx":360
jpayne@69 10841 * bcftools_set_stdout_fn(force_bytes(stdout_f))
jpayne@69 10842 * args.extend(stdout_option.format(stdout_f).split(" "))
jpayne@69 10843 * stdout_h = c_open(b"/dev/null", O_WRONLY) # <<<<<<<<<<<<<<
jpayne@69 10844 * else:
jpayne@69 10845 * samtools_set_stdout_fn("-")
jpayne@69 10846 */
jpayne@69 10847 __pyx_t_3 = __Pyx_PyInt_From_int(open(((char const *)"/dev/null"), O_WRONLY)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 360, __pyx_L1_error)
jpayne@69 10848 __Pyx_GOTREF(__pyx_t_3);
jpayne@69 10849 __Pyx_DECREF_SET(__pyx_v_stdout_h, __pyx_t_3);
jpayne@69 10850 __pyx_t_3 = 0;
jpayne@69 10851
jpayne@69 10852 /* "pysam/libcutils.pyx":355
jpayne@69 10853 * stdout_option = MAP_STDOUT_OPTIONS[collection][method]
jpayne@69 10854 *
jpayne@69 10855 * if stdout_option is not None and not is_usage: # <<<<<<<<<<<<<<
jpayne@69 10856 * os.close(stdout_h)
jpayne@69 10857 * samtools_set_stdout_fn(force_bytes(stdout_f))
jpayne@69 10858 */
jpayne@69 10859 }
jpayne@69 10860
jpayne@69 10861 /* "pysam/libcutils.pyx":332
jpayne@69 10862 * bcftools_set_stdout_fn(force_bytes(stdout_f))
jpayne@69 10863 *
jpayne@69 10864 * elif catch_stdout: # <<<<<<<<<<<<<<
jpayne@69 10865 * stdout_h, stdout_f = tempfile.mkstemp()
jpayne@69 10866 * MAP_STDOUT_OPTIONS = {
jpayne@69 10867 */
jpayne@69 10868 goto __pyx_L16;
jpayne@69 10869 }
jpayne@69 10870
jpayne@69 10871 /* "pysam/libcutils.pyx":362
jpayne@69 10872 * stdout_h = c_open(b"/dev/null", O_WRONLY)
jpayne@69 10873 * else:
jpayne@69 10874 * samtools_set_stdout_fn("-") # <<<<<<<<<<<<<<
jpayne@69 10875 * bcftools_set_stdout_fn("-")
jpayne@69 10876 * stdout_h = c_open(b"/dev/null", O_WRONLY)
jpayne@69 10877 */
jpayne@69 10878 /*else*/ {
jpayne@69 10879 samtools_set_stdout_fn(((char const *)"-"));
jpayne@69 10880
jpayne@69 10881 /* "pysam/libcutils.pyx":363
jpayne@69 10882 * else:
jpayne@69 10883 * samtools_set_stdout_fn("-")
jpayne@69 10884 * bcftools_set_stdout_fn("-") # <<<<<<<<<<<<<<
jpayne@69 10885 * stdout_h = c_open(b"/dev/null", O_WRONLY)
jpayne@69 10886 *
jpayne@69 10887 */
jpayne@69 10888 bcftools_set_stdout_fn(((char const *)"-"));
jpayne@69 10889
jpayne@69 10890 /* "pysam/libcutils.pyx":364
jpayne@69 10891 * samtools_set_stdout_fn("-")
jpayne@69 10892 * bcftools_set_stdout_fn("-")
jpayne@69 10893 * stdout_h = c_open(b"/dev/null", O_WRONLY) # <<<<<<<<<<<<<<
jpayne@69 10894 *
jpayne@69 10895 * # setup the function call to samtools/bcftools main
jpayne@69 10896 */
jpayne@69 10897 __pyx_t_3 = __Pyx_PyInt_From_int(open(((char const *)"/dev/null"), O_WRONLY)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 364, __pyx_L1_error)
jpayne@69 10898 __Pyx_GOTREF(__pyx_t_3);
jpayne@69 10899 __pyx_v_stdout_h = __pyx_t_3;
jpayne@69 10900 __pyx_t_3 = 0;
jpayne@69 10901 }
jpayne@69 10902 __pyx_L16:;
jpayne@69 10903
jpayne@69 10904 /* "pysam/libcutils.pyx":369
jpayne@69 10905 * cdef char ** cargs
jpayne@69 10906 * cdef int i, n, retval, l
jpayne@69 10907 * n = len(args) # <<<<<<<<<<<<<<
jpayne@69 10908 * method = force_bytes(method)
jpayne@69 10909 * collection = force_bytes(collection)
jpayne@69 10910 */
jpayne@69 10911 __pyx_t_4 = PyObject_Length(__pyx_v_args); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 369, __pyx_L1_error)
jpayne@69 10912 __pyx_v_n = __pyx_t_4;
jpayne@69 10913
jpayne@69 10914 /* "pysam/libcutils.pyx":370
jpayne@69 10915 * cdef int i, n, retval, l
jpayne@69 10916 * n = len(args)
jpayne@69 10917 * method = force_bytes(method) # <<<<<<<<<<<<<<
jpayne@69 10918 * collection = force_bytes(collection)
jpayne@69 10919 * args = [force_bytes(a) for a in args]
jpayne@69 10920 */
jpayne@69 10921 __pyx_t_3 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_v_method, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 370, __pyx_L1_error)
jpayne@69 10922 __Pyx_GOTREF(__pyx_t_3);
jpayne@69 10923 __Pyx_DECREF_SET(__pyx_v_method, __pyx_t_3);
jpayne@69 10924 __pyx_t_3 = 0;
jpayne@69 10925
jpayne@69 10926 /* "pysam/libcutils.pyx":371
jpayne@69 10927 * n = len(args)
jpayne@69 10928 * method = force_bytes(method)
jpayne@69 10929 * collection = force_bytes(collection) # <<<<<<<<<<<<<<
jpayne@69 10930 * args = [force_bytes(a) for a in args]
jpayne@69 10931 *
jpayne@69 10932 */
jpayne@69 10933 __pyx_t_3 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_v_collection, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 371, __pyx_L1_error)
jpayne@69 10934 __Pyx_GOTREF(__pyx_t_3);
jpayne@69 10935 __Pyx_DECREF_SET(__pyx_v_collection, __pyx_t_3);
jpayne@69 10936 __pyx_t_3 = 0;
jpayne@69 10937
jpayne@69 10938 /* "pysam/libcutils.pyx":372
jpayne@69 10939 * method = force_bytes(method)
jpayne@69 10940 * collection = force_bytes(collection)
jpayne@69 10941 * args = [force_bytes(a) for a in args] # <<<<<<<<<<<<<<
jpayne@69 10942 *
jpayne@69 10943 * # allocate two more for first (dummy) argument (contains command)
jpayne@69 10944 */
jpayne@69 10945 { /* enter inner scope */
jpayne@69 10946 __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 372, __pyx_L34_error)
jpayne@69 10947 __Pyx_GOTREF(__pyx_t_3);
jpayne@69 10948 if (likely(PyList_CheckExact(__pyx_v_args)) || PyTuple_CheckExact(__pyx_v_args)) {
jpayne@69 10949 __pyx_t_6 = __pyx_v_args; __Pyx_INCREF(__pyx_t_6);
jpayne@69 10950 __pyx_t_4 = 0;
jpayne@69 10951 __pyx_t_5 = NULL;
jpayne@69 10952 } else {
jpayne@69 10953 __pyx_t_4 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_args); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 372, __pyx_L34_error)
jpayne@69 10954 __Pyx_GOTREF(__pyx_t_6);
jpayne@69 10955 __pyx_t_5 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 372, __pyx_L34_error)
jpayne@69 10956 }
jpayne@69 10957 for (;;) {
jpayne@69 10958 if (likely(!__pyx_t_5)) {
jpayne@69 10959 if (likely(PyList_CheckExact(__pyx_t_6))) {
jpayne@69 10960 {
jpayne@69 10961 Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_6);
jpayne@69 10962 #if !CYTHON_ASSUME_SAFE_MACROS
jpayne@69 10963 if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 372, __pyx_L34_error)
jpayne@69 10964 #endif
jpayne@69 10965 if (__pyx_t_4 >= __pyx_temp) break;
jpayne@69 10966 }
jpayne@69 10967 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
jpayne@69 10968 __pyx_t_7 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_4); __Pyx_INCREF(__pyx_t_7); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(0, 372, __pyx_L34_error)
jpayne@69 10969 #else
jpayne@69 10970 __pyx_t_7 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 372, __pyx_L34_error)
jpayne@69 10971 __Pyx_GOTREF(__pyx_t_7);
jpayne@69 10972 #endif
jpayne@69 10973 } else {
jpayne@69 10974 {
jpayne@69 10975 Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_6);
jpayne@69 10976 #if !CYTHON_ASSUME_SAFE_MACROS
jpayne@69 10977 if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 372, __pyx_L34_error)
jpayne@69 10978 #endif
jpayne@69 10979 if (__pyx_t_4 >= __pyx_temp) break;
jpayne@69 10980 }
jpayne@69 10981 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
jpayne@69 10982 __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_4); __Pyx_INCREF(__pyx_t_7); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(0, 372, __pyx_L34_error)
jpayne@69 10983 #else
jpayne@69 10984 __pyx_t_7 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 372, __pyx_L34_error)
jpayne@69 10985 __Pyx_GOTREF(__pyx_t_7);
jpayne@69 10986 #endif
jpayne@69 10987 }
jpayne@69 10988 } else {
jpayne@69 10989 __pyx_t_7 = __pyx_t_5(__pyx_t_6);
jpayne@69 10990 if (unlikely(!__pyx_t_7)) {
jpayne@69 10991 PyObject* exc_type = PyErr_Occurred();
jpayne@69 10992 if (exc_type) {
jpayne@69 10993 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
jpayne@69 10994 else __PYX_ERR(0, 372, __pyx_L34_error)
jpayne@69 10995 }
jpayne@69 10996 break;
jpayne@69 10997 }
jpayne@69 10998 __Pyx_GOTREF(__pyx_t_7);
jpayne@69 10999 }
jpayne@69 11000 __Pyx_XDECREF_SET(__pyx_8genexpr2__pyx_v_a, __pyx_t_7);
jpayne@69 11001 __pyx_t_7 = 0;
jpayne@69 11002 __pyx_t_7 = __pyx_f_5pysam_9libcutils_force_bytes(__pyx_8genexpr2__pyx_v_a, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 372, __pyx_L34_error)
jpayne@69 11003 __Pyx_GOTREF(__pyx_t_7);
jpayne@69 11004 if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_7))) __PYX_ERR(0, 372, __pyx_L34_error)
jpayne@69 11005 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
jpayne@69 11006 }
jpayne@69 11007 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
jpayne@69 11008 __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_a); __pyx_8genexpr2__pyx_v_a = 0;
jpayne@69 11009 goto __pyx_L38_exit_scope;
jpayne@69 11010 __pyx_L34_error:;
jpayne@69 11011 __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_a); __pyx_8genexpr2__pyx_v_a = 0;
jpayne@69 11012 goto __pyx_L1_error;
jpayne@69 11013 __pyx_L38_exit_scope:;
jpayne@69 11014 } /* exit inner scope */
jpayne@69 11015 __Pyx_DECREF_SET(__pyx_v_args, __pyx_t_3);
jpayne@69 11016 __pyx_t_3 = 0;
jpayne@69 11017
jpayne@69 11018 /* "pysam/libcutils.pyx":375
jpayne@69 11019 *
jpayne@69 11020 * # allocate two more for first (dummy) argument (contains command)
jpayne@69 11021 * cdef int extra_args = 0 # <<<<<<<<<<<<<<
jpayne@69 11022 * if method == b"index":
jpayne@69 11023 * extra_args = 1
jpayne@69 11024 */
jpayne@69 11025 __pyx_v_extra_args = 0;
jpayne@69 11026
jpayne@69 11027 /* "pysam/libcutils.pyx":376
jpayne@69 11028 * # allocate two more for first (dummy) argument (contains command)
jpayne@69 11029 * cdef int extra_args = 0
jpayne@69 11030 * if method == b"index": # <<<<<<<<<<<<<<
jpayne@69 11031 * extra_args = 1
jpayne@69 11032 * # add extra arguments for commands accepting optional arguments
jpayne@69 11033 */
jpayne@69 11034 __pyx_t_2 = (__Pyx_PyBytes_Equals(__pyx_v_method, __pyx_n_b_index, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 376, __pyx_L1_error)
jpayne@69 11035 if (__pyx_t_2) {
jpayne@69 11036
jpayne@69 11037 /* "pysam/libcutils.pyx":377
jpayne@69 11038 * cdef int extra_args = 0
jpayne@69 11039 * if method == b"index":
jpayne@69 11040 * extra_args = 1 # <<<<<<<<<<<<<<
jpayne@69 11041 * # add extra arguments for commands accepting optional arguments
jpayne@69 11042 * # such as 'samtools index x.bam [out.index]'
jpayne@69 11043 */
jpayne@69 11044 __pyx_v_extra_args = 1;
jpayne@69 11045
jpayne@69 11046 /* "pysam/libcutils.pyx":376
jpayne@69 11047 * # allocate two more for first (dummy) argument (contains command)
jpayne@69 11048 * cdef int extra_args = 0
jpayne@69 11049 * if method == b"index": # <<<<<<<<<<<<<<
jpayne@69 11050 * extra_args = 1
jpayne@69 11051 * # add extra arguments for commands accepting optional arguments
jpayne@69 11052 */
jpayne@69 11053 }
jpayne@69 11054
jpayne@69 11055 /* "pysam/libcutils.pyx":380
jpayne@69 11056 * # add extra arguments for commands accepting optional arguments
jpayne@69 11057 * # such as 'samtools index x.bam [out.index]'
jpayne@69 11058 * cargs = <char**>calloc(n + 2 + extra_args, sizeof(char *)) # <<<<<<<<<<<<<<
jpayne@69 11059 * cargs[0] = collection
jpayne@69 11060 * cargs[1] = method
jpayne@69 11061 */
jpayne@69 11062 __pyx_v_cargs = ((char **)calloc(((__pyx_v_n + 2) + __pyx_v_extra_args), (sizeof(char *))));
jpayne@69 11063
jpayne@69 11064 /* "pysam/libcutils.pyx":381
jpayne@69 11065 * # such as 'samtools index x.bam [out.index]'
jpayne@69 11066 * cargs = <char**>calloc(n + 2 + extra_args, sizeof(char *))
jpayne@69 11067 * cargs[0] = collection # <<<<<<<<<<<<<<
jpayne@69 11068 * cargs[1] = method
jpayne@69 11069 *
jpayne@69 11070 */
jpayne@69 11071 __pyx_t_17 = __Pyx_PyObject_AsWritableString(__pyx_v_collection); if (unlikely((!__pyx_t_17) && PyErr_Occurred())) __PYX_ERR(0, 381, __pyx_L1_error)
jpayne@69 11072 (__pyx_v_cargs[0]) = __pyx_t_17;
jpayne@69 11073
jpayne@69 11074 /* "pysam/libcutils.pyx":382
jpayne@69 11075 * cargs = <char**>calloc(n + 2 + extra_args, sizeof(char *))
jpayne@69 11076 * cargs[0] = collection
jpayne@69 11077 * cargs[1] = method # <<<<<<<<<<<<<<
jpayne@69 11078 *
jpayne@69 11079 * # create copies of strings - getopt for long options permutes
jpayne@69 11080 */
jpayne@69 11081 __pyx_t_17 = __Pyx_PyObject_AsWritableString(__pyx_v_method); if (unlikely((!__pyx_t_17) && PyErr_Occurred())) __PYX_ERR(0, 382, __pyx_L1_error)
jpayne@69 11082 (__pyx_v_cargs[1]) = __pyx_t_17;
jpayne@69 11083
jpayne@69 11084 /* "pysam/libcutils.pyx":386
jpayne@69 11085 * # create copies of strings - getopt for long options permutes
jpayne@69 11086 * # arguments
jpayne@69 11087 * for i from 0 <= i < n: # <<<<<<<<<<<<<<
jpayne@69 11088 * l = len(args[i])
jpayne@69 11089 * cargs[i + 2] = <char *>calloc(l + 1, sizeof(char))
jpayne@69 11090 */
jpayne@69 11091 __pyx_t_18 = __pyx_v_n;
jpayne@69 11092 for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_18; __pyx_v_i++) {
jpayne@69 11093
jpayne@69 11094 /* "pysam/libcutils.pyx":387
jpayne@69 11095 * # arguments
jpayne@69 11096 * for i from 0 <= i < n:
jpayne@69 11097 * l = len(args[i]) # <<<<<<<<<<<<<<
jpayne@69 11098 * cargs[i + 2] = <char *>calloc(l + 1, sizeof(char))
jpayne@69 11099 * strncpy(cargs[i + 2], args[i], l)
jpayne@69 11100 */
jpayne@69 11101 __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_args, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 387, __pyx_L1_error)
jpayne@69 11102 __Pyx_GOTREF(__pyx_t_3);
jpayne@69 11103 __pyx_t_4 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_4 == ((Py_ssize_t)-1))) __PYX_ERR(0, 387, __pyx_L1_error)
jpayne@69 11104 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@69 11105 __pyx_v_l = __pyx_t_4;
jpayne@69 11106
jpayne@69 11107 /* "pysam/libcutils.pyx":388
jpayne@69 11108 * for i from 0 <= i < n:
jpayne@69 11109 * l = len(args[i])
jpayne@69 11110 * cargs[i + 2] = <char *>calloc(l + 1, sizeof(char)) # <<<<<<<<<<<<<<
jpayne@69 11111 * strncpy(cargs[i + 2], args[i], l)
jpayne@69 11112 *
jpayne@69 11113 */
jpayne@69 11114 (__pyx_v_cargs[(__pyx_v_i + 2)]) = ((char *)calloc((__pyx_v_l + 1), (sizeof(char))));
jpayne@69 11115
jpayne@69 11116 /* "pysam/libcutils.pyx":389
jpayne@69 11117 * l = len(args[i])
jpayne@69 11118 * cargs[i + 2] = <char *>calloc(l + 1, sizeof(char))
jpayne@69 11119 * strncpy(cargs[i + 2], args[i], l) # <<<<<<<<<<<<<<
jpayne@69 11120 *
jpayne@69 11121 * # call samtools/bcftools
jpayne@69 11122 */
jpayne@69 11123 __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_args, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 389, __pyx_L1_error)
jpayne@69 11124 __Pyx_GOTREF(__pyx_t_3);
jpayne@69 11125 __pyx_t_19 = __Pyx_PyObject_AsString(__pyx_t_3); if (unlikely((!__pyx_t_19) && PyErr_Occurred())) __PYX_ERR(0, 389, __pyx_L1_error)
jpayne@69 11126 (void)(strncpy((__pyx_v_cargs[(__pyx_v_i + 2)]), __pyx_t_19, __pyx_v_l));
jpayne@69 11127 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@69 11128 }
jpayne@69 11129
jpayne@69 11130 /* "pysam/libcutils.pyx":392
jpayne@69 11131 *
jpayne@69 11132 * # call samtools/bcftools
jpayne@69 11133 * if collection == b"samtools": # <<<<<<<<<<<<<<
jpayne@69 11134 * samtools_set_stdout(stdout_h)
jpayne@69 11135 * samtools_set_stderr(stderr_h)
jpayne@69 11136 */
jpayne@69 11137 __pyx_t_2 = (__Pyx_PyBytes_Equals(__pyx_v_collection, __pyx_n_b_samtools, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 392, __pyx_L1_error)
jpayne@69 11138 if (__pyx_t_2) {
jpayne@69 11139
jpayne@69 11140 /* "pysam/libcutils.pyx":393
jpayne@69 11141 * # call samtools/bcftools
jpayne@69 11142 * if collection == b"samtools":
jpayne@69 11143 * samtools_set_stdout(stdout_h) # <<<<<<<<<<<<<<
jpayne@69 11144 * samtools_set_stderr(stderr_h)
jpayne@69 11145 * retval = samtools_dispatch(n + 2, cargs)
jpayne@69 11146 */
jpayne@69 11147 __pyx_t_18 = __Pyx_PyInt_As_int(__pyx_v_stdout_h); if (unlikely((__pyx_t_18 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 393, __pyx_L1_error)
jpayne@69 11148 samtools_set_stdout(__pyx_t_18);
jpayne@69 11149
jpayne@69 11150 /* "pysam/libcutils.pyx":394
jpayne@69 11151 * if collection == b"samtools":
jpayne@69 11152 * samtools_set_stdout(stdout_h)
jpayne@69 11153 * samtools_set_stderr(stderr_h) # <<<<<<<<<<<<<<
jpayne@69 11154 * retval = samtools_dispatch(n + 2, cargs)
jpayne@69 11155 * samtools_close_stdout()
jpayne@69 11156 */
jpayne@69 11157 __pyx_t_18 = __Pyx_PyInt_As_int(__pyx_v_stderr_h); if (unlikely((__pyx_t_18 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 394, __pyx_L1_error)
jpayne@69 11158 samtools_set_stderr(__pyx_t_18);
jpayne@69 11159
jpayne@69 11160 /* "pysam/libcutils.pyx":395
jpayne@69 11161 * samtools_set_stdout(stdout_h)
jpayne@69 11162 * samtools_set_stderr(stderr_h)
jpayne@69 11163 * retval = samtools_dispatch(n + 2, cargs) # <<<<<<<<<<<<<<
jpayne@69 11164 * samtools_close_stdout()
jpayne@69 11165 * samtools_close_stderr()
jpayne@69 11166 */
jpayne@69 11167 __pyx_v_retval = samtools_dispatch((__pyx_v_n + 2), __pyx_v_cargs);
jpayne@69 11168
jpayne@69 11169 /* "pysam/libcutils.pyx":396
jpayne@69 11170 * samtools_set_stderr(stderr_h)
jpayne@69 11171 * retval = samtools_dispatch(n + 2, cargs)
jpayne@69 11172 * samtools_close_stdout() # <<<<<<<<<<<<<<
jpayne@69 11173 * samtools_close_stderr()
jpayne@69 11174 * elif collection == b"bcftools":
jpayne@69 11175 */
jpayne@69 11176 samtools_close_stdout();
jpayne@69 11177
jpayne@69 11178 /* "pysam/libcutils.pyx":397
jpayne@69 11179 * retval = samtools_dispatch(n + 2, cargs)
jpayne@69 11180 * samtools_close_stdout()
jpayne@69 11181 * samtools_close_stderr() # <<<<<<<<<<<<<<
jpayne@69 11182 * elif collection == b"bcftools":
jpayne@69 11183 * bcftools_set_stdout(stdout_h)
jpayne@69 11184 */
jpayne@69 11185 samtools_close_stderr();
jpayne@69 11186
jpayne@69 11187 /* "pysam/libcutils.pyx":392
jpayne@69 11188 *
jpayne@69 11189 * # call samtools/bcftools
jpayne@69 11190 * if collection == b"samtools": # <<<<<<<<<<<<<<
jpayne@69 11191 * samtools_set_stdout(stdout_h)
jpayne@69 11192 * samtools_set_stderr(stderr_h)
jpayne@69 11193 */
jpayne@69 11194 goto __pyx_L42;
jpayne@69 11195 }
jpayne@69 11196
jpayne@69 11197 /* "pysam/libcutils.pyx":398
jpayne@69 11198 * samtools_close_stdout()
jpayne@69 11199 * samtools_close_stderr()
jpayne@69 11200 * elif collection == b"bcftools": # <<<<<<<<<<<<<<
jpayne@69 11201 * bcftools_set_stdout(stdout_h)
jpayne@69 11202 * bcftools_set_stderr(stderr_h)
jpayne@69 11203 */
jpayne@69 11204 __pyx_t_2 = (__Pyx_PyBytes_Equals(__pyx_v_collection, __pyx_n_b_bcftools, Py_EQ)); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 398, __pyx_L1_error)
jpayne@69 11205 if (__pyx_t_2) {
jpayne@69 11206
jpayne@69 11207 /* "pysam/libcutils.pyx":399
jpayne@69 11208 * samtools_close_stderr()
jpayne@69 11209 * elif collection == b"bcftools":
jpayne@69 11210 * bcftools_set_stdout(stdout_h) # <<<<<<<<<<<<<<
jpayne@69 11211 * bcftools_set_stderr(stderr_h)
jpayne@69 11212 * retval = bcftools_dispatch(n + 2, cargs)
jpayne@69 11213 */
jpayne@69 11214 __pyx_t_18 = __Pyx_PyInt_As_int(__pyx_v_stdout_h); if (unlikely((__pyx_t_18 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 399, __pyx_L1_error)
jpayne@69 11215 bcftools_set_stdout(__pyx_t_18);
jpayne@69 11216
jpayne@69 11217 /* "pysam/libcutils.pyx":400
jpayne@69 11218 * elif collection == b"bcftools":
jpayne@69 11219 * bcftools_set_stdout(stdout_h)
jpayne@69 11220 * bcftools_set_stderr(stderr_h) # <<<<<<<<<<<<<<
jpayne@69 11221 * retval = bcftools_dispatch(n + 2, cargs)
jpayne@69 11222 * bcftools_close_stdout()
jpayne@69 11223 */
jpayne@69 11224 __pyx_t_18 = __Pyx_PyInt_As_int(__pyx_v_stderr_h); if (unlikely((__pyx_t_18 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 400, __pyx_L1_error)
jpayne@69 11225 bcftools_set_stderr(__pyx_t_18);
jpayne@69 11226
jpayne@69 11227 /* "pysam/libcutils.pyx":401
jpayne@69 11228 * bcftools_set_stdout(stdout_h)
jpayne@69 11229 * bcftools_set_stderr(stderr_h)
jpayne@69 11230 * retval = bcftools_dispatch(n + 2, cargs) # <<<<<<<<<<<<<<
jpayne@69 11231 * bcftools_close_stdout()
jpayne@69 11232 * bcftools_close_stderr()
jpayne@69 11233 */
jpayne@69 11234 __pyx_v_retval = bcftools_dispatch((__pyx_v_n + 2), __pyx_v_cargs);
jpayne@69 11235
jpayne@69 11236 /* "pysam/libcutils.pyx":402
jpayne@69 11237 * bcftools_set_stderr(stderr_h)
jpayne@69 11238 * retval = bcftools_dispatch(n + 2, cargs)
jpayne@69 11239 * bcftools_close_stdout() # <<<<<<<<<<<<<<
jpayne@69 11240 * bcftools_close_stderr()
jpayne@69 11241 * else:
jpayne@69 11242 */
jpayne@69 11243 bcftools_close_stdout();
jpayne@69 11244
jpayne@69 11245 /* "pysam/libcutils.pyx":403
jpayne@69 11246 * retval = bcftools_dispatch(n + 2, cargs)
jpayne@69 11247 * bcftools_close_stdout()
jpayne@69 11248 * bcftools_close_stderr() # <<<<<<<<<<<<<<
jpayne@69 11249 * else:
jpayne@69 11250 * # unknown -- just return a Unix shell's "command not found" exit status
jpayne@69 11251 */
jpayne@69 11252 bcftools_close_stderr();
jpayne@69 11253
jpayne@69 11254 /* "pysam/libcutils.pyx":398
jpayne@69 11255 * samtools_close_stdout()
jpayne@69 11256 * samtools_close_stderr()
jpayne@69 11257 * elif collection == b"bcftools": # <<<<<<<<<<<<<<
jpayne@69 11258 * bcftools_set_stdout(stdout_h)
jpayne@69 11259 * bcftools_set_stderr(stderr_h)
jpayne@69 11260 */
jpayne@69 11261 goto __pyx_L42;
jpayne@69 11262 }
jpayne@69 11263
jpayne@69 11264 /* "pysam/libcutils.pyx":406
jpayne@69 11265 * else:
jpayne@69 11266 * # unknown -- just return a Unix shell's "command not found" exit status
jpayne@69 11267 * retval = 127 # <<<<<<<<<<<<<<
jpayne@69 11268 *
jpayne@69 11269 * for i from 0 <= i < n:
jpayne@69 11270 */
jpayne@69 11271 /*else*/ {
jpayne@69 11272 __pyx_v_retval = 0x7F;
jpayne@69 11273 }
jpayne@69 11274 __pyx_L42:;
jpayne@69 11275
jpayne@69 11276 /* "pysam/libcutils.pyx":408
jpayne@69 11277 * retval = 127
jpayne@69 11278 *
jpayne@69 11279 * for i from 0 <= i < n: # <<<<<<<<<<<<<<
jpayne@69 11280 * free(cargs[i + 2])
jpayne@69 11281 * free(cargs)
jpayne@69 11282 */
jpayne@69 11283 __pyx_t_18 = __pyx_v_n;
jpayne@69 11284 for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_18; __pyx_v_i++) {
jpayne@69 11285
jpayne@69 11286 /* "pysam/libcutils.pyx":409
jpayne@69 11287 *
jpayne@69 11288 * for i from 0 <= i < n:
jpayne@69 11289 * free(cargs[i + 2]) # <<<<<<<<<<<<<<
jpayne@69 11290 * free(cargs)
jpayne@69 11291 *
jpayne@69 11292 */
jpayne@69 11293 free((__pyx_v_cargs[(__pyx_v_i + 2)]));
jpayne@69 11294 }
jpayne@69 11295
jpayne@69 11296 /* "pysam/libcutils.pyx":410
jpayne@69 11297 * for i from 0 <= i < n:
jpayne@69 11298 * free(cargs[i + 2])
jpayne@69 11299 * free(cargs) # <<<<<<<<<<<<<<
jpayne@69 11300 *
jpayne@69 11301 * # get error messages
jpayne@69 11302 */
jpayne@69 11303 free(__pyx_v_cargs);
jpayne@69 11304
jpayne@69 11305 /* "pysam/libcutils.pyx":413
jpayne@69 11306 *
jpayne@69 11307 * # get error messages
jpayne@69 11308 * def _collect(fn): # <<<<<<<<<<<<<<
jpayne@69 11309 * out = []
jpayne@69 11310 * try:
jpayne@69 11311 */
jpayne@69 11312 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_9libcutils_15_pysam_dispatch_1_collect, 0, __pyx_n_s_pysam_dispatch_locals__collect, NULL, __pyx_n_s_pysam_libcutils, __pyx_d, ((PyObject *)__pyx_codeobj__13)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 413, __pyx_L1_error)
jpayne@69 11313 __Pyx_GOTREF(__pyx_t_3);
jpayne@69 11314 __pyx_v__collect = __pyx_t_3;
jpayne@69 11315 __pyx_t_3 = 0;
jpayne@69 11316
jpayne@69 11317 /* "pysam/libcutils.pyx":426
jpayne@69 11318 * return out
jpayne@69 11319 *
jpayne@69 11320 * out_stderr = _collect(stderr_f) # <<<<<<<<<<<<<<
jpayne@69 11321 * if save_stdout:
jpayne@69 11322 * out_stdout = None
jpayne@69 11323 */
jpayne@69 11324 __pyx_t_3 = __pyx_pf_5pysam_9libcutils_15_pysam_dispatch__collect(__pyx_v__collect, __pyx_v_stderr_f); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 426, __pyx_L1_error)
jpayne@69 11325 __Pyx_GOTREF(__pyx_t_3);
jpayne@69 11326 __pyx_v_out_stderr = __pyx_t_3;
jpayne@69 11327 __pyx_t_3 = 0;
jpayne@69 11328
jpayne@69 11329 /* "pysam/libcutils.pyx":427
jpayne@69 11330 *
jpayne@69 11331 * out_stderr = _collect(stderr_f)
jpayne@69 11332 * if save_stdout: # <<<<<<<<<<<<<<
jpayne@69 11333 * out_stdout = None
jpayne@69 11334 * elif catch_stdout:
jpayne@69 11335 */
jpayne@69 11336 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_save_stdout); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 427, __pyx_L1_error)
jpayne@69 11337 if (__pyx_t_2) {
jpayne@69 11338
jpayne@69 11339 /* "pysam/libcutils.pyx":428
jpayne@69 11340 * out_stderr = _collect(stderr_f)
jpayne@69 11341 * if save_stdout:
jpayne@69 11342 * out_stdout = None # <<<<<<<<<<<<<<
jpayne@69 11343 * elif catch_stdout:
jpayne@69 11344 * out_stdout = _collect(stdout_f)
jpayne@69 11345 */
jpayne@69 11346 __Pyx_INCREF(Py_None);
jpayne@69 11347 __pyx_v_out_stdout = Py_None;
jpayne@69 11348
jpayne@69 11349 /* "pysam/libcutils.pyx":427
jpayne@69 11350 *
jpayne@69 11351 * out_stderr = _collect(stderr_f)
jpayne@69 11352 * if save_stdout: # <<<<<<<<<<<<<<
jpayne@69 11353 * out_stdout = None
jpayne@69 11354 * elif catch_stdout:
jpayne@69 11355 */
jpayne@69 11356 goto __pyx_L45;
jpayne@69 11357 }
jpayne@69 11358
jpayne@69 11359 /* "pysam/libcutils.pyx":429
jpayne@69 11360 * if save_stdout:
jpayne@69 11361 * out_stdout = None
jpayne@69 11362 * elif catch_stdout: # <<<<<<<<<<<<<<
jpayne@69 11363 * out_stdout = _collect(stdout_f)
jpayne@69 11364 * else:
jpayne@69 11365 */
jpayne@69 11366 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_catch_stdout); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 429, __pyx_L1_error)
jpayne@69 11367 if (__pyx_t_2) {
jpayne@69 11368
jpayne@69 11369 /* "pysam/libcutils.pyx":430
jpayne@69 11370 * out_stdout = None
jpayne@69 11371 * elif catch_stdout:
jpayne@69 11372 * out_stdout = _collect(stdout_f) # <<<<<<<<<<<<<<
jpayne@69 11373 * else:
jpayne@69 11374 * out_stdout = None
jpayne@69 11375 */
jpayne@69 11376 if (unlikely(!__pyx_v_stdout_f)) { __Pyx_RaiseUnboundLocalError("stdout_f"); __PYX_ERR(0, 430, __pyx_L1_error) }
jpayne@69 11377 __pyx_t_3 = __pyx_pf_5pysam_9libcutils_15_pysam_dispatch__collect(__pyx_v__collect, __pyx_v_stdout_f); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 430, __pyx_L1_error)
jpayne@69 11378 __Pyx_GOTREF(__pyx_t_3);
jpayne@69 11379 __pyx_v_out_stdout = __pyx_t_3;
jpayne@69 11380 __pyx_t_3 = 0;
jpayne@69 11381
jpayne@69 11382 /* "pysam/libcutils.pyx":429
jpayne@69 11383 * if save_stdout:
jpayne@69 11384 * out_stdout = None
jpayne@69 11385 * elif catch_stdout: # <<<<<<<<<<<<<<
jpayne@69 11386 * out_stdout = _collect(stdout_f)
jpayne@69 11387 * else:
jpayne@69 11388 */
jpayne@69 11389 goto __pyx_L45;
jpayne@69 11390 }
jpayne@69 11391
jpayne@69 11392 /* "pysam/libcutils.pyx":432
jpayne@69 11393 * out_stdout = _collect(stdout_f)
jpayne@69 11394 * else:
jpayne@69 11395 * out_stdout = None # <<<<<<<<<<<<<<
jpayne@69 11396 *
jpayne@69 11397 * return retval, out_stderr, out_stdout
jpayne@69 11398 */
jpayne@69 11399 /*else*/ {
jpayne@69 11400 __Pyx_INCREF(Py_None);
jpayne@69 11401 __pyx_v_out_stdout = Py_None;
jpayne@69 11402 }
jpayne@69 11403 __pyx_L45:;
jpayne@69 11404
jpayne@69 11405 /* "pysam/libcutils.pyx":434
jpayne@69 11406 * out_stdout = None
jpayne@69 11407 *
jpayne@69 11408 * return retval, out_stderr, out_stdout # <<<<<<<<<<<<<<
jpayne@69 11409 *
jpayne@69 11410 *
jpayne@69 11411 */
jpayne@69 11412 __Pyx_XDECREF(__pyx_r);
jpayne@69 11413 __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_retval); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 434, __pyx_L1_error)
jpayne@69 11414 __Pyx_GOTREF(__pyx_t_3);
jpayne@69 11415 __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 434, __pyx_L1_error)
jpayne@69 11416 __Pyx_GOTREF(__pyx_t_6);
jpayne@69 11417 __Pyx_GIVEREF(__pyx_t_3);
jpayne@69 11418 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3)) __PYX_ERR(0, 434, __pyx_L1_error);
jpayne@69 11419 __Pyx_INCREF(__pyx_v_out_stderr);
jpayne@69 11420 __Pyx_GIVEREF(__pyx_v_out_stderr);
jpayne@69 11421 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_out_stderr)) __PYX_ERR(0, 434, __pyx_L1_error);
jpayne@69 11422 __Pyx_INCREF(__pyx_v_out_stdout);
jpayne@69 11423 __Pyx_GIVEREF(__pyx_v_out_stdout);
jpayne@69 11424 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_out_stdout)) __PYX_ERR(0, 434, __pyx_L1_error);
jpayne@69 11425 __pyx_t_3 = 0;
jpayne@69 11426 __pyx_r = __pyx_t_6;
jpayne@69 11427 __pyx_t_6 = 0;
jpayne@69 11428 goto __pyx_L0;
jpayne@69 11429
jpayne@69 11430 /* "pysam/libcutils.pyx":276
jpayne@69 11431 *
jpayne@69 11432 *
jpayne@69 11433 * def _pysam_dispatch(collection, # <<<<<<<<<<<<<<
jpayne@69 11434 * method,
jpayne@69 11435 * args=None,
jpayne@69 11436 */
jpayne@69 11437
jpayne@69 11438 /* function exit code */
jpayne@69 11439 __pyx_L1_error:;
jpayne@69 11440 __Pyx_XDECREF(__pyx_t_3);
jpayne@69 11441 __Pyx_XDECREF(__pyx_t_6);
jpayne@69 11442 __Pyx_XDECREF(__pyx_t_7);
jpayne@69 11443 __Pyx_XDECREF(__pyx_t_8);
jpayne@69 11444 __Pyx_XDECREF(__pyx_t_15);
jpayne@69 11445 __Pyx_XDECREF(__pyx_t_16);
jpayne@69 11446 __Pyx_AddTraceback("pysam.libcutils._pysam_dispatch", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@69 11447 __pyx_r = NULL;
jpayne@69 11448 __pyx_L0:;
jpayne@69 11449 __Pyx_XDECREF(__pyx_v_ARGUMENTS);
jpayne@69 11450 __Pyx_XDECREF(__pyx_v_arg);
jpayne@69 11451 __Pyx_XDECREF(__pyx_v_stderr_h);
jpayne@69 11452 __Pyx_XDECREF(__pyx_v_stderr_f);
jpayne@69 11453 __Pyx_XDECREF(__pyx_v_stdout_f);
jpayne@69 11454 __Pyx_XDECREF(__pyx_v_stdout_h);
jpayne@69 11455 __Pyx_XDECREF(__pyx_v_MAP_STDOUT_OPTIONS);
jpayne@69 11456 __Pyx_XDECREF(__pyx_v_stdout_option);
jpayne@69 11457 __Pyx_XDECREF(__pyx_v__collect);
jpayne@69 11458 __Pyx_XDECREF(__pyx_v_out_stderr);
jpayne@69 11459 __Pyx_XDECREF(__pyx_v_out_stdout);
jpayne@69 11460 __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_a);
jpayne@69 11461 __Pyx_XDECREF(__pyx_v_collection);
jpayne@69 11462 __Pyx_XDECREF(__pyx_v_method);
jpayne@69 11463 __Pyx_XDECREF(__pyx_v_args);
jpayne@69 11464 __Pyx_XGIVEREF(__pyx_r);
jpayne@69 11465 __Pyx_RefNannyFinishContext();
jpayne@69 11466 return __pyx_r;
jpayne@69 11467 }
jpayne@69 11468
jpayne@69 11469 static PyMethodDef __pyx_methods[] = {
jpayne@69 11470 {0, 0, 0, 0}
jpayne@69 11471 };
jpayne@69 11472 #ifndef CYTHON_SMALL_CODE
jpayne@69 11473 #if defined(__clang__)
jpayne@69 11474 #define CYTHON_SMALL_CODE
jpayne@69 11475 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
jpayne@69 11476 #define CYTHON_SMALL_CODE __attribute__((cold))
jpayne@69 11477 #else
jpayne@69 11478 #define CYTHON_SMALL_CODE
jpayne@69 11479 #endif
jpayne@69 11480 #endif
jpayne@69 11481 /* #### Code section: pystring_table ### */
jpayne@69 11482
jpayne@69 11483 static int __Pyx_CreateStringTabAndInitStrings(void) {
jpayne@69 11484 __Pyx_StringTabEntry __pyx_string_tab[] = {
jpayne@69 11485 {&__pyx_kp_u_, __pyx_k_, sizeof(__pyx_k_), 0, 1, 0, 0},
jpayne@69 11486 {&__pyx_n_s_ARGUMENTS, __pyx_k_ARGUMENTS, sizeof(__pyx_k_ARGUMENTS), 0, 0, 1, 1},
jpayne@69 11487 {&__pyx_kp_u_Argument_must_be_string_bytes_or, __pyx_k_Argument_must_be_string_bytes_or, sizeof(__pyx_k_Argument_must_be_string_bytes_or), 0, 1, 0, 0},
jpayne@69 11488 {&__pyx_n_u_B, __pyx_k_B, sizeof(__pyx_k_B), 0, 1, 0, 1},
jpayne@69 11489 {&__pyx_n_s_IOError, __pyx_k_IOError, sizeof(__pyx_k_IOError), 0, 0, 1, 1},
jpayne@69 11490 {&__pyx_n_s_MAP_STDOUT_OPTIONS, __pyx_k_MAP_STDOUT_OPTIONS, sizeof(__pyx_k_MAP_STDOUT_OPTIONS), 0, 0, 1, 1},
jpayne@69 11491 {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
jpayne@69 11492 {&__pyx_kp_u_No_such_file_or_directory_s, __pyx_k_No_such_file_or_directory_s, sizeof(__pyx_k_No_such_file_or_directory_s), 0, 1, 0, 0},
jpayne@69 11493 {&__pyx_n_s_OSError, __pyx_k_OSError, sizeof(__pyx_k_OSError), 0, 0, 1, 1},
jpayne@69 11494 {&__pyx_n_s_OverflowError, __pyx_k_OverflowError, sizeof(__pyx_k_OverflowError), 0, 0, 1, 1},
jpayne@69 11495 {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
jpayne@69 11496 {&__pyx_n_s_UnicodeDecodeError, __pyx_k_UnicodeDecodeError, sizeof(__pyx_k_UnicodeDecodeError), 0, 0, 1, 1},
jpayne@69 11497 {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
jpayne@69 11498 {&__pyx_kp_u__10, __pyx_k__10, sizeof(__pyx_k__10), 0, 1, 0, 0},
jpayne@69 11499 {&__pyx_kp_u__11, __pyx_k__11, sizeof(__pyx_k__11), 0, 1, 0, 0},
jpayne@69 11500 {&__pyx_n_s__14, __pyx_k__14, sizeof(__pyx_k__14), 0, 0, 1, 1},
jpayne@69 11501 {&__pyx_kp_u__15, __pyx_k__15, sizeof(__pyx_k__15), 0, 1, 0, 0},
jpayne@69 11502 {&__pyx_n_s__33, __pyx_k__33, sizeof(__pyx_k__33), 0, 0, 1, 1},
jpayne@69 11503 {&__pyx_kp_u__7, __pyx_k__7, sizeof(__pyx_k__7), 0, 1, 0, 0},
jpayne@69 11504 {&__pyx_kp_u__8, __pyx_k__8, sizeof(__pyx_k__8), 0, 1, 0, 0},
jpayne@69 11505 {&__pyx_n_s_a, __pyx_k_a, sizeof(__pyx_k_a), 0, 0, 1, 1},
jpayne@69 11506 {&__pyx_n_s_all, __pyx_k_all, sizeof(__pyx_k_all), 0, 0, 1, 1},
jpayne@69 11507 {&__pyx_n_s_arg, __pyx_k_arg, sizeof(__pyx_k_arg), 0, 0, 1, 1},
jpayne@69 11508 {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1},
jpayne@69 11509 {&__pyx_n_s_array_to_qualitystring, __pyx_k_array_to_qualitystring, sizeof(__pyx_k_array_to_qualitystring), 0, 0, 1, 1},
jpayne@69 11510 {&__pyx_n_u_array_to_qualitystring, __pyx_k_array_to_qualitystring, sizeof(__pyx_k_array_to_qualitystring), 0, 1, 0, 1},
jpayne@69 11511 {&__pyx_n_u_ascii, __pyx_k_ascii, sizeof(__pyx_k_ascii), 0, 1, 0, 1},
jpayne@69 11512 {&__pyx_n_s_asyncio_coroutines, __pyx_k_asyncio_coroutines, sizeof(__pyx_k_asyncio_coroutines), 0, 0, 1, 1},
jpayne@69 11513 {&__pyx_n_b_bcftools, __pyx_k_bcftools, sizeof(__pyx_k_bcftools), 0, 0, 0, 1},
jpayne@69 11514 {&__pyx_n_u_bcftools, __pyx_k_bcftools, sizeof(__pyx_k_bcftools), 0, 1, 0, 1},
jpayne@69 11515 {&__pyx_kp_u_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 1, 0, 0},
jpayne@69 11516 {&__pyx_n_u_calmd, __pyx_k_calmd, sizeof(__pyx_k_calmd), 0, 1, 0, 1},
jpayne@69 11517 {&__pyx_n_s_cargs, __pyx_k_cargs, sizeof(__pyx_k_cargs), 0, 0, 1, 1},
jpayne@69 11518 {&__pyx_n_s_catch_stdout, __pyx_k_catch_stdout, sizeof(__pyx_k_catch_stdout), 0, 0, 1, 1},
jpayne@69 11519 {&__pyx_n_s_chr, __pyx_k_chr, sizeof(__pyx_k_chr), 0, 0, 1, 1},
jpayne@69 11520 {&__pyx_n_s_class_getitem, __pyx_k_class_getitem, sizeof(__pyx_k_class_getitem), 0, 0, 1, 1},
jpayne@69 11521 {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
jpayne@69 11522 {&__pyx_n_s_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1},
jpayne@69 11523 {&__pyx_n_s_codecs, __pyx_k_codecs, sizeof(__pyx_k_codecs), 0, 0, 1, 1},
jpayne@69 11524 {&__pyx_n_s_collect, __pyx_k_collect, sizeof(__pyx_k_collect), 0, 0, 1, 1},
jpayne@69 11525 {&__pyx_n_s_collection, __pyx_k_collection, sizeof(__pyx_k_collection), 0, 0, 1, 1},
jpayne@69 11526 {&__pyx_n_s_contextlib, __pyx_k_contextlib, sizeof(__pyx_k_contextlib), 0, 0, 1, 1},
jpayne@69 11527 {&__pyx_n_s_contextmanager, __pyx_k_contextmanager, sizeof(__pyx_k_contextmanager), 0, 0, 1, 1},
jpayne@69 11528 {&__pyx_n_s_contig, __pyx_k_contig, sizeof(__pyx_k_contig), 0, 0, 1, 1},
jpayne@69 11529 {&__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},
jpayne@69 11530 {&__pyx_kp_u_contig_reference_and_region_shou, __pyx_k_contig_reference_and_region_shou, sizeof(__pyx_k_contig_reference_and_region_shou), 0, 1, 0, 0},
jpayne@69 11531 {&__pyx_n_s_decode, __pyx_k_decode, sizeof(__pyx_k_decode), 0, 0, 1, 1},
jpayne@69 11532 {&__pyx_n_u_depad, __pyx_k_depad, sizeof(__pyx_k_depad), 0, 1, 0, 1},
jpayne@69 11533 {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1},
jpayne@69 11534 {&__pyx_n_s_end, __pyx_k_end, sizeof(__pyx_k_end), 0, 0, 1, 1},
jpayne@69 11535 {&__pyx_n_s_enter, __pyx_k_enter, sizeof(__pyx_k_enter), 0, 0, 1, 1},
jpayne@69 11536 {&__pyx_kp_u_error_while_opening_file_for_wri, __pyx_k_error_while_opening_file_for_wri, sizeof(__pyx_k_error_while_opening_file_for_wri), 0, 1, 0, 0},
jpayne@69 11537 {&__pyx_n_s_exception, __pyx_k_exception, sizeof(__pyx_k_exception), 0, 0, 1, 1},
jpayne@69 11538 {&__pyx_n_s_exists, __pyx_k_exists, sizeof(__pyx_k_exists), 0, 0, 1, 1},
jpayne@69 11539 {&__pyx_n_s_exit, __pyx_k_exit, sizeof(__pyx_k_exit), 0, 0, 1, 1},
jpayne@69 11540 {&__pyx_n_s_extend, __pyx_k_extend, sizeof(__pyx_k_extend), 0, 0, 1, 1},
jpayne@69 11541 {&__pyx_n_s_extra_args, __pyx_k_extra_args, sizeof(__pyx_k_extra_args), 0, 0, 1, 1},
jpayne@69 11542 {&__pyx_n_s_fn, __pyx_k_fn, sizeof(__pyx_k_fn), 0, 0, 1, 1},
jpayne@69 11543 {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1},
jpayne@69 11544 {&__pyx_n_s_fsencode, __pyx_k_fsencode, sizeof(__pyx_k_fsencode), 0, 0, 1, 1},
jpayne@69 11545 {&__pyx_n_s_get_encoding_error_handler, __pyx_k_get_encoding_error_handler, sizeof(__pyx_k_get_encoding_error_handler), 0, 0, 1, 1},
jpayne@69 11546 {&__pyx_n_u_get_encoding_error_handler, __pyx_k_get_encoding_error_handler, sizeof(__pyx_k_get_encoding_error_handler), 0, 1, 0, 1},
jpayne@69 11547 {&__pyx_n_s_getdefaultencoding, __pyx_k_getdefaultencoding, sizeof(__pyx_k_getdefaultencoding), 0, 0, 1, 1},
jpayne@69 11548 {&__pyx_n_s_getfilesystemencoding, __pyx_k_getfilesystemencoding, sizeof(__pyx_k_getfilesystemencoding), 0, 0, 1, 1},
jpayne@69 11549 {&__pyx_n_u_head, __pyx_k_head, sizeof(__pyx_k_head), 0, 1, 0, 1},
jpayne@69 11550 {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
jpayne@69 11551 {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
jpayne@69 11552 {&__pyx_n_b_index, __pyx_k_index, sizeof(__pyx_k_index), 0, 0, 0, 1},
jpayne@69 11553 {&__pyx_n_u_index, __pyx_k_index, sizeof(__pyx_k_index), 0, 1, 0, 1},
jpayne@69 11554 {&__pyx_n_s_inf, __pyx_k_inf, sizeof(__pyx_k_inf), 0, 0, 1, 1},
jpayne@69 11555 {&__pyx_n_s_initializing, __pyx_k_initializing, sizeof(__pyx_k_initializing), 0, 0, 1, 1},
jpayne@69 11556 {&__pyx_n_s_input_str, __pyx_k_input_str, sizeof(__pyx_k_input_str), 0, 0, 1, 1},
jpayne@69 11557 {&__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},
jpayne@69 11558 {&__pyx_n_s_io, __pyx_k_io, sizeof(__pyx_k_io), 0, 0, 1, 1},
jpayne@69 11559 {&__pyx_n_s_is_coroutine, __pyx_k_is_coroutine, sizeof(__pyx_k_is_coroutine), 0, 0, 1, 1},
jpayne@69 11560 {&__pyx_n_s_is_usage, __pyx_k_is_usage, sizeof(__pyx_k_is_usage), 0, 0, 1, 1},
jpayne@69 11561 {&__pyx_n_s_l, __pyx_k_l, sizeof(__pyx_k_l), 0, 0, 1, 1},
jpayne@69 11562 {&__pyx_n_s_latin1_replace, __pyx_k_latin1_replace, sizeof(__pyx_k_latin1_replace), 0, 0, 1, 1},
jpayne@69 11563 {&__pyx_kp_u_m, __pyx_k_m, sizeof(__pyx_k_m), 0, 1, 0, 0},
jpayne@69 11564 {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
jpayne@69 11565 {&__pyx_n_s_method, __pyx_k_method, sizeof(__pyx_k_method), 0, 0, 1, 1},
jpayne@69 11566 {&__pyx_kp_u_min_shift, __pyx_k_min_shift, sizeof(__pyx_k_min_shift), 0, 1, 0, 0},
jpayne@69 11567 {&__pyx_n_s_mkstemp, __pyx_k_mkstemp, sizeof(__pyx_k_mkstemp), 0, 0, 1, 1},
jpayne@69 11568 {&__pyx_n_u_mpileup, __pyx_k_mpileup, sizeof(__pyx_k_mpileup), 0, 1, 0, 1},
jpayne@69 11569 {&__pyx_n_s_n, __pyx_k_n, sizeof(__pyx_k_n), 0, 0, 1, 1},
jpayne@69 11570 {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
jpayne@69 11571 {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1},
jpayne@69 11572 {&__pyx_kp_u_neither_contig_nor_region_are_gi, __pyx_k_neither_contig_nor_region_are_gi, sizeof(__pyx_k_neither_contig_nor_region_are_gi), 0, 1, 0, 0},
jpayne@69 11573 {&__pyx_kp_u_o, __pyx_k_o, sizeof(__pyx_k_o), 0, 1, 0, 0},
jpayne@69 11574 {&__pyx_kp_u_o_2, __pyx_k_o_2, sizeof(__pyx_k_o_2), 0, 1, 0, 0},
jpayne@69 11575 {&__pyx_n_s_object, __pyx_k_object, sizeof(__pyx_k_object), 0, 0, 1, 1},
jpayne@69 11576 {&__pyx_n_s_offset, __pyx_k_offset, sizeof(__pyx_k_offset), 0, 0, 1, 1},
jpayne@69 11577 {&__pyx_n_s_open, __pyx_k_open, sizeof(__pyx_k_open), 0, 0, 1, 1},
jpayne@69 11578 {&__pyx_n_s_os, __pyx_k_os, sizeof(__pyx_k_os), 0, 0, 1, 1},
jpayne@69 11579 {&__pyx_n_s_out, __pyx_k_out, sizeof(__pyx_k_out), 0, 0, 1, 1},
jpayne@69 11580 {&__pyx_n_s_out_stderr, __pyx_k_out_stderr, sizeof(__pyx_k_out_stderr), 0, 0, 1, 1},
jpayne@69 11581 {&__pyx_n_s_out_stdout, __pyx_k_out_stdout, sizeof(__pyx_k_out_stdout), 0, 0, 1, 1},
jpayne@69 11582 {&__pyx_kp_u_output, __pyx_k_output, sizeof(__pyx_k_output), 0, 1, 0, 0},
jpayne@69 11583 {&__pyx_kp_u_output_file, __pyx_k_output_file, sizeof(__pyx_k_output_file), 0, 1, 0, 0},
jpayne@69 11584 {&__pyx_n_s_parse_region, __pyx_k_parse_region, sizeof(__pyx_k_parse_region), 0, 0, 1, 1},
jpayne@69 11585 {&__pyx_n_s_path, __pyx_k_path, sizeof(__pyx_k_path), 0, 0, 1, 1},
jpayne@69 11586 {&__pyx_n_s_pysam_dispatch, __pyx_k_pysam_dispatch, sizeof(__pyx_k_pysam_dispatch), 0, 0, 1, 1},
jpayne@69 11587 {&__pyx_n_s_pysam_dispatch_locals__collect, __pyx_k_pysam_dispatch_locals__collect, sizeof(__pyx_k_pysam_dispatch_locals__collect), 0, 0, 1, 1},
jpayne@69 11588 {&__pyx_kp_u_pysam_latin1replace, __pyx_k_pysam_latin1replace, sizeof(__pyx_k_pysam_latin1replace), 0, 1, 0, 0},
jpayne@69 11589 {&__pyx_n_s_pysam_libcutils, __pyx_k_pysam_libcutils, sizeof(__pyx_k_pysam_libcutils), 0, 0, 1, 1},
jpayne@69 11590 {&__pyx_kp_s_pysam_libcutils_pyx, __pyx_k_pysam_libcutils_pyx, sizeof(__pyx_k_pysam_libcutils_pyx), 0, 0, 1, 0},
jpayne@69 11591 {&__pyx_n_s_qualities, __pyx_k_qualities, sizeof(__pyx_k_qualities), 0, 0, 1, 1},
jpayne@69 11592 {&__pyx_n_s_qualities_to_qualitystring, __pyx_k_qualities_to_qualitystring, sizeof(__pyx_k_qualities_to_qualitystring), 0, 0, 1, 1},
jpayne@69 11593 {&__pyx_n_u_qualities_to_qualitystring, __pyx_k_qualities_to_qualitystring, sizeof(__pyx_k_qualities_to_qualitystring), 0, 1, 0, 1},
jpayne@69 11594 {&__pyx_n_s_qualitystring_to_array, __pyx_k_qualitystring_to_array, sizeof(__pyx_k_qualitystring_to_array), 0, 0, 1, 1},
jpayne@69 11595 {&__pyx_n_u_qualitystring_to_array, __pyx_k_qualitystring_to_array, sizeof(__pyx_k_qualitystring_to_array), 0, 1, 0, 1},
jpayne@69 11596 {&__pyx_n_u_r, __pyx_k_r, sizeof(__pyx_k_r), 0, 1, 0, 1},
jpayne@69 11597 {&__pyx_n_u_rb, __pyx_k_rb, sizeof(__pyx_k_rb), 0, 1, 0, 1},
jpayne@69 11598 {&__pyx_n_s_re, __pyx_k_re, sizeof(__pyx_k_re), 0, 0, 1, 1},
jpayne@69 11599 {&__pyx_n_s_read, __pyx_k_read, sizeof(__pyx_k_read), 0, 0, 1, 1},
jpayne@69 11600 {&__pyx_n_s_reference, __pyx_k_reference, sizeof(__pyx_k_reference), 0, 0, 1, 1},
jpayne@69 11601 {&__pyx_n_s_region, __pyx_k_region, sizeof(__pyx_k_region), 0, 0, 1, 1},
jpayne@69 11602 {&__pyx_n_s_register_error, __pyx_k_register_error, sizeof(__pyx_k_register_error), 0, 0, 1, 1},
jpayne@69 11603 {&__pyx_n_s_remove, __pyx_k_remove, sizeof(__pyx_k_remove), 0, 0, 1, 1},
jpayne@69 11604 {&__pyx_n_s_retval, __pyx_k_retval, sizeof(__pyx_k_retval), 0, 0, 1, 1},
jpayne@69 11605 {&__pyx_n_u_roh, __pyx_k_roh, sizeof(__pyx_k_roh), 0, 1, 0, 1},
jpayne@69 11606 {&__pyx_n_b_samtools, __pyx_k_samtools, sizeof(__pyx_k_samtools), 0, 0, 0, 1},
jpayne@69 11607 {&__pyx_n_u_samtools, __pyx_k_samtools, sizeof(__pyx_k_samtools), 0, 1, 0, 1},
jpayne@69 11608 {&__pyx_n_s_save_stdout, __pyx_k_save_stdout, sizeof(__pyx_k_save_stdout), 0, 0, 1, 1},
jpayne@69 11609 {&__pyx_n_s_set_encoding_error_handler, __pyx_k_set_encoding_error_handler, sizeof(__pyx_k_set_encoding_error_handler), 0, 0, 1, 1},
jpayne@69 11610 {&__pyx_n_u_set_encoding_error_handler, __pyx_k_set_encoding_error_handler, sizeof(__pyx_k_set_encoding_error_handler), 0, 1, 0, 1},
jpayne@69 11611 {&__pyx_n_s_skip_next, __pyx_k_skip_next, sizeof(__pyx_k_skip_next), 0, 0, 1, 1},
jpayne@69 11612 {&__pyx_n_s_spec, __pyx_k_spec, sizeof(__pyx_k_spec), 0, 0, 1, 1},
jpayne@69 11613 {&__pyx_n_s_split, __pyx_k_split, sizeof(__pyx_k_split), 0, 0, 1, 1},
jpayne@69 11614 {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1},
jpayne@69 11615 {&__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},
jpayne@69 11616 {&__pyx_n_s_startswith, __pyx_k_startswith, sizeof(__pyx_k_startswith), 0, 0, 1, 1},
jpayne@69 11617 {&__pyx_n_u_stats, __pyx_k_stats, sizeof(__pyx_k_stats), 0, 1, 0, 1},
jpayne@69 11618 {&__pyx_n_s_stderr_f, __pyx_k_stderr_f, sizeof(__pyx_k_stderr_f), 0, 0, 1, 1},
jpayne@69 11619 {&__pyx_n_s_stderr_h, __pyx_k_stderr_h, sizeof(__pyx_k_stderr_h), 0, 0, 1, 1},
jpayne@69 11620 {&__pyx_n_s_stdout_f, __pyx_k_stdout_f, sizeof(__pyx_k_stdout_f), 0, 0, 1, 1},
jpayne@69 11621 {&__pyx_n_s_stdout_h, __pyx_k_stdout_h, sizeof(__pyx_k_stdout_h), 0, 0, 1, 1},
jpayne@69 11622 {&__pyx_n_s_stdout_option, __pyx_k_stdout_option, sizeof(__pyx_k_stdout_option), 0, 0, 1, 1},
jpayne@69 11623 {&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1},
jpayne@69 11624 {&__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},
jpayne@69 11625 {&__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},
jpayne@69 11626 {&__pyx_n_u_strict, __pyx_k_strict, sizeof(__pyx_k_strict), 0, 1, 0, 1},
jpayne@69 11627 {&__pyx_n_s_string, __pyx_k_string, sizeof(__pyx_k_string), 0, 0, 1, 1},
jpayne@69 11628 {&__pyx_n_s_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 0, 0, 1, 1},
jpayne@69 11629 {&__pyx_n_s_tempfile, __pyx_k_tempfile, sizeof(__pyx_k_tempfile), 0, 0, 1, 1},
jpayne@69 11630 {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
jpayne@69 11631 {&__pyx_kp_u_threads, __pyx_k_threads, sizeof(__pyx_k_threads), 0, 1, 0, 0},
jpayne@69 11632 {&__pyx_n_s_tobytes, __pyx_k_tobytes, sizeof(__pyx_k_tobytes), 0, 0, 1, 1},
jpayne@69 11633 {&__pyx_n_s_types, __pyx_k_types, sizeof(__pyx_k_types), 0, 0, 1, 1},
jpayne@69 11634 {&__pyx_kp_u_utf_8, __pyx_k_utf_8, sizeof(__pyx_k_utf_8), 0, 1, 0, 0},
jpayne@69 11635 {&__pyx_n_u_view, __pyx_k_view, sizeof(__pyx_k_view), 0, 1, 0, 1},
jpayne@69 11636 {0, 0, 0, 0, 0, 0, 0}
jpayne@69 11637 };
jpayne@69 11638 return __Pyx_InitStrings(__pyx_string_tab);
jpayne@69 11639 }
jpayne@69 11640 /* #### Code section: cached_builtins ### */
jpayne@69 11641 static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
jpayne@69 11642 __pyx_builtin_chr = __Pyx_GetBuiltinName(__pyx_n_s_chr); if (!__pyx_builtin_chr) __PYX_ERR(0, 82, __pyx_L1_error)
jpayne@69 11643 __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 136, __pyx_L1_error)
jpayne@69 11644 __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 218, __pyx_L1_error)
jpayne@69 11645 __pyx_builtin_OverflowError = __Pyx_GetBuiltinName(__pyx_n_s_OverflowError); if (!__pyx_builtin_OverflowError) __PYX_ERR(0, 237, __pyx_L1_error)
jpayne@69 11646 __pyx_builtin_IOError = __Pyx_GetBuiltinName(__pyx_n_s_IOError); if (!__pyx_builtin_IOError) __PYX_ERR(0, 309, __pyx_L1_error)
jpayne@69 11647 __pyx_builtin_OSError = __Pyx_GetBuiltinName(__pyx_n_s_OSError); if (!__pyx_builtin_OSError) __PYX_ERR(0, 327, __pyx_L1_error)
jpayne@69 11648 __pyx_builtin_open = __Pyx_GetBuiltinName(__pyx_n_s_open); if (!__pyx_builtin_open) __PYX_ERR(0, 416, __pyx_L1_error)
jpayne@69 11649 __pyx_builtin_UnicodeDecodeError = __Pyx_GetBuiltinName(__pyx_n_s_UnicodeDecodeError); if (!__pyx_builtin_UnicodeDecodeError) __PYX_ERR(0, 418, __pyx_L1_error)
jpayne@69 11650 __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(2, 120, __pyx_L1_error)
jpayne@69 11651 return 0;
jpayne@69 11652 __pyx_L1_error:;
jpayne@69 11653 return -1;
jpayne@69 11654 }
jpayne@69 11655 /* #### Code section: cached_constants ### */
jpayne@69 11656
jpayne@69 11657 static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
jpayne@69 11658 __Pyx_RefNannyDeclarations
jpayne@69 11659 __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
jpayne@69 11660
jpayne@69 11661 /* "pysam/libcutils.pyx":136
jpayne@69 11662 * return s.encode(encoding or TEXT_ENCODING, errors or ERROR_HANDLER)
jpayne@69 11663 * else:
jpayne@69 11664 * raise TypeError("Argument must be string, bytes or unicode.") # <<<<<<<<<<<<<<
jpayne@69 11665 *
jpayne@69 11666 *
jpayne@69 11667 */
jpayne@69 11668 __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_Argument_must_be_string_bytes_or); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 136, __pyx_L1_error)
jpayne@69 11669 __Pyx_GOTREF(__pyx_tuple__2);
jpayne@69 11670 __Pyx_GIVEREF(__pyx_tuple__2);
jpayne@69 11671
jpayne@69 11672 /* "pysam/libcutils.pyx":218
jpayne@69 11673 * if reference is not None:
jpayne@69 11674 * if contig is not None:
jpayne@69 11675 * raise ValueError('contig and reference should not both be specified') # <<<<<<<<<<<<<<
jpayne@69 11676 * contig = reference
jpayne@69 11677 *
jpayne@69 11678 */
jpayne@69 11679 __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_u_contig_and_reference_should_not); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 218, __pyx_L1_error)
jpayne@69 11680 __Pyx_GOTREF(__pyx_tuple__3);
jpayne@69 11681 __Pyx_GIVEREF(__pyx_tuple__3);
jpayne@69 11682
jpayne@69 11683 /* "pysam/libcutils.pyx":222
jpayne@69 11684 *
jpayne@69 11685 * if contig is not None and region is not None:
jpayne@69 11686 * raise ValueError('contig/reference and region should not both be specified') # <<<<<<<<<<<<<<
jpayne@69 11687 *
jpayne@69 11688 * if end is not None:
jpayne@69 11689 */
jpayne@69 11690 __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_u_contig_reference_and_region_shou); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 222, __pyx_L1_error)
jpayne@69 11691 __Pyx_GOTREF(__pyx_tuple__4);
jpayne@69 11692 __Pyx_GIVEREF(__pyx_tuple__4);
jpayne@69 11693
jpayne@69 11694 /* "pysam/libcutils.pyx":226
jpayne@69 11695 * if end is not None:
jpayne@69 11696 * if stop is not None:
jpayne@69 11697 * raise ValueError('stop and end should not both be specified') # <<<<<<<<<<<<<<
jpayne@69 11698 * stop = end
jpayne@69 11699 *
jpayne@69 11700 */
jpayne@69 11701 __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_u_stop_and_end_should_not_both_be); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 226, __pyx_L1_error)
jpayne@69 11702 __Pyx_GOTREF(__pyx_tuple__5);
jpayne@69 11703 __Pyx_GIVEREF(__pyx_tuple__5);
jpayne@69 11704
jpayne@69 11705 /* "pysam/libcutils.pyx":230
jpayne@69 11706 *
jpayne@69 11707 * if contig is None and region is None:
jpayne@69 11708 * raise ValueError("neither contig nor region are given") # <<<<<<<<<<<<<<
jpayne@69 11709 *
jpayne@69 11710 * rstart = 0
jpayne@69 11711 */
jpayne@69 11712 __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_u_neither_contig_nor_region_are_gi); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 230, __pyx_L1_error)
jpayne@69 11713 __Pyx_GOTREF(__pyx_tuple__6);
jpayne@69 11714 __Pyx_GIVEREF(__pyx_tuple__6);
jpayne@69 11715
jpayne@69 11716 /* "pysam/libcutils.pyx":416
jpayne@69 11717 * out = []
jpayne@69 11718 * try:
jpayne@69 11719 * with open(fn, "r") as inf: # <<<<<<<<<<<<<<
jpayne@69 11720 * out = inf.read()
jpayne@69 11721 * except UnicodeDecodeError:
jpayne@69 11722 */
jpayne@69 11723 __pyx_tuple__9 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 416, __pyx_L1_error)
jpayne@69 11724 __Pyx_GOTREF(__pyx_tuple__9);
jpayne@69 11725 __Pyx_GIVEREF(__pyx_tuple__9);
jpayne@69 11726
jpayne@69 11727 /* "pysam/libcutils.pyx":413
jpayne@69 11728 *
jpayne@69 11729 * # get error messages
jpayne@69 11730 * def _collect(fn): # <<<<<<<<<<<<<<
jpayne@69 11731 * out = []
jpayne@69 11732 * try:
jpayne@69 11733 */
jpayne@69 11734 __pyx_tuple__12 = PyTuple_Pack(3, __pyx_n_s_fn, __pyx_n_s_out, __pyx_n_s_inf); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 413, __pyx_L1_error)
jpayne@69 11735 __Pyx_GOTREF(__pyx_tuple__12);
jpayne@69 11736 __Pyx_GIVEREF(__pyx_tuple__12);
jpayne@69 11737 __pyx_codeobj__13 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__12, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcutils_pyx, __pyx_n_s_collect, 413, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) __PYX_ERR(0, 413, __pyx_L1_error)
jpayne@69 11738
jpayne@69 11739 /* "pysam/libcutils.pyx":36
jpayne@69 11740 * #################################################################
jpayne@69 11741 * # Utility functions for quality string conversions
jpayne@69 11742 * cpdef c_array.array qualitystring_to_array(input_str, int offset=33): # <<<<<<<<<<<<<<
jpayne@69 11743 * """convert a qualitystring to an array of quality values."""
jpayne@69 11744 * if input_str is None:
jpayne@69 11745 */
jpayne@69 11746 __pyx_tuple__16 = PyTuple_Pack(2, __pyx_n_s_input_str, __pyx_n_s_offset); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 36, __pyx_L1_error)
jpayne@69 11747 __Pyx_GOTREF(__pyx_tuple__16);
jpayne@69 11748 __Pyx_GIVEREF(__pyx_tuple__16);
jpayne@69 11749 __pyx_codeobj__17 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__16, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcutils_pyx, __pyx_n_s_qualitystring_to_array, 36, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__17)) __PYX_ERR(0, 36, __pyx_L1_error)
jpayne@69 11750 __pyx_tuple__18 = PyTuple_Pack(1, __pyx_int_33); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 36, __pyx_L1_error)
jpayne@69 11751 __Pyx_GOTREF(__pyx_tuple__18);
jpayne@69 11752 __Pyx_GIVEREF(__pyx_tuple__18);
jpayne@69 11753
jpayne@69 11754 /* "pysam/libcutils.pyx":45
jpayne@69 11755 *
jpayne@69 11756 *
jpayne@69 11757 * cpdef array_to_qualitystring(c_array.array qualities, int offset=33): # <<<<<<<<<<<<<<
jpayne@69 11758 * """convert an array of quality values to a string."""
jpayne@69 11759 * if qualities is None:
jpayne@69 11760 */
jpayne@69 11761 __pyx_tuple__19 = PyTuple_Pack(2, __pyx_n_s_qualities, __pyx_n_s_offset); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 45, __pyx_L1_error)
jpayne@69 11762 __Pyx_GOTREF(__pyx_tuple__19);
jpayne@69 11763 __Pyx_GIVEREF(__pyx_tuple__19);
jpayne@69 11764 __pyx_codeobj__20 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcutils_pyx, __pyx_n_s_array_to_qualitystring, 45, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) __PYX_ERR(0, 45, __pyx_L1_error)
jpayne@69 11765
jpayne@69 11766 /* "pysam/libcutils.pyx":59
jpayne@69 11767 *
jpayne@69 11768 *
jpayne@69 11769 * cpdef qualities_to_qualitystring(qualities, int offset=33): # <<<<<<<<<<<<<<
jpayne@69 11770 * """convert a list or array of quality scores to the string
jpayne@69 11771 * representation used in the SAM format.
jpayne@69 11772 */
jpayne@69 11773 __pyx_codeobj__21 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcutils_pyx, __pyx_n_s_qualities_to_qualitystring, 59, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__21)) __PYX_ERR(0, 59, __pyx_L1_error)
jpayne@69 11774
jpayne@69 11775 /* "pysam/libcutils.pyx":90
jpayne@69 11776 *
jpayne@69 11777 * # Codec error handler that just interprets each bad byte as ISO-8859-1.
jpayne@69 11778 * def latin1_replace(exception): # <<<<<<<<<<<<<<
jpayne@69 11779 * return (chr(exception.object[exception.start]), exception.end)
jpayne@69 11780 *
jpayne@69 11781 */
jpayne@69 11782 __pyx_tuple__22 = PyTuple_Pack(1, __pyx_n_s_exception); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 90, __pyx_L1_error)
jpayne@69 11783 __Pyx_GOTREF(__pyx_tuple__22);
jpayne@69 11784 __Pyx_GIVEREF(__pyx_tuple__22);
jpayne@69 11785 __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__22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcutils_pyx, __pyx_n_s_latin1_replace, 90, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__23)) __PYX_ERR(0, 90, __pyx_L1_error)
jpayne@69 11786
jpayne@69 11787 /* "pysam/libcutils.pyx":98
jpayne@69 11788 * cdef str ERROR_HANDLER = 'strict'
jpayne@69 11789 *
jpayne@69 11790 * cpdef get_encoding_error_handler(): # <<<<<<<<<<<<<<
jpayne@69 11791 * return ERROR_HANDLER
jpayne@69 11792 *
jpayne@69 11793 */
jpayne@69 11794 __pyx_codeobj__24 = (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_libcutils_pyx, __pyx_n_s_get_encoding_error_handler, 98, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __PYX_ERR(0, 98, __pyx_L1_error)
jpayne@69 11795
jpayne@69 11796 /* "pysam/libcutils.pyx":101
jpayne@69 11797 * return ERROR_HANDLER
jpayne@69 11798 *
jpayne@69 11799 * cpdef set_encoding_error_handler(name): # <<<<<<<<<<<<<<
jpayne@69 11800 * global ERROR_HANDLER
jpayne@69 11801 * previous = ERROR_HANDLER
jpayne@69 11802 */
jpayne@69 11803 __pyx_tuple__25 = PyTuple_Pack(1, __pyx_n_s_name); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 101, __pyx_L1_error)
jpayne@69 11804 __Pyx_GOTREF(__pyx_tuple__25);
jpayne@69 11805 __Pyx_GIVEREF(__pyx_tuple__25);
jpayne@69 11806 __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__25, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcutils_pyx, __pyx_n_s_set_encoding_error_handler, 101, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __PYX_ERR(0, 101, __pyx_L1_error)
jpayne@69 11807
jpayne@69 11808 /* "pysam/libcutils.pyx":178
jpayne@69 11809 *
jpayne@69 11810 *
jpayne@69 11811 * cpdef parse_region(contig=None, # <<<<<<<<<<<<<<
jpayne@69 11812 * start=None,
jpayne@69 11813 * stop=None,
jpayne@69 11814 */
jpayne@69 11815 __pyx_tuple__27 = PyTuple_Pack(6, __pyx_n_s_contig, __pyx_n_s_start, __pyx_n_s_stop, __pyx_n_s_region, __pyx_n_s_reference, __pyx_n_s_end); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 178, __pyx_L1_error)
jpayne@69 11816 __Pyx_GOTREF(__pyx_tuple__27);
jpayne@69 11817 __Pyx_GIVEREF(__pyx_tuple__27);
jpayne@69 11818 __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(6, 0, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcutils_pyx, __pyx_n_s_parse_region, 178, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 178, __pyx_L1_error)
jpayne@69 11819 __pyx_tuple__29 = PyTuple_Pack(6, Py_None, Py_None, Py_None, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 178, __pyx_L1_error)
jpayne@69 11820 __Pyx_GOTREF(__pyx_tuple__29);
jpayne@69 11821 __Pyx_GIVEREF(__pyx_tuple__29);
jpayne@69 11822
jpayne@69 11823 /* "pysam/libcutils.pyx":276
jpayne@69 11824 *
jpayne@69 11825 *
jpayne@69 11826 * def _pysam_dispatch(collection, # <<<<<<<<<<<<<<
jpayne@69 11827 * method,
jpayne@69 11828 * args=None,
jpayne@69 11829 */
jpayne@69 11830 __pyx_tuple__30 = PyTuple_Pack(26, __pyx_n_s_collection, __pyx_n_s_method, __pyx_n_s_args, __pyx_n_s_catch_stdout, __pyx_n_s_is_usage, __pyx_n_s_save_stdout, __pyx_n_s_ARGUMENTS, __pyx_n_s_skip_next, __pyx_n_s_arg, __pyx_n_s_stderr_h, __pyx_n_s_stderr_f, __pyx_n_s_stdout_f, __pyx_n_s_stdout_h, __pyx_n_s_MAP_STDOUT_OPTIONS, __pyx_n_s_stdout_option, __pyx_n_s_cargs, __pyx_n_s_i, __pyx_n_s_n, __pyx_n_s_retval, __pyx_n_s_l, __pyx_n_s_extra_args, __pyx_n_s_collect, __pyx_n_s_collect, __pyx_n_s_out_stderr, __pyx_n_s_out_stdout, __pyx_n_s_a); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 276, __pyx_L1_error)
jpayne@69 11831 __Pyx_GOTREF(__pyx_tuple__30);
jpayne@69 11832 __Pyx_GIVEREF(__pyx_tuple__30);
jpayne@69 11833 __pyx_codeobj__31 = (PyObject*)__Pyx_PyCode_New(6, 0, 0, 26, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__30, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_pysam_libcutils_pyx, __pyx_n_s_pysam_dispatch, 276, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__31)) __PYX_ERR(0, 276, __pyx_L1_error)
jpayne@69 11834 __pyx_tuple__32 = PyTuple_Pack(4, Py_None, ((PyObject *)Py_True), ((PyObject *)Py_False), Py_None); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 276, __pyx_L1_error)
jpayne@69 11835 __Pyx_GOTREF(__pyx_tuple__32);
jpayne@69 11836 __Pyx_GIVEREF(__pyx_tuple__32);
jpayne@69 11837 __Pyx_RefNannyFinishContext();
jpayne@69 11838 return 0;
jpayne@69 11839 __pyx_L1_error:;
jpayne@69 11840 __Pyx_RefNannyFinishContext();
jpayne@69 11841 return -1;
jpayne@69 11842 }
jpayne@69 11843 /* #### Code section: init_constants ### */
jpayne@69 11844
jpayne@69 11845 static CYTHON_SMALL_CODE int __Pyx_InitConstants(void) {
jpayne@69 11846 if (__Pyx_CreateStringTabAndInitStrings() < 0) __PYX_ERR(0, 1, __pyx_L1_error);
jpayne@69 11847 __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@69 11848 __pyx_int_33 = PyInt_FromLong(33); if (unlikely(!__pyx_int_33)) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@69 11849 __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@69 11850 return 0;
jpayne@69 11851 __pyx_L1_error:;
jpayne@69 11852 return -1;
jpayne@69 11853 }
jpayne@69 11854 /* #### Code section: init_globals ### */
jpayne@69 11855
jpayne@69 11856 static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
jpayne@69 11857 return 0;
jpayne@69 11858 }
jpayne@69 11859 /* #### Code section: init_module ### */
jpayne@69 11860
jpayne@69 11861 static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
jpayne@69 11862 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
jpayne@69 11863 static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
jpayne@69 11864 static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
jpayne@69 11865 static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
jpayne@69 11866 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
jpayne@69 11867 static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
jpayne@69 11868
jpayne@69 11869 static int __Pyx_modinit_global_init_code(void) {
jpayne@69 11870 __Pyx_RefNannyDeclarations
jpayne@69 11871 __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
jpayne@69 11872 /*--- Global init code ---*/
jpayne@69 11873 __pyx_v_5pysam_9libcutils_ERROR_HANDLER = ((PyObject*)Py_None); Py_INCREF(Py_None);
jpayne@69 11874 __pyx_v_5pysam_9libcutils_FILENAME_ENCODING = ((PyObject*)Py_None); Py_INCREF(Py_None);
jpayne@69 11875 __pyx_v_5pysam_9libcutils_TEXT_ENCODING = ((PyObject*)Py_None); Py_INCREF(Py_None);
jpayne@69 11876 __Pyx_RefNannyFinishContext();
jpayne@69 11877 return 0;
jpayne@69 11878 }
jpayne@69 11879
jpayne@69 11880 static int __Pyx_modinit_variable_export_code(void) {
jpayne@69 11881 __Pyx_RefNannyDeclarations
jpayne@69 11882 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
jpayne@69 11883 /*--- Variable export code ---*/
jpayne@69 11884 __Pyx_RefNannyFinishContext();
jpayne@69 11885 return 0;
jpayne@69 11886 }
jpayne@69 11887
jpayne@69 11888 static int __Pyx_modinit_function_export_code(void) {
jpayne@69 11889 __Pyx_RefNannyDeclarations
jpayne@69 11890 int __pyx_lineno = 0;
jpayne@69 11891 const char *__pyx_filename = NULL;
jpayne@69 11892 int __pyx_clineno = 0;
jpayne@69 11893 __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
jpayne@69 11894 /*--- Function export code ---*/
jpayne@69 11895 if (__Pyx_ExportFunction("parse_region", (void (*)(void))__pyx_f_5pysam_9libcutils_parse_region, "PyObject *(int __pyx_skip_dispatch, struct __pyx_opt_args_5pysam_9libcutils_parse_region *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@69 11896 if (__Pyx_ExportFunction("libc_whence_from_io", (void (*)(void))__pyx_f_5pysam_9libcutils_libc_whence_from_io, "int (int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@69 11897 if (__Pyx_ExportFunction("qualitystring_to_array", (void (*)(void))__pyx_f_5pysam_9libcutils_qualitystring_to_array, "arrayobject *(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_5pysam_9libcutils_qualitystring_to_array *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@69 11898 if (__Pyx_ExportFunction("array_to_qualitystring", (void (*)(void))__pyx_f_5pysam_9libcutils_array_to_qualitystring, "PyObject *(arrayobject *, int __pyx_skip_dispatch, struct __pyx_opt_args_5pysam_9libcutils_array_to_qualitystring *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@69 11899 if (__Pyx_ExportFunction("qualities_to_qualitystring", (void (*)(void))__pyx_f_5pysam_9libcutils_qualities_to_qualitystring, "PyObject *(PyObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_5pysam_9libcutils_qualities_to_qualitystring *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@69 11900 if (__Pyx_ExportFunction("get_encoding_error_handler", (void (*)(void))__pyx_f_5pysam_9libcutils_get_encoding_error_handler, "PyObject *(int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@69 11901 if (__Pyx_ExportFunction("set_encoding_error_handler", (void (*)(void))__pyx_f_5pysam_9libcutils_set_encoding_error_handler, "PyObject *(PyObject *, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@69 11902 if (__Pyx_ExportFunction("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)
jpayne@69 11903 if (__Pyx_ExportFunction("charptr_to_bytes", (void (*)(void))__pyx_f_5pysam_9libcutils_charptr_to_bytes, "PyObject *(char const *, struct __pyx_opt_args_5pysam_9libcutils_charptr_to_bytes *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@69 11904 if (__Pyx_ExportFunction("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)
jpayne@69 11905 if (__Pyx_ExportFunction("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)
jpayne@69 11906 if (__Pyx_ExportFunction("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)
jpayne@69 11907 if (__Pyx_ExportFunction("decode_bytes", (void (*)(void))__pyx_f_5pysam_9libcutils_decode_bytes, "PyObject *(PyObject *, struct __pyx_opt_args_5pysam_9libcutils_decode_bytes *__pyx_optional_args)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@69 11908 if (__Pyx_ExportFunction("encode_filename", (void (*)(void))__pyx_f_5pysam_9libcutils_encode_filename, "PyObject *(PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@69 11909 if (__Pyx_ExportFunction("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)
jpayne@69 11910 __Pyx_RefNannyFinishContext();
jpayne@69 11911 return 0;
jpayne@69 11912 __pyx_L1_error:;
jpayne@69 11913 __Pyx_RefNannyFinishContext();
jpayne@69 11914 return -1;
jpayne@69 11915 }
jpayne@69 11916
jpayne@69 11917 static int __Pyx_modinit_type_init_code(void) {
jpayne@69 11918 __Pyx_RefNannyDeclarations
jpayne@69 11919 __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
jpayne@69 11920 /*--- Type init code ---*/
jpayne@69 11921 __Pyx_RefNannyFinishContext();
jpayne@69 11922 return 0;
jpayne@69 11923 }
jpayne@69 11924
jpayne@69 11925 static int __Pyx_modinit_type_import_code(void) {
jpayne@69 11926 __Pyx_RefNannyDeclarations
jpayne@69 11927 PyObject *__pyx_t_1 = NULL;
jpayne@69 11928 int __pyx_lineno = 0;
jpayne@69 11929 const char *__pyx_filename = NULL;
jpayne@69 11930 int __pyx_clineno = 0;
jpayne@69 11931 __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
jpayne@69 11932 /*--- Type import code ---*/
jpayne@69 11933 __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 9, __pyx_L1_error)
jpayne@69 11934 __Pyx_GOTREF(__pyx_t_1);
jpayne@69 11935 __pyx_ptype_7cpython_4type_type = __Pyx_ImportType_3_0_11(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type",
jpayne@69 11936 #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
jpayne@69 11937 sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(PyTypeObject),
jpayne@69 11938 #elif CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 11939 sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(PyTypeObject),
jpayne@69 11940 #else
jpayne@69 11941 sizeof(PyHeapTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(PyHeapTypeObject),
jpayne@69 11942 #endif
jpayne@69 11943 __Pyx_ImportType_CheckSize_Warn_3_0_11); if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(3, 9, __pyx_L1_error)
jpayne@69 11944 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
jpayne@69 11945 __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8, __pyx_L1_error)
jpayne@69 11946 __Pyx_GOTREF(__pyx_t_1);
jpayne@69 11947 __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(4, 8, __pyx_L1_error)
jpayne@69 11948 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
jpayne@69 11949 __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 15, __pyx_L1_error)
jpayne@69 11950 __Pyx_GOTREF(__pyx_t_1);
jpayne@69 11951 __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(5, 15, __pyx_L1_error)
jpayne@69 11952 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
jpayne@69 11953 __pyx_t_1 = PyImport_ImportModule("array"); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 69, __pyx_L1_error)
jpayne@69 11954 __Pyx_GOTREF(__pyx_t_1);
jpayne@69 11955 __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(2, 69, __pyx_L1_error)
jpayne@69 11956 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
jpayne@69 11957 __Pyx_RefNannyFinishContext();
jpayne@69 11958 return 0;
jpayne@69 11959 __pyx_L1_error:;
jpayne@69 11960 __Pyx_XDECREF(__pyx_t_1);
jpayne@69 11961 __Pyx_RefNannyFinishContext();
jpayne@69 11962 return -1;
jpayne@69 11963 }
jpayne@69 11964
jpayne@69 11965 static int __Pyx_modinit_variable_import_code(void) {
jpayne@69 11966 __Pyx_RefNannyDeclarations
jpayne@69 11967 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
jpayne@69 11968 /*--- Variable import code ---*/
jpayne@69 11969 __Pyx_RefNannyFinishContext();
jpayne@69 11970 return 0;
jpayne@69 11971 }
jpayne@69 11972
jpayne@69 11973 static int __Pyx_modinit_function_import_code(void) {
jpayne@69 11974 __Pyx_RefNannyDeclarations
jpayne@69 11975 __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
jpayne@69 11976 /*--- Function import code ---*/
jpayne@69 11977 __Pyx_RefNannyFinishContext();
jpayne@69 11978 return 0;
jpayne@69 11979 }
jpayne@69 11980
jpayne@69 11981
jpayne@69 11982 #if PY_MAJOR_VERSION >= 3
jpayne@69 11983 #if CYTHON_PEP489_MULTI_PHASE_INIT
jpayne@69 11984 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
jpayne@69 11985 static int __pyx_pymod_exec_libcutils(PyObject* module); /*proto*/
jpayne@69 11986 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
jpayne@69 11987 {Py_mod_create, (void*)__pyx_pymod_create},
jpayne@69 11988 {Py_mod_exec, (void*)__pyx_pymod_exec_libcutils},
jpayne@69 11989 {0, NULL}
jpayne@69 11990 };
jpayne@69 11991 #endif
jpayne@69 11992
jpayne@69 11993 #ifdef __cplusplus
jpayne@69 11994 namespace {
jpayne@69 11995 struct PyModuleDef __pyx_moduledef =
jpayne@69 11996 #else
jpayne@69 11997 static struct PyModuleDef __pyx_moduledef =
jpayne@69 11998 #endif
jpayne@69 11999 {
jpayne@69 12000 PyModuleDef_HEAD_INIT,
jpayne@69 12001 "libcutils",
jpayne@69 12002 0, /* m_doc */
jpayne@69 12003 #if CYTHON_PEP489_MULTI_PHASE_INIT
jpayne@69 12004 0, /* m_size */
jpayne@69 12005 #elif CYTHON_USE_MODULE_STATE
jpayne@69 12006 sizeof(__pyx_mstate), /* m_size */
jpayne@69 12007 #else
jpayne@69 12008 -1, /* m_size */
jpayne@69 12009 #endif
jpayne@69 12010 __pyx_methods /* m_methods */,
jpayne@69 12011 #if CYTHON_PEP489_MULTI_PHASE_INIT
jpayne@69 12012 __pyx_moduledef_slots, /* m_slots */
jpayne@69 12013 #else
jpayne@69 12014 NULL, /* m_reload */
jpayne@69 12015 #endif
jpayne@69 12016 #if CYTHON_USE_MODULE_STATE
jpayne@69 12017 __pyx_m_traverse, /* m_traverse */
jpayne@69 12018 __pyx_m_clear, /* m_clear */
jpayne@69 12019 NULL /* m_free */
jpayne@69 12020 #else
jpayne@69 12021 NULL, /* m_traverse */
jpayne@69 12022 NULL, /* m_clear */
jpayne@69 12023 NULL /* m_free */
jpayne@69 12024 #endif
jpayne@69 12025 };
jpayne@69 12026 #ifdef __cplusplus
jpayne@69 12027 } /* anonymous namespace */
jpayne@69 12028 #endif
jpayne@69 12029 #endif
jpayne@69 12030
jpayne@69 12031 #ifndef CYTHON_NO_PYINIT_EXPORT
jpayne@69 12032 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
jpayne@69 12033 #elif PY_MAJOR_VERSION < 3
jpayne@69 12034 #ifdef __cplusplus
jpayne@69 12035 #define __Pyx_PyMODINIT_FUNC extern "C" void
jpayne@69 12036 #else
jpayne@69 12037 #define __Pyx_PyMODINIT_FUNC void
jpayne@69 12038 #endif
jpayne@69 12039 #else
jpayne@69 12040 #ifdef __cplusplus
jpayne@69 12041 #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
jpayne@69 12042 #else
jpayne@69 12043 #define __Pyx_PyMODINIT_FUNC PyObject *
jpayne@69 12044 #endif
jpayne@69 12045 #endif
jpayne@69 12046
jpayne@69 12047
jpayne@69 12048 #if PY_MAJOR_VERSION < 3
jpayne@69 12049 __Pyx_PyMODINIT_FUNC initlibcutils(void) CYTHON_SMALL_CODE; /*proto*/
jpayne@69 12050 __Pyx_PyMODINIT_FUNC initlibcutils(void)
jpayne@69 12051 #else
jpayne@69 12052 __Pyx_PyMODINIT_FUNC PyInit_libcutils(void) CYTHON_SMALL_CODE; /*proto*/
jpayne@69 12053 __Pyx_PyMODINIT_FUNC PyInit_libcutils(void)
jpayne@69 12054 #if CYTHON_PEP489_MULTI_PHASE_INIT
jpayne@69 12055 {
jpayne@69 12056 return PyModuleDef_Init(&__pyx_moduledef);
jpayne@69 12057 }
jpayne@69 12058 static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
jpayne@69 12059 #if PY_VERSION_HEX >= 0x030700A1
jpayne@69 12060 static PY_INT64_T main_interpreter_id = -1;
jpayne@69 12061 PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
jpayne@69 12062 if (main_interpreter_id == -1) {
jpayne@69 12063 main_interpreter_id = current_id;
jpayne@69 12064 return (unlikely(current_id == -1)) ? -1 : 0;
jpayne@69 12065 } else if (unlikely(main_interpreter_id != current_id))
jpayne@69 12066 #else
jpayne@69 12067 static PyInterpreterState *main_interpreter = NULL;
jpayne@69 12068 PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
jpayne@69 12069 if (!main_interpreter) {
jpayne@69 12070 main_interpreter = current_interpreter;
jpayne@69 12071 } else if (unlikely(main_interpreter != current_interpreter))
jpayne@69 12072 #endif
jpayne@69 12073 {
jpayne@69 12074 PyErr_SetString(
jpayne@69 12075 PyExc_ImportError,
jpayne@69 12076 "Interpreter change detected - this module can only be loaded into one interpreter per process.");
jpayne@69 12077 return -1;
jpayne@69 12078 }
jpayne@69 12079 return 0;
jpayne@69 12080 }
jpayne@69 12081 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 12082 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)
jpayne@69 12083 #else
jpayne@69 12084 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)
jpayne@69 12085 #endif
jpayne@69 12086 {
jpayne@69 12087 PyObject *value = PyObject_GetAttrString(spec, from_name);
jpayne@69 12088 int result = 0;
jpayne@69 12089 if (likely(value)) {
jpayne@69 12090 if (allow_none || value != Py_None) {
jpayne@69 12091 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 12092 result = PyModule_AddObject(module, to_name, value);
jpayne@69 12093 #else
jpayne@69 12094 result = PyDict_SetItemString(moddict, to_name, value);
jpayne@69 12095 #endif
jpayne@69 12096 }
jpayne@69 12097 Py_DECREF(value);
jpayne@69 12098 } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
jpayne@69 12099 PyErr_Clear();
jpayne@69 12100 } else {
jpayne@69 12101 result = -1;
jpayne@69 12102 }
jpayne@69 12103 return result;
jpayne@69 12104 }
jpayne@69 12105 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def) {
jpayne@69 12106 PyObject *module = NULL, *moddict, *modname;
jpayne@69 12107 CYTHON_UNUSED_VAR(def);
jpayne@69 12108 if (__Pyx_check_single_interpreter())
jpayne@69 12109 return NULL;
jpayne@69 12110 if (__pyx_m)
jpayne@69 12111 return __Pyx_NewRef(__pyx_m);
jpayne@69 12112 modname = PyObject_GetAttrString(spec, "name");
jpayne@69 12113 if (unlikely(!modname)) goto bad;
jpayne@69 12114 module = PyModule_NewObject(modname);
jpayne@69 12115 Py_DECREF(modname);
jpayne@69 12116 if (unlikely(!module)) goto bad;
jpayne@69 12117 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 12118 moddict = module;
jpayne@69 12119 #else
jpayne@69 12120 moddict = PyModule_GetDict(module);
jpayne@69 12121 if (unlikely(!moddict)) goto bad;
jpayne@69 12122 #endif
jpayne@69 12123 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
jpayne@69 12124 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
jpayne@69 12125 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
jpayne@69 12126 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
jpayne@69 12127 return module;
jpayne@69 12128 bad:
jpayne@69 12129 Py_XDECREF(module);
jpayne@69 12130 return NULL;
jpayne@69 12131 }
jpayne@69 12132
jpayne@69 12133
jpayne@69 12134 static CYTHON_SMALL_CODE int __pyx_pymod_exec_libcutils(PyObject *__pyx_pyinit_module)
jpayne@69 12135 #endif
jpayne@69 12136 #endif
jpayne@69 12137 {
jpayne@69 12138 int stringtab_initialized = 0;
jpayne@69 12139 #if CYTHON_USE_MODULE_STATE
jpayne@69 12140 int pystate_addmodule_run = 0;
jpayne@69 12141 #endif
jpayne@69 12142 PyObject *__pyx_t_1 = NULL;
jpayne@69 12143 PyObject *__pyx_t_2 = NULL;
jpayne@69 12144 PyObject *__pyx_t_3 = NULL;
jpayne@69 12145 PyObject *__pyx_t_4 = NULL;
jpayne@69 12146 int __pyx_t_5;
jpayne@69 12147 int __pyx_lineno = 0;
jpayne@69 12148 const char *__pyx_filename = NULL;
jpayne@69 12149 int __pyx_clineno = 0;
jpayne@69 12150 __Pyx_RefNannyDeclarations
jpayne@69 12151 #if CYTHON_PEP489_MULTI_PHASE_INIT
jpayne@69 12152 if (__pyx_m) {
jpayne@69 12153 if (__pyx_m == __pyx_pyinit_module) return 0;
jpayne@69 12154 PyErr_SetString(PyExc_RuntimeError, "Module 'libcutils' has already been imported. Re-initialisation is not supported.");
jpayne@69 12155 return -1;
jpayne@69 12156 }
jpayne@69 12157 #elif PY_MAJOR_VERSION >= 3
jpayne@69 12158 if (__pyx_m) return __Pyx_NewRef(__pyx_m);
jpayne@69 12159 #endif
jpayne@69 12160 /*--- Module creation code ---*/
jpayne@69 12161 #if CYTHON_PEP489_MULTI_PHASE_INIT
jpayne@69 12162 __pyx_m = __pyx_pyinit_module;
jpayne@69 12163 Py_INCREF(__pyx_m);
jpayne@69 12164 #else
jpayne@69 12165 #if PY_MAJOR_VERSION < 3
jpayne@69 12166 __pyx_m = Py_InitModule4("libcutils", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
jpayne@69 12167 if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@69 12168 #elif CYTHON_USE_MODULE_STATE
jpayne@69 12169 __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@69 12170 {
jpayne@69 12171 int add_module_result = PyState_AddModule(__pyx_t_1, &__pyx_moduledef);
jpayne@69 12172 __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to "libcutils" pseudovariable */
jpayne@69 12173 if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@69 12174 pystate_addmodule_run = 1;
jpayne@69 12175 }
jpayne@69 12176 #else
jpayne@69 12177 __pyx_m = PyModule_Create(&__pyx_moduledef);
jpayne@69 12178 if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@69 12179 #endif
jpayne@69 12180 #endif
jpayne@69 12181 CYTHON_UNUSED_VAR(__pyx_t_1);
jpayne@69 12182 __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@69 12183 Py_INCREF(__pyx_d);
jpayne@69 12184 __pyx_b = __Pyx_PyImport_AddModuleRef(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@69 12185 __pyx_cython_runtime = __Pyx_PyImport_AddModuleRef((const char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@69 12186 if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@69 12187 #if CYTHON_REFNANNY
jpayne@69 12188 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
jpayne@69 12189 if (!__Pyx_RefNanny) {
jpayne@69 12190 PyErr_Clear();
jpayne@69 12191 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
jpayne@69 12192 if (!__Pyx_RefNanny)
jpayne@69 12193 Py_FatalError("failed to import 'refnanny' module");
jpayne@69 12194 }
jpayne@69 12195 #endif
jpayne@69 12196 __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_libcutils(void)", 0);
jpayne@69 12197 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)
jpayne@69 12198 #ifdef __Pxy_PyFrame_Initialize_Offsets
jpayne@69 12199 __Pxy_PyFrame_Initialize_Offsets();
jpayne@69 12200 #endif
jpayne@69 12201 __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@69 12202 __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@69 12203 __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@69 12204 #ifdef __Pyx_CyFunction_USED
jpayne@69 12205 if (__pyx_CyFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@69 12206 #endif
jpayne@69 12207 #ifdef __Pyx_FusedFunction_USED
jpayne@69 12208 if (__pyx_FusedFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@69 12209 #endif
jpayne@69 12210 #ifdef __Pyx_Coroutine_USED
jpayne@69 12211 if (__pyx_Coroutine_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@69 12212 #endif
jpayne@69 12213 #ifdef __Pyx_Generator_USED
jpayne@69 12214 if (__pyx_Generator_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@69 12215 #endif
jpayne@69 12216 #ifdef __Pyx_AsyncGen_USED
jpayne@69 12217 if (__pyx_AsyncGen_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@69 12218 #endif
jpayne@69 12219 #ifdef __Pyx_StopAsyncIteration_USED
jpayne@69 12220 if (__pyx_StopAsyncIteration_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@69 12221 #endif
jpayne@69 12222 /*--- Library function declarations ---*/
jpayne@69 12223 /*--- Threads initialization code ---*/
jpayne@69 12224 #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
jpayne@69 12225 PyEval_InitThreads();
jpayne@69 12226 #endif
jpayne@69 12227 /*--- Initialize various global constants etc. ---*/
jpayne@69 12228 if (__Pyx_InitConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@69 12229 stringtab_initialized = 1;
jpayne@69 12230 if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@69 12231 #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
jpayne@69 12232 if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@69 12233 #endif
jpayne@69 12234 if (__pyx_module_is_main_pysam__libcutils) {
jpayne@69 12235 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@69 12236 }
jpayne@69 12237 #if PY_MAJOR_VERSION >= 3
jpayne@69 12238 {
jpayne@69 12239 PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@69 12240 if (!PyDict_GetItemString(modules, "pysam.libcutils")) {
jpayne@69 12241 if (unlikely((PyDict_SetItemString(modules, "pysam.libcutils", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@69 12242 }
jpayne@69 12243 }
jpayne@69 12244 #endif
jpayne@69 12245 /*--- Builtin init code ---*/
jpayne@69 12246 if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@69 12247 /*--- Constants init code ---*/
jpayne@69 12248 if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@69 12249 /*--- Global type/function init code ---*/
jpayne@69 12250 (void)__Pyx_modinit_global_init_code();
jpayne@69 12251 (void)__Pyx_modinit_variable_export_code();
jpayne@69 12252 if (unlikely((__Pyx_modinit_function_export_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@69 12253 (void)__Pyx_modinit_type_init_code();
jpayne@69 12254 if (unlikely((__Pyx_modinit_type_import_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@69 12255 (void)__Pyx_modinit_variable_import_code();
jpayne@69 12256 (void)__Pyx_modinit_function_import_code();
jpayne@69 12257 /*--- Execution code ---*/
jpayne@69 12258 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
jpayne@69 12259 if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@69 12260 #endif
jpayne@69 12261
jpayne@69 12262 /* "pysam/libcutils.pyx":2
jpayne@69 12263 * # cython: language_level=3
jpayne@69 12264 * import types # <<<<<<<<<<<<<<
jpayne@69 12265 * import sys
jpayne@69 12266 * import string
jpayne@69 12267 */
jpayne@69 12268 __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_n_s_types, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2, __pyx_L1_error)
jpayne@69 12269 __Pyx_GOTREF(__pyx_t_2);
jpayne@69 12270 if (PyDict_SetItem(__pyx_d, __pyx_n_s_types, __pyx_t_2) < 0) __PYX_ERR(0, 2, __pyx_L1_error)
jpayne@69 12271 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@69 12272
jpayne@69 12273 /* "pysam/libcutils.pyx":3
jpayne@69 12274 * # cython: language_level=3
jpayne@69 12275 * import types
jpayne@69 12276 * import sys # <<<<<<<<<<<<<<
jpayne@69 12277 * import string
jpayne@69 12278 * import re
jpayne@69 12279 */
jpayne@69 12280 __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_n_s_sys, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3, __pyx_L1_error)
jpayne@69 12281 __Pyx_GOTREF(__pyx_t_2);
jpayne@69 12282 if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys, __pyx_t_2) < 0) __PYX_ERR(0, 3, __pyx_L1_error)
jpayne@69 12283 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@69 12284
jpayne@69 12285 /* "pysam/libcutils.pyx":4
jpayne@69 12286 * import types
jpayne@69 12287 * import sys
jpayne@69 12288 * import string # <<<<<<<<<<<<<<
jpayne@69 12289 * import re
jpayne@69 12290 * import tempfile
jpayne@69 12291 */
jpayne@69 12292 __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_n_s_string, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4, __pyx_L1_error)
jpayne@69 12293 __Pyx_GOTREF(__pyx_t_2);
jpayne@69 12294 if (PyDict_SetItem(__pyx_d, __pyx_n_s_string, __pyx_t_2) < 0) __PYX_ERR(0, 4, __pyx_L1_error)
jpayne@69 12295 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@69 12296
jpayne@69 12297 /* "pysam/libcutils.pyx":5
jpayne@69 12298 * import sys
jpayne@69 12299 * import string
jpayne@69 12300 * import re # <<<<<<<<<<<<<<
jpayne@69 12301 * import tempfile
jpayne@69 12302 * import os
jpayne@69 12303 */
jpayne@69 12304 __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_n_s_re, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5, __pyx_L1_error)
jpayne@69 12305 __Pyx_GOTREF(__pyx_t_2);
jpayne@69 12306 if (PyDict_SetItem(__pyx_d, __pyx_n_s_re, __pyx_t_2) < 0) __PYX_ERR(0, 5, __pyx_L1_error)
jpayne@69 12307 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@69 12308
jpayne@69 12309 /* "pysam/libcutils.pyx":6
jpayne@69 12310 * import string
jpayne@69 12311 * import re
jpayne@69 12312 * import tempfile # <<<<<<<<<<<<<<
jpayne@69 12313 * import os
jpayne@69 12314 * import io
jpayne@69 12315 */
jpayne@69 12316 __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_n_s_tempfile, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 6, __pyx_L1_error)
jpayne@69 12317 __Pyx_GOTREF(__pyx_t_2);
jpayne@69 12318 if (PyDict_SetItem(__pyx_d, __pyx_n_s_tempfile, __pyx_t_2) < 0) __PYX_ERR(0, 6, __pyx_L1_error)
jpayne@69 12319 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@69 12320
jpayne@69 12321 /* "pysam/libcutils.pyx":7
jpayne@69 12322 * import re
jpayne@69 12323 * import tempfile
jpayne@69 12324 * import os # <<<<<<<<<<<<<<
jpayne@69 12325 * import io
jpayne@69 12326 * from contextlib import contextmanager
jpayne@69 12327 */
jpayne@69 12328 __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_n_s_os, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 7, __pyx_L1_error)
jpayne@69 12329 __Pyx_GOTREF(__pyx_t_2);
jpayne@69 12330 if (PyDict_SetItem(__pyx_d, __pyx_n_s_os, __pyx_t_2) < 0) __PYX_ERR(0, 7, __pyx_L1_error)
jpayne@69 12331 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@69 12332
jpayne@69 12333 /* "pysam/libcutils.pyx":8
jpayne@69 12334 * import tempfile
jpayne@69 12335 * import os
jpayne@69 12336 * import io # <<<<<<<<<<<<<<
jpayne@69 12337 * from contextlib import contextmanager
jpayne@69 12338 * from codecs import register_error
jpayne@69 12339 */
jpayne@69 12340 __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_n_s_io, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 8, __pyx_L1_error)
jpayne@69 12341 __Pyx_GOTREF(__pyx_t_2);
jpayne@69 12342 if (PyDict_SetItem(__pyx_d, __pyx_n_s_io, __pyx_t_2) < 0) __PYX_ERR(0, 8, __pyx_L1_error)
jpayne@69 12343 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@69 12344
jpayne@69 12345 /* "pysam/libcutils.pyx":9
jpayne@69 12346 * import os
jpayne@69 12347 * import io
jpayne@69 12348 * from contextlib import contextmanager # <<<<<<<<<<<<<<
jpayne@69 12349 * from codecs import register_error
jpayne@69 12350 *
jpayne@69 12351 */
jpayne@69 12352 __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 9, __pyx_L1_error)
jpayne@69 12353 __Pyx_GOTREF(__pyx_t_2);
jpayne@69 12354 __Pyx_INCREF(__pyx_n_s_contextmanager);
jpayne@69 12355 __Pyx_GIVEREF(__pyx_n_s_contextmanager);
jpayne@69 12356 if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_contextmanager)) __PYX_ERR(0, 9, __pyx_L1_error);
jpayne@69 12357 __pyx_t_3 = __Pyx_Import(__pyx_n_s_contextlib, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 9, __pyx_L1_error)
jpayne@69 12358 __Pyx_GOTREF(__pyx_t_3);
jpayne@69 12359 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@69 12360 __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_contextmanager); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 9, __pyx_L1_error)
jpayne@69 12361 __Pyx_GOTREF(__pyx_t_2);
jpayne@69 12362 if (PyDict_SetItem(__pyx_d, __pyx_n_s_contextmanager, __pyx_t_2) < 0) __PYX_ERR(0, 9, __pyx_L1_error)
jpayne@69 12363 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@69 12364 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@69 12365
jpayne@69 12366 /* "pysam/libcutils.pyx":10
jpayne@69 12367 * import io
jpayne@69 12368 * from contextlib import contextmanager
jpayne@69 12369 * from codecs import register_error # <<<<<<<<<<<<<<
jpayne@69 12370 *
jpayne@69 12371 * from cpython.version cimport PY_MAJOR_VERSION, PY_MINOR_VERSION
jpayne@69 12372 */
jpayne@69 12373 __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 10, __pyx_L1_error)
jpayne@69 12374 __Pyx_GOTREF(__pyx_t_3);
jpayne@69 12375 __Pyx_INCREF(__pyx_n_s_register_error);
jpayne@69 12376 __Pyx_GIVEREF(__pyx_n_s_register_error);
jpayne@69 12377 if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_register_error)) __PYX_ERR(0, 10, __pyx_L1_error);
jpayne@69 12378 __pyx_t_2 = __Pyx_Import(__pyx_n_s_codecs, __pyx_t_3, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 10, __pyx_L1_error)
jpayne@69 12379 __Pyx_GOTREF(__pyx_t_2);
jpayne@69 12380 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@69 12381 __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_register_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 10, __pyx_L1_error)
jpayne@69 12382 __Pyx_GOTREF(__pyx_t_3);
jpayne@69 12383 if (PyDict_SetItem(__pyx_d, __pyx_n_s_register_error, __pyx_t_3) < 0) __PYX_ERR(0, 10, __pyx_L1_error)
jpayne@69 12384 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@69 12385 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@69 12386
jpayne@69 12387 /* "pysam/libcutils.pyx":32
jpayne@69 12388 * #####################################################################
jpayne@69 12389 * # hard-coded constants
jpayne@69 12390 * cdef int MAX_POS = (1 << 31) - 1 # <<<<<<<<<<<<<<
jpayne@69 12391 *
jpayne@69 12392 * #################################################################
jpayne@69 12393 */
jpayne@69 12394 __pyx_v_5pysam_9libcutils_MAX_POS = 0x7fffffff;
jpayne@69 12395
jpayne@69 12396 /* "pysam/libcutils.pyx":36
jpayne@69 12397 * #################################################################
jpayne@69 12398 * # Utility functions for quality string conversions
jpayne@69 12399 * cpdef c_array.array qualitystring_to_array(input_str, int offset=33): # <<<<<<<<<<<<<<
jpayne@69 12400 * """convert a qualitystring to an array of quality values."""
jpayne@69 12401 * if input_str is None:
jpayne@69 12402 */
jpayne@69 12403 __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_9libcutils_1qualitystring_to_array, 0, __pyx_n_s_qualitystring_to_array, NULL, __pyx_n_s_pysam_libcutils, __pyx_d, ((PyObject *)__pyx_codeobj__17)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 36, __pyx_L1_error)
jpayne@69 12404 __Pyx_GOTREF(__pyx_t_2);
jpayne@69 12405 __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__18);
jpayne@69 12406 if (PyDict_SetItem(__pyx_d, __pyx_n_s_qualitystring_to_array, __pyx_t_2) < 0) __PYX_ERR(0, 36, __pyx_L1_error)
jpayne@69 12407 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@69 12408
jpayne@69 12409 /* "pysam/libcutils.pyx":45
jpayne@69 12410 *
jpayne@69 12411 *
jpayne@69 12412 * cpdef array_to_qualitystring(c_array.array qualities, int offset=33): # <<<<<<<<<<<<<<
jpayne@69 12413 * """convert an array of quality values to a string."""
jpayne@69 12414 * if qualities is None:
jpayne@69 12415 */
jpayne@69 12416 __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_9libcutils_3array_to_qualitystring, 0, __pyx_n_s_array_to_qualitystring, NULL, __pyx_n_s_pysam_libcutils, __pyx_d, ((PyObject *)__pyx_codeobj__20)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 45, __pyx_L1_error)
jpayne@69 12417 __Pyx_GOTREF(__pyx_t_2);
jpayne@69 12418 __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__18);
jpayne@69 12419 if (PyDict_SetItem(__pyx_d, __pyx_n_s_array_to_qualitystring, __pyx_t_2) < 0) __PYX_ERR(0, 45, __pyx_L1_error)
jpayne@69 12420 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@69 12421
jpayne@69 12422 /* "pysam/libcutils.pyx":59
jpayne@69 12423 *
jpayne@69 12424 *
jpayne@69 12425 * cpdef qualities_to_qualitystring(qualities, int offset=33): # <<<<<<<<<<<<<<
jpayne@69 12426 * """convert a list or array of quality scores to the string
jpayne@69 12427 * representation used in the SAM format.
jpayne@69 12428 */
jpayne@69 12429 __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_9libcutils_5qualities_to_qualitystring, 0, __pyx_n_s_qualities_to_qualitystring, NULL, __pyx_n_s_pysam_libcutils, __pyx_d, ((PyObject *)__pyx_codeobj__21)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 59, __pyx_L1_error)
jpayne@69 12430 __Pyx_GOTREF(__pyx_t_2);
jpayne@69 12431 __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__18);
jpayne@69 12432 if (PyDict_SetItem(__pyx_d, __pyx_n_s_qualities_to_qualitystring, __pyx_t_2) < 0) __PYX_ERR(0, 59, __pyx_L1_error)
jpayne@69 12433 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@69 12434
jpayne@69 12435 /* "pysam/libcutils.pyx":90
jpayne@69 12436 *
jpayne@69 12437 * # Codec error handler that just interprets each bad byte as ISO-8859-1.
jpayne@69 12438 * def latin1_replace(exception): # <<<<<<<<<<<<<<
jpayne@69 12439 * return (chr(exception.object[exception.start]), exception.end)
jpayne@69 12440 *
jpayne@69 12441 */
jpayne@69 12442 __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_9libcutils_7latin1_replace, 0, __pyx_n_s_latin1_replace, NULL, __pyx_n_s_pysam_libcutils, __pyx_d, ((PyObject *)__pyx_codeobj__23)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 90, __pyx_L1_error)
jpayne@69 12443 __Pyx_GOTREF(__pyx_t_2);
jpayne@69 12444 if (PyDict_SetItem(__pyx_d, __pyx_n_s_latin1_replace, __pyx_t_2) < 0) __PYX_ERR(0, 90, __pyx_L1_error)
jpayne@69 12445 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@69 12446
jpayne@69 12447 /* "pysam/libcutils.pyx":93
jpayne@69 12448 * return (chr(exception.object[exception.start]), exception.end)
jpayne@69 12449 *
jpayne@69 12450 * register_error('pysam.latin1replace', latin1_replace) # <<<<<<<<<<<<<<
jpayne@69 12451 *
jpayne@69 12452 *
jpayne@69 12453 */
jpayne@69 12454 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_register_error); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 93, __pyx_L1_error)
jpayne@69 12455 __Pyx_GOTREF(__pyx_t_2);
jpayne@69 12456 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_latin1_replace); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 93, __pyx_L1_error)
jpayne@69 12457 __Pyx_GOTREF(__pyx_t_3);
jpayne@69 12458 __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 93, __pyx_L1_error)
jpayne@69 12459 __Pyx_GOTREF(__pyx_t_4);
jpayne@69 12460 __Pyx_INCREF(__pyx_kp_u_pysam_latin1replace);
jpayne@69 12461 __Pyx_GIVEREF(__pyx_kp_u_pysam_latin1replace);
jpayne@69 12462 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_u_pysam_latin1replace)) __PYX_ERR(0, 93, __pyx_L1_error);
jpayne@69 12463 __Pyx_GIVEREF(__pyx_t_3);
jpayne@69 12464 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3)) __PYX_ERR(0, 93, __pyx_L1_error);
jpayne@69 12465 __pyx_t_3 = 0;
jpayne@69 12466 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 93, __pyx_L1_error)
jpayne@69 12467 __Pyx_GOTREF(__pyx_t_3);
jpayne@69 12468 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@69 12469 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
jpayne@69 12470 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@69 12471
jpayne@69 12472 /* "pysam/libcutils.pyx":96
jpayne@69 12473 *
jpayne@69 12474 *
jpayne@69 12475 * cdef str ERROR_HANDLER = 'strict' # <<<<<<<<<<<<<<
jpayne@69 12476 *
jpayne@69 12477 * cpdef get_encoding_error_handler():
jpayne@69 12478 */
jpayne@69 12479 __Pyx_INCREF(__pyx_n_u_strict);
jpayne@69 12480 __Pyx_XGOTREF(__pyx_v_5pysam_9libcutils_ERROR_HANDLER);
jpayne@69 12481 __Pyx_DECREF_SET(__pyx_v_5pysam_9libcutils_ERROR_HANDLER, __pyx_n_u_strict);
jpayne@69 12482 __Pyx_GIVEREF(__pyx_n_u_strict);
jpayne@69 12483
jpayne@69 12484 /* "pysam/libcutils.pyx":98
jpayne@69 12485 * cdef str ERROR_HANDLER = 'strict'
jpayne@69 12486 *
jpayne@69 12487 * cpdef get_encoding_error_handler(): # <<<<<<<<<<<<<<
jpayne@69 12488 * return ERROR_HANDLER
jpayne@69 12489 *
jpayne@69 12490 */
jpayne@69 12491 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_9libcutils_9get_encoding_error_handler, 0, __pyx_n_s_get_encoding_error_handler, NULL, __pyx_n_s_pysam_libcutils, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 98, __pyx_L1_error)
jpayne@69 12492 __Pyx_GOTREF(__pyx_t_3);
jpayne@69 12493 if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_encoding_error_handler, __pyx_t_3) < 0) __PYX_ERR(0, 98, __pyx_L1_error)
jpayne@69 12494 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@69 12495
jpayne@69 12496 /* "pysam/libcutils.pyx":101
jpayne@69 12497 * return ERROR_HANDLER
jpayne@69 12498 *
jpayne@69 12499 * cpdef set_encoding_error_handler(name): # <<<<<<<<<<<<<<
jpayne@69 12500 * global ERROR_HANDLER
jpayne@69 12501 * previous = ERROR_HANDLER
jpayne@69 12502 */
jpayne@69 12503 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_9libcutils_11set_encoding_error_handler, 0, __pyx_n_s_set_encoding_error_handler, NULL, __pyx_n_s_pysam_libcutils, __pyx_d, ((PyObject *)__pyx_codeobj__26)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 101, __pyx_L1_error)
jpayne@69 12504 __Pyx_GOTREF(__pyx_t_3);
jpayne@69 12505 if (PyDict_SetItem(__pyx_d, __pyx_n_s_set_encoding_error_handler, __pyx_t_3) < 0) __PYX_ERR(0, 101, __pyx_L1_error)
jpayne@69 12506 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@69 12507
jpayne@69 12508 /* "pysam/libcutils.pyx":115
jpayne@69 12509 *
jpayne@69 12510 * # filename encoding (adapted from lxml.etree.pyx)
jpayne@69 12511 * cdef str FILENAME_ENCODING = sys.getfilesystemencoding() or sys.getdefaultencoding() or 'ascii' # <<<<<<<<<<<<<<
jpayne@69 12512 * cdef str TEXT_ENCODING = 'utf-8'
jpayne@69 12513 *
jpayne@69 12514 */
jpayne@69 12515 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_sys); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 115, __pyx_L1_error)
jpayne@69 12516 __Pyx_GOTREF(__pyx_t_4);
jpayne@69 12517 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_getfilesystemencoding); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 115, __pyx_L1_error)
jpayne@69 12518 __Pyx_GOTREF(__pyx_t_2);
jpayne@69 12519 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
jpayne@69 12520 __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 115, __pyx_L1_error)
jpayne@69 12521 __Pyx_GOTREF(__pyx_t_4);
jpayne@69 12522 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@69 12523 __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 115, __pyx_L1_error)
jpayne@69 12524 if (!__pyx_t_5) {
jpayne@69 12525 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
jpayne@69 12526 } else {
jpayne@69 12527 if (!(likely(PyUnicode_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None) || __Pyx_RaiseUnexpectedTypeError("unicode", __pyx_t_4))) __PYX_ERR(0, 115, __pyx_L1_error)
jpayne@69 12528 __Pyx_INCREF(__pyx_t_4);
jpayne@69 12529 __pyx_t_3 = __pyx_t_4;
jpayne@69 12530 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
jpayne@69 12531 goto __pyx_L2_bool_binop_done;
jpayne@69 12532 }
jpayne@69 12533 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_sys); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 115, __pyx_L1_error)
jpayne@69 12534 __Pyx_GOTREF(__pyx_t_4);
jpayne@69 12535 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_getdefaultencoding); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 115, __pyx_L1_error)
jpayne@69 12536 __Pyx_GOTREF(__pyx_t_2);
jpayne@69 12537 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
jpayne@69 12538 __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 115, __pyx_L1_error)
jpayne@69 12539 __Pyx_GOTREF(__pyx_t_4);
jpayne@69 12540 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@69 12541 __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 115, __pyx_L1_error)
jpayne@69 12542 if (!__pyx_t_5) {
jpayne@69 12543 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
jpayne@69 12544 } else {
jpayne@69 12545 if (!(likely(PyUnicode_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None) || __Pyx_RaiseUnexpectedTypeError("unicode", __pyx_t_4))) __PYX_ERR(0, 115, __pyx_L1_error)
jpayne@69 12546 __Pyx_INCREF(__pyx_t_4);
jpayne@69 12547 __pyx_t_3 = __pyx_t_4;
jpayne@69 12548 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
jpayne@69 12549 goto __pyx_L2_bool_binop_done;
jpayne@69 12550 }
jpayne@69 12551 __Pyx_INCREF(__pyx_n_u_ascii);
jpayne@69 12552 __pyx_t_3 = __pyx_n_u_ascii;
jpayne@69 12553 __pyx_L2_bool_binop_done:;
jpayne@69 12554 __Pyx_XGOTREF(__pyx_v_5pysam_9libcutils_FILENAME_ENCODING);
jpayne@69 12555 __Pyx_DECREF_SET(__pyx_v_5pysam_9libcutils_FILENAME_ENCODING, ((PyObject*)__pyx_t_3));
jpayne@69 12556 __Pyx_GIVEREF(__pyx_t_3);
jpayne@69 12557 __pyx_t_3 = 0;
jpayne@69 12558
jpayne@69 12559 /* "pysam/libcutils.pyx":116
jpayne@69 12560 * # filename encoding (adapted from lxml.etree.pyx)
jpayne@69 12561 * cdef str FILENAME_ENCODING = sys.getfilesystemencoding() or sys.getdefaultencoding() or 'ascii'
jpayne@69 12562 * cdef str TEXT_ENCODING = 'utf-8' # <<<<<<<<<<<<<<
jpayne@69 12563 *
jpayne@69 12564 * cdef bytes encode_filename(object filename):
jpayne@69 12565 */
jpayne@69 12566 __Pyx_INCREF(__pyx_kp_u_utf_8);
jpayne@69 12567 __Pyx_XGOTREF(__pyx_v_5pysam_9libcutils_TEXT_ENCODING);
jpayne@69 12568 __Pyx_DECREF_SET(__pyx_v_5pysam_9libcutils_TEXT_ENCODING, __pyx_kp_u_utf_8);
jpayne@69 12569 __Pyx_GIVEREF(__pyx_kp_u_utf_8);
jpayne@69 12570
jpayne@69 12571 /* "pysam/libcutils.pyx":178
jpayne@69 12572 *
jpayne@69 12573 *
jpayne@69 12574 * cpdef parse_region(contig=None, # <<<<<<<<<<<<<<
jpayne@69 12575 * start=None,
jpayne@69 12576 * stop=None,
jpayne@69 12577 */
jpayne@69 12578 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_9libcutils_13parse_region, 0, __pyx_n_s_parse_region, NULL, __pyx_n_s_pysam_libcutils, __pyx_d, ((PyObject *)__pyx_codeobj__28)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 178, __pyx_L1_error)
jpayne@69 12579 __Pyx_GOTREF(__pyx_t_3);
jpayne@69 12580 __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__29);
jpayne@69 12581 if (PyDict_SetItem(__pyx_d, __pyx_n_s_parse_region, __pyx_t_3) < 0) __PYX_ERR(0, 178, __pyx_L1_error)
jpayne@69 12582 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@69 12583
jpayne@69 12584 /* "pysam/libcutils.pyx":276
jpayne@69 12585 *
jpayne@69 12586 *
jpayne@69 12587 * def _pysam_dispatch(collection, # <<<<<<<<<<<<<<
jpayne@69 12588 * method,
jpayne@69 12589 * args=None,
jpayne@69 12590 */
jpayne@69 12591 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_5pysam_9libcutils_15_pysam_dispatch, 0, __pyx_n_s_pysam_dispatch, NULL, __pyx_n_s_pysam_libcutils, __pyx_d, ((PyObject *)__pyx_codeobj__31)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 276, __pyx_L1_error)
jpayne@69 12592 __Pyx_GOTREF(__pyx_t_3);
jpayne@69 12593 __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__32);
jpayne@69 12594 if (PyDict_SetItem(__pyx_d, __pyx_n_s_pysam_dispatch, __pyx_t_3) < 0) __PYX_ERR(0, 276, __pyx_L1_error)
jpayne@69 12595 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@69 12596
jpayne@69 12597 /* "pysam/libcutils.pyx":437
jpayne@69 12598 *
jpayne@69 12599 *
jpayne@69 12600 * __all__ = [ # <<<<<<<<<<<<<<
jpayne@69 12601 * "qualitystring_to_array",
jpayne@69 12602 * "array_to_qualitystring",
jpayne@69 12603 */
jpayne@69 12604 __pyx_t_3 = PyList_New(5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 437, __pyx_L1_error)
jpayne@69 12605 __Pyx_GOTREF(__pyx_t_3);
jpayne@69 12606 __Pyx_INCREF(__pyx_n_u_qualitystring_to_array);
jpayne@69 12607 __Pyx_GIVEREF(__pyx_n_u_qualitystring_to_array);
jpayne@69 12608 if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_u_qualitystring_to_array)) __PYX_ERR(0, 437, __pyx_L1_error);
jpayne@69 12609 __Pyx_INCREF(__pyx_n_u_array_to_qualitystring);
jpayne@69 12610 __Pyx_GIVEREF(__pyx_n_u_array_to_qualitystring);
jpayne@69 12611 if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 1, __pyx_n_u_array_to_qualitystring)) __PYX_ERR(0, 437, __pyx_L1_error);
jpayne@69 12612 __Pyx_INCREF(__pyx_n_u_qualities_to_qualitystring);
jpayne@69 12613 __Pyx_GIVEREF(__pyx_n_u_qualities_to_qualitystring);
jpayne@69 12614 if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 2, __pyx_n_u_qualities_to_qualitystring)) __PYX_ERR(0, 437, __pyx_L1_error);
jpayne@69 12615 __Pyx_INCREF(__pyx_n_u_get_encoding_error_handler);
jpayne@69 12616 __Pyx_GIVEREF(__pyx_n_u_get_encoding_error_handler);
jpayne@69 12617 if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 3, __pyx_n_u_get_encoding_error_handler)) __PYX_ERR(0, 437, __pyx_L1_error);
jpayne@69 12618 __Pyx_INCREF(__pyx_n_u_set_encoding_error_handler);
jpayne@69 12619 __Pyx_GIVEREF(__pyx_n_u_set_encoding_error_handler);
jpayne@69 12620 if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 4, __pyx_n_u_set_encoding_error_handler)) __PYX_ERR(0, 437, __pyx_L1_error);
jpayne@69 12621 if (PyDict_SetItem(__pyx_d, __pyx_n_s_all, __pyx_t_3) < 0) __PYX_ERR(0, 437, __pyx_L1_error)
jpayne@69 12622 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@69 12623
jpayne@69 12624 /* "pysam/libcutils.pyx":1
jpayne@69 12625 * # cython: language_level=3 # <<<<<<<<<<<<<<
jpayne@69 12626 * import types
jpayne@69 12627 * import sys
jpayne@69 12628 */
jpayne@69 12629 __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@69 12630 __Pyx_GOTREF(__pyx_t_3);
jpayne@69 12631 if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_3) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@69 12632 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@69 12633
jpayne@69 12634 /*--- Wrapped vars code ---*/
jpayne@69 12635
jpayne@69 12636 goto __pyx_L0;
jpayne@69 12637 __pyx_L1_error:;
jpayne@69 12638 __Pyx_XDECREF(__pyx_t_2);
jpayne@69 12639 __Pyx_XDECREF(__pyx_t_3);
jpayne@69 12640 __Pyx_XDECREF(__pyx_t_4);
jpayne@69 12641 if (__pyx_m) {
jpayne@69 12642 if (__pyx_d && stringtab_initialized) {
jpayne@69 12643 __Pyx_AddTraceback("init pysam.libcutils", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@69 12644 }
jpayne@69 12645 #if !CYTHON_USE_MODULE_STATE
jpayne@69 12646 Py_CLEAR(__pyx_m);
jpayne@69 12647 #else
jpayne@69 12648 Py_DECREF(__pyx_m);
jpayne@69 12649 if (pystate_addmodule_run) {
jpayne@69 12650 PyObject *tp, *value, *tb;
jpayne@69 12651 PyErr_Fetch(&tp, &value, &tb);
jpayne@69 12652 PyState_RemoveModule(&__pyx_moduledef);
jpayne@69 12653 PyErr_Restore(tp, value, tb);
jpayne@69 12654 }
jpayne@69 12655 #endif
jpayne@69 12656 } else if (!PyErr_Occurred()) {
jpayne@69 12657 PyErr_SetString(PyExc_ImportError, "init pysam.libcutils");
jpayne@69 12658 }
jpayne@69 12659 __pyx_L0:;
jpayne@69 12660 __Pyx_RefNannyFinishContext();
jpayne@69 12661 #if CYTHON_PEP489_MULTI_PHASE_INIT
jpayne@69 12662 return (__pyx_m != NULL) ? 0 : -1;
jpayne@69 12663 #elif PY_MAJOR_VERSION >= 3
jpayne@69 12664 return __pyx_m;
jpayne@69 12665 #else
jpayne@69 12666 return;
jpayne@69 12667 #endif
jpayne@69 12668 }
jpayne@69 12669 /* #### Code section: cleanup_globals ### */
jpayne@69 12670 /* #### Code section: cleanup_module ### */
jpayne@69 12671 /* #### Code section: main_method ### */
jpayne@69 12672 /* #### Code section: utility_code_pragmas ### */
jpayne@69 12673 #ifdef _MSC_VER
jpayne@69 12674 #pragma warning( push )
jpayne@69 12675 /* Warning 4127: conditional expression is constant
jpayne@69 12676 * Cython uses constant conditional expressions to allow in inline functions to be optimized at
jpayne@69 12677 * compile-time, so this warning is not useful
jpayne@69 12678 */
jpayne@69 12679 #pragma warning( disable : 4127 )
jpayne@69 12680 #endif
jpayne@69 12681
jpayne@69 12682
jpayne@69 12683
jpayne@69 12684 /* #### Code section: utility_code_def ### */
jpayne@69 12685
jpayne@69 12686 /* --- Runtime support code --- */
jpayne@69 12687 /* Refnanny */
jpayne@69 12688 #if CYTHON_REFNANNY
jpayne@69 12689 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
jpayne@69 12690 PyObject *m = NULL, *p = NULL;
jpayne@69 12691 void *r = NULL;
jpayne@69 12692 m = PyImport_ImportModule(modname);
jpayne@69 12693 if (!m) goto end;
jpayne@69 12694 p = PyObject_GetAttrString(m, "RefNannyAPI");
jpayne@69 12695 if (!p) goto end;
jpayne@69 12696 r = PyLong_AsVoidPtr(p);
jpayne@69 12697 end:
jpayne@69 12698 Py_XDECREF(p);
jpayne@69 12699 Py_XDECREF(m);
jpayne@69 12700 return (__Pyx_RefNannyAPIStruct *)r;
jpayne@69 12701 }
jpayne@69 12702 #endif
jpayne@69 12703
jpayne@69 12704 /* PyErrExceptionMatches */
jpayne@69 12705 #if CYTHON_FAST_THREAD_STATE
jpayne@69 12706 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
jpayne@69 12707 Py_ssize_t i, n;
jpayne@69 12708 n = PyTuple_GET_SIZE(tuple);
jpayne@69 12709 #if PY_MAJOR_VERSION >= 3
jpayne@69 12710 for (i=0; i<n; i++) {
jpayne@69 12711 if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
jpayne@69 12712 }
jpayne@69 12713 #endif
jpayne@69 12714 for (i=0; i<n; i++) {
jpayne@69 12715 if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
jpayne@69 12716 }
jpayne@69 12717 return 0;
jpayne@69 12718 }
jpayne@69 12719 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
jpayne@69 12720 int result;
jpayne@69 12721 PyObject *exc_type;
jpayne@69 12722 #if PY_VERSION_HEX >= 0x030C00A6
jpayne@69 12723 PyObject *current_exception = tstate->current_exception;
jpayne@69 12724 if (unlikely(!current_exception)) return 0;
jpayne@69 12725 exc_type = (PyObject*) Py_TYPE(current_exception);
jpayne@69 12726 if (exc_type == err) return 1;
jpayne@69 12727 #else
jpayne@69 12728 exc_type = tstate->curexc_type;
jpayne@69 12729 if (exc_type == err) return 1;
jpayne@69 12730 if (unlikely(!exc_type)) return 0;
jpayne@69 12731 #endif
jpayne@69 12732 #if CYTHON_AVOID_BORROWED_REFS
jpayne@69 12733 Py_INCREF(exc_type);
jpayne@69 12734 #endif
jpayne@69 12735 if (unlikely(PyTuple_Check(err))) {
jpayne@69 12736 result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
jpayne@69 12737 } else {
jpayne@69 12738 result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
jpayne@69 12739 }
jpayne@69 12740 #if CYTHON_AVOID_BORROWED_REFS
jpayne@69 12741 Py_DECREF(exc_type);
jpayne@69 12742 #endif
jpayne@69 12743 return result;
jpayne@69 12744 }
jpayne@69 12745 #endif
jpayne@69 12746
jpayne@69 12747 /* PyErrFetchRestore */
jpayne@69 12748 #if CYTHON_FAST_THREAD_STATE
jpayne@69 12749 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
jpayne@69 12750 #if PY_VERSION_HEX >= 0x030C00A6
jpayne@69 12751 PyObject *tmp_value;
jpayne@69 12752 assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value)));
jpayne@69 12753 if (value) {
jpayne@69 12754 #if CYTHON_COMPILING_IN_CPYTHON
jpayne@69 12755 if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb))
jpayne@69 12756 #endif
jpayne@69 12757 PyException_SetTraceback(value, tb);
jpayne@69 12758 }
jpayne@69 12759 tmp_value = tstate->current_exception;
jpayne@69 12760 tstate->current_exception = value;
jpayne@69 12761 Py_XDECREF(tmp_value);
jpayne@69 12762 Py_XDECREF(type);
jpayne@69 12763 Py_XDECREF(tb);
jpayne@69 12764 #else
jpayne@69 12765 PyObject *tmp_type, *tmp_value, *tmp_tb;
jpayne@69 12766 tmp_type = tstate->curexc_type;
jpayne@69 12767 tmp_value = tstate->curexc_value;
jpayne@69 12768 tmp_tb = tstate->curexc_traceback;
jpayne@69 12769 tstate->curexc_type = type;
jpayne@69 12770 tstate->curexc_value = value;
jpayne@69 12771 tstate->curexc_traceback = tb;
jpayne@69 12772 Py_XDECREF(tmp_type);
jpayne@69 12773 Py_XDECREF(tmp_value);
jpayne@69 12774 Py_XDECREF(tmp_tb);
jpayne@69 12775 #endif
jpayne@69 12776 }
jpayne@69 12777 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
jpayne@69 12778 #if PY_VERSION_HEX >= 0x030C00A6
jpayne@69 12779 PyObject* exc_value;
jpayne@69 12780 exc_value = tstate->current_exception;
jpayne@69 12781 tstate->current_exception = 0;
jpayne@69 12782 *value = exc_value;
jpayne@69 12783 *type = NULL;
jpayne@69 12784 *tb = NULL;
jpayne@69 12785 if (exc_value) {
jpayne@69 12786 *type = (PyObject*) Py_TYPE(exc_value);
jpayne@69 12787 Py_INCREF(*type);
jpayne@69 12788 #if CYTHON_COMPILING_IN_CPYTHON
jpayne@69 12789 *tb = ((PyBaseExceptionObject*) exc_value)->traceback;
jpayne@69 12790 Py_XINCREF(*tb);
jpayne@69 12791 #else
jpayne@69 12792 *tb = PyException_GetTraceback(exc_value);
jpayne@69 12793 #endif
jpayne@69 12794 }
jpayne@69 12795 #else
jpayne@69 12796 *type = tstate->curexc_type;
jpayne@69 12797 *value = tstate->curexc_value;
jpayne@69 12798 *tb = tstate->curexc_traceback;
jpayne@69 12799 tstate->curexc_type = 0;
jpayne@69 12800 tstate->curexc_value = 0;
jpayne@69 12801 tstate->curexc_traceback = 0;
jpayne@69 12802 #endif
jpayne@69 12803 }
jpayne@69 12804 #endif
jpayne@69 12805
jpayne@69 12806 /* PyObjectGetAttrStr */
jpayne@69 12807 #if CYTHON_USE_TYPE_SLOTS
jpayne@69 12808 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
jpayne@69 12809 PyTypeObject* tp = Py_TYPE(obj);
jpayne@69 12810 if (likely(tp->tp_getattro))
jpayne@69 12811 return tp->tp_getattro(obj, attr_name);
jpayne@69 12812 #if PY_MAJOR_VERSION < 3
jpayne@69 12813 if (likely(tp->tp_getattr))
jpayne@69 12814 return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
jpayne@69 12815 #endif
jpayne@69 12816 return PyObject_GetAttr(obj, attr_name);
jpayne@69 12817 }
jpayne@69 12818 #endif
jpayne@69 12819
jpayne@69 12820 /* PyObjectGetAttrStrNoError */
jpayne@69 12821 #if __PYX_LIMITED_VERSION_HEX < 0x030d00A1
jpayne@69 12822 static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
jpayne@69 12823 __Pyx_PyThreadState_declare
jpayne@69 12824 __Pyx_PyThreadState_assign
jpayne@69 12825 if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
jpayne@69 12826 __Pyx_PyErr_Clear();
jpayne@69 12827 }
jpayne@69 12828 #endif
jpayne@69 12829 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
jpayne@69 12830 PyObject *result;
jpayne@69 12831 #if __PYX_LIMITED_VERSION_HEX >= 0x030d00A1
jpayne@69 12832 (void) PyObject_GetOptionalAttr(obj, attr_name, &result);
jpayne@69 12833 return result;
jpayne@69 12834 #else
jpayne@69 12835 #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1
jpayne@69 12836 PyTypeObject* tp = Py_TYPE(obj);
jpayne@69 12837 if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
jpayne@69 12838 return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
jpayne@69 12839 }
jpayne@69 12840 #endif
jpayne@69 12841 result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
jpayne@69 12842 if (unlikely(!result)) {
jpayne@69 12843 __Pyx_PyObject_GetAttrStr_ClearAttributeError();
jpayne@69 12844 }
jpayne@69 12845 return result;
jpayne@69 12846 #endif
jpayne@69 12847 }
jpayne@69 12848
jpayne@69 12849 /* GetBuiltinName */
jpayne@69 12850 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
jpayne@69 12851 PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_b, name);
jpayne@69 12852 if (unlikely(!result) && !PyErr_Occurred()) {
jpayne@69 12853 PyErr_Format(PyExc_NameError,
jpayne@69 12854 #if PY_MAJOR_VERSION >= 3
jpayne@69 12855 "name '%U' is not defined", name);
jpayne@69 12856 #else
jpayne@69 12857 "name '%.200s' is not defined", PyString_AS_STRING(name));
jpayne@69 12858 #endif
jpayne@69 12859 }
jpayne@69 12860 return result;
jpayne@69 12861 }
jpayne@69 12862
jpayne@69 12863 /* TupleAndListFromArray */
jpayne@69 12864 #if CYTHON_COMPILING_IN_CPYTHON
jpayne@69 12865 static CYTHON_INLINE void __Pyx_copy_object_array(PyObject *const *CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) {
jpayne@69 12866 PyObject *v;
jpayne@69 12867 Py_ssize_t i;
jpayne@69 12868 for (i = 0; i < length; i++) {
jpayne@69 12869 v = dest[i] = src[i];
jpayne@69 12870 Py_INCREF(v);
jpayne@69 12871 }
jpayne@69 12872 }
jpayne@69 12873 static CYTHON_INLINE PyObject *
jpayne@69 12874 __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n)
jpayne@69 12875 {
jpayne@69 12876 PyObject *res;
jpayne@69 12877 if (n <= 0) {
jpayne@69 12878 Py_INCREF(__pyx_empty_tuple);
jpayne@69 12879 return __pyx_empty_tuple;
jpayne@69 12880 }
jpayne@69 12881 res = PyTuple_New(n);
jpayne@69 12882 if (unlikely(res == NULL)) return NULL;
jpayne@69 12883 __Pyx_copy_object_array(src, ((PyTupleObject*)res)->ob_item, n);
jpayne@69 12884 return res;
jpayne@69 12885 }
jpayne@69 12886 static CYTHON_INLINE PyObject *
jpayne@69 12887 __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n)
jpayne@69 12888 {
jpayne@69 12889 PyObject *res;
jpayne@69 12890 if (n <= 0) {
jpayne@69 12891 return PyList_New(0);
jpayne@69 12892 }
jpayne@69 12893 res = PyList_New(n);
jpayne@69 12894 if (unlikely(res == NULL)) return NULL;
jpayne@69 12895 __Pyx_copy_object_array(src, ((PyListObject*)res)->ob_item, n);
jpayne@69 12896 return res;
jpayne@69 12897 }
jpayne@69 12898 #endif
jpayne@69 12899
jpayne@69 12900 /* BytesEquals */
jpayne@69 12901 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
jpayne@69 12902 #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 12903 return PyObject_RichCompareBool(s1, s2, equals);
jpayne@69 12904 #else
jpayne@69 12905 if (s1 == s2) {
jpayne@69 12906 return (equals == Py_EQ);
jpayne@69 12907 } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
jpayne@69 12908 const char *ps1, *ps2;
jpayne@69 12909 Py_ssize_t length = PyBytes_GET_SIZE(s1);
jpayne@69 12910 if (length != PyBytes_GET_SIZE(s2))
jpayne@69 12911 return (equals == Py_NE);
jpayne@69 12912 ps1 = PyBytes_AS_STRING(s1);
jpayne@69 12913 ps2 = PyBytes_AS_STRING(s2);
jpayne@69 12914 if (ps1[0] != ps2[0]) {
jpayne@69 12915 return (equals == Py_NE);
jpayne@69 12916 } else if (length == 1) {
jpayne@69 12917 return (equals == Py_EQ);
jpayne@69 12918 } else {
jpayne@69 12919 int result;
jpayne@69 12920 #if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000)
jpayne@69 12921 Py_hash_t hash1, hash2;
jpayne@69 12922 hash1 = ((PyBytesObject*)s1)->ob_shash;
jpayne@69 12923 hash2 = ((PyBytesObject*)s2)->ob_shash;
jpayne@69 12924 if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
jpayne@69 12925 return (equals == Py_NE);
jpayne@69 12926 }
jpayne@69 12927 #endif
jpayne@69 12928 result = memcmp(ps1, ps2, (size_t)length);
jpayne@69 12929 return (equals == Py_EQ) ? (result == 0) : (result != 0);
jpayne@69 12930 }
jpayne@69 12931 } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
jpayne@69 12932 return (equals == Py_NE);
jpayne@69 12933 } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
jpayne@69 12934 return (equals == Py_NE);
jpayne@69 12935 } else {
jpayne@69 12936 int result;
jpayne@69 12937 PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
jpayne@69 12938 if (!py_result)
jpayne@69 12939 return -1;
jpayne@69 12940 result = __Pyx_PyObject_IsTrue(py_result);
jpayne@69 12941 Py_DECREF(py_result);
jpayne@69 12942 return result;
jpayne@69 12943 }
jpayne@69 12944 #endif
jpayne@69 12945 }
jpayne@69 12946
jpayne@69 12947 /* UnicodeEquals */
jpayne@69 12948 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
jpayne@69 12949 #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 12950 return PyObject_RichCompareBool(s1, s2, equals);
jpayne@69 12951 #else
jpayne@69 12952 #if PY_MAJOR_VERSION < 3
jpayne@69 12953 PyObject* owned_ref = NULL;
jpayne@69 12954 #endif
jpayne@69 12955 int s1_is_unicode, s2_is_unicode;
jpayne@69 12956 if (s1 == s2) {
jpayne@69 12957 goto return_eq;
jpayne@69 12958 }
jpayne@69 12959 s1_is_unicode = PyUnicode_CheckExact(s1);
jpayne@69 12960 s2_is_unicode = PyUnicode_CheckExact(s2);
jpayne@69 12961 #if PY_MAJOR_VERSION < 3
jpayne@69 12962 if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
jpayne@69 12963 owned_ref = PyUnicode_FromObject(s2);
jpayne@69 12964 if (unlikely(!owned_ref))
jpayne@69 12965 return -1;
jpayne@69 12966 s2 = owned_ref;
jpayne@69 12967 s2_is_unicode = 1;
jpayne@69 12968 } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
jpayne@69 12969 owned_ref = PyUnicode_FromObject(s1);
jpayne@69 12970 if (unlikely(!owned_ref))
jpayne@69 12971 return -1;
jpayne@69 12972 s1 = owned_ref;
jpayne@69 12973 s1_is_unicode = 1;
jpayne@69 12974 } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
jpayne@69 12975 return __Pyx_PyBytes_Equals(s1, s2, equals);
jpayne@69 12976 }
jpayne@69 12977 #endif
jpayne@69 12978 if (s1_is_unicode & s2_is_unicode) {
jpayne@69 12979 Py_ssize_t length;
jpayne@69 12980 int kind;
jpayne@69 12981 void *data1, *data2;
jpayne@69 12982 if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
jpayne@69 12983 return -1;
jpayne@69 12984 length = __Pyx_PyUnicode_GET_LENGTH(s1);
jpayne@69 12985 if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
jpayne@69 12986 goto return_ne;
jpayne@69 12987 }
jpayne@69 12988 #if CYTHON_USE_UNICODE_INTERNALS
jpayne@69 12989 {
jpayne@69 12990 Py_hash_t hash1, hash2;
jpayne@69 12991 #if CYTHON_PEP393_ENABLED
jpayne@69 12992 hash1 = ((PyASCIIObject*)s1)->hash;
jpayne@69 12993 hash2 = ((PyASCIIObject*)s2)->hash;
jpayne@69 12994 #else
jpayne@69 12995 hash1 = ((PyUnicodeObject*)s1)->hash;
jpayne@69 12996 hash2 = ((PyUnicodeObject*)s2)->hash;
jpayne@69 12997 #endif
jpayne@69 12998 if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
jpayne@69 12999 goto return_ne;
jpayne@69 13000 }
jpayne@69 13001 }
jpayne@69 13002 #endif
jpayne@69 13003 kind = __Pyx_PyUnicode_KIND(s1);
jpayne@69 13004 if (kind != __Pyx_PyUnicode_KIND(s2)) {
jpayne@69 13005 goto return_ne;
jpayne@69 13006 }
jpayne@69 13007 data1 = __Pyx_PyUnicode_DATA(s1);
jpayne@69 13008 data2 = __Pyx_PyUnicode_DATA(s2);
jpayne@69 13009 if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
jpayne@69 13010 goto return_ne;
jpayne@69 13011 } else if (length == 1) {
jpayne@69 13012 goto return_eq;
jpayne@69 13013 } else {
jpayne@69 13014 int result = memcmp(data1, data2, (size_t)(length * kind));
jpayne@69 13015 #if PY_MAJOR_VERSION < 3
jpayne@69 13016 Py_XDECREF(owned_ref);
jpayne@69 13017 #endif
jpayne@69 13018 return (equals == Py_EQ) ? (result == 0) : (result != 0);
jpayne@69 13019 }
jpayne@69 13020 } else if ((s1 == Py_None) & s2_is_unicode) {
jpayne@69 13021 goto return_ne;
jpayne@69 13022 } else if ((s2 == Py_None) & s1_is_unicode) {
jpayne@69 13023 goto return_ne;
jpayne@69 13024 } else {
jpayne@69 13025 int result;
jpayne@69 13026 PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
jpayne@69 13027 #if PY_MAJOR_VERSION < 3
jpayne@69 13028 Py_XDECREF(owned_ref);
jpayne@69 13029 #endif
jpayne@69 13030 if (!py_result)
jpayne@69 13031 return -1;
jpayne@69 13032 result = __Pyx_PyObject_IsTrue(py_result);
jpayne@69 13033 Py_DECREF(py_result);
jpayne@69 13034 return result;
jpayne@69 13035 }
jpayne@69 13036 return_eq:
jpayne@69 13037 #if PY_MAJOR_VERSION < 3
jpayne@69 13038 Py_XDECREF(owned_ref);
jpayne@69 13039 #endif
jpayne@69 13040 return (equals == Py_EQ);
jpayne@69 13041 return_ne:
jpayne@69 13042 #if PY_MAJOR_VERSION < 3
jpayne@69 13043 Py_XDECREF(owned_ref);
jpayne@69 13044 #endif
jpayne@69 13045 return (equals == Py_NE);
jpayne@69 13046 #endif
jpayne@69 13047 }
jpayne@69 13048
jpayne@69 13049 /* fastcall */
jpayne@69 13050 #if CYTHON_METH_FASTCALL
jpayne@69 13051 static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s)
jpayne@69 13052 {
jpayne@69 13053 Py_ssize_t i, n = PyTuple_GET_SIZE(kwnames);
jpayne@69 13054 for (i = 0; i < n; i++)
jpayne@69 13055 {
jpayne@69 13056 if (s == PyTuple_GET_ITEM(kwnames, i)) return kwvalues[i];
jpayne@69 13057 }
jpayne@69 13058 for (i = 0; i < n; i++)
jpayne@69 13059 {
jpayne@69 13060 int eq = __Pyx_PyUnicode_Equals(s, PyTuple_GET_ITEM(kwnames, i), Py_EQ);
jpayne@69 13061 if (unlikely(eq != 0)) {
jpayne@69 13062 if (unlikely(eq < 0)) return NULL;
jpayne@69 13063 return kwvalues[i];
jpayne@69 13064 }
jpayne@69 13065 }
jpayne@69 13066 return NULL;
jpayne@69 13067 }
jpayne@69 13068 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000
jpayne@69 13069 CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues) {
jpayne@69 13070 Py_ssize_t i, nkwargs = PyTuple_GET_SIZE(kwnames);
jpayne@69 13071 PyObject *dict;
jpayne@69 13072 dict = PyDict_New();
jpayne@69 13073 if (unlikely(!dict))
jpayne@69 13074 return NULL;
jpayne@69 13075 for (i=0; i<nkwargs; i++) {
jpayne@69 13076 PyObject *key = PyTuple_GET_ITEM(kwnames, i);
jpayne@69 13077 if (unlikely(PyDict_SetItem(dict, key, kwvalues[i]) < 0))
jpayne@69 13078 goto bad;
jpayne@69 13079 }
jpayne@69 13080 return dict;
jpayne@69 13081 bad:
jpayne@69 13082 Py_DECREF(dict);
jpayne@69 13083 return NULL;
jpayne@69 13084 }
jpayne@69 13085 #endif
jpayne@69 13086 #endif
jpayne@69 13087
jpayne@69 13088 /* PyObjectCall */
jpayne@69 13089 #if CYTHON_COMPILING_IN_CPYTHON
jpayne@69 13090 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
jpayne@69 13091 PyObject *result;
jpayne@69 13092 ternaryfunc call = Py_TYPE(func)->tp_call;
jpayne@69 13093 if (unlikely(!call))
jpayne@69 13094 return PyObject_Call(func, arg, kw);
jpayne@69 13095 #if PY_MAJOR_VERSION < 3
jpayne@69 13096 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
jpayne@69 13097 return NULL;
jpayne@69 13098 #else
jpayne@69 13099 if (unlikely(Py_EnterRecursiveCall(" while calling a Python object")))
jpayne@69 13100 return NULL;
jpayne@69 13101 #endif
jpayne@69 13102 result = (*call)(func, arg, kw);
jpayne@69 13103 Py_LeaveRecursiveCall();
jpayne@69 13104 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
jpayne@69 13105 PyErr_SetString(
jpayne@69 13106 PyExc_SystemError,
jpayne@69 13107 "NULL result without error in PyObject_Call");
jpayne@69 13108 }
jpayne@69 13109 return result;
jpayne@69 13110 }
jpayne@69 13111 #endif
jpayne@69 13112
jpayne@69 13113 /* RaiseDoubleKeywords */
jpayne@69 13114 static void __Pyx_RaiseDoubleKeywordsError(
jpayne@69 13115 const char* func_name,
jpayne@69 13116 PyObject* kw_name)
jpayne@69 13117 {
jpayne@69 13118 PyErr_Format(PyExc_TypeError,
jpayne@69 13119 #if PY_MAJOR_VERSION >= 3
jpayne@69 13120 "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
jpayne@69 13121 #else
jpayne@69 13122 "%s() got multiple values for keyword argument '%s'", func_name,
jpayne@69 13123 PyString_AsString(kw_name));
jpayne@69 13124 #endif
jpayne@69 13125 }
jpayne@69 13126
jpayne@69 13127 /* ParseKeywords */
jpayne@69 13128 static int __Pyx_ParseOptionalKeywords(
jpayne@69 13129 PyObject *kwds,
jpayne@69 13130 PyObject *const *kwvalues,
jpayne@69 13131 PyObject **argnames[],
jpayne@69 13132 PyObject *kwds2,
jpayne@69 13133 PyObject *values[],
jpayne@69 13134 Py_ssize_t num_pos_args,
jpayne@69 13135 const char* function_name)
jpayne@69 13136 {
jpayne@69 13137 PyObject *key = 0, *value = 0;
jpayne@69 13138 Py_ssize_t pos = 0;
jpayne@69 13139 PyObject*** name;
jpayne@69 13140 PyObject*** first_kw_arg = argnames + num_pos_args;
jpayne@69 13141 int kwds_is_tuple = CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds));
jpayne@69 13142 while (1) {
jpayne@69 13143 Py_XDECREF(key); key = NULL;
jpayne@69 13144 Py_XDECREF(value); value = NULL;
jpayne@69 13145 if (kwds_is_tuple) {
jpayne@69 13146 Py_ssize_t size;
jpayne@69 13147 #if CYTHON_ASSUME_SAFE_MACROS
jpayne@69 13148 size = PyTuple_GET_SIZE(kwds);
jpayne@69 13149 #else
jpayne@69 13150 size = PyTuple_Size(kwds);
jpayne@69 13151 if (size < 0) goto bad;
jpayne@69 13152 #endif
jpayne@69 13153 if (pos >= size) break;
jpayne@69 13154 #if CYTHON_AVOID_BORROWED_REFS
jpayne@69 13155 key = __Pyx_PySequence_ITEM(kwds, pos);
jpayne@69 13156 if (!key) goto bad;
jpayne@69 13157 #elif CYTHON_ASSUME_SAFE_MACROS
jpayne@69 13158 key = PyTuple_GET_ITEM(kwds, pos);
jpayne@69 13159 #else
jpayne@69 13160 key = PyTuple_GetItem(kwds, pos);
jpayne@69 13161 if (!key) goto bad;
jpayne@69 13162 #endif
jpayne@69 13163 value = kwvalues[pos];
jpayne@69 13164 pos++;
jpayne@69 13165 }
jpayne@69 13166 else
jpayne@69 13167 {
jpayne@69 13168 if (!PyDict_Next(kwds, &pos, &key, &value)) break;
jpayne@69 13169 #if CYTHON_AVOID_BORROWED_REFS
jpayne@69 13170 Py_INCREF(key);
jpayne@69 13171 #endif
jpayne@69 13172 }
jpayne@69 13173 name = first_kw_arg;
jpayne@69 13174 while (*name && (**name != key)) name++;
jpayne@69 13175 if (*name) {
jpayne@69 13176 values[name-argnames] = value;
jpayne@69 13177 #if CYTHON_AVOID_BORROWED_REFS
jpayne@69 13178 Py_INCREF(value);
jpayne@69 13179 Py_DECREF(key);
jpayne@69 13180 #endif
jpayne@69 13181 key = NULL;
jpayne@69 13182 value = NULL;
jpayne@69 13183 continue;
jpayne@69 13184 }
jpayne@69 13185 #if !CYTHON_AVOID_BORROWED_REFS
jpayne@69 13186 Py_INCREF(key);
jpayne@69 13187 #endif
jpayne@69 13188 Py_INCREF(value);
jpayne@69 13189 name = first_kw_arg;
jpayne@69 13190 #if PY_MAJOR_VERSION < 3
jpayne@69 13191 if (likely(PyString_Check(key))) {
jpayne@69 13192 while (*name) {
jpayne@69 13193 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
jpayne@69 13194 && _PyString_Eq(**name, key)) {
jpayne@69 13195 values[name-argnames] = value;
jpayne@69 13196 #if CYTHON_AVOID_BORROWED_REFS
jpayne@69 13197 value = NULL;
jpayne@69 13198 #endif
jpayne@69 13199 break;
jpayne@69 13200 }
jpayne@69 13201 name++;
jpayne@69 13202 }
jpayne@69 13203 if (*name) continue;
jpayne@69 13204 else {
jpayne@69 13205 PyObject*** argname = argnames;
jpayne@69 13206 while (argname != first_kw_arg) {
jpayne@69 13207 if ((**argname == key) || (
jpayne@69 13208 (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
jpayne@69 13209 && _PyString_Eq(**argname, key))) {
jpayne@69 13210 goto arg_passed_twice;
jpayne@69 13211 }
jpayne@69 13212 argname++;
jpayne@69 13213 }
jpayne@69 13214 }
jpayne@69 13215 } else
jpayne@69 13216 #endif
jpayne@69 13217 if (likely(PyUnicode_Check(key))) {
jpayne@69 13218 while (*name) {
jpayne@69 13219 int cmp = (
jpayne@69 13220 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
jpayne@69 13221 (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
jpayne@69 13222 #endif
jpayne@69 13223 PyUnicode_Compare(**name, key)
jpayne@69 13224 );
jpayne@69 13225 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
jpayne@69 13226 if (cmp == 0) {
jpayne@69 13227 values[name-argnames] = value;
jpayne@69 13228 #if CYTHON_AVOID_BORROWED_REFS
jpayne@69 13229 value = NULL;
jpayne@69 13230 #endif
jpayne@69 13231 break;
jpayne@69 13232 }
jpayne@69 13233 name++;
jpayne@69 13234 }
jpayne@69 13235 if (*name) continue;
jpayne@69 13236 else {
jpayne@69 13237 PyObject*** argname = argnames;
jpayne@69 13238 while (argname != first_kw_arg) {
jpayne@69 13239 int cmp = (**argname == key) ? 0 :
jpayne@69 13240 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
jpayne@69 13241 (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
jpayne@69 13242 #endif
jpayne@69 13243 PyUnicode_Compare(**argname, key);
jpayne@69 13244 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
jpayne@69 13245 if (cmp == 0) goto arg_passed_twice;
jpayne@69 13246 argname++;
jpayne@69 13247 }
jpayne@69 13248 }
jpayne@69 13249 } else
jpayne@69 13250 goto invalid_keyword_type;
jpayne@69 13251 if (kwds2) {
jpayne@69 13252 if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
jpayne@69 13253 } else {
jpayne@69 13254 goto invalid_keyword;
jpayne@69 13255 }
jpayne@69 13256 }
jpayne@69 13257 Py_XDECREF(key);
jpayne@69 13258 Py_XDECREF(value);
jpayne@69 13259 return 0;
jpayne@69 13260 arg_passed_twice:
jpayne@69 13261 __Pyx_RaiseDoubleKeywordsError(function_name, key);
jpayne@69 13262 goto bad;
jpayne@69 13263 invalid_keyword_type:
jpayne@69 13264 PyErr_Format(PyExc_TypeError,
jpayne@69 13265 "%.200s() keywords must be strings", function_name);
jpayne@69 13266 goto bad;
jpayne@69 13267 invalid_keyword:
jpayne@69 13268 #if PY_MAJOR_VERSION < 3
jpayne@69 13269 PyErr_Format(PyExc_TypeError,
jpayne@69 13270 "%.200s() got an unexpected keyword argument '%.200s'",
jpayne@69 13271 function_name, PyString_AsString(key));
jpayne@69 13272 #else
jpayne@69 13273 PyErr_Format(PyExc_TypeError,
jpayne@69 13274 "%s() got an unexpected keyword argument '%U'",
jpayne@69 13275 function_name, key);
jpayne@69 13276 #endif
jpayne@69 13277 bad:
jpayne@69 13278 Py_XDECREF(key);
jpayne@69 13279 Py_XDECREF(value);
jpayne@69 13280 return -1;
jpayne@69 13281 }
jpayne@69 13282
jpayne@69 13283 /* RaiseArgTupleInvalid */
jpayne@69 13284 static void __Pyx_RaiseArgtupleInvalid(
jpayne@69 13285 const char* func_name,
jpayne@69 13286 int exact,
jpayne@69 13287 Py_ssize_t num_min,
jpayne@69 13288 Py_ssize_t num_max,
jpayne@69 13289 Py_ssize_t num_found)
jpayne@69 13290 {
jpayne@69 13291 Py_ssize_t num_expected;
jpayne@69 13292 const char *more_or_less;
jpayne@69 13293 if (num_found < num_min) {
jpayne@69 13294 num_expected = num_min;
jpayne@69 13295 more_or_less = "at least";
jpayne@69 13296 } else {
jpayne@69 13297 num_expected = num_max;
jpayne@69 13298 more_or_less = "at most";
jpayne@69 13299 }
jpayne@69 13300 if (exact) {
jpayne@69 13301 more_or_less = "exactly";
jpayne@69 13302 }
jpayne@69 13303 PyErr_Format(PyExc_TypeError,
jpayne@69 13304 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
jpayne@69 13305 func_name, more_or_less, num_expected,
jpayne@69 13306 (num_expected == 1) ? "" : "s", num_found);
jpayne@69 13307 }
jpayne@69 13308
jpayne@69 13309 /* GetItemInt */
jpayne@69 13310 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
jpayne@69 13311 PyObject *r;
jpayne@69 13312 if (unlikely(!j)) return NULL;
jpayne@69 13313 r = PyObject_GetItem(o, j);
jpayne@69 13314 Py_DECREF(j);
jpayne@69 13315 return r;
jpayne@69 13316 }
jpayne@69 13317 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
jpayne@69 13318 CYTHON_NCP_UNUSED int wraparound,
jpayne@69 13319 CYTHON_NCP_UNUSED int boundscheck) {
jpayne@69 13320 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
jpayne@69 13321 Py_ssize_t wrapped_i = i;
jpayne@69 13322 if (wraparound & unlikely(i < 0)) {
jpayne@69 13323 wrapped_i += PyList_GET_SIZE(o);
jpayne@69 13324 }
jpayne@69 13325 if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
jpayne@69 13326 PyObject *r = PyList_GET_ITEM(o, wrapped_i);
jpayne@69 13327 Py_INCREF(r);
jpayne@69 13328 return r;
jpayne@69 13329 }
jpayne@69 13330 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
jpayne@69 13331 #else
jpayne@69 13332 return PySequence_GetItem(o, i);
jpayne@69 13333 #endif
jpayne@69 13334 }
jpayne@69 13335 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
jpayne@69 13336 CYTHON_NCP_UNUSED int wraparound,
jpayne@69 13337 CYTHON_NCP_UNUSED int boundscheck) {
jpayne@69 13338 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
jpayne@69 13339 Py_ssize_t wrapped_i = i;
jpayne@69 13340 if (wraparound & unlikely(i < 0)) {
jpayne@69 13341 wrapped_i += PyTuple_GET_SIZE(o);
jpayne@69 13342 }
jpayne@69 13343 if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
jpayne@69 13344 PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
jpayne@69 13345 Py_INCREF(r);
jpayne@69 13346 return r;
jpayne@69 13347 }
jpayne@69 13348 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
jpayne@69 13349 #else
jpayne@69 13350 return PySequence_GetItem(o, i);
jpayne@69 13351 #endif
jpayne@69 13352 }
jpayne@69 13353 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
jpayne@69 13354 CYTHON_NCP_UNUSED int wraparound,
jpayne@69 13355 CYTHON_NCP_UNUSED int boundscheck) {
jpayne@69 13356 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
jpayne@69 13357 if (is_list || PyList_CheckExact(o)) {
jpayne@69 13358 Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
jpayne@69 13359 if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
jpayne@69 13360 PyObject *r = PyList_GET_ITEM(o, n);
jpayne@69 13361 Py_INCREF(r);
jpayne@69 13362 return r;
jpayne@69 13363 }
jpayne@69 13364 }
jpayne@69 13365 else if (PyTuple_CheckExact(o)) {
jpayne@69 13366 Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
jpayne@69 13367 if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
jpayne@69 13368 PyObject *r = PyTuple_GET_ITEM(o, n);
jpayne@69 13369 Py_INCREF(r);
jpayne@69 13370 return r;
jpayne@69 13371 }
jpayne@69 13372 } else {
jpayne@69 13373 PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping;
jpayne@69 13374 PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence;
jpayne@69 13375 if (mm && mm->mp_subscript) {
jpayne@69 13376 PyObject *r, *key = PyInt_FromSsize_t(i);
jpayne@69 13377 if (unlikely(!key)) return NULL;
jpayne@69 13378 r = mm->mp_subscript(o, key);
jpayne@69 13379 Py_DECREF(key);
jpayne@69 13380 return r;
jpayne@69 13381 }
jpayne@69 13382 if (likely(sm && sm->sq_item)) {
jpayne@69 13383 if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) {
jpayne@69 13384 Py_ssize_t l = sm->sq_length(o);
jpayne@69 13385 if (likely(l >= 0)) {
jpayne@69 13386 i += l;
jpayne@69 13387 } else {
jpayne@69 13388 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
jpayne@69 13389 return NULL;
jpayne@69 13390 PyErr_Clear();
jpayne@69 13391 }
jpayne@69 13392 }
jpayne@69 13393 return sm->sq_item(o, i);
jpayne@69 13394 }
jpayne@69 13395 }
jpayne@69 13396 #else
jpayne@69 13397 if (is_list || !PyMapping_Check(o)) {
jpayne@69 13398 return PySequence_GetItem(o, i);
jpayne@69 13399 }
jpayne@69 13400 #endif
jpayne@69 13401 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
jpayne@69 13402 }
jpayne@69 13403
jpayne@69 13404 /* SetItemInt */
jpayne@69 13405 static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) {
jpayne@69 13406 int r;
jpayne@69 13407 if (unlikely(!j)) return -1;
jpayne@69 13408 r = PyObject_SetItem(o, j, v);
jpayne@69 13409 Py_DECREF(j);
jpayne@69 13410 return r;
jpayne@69 13411 }
jpayne@69 13412 static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list,
jpayne@69 13413 CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) {
jpayne@69 13414 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
jpayne@69 13415 if (is_list || PyList_CheckExact(o)) {
jpayne@69 13416 Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o));
jpayne@69 13417 if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o)))) {
jpayne@69 13418 PyObject* old = PyList_GET_ITEM(o, n);
jpayne@69 13419 Py_INCREF(v);
jpayne@69 13420 PyList_SET_ITEM(o, n, v);
jpayne@69 13421 Py_DECREF(old);
jpayne@69 13422 return 1;
jpayne@69 13423 }
jpayne@69 13424 } else {
jpayne@69 13425 PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping;
jpayne@69 13426 PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence;
jpayne@69 13427 if (mm && mm->mp_ass_subscript) {
jpayne@69 13428 int r;
jpayne@69 13429 PyObject *key = PyInt_FromSsize_t(i);
jpayne@69 13430 if (unlikely(!key)) return -1;
jpayne@69 13431 r = mm->mp_ass_subscript(o, key, v);
jpayne@69 13432 Py_DECREF(key);
jpayne@69 13433 return r;
jpayne@69 13434 }
jpayne@69 13435 if (likely(sm && sm->sq_ass_item)) {
jpayne@69 13436 if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) {
jpayne@69 13437 Py_ssize_t l = sm->sq_length(o);
jpayne@69 13438 if (likely(l >= 0)) {
jpayne@69 13439 i += l;
jpayne@69 13440 } else {
jpayne@69 13441 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
jpayne@69 13442 return -1;
jpayne@69 13443 PyErr_Clear();
jpayne@69 13444 }
jpayne@69 13445 }
jpayne@69 13446 return sm->sq_ass_item(o, i, v);
jpayne@69 13447 }
jpayne@69 13448 }
jpayne@69 13449 #else
jpayne@69 13450 if (is_list || !PyMapping_Check(o))
jpayne@69 13451 {
jpayne@69 13452 return PySequence_SetItem(o, i, v);
jpayne@69 13453 }
jpayne@69 13454 #endif
jpayne@69 13455 return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v);
jpayne@69 13456 }
jpayne@69 13457
jpayne@69 13458 /* PyFunctionFastCall */
jpayne@69 13459 #if CYTHON_FAST_PYCALL && !CYTHON_VECTORCALL
jpayne@69 13460 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
jpayne@69 13461 PyObject *globals) {
jpayne@69 13462 PyFrameObject *f;
jpayne@69 13463 PyThreadState *tstate = __Pyx_PyThreadState_Current;
jpayne@69 13464 PyObject **fastlocals;
jpayne@69 13465 Py_ssize_t i;
jpayne@69 13466 PyObject *result;
jpayne@69 13467 assert(globals != NULL);
jpayne@69 13468 /* XXX Perhaps we should create a specialized
jpayne@69 13469 PyFrame_New() that doesn't take locals, but does
jpayne@69 13470 take builtins without sanity checking them.
jpayne@69 13471 */
jpayne@69 13472 assert(tstate != NULL);
jpayne@69 13473 f = PyFrame_New(tstate, co, globals, NULL);
jpayne@69 13474 if (f == NULL) {
jpayne@69 13475 return NULL;
jpayne@69 13476 }
jpayne@69 13477 fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
jpayne@69 13478 for (i = 0; i < na; i++) {
jpayne@69 13479 Py_INCREF(*args);
jpayne@69 13480 fastlocals[i] = *args++;
jpayne@69 13481 }
jpayne@69 13482 result = PyEval_EvalFrameEx(f,0);
jpayne@69 13483 ++tstate->recursion_depth;
jpayne@69 13484 Py_DECREF(f);
jpayne@69 13485 --tstate->recursion_depth;
jpayne@69 13486 return result;
jpayne@69 13487 }
jpayne@69 13488 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
jpayne@69 13489 PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
jpayne@69 13490 PyObject *globals = PyFunction_GET_GLOBALS(func);
jpayne@69 13491 PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
jpayne@69 13492 PyObject *closure;
jpayne@69 13493 #if PY_MAJOR_VERSION >= 3
jpayne@69 13494 PyObject *kwdefs;
jpayne@69 13495 #endif
jpayne@69 13496 PyObject *kwtuple, **k;
jpayne@69 13497 PyObject **d;
jpayne@69 13498 Py_ssize_t nd;
jpayne@69 13499 Py_ssize_t nk;
jpayne@69 13500 PyObject *result;
jpayne@69 13501 assert(kwargs == NULL || PyDict_Check(kwargs));
jpayne@69 13502 nk = kwargs ? PyDict_Size(kwargs) : 0;
jpayne@69 13503 #if PY_MAJOR_VERSION < 3
jpayne@69 13504 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) {
jpayne@69 13505 return NULL;
jpayne@69 13506 }
jpayne@69 13507 #else
jpayne@69 13508 if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) {
jpayne@69 13509 return NULL;
jpayne@69 13510 }
jpayne@69 13511 #endif
jpayne@69 13512 if (
jpayne@69 13513 #if PY_MAJOR_VERSION >= 3
jpayne@69 13514 co->co_kwonlyargcount == 0 &&
jpayne@69 13515 #endif
jpayne@69 13516 likely(kwargs == NULL || nk == 0) &&
jpayne@69 13517 co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
jpayne@69 13518 if (argdefs == NULL && co->co_argcount == nargs) {
jpayne@69 13519 result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
jpayne@69 13520 goto done;
jpayne@69 13521 }
jpayne@69 13522 else if (nargs == 0 && argdefs != NULL
jpayne@69 13523 && co->co_argcount == Py_SIZE(argdefs)) {
jpayne@69 13524 /* function called with no arguments, but all parameters have
jpayne@69 13525 a default value: use default values as arguments .*/
jpayne@69 13526 args = &PyTuple_GET_ITEM(argdefs, 0);
jpayne@69 13527 result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
jpayne@69 13528 goto done;
jpayne@69 13529 }
jpayne@69 13530 }
jpayne@69 13531 if (kwargs != NULL) {
jpayne@69 13532 Py_ssize_t pos, i;
jpayne@69 13533 kwtuple = PyTuple_New(2 * nk);
jpayne@69 13534 if (kwtuple == NULL) {
jpayne@69 13535 result = NULL;
jpayne@69 13536 goto done;
jpayne@69 13537 }
jpayne@69 13538 k = &PyTuple_GET_ITEM(kwtuple, 0);
jpayne@69 13539 pos = i = 0;
jpayne@69 13540 while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
jpayne@69 13541 Py_INCREF(k[i]);
jpayne@69 13542 Py_INCREF(k[i+1]);
jpayne@69 13543 i += 2;
jpayne@69 13544 }
jpayne@69 13545 nk = i / 2;
jpayne@69 13546 }
jpayne@69 13547 else {
jpayne@69 13548 kwtuple = NULL;
jpayne@69 13549 k = NULL;
jpayne@69 13550 }
jpayne@69 13551 closure = PyFunction_GET_CLOSURE(func);
jpayne@69 13552 #if PY_MAJOR_VERSION >= 3
jpayne@69 13553 kwdefs = PyFunction_GET_KW_DEFAULTS(func);
jpayne@69 13554 #endif
jpayne@69 13555 if (argdefs != NULL) {
jpayne@69 13556 d = &PyTuple_GET_ITEM(argdefs, 0);
jpayne@69 13557 nd = Py_SIZE(argdefs);
jpayne@69 13558 }
jpayne@69 13559 else {
jpayne@69 13560 d = NULL;
jpayne@69 13561 nd = 0;
jpayne@69 13562 }
jpayne@69 13563 #if PY_MAJOR_VERSION >= 3
jpayne@69 13564 result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
jpayne@69 13565 args, (int)nargs,
jpayne@69 13566 k, (int)nk,
jpayne@69 13567 d, (int)nd, kwdefs, closure);
jpayne@69 13568 #else
jpayne@69 13569 result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
jpayne@69 13570 args, (int)nargs,
jpayne@69 13571 k, (int)nk,
jpayne@69 13572 d, (int)nd, closure);
jpayne@69 13573 #endif
jpayne@69 13574 Py_XDECREF(kwtuple);
jpayne@69 13575 done:
jpayne@69 13576 Py_LeaveRecursiveCall();
jpayne@69 13577 return result;
jpayne@69 13578 }
jpayne@69 13579 #endif
jpayne@69 13580
jpayne@69 13581 /* PyObjectCallMethO */
jpayne@69 13582 #if CYTHON_COMPILING_IN_CPYTHON
jpayne@69 13583 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
jpayne@69 13584 PyObject *self, *result;
jpayne@69 13585 PyCFunction cfunc;
jpayne@69 13586 cfunc = __Pyx_CyOrPyCFunction_GET_FUNCTION(func);
jpayne@69 13587 self = __Pyx_CyOrPyCFunction_GET_SELF(func);
jpayne@69 13588 #if PY_MAJOR_VERSION < 3
jpayne@69 13589 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
jpayne@69 13590 return NULL;
jpayne@69 13591 #else
jpayne@69 13592 if (unlikely(Py_EnterRecursiveCall(" while calling a Python object")))
jpayne@69 13593 return NULL;
jpayne@69 13594 #endif
jpayne@69 13595 result = cfunc(self, arg);
jpayne@69 13596 Py_LeaveRecursiveCall();
jpayne@69 13597 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
jpayne@69 13598 PyErr_SetString(
jpayne@69 13599 PyExc_SystemError,
jpayne@69 13600 "NULL result without error in PyObject_Call");
jpayne@69 13601 }
jpayne@69 13602 return result;
jpayne@69 13603 }
jpayne@69 13604 #endif
jpayne@69 13605
jpayne@69 13606 /* PyObjectFastCall */
jpayne@69 13607 #if PY_VERSION_HEX < 0x03090000 || CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 13608 static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs) {
jpayne@69 13609 PyObject *argstuple;
jpayne@69 13610 PyObject *result = 0;
jpayne@69 13611 size_t i;
jpayne@69 13612 argstuple = PyTuple_New((Py_ssize_t)nargs);
jpayne@69 13613 if (unlikely(!argstuple)) return NULL;
jpayne@69 13614 for (i = 0; i < nargs; i++) {
jpayne@69 13615 Py_INCREF(args[i]);
jpayne@69 13616 if (__Pyx_PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]) < 0) goto bad;
jpayne@69 13617 }
jpayne@69 13618 result = __Pyx_PyObject_Call(func, argstuple, kwargs);
jpayne@69 13619 bad:
jpayne@69 13620 Py_DECREF(argstuple);
jpayne@69 13621 return result;
jpayne@69 13622 }
jpayne@69 13623 #endif
jpayne@69 13624 static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t _nargs, PyObject *kwargs) {
jpayne@69 13625 Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs);
jpayne@69 13626 #if CYTHON_COMPILING_IN_CPYTHON
jpayne@69 13627 if (nargs == 0 && kwargs == NULL) {
jpayne@69 13628 if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_NOARGS))
jpayne@69 13629 return __Pyx_PyObject_CallMethO(func, NULL);
jpayne@69 13630 }
jpayne@69 13631 else if (nargs == 1 && kwargs == NULL) {
jpayne@69 13632 if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_O))
jpayne@69 13633 return __Pyx_PyObject_CallMethO(func, args[0]);
jpayne@69 13634 }
jpayne@69 13635 #endif
jpayne@69 13636 #if PY_VERSION_HEX < 0x030800B1
jpayne@69 13637 #if CYTHON_FAST_PYCCALL
jpayne@69 13638 if (PyCFunction_Check(func)) {
jpayne@69 13639 if (kwargs) {
jpayne@69 13640 return _PyCFunction_FastCallDict(func, args, nargs, kwargs);
jpayne@69 13641 } else {
jpayne@69 13642 return _PyCFunction_FastCallKeywords(func, args, nargs, NULL);
jpayne@69 13643 }
jpayne@69 13644 }
jpayne@69 13645 #if PY_VERSION_HEX >= 0x030700A1
jpayne@69 13646 if (!kwargs && __Pyx_IS_TYPE(func, &PyMethodDescr_Type)) {
jpayne@69 13647 return _PyMethodDescr_FastCallKeywords(func, args, nargs, NULL);
jpayne@69 13648 }
jpayne@69 13649 #endif
jpayne@69 13650 #endif
jpayne@69 13651 #if CYTHON_FAST_PYCALL
jpayne@69 13652 if (PyFunction_Check(func)) {
jpayne@69 13653 return __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs);
jpayne@69 13654 }
jpayne@69 13655 #endif
jpayne@69 13656 #endif
jpayne@69 13657 if (kwargs == NULL) {
jpayne@69 13658 #if CYTHON_VECTORCALL
jpayne@69 13659 #if PY_VERSION_HEX < 0x03090000
jpayne@69 13660 vectorcallfunc f = _PyVectorcall_Function(func);
jpayne@69 13661 #else
jpayne@69 13662 vectorcallfunc f = PyVectorcall_Function(func);
jpayne@69 13663 #endif
jpayne@69 13664 if (f) {
jpayne@69 13665 return f(func, args, (size_t)nargs, NULL);
jpayne@69 13666 }
jpayne@69 13667 #elif defined(__Pyx_CyFunction_USED) && CYTHON_BACKPORT_VECTORCALL
jpayne@69 13668 if (__Pyx_CyFunction_CheckExact(func)) {
jpayne@69 13669 __pyx_vectorcallfunc f = __Pyx_CyFunction_func_vectorcall(func);
jpayne@69 13670 if (f) return f(func, args, (size_t)nargs, NULL);
jpayne@69 13671 }
jpayne@69 13672 #endif
jpayne@69 13673 }
jpayne@69 13674 if (nargs == 0) {
jpayne@69 13675 return __Pyx_PyObject_Call(func, __pyx_empty_tuple, kwargs);
jpayne@69 13676 }
jpayne@69 13677 #if PY_VERSION_HEX >= 0x03090000 && !CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 13678 return PyObject_VectorcallDict(func, args, (size_t)nargs, kwargs);
jpayne@69 13679 #else
jpayne@69 13680 return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs);
jpayne@69 13681 #endif
jpayne@69 13682 }
jpayne@69 13683
jpayne@69 13684 /* ArgTypeTest */
jpayne@69 13685 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
jpayne@69 13686 {
jpayne@69 13687 __Pyx_TypeName type_name;
jpayne@69 13688 __Pyx_TypeName obj_type_name;
jpayne@69 13689 if (unlikely(!type)) {
jpayne@69 13690 PyErr_SetString(PyExc_SystemError, "Missing type object");
jpayne@69 13691 return 0;
jpayne@69 13692 }
jpayne@69 13693 else if (exact) {
jpayne@69 13694 #if PY_MAJOR_VERSION == 2
jpayne@69 13695 if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
jpayne@69 13696 #endif
jpayne@69 13697 }
jpayne@69 13698 else {
jpayne@69 13699 if (likely(__Pyx_TypeCheck(obj, type))) return 1;
jpayne@69 13700 }
jpayne@69 13701 type_name = __Pyx_PyType_GetName(type);
jpayne@69 13702 obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj));
jpayne@69 13703 PyErr_Format(PyExc_TypeError,
jpayne@69 13704 "Argument '%.200s' has incorrect type (expected " __Pyx_FMT_TYPENAME
jpayne@69 13705 ", got " __Pyx_FMT_TYPENAME ")", name, type_name, obj_type_name);
jpayne@69 13706 __Pyx_DECREF_TypeName(type_name);
jpayne@69 13707 __Pyx_DECREF_TypeName(obj_type_name);
jpayne@69 13708 return 0;
jpayne@69 13709 }
jpayne@69 13710
jpayne@69 13711 /* ExtTypeTest */
jpayne@69 13712 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
jpayne@69 13713 __Pyx_TypeName obj_type_name;
jpayne@69 13714 __Pyx_TypeName type_name;
jpayne@69 13715 if (unlikely(!type)) {
jpayne@69 13716 PyErr_SetString(PyExc_SystemError, "Missing type object");
jpayne@69 13717 return 0;
jpayne@69 13718 }
jpayne@69 13719 if (likely(__Pyx_TypeCheck(obj, type)))
jpayne@69 13720 return 1;
jpayne@69 13721 obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj));
jpayne@69 13722 type_name = __Pyx_PyType_GetName(type);
jpayne@69 13723 PyErr_Format(PyExc_TypeError,
jpayne@69 13724 "Cannot convert " __Pyx_FMT_TYPENAME " to " __Pyx_FMT_TYPENAME,
jpayne@69 13725 obj_type_name, type_name);
jpayne@69 13726 __Pyx_DECREF_TypeName(obj_type_name);
jpayne@69 13727 __Pyx_DECREF_TypeName(type_name);
jpayne@69 13728 return 0;
jpayne@69 13729 }
jpayne@69 13730
jpayne@69 13731 /* PyObjectCallOneArg */
jpayne@69 13732 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
jpayne@69 13733 PyObject *args[2] = {NULL, arg};
jpayne@69 13734 return __Pyx_PyObject_FastCall(func, args+1, 1 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
jpayne@69 13735 }
jpayne@69 13736
jpayne@69 13737 /* ObjectGetItem */
jpayne@69 13738 #if CYTHON_USE_TYPE_SLOTS
jpayne@69 13739 static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject *index) {
jpayne@69 13740 PyObject *runerr = NULL;
jpayne@69 13741 Py_ssize_t key_value;
jpayne@69 13742 key_value = __Pyx_PyIndex_AsSsize_t(index);
jpayne@69 13743 if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
jpayne@69 13744 return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
jpayne@69 13745 }
jpayne@69 13746 if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
jpayne@69 13747 __Pyx_TypeName index_type_name = __Pyx_PyType_GetName(Py_TYPE(index));
jpayne@69 13748 PyErr_Clear();
jpayne@69 13749 PyErr_Format(PyExc_IndexError,
jpayne@69 13750 "cannot fit '" __Pyx_FMT_TYPENAME "' into an index-sized integer", index_type_name);
jpayne@69 13751 __Pyx_DECREF_TypeName(index_type_name);
jpayne@69 13752 }
jpayne@69 13753 return NULL;
jpayne@69 13754 }
jpayne@69 13755 static PyObject *__Pyx_PyObject_GetItem_Slow(PyObject *obj, PyObject *key) {
jpayne@69 13756 __Pyx_TypeName obj_type_name;
jpayne@69 13757 if (likely(PyType_Check(obj))) {
jpayne@69 13758 PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(obj, __pyx_n_s_class_getitem);
jpayne@69 13759 if (!meth) {
jpayne@69 13760 PyErr_Clear();
jpayne@69 13761 } else {
jpayne@69 13762 PyObject *result = __Pyx_PyObject_CallOneArg(meth, key);
jpayne@69 13763 Py_DECREF(meth);
jpayne@69 13764 return result;
jpayne@69 13765 }
jpayne@69 13766 }
jpayne@69 13767 obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj));
jpayne@69 13768 PyErr_Format(PyExc_TypeError,
jpayne@69 13769 "'" __Pyx_FMT_TYPENAME "' object is not subscriptable", obj_type_name);
jpayne@69 13770 __Pyx_DECREF_TypeName(obj_type_name);
jpayne@69 13771 return NULL;
jpayne@69 13772 }
jpayne@69 13773 static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key) {
jpayne@69 13774 PyTypeObject *tp = Py_TYPE(obj);
jpayne@69 13775 PyMappingMethods *mm = tp->tp_as_mapping;
jpayne@69 13776 PySequenceMethods *sm = tp->tp_as_sequence;
jpayne@69 13777 if (likely(mm && mm->mp_subscript)) {
jpayne@69 13778 return mm->mp_subscript(obj, key);
jpayne@69 13779 }
jpayne@69 13780 if (likely(sm && sm->sq_item)) {
jpayne@69 13781 return __Pyx_PyObject_GetIndex(obj, key);
jpayne@69 13782 }
jpayne@69 13783 return __Pyx_PyObject_GetItem_Slow(obj, key);
jpayne@69 13784 }
jpayne@69 13785 #endif
jpayne@69 13786
jpayne@69 13787 /* RaiseUnexpectedTypeError */
jpayne@69 13788 static int
jpayne@69 13789 __Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj)
jpayne@69 13790 {
jpayne@69 13791 __Pyx_TypeName obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj));
jpayne@69 13792 PyErr_Format(PyExc_TypeError, "Expected %s, got " __Pyx_FMT_TYPENAME,
jpayne@69 13793 expected, obj_type_name);
jpayne@69 13794 __Pyx_DECREF_TypeName(obj_type_name);
jpayne@69 13795 return 0;
jpayne@69 13796 }
jpayne@69 13797
jpayne@69 13798 /* PyDictVersioning */
jpayne@69 13799 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
jpayne@69 13800 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
jpayne@69 13801 PyObject *dict = Py_TYPE(obj)->tp_dict;
jpayne@69 13802 return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
jpayne@69 13803 }
jpayne@69 13804 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
jpayne@69 13805 PyObject **dictptr = NULL;
jpayne@69 13806 Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
jpayne@69 13807 if (offset) {
jpayne@69 13808 #if CYTHON_COMPILING_IN_CPYTHON
jpayne@69 13809 dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
jpayne@69 13810 #else
jpayne@69 13811 dictptr = _PyObject_GetDictPtr(obj);
jpayne@69 13812 #endif
jpayne@69 13813 }
jpayne@69 13814 return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
jpayne@69 13815 }
jpayne@69 13816 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
jpayne@69 13817 PyObject *dict = Py_TYPE(obj)->tp_dict;
jpayne@69 13818 if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
jpayne@69 13819 return 0;
jpayne@69 13820 return obj_dict_version == __Pyx_get_object_dict_version(obj);
jpayne@69 13821 }
jpayne@69 13822 #endif
jpayne@69 13823
jpayne@69 13824 /* GetModuleGlobalName */
jpayne@69 13825 #if CYTHON_USE_DICT_VERSIONS
jpayne@69 13826 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
jpayne@69 13827 #else
jpayne@69 13828 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
jpayne@69 13829 #endif
jpayne@69 13830 {
jpayne@69 13831 PyObject *result;
jpayne@69 13832 #if !CYTHON_AVOID_BORROWED_REFS
jpayne@69 13833 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && PY_VERSION_HEX < 0x030d0000
jpayne@69 13834 result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
jpayne@69 13835 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
jpayne@69 13836 if (likely(result)) {
jpayne@69 13837 return __Pyx_NewRef(result);
jpayne@69 13838 } else if (unlikely(PyErr_Occurred())) {
jpayne@69 13839 return NULL;
jpayne@69 13840 }
jpayne@69 13841 #elif CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 13842 if (unlikely(!__pyx_m)) {
jpayne@69 13843 return NULL;
jpayne@69 13844 }
jpayne@69 13845 result = PyObject_GetAttr(__pyx_m, name);
jpayne@69 13846 if (likely(result)) {
jpayne@69 13847 return result;
jpayne@69 13848 }
jpayne@69 13849 #else
jpayne@69 13850 result = PyDict_GetItem(__pyx_d, name);
jpayne@69 13851 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
jpayne@69 13852 if (likely(result)) {
jpayne@69 13853 return __Pyx_NewRef(result);
jpayne@69 13854 }
jpayne@69 13855 #endif
jpayne@69 13856 #else
jpayne@69 13857 result = PyObject_GetItem(__pyx_d, name);
jpayne@69 13858 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
jpayne@69 13859 if (likely(result)) {
jpayne@69 13860 return __Pyx_NewRef(result);
jpayne@69 13861 }
jpayne@69 13862 PyErr_Clear();
jpayne@69 13863 #endif
jpayne@69 13864 return __Pyx_GetBuiltinName(name);
jpayne@69 13865 }
jpayne@69 13866
jpayne@69 13867 /* RaiseException */
jpayne@69 13868 #if PY_MAJOR_VERSION < 3
jpayne@69 13869 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
jpayne@69 13870 __Pyx_PyThreadState_declare
jpayne@69 13871 CYTHON_UNUSED_VAR(cause);
jpayne@69 13872 Py_XINCREF(type);
jpayne@69 13873 if (!value || value == Py_None)
jpayne@69 13874 value = NULL;
jpayne@69 13875 else
jpayne@69 13876 Py_INCREF(value);
jpayne@69 13877 if (!tb || tb == Py_None)
jpayne@69 13878 tb = NULL;
jpayne@69 13879 else {
jpayne@69 13880 Py_INCREF(tb);
jpayne@69 13881 if (!PyTraceBack_Check(tb)) {
jpayne@69 13882 PyErr_SetString(PyExc_TypeError,
jpayne@69 13883 "raise: arg 3 must be a traceback or None");
jpayne@69 13884 goto raise_error;
jpayne@69 13885 }
jpayne@69 13886 }
jpayne@69 13887 if (PyType_Check(type)) {
jpayne@69 13888 #if CYTHON_COMPILING_IN_PYPY
jpayne@69 13889 if (!value) {
jpayne@69 13890 Py_INCREF(Py_None);
jpayne@69 13891 value = Py_None;
jpayne@69 13892 }
jpayne@69 13893 #endif
jpayne@69 13894 PyErr_NormalizeException(&type, &value, &tb);
jpayne@69 13895 } else {
jpayne@69 13896 if (value) {
jpayne@69 13897 PyErr_SetString(PyExc_TypeError,
jpayne@69 13898 "instance exception may not have a separate value");
jpayne@69 13899 goto raise_error;
jpayne@69 13900 }
jpayne@69 13901 value = type;
jpayne@69 13902 type = (PyObject*) Py_TYPE(type);
jpayne@69 13903 Py_INCREF(type);
jpayne@69 13904 if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
jpayne@69 13905 PyErr_SetString(PyExc_TypeError,
jpayne@69 13906 "raise: exception class must be a subclass of BaseException");
jpayne@69 13907 goto raise_error;
jpayne@69 13908 }
jpayne@69 13909 }
jpayne@69 13910 __Pyx_PyThreadState_assign
jpayne@69 13911 __Pyx_ErrRestore(type, value, tb);
jpayne@69 13912 return;
jpayne@69 13913 raise_error:
jpayne@69 13914 Py_XDECREF(value);
jpayne@69 13915 Py_XDECREF(type);
jpayne@69 13916 Py_XDECREF(tb);
jpayne@69 13917 return;
jpayne@69 13918 }
jpayne@69 13919 #else
jpayne@69 13920 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
jpayne@69 13921 PyObject* owned_instance = NULL;
jpayne@69 13922 if (tb == Py_None) {
jpayne@69 13923 tb = 0;
jpayne@69 13924 } else if (tb && !PyTraceBack_Check(tb)) {
jpayne@69 13925 PyErr_SetString(PyExc_TypeError,
jpayne@69 13926 "raise: arg 3 must be a traceback or None");
jpayne@69 13927 goto bad;
jpayne@69 13928 }
jpayne@69 13929 if (value == Py_None)
jpayne@69 13930 value = 0;
jpayne@69 13931 if (PyExceptionInstance_Check(type)) {
jpayne@69 13932 if (value) {
jpayne@69 13933 PyErr_SetString(PyExc_TypeError,
jpayne@69 13934 "instance exception may not have a separate value");
jpayne@69 13935 goto bad;
jpayne@69 13936 }
jpayne@69 13937 value = type;
jpayne@69 13938 type = (PyObject*) Py_TYPE(value);
jpayne@69 13939 } else if (PyExceptionClass_Check(type)) {
jpayne@69 13940 PyObject *instance_class = NULL;
jpayne@69 13941 if (value && PyExceptionInstance_Check(value)) {
jpayne@69 13942 instance_class = (PyObject*) Py_TYPE(value);
jpayne@69 13943 if (instance_class != type) {
jpayne@69 13944 int is_subclass = PyObject_IsSubclass(instance_class, type);
jpayne@69 13945 if (!is_subclass) {
jpayne@69 13946 instance_class = NULL;
jpayne@69 13947 } else if (unlikely(is_subclass == -1)) {
jpayne@69 13948 goto bad;
jpayne@69 13949 } else {
jpayne@69 13950 type = instance_class;
jpayne@69 13951 }
jpayne@69 13952 }
jpayne@69 13953 }
jpayne@69 13954 if (!instance_class) {
jpayne@69 13955 PyObject *args;
jpayne@69 13956 if (!value)
jpayne@69 13957 args = PyTuple_New(0);
jpayne@69 13958 else if (PyTuple_Check(value)) {
jpayne@69 13959 Py_INCREF(value);
jpayne@69 13960 args = value;
jpayne@69 13961 } else
jpayne@69 13962 args = PyTuple_Pack(1, value);
jpayne@69 13963 if (!args)
jpayne@69 13964 goto bad;
jpayne@69 13965 owned_instance = PyObject_Call(type, args, NULL);
jpayne@69 13966 Py_DECREF(args);
jpayne@69 13967 if (!owned_instance)
jpayne@69 13968 goto bad;
jpayne@69 13969 value = owned_instance;
jpayne@69 13970 if (!PyExceptionInstance_Check(value)) {
jpayne@69 13971 PyErr_Format(PyExc_TypeError,
jpayne@69 13972 "calling %R should have returned an instance of "
jpayne@69 13973 "BaseException, not %R",
jpayne@69 13974 type, Py_TYPE(value));
jpayne@69 13975 goto bad;
jpayne@69 13976 }
jpayne@69 13977 }
jpayne@69 13978 } else {
jpayne@69 13979 PyErr_SetString(PyExc_TypeError,
jpayne@69 13980 "raise: exception class must be a subclass of BaseException");
jpayne@69 13981 goto bad;
jpayne@69 13982 }
jpayne@69 13983 if (cause) {
jpayne@69 13984 PyObject *fixed_cause;
jpayne@69 13985 if (cause == Py_None) {
jpayne@69 13986 fixed_cause = NULL;
jpayne@69 13987 } else if (PyExceptionClass_Check(cause)) {
jpayne@69 13988 fixed_cause = PyObject_CallObject(cause, NULL);
jpayne@69 13989 if (fixed_cause == NULL)
jpayne@69 13990 goto bad;
jpayne@69 13991 } else if (PyExceptionInstance_Check(cause)) {
jpayne@69 13992 fixed_cause = cause;
jpayne@69 13993 Py_INCREF(fixed_cause);
jpayne@69 13994 } else {
jpayne@69 13995 PyErr_SetString(PyExc_TypeError,
jpayne@69 13996 "exception causes must derive from "
jpayne@69 13997 "BaseException");
jpayne@69 13998 goto bad;
jpayne@69 13999 }
jpayne@69 14000 PyException_SetCause(value, fixed_cause);
jpayne@69 14001 }
jpayne@69 14002 PyErr_SetObject(type, value);
jpayne@69 14003 if (tb) {
jpayne@69 14004 #if PY_VERSION_HEX >= 0x030C00A6
jpayne@69 14005 PyException_SetTraceback(value, tb);
jpayne@69 14006 #elif CYTHON_FAST_THREAD_STATE
jpayne@69 14007 PyThreadState *tstate = __Pyx_PyThreadState_Current;
jpayne@69 14008 PyObject* tmp_tb = tstate->curexc_traceback;
jpayne@69 14009 if (tb != tmp_tb) {
jpayne@69 14010 Py_INCREF(tb);
jpayne@69 14011 tstate->curexc_traceback = tb;
jpayne@69 14012 Py_XDECREF(tmp_tb);
jpayne@69 14013 }
jpayne@69 14014 #else
jpayne@69 14015 PyObject *tmp_type, *tmp_value, *tmp_tb;
jpayne@69 14016 PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
jpayne@69 14017 Py_INCREF(tb);
jpayne@69 14018 PyErr_Restore(tmp_type, tmp_value, tb);
jpayne@69 14019 Py_XDECREF(tmp_tb);
jpayne@69 14020 #endif
jpayne@69 14021 }
jpayne@69 14022 bad:
jpayne@69 14023 Py_XDECREF(owned_instance);
jpayne@69 14024 return;
jpayne@69 14025 }
jpayne@69 14026 #endif
jpayne@69 14027
jpayne@69 14028 /* GetTopmostException */
jpayne@69 14029 #if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE
jpayne@69 14030 static _PyErr_StackItem *
jpayne@69 14031 __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
jpayne@69 14032 {
jpayne@69 14033 _PyErr_StackItem *exc_info = tstate->exc_info;
jpayne@69 14034 while ((exc_info->exc_value == NULL || exc_info->exc_value == Py_None) &&
jpayne@69 14035 exc_info->previous_item != NULL)
jpayne@69 14036 {
jpayne@69 14037 exc_info = exc_info->previous_item;
jpayne@69 14038 }
jpayne@69 14039 return exc_info;
jpayne@69 14040 }
jpayne@69 14041 #endif
jpayne@69 14042
jpayne@69 14043 /* SaveResetException */
jpayne@69 14044 #if CYTHON_FAST_THREAD_STATE
jpayne@69 14045 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
jpayne@69 14046 #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4
jpayne@69 14047 _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
jpayne@69 14048 PyObject *exc_value = exc_info->exc_value;
jpayne@69 14049 if (exc_value == NULL || exc_value == Py_None) {
jpayne@69 14050 *value = NULL;
jpayne@69 14051 *type = NULL;
jpayne@69 14052 *tb = NULL;
jpayne@69 14053 } else {
jpayne@69 14054 *value = exc_value;
jpayne@69 14055 Py_INCREF(*value);
jpayne@69 14056 *type = (PyObject*) Py_TYPE(exc_value);
jpayne@69 14057 Py_INCREF(*type);
jpayne@69 14058 *tb = PyException_GetTraceback(exc_value);
jpayne@69 14059 }
jpayne@69 14060 #elif CYTHON_USE_EXC_INFO_STACK
jpayne@69 14061 _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
jpayne@69 14062 *type = exc_info->exc_type;
jpayne@69 14063 *value = exc_info->exc_value;
jpayne@69 14064 *tb = exc_info->exc_traceback;
jpayne@69 14065 Py_XINCREF(*type);
jpayne@69 14066 Py_XINCREF(*value);
jpayne@69 14067 Py_XINCREF(*tb);
jpayne@69 14068 #else
jpayne@69 14069 *type = tstate->exc_type;
jpayne@69 14070 *value = tstate->exc_value;
jpayne@69 14071 *tb = tstate->exc_traceback;
jpayne@69 14072 Py_XINCREF(*type);
jpayne@69 14073 Py_XINCREF(*value);
jpayne@69 14074 Py_XINCREF(*tb);
jpayne@69 14075 #endif
jpayne@69 14076 }
jpayne@69 14077 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
jpayne@69 14078 #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4
jpayne@69 14079 _PyErr_StackItem *exc_info = tstate->exc_info;
jpayne@69 14080 PyObject *tmp_value = exc_info->exc_value;
jpayne@69 14081 exc_info->exc_value = value;
jpayne@69 14082 Py_XDECREF(tmp_value);
jpayne@69 14083 Py_XDECREF(type);
jpayne@69 14084 Py_XDECREF(tb);
jpayne@69 14085 #else
jpayne@69 14086 PyObject *tmp_type, *tmp_value, *tmp_tb;
jpayne@69 14087 #if CYTHON_USE_EXC_INFO_STACK
jpayne@69 14088 _PyErr_StackItem *exc_info = tstate->exc_info;
jpayne@69 14089 tmp_type = exc_info->exc_type;
jpayne@69 14090 tmp_value = exc_info->exc_value;
jpayne@69 14091 tmp_tb = exc_info->exc_traceback;
jpayne@69 14092 exc_info->exc_type = type;
jpayne@69 14093 exc_info->exc_value = value;
jpayne@69 14094 exc_info->exc_traceback = tb;
jpayne@69 14095 #else
jpayne@69 14096 tmp_type = tstate->exc_type;
jpayne@69 14097 tmp_value = tstate->exc_value;
jpayne@69 14098 tmp_tb = tstate->exc_traceback;
jpayne@69 14099 tstate->exc_type = type;
jpayne@69 14100 tstate->exc_value = value;
jpayne@69 14101 tstate->exc_traceback = tb;
jpayne@69 14102 #endif
jpayne@69 14103 Py_XDECREF(tmp_type);
jpayne@69 14104 Py_XDECREF(tmp_value);
jpayne@69 14105 Py_XDECREF(tmp_tb);
jpayne@69 14106 #endif
jpayne@69 14107 }
jpayne@69 14108 #endif
jpayne@69 14109
jpayne@69 14110 /* GetException */
jpayne@69 14111 #if CYTHON_FAST_THREAD_STATE
jpayne@69 14112 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
jpayne@69 14113 #else
jpayne@69 14114 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
jpayne@69 14115 #endif
jpayne@69 14116 {
jpayne@69 14117 PyObject *local_type = NULL, *local_value, *local_tb = NULL;
jpayne@69 14118 #if CYTHON_FAST_THREAD_STATE
jpayne@69 14119 PyObject *tmp_type, *tmp_value, *tmp_tb;
jpayne@69 14120 #if PY_VERSION_HEX >= 0x030C00A6
jpayne@69 14121 local_value = tstate->current_exception;
jpayne@69 14122 tstate->current_exception = 0;
jpayne@69 14123 if (likely(local_value)) {
jpayne@69 14124 local_type = (PyObject*) Py_TYPE(local_value);
jpayne@69 14125 Py_INCREF(local_type);
jpayne@69 14126 local_tb = PyException_GetTraceback(local_value);
jpayne@69 14127 }
jpayne@69 14128 #else
jpayne@69 14129 local_type = tstate->curexc_type;
jpayne@69 14130 local_value = tstate->curexc_value;
jpayne@69 14131 local_tb = tstate->curexc_traceback;
jpayne@69 14132 tstate->curexc_type = 0;
jpayne@69 14133 tstate->curexc_value = 0;
jpayne@69 14134 tstate->curexc_traceback = 0;
jpayne@69 14135 #endif
jpayne@69 14136 #else
jpayne@69 14137 PyErr_Fetch(&local_type, &local_value, &local_tb);
jpayne@69 14138 #endif
jpayne@69 14139 PyErr_NormalizeException(&local_type, &local_value, &local_tb);
jpayne@69 14140 #if CYTHON_FAST_THREAD_STATE && PY_VERSION_HEX >= 0x030C00A6
jpayne@69 14141 if (unlikely(tstate->current_exception))
jpayne@69 14142 #elif CYTHON_FAST_THREAD_STATE
jpayne@69 14143 if (unlikely(tstate->curexc_type))
jpayne@69 14144 #else
jpayne@69 14145 if (unlikely(PyErr_Occurred()))
jpayne@69 14146 #endif
jpayne@69 14147 goto bad;
jpayne@69 14148 #if PY_MAJOR_VERSION >= 3
jpayne@69 14149 if (local_tb) {
jpayne@69 14150 if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
jpayne@69 14151 goto bad;
jpayne@69 14152 }
jpayne@69 14153 #endif
jpayne@69 14154 Py_XINCREF(local_tb);
jpayne@69 14155 Py_XINCREF(local_type);
jpayne@69 14156 Py_XINCREF(local_value);
jpayne@69 14157 *type = local_type;
jpayne@69 14158 *value = local_value;
jpayne@69 14159 *tb = local_tb;
jpayne@69 14160 #if CYTHON_FAST_THREAD_STATE
jpayne@69 14161 #if CYTHON_USE_EXC_INFO_STACK
jpayne@69 14162 {
jpayne@69 14163 _PyErr_StackItem *exc_info = tstate->exc_info;
jpayne@69 14164 #if PY_VERSION_HEX >= 0x030B00a4
jpayne@69 14165 tmp_value = exc_info->exc_value;
jpayne@69 14166 exc_info->exc_value = local_value;
jpayne@69 14167 tmp_type = NULL;
jpayne@69 14168 tmp_tb = NULL;
jpayne@69 14169 Py_XDECREF(local_type);
jpayne@69 14170 Py_XDECREF(local_tb);
jpayne@69 14171 #else
jpayne@69 14172 tmp_type = exc_info->exc_type;
jpayne@69 14173 tmp_value = exc_info->exc_value;
jpayne@69 14174 tmp_tb = exc_info->exc_traceback;
jpayne@69 14175 exc_info->exc_type = local_type;
jpayne@69 14176 exc_info->exc_value = local_value;
jpayne@69 14177 exc_info->exc_traceback = local_tb;
jpayne@69 14178 #endif
jpayne@69 14179 }
jpayne@69 14180 #else
jpayne@69 14181 tmp_type = tstate->exc_type;
jpayne@69 14182 tmp_value = tstate->exc_value;
jpayne@69 14183 tmp_tb = tstate->exc_traceback;
jpayne@69 14184 tstate->exc_type = local_type;
jpayne@69 14185 tstate->exc_value = local_value;
jpayne@69 14186 tstate->exc_traceback = local_tb;
jpayne@69 14187 #endif
jpayne@69 14188 Py_XDECREF(tmp_type);
jpayne@69 14189 Py_XDECREF(tmp_value);
jpayne@69 14190 Py_XDECREF(tmp_tb);
jpayne@69 14191 #else
jpayne@69 14192 PyErr_SetExcInfo(local_type, local_value, local_tb);
jpayne@69 14193 #endif
jpayne@69 14194 return 0;
jpayne@69 14195 bad:
jpayne@69 14196 *type = 0;
jpayne@69 14197 *value = 0;
jpayne@69 14198 *tb = 0;
jpayne@69 14199 Py_XDECREF(local_type);
jpayne@69 14200 Py_XDECREF(local_value);
jpayne@69 14201 Py_XDECREF(local_tb);
jpayne@69 14202 return -1;
jpayne@69 14203 }
jpayne@69 14204
jpayne@69 14205 /* RaiseTooManyValuesToUnpack */
jpayne@69 14206 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
jpayne@69 14207 PyErr_Format(PyExc_ValueError,
jpayne@69 14208 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
jpayne@69 14209 }
jpayne@69 14210
jpayne@69 14211 /* RaiseNeedMoreValuesToUnpack */
jpayne@69 14212 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
jpayne@69 14213 PyErr_Format(PyExc_ValueError,
jpayne@69 14214 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
jpayne@69 14215 index, (index == 1) ? "" : "s");
jpayne@69 14216 }
jpayne@69 14217
jpayne@69 14218 /* IterFinish */
jpayne@69 14219 static CYTHON_INLINE int __Pyx_IterFinish(void) {
jpayne@69 14220 PyObject* exc_type;
jpayne@69 14221 __Pyx_PyThreadState_declare
jpayne@69 14222 __Pyx_PyThreadState_assign
jpayne@69 14223 exc_type = __Pyx_PyErr_CurrentExceptionType();
jpayne@69 14224 if (unlikely(exc_type)) {
jpayne@69 14225 if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))
jpayne@69 14226 return -1;
jpayne@69 14227 __Pyx_PyErr_Clear();
jpayne@69 14228 return 0;
jpayne@69 14229 }
jpayne@69 14230 return 0;
jpayne@69 14231 }
jpayne@69 14232
jpayne@69 14233 /* UnpackItemEndCheck */
jpayne@69 14234 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
jpayne@69 14235 if (unlikely(retval)) {
jpayne@69 14236 Py_DECREF(retval);
jpayne@69 14237 __Pyx_RaiseTooManyValuesError(expected);
jpayne@69 14238 return -1;
jpayne@69 14239 }
jpayne@69 14240 return __Pyx_IterFinish();
jpayne@69 14241 }
jpayne@69 14242
jpayne@69 14243 /* PyIntBinop */
jpayne@69 14244 #if !CYTHON_COMPILING_IN_PYPY
jpayne@69 14245 static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
jpayne@69 14246 CYTHON_MAYBE_UNUSED_VAR(intval);
jpayne@69 14247 CYTHON_MAYBE_UNUSED_VAR(inplace);
jpayne@69 14248 CYTHON_UNUSED_VAR(zerodivision_check);
jpayne@69 14249 #if PY_MAJOR_VERSION < 3
jpayne@69 14250 if (likely(PyInt_CheckExact(op1))) {
jpayne@69 14251 const long b = intval;
jpayne@69 14252 long x;
jpayne@69 14253 long a = PyInt_AS_LONG(op1);
jpayne@69 14254
jpayne@69 14255 x = (long)((unsigned long)a - (unsigned long)b);
jpayne@69 14256 if (likely((x^a) >= 0 || (x^~b) >= 0))
jpayne@69 14257 return PyInt_FromLong(x);
jpayne@69 14258 return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
jpayne@69 14259 }
jpayne@69 14260 #endif
jpayne@69 14261 #if CYTHON_USE_PYLONG_INTERNALS
jpayne@69 14262 if (likely(PyLong_CheckExact(op1))) {
jpayne@69 14263 const long b = intval;
jpayne@69 14264 long a, x;
jpayne@69 14265 #ifdef HAVE_LONG_LONG
jpayne@69 14266 const PY_LONG_LONG llb = intval;
jpayne@69 14267 PY_LONG_LONG lla, llx;
jpayne@69 14268 #endif
jpayne@69 14269 if (unlikely(__Pyx_PyLong_IsZero(op1))) {
jpayne@69 14270 return PyLong_FromLong(-intval);
jpayne@69 14271 }
jpayne@69 14272 if (likely(__Pyx_PyLong_IsCompact(op1))) {
jpayne@69 14273 a = __Pyx_PyLong_CompactValue(op1);
jpayne@69 14274 } else {
jpayne@69 14275 const digit* digits = __Pyx_PyLong_Digits(op1);
jpayne@69 14276 const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(op1);
jpayne@69 14277 switch (size) {
jpayne@69 14278 case -2:
jpayne@69 14279 if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
jpayne@69 14280 a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
jpayne@69 14281 break;
jpayne@69 14282 #ifdef HAVE_LONG_LONG
jpayne@69 14283 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
jpayne@69 14284 lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
jpayne@69 14285 goto long_long;
jpayne@69 14286 #endif
jpayne@69 14287 }
jpayne@69 14288 CYTHON_FALLTHROUGH;
jpayne@69 14289 case 2:
jpayne@69 14290 if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
jpayne@69 14291 a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
jpayne@69 14292 break;
jpayne@69 14293 #ifdef HAVE_LONG_LONG
jpayne@69 14294 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
jpayne@69 14295 lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
jpayne@69 14296 goto long_long;
jpayne@69 14297 #endif
jpayne@69 14298 }
jpayne@69 14299 CYTHON_FALLTHROUGH;
jpayne@69 14300 case -3:
jpayne@69 14301 if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
jpayne@69 14302 a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
jpayne@69 14303 break;
jpayne@69 14304 #ifdef HAVE_LONG_LONG
jpayne@69 14305 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
jpayne@69 14306 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]));
jpayne@69 14307 goto long_long;
jpayne@69 14308 #endif
jpayne@69 14309 }
jpayne@69 14310 CYTHON_FALLTHROUGH;
jpayne@69 14311 case 3:
jpayne@69 14312 if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
jpayne@69 14313 a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
jpayne@69 14314 break;
jpayne@69 14315 #ifdef HAVE_LONG_LONG
jpayne@69 14316 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
jpayne@69 14317 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]));
jpayne@69 14318 goto long_long;
jpayne@69 14319 #endif
jpayne@69 14320 }
jpayne@69 14321 CYTHON_FALLTHROUGH;
jpayne@69 14322 case -4:
jpayne@69 14323 if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
jpayne@69 14324 a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
jpayne@69 14325 break;
jpayne@69 14326 #ifdef HAVE_LONG_LONG
jpayne@69 14327 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
jpayne@69 14328 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]));
jpayne@69 14329 goto long_long;
jpayne@69 14330 #endif
jpayne@69 14331 }
jpayne@69 14332 CYTHON_FALLTHROUGH;
jpayne@69 14333 case 4:
jpayne@69 14334 if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
jpayne@69 14335 a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
jpayne@69 14336 break;
jpayne@69 14337 #ifdef HAVE_LONG_LONG
jpayne@69 14338 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
jpayne@69 14339 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]));
jpayne@69 14340 goto long_long;
jpayne@69 14341 #endif
jpayne@69 14342 }
jpayne@69 14343 CYTHON_FALLTHROUGH;
jpayne@69 14344 default: return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
jpayne@69 14345 }
jpayne@69 14346 }
jpayne@69 14347 x = a - b;
jpayne@69 14348 return PyLong_FromLong(x);
jpayne@69 14349 #ifdef HAVE_LONG_LONG
jpayne@69 14350 long_long:
jpayne@69 14351 llx = lla - llb;
jpayne@69 14352 return PyLong_FromLongLong(llx);
jpayne@69 14353 #endif
jpayne@69 14354
jpayne@69 14355
jpayne@69 14356 }
jpayne@69 14357 #endif
jpayne@69 14358 if (PyFloat_CheckExact(op1)) {
jpayne@69 14359 const long b = intval;
jpayne@69 14360 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 14361 double a = __pyx_PyFloat_AsDouble(op1);
jpayne@69 14362 #else
jpayne@69 14363 double a = PyFloat_AS_DOUBLE(op1);
jpayne@69 14364 #endif
jpayne@69 14365 double result;
jpayne@69 14366
jpayne@69 14367 PyFPE_START_PROTECT("subtract", return NULL)
jpayne@69 14368 result = ((double)a) - (double)b;
jpayne@69 14369 PyFPE_END_PROTECT(result)
jpayne@69 14370 return PyFloat_FromDouble(result);
jpayne@69 14371 }
jpayne@69 14372 return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2);
jpayne@69 14373 }
jpayne@69 14374 #endif
jpayne@69 14375
jpayne@69 14376 /* PyObjectLookupSpecial */
jpayne@69 14377 #if CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
jpayne@69 14378 static CYTHON_INLINE PyObject* __Pyx__PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name, int with_error) {
jpayne@69 14379 PyObject *res;
jpayne@69 14380 PyTypeObject *tp = Py_TYPE(obj);
jpayne@69 14381 #if PY_MAJOR_VERSION < 3
jpayne@69 14382 if (unlikely(PyInstance_Check(obj)))
jpayne@69 14383 return with_error ? __Pyx_PyObject_GetAttrStr(obj, attr_name) : __Pyx_PyObject_GetAttrStrNoError(obj, attr_name);
jpayne@69 14384 #endif
jpayne@69 14385 res = _PyType_Lookup(tp, attr_name);
jpayne@69 14386 if (likely(res)) {
jpayne@69 14387 descrgetfunc f = Py_TYPE(res)->tp_descr_get;
jpayne@69 14388 if (!f) {
jpayne@69 14389 Py_INCREF(res);
jpayne@69 14390 } else {
jpayne@69 14391 res = f(res, obj, (PyObject *)tp);
jpayne@69 14392 }
jpayne@69 14393 } else if (with_error) {
jpayne@69 14394 PyErr_SetObject(PyExc_AttributeError, attr_name);
jpayne@69 14395 }
jpayne@69 14396 return res;
jpayne@69 14397 }
jpayne@69 14398 #endif
jpayne@69 14399
jpayne@69 14400 /* SwapException */
jpayne@69 14401 #if CYTHON_FAST_THREAD_STATE
jpayne@69 14402 static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
jpayne@69 14403 PyObject *tmp_type, *tmp_value, *tmp_tb;
jpayne@69 14404 #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4
jpayne@69 14405 _PyErr_StackItem *exc_info = tstate->exc_info;
jpayne@69 14406 tmp_value = exc_info->exc_value;
jpayne@69 14407 exc_info->exc_value = *value;
jpayne@69 14408 if (tmp_value == NULL || tmp_value == Py_None) {
jpayne@69 14409 Py_XDECREF(tmp_value);
jpayne@69 14410 tmp_value = NULL;
jpayne@69 14411 tmp_type = NULL;
jpayne@69 14412 tmp_tb = NULL;
jpayne@69 14413 } else {
jpayne@69 14414 tmp_type = (PyObject*) Py_TYPE(tmp_value);
jpayne@69 14415 Py_INCREF(tmp_type);
jpayne@69 14416 #if CYTHON_COMPILING_IN_CPYTHON
jpayne@69 14417 tmp_tb = ((PyBaseExceptionObject*) tmp_value)->traceback;
jpayne@69 14418 Py_XINCREF(tmp_tb);
jpayne@69 14419 #else
jpayne@69 14420 tmp_tb = PyException_GetTraceback(tmp_value);
jpayne@69 14421 #endif
jpayne@69 14422 }
jpayne@69 14423 #elif CYTHON_USE_EXC_INFO_STACK
jpayne@69 14424 _PyErr_StackItem *exc_info = tstate->exc_info;
jpayne@69 14425 tmp_type = exc_info->exc_type;
jpayne@69 14426 tmp_value = exc_info->exc_value;
jpayne@69 14427 tmp_tb = exc_info->exc_traceback;
jpayne@69 14428 exc_info->exc_type = *type;
jpayne@69 14429 exc_info->exc_value = *value;
jpayne@69 14430 exc_info->exc_traceback = *tb;
jpayne@69 14431 #else
jpayne@69 14432 tmp_type = tstate->exc_type;
jpayne@69 14433 tmp_value = tstate->exc_value;
jpayne@69 14434 tmp_tb = tstate->exc_traceback;
jpayne@69 14435 tstate->exc_type = *type;
jpayne@69 14436 tstate->exc_value = *value;
jpayne@69 14437 tstate->exc_traceback = *tb;
jpayne@69 14438 #endif
jpayne@69 14439 *type = tmp_type;
jpayne@69 14440 *value = tmp_value;
jpayne@69 14441 *tb = tmp_tb;
jpayne@69 14442 }
jpayne@69 14443 #else
jpayne@69 14444 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
jpayne@69 14445 PyObject *tmp_type, *tmp_value, *tmp_tb;
jpayne@69 14446 PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
jpayne@69 14447 PyErr_SetExcInfo(*type, *value, *tb);
jpayne@69 14448 *type = tmp_type;
jpayne@69 14449 *value = tmp_value;
jpayne@69 14450 *tb = tmp_tb;
jpayne@69 14451 }
jpayne@69 14452 #endif
jpayne@69 14453
jpayne@69 14454 /* PyIntCompare */
jpayne@69 14455 static CYTHON_INLINE int __Pyx_PyInt_BoolEqObjC(PyObject *op1, PyObject *op2, long intval, long inplace) {
jpayne@69 14456 CYTHON_MAYBE_UNUSED_VAR(intval);
jpayne@69 14457 CYTHON_UNUSED_VAR(inplace);
jpayne@69 14458 if (op1 == op2) {
jpayne@69 14459 return 1;
jpayne@69 14460 }
jpayne@69 14461 #if PY_MAJOR_VERSION < 3
jpayne@69 14462 if (likely(PyInt_CheckExact(op1))) {
jpayne@69 14463 const long b = intval;
jpayne@69 14464 long a = PyInt_AS_LONG(op1);
jpayne@69 14465 return (a == b);
jpayne@69 14466 }
jpayne@69 14467 #endif
jpayne@69 14468 #if CYTHON_USE_PYLONG_INTERNALS
jpayne@69 14469 if (likely(PyLong_CheckExact(op1))) {
jpayne@69 14470 int unequal;
jpayne@69 14471 unsigned long uintval;
jpayne@69 14472 Py_ssize_t size = __Pyx_PyLong_DigitCount(op1);
jpayne@69 14473 const digit* digits = __Pyx_PyLong_Digits(op1);
jpayne@69 14474 if (intval == 0) {
jpayne@69 14475 return (__Pyx_PyLong_IsZero(op1) == 1);
jpayne@69 14476 } else if (intval < 0) {
jpayne@69 14477 if (__Pyx_PyLong_IsNonNeg(op1))
jpayne@69 14478 return 0;
jpayne@69 14479 intval = -intval;
jpayne@69 14480 } else {
jpayne@69 14481 if (__Pyx_PyLong_IsNeg(op1))
jpayne@69 14482 return 0;
jpayne@69 14483 }
jpayne@69 14484 uintval = (unsigned long) intval;
jpayne@69 14485 #if PyLong_SHIFT * 4 < SIZEOF_LONG*8
jpayne@69 14486 if (uintval >> (PyLong_SHIFT * 4)) {
jpayne@69 14487 unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
jpayne@69 14488 | (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));
jpayne@69 14489 } else
jpayne@69 14490 #endif
jpayne@69 14491 #if PyLong_SHIFT * 3 < SIZEOF_LONG*8
jpayne@69 14492 if (uintval >> (PyLong_SHIFT * 3)) {
jpayne@69 14493 unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
jpayne@69 14494 | (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));
jpayne@69 14495 } else
jpayne@69 14496 #endif
jpayne@69 14497 #if PyLong_SHIFT * 2 < SIZEOF_LONG*8
jpayne@69 14498 if (uintval >> (PyLong_SHIFT * 2)) {
jpayne@69 14499 unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
jpayne@69 14500 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
jpayne@69 14501 } else
jpayne@69 14502 #endif
jpayne@69 14503 #if PyLong_SHIFT * 1 < SIZEOF_LONG*8
jpayne@69 14504 if (uintval >> (PyLong_SHIFT * 1)) {
jpayne@69 14505 unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
jpayne@69 14506 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
jpayne@69 14507 } else
jpayne@69 14508 #endif
jpayne@69 14509 unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK));
jpayne@69 14510 return (unequal == 0);
jpayne@69 14511 }
jpayne@69 14512 #endif
jpayne@69 14513 if (PyFloat_CheckExact(op1)) {
jpayne@69 14514 const long b = intval;
jpayne@69 14515 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 14516 double a = __pyx_PyFloat_AsDouble(op1);
jpayne@69 14517 #else
jpayne@69 14518 double a = PyFloat_AS_DOUBLE(op1);
jpayne@69 14519 #endif
jpayne@69 14520 return ((double)a == (double)b);
jpayne@69 14521 }
jpayne@69 14522 return __Pyx_PyObject_IsTrueAndDecref(
jpayne@69 14523 PyObject_RichCompare(op1, op2, Py_EQ));
jpayne@69 14524 }
jpayne@69 14525
jpayne@69 14526 /* DictGetItem */
jpayne@69 14527 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
jpayne@69 14528 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
jpayne@69 14529 PyObject *value;
jpayne@69 14530 value = PyDict_GetItemWithError(d, key);
jpayne@69 14531 if (unlikely(!value)) {
jpayne@69 14532 if (!PyErr_Occurred()) {
jpayne@69 14533 if (unlikely(PyTuple_Check(key))) {
jpayne@69 14534 PyObject* args = PyTuple_Pack(1, key);
jpayne@69 14535 if (likely(args)) {
jpayne@69 14536 PyErr_SetObject(PyExc_KeyError, args);
jpayne@69 14537 Py_DECREF(args);
jpayne@69 14538 }
jpayne@69 14539 } else {
jpayne@69 14540 PyErr_SetObject(PyExc_KeyError, key);
jpayne@69 14541 }
jpayne@69 14542 }
jpayne@69 14543 return NULL;
jpayne@69 14544 }
jpayne@69 14545 Py_INCREF(value);
jpayne@69 14546 return value;
jpayne@69 14547 }
jpayne@69 14548 #endif
jpayne@69 14549
jpayne@69 14550 /* FixUpExtensionType */
jpayne@69 14551 #if CYTHON_USE_TYPE_SPECS
jpayne@69 14552 static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type) {
jpayne@69 14553 #if PY_VERSION_HEX > 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 14554 CYTHON_UNUSED_VAR(spec);
jpayne@69 14555 CYTHON_UNUSED_VAR(type);
jpayne@69 14556 #else
jpayne@69 14557 const PyType_Slot *slot = spec->slots;
jpayne@69 14558 while (slot && slot->slot && slot->slot != Py_tp_members)
jpayne@69 14559 slot++;
jpayne@69 14560 if (slot && slot->slot == Py_tp_members) {
jpayne@69 14561 int changed = 0;
jpayne@69 14562 #if !(PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON)
jpayne@69 14563 const
jpayne@69 14564 #endif
jpayne@69 14565 PyMemberDef *memb = (PyMemberDef*) slot->pfunc;
jpayne@69 14566 while (memb && memb->name) {
jpayne@69 14567 if (memb->name[0] == '_' && memb->name[1] == '_') {
jpayne@69 14568 #if PY_VERSION_HEX < 0x030900b1
jpayne@69 14569 if (strcmp(memb->name, "__weaklistoffset__") == 0) {
jpayne@69 14570 assert(memb->type == T_PYSSIZET);
jpayne@69 14571 assert(memb->flags == READONLY);
jpayne@69 14572 type->tp_weaklistoffset = memb->offset;
jpayne@69 14573 changed = 1;
jpayne@69 14574 }
jpayne@69 14575 else if (strcmp(memb->name, "__dictoffset__") == 0) {
jpayne@69 14576 assert(memb->type == T_PYSSIZET);
jpayne@69 14577 assert(memb->flags == READONLY);
jpayne@69 14578 type->tp_dictoffset = memb->offset;
jpayne@69 14579 changed = 1;
jpayne@69 14580 }
jpayne@69 14581 #if CYTHON_METH_FASTCALL
jpayne@69 14582 else if (strcmp(memb->name, "__vectorcalloffset__") == 0) {
jpayne@69 14583 assert(memb->type == T_PYSSIZET);
jpayne@69 14584 assert(memb->flags == READONLY);
jpayne@69 14585 #if PY_VERSION_HEX >= 0x030800b4
jpayne@69 14586 type->tp_vectorcall_offset = memb->offset;
jpayne@69 14587 #else
jpayne@69 14588 type->tp_print = (printfunc) memb->offset;
jpayne@69 14589 #endif
jpayne@69 14590 changed = 1;
jpayne@69 14591 }
jpayne@69 14592 #endif
jpayne@69 14593 #else
jpayne@69 14594 if ((0));
jpayne@69 14595 #endif
jpayne@69 14596 #if PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON
jpayne@69 14597 else if (strcmp(memb->name, "__module__") == 0) {
jpayne@69 14598 PyObject *descr;
jpayne@69 14599 assert(memb->type == T_OBJECT);
jpayne@69 14600 assert(memb->flags == 0 || memb->flags == READONLY);
jpayne@69 14601 descr = PyDescr_NewMember(type, memb);
jpayne@69 14602 if (unlikely(!descr))
jpayne@69 14603 return -1;
jpayne@69 14604 if (unlikely(PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr) < 0)) {
jpayne@69 14605 Py_DECREF(descr);
jpayne@69 14606 return -1;
jpayne@69 14607 }
jpayne@69 14608 Py_DECREF(descr);
jpayne@69 14609 changed = 1;
jpayne@69 14610 }
jpayne@69 14611 #endif
jpayne@69 14612 }
jpayne@69 14613 memb++;
jpayne@69 14614 }
jpayne@69 14615 if (changed)
jpayne@69 14616 PyType_Modified(type);
jpayne@69 14617 }
jpayne@69 14618 #endif
jpayne@69 14619 return 0;
jpayne@69 14620 }
jpayne@69 14621 #endif
jpayne@69 14622
jpayne@69 14623 /* FetchSharedCythonModule */
jpayne@69 14624 static PyObject *__Pyx_FetchSharedCythonABIModule(void) {
jpayne@69 14625 return __Pyx_PyImport_AddModuleRef((char*) __PYX_ABI_MODULE_NAME);
jpayne@69 14626 }
jpayne@69 14627
jpayne@69 14628 /* FetchCommonType */
jpayne@69 14629 static int __Pyx_VerifyCachedType(PyObject *cached_type,
jpayne@69 14630 const char *name,
jpayne@69 14631 Py_ssize_t basicsize,
jpayne@69 14632 Py_ssize_t expected_basicsize) {
jpayne@69 14633 if (!PyType_Check(cached_type)) {
jpayne@69 14634 PyErr_Format(PyExc_TypeError,
jpayne@69 14635 "Shared Cython type %.200s is not a type object", name);
jpayne@69 14636 return -1;
jpayne@69 14637 }
jpayne@69 14638 if (basicsize != expected_basicsize) {
jpayne@69 14639 PyErr_Format(PyExc_TypeError,
jpayne@69 14640 "Shared Cython type %.200s has the wrong size, try recompiling",
jpayne@69 14641 name);
jpayne@69 14642 return -1;
jpayne@69 14643 }
jpayne@69 14644 return 0;
jpayne@69 14645 }
jpayne@69 14646 #if !CYTHON_USE_TYPE_SPECS
jpayne@69 14647 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
jpayne@69 14648 PyObject* abi_module;
jpayne@69 14649 const char* object_name;
jpayne@69 14650 PyTypeObject *cached_type = NULL;
jpayne@69 14651 abi_module = __Pyx_FetchSharedCythonABIModule();
jpayne@69 14652 if (!abi_module) return NULL;
jpayne@69 14653 object_name = strrchr(type->tp_name, '.');
jpayne@69 14654 object_name = object_name ? object_name+1 : type->tp_name;
jpayne@69 14655 cached_type = (PyTypeObject*) PyObject_GetAttrString(abi_module, object_name);
jpayne@69 14656 if (cached_type) {
jpayne@69 14657 if (__Pyx_VerifyCachedType(
jpayne@69 14658 (PyObject *)cached_type,
jpayne@69 14659 object_name,
jpayne@69 14660 cached_type->tp_basicsize,
jpayne@69 14661 type->tp_basicsize) < 0) {
jpayne@69 14662 goto bad;
jpayne@69 14663 }
jpayne@69 14664 goto done;
jpayne@69 14665 }
jpayne@69 14666 if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
jpayne@69 14667 PyErr_Clear();
jpayne@69 14668 if (PyType_Ready(type) < 0) goto bad;
jpayne@69 14669 if (PyObject_SetAttrString(abi_module, object_name, (PyObject *)type) < 0)
jpayne@69 14670 goto bad;
jpayne@69 14671 Py_INCREF(type);
jpayne@69 14672 cached_type = type;
jpayne@69 14673 done:
jpayne@69 14674 Py_DECREF(abi_module);
jpayne@69 14675 return cached_type;
jpayne@69 14676 bad:
jpayne@69 14677 Py_XDECREF(cached_type);
jpayne@69 14678 cached_type = NULL;
jpayne@69 14679 goto done;
jpayne@69 14680 }
jpayne@69 14681 #else
jpayne@69 14682 static PyTypeObject *__Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases) {
jpayne@69 14683 PyObject *abi_module, *cached_type = NULL;
jpayne@69 14684 const char* object_name = strrchr(spec->name, '.');
jpayne@69 14685 object_name = object_name ? object_name+1 : spec->name;
jpayne@69 14686 abi_module = __Pyx_FetchSharedCythonABIModule();
jpayne@69 14687 if (!abi_module) return NULL;
jpayne@69 14688 cached_type = PyObject_GetAttrString(abi_module, object_name);
jpayne@69 14689 if (cached_type) {
jpayne@69 14690 Py_ssize_t basicsize;
jpayne@69 14691 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 14692 PyObject *py_basicsize;
jpayne@69 14693 py_basicsize = PyObject_GetAttrString(cached_type, "__basicsize__");
jpayne@69 14694 if (unlikely(!py_basicsize)) goto bad;
jpayne@69 14695 basicsize = PyLong_AsSsize_t(py_basicsize);
jpayne@69 14696 Py_DECREF(py_basicsize);
jpayne@69 14697 py_basicsize = 0;
jpayne@69 14698 if (unlikely(basicsize == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
jpayne@69 14699 #else
jpayne@69 14700 basicsize = likely(PyType_Check(cached_type)) ? ((PyTypeObject*) cached_type)->tp_basicsize : -1;
jpayne@69 14701 #endif
jpayne@69 14702 if (__Pyx_VerifyCachedType(
jpayne@69 14703 cached_type,
jpayne@69 14704 object_name,
jpayne@69 14705 basicsize,
jpayne@69 14706 spec->basicsize) < 0) {
jpayne@69 14707 goto bad;
jpayne@69 14708 }
jpayne@69 14709 goto done;
jpayne@69 14710 }
jpayne@69 14711 if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
jpayne@69 14712 PyErr_Clear();
jpayne@69 14713 CYTHON_UNUSED_VAR(module);
jpayne@69 14714 cached_type = __Pyx_PyType_FromModuleAndSpec(abi_module, spec, bases);
jpayne@69 14715 if (unlikely(!cached_type)) goto bad;
jpayne@69 14716 if (unlikely(__Pyx_fix_up_extension_type_from_spec(spec, (PyTypeObject *) cached_type) < 0)) goto bad;
jpayne@69 14717 if (PyObject_SetAttrString(abi_module, object_name, cached_type) < 0) goto bad;
jpayne@69 14718 done:
jpayne@69 14719 Py_DECREF(abi_module);
jpayne@69 14720 assert(cached_type == NULL || PyType_Check(cached_type));
jpayne@69 14721 return (PyTypeObject *) cached_type;
jpayne@69 14722 bad:
jpayne@69 14723 Py_XDECREF(cached_type);
jpayne@69 14724 cached_type = NULL;
jpayne@69 14725 goto done;
jpayne@69 14726 }
jpayne@69 14727 #endif
jpayne@69 14728
jpayne@69 14729 /* PyVectorcallFastCallDict */
jpayne@69 14730 #if CYTHON_METH_FASTCALL
jpayne@69 14731 static PyObject *__Pyx_PyVectorcall_FastCallDict_kw(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw)
jpayne@69 14732 {
jpayne@69 14733 PyObject *res = NULL;
jpayne@69 14734 PyObject *kwnames;
jpayne@69 14735 PyObject **newargs;
jpayne@69 14736 PyObject **kwvalues;
jpayne@69 14737 Py_ssize_t i, pos;
jpayne@69 14738 size_t j;
jpayne@69 14739 PyObject *key, *value;
jpayne@69 14740 unsigned long keys_are_strings;
jpayne@69 14741 Py_ssize_t nkw = PyDict_GET_SIZE(kw);
jpayne@69 14742 newargs = (PyObject **)PyMem_Malloc((nargs + (size_t)nkw) * sizeof(args[0]));
jpayne@69 14743 if (unlikely(newargs == NULL)) {
jpayne@69 14744 PyErr_NoMemory();
jpayne@69 14745 return NULL;
jpayne@69 14746 }
jpayne@69 14747 for (j = 0; j < nargs; j++) newargs[j] = args[j];
jpayne@69 14748 kwnames = PyTuple_New(nkw);
jpayne@69 14749 if (unlikely(kwnames == NULL)) {
jpayne@69 14750 PyMem_Free(newargs);
jpayne@69 14751 return NULL;
jpayne@69 14752 }
jpayne@69 14753 kwvalues = newargs + nargs;
jpayne@69 14754 pos = i = 0;
jpayne@69 14755 keys_are_strings = Py_TPFLAGS_UNICODE_SUBCLASS;
jpayne@69 14756 while (PyDict_Next(kw, &pos, &key, &value)) {
jpayne@69 14757 keys_are_strings &= Py_TYPE(key)->tp_flags;
jpayne@69 14758 Py_INCREF(key);
jpayne@69 14759 Py_INCREF(value);
jpayne@69 14760 PyTuple_SET_ITEM(kwnames, i, key);
jpayne@69 14761 kwvalues[i] = value;
jpayne@69 14762 i++;
jpayne@69 14763 }
jpayne@69 14764 if (unlikely(!keys_are_strings)) {
jpayne@69 14765 PyErr_SetString(PyExc_TypeError, "keywords must be strings");
jpayne@69 14766 goto cleanup;
jpayne@69 14767 }
jpayne@69 14768 res = vc(func, newargs, nargs, kwnames);
jpayne@69 14769 cleanup:
jpayne@69 14770 Py_DECREF(kwnames);
jpayne@69 14771 for (i = 0; i < nkw; i++)
jpayne@69 14772 Py_DECREF(kwvalues[i]);
jpayne@69 14773 PyMem_Free(newargs);
jpayne@69 14774 return res;
jpayne@69 14775 }
jpayne@69 14776 static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw)
jpayne@69 14777 {
jpayne@69 14778 if (likely(kw == NULL) || PyDict_GET_SIZE(kw) == 0) {
jpayne@69 14779 return vc(func, args, nargs, NULL);
jpayne@69 14780 }
jpayne@69 14781 return __Pyx_PyVectorcall_FastCallDict_kw(func, vc, args, nargs, kw);
jpayne@69 14782 }
jpayne@69 14783 #endif
jpayne@69 14784
jpayne@69 14785 /* CythonFunctionShared */
jpayne@69 14786 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 14787 static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void *cfunc) {
jpayne@69 14788 if (__Pyx_CyFunction_Check(func)) {
jpayne@69 14789 return PyCFunction_GetFunction(((__pyx_CyFunctionObject*)func)->func) == (PyCFunction) cfunc;
jpayne@69 14790 } else if (PyCFunction_Check(func)) {
jpayne@69 14791 return PyCFunction_GetFunction(func) == (PyCFunction) cfunc;
jpayne@69 14792 }
jpayne@69 14793 return 0;
jpayne@69 14794 }
jpayne@69 14795 #else
jpayne@69 14796 static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void *cfunc) {
jpayne@69 14797 return __Pyx_CyOrPyCFunction_Check(func) && __Pyx_CyOrPyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc;
jpayne@69 14798 }
jpayne@69 14799 #endif
jpayne@69 14800 static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj) {
jpayne@69 14801 #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 14802 __Pyx_Py_XDECREF_SET(
jpayne@69 14803 __Pyx_CyFunction_GetClassObj(f),
jpayne@69 14804 ((classobj) ? __Pyx_NewRef(classobj) : NULL));
jpayne@69 14805 #else
jpayne@69 14806 __Pyx_Py_XDECREF_SET(
jpayne@69 14807 ((PyCMethodObject *) (f))->mm_class,
jpayne@69 14808 (PyTypeObject*)((classobj) ? __Pyx_NewRef(classobj) : NULL));
jpayne@69 14809 #endif
jpayne@69 14810 }
jpayne@69 14811 static PyObject *
jpayne@69 14812 __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, void *closure)
jpayne@69 14813 {
jpayne@69 14814 CYTHON_UNUSED_VAR(closure);
jpayne@69 14815 if (unlikely(op->func_doc == NULL)) {
jpayne@69 14816 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 14817 op->func_doc = PyObject_GetAttrString(op->func, "__doc__");
jpayne@69 14818 if (unlikely(!op->func_doc)) return NULL;
jpayne@69 14819 #else
jpayne@69 14820 if (((PyCFunctionObject*)op)->m_ml->ml_doc) {
jpayne@69 14821 #if PY_MAJOR_VERSION >= 3
jpayne@69 14822 op->func_doc = PyUnicode_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc);
jpayne@69 14823 #else
jpayne@69 14824 op->func_doc = PyString_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc);
jpayne@69 14825 #endif
jpayne@69 14826 if (unlikely(op->func_doc == NULL))
jpayne@69 14827 return NULL;
jpayne@69 14828 } else {
jpayne@69 14829 Py_INCREF(Py_None);
jpayne@69 14830 return Py_None;
jpayne@69 14831 }
jpayne@69 14832 #endif
jpayne@69 14833 }
jpayne@69 14834 Py_INCREF(op->func_doc);
jpayne@69 14835 return op->func_doc;
jpayne@69 14836 }
jpayne@69 14837 static int
jpayne@69 14838 __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, void *context)
jpayne@69 14839 {
jpayne@69 14840 CYTHON_UNUSED_VAR(context);
jpayne@69 14841 if (value == NULL) {
jpayne@69 14842 value = Py_None;
jpayne@69 14843 }
jpayne@69 14844 Py_INCREF(value);
jpayne@69 14845 __Pyx_Py_XDECREF_SET(op->func_doc, value);
jpayne@69 14846 return 0;
jpayne@69 14847 }
jpayne@69 14848 static PyObject *
jpayne@69 14849 __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, void *context)
jpayne@69 14850 {
jpayne@69 14851 CYTHON_UNUSED_VAR(context);
jpayne@69 14852 if (unlikely(op->func_name == NULL)) {
jpayne@69 14853 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 14854 op->func_name = PyObject_GetAttrString(op->func, "__name__");
jpayne@69 14855 #elif PY_MAJOR_VERSION >= 3
jpayne@69 14856 op->func_name = PyUnicode_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name);
jpayne@69 14857 #else
jpayne@69 14858 op->func_name = PyString_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name);
jpayne@69 14859 #endif
jpayne@69 14860 if (unlikely(op->func_name == NULL))
jpayne@69 14861 return NULL;
jpayne@69 14862 }
jpayne@69 14863 Py_INCREF(op->func_name);
jpayne@69 14864 return op->func_name;
jpayne@69 14865 }
jpayne@69 14866 static int
jpayne@69 14867 __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, void *context)
jpayne@69 14868 {
jpayne@69 14869 CYTHON_UNUSED_VAR(context);
jpayne@69 14870 #if PY_MAJOR_VERSION >= 3
jpayne@69 14871 if (unlikely(value == NULL || !PyUnicode_Check(value)))
jpayne@69 14872 #else
jpayne@69 14873 if (unlikely(value == NULL || !PyString_Check(value)))
jpayne@69 14874 #endif
jpayne@69 14875 {
jpayne@69 14876 PyErr_SetString(PyExc_TypeError,
jpayne@69 14877 "__name__ must be set to a string object");
jpayne@69 14878 return -1;
jpayne@69 14879 }
jpayne@69 14880 Py_INCREF(value);
jpayne@69 14881 __Pyx_Py_XDECREF_SET(op->func_name, value);
jpayne@69 14882 return 0;
jpayne@69 14883 }
jpayne@69 14884 static PyObject *
jpayne@69 14885 __Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, void *context)
jpayne@69 14886 {
jpayne@69 14887 CYTHON_UNUSED_VAR(context);
jpayne@69 14888 Py_INCREF(op->func_qualname);
jpayne@69 14889 return op->func_qualname;
jpayne@69 14890 }
jpayne@69 14891 static int
jpayne@69 14892 __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, void *context)
jpayne@69 14893 {
jpayne@69 14894 CYTHON_UNUSED_VAR(context);
jpayne@69 14895 #if PY_MAJOR_VERSION >= 3
jpayne@69 14896 if (unlikely(value == NULL || !PyUnicode_Check(value)))
jpayne@69 14897 #else
jpayne@69 14898 if (unlikely(value == NULL || !PyString_Check(value)))
jpayne@69 14899 #endif
jpayne@69 14900 {
jpayne@69 14901 PyErr_SetString(PyExc_TypeError,
jpayne@69 14902 "__qualname__ must be set to a string object");
jpayne@69 14903 return -1;
jpayne@69 14904 }
jpayne@69 14905 Py_INCREF(value);
jpayne@69 14906 __Pyx_Py_XDECREF_SET(op->func_qualname, value);
jpayne@69 14907 return 0;
jpayne@69 14908 }
jpayne@69 14909 static PyObject *
jpayne@69 14910 __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, void *context)
jpayne@69 14911 {
jpayne@69 14912 CYTHON_UNUSED_VAR(context);
jpayne@69 14913 if (unlikely(op->func_dict == NULL)) {
jpayne@69 14914 op->func_dict = PyDict_New();
jpayne@69 14915 if (unlikely(op->func_dict == NULL))
jpayne@69 14916 return NULL;
jpayne@69 14917 }
jpayne@69 14918 Py_INCREF(op->func_dict);
jpayne@69 14919 return op->func_dict;
jpayne@69 14920 }
jpayne@69 14921 static int
jpayne@69 14922 __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, void *context)
jpayne@69 14923 {
jpayne@69 14924 CYTHON_UNUSED_VAR(context);
jpayne@69 14925 if (unlikely(value == NULL)) {
jpayne@69 14926 PyErr_SetString(PyExc_TypeError,
jpayne@69 14927 "function's dictionary may not be deleted");
jpayne@69 14928 return -1;
jpayne@69 14929 }
jpayne@69 14930 if (unlikely(!PyDict_Check(value))) {
jpayne@69 14931 PyErr_SetString(PyExc_TypeError,
jpayne@69 14932 "setting function's dictionary to a non-dict");
jpayne@69 14933 return -1;
jpayne@69 14934 }
jpayne@69 14935 Py_INCREF(value);
jpayne@69 14936 __Pyx_Py_XDECREF_SET(op->func_dict, value);
jpayne@69 14937 return 0;
jpayne@69 14938 }
jpayne@69 14939 static PyObject *
jpayne@69 14940 __Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, void *context)
jpayne@69 14941 {
jpayne@69 14942 CYTHON_UNUSED_VAR(context);
jpayne@69 14943 Py_INCREF(op->func_globals);
jpayne@69 14944 return op->func_globals;
jpayne@69 14945 }
jpayne@69 14946 static PyObject *
jpayne@69 14947 __Pyx_CyFunction_get_closure(__pyx_CyFunctionObject *op, void *context)
jpayne@69 14948 {
jpayne@69 14949 CYTHON_UNUSED_VAR(op);
jpayne@69 14950 CYTHON_UNUSED_VAR(context);
jpayne@69 14951 Py_INCREF(Py_None);
jpayne@69 14952 return Py_None;
jpayne@69 14953 }
jpayne@69 14954 static PyObject *
jpayne@69 14955 __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, void *context)
jpayne@69 14956 {
jpayne@69 14957 PyObject* result = (op->func_code) ? op->func_code : Py_None;
jpayne@69 14958 CYTHON_UNUSED_VAR(context);
jpayne@69 14959 Py_INCREF(result);
jpayne@69 14960 return result;
jpayne@69 14961 }
jpayne@69 14962 static int
jpayne@69 14963 __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
jpayne@69 14964 int result = 0;
jpayne@69 14965 PyObject *res = op->defaults_getter((PyObject *) op);
jpayne@69 14966 if (unlikely(!res))
jpayne@69 14967 return -1;
jpayne@69 14968 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
jpayne@69 14969 op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
jpayne@69 14970 Py_INCREF(op->defaults_tuple);
jpayne@69 14971 op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
jpayne@69 14972 Py_INCREF(op->defaults_kwdict);
jpayne@69 14973 #else
jpayne@69 14974 op->defaults_tuple = __Pyx_PySequence_ITEM(res, 0);
jpayne@69 14975 if (unlikely(!op->defaults_tuple)) result = -1;
jpayne@69 14976 else {
jpayne@69 14977 op->defaults_kwdict = __Pyx_PySequence_ITEM(res, 1);
jpayne@69 14978 if (unlikely(!op->defaults_kwdict)) result = -1;
jpayne@69 14979 }
jpayne@69 14980 #endif
jpayne@69 14981 Py_DECREF(res);
jpayne@69 14982 return result;
jpayne@69 14983 }
jpayne@69 14984 static int
jpayne@69 14985 __Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
jpayne@69 14986 CYTHON_UNUSED_VAR(context);
jpayne@69 14987 if (!value) {
jpayne@69 14988 value = Py_None;
jpayne@69 14989 } else if (unlikely(value != Py_None && !PyTuple_Check(value))) {
jpayne@69 14990 PyErr_SetString(PyExc_TypeError,
jpayne@69 14991 "__defaults__ must be set to a tuple object");
jpayne@69 14992 return -1;
jpayne@69 14993 }
jpayne@69 14994 PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__defaults__ will not "
jpayne@69 14995 "currently affect the values used in function calls", 1);
jpayne@69 14996 Py_INCREF(value);
jpayne@69 14997 __Pyx_Py_XDECREF_SET(op->defaults_tuple, value);
jpayne@69 14998 return 0;
jpayne@69 14999 }
jpayne@69 15000 static PyObject *
jpayne@69 15001 __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, void *context) {
jpayne@69 15002 PyObject* result = op->defaults_tuple;
jpayne@69 15003 CYTHON_UNUSED_VAR(context);
jpayne@69 15004 if (unlikely(!result)) {
jpayne@69 15005 if (op->defaults_getter) {
jpayne@69 15006 if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL;
jpayne@69 15007 result = op->defaults_tuple;
jpayne@69 15008 } else {
jpayne@69 15009 result = Py_None;
jpayne@69 15010 }
jpayne@69 15011 }
jpayne@69 15012 Py_INCREF(result);
jpayne@69 15013 return result;
jpayne@69 15014 }
jpayne@69 15015 static int
jpayne@69 15016 __Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
jpayne@69 15017 CYTHON_UNUSED_VAR(context);
jpayne@69 15018 if (!value) {
jpayne@69 15019 value = Py_None;
jpayne@69 15020 } else if (unlikely(value != Py_None && !PyDict_Check(value))) {
jpayne@69 15021 PyErr_SetString(PyExc_TypeError,
jpayne@69 15022 "__kwdefaults__ must be set to a dict object");
jpayne@69 15023 return -1;
jpayne@69 15024 }
jpayne@69 15025 PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__kwdefaults__ will not "
jpayne@69 15026 "currently affect the values used in function calls", 1);
jpayne@69 15027 Py_INCREF(value);
jpayne@69 15028 __Pyx_Py_XDECREF_SET(op->defaults_kwdict, value);
jpayne@69 15029 return 0;
jpayne@69 15030 }
jpayne@69 15031 static PyObject *
jpayne@69 15032 __Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, void *context) {
jpayne@69 15033 PyObject* result = op->defaults_kwdict;
jpayne@69 15034 CYTHON_UNUSED_VAR(context);
jpayne@69 15035 if (unlikely(!result)) {
jpayne@69 15036 if (op->defaults_getter) {
jpayne@69 15037 if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL;
jpayne@69 15038 result = op->defaults_kwdict;
jpayne@69 15039 } else {
jpayne@69 15040 result = Py_None;
jpayne@69 15041 }
jpayne@69 15042 }
jpayne@69 15043 Py_INCREF(result);
jpayne@69 15044 return result;
jpayne@69 15045 }
jpayne@69 15046 static int
jpayne@69 15047 __Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
jpayne@69 15048 CYTHON_UNUSED_VAR(context);
jpayne@69 15049 if (!value || value == Py_None) {
jpayne@69 15050 value = NULL;
jpayne@69 15051 } else if (unlikely(!PyDict_Check(value))) {
jpayne@69 15052 PyErr_SetString(PyExc_TypeError,
jpayne@69 15053 "__annotations__ must be set to a dict object");
jpayne@69 15054 return -1;
jpayne@69 15055 }
jpayne@69 15056 Py_XINCREF(value);
jpayne@69 15057 __Pyx_Py_XDECREF_SET(op->func_annotations, value);
jpayne@69 15058 return 0;
jpayne@69 15059 }
jpayne@69 15060 static PyObject *
jpayne@69 15061 __Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, void *context) {
jpayne@69 15062 PyObject* result = op->func_annotations;
jpayne@69 15063 CYTHON_UNUSED_VAR(context);
jpayne@69 15064 if (unlikely(!result)) {
jpayne@69 15065 result = PyDict_New();
jpayne@69 15066 if (unlikely(!result)) return NULL;
jpayne@69 15067 op->func_annotations = result;
jpayne@69 15068 }
jpayne@69 15069 Py_INCREF(result);
jpayne@69 15070 return result;
jpayne@69 15071 }
jpayne@69 15072 static PyObject *
jpayne@69 15073 __Pyx_CyFunction_get_is_coroutine(__pyx_CyFunctionObject *op, void *context) {
jpayne@69 15074 int is_coroutine;
jpayne@69 15075 CYTHON_UNUSED_VAR(context);
jpayne@69 15076 if (op->func_is_coroutine) {
jpayne@69 15077 return __Pyx_NewRef(op->func_is_coroutine);
jpayne@69 15078 }
jpayne@69 15079 is_coroutine = op->flags & __Pyx_CYFUNCTION_COROUTINE;
jpayne@69 15080 #if PY_VERSION_HEX >= 0x03050000
jpayne@69 15081 if (is_coroutine) {
jpayne@69 15082 PyObject *module, *fromlist, *marker = __pyx_n_s_is_coroutine;
jpayne@69 15083 fromlist = PyList_New(1);
jpayne@69 15084 if (unlikely(!fromlist)) return NULL;
jpayne@69 15085 Py_INCREF(marker);
jpayne@69 15086 #if CYTHON_ASSUME_SAFE_MACROS
jpayne@69 15087 PyList_SET_ITEM(fromlist, 0, marker);
jpayne@69 15088 #else
jpayne@69 15089 if (unlikely(PyList_SetItem(fromlist, 0, marker) < 0)) {
jpayne@69 15090 Py_DECREF(marker);
jpayne@69 15091 Py_DECREF(fromlist);
jpayne@69 15092 return NULL;
jpayne@69 15093 }
jpayne@69 15094 #endif
jpayne@69 15095 module = PyImport_ImportModuleLevelObject(__pyx_n_s_asyncio_coroutines, NULL, NULL, fromlist, 0);
jpayne@69 15096 Py_DECREF(fromlist);
jpayne@69 15097 if (unlikely(!module)) goto ignore;
jpayne@69 15098 op->func_is_coroutine = __Pyx_PyObject_GetAttrStr(module, marker);
jpayne@69 15099 Py_DECREF(module);
jpayne@69 15100 if (likely(op->func_is_coroutine)) {
jpayne@69 15101 return __Pyx_NewRef(op->func_is_coroutine);
jpayne@69 15102 }
jpayne@69 15103 ignore:
jpayne@69 15104 PyErr_Clear();
jpayne@69 15105 }
jpayne@69 15106 #endif
jpayne@69 15107 op->func_is_coroutine = __Pyx_PyBool_FromLong(is_coroutine);
jpayne@69 15108 return __Pyx_NewRef(op->func_is_coroutine);
jpayne@69 15109 }
jpayne@69 15110 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 15111 static PyObject *
jpayne@69 15112 __Pyx_CyFunction_get_module(__pyx_CyFunctionObject *op, void *context) {
jpayne@69 15113 CYTHON_UNUSED_VAR(context);
jpayne@69 15114 return PyObject_GetAttrString(op->func, "__module__");
jpayne@69 15115 }
jpayne@69 15116 static int
jpayne@69 15117 __Pyx_CyFunction_set_module(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
jpayne@69 15118 CYTHON_UNUSED_VAR(context);
jpayne@69 15119 return PyObject_SetAttrString(op->func, "__module__", value);
jpayne@69 15120 }
jpayne@69 15121 #endif
jpayne@69 15122 static PyGetSetDef __pyx_CyFunction_getsets[] = {
jpayne@69 15123 {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
jpayne@69 15124 {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
jpayne@69 15125 {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
jpayne@69 15126 {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
jpayne@69 15127 {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
jpayne@69 15128 {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
jpayne@69 15129 {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
jpayne@69 15130 {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
jpayne@69 15131 {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
jpayne@69 15132 {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
jpayne@69 15133 {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
jpayne@69 15134 {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
jpayne@69 15135 {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
jpayne@69 15136 {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
jpayne@69 15137 {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
jpayne@69 15138 {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
jpayne@69 15139 {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
jpayne@69 15140 {(char *) "_is_coroutine", (getter)__Pyx_CyFunction_get_is_coroutine, 0, 0, 0},
jpayne@69 15141 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 15142 {"__module__", (getter)__Pyx_CyFunction_get_module, (setter)__Pyx_CyFunction_set_module, 0, 0},
jpayne@69 15143 #endif
jpayne@69 15144 {0, 0, 0, 0, 0}
jpayne@69 15145 };
jpayne@69 15146 static PyMemberDef __pyx_CyFunction_members[] = {
jpayne@69 15147 #if !CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 15148 {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), 0, 0},
jpayne@69 15149 #endif
jpayne@69 15150 #if CYTHON_USE_TYPE_SPECS
jpayne@69 15151 {(char *) "__dictoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_dict), READONLY, 0},
jpayne@69 15152 #if CYTHON_METH_FASTCALL
jpayne@69 15153 #if CYTHON_BACKPORT_VECTORCALL
jpayne@69 15154 {(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_vectorcall), READONLY, 0},
jpayne@69 15155 #else
jpayne@69 15156 #if !CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 15157 {(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(PyCFunctionObject, vectorcall), READONLY, 0},
jpayne@69 15158 #endif
jpayne@69 15159 #endif
jpayne@69 15160 #endif
jpayne@69 15161 #if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 15162 {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_weakreflist), READONLY, 0},
jpayne@69 15163 #else
jpayne@69 15164 {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(PyCFunctionObject, m_weakreflist), READONLY, 0},
jpayne@69 15165 #endif
jpayne@69 15166 #endif
jpayne@69 15167 {0, 0, 0, 0, 0}
jpayne@69 15168 };
jpayne@69 15169 static PyObject *
jpayne@69 15170 __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, PyObject *args)
jpayne@69 15171 {
jpayne@69 15172 CYTHON_UNUSED_VAR(args);
jpayne@69 15173 #if PY_MAJOR_VERSION >= 3
jpayne@69 15174 Py_INCREF(m->func_qualname);
jpayne@69 15175 return m->func_qualname;
jpayne@69 15176 #else
jpayne@69 15177 return PyString_FromString(((PyCFunctionObject*)m)->m_ml->ml_name);
jpayne@69 15178 #endif
jpayne@69 15179 }
jpayne@69 15180 static PyMethodDef __pyx_CyFunction_methods[] = {
jpayne@69 15181 {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
jpayne@69 15182 {0, 0, 0, 0}
jpayne@69 15183 };
jpayne@69 15184 #if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 15185 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
jpayne@69 15186 #else
jpayne@69 15187 #define __Pyx_CyFunction_weakreflist(cyfunc) (((PyCFunctionObject*)cyfunc)->m_weakreflist)
jpayne@69 15188 #endif
jpayne@69 15189 static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname,
jpayne@69 15190 PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
jpayne@69 15191 #if !CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 15192 PyCFunctionObject *cf = (PyCFunctionObject*) op;
jpayne@69 15193 #endif
jpayne@69 15194 if (unlikely(op == NULL))
jpayne@69 15195 return NULL;
jpayne@69 15196 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 15197 op->func = PyCFunction_NewEx(ml, (PyObject*)op, module);
jpayne@69 15198 if (unlikely(!op->func)) return NULL;
jpayne@69 15199 #endif
jpayne@69 15200 op->flags = flags;
jpayne@69 15201 __Pyx_CyFunction_weakreflist(op) = NULL;
jpayne@69 15202 #if !CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 15203 cf->m_ml = ml;
jpayne@69 15204 cf->m_self = (PyObject *) op;
jpayne@69 15205 #endif
jpayne@69 15206 Py_XINCREF(closure);
jpayne@69 15207 op->func_closure = closure;
jpayne@69 15208 #if !CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 15209 Py_XINCREF(module);
jpayne@69 15210 cf->m_module = module;
jpayne@69 15211 #endif
jpayne@69 15212 op->func_dict = NULL;
jpayne@69 15213 op->func_name = NULL;
jpayne@69 15214 Py_INCREF(qualname);
jpayne@69 15215 op->func_qualname = qualname;
jpayne@69 15216 op->func_doc = NULL;
jpayne@69 15217 #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 15218 op->func_classobj = NULL;
jpayne@69 15219 #else
jpayne@69 15220 ((PyCMethodObject*)op)->mm_class = NULL;
jpayne@69 15221 #endif
jpayne@69 15222 op->func_globals = globals;
jpayne@69 15223 Py_INCREF(op->func_globals);
jpayne@69 15224 Py_XINCREF(code);
jpayne@69 15225 op->func_code = code;
jpayne@69 15226 op->defaults_pyobjects = 0;
jpayne@69 15227 op->defaults_size = 0;
jpayne@69 15228 op->defaults = NULL;
jpayne@69 15229 op->defaults_tuple = NULL;
jpayne@69 15230 op->defaults_kwdict = NULL;
jpayne@69 15231 op->defaults_getter = NULL;
jpayne@69 15232 op->func_annotations = NULL;
jpayne@69 15233 op->func_is_coroutine = NULL;
jpayne@69 15234 #if CYTHON_METH_FASTCALL
jpayne@69 15235 switch (ml->ml_flags & (METH_VARARGS | METH_FASTCALL | METH_NOARGS | METH_O | METH_KEYWORDS | METH_METHOD)) {
jpayne@69 15236 case METH_NOARGS:
jpayne@69 15237 __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_NOARGS;
jpayne@69 15238 break;
jpayne@69 15239 case METH_O:
jpayne@69 15240 __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_O;
jpayne@69 15241 break;
jpayne@69 15242 case METH_METHOD | METH_FASTCALL | METH_KEYWORDS:
jpayne@69 15243 __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD;
jpayne@69 15244 break;
jpayne@69 15245 case METH_FASTCALL | METH_KEYWORDS:
jpayne@69 15246 __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS;
jpayne@69 15247 break;
jpayne@69 15248 case METH_VARARGS | METH_KEYWORDS:
jpayne@69 15249 __Pyx_CyFunction_func_vectorcall(op) = NULL;
jpayne@69 15250 break;
jpayne@69 15251 default:
jpayne@69 15252 PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction");
jpayne@69 15253 Py_DECREF(op);
jpayne@69 15254 return NULL;
jpayne@69 15255 }
jpayne@69 15256 #endif
jpayne@69 15257 return (PyObject *) op;
jpayne@69 15258 }
jpayne@69 15259 static int
jpayne@69 15260 __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
jpayne@69 15261 {
jpayne@69 15262 Py_CLEAR(m->func_closure);
jpayne@69 15263 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 15264 Py_CLEAR(m->func);
jpayne@69 15265 #else
jpayne@69 15266 Py_CLEAR(((PyCFunctionObject*)m)->m_module);
jpayne@69 15267 #endif
jpayne@69 15268 Py_CLEAR(m->func_dict);
jpayne@69 15269 Py_CLEAR(m->func_name);
jpayne@69 15270 Py_CLEAR(m->func_qualname);
jpayne@69 15271 Py_CLEAR(m->func_doc);
jpayne@69 15272 Py_CLEAR(m->func_globals);
jpayne@69 15273 Py_CLEAR(m->func_code);
jpayne@69 15274 #if !CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 15275 #if PY_VERSION_HEX < 0x030900B1
jpayne@69 15276 Py_CLEAR(__Pyx_CyFunction_GetClassObj(m));
jpayne@69 15277 #else
jpayne@69 15278 {
jpayne@69 15279 PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class;
jpayne@69 15280 ((PyCMethodObject *) (m))->mm_class = NULL;
jpayne@69 15281 Py_XDECREF(cls);
jpayne@69 15282 }
jpayne@69 15283 #endif
jpayne@69 15284 #endif
jpayne@69 15285 Py_CLEAR(m->defaults_tuple);
jpayne@69 15286 Py_CLEAR(m->defaults_kwdict);
jpayne@69 15287 Py_CLEAR(m->func_annotations);
jpayne@69 15288 Py_CLEAR(m->func_is_coroutine);
jpayne@69 15289 if (m->defaults) {
jpayne@69 15290 PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
jpayne@69 15291 int i;
jpayne@69 15292 for (i = 0; i < m->defaults_pyobjects; i++)
jpayne@69 15293 Py_XDECREF(pydefaults[i]);
jpayne@69 15294 PyObject_Free(m->defaults);
jpayne@69 15295 m->defaults = NULL;
jpayne@69 15296 }
jpayne@69 15297 return 0;
jpayne@69 15298 }
jpayne@69 15299 static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
jpayne@69 15300 {
jpayne@69 15301 if (__Pyx_CyFunction_weakreflist(m) != NULL)
jpayne@69 15302 PyObject_ClearWeakRefs((PyObject *) m);
jpayne@69 15303 __Pyx_CyFunction_clear(m);
jpayne@69 15304 __Pyx_PyHeapTypeObject_GC_Del(m);
jpayne@69 15305 }
jpayne@69 15306 static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
jpayne@69 15307 {
jpayne@69 15308 PyObject_GC_UnTrack(m);
jpayne@69 15309 __Pyx__CyFunction_dealloc(m);
jpayne@69 15310 }
jpayne@69 15311 static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
jpayne@69 15312 {
jpayne@69 15313 Py_VISIT(m->func_closure);
jpayne@69 15314 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 15315 Py_VISIT(m->func);
jpayne@69 15316 #else
jpayne@69 15317 Py_VISIT(((PyCFunctionObject*)m)->m_module);
jpayne@69 15318 #endif
jpayne@69 15319 Py_VISIT(m->func_dict);
jpayne@69 15320 Py_VISIT(m->func_name);
jpayne@69 15321 Py_VISIT(m->func_qualname);
jpayne@69 15322 Py_VISIT(m->func_doc);
jpayne@69 15323 Py_VISIT(m->func_globals);
jpayne@69 15324 Py_VISIT(m->func_code);
jpayne@69 15325 #if !CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 15326 Py_VISIT(__Pyx_CyFunction_GetClassObj(m));
jpayne@69 15327 #endif
jpayne@69 15328 Py_VISIT(m->defaults_tuple);
jpayne@69 15329 Py_VISIT(m->defaults_kwdict);
jpayne@69 15330 Py_VISIT(m->func_is_coroutine);
jpayne@69 15331 if (m->defaults) {
jpayne@69 15332 PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
jpayne@69 15333 int i;
jpayne@69 15334 for (i = 0; i < m->defaults_pyobjects; i++)
jpayne@69 15335 Py_VISIT(pydefaults[i]);
jpayne@69 15336 }
jpayne@69 15337 return 0;
jpayne@69 15338 }
jpayne@69 15339 static PyObject*
jpayne@69 15340 __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
jpayne@69 15341 {
jpayne@69 15342 #if PY_MAJOR_VERSION >= 3
jpayne@69 15343 return PyUnicode_FromFormat("<cyfunction %U at %p>",
jpayne@69 15344 op->func_qualname, (void *)op);
jpayne@69 15345 #else
jpayne@69 15346 return PyString_FromFormat("<cyfunction %s at %p>",
jpayne@69 15347 PyString_AsString(op->func_qualname), (void *)op);
jpayne@69 15348 #endif
jpayne@69 15349 }
jpayne@69 15350 static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) {
jpayne@69 15351 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 15352 PyObject *f = ((__pyx_CyFunctionObject*)func)->func;
jpayne@69 15353 PyObject *py_name = NULL;
jpayne@69 15354 PyCFunction meth;
jpayne@69 15355 int flags;
jpayne@69 15356 meth = PyCFunction_GetFunction(f);
jpayne@69 15357 if (unlikely(!meth)) return NULL;
jpayne@69 15358 flags = PyCFunction_GetFlags(f);
jpayne@69 15359 if (unlikely(flags < 0)) return NULL;
jpayne@69 15360 #else
jpayne@69 15361 PyCFunctionObject* f = (PyCFunctionObject*)func;
jpayne@69 15362 PyCFunction meth = f->m_ml->ml_meth;
jpayne@69 15363 int flags = f->m_ml->ml_flags;
jpayne@69 15364 #endif
jpayne@69 15365 Py_ssize_t size;
jpayne@69 15366 switch (flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
jpayne@69 15367 case METH_VARARGS:
jpayne@69 15368 if (likely(kw == NULL || PyDict_Size(kw) == 0))
jpayne@69 15369 return (*meth)(self, arg);
jpayne@69 15370 break;
jpayne@69 15371 case METH_VARARGS | METH_KEYWORDS:
jpayne@69 15372 return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw);
jpayne@69 15373 case METH_NOARGS:
jpayne@69 15374 if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
jpayne@69 15375 #if CYTHON_ASSUME_SAFE_MACROS
jpayne@69 15376 size = PyTuple_GET_SIZE(arg);
jpayne@69 15377 #else
jpayne@69 15378 size = PyTuple_Size(arg);
jpayne@69 15379 if (unlikely(size < 0)) return NULL;
jpayne@69 15380 #endif
jpayne@69 15381 if (likely(size == 0))
jpayne@69 15382 return (*meth)(self, NULL);
jpayne@69 15383 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 15384 py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL);
jpayne@69 15385 if (!py_name) return NULL;
jpayne@69 15386 PyErr_Format(PyExc_TypeError,
jpayne@69 15387 "%.200S() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
jpayne@69 15388 py_name, size);
jpayne@69 15389 Py_DECREF(py_name);
jpayne@69 15390 #else
jpayne@69 15391 PyErr_Format(PyExc_TypeError,
jpayne@69 15392 "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
jpayne@69 15393 f->m_ml->ml_name, size);
jpayne@69 15394 #endif
jpayne@69 15395 return NULL;
jpayne@69 15396 }
jpayne@69 15397 break;
jpayne@69 15398 case METH_O:
jpayne@69 15399 if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
jpayne@69 15400 #if CYTHON_ASSUME_SAFE_MACROS
jpayne@69 15401 size = PyTuple_GET_SIZE(arg);
jpayne@69 15402 #else
jpayne@69 15403 size = PyTuple_Size(arg);
jpayne@69 15404 if (unlikely(size < 0)) return NULL;
jpayne@69 15405 #endif
jpayne@69 15406 if (likely(size == 1)) {
jpayne@69 15407 PyObject *result, *arg0;
jpayne@69 15408 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
jpayne@69 15409 arg0 = PyTuple_GET_ITEM(arg, 0);
jpayne@69 15410 #else
jpayne@69 15411 arg0 = __Pyx_PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL;
jpayne@69 15412 #endif
jpayne@69 15413 result = (*meth)(self, arg0);
jpayne@69 15414 #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
jpayne@69 15415 Py_DECREF(arg0);
jpayne@69 15416 #endif
jpayne@69 15417 return result;
jpayne@69 15418 }
jpayne@69 15419 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 15420 py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL);
jpayne@69 15421 if (!py_name) return NULL;
jpayne@69 15422 PyErr_Format(PyExc_TypeError,
jpayne@69 15423 "%.200S() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
jpayne@69 15424 py_name, size);
jpayne@69 15425 Py_DECREF(py_name);
jpayne@69 15426 #else
jpayne@69 15427 PyErr_Format(PyExc_TypeError,
jpayne@69 15428 "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
jpayne@69 15429 f->m_ml->ml_name, size);
jpayne@69 15430 #endif
jpayne@69 15431 return NULL;
jpayne@69 15432 }
jpayne@69 15433 break;
jpayne@69 15434 default:
jpayne@69 15435 PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction");
jpayne@69 15436 return NULL;
jpayne@69 15437 }
jpayne@69 15438 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 15439 py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL);
jpayne@69 15440 if (!py_name) return NULL;
jpayne@69 15441 PyErr_Format(PyExc_TypeError, "%.200S() takes no keyword arguments",
jpayne@69 15442 py_name);
jpayne@69 15443 Py_DECREF(py_name);
jpayne@69 15444 #else
jpayne@69 15445 PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
jpayne@69 15446 f->m_ml->ml_name);
jpayne@69 15447 #endif
jpayne@69 15448 return NULL;
jpayne@69 15449 }
jpayne@69 15450 static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
jpayne@69 15451 PyObject *self, *result;
jpayne@69 15452 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 15453 self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)func)->func);
jpayne@69 15454 if (unlikely(!self) && PyErr_Occurred()) return NULL;
jpayne@69 15455 #else
jpayne@69 15456 self = ((PyCFunctionObject*)func)->m_self;
jpayne@69 15457 #endif
jpayne@69 15458 result = __Pyx_CyFunction_CallMethod(func, self, arg, kw);
jpayne@69 15459 return result;
jpayne@69 15460 }
jpayne@69 15461 static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
jpayne@69 15462 PyObject *result;
jpayne@69 15463 __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
jpayne@69 15464 #if CYTHON_METH_FASTCALL
jpayne@69 15465 __pyx_vectorcallfunc vc = __Pyx_CyFunction_func_vectorcall(cyfunc);
jpayne@69 15466 if (vc) {
jpayne@69 15467 #if CYTHON_ASSUME_SAFE_MACROS
jpayne@69 15468 return __Pyx_PyVectorcall_FastCallDict(func, vc, &PyTuple_GET_ITEM(args, 0), (size_t)PyTuple_GET_SIZE(args), kw);
jpayne@69 15469 #else
jpayne@69 15470 (void) &__Pyx_PyVectorcall_FastCallDict;
jpayne@69 15471 return PyVectorcall_Call(func, args, kw);
jpayne@69 15472 #endif
jpayne@69 15473 }
jpayne@69 15474 #endif
jpayne@69 15475 if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
jpayne@69 15476 Py_ssize_t argc;
jpayne@69 15477 PyObject *new_args;
jpayne@69 15478 PyObject *self;
jpayne@69 15479 #if CYTHON_ASSUME_SAFE_MACROS
jpayne@69 15480 argc = PyTuple_GET_SIZE(args);
jpayne@69 15481 #else
jpayne@69 15482 argc = PyTuple_Size(args);
jpayne@69 15483 if (unlikely(!argc) < 0) return NULL;
jpayne@69 15484 #endif
jpayne@69 15485 new_args = PyTuple_GetSlice(args, 1, argc);
jpayne@69 15486 if (unlikely(!new_args))
jpayne@69 15487 return NULL;
jpayne@69 15488 self = PyTuple_GetItem(args, 0);
jpayne@69 15489 if (unlikely(!self)) {
jpayne@69 15490 Py_DECREF(new_args);
jpayne@69 15491 #if PY_MAJOR_VERSION > 2
jpayne@69 15492 PyErr_Format(PyExc_TypeError,
jpayne@69 15493 "unbound method %.200S() needs an argument",
jpayne@69 15494 cyfunc->func_qualname);
jpayne@69 15495 #else
jpayne@69 15496 PyErr_SetString(PyExc_TypeError,
jpayne@69 15497 "unbound method needs an argument");
jpayne@69 15498 #endif
jpayne@69 15499 return NULL;
jpayne@69 15500 }
jpayne@69 15501 result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw);
jpayne@69 15502 Py_DECREF(new_args);
jpayne@69 15503 } else {
jpayne@69 15504 result = __Pyx_CyFunction_Call(func, args, kw);
jpayne@69 15505 }
jpayne@69 15506 return result;
jpayne@69 15507 }
jpayne@69 15508 #if CYTHON_METH_FASTCALL
jpayne@69 15509 static CYTHON_INLINE int __Pyx_CyFunction_Vectorcall_CheckArgs(__pyx_CyFunctionObject *cyfunc, Py_ssize_t nargs, PyObject *kwnames)
jpayne@69 15510 {
jpayne@69 15511 int ret = 0;
jpayne@69 15512 if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
jpayne@69 15513 if (unlikely(nargs < 1)) {
jpayne@69 15514 PyErr_Format(PyExc_TypeError, "%.200s() needs an argument",
jpayne@69 15515 ((PyCFunctionObject*)cyfunc)->m_ml->ml_name);
jpayne@69 15516 return -1;
jpayne@69 15517 }
jpayne@69 15518 ret = 1;
jpayne@69 15519 }
jpayne@69 15520 if (unlikely(kwnames) && unlikely(PyTuple_GET_SIZE(kwnames))) {
jpayne@69 15521 PyErr_Format(PyExc_TypeError,
jpayne@69 15522 "%.200s() takes no keyword arguments", ((PyCFunctionObject*)cyfunc)->m_ml->ml_name);
jpayne@69 15523 return -1;
jpayne@69 15524 }
jpayne@69 15525 return ret;
jpayne@69 15526 }
jpayne@69 15527 static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
jpayne@69 15528 {
jpayne@69 15529 __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
jpayne@69 15530 PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml;
jpayne@69 15531 #if CYTHON_BACKPORT_VECTORCALL
jpayne@69 15532 Py_ssize_t nargs = (Py_ssize_t)nargsf;
jpayne@69 15533 #else
jpayne@69 15534 Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
jpayne@69 15535 #endif
jpayne@69 15536 PyObject *self;
jpayne@69 15537 switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) {
jpayne@69 15538 case 1:
jpayne@69 15539 self = args[0];
jpayne@69 15540 args += 1;
jpayne@69 15541 nargs -= 1;
jpayne@69 15542 break;
jpayne@69 15543 case 0:
jpayne@69 15544 self = ((PyCFunctionObject*)cyfunc)->m_self;
jpayne@69 15545 break;
jpayne@69 15546 default:
jpayne@69 15547 return NULL;
jpayne@69 15548 }
jpayne@69 15549 if (unlikely(nargs != 0)) {
jpayne@69 15550 PyErr_Format(PyExc_TypeError,
jpayne@69 15551 "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
jpayne@69 15552 def->ml_name, nargs);
jpayne@69 15553 return NULL;
jpayne@69 15554 }
jpayne@69 15555 return def->ml_meth(self, NULL);
jpayne@69 15556 }
jpayne@69 15557 static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
jpayne@69 15558 {
jpayne@69 15559 __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
jpayne@69 15560 PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml;
jpayne@69 15561 #if CYTHON_BACKPORT_VECTORCALL
jpayne@69 15562 Py_ssize_t nargs = (Py_ssize_t)nargsf;
jpayne@69 15563 #else
jpayne@69 15564 Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
jpayne@69 15565 #endif
jpayne@69 15566 PyObject *self;
jpayne@69 15567 switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) {
jpayne@69 15568 case 1:
jpayne@69 15569 self = args[0];
jpayne@69 15570 args += 1;
jpayne@69 15571 nargs -= 1;
jpayne@69 15572 break;
jpayne@69 15573 case 0:
jpayne@69 15574 self = ((PyCFunctionObject*)cyfunc)->m_self;
jpayne@69 15575 break;
jpayne@69 15576 default:
jpayne@69 15577 return NULL;
jpayne@69 15578 }
jpayne@69 15579 if (unlikely(nargs != 1)) {
jpayne@69 15580 PyErr_Format(PyExc_TypeError,
jpayne@69 15581 "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
jpayne@69 15582 def->ml_name, nargs);
jpayne@69 15583 return NULL;
jpayne@69 15584 }
jpayne@69 15585 return def->ml_meth(self, args[0]);
jpayne@69 15586 }
jpayne@69 15587 static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
jpayne@69 15588 {
jpayne@69 15589 __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
jpayne@69 15590 PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml;
jpayne@69 15591 #if CYTHON_BACKPORT_VECTORCALL
jpayne@69 15592 Py_ssize_t nargs = (Py_ssize_t)nargsf;
jpayne@69 15593 #else
jpayne@69 15594 Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
jpayne@69 15595 #endif
jpayne@69 15596 PyObject *self;
jpayne@69 15597 switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) {
jpayne@69 15598 case 1:
jpayne@69 15599 self = args[0];
jpayne@69 15600 args += 1;
jpayne@69 15601 nargs -= 1;
jpayne@69 15602 break;
jpayne@69 15603 case 0:
jpayne@69 15604 self = ((PyCFunctionObject*)cyfunc)->m_self;
jpayne@69 15605 break;
jpayne@69 15606 default:
jpayne@69 15607 return NULL;
jpayne@69 15608 }
jpayne@69 15609 return ((__Pyx_PyCFunctionFastWithKeywords)(void(*)(void))def->ml_meth)(self, args, nargs, kwnames);
jpayne@69 15610 }
jpayne@69 15611 static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
jpayne@69 15612 {
jpayne@69 15613 __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
jpayne@69 15614 PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml;
jpayne@69 15615 PyTypeObject *cls = (PyTypeObject *) __Pyx_CyFunction_GetClassObj(cyfunc);
jpayne@69 15616 #if CYTHON_BACKPORT_VECTORCALL
jpayne@69 15617 Py_ssize_t nargs = (Py_ssize_t)nargsf;
jpayne@69 15618 #else
jpayne@69 15619 Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
jpayne@69 15620 #endif
jpayne@69 15621 PyObject *self;
jpayne@69 15622 switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) {
jpayne@69 15623 case 1:
jpayne@69 15624 self = args[0];
jpayne@69 15625 args += 1;
jpayne@69 15626 nargs -= 1;
jpayne@69 15627 break;
jpayne@69 15628 case 0:
jpayne@69 15629 self = ((PyCFunctionObject*)cyfunc)->m_self;
jpayne@69 15630 break;
jpayne@69 15631 default:
jpayne@69 15632 return NULL;
jpayne@69 15633 }
jpayne@69 15634 return ((__Pyx_PyCMethod)(void(*)(void))def->ml_meth)(self, cls, args, (size_t)nargs, kwnames);
jpayne@69 15635 }
jpayne@69 15636 #endif
jpayne@69 15637 #if CYTHON_USE_TYPE_SPECS
jpayne@69 15638 static PyType_Slot __pyx_CyFunctionType_slots[] = {
jpayne@69 15639 {Py_tp_dealloc, (void *)__Pyx_CyFunction_dealloc},
jpayne@69 15640 {Py_tp_repr, (void *)__Pyx_CyFunction_repr},
jpayne@69 15641 {Py_tp_call, (void *)__Pyx_CyFunction_CallAsMethod},
jpayne@69 15642 {Py_tp_traverse, (void *)__Pyx_CyFunction_traverse},
jpayne@69 15643 {Py_tp_clear, (void *)__Pyx_CyFunction_clear},
jpayne@69 15644 {Py_tp_methods, (void *)__pyx_CyFunction_methods},
jpayne@69 15645 {Py_tp_members, (void *)__pyx_CyFunction_members},
jpayne@69 15646 {Py_tp_getset, (void *)__pyx_CyFunction_getsets},
jpayne@69 15647 {Py_tp_descr_get, (void *)__Pyx_PyMethod_New},
jpayne@69 15648 {0, 0},
jpayne@69 15649 };
jpayne@69 15650 static PyType_Spec __pyx_CyFunctionType_spec = {
jpayne@69 15651 __PYX_TYPE_MODULE_PREFIX "cython_function_or_method",
jpayne@69 15652 sizeof(__pyx_CyFunctionObject),
jpayne@69 15653 0,
jpayne@69 15654 #ifdef Py_TPFLAGS_METHOD_DESCRIPTOR
jpayne@69 15655 Py_TPFLAGS_METHOD_DESCRIPTOR |
jpayne@69 15656 #endif
jpayne@69 15657 #if (defined(_Py_TPFLAGS_HAVE_VECTORCALL) && CYTHON_METH_FASTCALL)
jpayne@69 15658 _Py_TPFLAGS_HAVE_VECTORCALL |
jpayne@69 15659 #endif
jpayne@69 15660 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE,
jpayne@69 15661 __pyx_CyFunctionType_slots
jpayne@69 15662 };
jpayne@69 15663 #else
jpayne@69 15664 static PyTypeObject __pyx_CyFunctionType_type = {
jpayne@69 15665 PyVarObject_HEAD_INIT(0, 0)
jpayne@69 15666 __PYX_TYPE_MODULE_PREFIX "cython_function_or_method",
jpayne@69 15667 sizeof(__pyx_CyFunctionObject),
jpayne@69 15668 0,
jpayne@69 15669 (destructor) __Pyx_CyFunction_dealloc,
jpayne@69 15670 #if !CYTHON_METH_FASTCALL
jpayne@69 15671 0,
jpayne@69 15672 #elif CYTHON_BACKPORT_VECTORCALL
jpayne@69 15673 (printfunc)offsetof(__pyx_CyFunctionObject, func_vectorcall),
jpayne@69 15674 #else
jpayne@69 15675 offsetof(PyCFunctionObject, vectorcall),
jpayne@69 15676 #endif
jpayne@69 15677 0,
jpayne@69 15678 0,
jpayne@69 15679 #if PY_MAJOR_VERSION < 3
jpayne@69 15680 0,
jpayne@69 15681 #else
jpayne@69 15682 0,
jpayne@69 15683 #endif
jpayne@69 15684 (reprfunc) __Pyx_CyFunction_repr,
jpayne@69 15685 0,
jpayne@69 15686 0,
jpayne@69 15687 0,
jpayne@69 15688 0,
jpayne@69 15689 __Pyx_CyFunction_CallAsMethod,
jpayne@69 15690 0,
jpayne@69 15691 0,
jpayne@69 15692 0,
jpayne@69 15693 0,
jpayne@69 15694 #ifdef Py_TPFLAGS_METHOD_DESCRIPTOR
jpayne@69 15695 Py_TPFLAGS_METHOD_DESCRIPTOR |
jpayne@69 15696 #endif
jpayne@69 15697 #if defined(_Py_TPFLAGS_HAVE_VECTORCALL) && CYTHON_METH_FASTCALL
jpayne@69 15698 _Py_TPFLAGS_HAVE_VECTORCALL |
jpayne@69 15699 #endif
jpayne@69 15700 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE,
jpayne@69 15701 0,
jpayne@69 15702 (traverseproc) __Pyx_CyFunction_traverse,
jpayne@69 15703 (inquiry) __Pyx_CyFunction_clear,
jpayne@69 15704 0,
jpayne@69 15705 #if PY_VERSION_HEX < 0x030500A0
jpayne@69 15706 offsetof(__pyx_CyFunctionObject, func_weakreflist),
jpayne@69 15707 #else
jpayne@69 15708 offsetof(PyCFunctionObject, m_weakreflist),
jpayne@69 15709 #endif
jpayne@69 15710 0,
jpayne@69 15711 0,
jpayne@69 15712 __pyx_CyFunction_methods,
jpayne@69 15713 __pyx_CyFunction_members,
jpayne@69 15714 __pyx_CyFunction_getsets,
jpayne@69 15715 0,
jpayne@69 15716 0,
jpayne@69 15717 __Pyx_PyMethod_New,
jpayne@69 15718 0,
jpayne@69 15719 offsetof(__pyx_CyFunctionObject, func_dict),
jpayne@69 15720 0,
jpayne@69 15721 0,
jpayne@69 15722 0,
jpayne@69 15723 0,
jpayne@69 15724 0,
jpayne@69 15725 0,
jpayne@69 15726 0,
jpayne@69 15727 0,
jpayne@69 15728 0,
jpayne@69 15729 0,
jpayne@69 15730 0,
jpayne@69 15731 0,
jpayne@69 15732 #if PY_VERSION_HEX >= 0x030400a1
jpayne@69 15733 0,
jpayne@69 15734 #endif
jpayne@69 15735 #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
jpayne@69 15736 0,
jpayne@69 15737 #endif
jpayne@69 15738 #if __PYX_NEED_TP_PRINT_SLOT
jpayne@69 15739 0,
jpayne@69 15740 #endif
jpayne@69 15741 #if PY_VERSION_HEX >= 0x030C0000
jpayne@69 15742 0,
jpayne@69 15743 #endif
jpayne@69 15744 #if PY_VERSION_HEX >= 0x030d00A4
jpayne@69 15745 0,
jpayne@69 15746 #endif
jpayne@69 15747 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
jpayne@69 15748 0,
jpayne@69 15749 #endif
jpayne@69 15750 };
jpayne@69 15751 #endif
jpayne@69 15752 static int __pyx_CyFunction_init(PyObject *module) {
jpayne@69 15753 #if CYTHON_USE_TYPE_SPECS
jpayne@69 15754 __pyx_CyFunctionType = __Pyx_FetchCommonTypeFromSpec(module, &__pyx_CyFunctionType_spec, NULL);
jpayne@69 15755 #else
jpayne@69 15756 CYTHON_UNUSED_VAR(module);
jpayne@69 15757 __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
jpayne@69 15758 #endif
jpayne@69 15759 if (unlikely(__pyx_CyFunctionType == NULL)) {
jpayne@69 15760 return -1;
jpayne@69 15761 }
jpayne@69 15762 return 0;
jpayne@69 15763 }
jpayne@69 15764 static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
jpayne@69 15765 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
jpayne@69 15766 m->defaults = PyObject_Malloc(size);
jpayne@69 15767 if (unlikely(!m->defaults))
jpayne@69 15768 return PyErr_NoMemory();
jpayne@69 15769 memset(m->defaults, 0, size);
jpayne@69 15770 m->defaults_pyobjects = pyobjects;
jpayne@69 15771 m->defaults_size = size;
jpayne@69 15772 return m->defaults;
jpayne@69 15773 }
jpayne@69 15774 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
jpayne@69 15775 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
jpayne@69 15776 m->defaults_tuple = tuple;
jpayne@69 15777 Py_INCREF(tuple);
jpayne@69 15778 }
jpayne@69 15779 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
jpayne@69 15780 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
jpayne@69 15781 m->defaults_kwdict = dict;
jpayne@69 15782 Py_INCREF(dict);
jpayne@69 15783 }
jpayne@69 15784 static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
jpayne@69 15785 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
jpayne@69 15786 m->func_annotations = dict;
jpayne@69 15787 Py_INCREF(dict);
jpayne@69 15788 }
jpayne@69 15789
jpayne@69 15790 /* CythonFunction */
jpayne@69 15791 static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname,
jpayne@69 15792 PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
jpayne@69 15793 PyObject *op = __Pyx_CyFunction_Init(
jpayne@69 15794 PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType),
jpayne@69 15795 ml, flags, qualname, closure, module, globals, code
jpayne@69 15796 );
jpayne@69 15797 if (likely(op)) {
jpayne@69 15798 PyObject_GC_Track(op);
jpayne@69 15799 }
jpayne@69 15800 return op;
jpayne@69 15801 }
jpayne@69 15802
jpayne@69 15803 /* RaiseUnboundLocalError */
jpayne@69 15804 static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
jpayne@69 15805 PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
jpayne@69 15806 }
jpayne@69 15807
jpayne@69 15808 /* TypeImport */
jpayne@69 15809 #ifndef __PYX_HAVE_RT_ImportType_3_0_11
jpayne@69 15810 #define __PYX_HAVE_RT_ImportType_3_0_11
jpayne@69 15811 static PyTypeObject *__Pyx_ImportType_3_0_11(PyObject *module, const char *module_name, const char *class_name,
jpayne@69 15812 size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_11 check_size)
jpayne@69 15813 {
jpayne@69 15814 PyObject *result = 0;
jpayne@69 15815 char warning[200];
jpayne@69 15816 Py_ssize_t basicsize;
jpayne@69 15817 Py_ssize_t itemsize;
jpayne@69 15818 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 15819 PyObject *py_basicsize;
jpayne@69 15820 PyObject *py_itemsize;
jpayne@69 15821 #endif
jpayne@69 15822 result = PyObject_GetAttrString(module, class_name);
jpayne@69 15823 if (!result)
jpayne@69 15824 goto bad;
jpayne@69 15825 if (!PyType_Check(result)) {
jpayne@69 15826 PyErr_Format(PyExc_TypeError,
jpayne@69 15827 "%.200s.%.200s is not a type object",
jpayne@69 15828 module_name, class_name);
jpayne@69 15829 goto bad;
jpayne@69 15830 }
jpayne@69 15831 #if !CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 15832 basicsize = ((PyTypeObject *)result)->tp_basicsize;
jpayne@69 15833 itemsize = ((PyTypeObject *)result)->tp_itemsize;
jpayne@69 15834 #else
jpayne@69 15835 py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
jpayne@69 15836 if (!py_basicsize)
jpayne@69 15837 goto bad;
jpayne@69 15838 basicsize = PyLong_AsSsize_t(py_basicsize);
jpayne@69 15839 Py_DECREF(py_basicsize);
jpayne@69 15840 py_basicsize = 0;
jpayne@69 15841 if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
jpayne@69 15842 goto bad;
jpayne@69 15843 py_itemsize = PyObject_GetAttrString(result, "__itemsize__");
jpayne@69 15844 if (!py_itemsize)
jpayne@69 15845 goto bad;
jpayne@69 15846 itemsize = PyLong_AsSsize_t(py_itemsize);
jpayne@69 15847 Py_DECREF(py_itemsize);
jpayne@69 15848 py_itemsize = 0;
jpayne@69 15849 if (itemsize == (Py_ssize_t)-1 && PyErr_Occurred())
jpayne@69 15850 goto bad;
jpayne@69 15851 #endif
jpayne@69 15852 if (itemsize) {
jpayne@69 15853 if (size % alignment) {
jpayne@69 15854 alignment = size % alignment;
jpayne@69 15855 }
jpayne@69 15856 if (itemsize < (Py_ssize_t)alignment)
jpayne@69 15857 itemsize = (Py_ssize_t)alignment;
jpayne@69 15858 }
jpayne@69 15859 if ((size_t)(basicsize + itemsize) < size) {
jpayne@69 15860 PyErr_Format(PyExc_ValueError,
jpayne@69 15861 "%.200s.%.200s size changed, may indicate binary incompatibility. "
jpayne@69 15862 "Expected %zd from C header, got %zd from PyObject",
jpayne@69 15863 module_name, class_name, size, basicsize+itemsize);
jpayne@69 15864 goto bad;
jpayne@69 15865 }
jpayne@69 15866 if (check_size == __Pyx_ImportType_CheckSize_Error_3_0_11 &&
jpayne@69 15867 ((size_t)basicsize > size || (size_t)(basicsize + itemsize) < size)) {
jpayne@69 15868 PyErr_Format(PyExc_ValueError,
jpayne@69 15869 "%.200s.%.200s size changed, may indicate binary incompatibility. "
jpayne@69 15870 "Expected %zd from C header, got %zd-%zd from PyObject",
jpayne@69 15871 module_name, class_name, size, basicsize, basicsize+itemsize);
jpayne@69 15872 goto bad;
jpayne@69 15873 }
jpayne@69 15874 else if (check_size == __Pyx_ImportType_CheckSize_Warn_3_0_11 && (size_t)basicsize > size) {
jpayne@69 15875 PyOS_snprintf(warning, sizeof(warning),
jpayne@69 15876 "%s.%s size changed, may indicate binary incompatibility. "
jpayne@69 15877 "Expected %zd from C header, got %zd from PyObject",
jpayne@69 15878 module_name, class_name, size, basicsize);
jpayne@69 15879 if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
jpayne@69 15880 }
jpayne@69 15881 return (PyTypeObject *)result;
jpayne@69 15882 bad:
jpayne@69 15883 Py_XDECREF(result);
jpayne@69 15884 return NULL;
jpayne@69 15885 }
jpayne@69 15886 #endif
jpayne@69 15887
jpayne@69 15888 /* Import */
jpayne@69 15889 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
jpayne@69 15890 PyObject *module = 0;
jpayne@69 15891 PyObject *empty_dict = 0;
jpayne@69 15892 PyObject *empty_list = 0;
jpayne@69 15893 #if PY_MAJOR_VERSION < 3
jpayne@69 15894 PyObject *py_import;
jpayne@69 15895 py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
jpayne@69 15896 if (unlikely(!py_import))
jpayne@69 15897 goto bad;
jpayne@69 15898 if (!from_list) {
jpayne@69 15899 empty_list = PyList_New(0);
jpayne@69 15900 if (unlikely(!empty_list))
jpayne@69 15901 goto bad;
jpayne@69 15902 from_list = empty_list;
jpayne@69 15903 }
jpayne@69 15904 #endif
jpayne@69 15905 empty_dict = PyDict_New();
jpayne@69 15906 if (unlikely(!empty_dict))
jpayne@69 15907 goto bad;
jpayne@69 15908 {
jpayne@69 15909 #if PY_MAJOR_VERSION >= 3
jpayne@69 15910 if (level == -1) {
jpayne@69 15911 if (strchr(__Pyx_MODULE_NAME, '.') != NULL) {
jpayne@69 15912 module = PyImport_ImportModuleLevelObject(
jpayne@69 15913 name, __pyx_d, empty_dict, from_list, 1);
jpayne@69 15914 if (unlikely(!module)) {
jpayne@69 15915 if (unlikely(!PyErr_ExceptionMatches(PyExc_ImportError)))
jpayne@69 15916 goto bad;
jpayne@69 15917 PyErr_Clear();
jpayne@69 15918 }
jpayne@69 15919 }
jpayne@69 15920 level = 0;
jpayne@69 15921 }
jpayne@69 15922 #endif
jpayne@69 15923 if (!module) {
jpayne@69 15924 #if PY_MAJOR_VERSION < 3
jpayne@69 15925 PyObject *py_level = PyInt_FromLong(level);
jpayne@69 15926 if (unlikely(!py_level))
jpayne@69 15927 goto bad;
jpayne@69 15928 module = PyObject_CallFunctionObjArgs(py_import,
jpayne@69 15929 name, __pyx_d, empty_dict, from_list, py_level, (PyObject *)NULL);
jpayne@69 15930 Py_DECREF(py_level);
jpayne@69 15931 #else
jpayne@69 15932 module = PyImport_ImportModuleLevelObject(
jpayne@69 15933 name, __pyx_d, empty_dict, from_list, level);
jpayne@69 15934 #endif
jpayne@69 15935 }
jpayne@69 15936 }
jpayne@69 15937 bad:
jpayne@69 15938 Py_XDECREF(empty_dict);
jpayne@69 15939 Py_XDECREF(empty_list);
jpayne@69 15940 #if PY_MAJOR_VERSION < 3
jpayne@69 15941 Py_XDECREF(py_import);
jpayne@69 15942 #endif
jpayne@69 15943 return module;
jpayne@69 15944 }
jpayne@69 15945
jpayne@69 15946 /* ImportDottedModule */
jpayne@69 15947 #if PY_MAJOR_VERSION >= 3
jpayne@69 15948 static PyObject *__Pyx__ImportDottedModule_Error(PyObject *name, PyObject *parts_tuple, Py_ssize_t count) {
jpayne@69 15949 PyObject *partial_name = NULL, *slice = NULL, *sep = NULL;
jpayne@69 15950 if (unlikely(PyErr_Occurred())) {
jpayne@69 15951 PyErr_Clear();
jpayne@69 15952 }
jpayne@69 15953 if (likely(PyTuple_GET_SIZE(parts_tuple) == count)) {
jpayne@69 15954 partial_name = name;
jpayne@69 15955 } else {
jpayne@69 15956 slice = PySequence_GetSlice(parts_tuple, 0, count);
jpayne@69 15957 if (unlikely(!slice))
jpayne@69 15958 goto bad;
jpayne@69 15959 sep = PyUnicode_FromStringAndSize(".", 1);
jpayne@69 15960 if (unlikely(!sep))
jpayne@69 15961 goto bad;
jpayne@69 15962 partial_name = PyUnicode_Join(sep, slice);
jpayne@69 15963 }
jpayne@69 15964 PyErr_Format(
jpayne@69 15965 #if PY_MAJOR_VERSION < 3
jpayne@69 15966 PyExc_ImportError,
jpayne@69 15967 "No module named '%s'", PyString_AS_STRING(partial_name));
jpayne@69 15968 #else
jpayne@69 15969 #if PY_VERSION_HEX >= 0x030600B1
jpayne@69 15970 PyExc_ModuleNotFoundError,
jpayne@69 15971 #else
jpayne@69 15972 PyExc_ImportError,
jpayne@69 15973 #endif
jpayne@69 15974 "No module named '%U'", partial_name);
jpayne@69 15975 #endif
jpayne@69 15976 bad:
jpayne@69 15977 Py_XDECREF(sep);
jpayne@69 15978 Py_XDECREF(slice);
jpayne@69 15979 Py_XDECREF(partial_name);
jpayne@69 15980 return NULL;
jpayne@69 15981 }
jpayne@69 15982 #endif
jpayne@69 15983 #if PY_MAJOR_VERSION >= 3
jpayne@69 15984 static PyObject *__Pyx__ImportDottedModule_Lookup(PyObject *name) {
jpayne@69 15985 PyObject *imported_module;
jpayne@69 15986 #if PY_VERSION_HEX < 0x030700A1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400)
jpayne@69 15987 PyObject *modules = PyImport_GetModuleDict();
jpayne@69 15988 if (unlikely(!modules))
jpayne@69 15989 return NULL;
jpayne@69 15990 imported_module = __Pyx_PyDict_GetItemStr(modules, name);
jpayne@69 15991 Py_XINCREF(imported_module);
jpayne@69 15992 #else
jpayne@69 15993 imported_module = PyImport_GetModule(name);
jpayne@69 15994 #endif
jpayne@69 15995 return imported_module;
jpayne@69 15996 }
jpayne@69 15997 #endif
jpayne@69 15998 #if PY_MAJOR_VERSION >= 3
jpayne@69 15999 static PyObject *__Pyx_ImportDottedModule_WalkParts(PyObject *module, PyObject *name, PyObject *parts_tuple) {
jpayne@69 16000 Py_ssize_t i, nparts;
jpayne@69 16001 nparts = PyTuple_GET_SIZE(parts_tuple);
jpayne@69 16002 for (i=1; i < nparts && module; i++) {
jpayne@69 16003 PyObject *part, *submodule;
jpayne@69 16004 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
jpayne@69 16005 part = PyTuple_GET_ITEM(parts_tuple, i);
jpayne@69 16006 #else
jpayne@69 16007 part = PySequence_ITEM(parts_tuple, i);
jpayne@69 16008 #endif
jpayne@69 16009 submodule = __Pyx_PyObject_GetAttrStrNoError(module, part);
jpayne@69 16010 #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
jpayne@69 16011 Py_DECREF(part);
jpayne@69 16012 #endif
jpayne@69 16013 Py_DECREF(module);
jpayne@69 16014 module = submodule;
jpayne@69 16015 }
jpayne@69 16016 if (unlikely(!module)) {
jpayne@69 16017 return __Pyx__ImportDottedModule_Error(name, parts_tuple, i);
jpayne@69 16018 }
jpayne@69 16019 return module;
jpayne@69 16020 }
jpayne@69 16021 #endif
jpayne@69 16022 static PyObject *__Pyx__ImportDottedModule(PyObject *name, PyObject *parts_tuple) {
jpayne@69 16023 #if PY_MAJOR_VERSION < 3
jpayne@69 16024 PyObject *module, *from_list, *star = __pyx_n_s__14;
jpayne@69 16025 CYTHON_UNUSED_VAR(parts_tuple);
jpayne@69 16026 from_list = PyList_New(1);
jpayne@69 16027 if (unlikely(!from_list))
jpayne@69 16028 return NULL;
jpayne@69 16029 Py_INCREF(star);
jpayne@69 16030 PyList_SET_ITEM(from_list, 0, star);
jpayne@69 16031 module = __Pyx_Import(name, from_list, 0);
jpayne@69 16032 Py_DECREF(from_list);
jpayne@69 16033 return module;
jpayne@69 16034 #else
jpayne@69 16035 PyObject *imported_module;
jpayne@69 16036 PyObject *module = __Pyx_Import(name, NULL, 0);
jpayne@69 16037 if (!parts_tuple || unlikely(!module))
jpayne@69 16038 return module;
jpayne@69 16039 imported_module = __Pyx__ImportDottedModule_Lookup(name);
jpayne@69 16040 if (likely(imported_module)) {
jpayne@69 16041 Py_DECREF(module);
jpayne@69 16042 return imported_module;
jpayne@69 16043 }
jpayne@69 16044 PyErr_Clear();
jpayne@69 16045 return __Pyx_ImportDottedModule_WalkParts(module, name, parts_tuple);
jpayne@69 16046 #endif
jpayne@69 16047 }
jpayne@69 16048 static PyObject *__Pyx_ImportDottedModule(PyObject *name, PyObject *parts_tuple) {
jpayne@69 16049 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030400B1
jpayne@69 16050 PyObject *module = __Pyx__ImportDottedModule_Lookup(name);
jpayne@69 16051 if (likely(module)) {
jpayne@69 16052 PyObject *spec = __Pyx_PyObject_GetAttrStrNoError(module, __pyx_n_s_spec);
jpayne@69 16053 if (likely(spec)) {
jpayne@69 16054 PyObject *unsafe = __Pyx_PyObject_GetAttrStrNoError(spec, __pyx_n_s_initializing);
jpayne@69 16055 if (likely(!unsafe || !__Pyx_PyObject_IsTrue(unsafe))) {
jpayne@69 16056 Py_DECREF(spec);
jpayne@69 16057 spec = NULL;
jpayne@69 16058 }
jpayne@69 16059 Py_XDECREF(unsafe);
jpayne@69 16060 }
jpayne@69 16061 if (likely(!spec)) {
jpayne@69 16062 PyErr_Clear();
jpayne@69 16063 return module;
jpayne@69 16064 }
jpayne@69 16065 Py_DECREF(spec);
jpayne@69 16066 Py_DECREF(module);
jpayne@69 16067 } else if (PyErr_Occurred()) {
jpayne@69 16068 PyErr_Clear();
jpayne@69 16069 }
jpayne@69 16070 #endif
jpayne@69 16071 return __Pyx__ImportDottedModule(name, parts_tuple);
jpayne@69 16072 }
jpayne@69 16073
jpayne@69 16074 /* ImportFrom */
jpayne@69 16075 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
jpayne@69 16076 PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
jpayne@69 16077 if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
jpayne@69 16078 const char* module_name_str = 0;
jpayne@69 16079 PyObject* module_name = 0;
jpayne@69 16080 PyObject* module_dot = 0;
jpayne@69 16081 PyObject* full_name = 0;
jpayne@69 16082 PyErr_Clear();
jpayne@69 16083 module_name_str = PyModule_GetName(module);
jpayne@69 16084 if (unlikely(!module_name_str)) { goto modbad; }
jpayne@69 16085 module_name = PyUnicode_FromString(module_name_str);
jpayne@69 16086 if (unlikely(!module_name)) { goto modbad; }
jpayne@69 16087 module_dot = PyUnicode_Concat(module_name, __pyx_kp_u__15);
jpayne@69 16088 if (unlikely(!module_dot)) { goto modbad; }
jpayne@69 16089 full_name = PyUnicode_Concat(module_dot, name);
jpayne@69 16090 if (unlikely(!full_name)) { goto modbad; }
jpayne@69 16091 #if PY_VERSION_HEX < 0x030700A1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400)
jpayne@69 16092 {
jpayne@69 16093 PyObject *modules = PyImport_GetModuleDict();
jpayne@69 16094 if (unlikely(!modules))
jpayne@69 16095 goto modbad;
jpayne@69 16096 value = PyObject_GetItem(modules, full_name);
jpayne@69 16097 }
jpayne@69 16098 #else
jpayne@69 16099 value = PyImport_GetModule(full_name);
jpayne@69 16100 #endif
jpayne@69 16101 modbad:
jpayne@69 16102 Py_XDECREF(full_name);
jpayne@69 16103 Py_XDECREF(module_dot);
jpayne@69 16104 Py_XDECREF(module_name);
jpayne@69 16105 }
jpayne@69 16106 if (unlikely(!value)) {
jpayne@69 16107 PyErr_Format(PyExc_ImportError,
jpayne@69 16108 #if PY_MAJOR_VERSION < 3
jpayne@69 16109 "cannot import name %.230s", PyString_AS_STRING(name));
jpayne@69 16110 #else
jpayne@69 16111 "cannot import name %S", name);
jpayne@69 16112 #endif
jpayne@69 16113 }
jpayne@69 16114 return value;
jpayne@69 16115 }
jpayne@69 16116
jpayne@69 16117 /* PyObjectCallNoArg */
jpayne@69 16118 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
jpayne@69 16119 PyObject *arg[2] = {NULL, NULL};
jpayne@69 16120 return __Pyx_PyObject_FastCall(func, arg + 1, 0 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
jpayne@69 16121 }
jpayne@69 16122
jpayne@69 16123 /* CLineInTraceback */
jpayne@69 16124 #ifndef CYTHON_CLINE_IN_TRACEBACK
jpayne@69 16125 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) {
jpayne@69 16126 PyObject *use_cline;
jpayne@69 16127 PyObject *ptype, *pvalue, *ptraceback;
jpayne@69 16128 #if CYTHON_COMPILING_IN_CPYTHON
jpayne@69 16129 PyObject **cython_runtime_dict;
jpayne@69 16130 #endif
jpayne@69 16131 CYTHON_MAYBE_UNUSED_VAR(tstate);
jpayne@69 16132 if (unlikely(!__pyx_cython_runtime)) {
jpayne@69 16133 return c_line;
jpayne@69 16134 }
jpayne@69 16135 __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
jpayne@69 16136 #if CYTHON_COMPILING_IN_CPYTHON
jpayne@69 16137 cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
jpayne@69 16138 if (likely(cython_runtime_dict)) {
jpayne@69 16139 __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
jpayne@69 16140 use_cline, *cython_runtime_dict,
jpayne@69 16141 __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
jpayne@69 16142 } else
jpayne@69 16143 #endif
jpayne@69 16144 {
jpayne@69 16145 PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStrNoError(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
jpayne@69 16146 if (use_cline_obj) {
jpayne@69 16147 use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
jpayne@69 16148 Py_DECREF(use_cline_obj);
jpayne@69 16149 } else {
jpayne@69 16150 PyErr_Clear();
jpayne@69 16151 use_cline = NULL;
jpayne@69 16152 }
jpayne@69 16153 }
jpayne@69 16154 if (!use_cline) {
jpayne@69 16155 c_line = 0;
jpayne@69 16156 (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
jpayne@69 16157 }
jpayne@69 16158 else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
jpayne@69 16159 c_line = 0;
jpayne@69 16160 }
jpayne@69 16161 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
jpayne@69 16162 return c_line;
jpayne@69 16163 }
jpayne@69 16164 #endif
jpayne@69 16165
jpayne@69 16166 /* CodeObjectCache */
jpayne@69 16167 #if !CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 16168 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
jpayne@69 16169 int start = 0, mid = 0, end = count - 1;
jpayne@69 16170 if (end >= 0 && code_line > entries[end].code_line) {
jpayne@69 16171 return count;
jpayne@69 16172 }
jpayne@69 16173 while (start < end) {
jpayne@69 16174 mid = start + (end - start) / 2;
jpayne@69 16175 if (code_line < entries[mid].code_line) {
jpayne@69 16176 end = mid;
jpayne@69 16177 } else if (code_line > entries[mid].code_line) {
jpayne@69 16178 start = mid + 1;
jpayne@69 16179 } else {
jpayne@69 16180 return mid;
jpayne@69 16181 }
jpayne@69 16182 }
jpayne@69 16183 if (code_line <= entries[mid].code_line) {
jpayne@69 16184 return mid;
jpayne@69 16185 } else {
jpayne@69 16186 return mid + 1;
jpayne@69 16187 }
jpayne@69 16188 }
jpayne@69 16189 static PyCodeObject *__pyx_find_code_object(int code_line) {
jpayne@69 16190 PyCodeObject* code_object;
jpayne@69 16191 int pos;
jpayne@69 16192 if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
jpayne@69 16193 return NULL;
jpayne@69 16194 }
jpayne@69 16195 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
jpayne@69 16196 if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
jpayne@69 16197 return NULL;
jpayne@69 16198 }
jpayne@69 16199 code_object = __pyx_code_cache.entries[pos].code_object;
jpayne@69 16200 Py_INCREF(code_object);
jpayne@69 16201 return code_object;
jpayne@69 16202 }
jpayne@69 16203 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
jpayne@69 16204 int pos, i;
jpayne@69 16205 __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
jpayne@69 16206 if (unlikely(!code_line)) {
jpayne@69 16207 return;
jpayne@69 16208 }
jpayne@69 16209 if (unlikely(!entries)) {
jpayne@69 16210 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
jpayne@69 16211 if (likely(entries)) {
jpayne@69 16212 __pyx_code_cache.entries = entries;
jpayne@69 16213 __pyx_code_cache.max_count = 64;
jpayne@69 16214 __pyx_code_cache.count = 1;
jpayne@69 16215 entries[0].code_line = code_line;
jpayne@69 16216 entries[0].code_object = code_object;
jpayne@69 16217 Py_INCREF(code_object);
jpayne@69 16218 }
jpayne@69 16219 return;
jpayne@69 16220 }
jpayne@69 16221 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
jpayne@69 16222 if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
jpayne@69 16223 PyCodeObject* tmp = entries[pos].code_object;
jpayne@69 16224 entries[pos].code_object = code_object;
jpayne@69 16225 Py_DECREF(tmp);
jpayne@69 16226 return;
jpayne@69 16227 }
jpayne@69 16228 if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
jpayne@69 16229 int new_max = __pyx_code_cache.max_count + 64;
jpayne@69 16230 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
jpayne@69 16231 __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
jpayne@69 16232 if (unlikely(!entries)) {
jpayne@69 16233 return;
jpayne@69 16234 }
jpayne@69 16235 __pyx_code_cache.entries = entries;
jpayne@69 16236 __pyx_code_cache.max_count = new_max;
jpayne@69 16237 }
jpayne@69 16238 for (i=__pyx_code_cache.count; i>pos; i--) {
jpayne@69 16239 entries[i] = entries[i-1];
jpayne@69 16240 }
jpayne@69 16241 entries[pos].code_line = code_line;
jpayne@69 16242 entries[pos].code_object = code_object;
jpayne@69 16243 __pyx_code_cache.count++;
jpayne@69 16244 Py_INCREF(code_object);
jpayne@69 16245 }
jpayne@69 16246 #endif
jpayne@69 16247
jpayne@69 16248 /* AddTraceback */
jpayne@69 16249 #include "compile.h"
jpayne@69 16250 #include "frameobject.h"
jpayne@69 16251 #include "traceback.h"
jpayne@69 16252 #if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 16253 #ifndef Py_BUILD_CORE
jpayne@69 16254 #define Py_BUILD_CORE 1
jpayne@69 16255 #endif
jpayne@69 16256 #include "internal/pycore_frame.h"
jpayne@69 16257 #endif
jpayne@69 16258 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 16259 static PyObject *__Pyx_PyCode_Replace_For_AddTraceback(PyObject *code, PyObject *scratch_dict,
jpayne@69 16260 PyObject *firstlineno, PyObject *name) {
jpayne@69 16261 PyObject *replace = NULL;
jpayne@69 16262 if (unlikely(PyDict_SetItemString(scratch_dict, "co_firstlineno", firstlineno))) return NULL;
jpayne@69 16263 if (unlikely(PyDict_SetItemString(scratch_dict, "co_name", name))) return NULL;
jpayne@69 16264 replace = PyObject_GetAttrString(code, "replace");
jpayne@69 16265 if (likely(replace)) {
jpayne@69 16266 PyObject *result;
jpayne@69 16267 result = PyObject_Call(replace, __pyx_empty_tuple, scratch_dict);
jpayne@69 16268 Py_DECREF(replace);
jpayne@69 16269 return result;
jpayne@69 16270 }
jpayne@69 16271 PyErr_Clear();
jpayne@69 16272 #if __PYX_LIMITED_VERSION_HEX < 0x030780000
jpayne@69 16273 {
jpayne@69 16274 PyObject *compiled = NULL, *result = NULL;
jpayne@69 16275 if (unlikely(PyDict_SetItemString(scratch_dict, "code", code))) return NULL;
jpayne@69 16276 if (unlikely(PyDict_SetItemString(scratch_dict, "type", (PyObject*)(&PyType_Type)))) return NULL;
jpayne@69 16277 compiled = Py_CompileString(
jpayne@69 16278 "out = type(code)(\n"
jpayne@69 16279 " code.co_argcount, code.co_kwonlyargcount, code.co_nlocals, code.co_stacksize,\n"
jpayne@69 16280 " code.co_flags, code.co_code, code.co_consts, code.co_names,\n"
jpayne@69 16281 " code.co_varnames, code.co_filename, co_name, co_firstlineno,\n"
jpayne@69 16282 " code.co_lnotab)\n", "<dummy>", Py_file_input);
jpayne@69 16283 if (!compiled) return NULL;
jpayne@69 16284 result = PyEval_EvalCode(compiled, scratch_dict, scratch_dict);
jpayne@69 16285 Py_DECREF(compiled);
jpayne@69 16286 if (!result) PyErr_Print();
jpayne@69 16287 Py_DECREF(result);
jpayne@69 16288 result = PyDict_GetItemString(scratch_dict, "out");
jpayne@69 16289 if (result) Py_INCREF(result);
jpayne@69 16290 return result;
jpayne@69 16291 }
jpayne@69 16292 #else
jpayne@69 16293 return NULL;
jpayne@69 16294 #endif
jpayne@69 16295 }
jpayne@69 16296 static void __Pyx_AddTraceback(const char *funcname, int c_line,
jpayne@69 16297 int py_line, const char *filename) {
jpayne@69 16298 PyObject *code_object = NULL, *py_py_line = NULL, *py_funcname = NULL, *dict = NULL;
jpayne@69 16299 PyObject *replace = NULL, *getframe = NULL, *frame = NULL;
jpayne@69 16300 PyObject *exc_type, *exc_value, *exc_traceback;
jpayne@69 16301 int success = 0;
jpayne@69 16302 if (c_line) {
jpayne@69 16303 (void) __pyx_cfilenm;
jpayne@69 16304 (void) __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line);
jpayne@69 16305 }
jpayne@69 16306 PyErr_Fetch(&exc_type, &exc_value, &exc_traceback);
jpayne@69 16307 code_object = Py_CompileString("_getframe()", filename, Py_eval_input);
jpayne@69 16308 if (unlikely(!code_object)) goto bad;
jpayne@69 16309 py_py_line = PyLong_FromLong(py_line);
jpayne@69 16310 if (unlikely(!py_py_line)) goto bad;
jpayne@69 16311 py_funcname = PyUnicode_FromString(funcname);
jpayne@69 16312 if (unlikely(!py_funcname)) goto bad;
jpayne@69 16313 dict = PyDict_New();
jpayne@69 16314 if (unlikely(!dict)) goto bad;
jpayne@69 16315 {
jpayne@69 16316 PyObject *old_code_object = code_object;
jpayne@69 16317 code_object = __Pyx_PyCode_Replace_For_AddTraceback(code_object, dict, py_py_line, py_funcname);
jpayne@69 16318 Py_DECREF(old_code_object);
jpayne@69 16319 }
jpayne@69 16320 if (unlikely(!code_object)) goto bad;
jpayne@69 16321 getframe = PySys_GetObject("_getframe");
jpayne@69 16322 if (unlikely(!getframe)) goto bad;
jpayne@69 16323 if (unlikely(PyDict_SetItemString(dict, "_getframe", getframe))) goto bad;
jpayne@69 16324 frame = PyEval_EvalCode(code_object, dict, dict);
jpayne@69 16325 if (unlikely(!frame) || frame == Py_None) goto bad;
jpayne@69 16326 success = 1;
jpayne@69 16327 bad:
jpayne@69 16328 PyErr_Restore(exc_type, exc_value, exc_traceback);
jpayne@69 16329 Py_XDECREF(code_object);
jpayne@69 16330 Py_XDECREF(py_py_line);
jpayne@69 16331 Py_XDECREF(py_funcname);
jpayne@69 16332 Py_XDECREF(dict);
jpayne@69 16333 Py_XDECREF(replace);
jpayne@69 16334 if (success) {
jpayne@69 16335 PyTraceBack_Here(
jpayne@69 16336 (struct _frame*)frame);
jpayne@69 16337 }
jpayne@69 16338 Py_XDECREF(frame);
jpayne@69 16339 }
jpayne@69 16340 #else
jpayne@69 16341 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
jpayne@69 16342 const char *funcname, int c_line,
jpayne@69 16343 int py_line, const char *filename) {
jpayne@69 16344 PyCodeObject *py_code = NULL;
jpayne@69 16345 PyObject *py_funcname = NULL;
jpayne@69 16346 #if PY_MAJOR_VERSION < 3
jpayne@69 16347 PyObject *py_srcfile = NULL;
jpayne@69 16348 py_srcfile = PyString_FromString(filename);
jpayne@69 16349 if (!py_srcfile) goto bad;
jpayne@69 16350 #endif
jpayne@69 16351 if (c_line) {
jpayne@69 16352 #if PY_MAJOR_VERSION < 3
jpayne@69 16353 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
jpayne@69 16354 if (!py_funcname) goto bad;
jpayne@69 16355 #else
jpayne@69 16356 py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
jpayne@69 16357 if (!py_funcname) goto bad;
jpayne@69 16358 funcname = PyUnicode_AsUTF8(py_funcname);
jpayne@69 16359 if (!funcname) goto bad;
jpayne@69 16360 #endif
jpayne@69 16361 }
jpayne@69 16362 else {
jpayne@69 16363 #if PY_MAJOR_VERSION < 3
jpayne@69 16364 py_funcname = PyString_FromString(funcname);
jpayne@69 16365 if (!py_funcname) goto bad;
jpayne@69 16366 #endif
jpayne@69 16367 }
jpayne@69 16368 #if PY_MAJOR_VERSION < 3
jpayne@69 16369 py_code = __Pyx_PyCode_New(
jpayne@69 16370 0,
jpayne@69 16371 0,
jpayne@69 16372 0,
jpayne@69 16373 0,
jpayne@69 16374 0,
jpayne@69 16375 0,
jpayne@69 16376 __pyx_empty_bytes, /*PyObject *code,*/
jpayne@69 16377 __pyx_empty_tuple, /*PyObject *consts,*/
jpayne@69 16378 __pyx_empty_tuple, /*PyObject *names,*/
jpayne@69 16379 __pyx_empty_tuple, /*PyObject *varnames,*/
jpayne@69 16380 __pyx_empty_tuple, /*PyObject *freevars,*/
jpayne@69 16381 __pyx_empty_tuple, /*PyObject *cellvars,*/
jpayne@69 16382 py_srcfile, /*PyObject *filename,*/
jpayne@69 16383 py_funcname, /*PyObject *name,*/
jpayne@69 16384 py_line,
jpayne@69 16385 __pyx_empty_bytes /*PyObject *lnotab*/
jpayne@69 16386 );
jpayne@69 16387 Py_DECREF(py_srcfile);
jpayne@69 16388 #else
jpayne@69 16389 py_code = PyCode_NewEmpty(filename, funcname, py_line);
jpayne@69 16390 #endif
jpayne@69 16391 Py_XDECREF(py_funcname);
jpayne@69 16392 return py_code;
jpayne@69 16393 bad:
jpayne@69 16394 Py_XDECREF(py_funcname);
jpayne@69 16395 #if PY_MAJOR_VERSION < 3
jpayne@69 16396 Py_XDECREF(py_srcfile);
jpayne@69 16397 #endif
jpayne@69 16398 return NULL;
jpayne@69 16399 }
jpayne@69 16400 static void __Pyx_AddTraceback(const char *funcname, int c_line,
jpayne@69 16401 int py_line, const char *filename) {
jpayne@69 16402 PyCodeObject *py_code = 0;
jpayne@69 16403 PyFrameObject *py_frame = 0;
jpayne@69 16404 PyThreadState *tstate = __Pyx_PyThreadState_Current;
jpayne@69 16405 PyObject *ptype, *pvalue, *ptraceback;
jpayne@69 16406 if (c_line) {
jpayne@69 16407 c_line = __Pyx_CLineForTraceback(tstate, c_line);
jpayne@69 16408 }
jpayne@69 16409 py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
jpayne@69 16410 if (!py_code) {
jpayne@69 16411 __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
jpayne@69 16412 py_code = __Pyx_CreateCodeObjectForTraceback(
jpayne@69 16413 funcname, c_line, py_line, filename);
jpayne@69 16414 if (!py_code) {
jpayne@69 16415 /* If the code object creation fails, then we should clear the
jpayne@69 16416 fetched exception references and propagate the new exception */
jpayne@69 16417 Py_XDECREF(ptype);
jpayne@69 16418 Py_XDECREF(pvalue);
jpayne@69 16419 Py_XDECREF(ptraceback);
jpayne@69 16420 goto bad;
jpayne@69 16421 }
jpayne@69 16422 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
jpayne@69 16423 __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
jpayne@69 16424 }
jpayne@69 16425 py_frame = PyFrame_New(
jpayne@69 16426 tstate, /*PyThreadState *tstate,*/
jpayne@69 16427 py_code, /*PyCodeObject *code,*/
jpayne@69 16428 __pyx_d, /*PyObject *globals,*/
jpayne@69 16429 0 /*PyObject *locals*/
jpayne@69 16430 );
jpayne@69 16431 if (!py_frame) goto bad;
jpayne@69 16432 __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
jpayne@69 16433 PyTraceBack_Here(py_frame);
jpayne@69 16434 bad:
jpayne@69 16435 Py_XDECREF(py_code);
jpayne@69 16436 Py_XDECREF(py_frame);
jpayne@69 16437 }
jpayne@69 16438 #endif
jpayne@69 16439
jpayne@69 16440 /* CIntFromPyVerify */
jpayne@69 16441 #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
jpayne@69 16442 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
jpayne@69 16443 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
jpayne@69 16444 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
jpayne@69 16445 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
jpayne@69 16446 {\
jpayne@69 16447 func_type value = func_value;\
jpayne@69 16448 if (sizeof(target_type) < sizeof(func_type)) {\
jpayne@69 16449 if (unlikely(value != (func_type) (target_type) value)) {\
jpayne@69 16450 func_type zero = 0;\
jpayne@69 16451 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
jpayne@69 16452 return (target_type) -1;\
jpayne@69 16453 if (is_unsigned && unlikely(value < zero))\
jpayne@69 16454 goto raise_neg_overflow;\
jpayne@69 16455 else\
jpayne@69 16456 goto raise_overflow;\
jpayne@69 16457 }\
jpayne@69 16458 }\
jpayne@69 16459 return (target_type) value;\
jpayne@69 16460 }
jpayne@69 16461
jpayne@69 16462 /* CIntFromPy */
jpayne@69 16463 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
jpayne@69 16464 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
jpayne@69 16465 #pragma GCC diagnostic push
jpayne@69 16466 #pragma GCC diagnostic ignored "-Wconversion"
jpayne@69 16467 #endif
jpayne@69 16468 const int neg_one = (int) -1, const_zero = (int) 0;
jpayne@69 16469 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
jpayne@69 16470 #pragma GCC diagnostic pop
jpayne@69 16471 #endif
jpayne@69 16472 const int is_unsigned = neg_one > const_zero;
jpayne@69 16473 #if PY_MAJOR_VERSION < 3
jpayne@69 16474 if (likely(PyInt_Check(x))) {
jpayne@69 16475 if ((sizeof(int) < sizeof(long))) {
jpayne@69 16476 __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
jpayne@69 16477 } else {
jpayne@69 16478 long val = PyInt_AS_LONG(x);
jpayne@69 16479 if (is_unsigned && unlikely(val < 0)) {
jpayne@69 16480 goto raise_neg_overflow;
jpayne@69 16481 }
jpayne@69 16482 return (int) val;
jpayne@69 16483 }
jpayne@69 16484 }
jpayne@69 16485 #endif
jpayne@69 16486 if (unlikely(!PyLong_Check(x))) {
jpayne@69 16487 int val;
jpayne@69 16488 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
jpayne@69 16489 if (!tmp) return (int) -1;
jpayne@69 16490 val = __Pyx_PyInt_As_int(tmp);
jpayne@69 16491 Py_DECREF(tmp);
jpayne@69 16492 return val;
jpayne@69 16493 }
jpayne@69 16494 if (is_unsigned) {
jpayne@69 16495 #if CYTHON_USE_PYLONG_INTERNALS
jpayne@69 16496 if (unlikely(__Pyx_PyLong_IsNeg(x))) {
jpayne@69 16497 goto raise_neg_overflow;
jpayne@69 16498 } else if (__Pyx_PyLong_IsCompact(x)) {
jpayne@69 16499 __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
jpayne@69 16500 } else {
jpayne@69 16501 const digit* digits = __Pyx_PyLong_Digits(x);
jpayne@69 16502 assert(__Pyx_PyLong_DigitCount(x) > 1);
jpayne@69 16503 switch (__Pyx_PyLong_DigitCount(x)) {
jpayne@69 16504 case 2:
jpayne@69 16505 if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) {
jpayne@69 16506 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
jpayne@69 16507 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
jpayne@69 16508 } else if ((8 * sizeof(int) >= 2 * PyLong_SHIFT)) {
jpayne@69 16509 return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
jpayne@69 16510 }
jpayne@69 16511 }
jpayne@69 16512 break;
jpayne@69 16513 case 3:
jpayne@69 16514 if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) {
jpayne@69 16515 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
jpayne@69 16516 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
jpayne@69 16517 } else if ((8 * sizeof(int) >= 3 * PyLong_SHIFT)) {
jpayne@69 16518 return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
jpayne@69 16519 }
jpayne@69 16520 }
jpayne@69 16521 break;
jpayne@69 16522 case 4:
jpayne@69 16523 if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) {
jpayne@69 16524 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
jpayne@69 16525 __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])))
jpayne@69 16526 } else if ((8 * sizeof(int) >= 4 * PyLong_SHIFT)) {
jpayne@69 16527 return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
jpayne@69 16528 }
jpayne@69 16529 }
jpayne@69 16530 break;
jpayne@69 16531 }
jpayne@69 16532 }
jpayne@69 16533 #endif
jpayne@69 16534 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
jpayne@69 16535 if (unlikely(Py_SIZE(x) < 0)) {
jpayne@69 16536 goto raise_neg_overflow;
jpayne@69 16537 }
jpayne@69 16538 #else
jpayne@69 16539 {
jpayne@69 16540 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
jpayne@69 16541 if (unlikely(result < 0))
jpayne@69 16542 return (int) -1;
jpayne@69 16543 if (unlikely(result == 1))
jpayne@69 16544 goto raise_neg_overflow;
jpayne@69 16545 }
jpayne@69 16546 #endif
jpayne@69 16547 if ((sizeof(int) <= sizeof(unsigned long))) {
jpayne@69 16548 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
jpayne@69 16549 #ifdef HAVE_LONG_LONG
jpayne@69 16550 } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) {
jpayne@69 16551 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
jpayne@69 16552 #endif
jpayne@69 16553 }
jpayne@69 16554 } else {
jpayne@69 16555 #if CYTHON_USE_PYLONG_INTERNALS
jpayne@69 16556 if (__Pyx_PyLong_IsCompact(x)) {
jpayne@69 16557 __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
jpayne@69 16558 } else {
jpayne@69 16559 const digit* digits = __Pyx_PyLong_Digits(x);
jpayne@69 16560 assert(__Pyx_PyLong_DigitCount(x) > 1);
jpayne@69 16561 switch (__Pyx_PyLong_SignedDigitCount(x)) {
jpayne@69 16562 case -2:
jpayne@69 16563 if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) {
jpayne@69 16564 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
jpayne@69 16565 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
jpayne@69 16566 } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
jpayne@69 16567 return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
jpayne@69 16568 }
jpayne@69 16569 }
jpayne@69 16570 break;
jpayne@69 16571 case 2:
jpayne@69 16572 if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) {
jpayne@69 16573 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
jpayne@69 16574 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
jpayne@69 16575 } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
jpayne@69 16576 return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
jpayne@69 16577 }
jpayne@69 16578 }
jpayne@69 16579 break;
jpayne@69 16580 case -3:
jpayne@69 16581 if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
jpayne@69 16582 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
jpayne@69 16583 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
jpayne@69 16584 } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
jpayne@69 16585 return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
jpayne@69 16586 }
jpayne@69 16587 }
jpayne@69 16588 break;
jpayne@69 16589 case 3:
jpayne@69 16590 if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) {
jpayne@69 16591 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
jpayne@69 16592 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
jpayne@69 16593 } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
jpayne@69 16594 return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
jpayne@69 16595 }
jpayne@69 16596 }
jpayne@69 16597 break;
jpayne@69 16598 case -4:
jpayne@69 16599 if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
jpayne@69 16600 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
jpayne@69 16601 __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])))
jpayne@69 16602 } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) {
jpayne@69 16603 return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
jpayne@69 16604 }
jpayne@69 16605 }
jpayne@69 16606 break;
jpayne@69 16607 case 4:
jpayne@69 16608 if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) {
jpayne@69 16609 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
jpayne@69 16610 __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])))
jpayne@69 16611 } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) {
jpayne@69 16612 return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
jpayne@69 16613 }
jpayne@69 16614 }
jpayne@69 16615 break;
jpayne@69 16616 }
jpayne@69 16617 }
jpayne@69 16618 #endif
jpayne@69 16619 if ((sizeof(int) <= sizeof(long))) {
jpayne@69 16620 __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
jpayne@69 16621 #ifdef HAVE_LONG_LONG
jpayne@69 16622 } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) {
jpayne@69 16623 __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
jpayne@69 16624 #endif
jpayne@69 16625 }
jpayne@69 16626 }
jpayne@69 16627 {
jpayne@69 16628 int val;
jpayne@69 16629 int ret = -1;
jpayne@69 16630 #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 16631 Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
jpayne@69 16632 x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
jpayne@69 16633 if (unlikely(bytes_copied == -1)) {
jpayne@69 16634 } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
jpayne@69 16635 goto raise_overflow;
jpayne@69 16636 } else {
jpayne@69 16637 ret = 0;
jpayne@69 16638 }
jpayne@69 16639 #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
jpayne@69 16640 int one = 1; int is_little = (int)*(unsigned char *)&one;
jpayne@69 16641 unsigned char *bytes = (unsigned char *)&val;
jpayne@69 16642 ret = _PyLong_AsByteArray((PyLongObject *)x,
jpayne@69 16643 bytes, sizeof(val),
jpayne@69 16644 is_little, !is_unsigned);
jpayne@69 16645 #else
jpayne@69 16646 PyObject *v;
jpayne@69 16647 PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
jpayne@69 16648 int bits, remaining_bits, is_negative = 0;
jpayne@69 16649 int chunk_size = (sizeof(long) < 8) ? 30 : 62;
jpayne@69 16650 if (likely(PyLong_CheckExact(x))) {
jpayne@69 16651 v = __Pyx_NewRef(x);
jpayne@69 16652 } else {
jpayne@69 16653 v = PyNumber_Long(x);
jpayne@69 16654 if (unlikely(!v)) return (int) -1;
jpayne@69 16655 assert(PyLong_CheckExact(v));
jpayne@69 16656 }
jpayne@69 16657 {
jpayne@69 16658 int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
jpayne@69 16659 if (unlikely(result < 0)) {
jpayne@69 16660 Py_DECREF(v);
jpayne@69 16661 return (int) -1;
jpayne@69 16662 }
jpayne@69 16663 is_negative = result == 1;
jpayne@69 16664 }
jpayne@69 16665 if (is_unsigned && unlikely(is_negative)) {
jpayne@69 16666 Py_DECREF(v);
jpayne@69 16667 goto raise_neg_overflow;
jpayne@69 16668 } else if (is_negative) {
jpayne@69 16669 stepval = PyNumber_Invert(v);
jpayne@69 16670 Py_DECREF(v);
jpayne@69 16671 if (unlikely(!stepval))
jpayne@69 16672 return (int) -1;
jpayne@69 16673 } else {
jpayne@69 16674 stepval = v;
jpayne@69 16675 }
jpayne@69 16676 v = NULL;
jpayne@69 16677 val = (int) 0;
jpayne@69 16678 mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
jpayne@69 16679 shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
jpayne@69 16680 for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) {
jpayne@69 16681 PyObject *tmp, *digit;
jpayne@69 16682 long idigit;
jpayne@69 16683 digit = PyNumber_And(stepval, mask);
jpayne@69 16684 if (unlikely(!digit)) goto done;
jpayne@69 16685 idigit = PyLong_AsLong(digit);
jpayne@69 16686 Py_DECREF(digit);
jpayne@69 16687 if (unlikely(idigit < 0)) goto done;
jpayne@69 16688 val |= ((int) idigit) << bits;
jpayne@69 16689 tmp = PyNumber_Rshift(stepval, shift);
jpayne@69 16690 if (unlikely(!tmp)) goto done;
jpayne@69 16691 Py_DECREF(stepval); stepval = tmp;
jpayne@69 16692 }
jpayne@69 16693 Py_DECREF(shift); shift = NULL;
jpayne@69 16694 Py_DECREF(mask); mask = NULL;
jpayne@69 16695 {
jpayne@69 16696 long idigit = PyLong_AsLong(stepval);
jpayne@69 16697 if (unlikely(idigit < 0)) goto done;
jpayne@69 16698 remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1);
jpayne@69 16699 if (unlikely(idigit >= (1L << remaining_bits)))
jpayne@69 16700 goto raise_overflow;
jpayne@69 16701 val |= ((int) idigit) << bits;
jpayne@69 16702 }
jpayne@69 16703 if (!is_unsigned) {
jpayne@69 16704 if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1))))
jpayne@69 16705 goto raise_overflow;
jpayne@69 16706 if (is_negative)
jpayne@69 16707 val = ~val;
jpayne@69 16708 }
jpayne@69 16709 ret = 0;
jpayne@69 16710 done:
jpayne@69 16711 Py_XDECREF(shift);
jpayne@69 16712 Py_XDECREF(mask);
jpayne@69 16713 Py_XDECREF(stepval);
jpayne@69 16714 #endif
jpayne@69 16715 if (unlikely(ret))
jpayne@69 16716 return (int) -1;
jpayne@69 16717 return val;
jpayne@69 16718 }
jpayne@69 16719 raise_overflow:
jpayne@69 16720 PyErr_SetString(PyExc_OverflowError,
jpayne@69 16721 "value too large to convert to int");
jpayne@69 16722 return (int) -1;
jpayne@69 16723 raise_neg_overflow:
jpayne@69 16724 PyErr_SetString(PyExc_OverflowError,
jpayne@69 16725 "can't convert negative value to int");
jpayne@69 16726 return (int) -1;
jpayne@69 16727 }
jpayne@69 16728
jpayne@69 16729 /* CIntFromPy */
jpayne@69 16730 static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *x) {
jpayne@69 16731 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
jpayne@69 16732 #pragma GCC diagnostic push
jpayne@69 16733 #pragma GCC diagnostic ignored "-Wconversion"
jpayne@69 16734 #endif
jpayne@69 16735 const char neg_one = (char) -1, const_zero = (char) 0;
jpayne@69 16736 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
jpayne@69 16737 #pragma GCC diagnostic pop
jpayne@69 16738 #endif
jpayne@69 16739 const int is_unsigned = neg_one > const_zero;
jpayne@69 16740 #if PY_MAJOR_VERSION < 3
jpayne@69 16741 if (likely(PyInt_Check(x))) {
jpayne@69 16742 if ((sizeof(char) < sizeof(long))) {
jpayne@69 16743 __PYX_VERIFY_RETURN_INT(char, long, PyInt_AS_LONG(x))
jpayne@69 16744 } else {
jpayne@69 16745 long val = PyInt_AS_LONG(x);
jpayne@69 16746 if (is_unsigned && unlikely(val < 0)) {
jpayne@69 16747 goto raise_neg_overflow;
jpayne@69 16748 }
jpayne@69 16749 return (char) val;
jpayne@69 16750 }
jpayne@69 16751 }
jpayne@69 16752 #endif
jpayne@69 16753 if (unlikely(!PyLong_Check(x))) {
jpayne@69 16754 char val;
jpayne@69 16755 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
jpayne@69 16756 if (!tmp) return (char) -1;
jpayne@69 16757 val = __Pyx_PyInt_As_char(tmp);
jpayne@69 16758 Py_DECREF(tmp);
jpayne@69 16759 return val;
jpayne@69 16760 }
jpayne@69 16761 if (is_unsigned) {
jpayne@69 16762 #if CYTHON_USE_PYLONG_INTERNALS
jpayne@69 16763 if (unlikely(__Pyx_PyLong_IsNeg(x))) {
jpayne@69 16764 goto raise_neg_overflow;
jpayne@69 16765 } else if (__Pyx_PyLong_IsCompact(x)) {
jpayne@69 16766 __PYX_VERIFY_RETURN_INT(char, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
jpayne@69 16767 } else {
jpayne@69 16768 const digit* digits = __Pyx_PyLong_Digits(x);
jpayne@69 16769 assert(__Pyx_PyLong_DigitCount(x) > 1);
jpayne@69 16770 switch (__Pyx_PyLong_DigitCount(x)) {
jpayne@69 16771 case 2:
jpayne@69 16772 if ((8 * sizeof(char) > 1 * PyLong_SHIFT)) {
jpayne@69 16773 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
jpayne@69 16774 __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
jpayne@69 16775 } else if ((8 * sizeof(char) >= 2 * PyLong_SHIFT)) {
jpayne@69 16776 return (char) (((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
jpayne@69 16777 }
jpayne@69 16778 }
jpayne@69 16779 break;
jpayne@69 16780 case 3:
jpayne@69 16781 if ((8 * sizeof(char) > 2 * PyLong_SHIFT)) {
jpayne@69 16782 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
jpayne@69 16783 __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
jpayne@69 16784 } else if ((8 * sizeof(char) >= 3 * PyLong_SHIFT)) {
jpayne@69 16785 return (char) (((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
jpayne@69 16786 }
jpayne@69 16787 }
jpayne@69 16788 break;
jpayne@69 16789 case 4:
jpayne@69 16790 if ((8 * sizeof(char) > 3 * PyLong_SHIFT)) {
jpayne@69 16791 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
jpayne@69 16792 __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
jpayne@69 16793 } else if ((8 * sizeof(char) >= 4 * PyLong_SHIFT)) {
jpayne@69 16794 return (char) (((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
jpayne@69 16795 }
jpayne@69 16796 }
jpayne@69 16797 break;
jpayne@69 16798 }
jpayne@69 16799 }
jpayne@69 16800 #endif
jpayne@69 16801 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
jpayne@69 16802 if (unlikely(Py_SIZE(x) < 0)) {
jpayne@69 16803 goto raise_neg_overflow;
jpayne@69 16804 }
jpayne@69 16805 #else
jpayne@69 16806 {
jpayne@69 16807 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
jpayne@69 16808 if (unlikely(result < 0))
jpayne@69 16809 return (char) -1;
jpayne@69 16810 if (unlikely(result == 1))
jpayne@69 16811 goto raise_neg_overflow;
jpayne@69 16812 }
jpayne@69 16813 #endif
jpayne@69 16814 if ((sizeof(char) <= sizeof(unsigned long))) {
jpayne@69 16815 __PYX_VERIFY_RETURN_INT_EXC(char, unsigned long, PyLong_AsUnsignedLong(x))
jpayne@69 16816 #ifdef HAVE_LONG_LONG
jpayne@69 16817 } else if ((sizeof(char) <= sizeof(unsigned PY_LONG_LONG))) {
jpayne@69 16818 __PYX_VERIFY_RETURN_INT_EXC(char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
jpayne@69 16819 #endif
jpayne@69 16820 }
jpayne@69 16821 } else {
jpayne@69 16822 #if CYTHON_USE_PYLONG_INTERNALS
jpayne@69 16823 if (__Pyx_PyLong_IsCompact(x)) {
jpayne@69 16824 __PYX_VERIFY_RETURN_INT(char, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
jpayne@69 16825 } else {
jpayne@69 16826 const digit* digits = __Pyx_PyLong_Digits(x);
jpayne@69 16827 assert(__Pyx_PyLong_DigitCount(x) > 1);
jpayne@69 16828 switch (__Pyx_PyLong_SignedDigitCount(x)) {
jpayne@69 16829 case -2:
jpayne@69 16830 if ((8 * sizeof(char) - 1 > 1 * PyLong_SHIFT)) {
jpayne@69 16831 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
jpayne@69 16832 __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
jpayne@69 16833 } else if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) {
jpayne@69 16834 return (char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
jpayne@69 16835 }
jpayne@69 16836 }
jpayne@69 16837 break;
jpayne@69 16838 case 2:
jpayne@69 16839 if ((8 * sizeof(char) > 1 * PyLong_SHIFT)) {
jpayne@69 16840 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
jpayne@69 16841 __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
jpayne@69 16842 } else if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) {
jpayne@69 16843 return (char) ((((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
jpayne@69 16844 }
jpayne@69 16845 }
jpayne@69 16846 break;
jpayne@69 16847 case -3:
jpayne@69 16848 if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) {
jpayne@69 16849 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
jpayne@69 16850 __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
jpayne@69 16851 } else if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) {
jpayne@69 16852 return (char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
jpayne@69 16853 }
jpayne@69 16854 }
jpayne@69 16855 break;
jpayne@69 16856 case 3:
jpayne@69 16857 if ((8 * sizeof(char) > 2 * PyLong_SHIFT)) {
jpayne@69 16858 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
jpayne@69 16859 __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
jpayne@69 16860 } else if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) {
jpayne@69 16861 return (char) ((((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
jpayne@69 16862 }
jpayne@69 16863 }
jpayne@69 16864 break;
jpayne@69 16865 case -4:
jpayne@69 16866 if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) {
jpayne@69 16867 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
jpayne@69 16868 __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
jpayne@69 16869 } else if ((8 * sizeof(char) - 1 > 4 * PyLong_SHIFT)) {
jpayne@69 16870 return (char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
jpayne@69 16871 }
jpayne@69 16872 }
jpayne@69 16873 break;
jpayne@69 16874 case 4:
jpayne@69 16875 if ((8 * sizeof(char) > 3 * PyLong_SHIFT)) {
jpayne@69 16876 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
jpayne@69 16877 __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
jpayne@69 16878 } else if ((8 * sizeof(char) - 1 > 4 * PyLong_SHIFT)) {
jpayne@69 16879 return (char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
jpayne@69 16880 }
jpayne@69 16881 }
jpayne@69 16882 break;
jpayne@69 16883 }
jpayne@69 16884 }
jpayne@69 16885 #endif
jpayne@69 16886 if ((sizeof(char) <= sizeof(long))) {
jpayne@69 16887 __PYX_VERIFY_RETURN_INT_EXC(char, long, PyLong_AsLong(x))
jpayne@69 16888 #ifdef HAVE_LONG_LONG
jpayne@69 16889 } else if ((sizeof(char) <= sizeof(PY_LONG_LONG))) {
jpayne@69 16890 __PYX_VERIFY_RETURN_INT_EXC(char, PY_LONG_LONG, PyLong_AsLongLong(x))
jpayne@69 16891 #endif
jpayne@69 16892 }
jpayne@69 16893 }
jpayne@69 16894 {
jpayne@69 16895 char val;
jpayne@69 16896 int ret = -1;
jpayne@69 16897 #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 16898 Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
jpayne@69 16899 x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
jpayne@69 16900 if (unlikely(bytes_copied == -1)) {
jpayne@69 16901 } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
jpayne@69 16902 goto raise_overflow;
jpayne@69 16903 } else {
jpayne@69 16904 ret = 0;
jpayne@69 16905 }
jpayne@69 16906 #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
jpayne@69 16907 int one = 1; int is_little = (int)*(unsigned char *)&one;
jpayne@69 16908 unsigned char *bytes = (unsigned char *)&val;
jpayne@69 16909 ret = _PyLong_AsByteArray((PyLongObject *)x,
jpayne@69 16910 bytes, sizeof(val),
jpayne@69 16911 is_little, !is_unsigned);
jpayne@69 16912 #else
jpayne@69 16913 PyObject *v;
jpayne@69 16914 PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
jpayne@69 16915 int bits, remaining_bits, is_negative = 0;
jpayne@69 16916 int chunk_size = (sizeof(long) < 8) ? 30 : 62;
jpayne@69 16917 if (likely(PyLong_CheckExact(x))) {
jpayne@69 16918 v = __Pyx_NewRef(x);
jpayne@69 16919 } else {
jpayne@69 16920 v = PyNumber_Long(x);
jpayne@69 16921 if (unlikely(!v)) return (char) -1;
jpayne@69 16922 assert(PyLong_CheckExact(v));
jpayne@69 16923 }
jpayne@69 16924 {
jpayne@69 16925 int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
jpayne@69 16926 if (unlikely(result < 0)) {
jpayne@69 16927 Py_DECREF(v);
jpayne@69 16928 return (char) -1;
jpayne@69 16929 }
jpayne@69 16930 is_negative = result == 1;
jpayne@69 16931 }
jpayne@69 16932 if (is_unsigned && unlikely(is_negative)) {
jpayne@69 16933 Py_DECREF(v);
jpayne@69 16934 goto raise_neg_overflow;
jpayne@69 16935 } else if (is_negative) {
jpayne@69 16936 stepval = PyNumber_Invert(v);
jpayne@69 16937 Py_DECREF(v);
jpayne@69 16938 if (unlikely(!stepval))
jpayne@69 16939 return (char) -1;
jpayne@69 16940 } else {
jpayne@69 16941 stepval = v;
jpayne@69 16942 }
jpayne@69 16943 v = NULL;
jpayne@69 16944 val = (char) 0;
jpayne@69 16945 mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
jpayne@69 16946 shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
jpayne@69 16947 for (bits = 0; bits < (int) sizeof(char) * 8 - chunk_size; bits += chunk_size) {
jpayne@69 16948 PyObject *tmp, *digit;
jpayne@69 16949 long idigit;
jpayne@69 16950 digit = PyNumber_And(stepval, mask);
jpayne@69 16951 if (unlikely(!digit)) goto done;
jpayne@69 16952 idigit = PyLong_AsLong(digit);
jpayne@69 16953 Py_DECREF(digit);
jpayne@69 16954 if (unlikely(idigit < 0)) goto done;
jpayne@69 16955 val |= ((char) idigit) << bits;
jpayne@69 16956 tmp = PyNumber_Rshift(stepval, shift);
jpayne@69 16957 if (unlikely(!tmp)) goto done;
jpayne@69 16958 Py_DECREF(stepval); stepval = tmp;
jpayne@69 16959 }
jpayne@69 16960 Py_DECREF(shift); shift = NULL;
jpayne@69 16961 Py_DECREF(mask); mask = NULL;
jpayne@69 16962 {
jpayne@69 16963 long idigit = PyLong_AsLong(stepval);
jpayne@69 16964 if (unlikely(idigit < 0)) goto done;
jpayne@69 16965 remaining_bits = ((int) sizeof(char) * 8) - bits - (is_unsigned ? 0 : 1);
jpayne@69 16966 if (unlikely(idigit >= (1L << remaining_bits)))
jpayne@69 16967 goto raise_overflow;
jpayne@69 16968 val |= ((char) idigit) << bits;
jpayne@69 16969 }
jpayne@69 16970 if (!is_unsigned) {
jpayne@69 16971 if (unlikely(val & (((char) 1) << (sizeof(char) * 8 - 1))))
jpayne@69 16972 goto raise_overflow;
jpayne@69 16973 if (is_negative)
jpayne@69 16974 val = ~val;
jpayne@69 16975 }
jpayne@69 16976 ret = 0;
jpayne@69 16977 done:
jpayne@69 16978 Py_XDECREF(shift);
jpayne@69 16979 Py_XDECREF(mask);
jpayne@69 16980 Py_XDECREF(stepval);
jpayne@69 16981 #endif
jpayne@69 16982 if (unlikely(ret))
jpayne@69 16983 return (char) -1;
jpayne@69 16984 return val;
jpayne@69 16985 }
jpayne@69 16986 raise_overflow:
jpayne@69 16987 PyErr_SetString(PyExc_OverflowError,
jpayne@69 16988 "value too large to convert to char");
jpayne@69 16989 return (char) -1;
jpayne@69 16990 raise_neg_overflow:
jpayne@69 16991 PyErr_SetString(PyExc_OverflowError,
jpayne@69 16992 "can't convert negative value to char");
jpayne@69 16993 return (char) -1;
jpayne@69 16994 }
jpayne@69 16995
jpayne@69 16996 /* CIntToPy */
jpayne@69 16997 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
jpayne@69 16998 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
jpayne@69 16999 #pragma GCC diagnostic push
jpayne@69 17000 #pragma GCC diagnostic ignored "-Wconversion"
jpayne@69 17001 #endif
jpayne@69 17002 const int neg_one = (int) -1, const_zero = (int) 0;
jpayne@69 17003 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
jpayne@69 17004 #pragma GCC diagnostic pop
jpayne@69 17005 #endif
jpayne@69 17006 const int is_unsigned = neg_one > const_zero;
jpayne@69 17007 if (is_unsigned) {
jpayne@69 17008 if (sizeof(int) < sizeof(long)) {
jpayne@69 17009 return PyInt_FromLong((long) value);
jpayne@69 17010 } else if (sizeof(int) <= sizeof(unsigned long)) {
jpayne@69 17011 return PyLong_FromUnsignedLong((unsigned long) value);
jpayne@69 17012 #ifdef HAVE_LONG_LONG
jpayne@69 17013 } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
jpayne@69 17014 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
jpayne@69 17015 #endif
jpayne@69 17016 }
jpayne@69 17017 } else {
jpayne@69 17018 if (sizeof(int) <= sizeof(long)) {
jpayne@69 17019 return PyInt_FromLong((long) value);
jpayne@69 17020 #ifdef HAVE_LONG_LONG
jpayne@69 17021 } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
jpayne@69 17022 return PyLong_FromLongLong((PY_LONG_LONG) value);
jpayne@69 17023 #endif
jpayne@69 17024 }
jpayne@69 17025 }
jpayne@69 17026 {
jpayne@69 17027 unsigned char *bytes = (unsigned char *)&value;
jpayne@69 17028 #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
jpayne@69 17029 if (is_unsigned) {
jpayne@69 17030 return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
jpayne@69 17031 } else {
jpayne@69 17032 return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
jpayne@69 17033 }
jpayne@69 17034 #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
jpayne@69 17035 int one = 1; int little = (int)*(unsigned char *)&one;
jpayne@69 17036 return _PyLong_FromByteArray(bytes, sizeof(int),
jpayne@69 17037 little, !is_unsigned);
jpayne@69 17038 #else
jpayne@69 17039 int one = 1; int little = (int)*(unsigned char *)&one;
jpayne@69 17040 PyObject *from_bytes, *result = NULL;
jpayne@69 17041 PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL;
jpayne@69 17042 from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
jpayne@69 17043 if (!from_bytes) return NULL;
jpayne@69 17044 py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(int));
jpayne@69 17045 if (!py_bytes) goto limited_bad;
jpayne@69 17046 order_str = PyUnicode_FromString(little ? "little" : "big");
jpayne@69 17047 if (!order_str) goto limited_bad;
jpayne@69 17048 arg_tuple = PyTuple_Pack(2, py_bytes, order_str);
jpayne@69 17049 if (!arg_tuple) goto limited_bad;
jpayne@69 17050 if (!is_unsigned) {
jpayne@69 17051 kwds = PyDict_New();
jpayne@69 17052 if (!kwds) goto limited_bad;
jpayne@69 17053 if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(Py_True))) goto limited_bad;
jpayne@69 17054 }
jpayne@69 17055 result = PyObject_Call(from_bytes, arg_tuple, kwds);
jpayne@69 17056 limited_bad:
jpayne@69 17057 Py_XDECREF(kwds);
jpayne@69 17058 Py_XDECREF(arg_tuple);
jpayne@69 17059 Py_XDECREF(order_str);
jpayne@69 17060 Py_XDECREF(py_bytes);
jpayne@69 17061 Py_XDECREF(from_bytes);
jpayne@69 17062 return result;
jpayne@69 17063 #endif
jpayne@69 17064 }
jpayne@69 17065 }
jpayne@69 17066
jpayne@69 17067 /* CIntFromPy */
jpayne@69 17068 static CYTHON_INLINE int32_t __Pyx_PyInt_As_int32_t(PyObject *x) {
jpayne@69 17069 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
jpayne@69 17070 #pragma GCC diagnostic push
jpayne@69 17071 #pragma GCC diagnostic ignored "-Wconversion"
jpayne@69 17072 #endif
jpayne@69 17073 const int32_t neg_one = (int32_t) -1, const_zero = (int32_t) 0;
jpayne@69 17074 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
jpayne@69 17075 #pragma GCC diagnostic pop
jpayne@69 17076 #endif
jpayne@69 17077 const int is_unsigned = neg_one > const_zero;
jpayne@69 17078 #if PY_MAJOR_VERSION < 3
jpayne@69 17079 if (likely(PyInt_Check(x))) {
jpayne@69 17080 if ((sizeof(int32_t) < sizeof(long))) {
jpayne@69 17081 __PYX_VERIFY_RETURN_INT(int32_t, long, PyInt_AS_LONG(x))
jpayne@69 17082 } else {
jpayne@69 17083 long val = PyInt_AS_LONG(x);
jpayne@69 17084 if (is_unsigned && unlikely(val < 0)) {
jpayne@69 17085 goto raise_neg_overflow;
jpayne@69 17086 }
jpayne@69 17087 return (int32_t) val;
jpayne@69 17088 }
jpayne@69 17089 }
jpayne@69 17090 #endif
jpayne@69 17091 if (unlikely(!PyLong_Check(x))) {
jpayne@69 17092 int32_t val;
jpayne@69 17093 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
jpayne@69 17094 if (!tmp) return (int32_t) -1;
jpayne@69 17095 val = __Pyx_PyInt_As_int32_t(tmp);
jpayne@69 17096 Py_DECREF(tmp);
jpayne@69 17097 return val;
jpayne@69 17098 }
jpayne@69 17099 if (is_unsigned) {
jpayne@69 17100 #if CYTHON_USE_PYLONG_INTERNALS
jpayne@69 17101 if (unlikely(__Pyx_PyLong_IsNeg(x))) {
jpayne@69 17102 goto raise_neg_overflow;
jpayne@69 17103 } else if (__Pyx_PyLong_IsCompact(x)) {
jpayne@69 17104 __PYX_VERIFY_RETURN_INT(int32_t, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
jpayne@69 17105 } else {
jpayne@69 17106 const digit* digits = __Pyx_PyLong_Digits(x);
jpayne@69 17107 assert(__Pyx_PyLong_DigitCount(x) > 1);
jpayne@69 17108 switch (__Pyx_PyLong_DigitCount(x)) {
jpayne@69 17109 case 2:
jpayne@69 17110 if ((8 * sizeof(int32_t) > 1 * PyLong_SHIFT)) {
jpayne@69 17111 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
jpayne@69 17112 __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
jpayne@69 17113 } else if ((8 * sizeof(int32_t) >= 2 * PyLong_SHIFT)) {
jpayne@69 17114 return (int32_t) (((((int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]));
jpayne@69 17115 }
jpayne@69 17116 }
jpayne@69 17117 break;
jpayne@69 17118 case 3:
jpayne@69 17119 if ((8 * sizeof(int32_t) > 2 * PyLong_SHIFT)) {
jpayne@69 17120 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
jpayne@69 17121 __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
jpayne@69 17122 } else if ((8 * sizeof(int32_t) >= 3 * PyLong_SHIFT)) {
jpayne@69 17123 return (int32_t) (((((((int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]));
jpayne@69 17124 }
jpayne@69 17125 }
jpayne@69 17126 break;
jpayne@69 17127 case 4:
jpayne@69 17128 if ((8 * sizeof(int32_t) > 3 * PyLong_SHIFT)) {
jpayne@69 17129 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
jpayne@69 17130 __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])))
jpayne@69 17131 } else if ((8 * sizeof(int32_t) >= 4 * PyLong_SHIFT)) {
jpayne@69 17132 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]));
jpayne@69 17133 }
jpayne@69 17134 }
jpayne@69 17135 break;
jpayne@69 17136 }
jpayne@69 17137 }
jpayne@69 17138 #endif
jpayne@69 17139 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
jpayne@69 17140 if (unlikely(Py_SIZE(x) < 0)) {
jpayne@69 17141 goto raise_neg_overflow;
jpayne@69 17142 }
jpayne@69 17143 #else
jpayne@69 17144 {
jpayne@69 17145 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
jpayne@69 17146 if (unlikely(result < 0))
jpayne@69 17147 return (int32_t) -1;
jpayne@69 17148 if (unlikely(result == 1))
jpayne@69 17149 goto raise_neg_overflow;
jpayne@69 17150 }
jpayne@69 17151 #endif
jpayne@69 17152 if ((sizeof(int32_t) <= sizeof(unsigned long))) {
jpayne@69 17153 __PYX_VERIFY_RETURN_INT_EXC(int32_t, unsigned long, PyLong_AsUnsignedLong(x))
jpayne@69 17154 #ifdef HAVE_LONG_LONG
jpayne@69 17155 } else if ((sizeof(int32_t) <= sizeof(unsigned PY_LONG_LONG))) {
jpayne@69 17156 __PYX_VERIFY_RETURN_INT_EXC(int32_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
jpayne@69 17157 #endif
jpayne@69 17158 }
jpayne@69 17159 } else {
jpayne@69 17160 #if CYTHON_USE_PYLONG_INTERNALS
jpayne@69 17161 if (__Pyx_PyLong_IsCompact(x)) {
jpayne@69 17162 __PYX_VERIFY_RETURN_INT(int32_t, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
jpayne@69 17163 } else {
jpayne@69 17164 const digit* digits = __Pyx_PyLong_Digits(x);
jpayne@69 17165 assert(__Pyx_PyLong_DigitCount(x) > 1);
jpayne@69 17166 switch (__Pyx_PyLong_SignedDigitCount(x)) {
jpayne@69 17167 case -2:
jpayne@69 17168 if ((8 * sizeof(int32_t) - 1 > 1 * PyLong_SHIFT)) {
jpayne@69 17169 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
jpayne@69 17170 __PYX_VERIFY_RETURN_INT(int32_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
jpayne@69 17171 } else if ((8 * sizeof(int32_t) - 1 > 2 * PyLong_SHIFT)) {
jpayne@69 17172 return (int32_t) (((int32_t)-1)*(((((int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])));
jpayne@69 17173 }
jpayne@69 17174 }
jpayne@69 17175 break;
jpayne@69 17176 case 2:
jpayne@69 17177 if ((8 * sizeof(int32_t) > 1 * PyLong_SHIFT)) {
jpayne@69 17178 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
jpayne@69 17179 __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
jpayne@69 17180 } else if ((8 * sizeof(int32_t) - 1 > 2 * PyLong_SHIFT)) {
jpayne@69 17181 return (int32_t) ((((((int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])));
jpayne@69 17182 }
jpayne@69 17183 }
jpayne@69 17184 break;
jpayne@69 17185 case -3:
jpayne@69 17186 if ((8 * sizeof(int32_t) - 1 > 2 * PyLong_SHIFT)) {
jpayne@69 17187 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
jpayne@69 17188 __PYX_VERIFY_RETURN_INT(int32_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
jpayne@69 17189 } else if ((8 * sizeof(int32_t) - 1 > 3 * PyLong_SHIFT)) {
jpayne@69 17190 return (int32_t) (((int32_t)-1)*(((((((int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])));
jpayne@69 17191 }
jpayne@69 17192 }
jpayne@69 17193 break;
jpayne@69 17194 case 3:
jpayne@69 17195 if ((8 * sizeof(int32_t) > 2 * PyLong_SHIFT)) {
jpayne@69 17196 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
jpayne@69 17197 __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
jpayne@69 17198 } else if ((8 * sizeof(int32_t) - 1 > 3 * PyLong_SHIFT)) {
jpayne@69 17199 return (int32_t) ((((((((int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])));
jpayne@69 17200 }
jpayne@69 17201 }
jpayne@69 17202 break;
jpayne@69 17203 case -4:
jpayne@69 17204 if ((8 * sizeof(int32_t) - 1 > 3 * PyLong_SHIFT)) {
jpayne@69 17205 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
jpayne@69 17206 __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])))
jpayne@69 17207 } else if ((8 * sizeof(int32_t) - 1 > 4 * PyLong_SHIFT)) {
jpayne@69 17208 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])));
jpayne@69 17209 }
jpayne@69 17210 }
jpayne@69 17211 break;
jpayne@69 17212 case 4:
jpayne@69 17213 if ((8 * sizeof(int32_t) > 3 * PyLong_SHIFT)) {
jpayne@69 17214 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
jpayne@69 17215 __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])))
jpayne@69 17216 } else if ((8 * sizeof(int32_t) - 1 > 4 * PyLong_SHIFT)) {
jpayne@69 17217 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])));
jpayne@69 17218 }
jpayne@69 17219 }
jpayne@69 17220 break;
jpayne@69 17221 }
jpayne@69 17222 }
jpayne@69 17223 #endif
jpayne@69 17224 if ((sizeof(int32_t) <= sizeof(long))) {
jpayne@69 17225 __PYX_VERIFY_RETURN_INT_EXC(int32_t, long, PyLong_AsLong(x))
jpayne@69 17226 #ifdef HAVE_LONG_LONG
jpayne@69 17227 } else if ((sizeof(int32_t) <= sizeof(PY_LONG_LONG))) {
jpayne@69 17228 __PYX_VERIFY_RETURN_INT_EXC(int32_t, PY_LONG_LONG, PyLong_AsLongLong(x))
jpayne@69 17229 #endif
jpayne@69 17230 }
jpayne@69 17231 }
jpayne@69 17232 {
jpayne@69 17233 int32_t val;
jpayne@69 17234 int ret = -1;
jpayne@69 17235 #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 17236 Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
jpayne@69 17237 x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
jpayne@69 17238 if (unlikely(bytes_copied == -1)) {
jpayne@69 17239 } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
jpayne@69 17240 goto raise_overflow;
jpayne@69 17241 } else {
jpayne@69 17242 ret = 0;
jpayne@69 17243 }
jpayne@69 17244 #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
jpayne@69 17245 int one = 1; int is_little = (int)*(unsigned char *)&one;
jpayne@69 17246 unsigned char *bytes = (unsigned char *)&val;
jpayne@69 17247 ret = _PyLong_AsByteArray((PyLongObject *)x,
jpayne@69 17248 bytes, sizeof(val),
jpayne@69 17249 is_little, !is_unsigned);
jpayne@69 17250 #else
jpayne@69 17251 PyObject *v;
jpayne@69 17252 PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
jpayne@69 17253 int bits, remaining_bits, is_negative = 0;
jpayne@69 17254 int chunk_size = (sizeof(long) < 8) ? 30 : 62;
jpayne@69 17255 if (likely(PyLong_CheckExact(x))) {
jpayne@69 17256 v = __Pyx_NewRef(x);
jpayne@69 17257 } else {
jpayne@69 17258 v = PyNumber_Long(x);
jpayne@69 17259 if (unlikely(!v)) return (int32_t) -1;
jpayne@69 17260 assert(PyLong_CheckExact(v));
jpayne@69 17261 }
jpayne@69 17262 {
jpayne@69 17263 int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
jpayne@69 17264 if (unlikely(result < 0)) {
jpayne@69 17265 Py_DECREF(v);
jpayne@69 17266 return (int32_t) -1;
jpayne@69 17267 }
jpayne@69 17268 is_negative = result == 1;
jpayne@69 17269 }
jpayne@69 17270 if (is_unsigned && unlikely(is_negative)) {
jpayne@69 17271 Py_DECREF(v);
jpayne@69 17272 goto raise_neg_overflow;
jpayne@69 17273 } else if (is_negative) {
jpayne@69 17274 stepval = PyNumber_Invert(v);
jpayne@69 17275 Py_DECREF(v);
jpayne@69 17276 if (unlikely(!stepval))
jpayne@69 17277 return (int32_t) -1;
jpayne@69 17278 } else {
jpayne@69 17279 stepval = v;
jpayne@69 17280 }
jpayne@69 17281 v = NULL;
jpayne@69 17282 val = (int32_t) 0;
jpayne@69 17283 mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
jpayne@69 17284 shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
jpayne@69 17285 for (bits = 0; bits < (int) sizeof(int32_t) * 8 - chunk_size; bits += chunk_size) {
jpayne@69 17286 PyObject *tmp, *digit;
jpayne@69 17287 long idigit;
jpayne@69 17288 digit = PyNumber_And(stepval, mask);
jpayne@69 17289 if (unlikely(!digit)) goto done;
jpayne@69 17290 idigit = PyLong_AsLong(digit);
jpayne@69 17291 Py_DECREF(digit);
jpayne@69 17292 if (unlikely(idigit < 0)) goto done;
jpayne@69 17293 val |= ((int32_t) idigit) << bits;
jpayne@69 17294 tmp = PyNumber_Rshift(stepval, shift);
jpayne@69 17295 if (unlikely(!tmp)) goto done;
jpayne@69 17296 Py_DECREF(stepval); stepval = tmp;
jpayne@69 17297 }
jpayne@69 17298 Py_DECREF(shift); shift = NULL;
jpayne@69 17299 Py_DECREF(mask); mask = NULL;
jpayne@69 17300 {
jpayne@69 17301 long idigit = PyLong_AsLong(stepval);
jpayne@69 17302 if (unlikely(idigit < 0)) goto done;
jpayne@69 17303 remaining_bits = ((int) sizeof(int32_t) * 8) - bits - (is_unsigned ? 0 : 1);
jpayne@69 17304 if (unlikely(idigit >= (1L << remaining_bits)))
jpayne@69 17305 goto raise_overflow;
jpayne@69 17306 val |= ((int32_t) idigit) << bits;
jpayne@69 17307 }
jpayne@69 17308 if (!is_unsigned) {
jpayne@69 17309 if (unlikely(val & (((int32_t) 1) << (sizeof(int32_t) * 8 - 1))))
jpayne@69 17310 goto raise_overflow;
jpayne@69 17311 if (is_negative)
jpayne@69 17312 val = ~val;
jpayne@69 17313 }
jpayne@69 17314 ret = 0;
jpayne@69 17315 done:
jpayne@69 17316 Py_XDECREF(shift);
jpayne@69 17317 Py_XDECREF(mask);
jpayne@69 17318 Py_XDECREF(stepval);
jpayne@69 17319 #endif
jpayne@69 17320 if (unlikely(ret))
jpayne@69 17321 return (int32_t) -1;
jpayne@69 17322 return val;
jpayne@69 17323 }
jpayne@69 17324 raise_overflow:
jpayne@69 17325 PyErr_SetString(PyExc_OverflowError,
jpayne@69 17326 "value too large to convert to int32_t");
jpayne@69 17327 return (int32_t) -1;
jpayne@69 17328 raise_neg_overflow:
jpayne@69 17329 PyErr_SetString(PyExc_OverflowError,
jpayne@69 17330 "can't convert negative value to int32_t");
jpayne@69 17331 return (int32_t) -1;
jpayne@69 17332 }
jpayne@69 17333
jpayne@69 17334 /* CIntToPy */
jpayne@69 17335 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
jpayne@69 17336 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
jpayne@69 17337 #pragma GCC diagnostic push
jpayne@69 17338 #pragma GCC diagnostic ignored "-Wconversion"
jpayne@69 17339 #endif
jpayne@69 17340 const long neg_one = (long) -1, const_zero = (long) 0;
jpayne@69 17341 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
jpayne@69 17342 #pragma GCC diagnostic pop
jpayne@69 17343 #endif
jpayne@69 17344 const int is_unsigned = neg_one > const_zero;
jpayne@69 17345 if (is_unsigned) {
jpayne@69 17346 if (sizeof(long) < sizeof(long)) {
jpayne@69 17347 return PyInt_FromLong((long) value);
jpayne@69 17348 } else if (sizeof(long) <= sizeof(unsigned long)) {
jpayne@69 17349 return PyLong_FromUnsignedLong((unsigned long) value);
jpayne@69 17350 #ifdef HAVE_LONG_LONG
jpayne@69 17351 } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
jpayne@69 17352 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
jpayne@69 17353 #endif
jpayne@69 17354 }
jpayne@69 17355 } else {
jpayne@69 17356 if (sizeof(long) <= sizeof(long)) {
jpayne@69 17357 return PyInt_FromLong((long) value);
jpayne@69 17358 #ifdef HAVE_LONG_LONG
jpayne@69 17359 } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
jpayne@69 17360 return PyLong_FromLongLong((PY_LONG_LONG) value);
jpayne@69 17361 #endif
jpayne@69 17362 }
jpayne@69 17363 }
jpayne@69 17364 {
jpayne@69 17365 unsigned char *bytes = (unsigned char *)&value;
jpayne@69 17366 #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
jpayne@69 17367 if (is_unsigned) {
jpayne@69 17368 return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
jpayne@69 17369 } else {
jpayne@69 17370 return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
jpayne@69 17371 }
jpayne@69 17372 #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
jpayne@69 17373 int one = 1; int little = (int)*(unsigned char *)&one;
jpayne@69 17374 return _PyLong_FromByteArray(bytes, sizeof(long),
jpayne@69 17375 little, !is_unsigned);
jpayne@69 17376 #else
jpayne@69 17377 int one = 1; int little = (int)*(unsigned char *)&one;
jpayne@69 17378 PyObject *from_bytes, *result = NULL;
jpayne@69 17379 PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL;
jpayne@69 17380 from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
jpayne@69 17381 if (!from_bytes) return NULL;
jpayne@69 17382 py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(long));
jpayne@69 17383 if (!py_bytes) goto limited_bad;
jpayne@69 17384 order_str = PyUnicode_FromString(little ? "little" : "big");
jpayne@69 17385 if (!order_str) goto limited_bad;
jpayne@69 17386 arg_tuple = PyTuple_Pack(2, py_bytes, order_str);
jpayne@69 17387 if (!arg_tuple) goto limited_bad;
jpayne@69 17388 if (!is_unsigned) {
jpayne@69 17389 kwds = PyDict_New();
jpayne@69 17390 if (!kwds) goto limited_bad;
jpayne@69 17391 if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(Py_True))) goto limited_bad;
jpayne@69 17392 }
jpayne@69 17393 result = PyObject_Call(from_bytes, arg_tuple, kwds);
jpayne@69 17394 limited_bad:
jpayne@69 17395 Py_XDECREF(kwds);
jpayne@69 17396 Py_XDECREF(arg_tuple);
jpayne@69 17397 Py_XDECREF(order_str);
jpayne@69 17398 Py_XDECREF(py_bytes);
jpayne@69 17399 Py_XDECREF(from_bytes);
jpayne@69 17400 return result;
jpayne@69 17401 #endif
jpayne@69 17402 }
jpayne@69 17403 }
jpayne@69 17404
jpayne@69 17405 /* CIntToPy */
jpayne@69 17406 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int32_t(int32_t value) {
jpayne@69 17407 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
jpayne@69 17408 #pragma GCC diagnostic push
jpayne@69 17409 #pragma GCC diagnostic ignored "-Wconversion"
jpayne@69 17410 #endif
jpayne@69 17411 const int32_t neg_one = (int32_t) -1, const_zero = (int32_t) 0;
jpayne@69 17412 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
jpayne@69 17413 #pragma GCC diagnostic pop
jpayne@69 17414 #endif
jpayne@69 17415 const int is_unsigned = neg_one > const_zero;
jpayne@69 17416 if (is_unsigned) {
jpayne@69 17417 if (sizeof(int32_t) < sizeof(long)) {
jpayne@69 17418 return PyInt_FromLong((long) value);
jpayne@69 17419 } else if (sizeof(int32_t) <= sizeof(unsigned long)) {
jpayne@69 17420 return PyLong_FromUnsignedLong((unsigned long) value);
jpayne@69 17421 #ifdef HAVE_LONG_LONG
jpayne@69 17422 } else if (sizeof(int32_t) <= sizeof(unsigned PY_LONG_LONG)) {
jpayne@69 17423 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
jpayne@69 17424 #endif
jpayne@69 17425 }
jpayne@69 17426 } else {
jpayne@69 17427 if (sizeof(int32_t) <= sizeof(long)) {
jpayne@69 17428 return PyInt_FromLong((long) value);
jpayne@69 17429 #ifdef HAVE_LONG_LONG
jpayne@69 17430 } else if (sizeof(int32_t) <= sizeof(PY_LONG_LONG)) {
jpayne@69 17431 return PyLong_FromLongLong((PY_LONG_LONG) value);
jpayne@69 17432 #endif
jpayne@69 17433 }
jpayne@69 17434 }
jpayne@69 17435 {
jpayne@69 17436 unsigned char *bytes = (unsigned char *)&value;
jpayne@69 17437 #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
jpayne@69 17438 if (is_unsigned) {
jpayne@69 17439 return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
jpayne@69 17440 } else {
jpayne@69 17441 return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
jpayne@69 17442 }
jpayne@69 17443 #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
jpayne@69 17444 int one = 1; int little = (int)*(unsigned char *)&one;
jpayne@69 17445 return _PyLong_FromByteArray(bytes, sizeof(int32_t),
jpayne@69 17446 little, !is_unsigned);
jpayne@69 17447 #else
jpayne@69 17448 int one = 1; int little = (int)*(unsigned char *)&one;
jpayne@69 17449 PyObject *from_bytes, *result = NULL;
jpayne@69 17450 PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL;
jpayne@69 17451 from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
jpayne@69 17452 if (!from_bytes) return NULL;
jpayne@69 17453 py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(int32_t));
jpayne@69 17454 if (!py_bytes) goto limited_bad;
jpayne@69 17455 order_str = PyUnicode_FromString(little ? "little" : "big");
jpayne@69 17456 if (!order_str) goto limited_bad;
jpayne@69 17457 arg_tuple = PyTuple_Pack(2, py_bytes, order_str);
jpayne@69 17458 if (!arg_tuple) goto limited_bad;
jpayne@69 17459 if (!is_unsigned) {
jpayne@69 17460 kwds = PyDict_New();
jpayne@69 17461 if (!kwds) goto limited_bad;
jpayne@69 17462 if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(Py_True))) goto limited_bad;
jpayne@69 17463 }
jpayne@69 17464 result = PyObject_Call(from_bytes, arg_tuple, kwds);
jpayne@69 17465 limited_bad:
jpayne@69 17466 Py_XDECREF(kwds);
jpayne@69 17467 Py_XDECREF(arg_tuple);
jpayne@69 17468 Py_XDECREF(order_str);
jpayne@69 17469 Py_XDECREF(py_bytes);
jpayne@69 17470 Py_XDECREF(from_bytes);
jpayne@69 17471 return result;
jpayne@69 17472 #endif
jpayne@69 17473 }
jpayne@69 17474 }
jpayne@69 17475
jpayne@69 17476 /* FormatTypeName */
jpayne@69 17477 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 17478 static __Pyx_TypeName
jpayne@69 17479 __Pyx_PyType_GetName(PyTypeObject* tp)
jpayne@69 17480 {
jpayne@69 17481 PyObject *name = __Pyx_PyObject_GetAttrStr((PyObject *)tp,
jpayne@69 17482 __pyx_n_s_name_2);
jpayne@69 17483 if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) {
jpayne@69 17484 PyErr_Clear();
jpayne@69 17485 Py_XDECREF(name);
jpayne@69 17486 name = __Pyx_NewRef(__pyx_n_s__33);
jpayne@69 17487 }
jpayne@69 17488 return name;
jpayne@69 17489 }
jpayne@69 17490 #endif
jpayne@69 17491
jpayne@69 17492 /* CIntFromPy */
jpayne@69 17493 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
jpayne@69 17494 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
jpayne@69 17495 #pragma GCC diagnostic push
jpayne@69 17496 #pragma GCC diagnostic ignored "-Wconversion"
jpayne@69 17497 #endif
jpayne@69 17498 const long neg_one = (long) -1, const_zero = (long) 0;
jpayne@69 17499 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
jpayne@69 17500 #pragma GCC diagnostic pop
jpayne@69 17501 #endif
jpayne@69 17502 const int is_unsigned = neg_one > const_zero;
jpayne@69 17503 #if PY_MAJOR_VERSION < 3
jpayne@69 17504 if (likely(PyInt_Check(x))) {
jpayne@69 17505 if ((sizeof(long) < sizeof(long))) {
jpayne@69 17506 __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
jpayne@69 17507 } else {
jpayne@69 17508 long val = PyInt_AS_LONG(x);
jpayne@69 17509 if (is_unsigned && unlikely(val < 0)) {
jpayne@69 17510 goto raise_neg_overflow;
jpayne@69 17511 }
jpayne@69 17512 return (long) val;
jpayne@69 17513 }
jpayne@69 17514 }
jpayne@69 17515 #endif
jpayne@69 17516 if (unlikely(!PyLong_Check(x))) {
jpayne@69 17517 long val;
jpayne@69 17518 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
jpayne@69 17519 if (!tmp) return (long) -1;
jpayne@69 17520 val = __Pyx_PyInt_As_long(tmp);
jpayne@69 17521 Py_DECREF(tmp);
jpayne@69 17522 return val;
jpayne@69 17523 }
jpayne@69 17524 if (is_unsigned) {
jpayne@69 17525 #if CYTHON_USE_PYLONG_INTERNALS
jpayne@69 17526 if (unlikely(__Pyx_PyLong_IsNeg(x))) {
jpayne@69 17527 goto raise_neg_overflow;
jpayne@69 17528 } else if (__Pyx_PyLong_IsCompact(x)) {
jpayne@69 17529 __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
jpayne@69 17530 } else {
jpayne@69 17531 const digit* digits = __Pyx_PyLong_Digits(x);
jpayne@69 17532 assert(__Pyx_PyLong_DigitCount(x) > 1);
jpayne@69 17533 switch (__Pyx_PyLong_DigitCount(x)) {
jpayne@69 17534 case 2:
jpayne@69 17535 if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) {
jpayne@69 17536 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
jpayne@69 17537 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
jpayne@69 17538 } else if ((8 * sizeof(long) >= 2 * PyLong_SHIFT)) {
jpayne@69 17539 return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
jpayne@69 17540 }
jpayne@69 17541 }
jpayne@69 17542 break;
jpayne@69 17543 case 3:
jpayne@69 17544 if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) {
jpayne@69 17545 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
jpayne@69 17546 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
jpayne@69 17547 } else if ((8 * sizeof(long) >= 3 * PyLong_SHIFT)) {
jpayne@69 17548 return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
jpayne@69 17549 }
jpayne@69 17550 }
jpayne@69 17551 break;
jpayne@69 17552 case 4:
jpayne@69 17553 if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) {
jpayne@69 17554 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
jpayne@69 17555 __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])))
jpayne@69 17556 } else if ((8 * sizeof(long) >= 4 * PyLong_SHIFT)) {
jpayne@69 17557 return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
jpayne@69 17558 }
jpayne@69 17559 }
jpayne@69 17560 break;
jpayne@69 17561 }
jpayne@69 17562 }
jpayne@69 17563 #endif
jpayne@69 17564 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
jpayne@69 17565 if (unlikely(Py_SIZE(x) < 0)) {
jpayne@69 17566 goto raise_neg_overflow;
jpayne@69 17567 }
jpayne@69 17568 #else
jpayne@69 17569 {
jpayne@69 17570 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
jpayne@69 17571 if (unlikely(result < 0))
jpayne@69 17572 return (long) -1;
jpayne@69 17573 if (unlikely(result == 1))
jpayne@69 17574 goto raise_neg_overflow;
jpayne@69 17575 }
jpayne@69 17576 #endif
jpayne@69 17577 if ((sizeof(long) <= sizeof(unsigned long))) {
jpayne@69 17578 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
jpayne@69 17579 #ifdef HAVE_LONG_LONG
jpayne@69 17580 } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) {
jpayne@69 17581 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
jpayne@69 17582 #endif
jpayne@69 17583 }
jpayne@69 17584 } else {
jpayne@69 17585 #if CYTHON_USE_PYLONG_INTERNALS
jpayne@69 17586 if (__Pyx_PyLong_IsCompact(x)) {
jpayne@69 17587 __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
jpayne@69 17588 } else {
jpayne@69 17589 const digit* digits = __Pyx_PyLong_Digits(x);
jpayne@69 17590 assert(__Pyx_PyLong_DigitCount(x) > 1);
jpayne@69 17591 switch (__Pyx_PyLong_SignedDigitCount(x)) {
jpayne@69 17592 case -2:
jpayne@69 17593 if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) {
jpayne@69 17594 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
jpayne@69 17595 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
jpayne@69 17596 } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
jpayne@69 17597 return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
jpayne@69 17598 }
jpayne@69 17599 }
jpayne@69 17600 break;
jpayne@69 17601 case 2:
jpayne@69 17602 if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) {
jpayne@69 17603 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
jpayne@69 17604 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
jpayne@69 17605 } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
jpayne@69 17606 return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
jpayne@69 17607 }
jpayne@69 17608 }
jpayne@69 17609 break;
jpayne@69 17610 case -3:
jpayne@69 17611 if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
jpayne@69 17612 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
jpayne@69 17613 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
jpayne@69 17614 } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
jpayne@69 17615 return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
jpayne@69 17616 }
jpayne@69 17617 }
jpayne@69 17618 break;
jpayne@69 17619 case 3:
jpayne@69 17620 if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) {
jpayne@69 17621 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
jpayne@69 17622 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
jpayne@69 17623 } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
jpayne@69 17624 return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
jpayne@69 17625 }
jpayne@69 17626 }
jpayne@69 17627 break;
jpayne@69 17628 case -4:
jpayne@69 17629 if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
jpayne@69 17630 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
jpayne@69 17631 __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])))
jpayne@69 17632 } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) {
jpayne@69 17633 return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
jpayne@69 17634 }
jpayne@69 17635 }
jpayne@69 17636 break;
jpayne@69 17637 case 4:
jpayne@69 17638 if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) {
jpayne@69 17639 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
jpayne@69 17640 __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])))
jpayne@69 17641 } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) {
jpayne@69 17642 return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
jpayne@69 17643 }
jpayne@69 17644 }
jpayne@69 17645 break;
jpayne@69 17646 }
jpayne@69 17647 }
jpayne@69 17648 #endif
jpayne@69 17649 if ((sizeof(long) <= sizeof(long))) {
jpayne@69 17650 __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
jpayne@69 17651 #ifdef HAVE_LONG_LONG
jpayne@69 17652 } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) {
jpayne@69 17653 __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
jpayne@69 17654 #endif
jpayne@69 17655 }
jpayne@69 17656 }
jpayne@69 17657 {
jpayne@69 17658 long val;
jpayne@69 17659 int ret = -1;
jpayne@69 17660 #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
jpayne@69 17661 Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
jpayne@69 17662 x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
jpayne@69 17663 if (unlikely(bytes_copied == -1)) {
jpayne@69 17664 } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
jpayne@69 17665 goto raise_overflow;
jpayne@69 17666 } else {
jpayne@69 17667 ret = 0;
jpayne@69 17668 }
jpayne@69 17669 #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
jpayne@69 17670 int one = 1; int is_little = (int)*(unsigned char *)&one;
jpayne@69 17671 unsigned char *bytes = (unsigned char *)&val;
jpayne@69 17672 ret = _PyLong_AsByteArray((PyLongObject *)x,
jpayne@69 17673 bytes, sizeof(val),
jpayne@69 17674 is_little, !is_unsigned);
jpayne@69 17675 #else
jpayne@69 17676 PyObject *v;
jpayne@69 17677 PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
jpayne@69 17678 int bits, remaining_bits, is_negative = 0;
jpayne@69 17679 int chunk_size = (sizeof(long) < 8) ? 30 : 62;
jpayne@69 17680 if (likely(PyLong_CheckExact(x))) {
jpayne@69 17681 v = __Pyx_NewRef(x);
jpayne@69 17682 } else {
jpayne@69 17683 v = PyNumber_Long(x);
jpayne@69 17684 if (unlikely(!v)) return (long) -1;
jpayne@69 17685 assert(PyLong_CheckExact(v));
jpayne@69 17686 }
jpayne@69 17687 {
jpayne@69 17688 int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
jpayne@69 17689 if (unlikely(result < 0)) {
jpayne@69 17690 Py_DECREF(v);
jpayne@69 17691 return (long) -1;
jpayne@69 17692 }
jpayne@69 17693 is_negative = result == 1;
jpayne@69 17694 }
jpayne@69 17695 if (is_unsigned && unlikely(is_negative)) {
jpayne@69 17696 Py_DECREF(v);
jpayne@69 17697 goto raise_neg_overflow;
jpayne@69 17698 } else if (is_negative) {
jpayne@69 17699 stepval = PyNumber_Invert(v);
jpayne@69 17700 Py_DECREF(v);
jpayne@69 17701 if (unlikely(!stepval))
jpayne@69 17702 return (long) -1;
jpayne@69 17703 } else {
jpayne@69 17704 stepval = v;
jpayne@69 17705 }
jpayne@69 17706 v = NULL;
jpayne@69 17707 val = (long) 0;
jpayne@69 17708 mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
jpayne@69 17709 shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
jpayne@69 17710 for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) {
jpayne@69 17711 PyObject *tmp, *digit;
jpayne@69 17712 long idigit;
jpayne@69 17713 digit = PyNumber_And(stepval, mask);
jpayne@69 17714 if (unlikely(!digit)) goto done;
jpayne@69 17715 idigit = PyLong_AsLong(digit);
jpayne@69 17716 Py_DECREF(digit);
jpayne@69 17717 if (unlikely(idigit < 0)) goto done;
jpayne@69 17718 val |= ((long) idigit) << bits;
jpayne@69 17719 tmp = PyNumber_Rshift(stepval, shift);
jpayne@69 17720 if (unlikely(!tmp)) goto done;
jpayne@69 17721 Py_DECREF(stepval); stepval = tmp;
jpayne@69 17722 }
jpayne@69 17723 Py_DECREF(shift); shift = NULL;
jpayne@69 17724 Py_DECREF(mask); mask = NULL;
jpayne@69 17725 {
jpayne@69 17726 long idigit = PyLong_AsLong(stepval);
jpayne@69 17727 if (unlikely(idigit < 0)) goto done;
jpayne@69 17728 remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1);
jpayne@69 17729 if (unlikely(idigit >= (1L << remaining_bits)))
jpayne@69 17730 goto raise_overflow;
jpayne@69 17731 val |= ((long) idigit) << bits;
jpayne@69 17732 }
jpayne@69 17733 if (!is_unsigned) {
jpayne@69 17734 if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1))))
jpayne@69 17735 goto raise_overflow;
jpayne@69 17736 if (is_negative)
jpayne@69 17737 val = ~val;
jpayne@69 17738 }
jpayne@69 17739 ret = 0;
jpayne@69 17740 done:
jpayne@69 17741 Py_XDECREF(shift);
jpayne@69 17742 Py_XDECREF(mask);
jpayne@69 17743 Py_XDECREF(stepval);
jpayne@69 17744 #endif
jpayne@69 17745 if (unlikely(ret))
jpayne@69 17746 return (long) -1;
jpayne@69 17747 return val;
jpayne@69 17748 }
jpayne@69 17749 raise_overflow:
jpayne@69 17750 PyErr_SetString(PyExc_OverflowError,
jpayne@69 17751 "value too large to convert to long");
jpayne@69 17752 return (long) -1;
jpayne@69 17753 raise_neg_overflow:
jpayne@69 17754 PyErr_SetString(PyExc_OverflowError,
jpayne@69 17755 "can't convert negative value to long");
jpayne@69 17756 return (long) -1;
jpayne@69 17757 }
jpayne@69 17758
jpayne@69 17759 /* FastTypeChecks */
jpayne@69 17760 #if CYTHON_COMPILING_IN_CPYTHON
jpayne@69 17761 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
jpayne@69 17762 while (a) {
jpayne@69 17763 a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*);
jpayne@69 17764 if (a == b)
jpayne@69 17765 return 1;
jpayne@69 17766 }
jpayne@69 17767 return b == &PyBaseObject_Type;
jpayne@69 17768 }
jpayne@69 17769 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
jpayne@69 17770 PyObject *mro;
jpayne@69 17771 if (a == b) return 1;
jpayne@69 17772 mro = a->tp_mro;
jpayne@69 17773 if (likely(mro)) {
jpayne@69 17774 Py_ssize_t i, n;
jpayne@69 17775 n = PyTuple_GET_SIZE(mro);
jpayne@69 17776 for (i = 0; i < n; i++) {
jpayne@69 17777 if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
jpayne@69 17778 return 1;
jpayne@69 17779 }
jpayne@69 17780 return 0;
jpayne@69 17781 }
jpayne@69 17782 return __Pyx_InBases(a, b);
jpayne@69 17783 }
jpayne@69 17784 static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) {
jpayne@69 17785 PyObject *mro;
jpayne@69 17786 if (cls == a || cls == b) return 1;
jpayne@69 17787 mro = cls->tp_mro;
jpayne@69 17788 if (likely(mro)) {
jpayne@69 17789 Py_ssize_t i, n;
jpayne@69 17790 n = PyTuple_GET_SIZE(mro);
jpayne@69 17791 for (i = 0; i < n; i++) {
jpayne@69 17792 PyObject *base = PyTuple_GET_ITEM(mro, i);
jpayne@69 17793 if (base == (PyObject *)a || base == (PyObject *)b)
jpayne@69 17794 return 1;
jpayne@69 17795 }
jpayne@69 17796 return 0;
jpayne@69 17797 }
jpayne@69 17798 return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b);
jpayne@69 17799 }
jpayne@69 17800 #if PY_MAJOR_VERSION == 2
jpayne@69 17801 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
jpayne@69 17802 PyObject *exception, *value, *tb;
jpayne@69 17803 int res;
jpayne@69 17804 __Pyx_PyThreadState_declare
jpayne@69 17805 __Pyx_PyThreadState_assign
jpayne@69 17806 __Pyx_ErrFetch(&exception, &value, &tb);
jpayne@69 17807 res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
jpayne@69 17808 if (unlikely(res == -1)) {
jpayne@69 17809 PyErr_WriteUnraisable(err);
jpayne@69 17810 res = 0;
jpayne@69 17811 }
jpayne@69 17812 if (!res) {
jpayne@69 17813 res = PyObject_IsSubclass(err, exc_type2);
jpayne@69 17814 if (unlikely(res == -1)) {
jpayne@69 17815 PyErr_WriteUnraisable(err);
jpayne@69 17816 res = 0;
jpayne@69 17817 }
jpayne@69 17818 }
jpayne@69 17819 __Pyx_ErrRestore(exception, value, tb);
jpayne@69 17820 return res;
jpayne@69 17821 }
jpayne@69 17822 #else
jpayne@69 17823 static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
jpayne@69 17824 if (exc_type1) {
jpayne@69 17825 return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2);
jpayne@69 17826 } else {
jpayne@69 17827 return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
jpayne@69 17828 }
jpayne@69 17829 }
jpayne@69 17830 #endif
jpayne@69 17831 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
jpayne@69 17832 Py_ssize_t i, n;
jpayne@69 17833 assert(PyExceptionClass_Check(exc_type));
jpayne@69 17834 n = PyTuple_GET_SIZE(tuple);
jpayne@69 17835 #if PY_MAJOR_VERSION >= 3
jpayne@69 17836 for (i=0; i<n; i++) {
jpayne@69 17837 if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
jpayne@69 17838 }
jpayne@69 17839 #endif
jpayne@69 17840 for (i=0; i<n; i++) {
jpayne@69 17841 PyObject *t = PyTuple_GET_ITEM(tuple, i);
jpayne@69 17842 #if PY_MAJOR_VERSION < 3
jpayne@69 17843 if (likely(exc_type == t)) return 1;
jpayne@69 17844 #endif
jpayne@69 17845 if (likely(PyExceptionClass_Check(t))) {
jpayne@69 17846 if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
jpayne@69 17847 } else {
jpayne@69 17848 }
jpayne@69 17849 }
jpayne@69 17850 return 0;
jpayne@69 17851 }
jpayne@69 17852 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
jpayne@69 17853 if (likely(err == exc_type)) return 1;
jpayne@69 17854 if (likely(PyExceptionClass_Check(err))) {
jpayne@69 17855 if (likely(PyExceptionClass_Check(exc_type))) {
jpayne@69 17856 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
jpayne@69 17857 } else if (likely(PyTuple_Check(exc_type))) {
jpayne@69 17858 return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
jpayne@69 17859 } else {
jpayne@69 17860 }
jpayne@69 17861 }
jpayne@69 17862 return PyErr_GivenExceptionMatches(err, exc_type);
jpayne@69 17863 }
jpayne@69 17864 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
jpayne@69 17865 assert(PyExceptionClass_Check(exc_type1));
jpayne@69 17866 assert(PyExceptionClass_Check(exc_type2));
jpayne@69 17867 if (likely(err == exc_type1 || err == exc_type2)) return 1;
jpayne@69 17868 if (likely(PyExceptionClass_Check(err))) {
jpayne@69 17869 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
jpayne@69 17870 }
jpayne@69 17871 return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
jpayne@69 17872 }
jpayne@69 17873 #endif
jpayne@69 17874
jpayne@69 17875 /* CheckBinaryVersion */
jpayne@69 17876 static unsigned long __Pyx_get_runtime_version(void) {
jpayne@69 17877 #if __PYX_LIMITED_VERSION_HEX >= 0x030B00A4
jpayne@69 17878 return Py_Version & ~0xFFUL;
jpayne@69 17879 #else
jpayne@69 17880 const char* rt_version = Py_GetVersion();
jpayne@69 17881 unsigned long version = 0;
jpayne@69 17882 unsigned long factor = 0x01000000UL;
jpayne@69 17883 unsigned int digit = 0;
jpayne@69 17884 int i = 0;
jpayne@69 17885 while (factor) {
jpayne@69 17886 while ('0' <= rt_version[i] && rt_version[i] <= '9') {
jpayne@69 17887 digit = digit * 10 + (unsigned int) (rt_version[i] - '0');
jpayne@69 17888 ++i;
jpayne@69 17889 }
jpayne@69 17890 version += factor * digit;
jpayne@69 17891 if (rt_version[i] != '.')
jpayne@69 17892 break;
jpayne@69 17893 digit = 0;
jpayne@69 17894 factor >>= 8;
jpayne@69 17895 ++i;
jpayne@69 17896 }
jpayne@69 17897 return version;
jpayne@69 17898 #endif
jpayne@69 17899 }
jpayne@69 17900 static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer) {
jpayne@69 17901 const unsigned long MAJOR_MINOR = 0xFFFF0000UL;
jpayne@69 17902 if ((rt_version & MAJOR_MINOR) == (ct_version & MAJOR_MINOR))
jpayne@69 17903 return 0;
jpayne@69 17904 if (likely(allow_newer && (rt_version & MAJOR_MINOR) > (ct_version & MAJOR_MINOR)))
jpayne@69 17905 return 1;
jpayne@69 17906 {
jpayne@69 17907 char message[200];
jpayne@69 17908 PyOS_snprintf(message, sizeof(message),
jpayne@69 17909 "compile time Python version %d.%d "
jpayne@69 17910 "of module '%.100s' "
jpayne@69 17911 "%s "
jpayne@69 17912 "runtime version %d.%d",
jpayne@69 17913 (int) (ct_version >> 24), (int) ((ct_version >> 16) & 0xFF),
jpayne@69 17914 __Pyx_MODULE_NAME,
jpayne@69 17915 (allow_newer) ? "was newer than" : "does not match",
jpayne@69 17916 (int) (rt_version >> 24), (int) ((rt_version >> 16) & 0xFF)
jpayne@69 17917 );
jpayne@69 17918 return PyErr_WarnEx(NULL, message, 1);
jpayne@69 17919 }
jpayne@69 17920 }
jpayne@69 17921
jpayne@69 17922 /* FunctionExport */
jpayne@69 17923 static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig) {
jpayne@69 17924 PyObject *d = 0;
jpayne@69 17925 PyObject *cobj = 0;
jpayne@69 17926 union {
jpayne@69 17927 void (*fp)(void);
jpayne@69 17928 void *p;
jpayne@69 17929 } tmp;
jpayne@69 17930 d = PyObject_GetAttrString(__pyx_m, (char *)"__pyx_capi__");
jpayne@69 17931 if (!d) {
jpayne@69 17932 PyErr_Clear();
jpayne@69 17933 d = PyDict_New();
jpayne@69 17934 if (!d)
jpayne@69 17935 goto bad;
jpayne@69 17936 Py_INCREF(d);
jpayne@69 17937 if (PyModule_AddObject(__pyx_m, (char *)"__pyx_capi__", d) < 0)
jpayne@69 17938 goto bad;
jpayne@69 17939 }
jpayne@69 17940 tmp.fp = f;
jpayne@69 17941 cobj = PyCapsule_New(tmp.p, sig, 0);
jpayne@69 17942 if (!cobj)
jpayne@69 17943 goto bad;
jpayne@69 17944 if (PyDict_SetItemString(d, name, cobj) < 0)
jpayne@69 17945 goto bad;
jpayne@69 17946 Py_DECREF(cobj);
jpayne@69 17947 Py_DECREF(d);
jpayne@69 17948 return 0;
jpayne@69 17949 bad:
jpayne@69 17950 Py_XDECREF(cobj);
jpayne@69 17951 Py_XDECREF(d);
jpayne@69 17952 return -1;
jpayne@69 17953 }
jpayne@69 17954
jpayne@69 17955 /* InitStrings */
jpayne@69 17956 #if PY_MAJOR_VERSION >= 3
jpayne@69 17957 static int __Pyx_InitString(__Pyx_StringTabEntry t, PyObject **str) {
jpayne@69 17958 if (t.is_unicode | t.is_str) {
jpayne@69 17959 if (t.intern) {
jpayne@69 17960 *str = PyUnicode_InternFromString(t.s);
jpayne@69 17961 } else if (t.encoding) {
jpayne@69 17962 *str = PyUnicode_Decode(t.s, t.n - 1, t.encoding, NULL);
jpayne@69 17963 } else {
jpayne@69 17964 *str = PyUnicode_FromStringAndSize(t.s, t.n - 1);
jpayne@69 17965 }
jpayne@69 17966 } else {
jpayne@69 17967 *str = PyBytes_FromStringAndSize(t.s, t.n - 1);
jpayne@69 17968 }
jpayne@69 17969 if (!*str)
jpayne@69 17970 return -1;
jpayne@69 17971 if (PyObject_Hash(*str) == -1)
jpayne@69 17972 return -1;
jpayne@69 17973 return 0;
jpayne@69 17974 }
jpayne@69 17975 #endif
jpayne@69 17976 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
jpayne@69 17977 while (t->p) {
jpayne@69 17978 #if PY_MAJOR_VERSION >= 3
jpayne@69 17979 __Pyx_InitString(*t, t->p);
jpayne@69 17980 #else
jpayne@69 17981 if (t->is_unicode) {
jpayne@69 17982 *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
jpayne@69 17983 } else if (t->intern) {
jpayne@69 17984 *t->p = PyString_InternFromString(t->s);
jpayne@69 17985 } else {
jpayne@69 17986 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
jpayne@69 17987 }
jpayne@69 17988 if (!*t->p)
jpayne@69 17989 return -1;
jpayne@69 17990 if (PyObject_Hash(*t->p) == -1)
jpayne@69 17991 return -1;
jpayne@69 17992 #endif
jpayne@69 17993 ++t;
jpayne@69 17994 }
jpayne@69 17995 return 0;
jpayne@69 17996 }
jpayne@69 17997
jpayne@69 17998 #include <string.h>
jpayne@69 17999 static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s) {
jpayne@69 18000 size_t len = strlen(s);
jpayne@69 18001 if (unlikely(len > (size_t) PY_SSIZE_T_MAX)) {
jpayne@69 18002 PyErr_SetString(PyExc_OverflowError, "byte string is too long");
jpayne@69 18003 return -1;
jpayne@69 18004 }
jpayne@69 18005 return (Py_ssize_t) len;
jpayne@69 18006 }
jpayne@69 18007 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
jpayne@69 18008 Py_ssize_t len = __Pyx_ssize_strlen(c_str);
jpayne@69 18009 if (unlikely(len < 0)) return NULL;
jpayne@69 18010 return __Pyx_PyUnicode_FromStringAndSize(c_str, len);
jpayne@69 18011 }
jpayne@69 18012 static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char* c_str) {
jpayne@69 18013 Py_ssize_t len = __Pyx_ssize_strlen(c_str);
jpayne@69 18014 if (unlikely(len < 0)) return NULL;
jpayne@69 18015 return PyByteArray_FromStringAndSize(c_str, len);
jpayne@69 18016 }
jpayne@69 18017 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
jpayne@69 18018 Py_ssize_t ignore;
jpayne@69 18019 return __Pyx_PyObject_AsStringAndSize(o, &ignore);
jpayne@69 18020 }
jpayne@69 18021 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
jpayne@69 18022 #if !CYTHON_PEP393_ENABLED
jpayne@69 18023 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
jpayne@69 18024 char* defenc_c;
jpayne@69 18025 PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
jpayne@69 18026 if (!defenc) return NULL;
jpayne@69 18027 defenc_c = PyBytes_AS_STRING(defenc);
jpayne@69 18028 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
jpayne@69 18029 {
jpayne@69 18030 char* end = defenc_c + PyBytes_GET_SIZE(defenc);
jpayne@69 18031 char* c;
jpayne@69 18032 for (c = defenc_c; c < end; c++) {
jpayne@69 18033 if ((unsigned char) (*c) >= 128) {
jpayne@69 18034 PyUnicode_AsASCIIString(o);
jpayne@69 18035 return NULL;
jpayne@69 18036 }
jpayne@69 18037 }
jpayne@69 18038 }
jpayne@69 18039 #endif
jpayne@69 18040 *length = PyBytes_GET_SIZE(defenc);
jpayne@69 18041 return defenc_c;
jpayne@69 18042 }
jpayne@69 18043 #else
jpayne@69 18044 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
jpayne@69 18045 if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
jpayne@69 18046 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
jpayne@69 18047 if (likely(PyUnicode_IS_ASCII(o))) {
jpayne@69 18048 *length = PyUnicode_GET_LENGTH(o);
jpayne@69 18049 return PyUnicode_AsUTF8(o);
jpayne@69 18050 } else {
jpayne@69 18051 PyUnicode_AsASCIIString(o);
jpayne@69 18052 return NULL;
jpayne@69 18053 }
jpayne@69 18054 #else
jpayne@69 18055 return PyUnicode_AsUTF8AndSize(o, length);
jpayne@69 18056 #endif
jpayne@69 18057 }
jpayne@69 18058 #endif
jpayne@69 18059 #endif
jpayne@69 18060 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
jpayne@69 18061 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
jpayne@69 18062 if (
jpayne@69 18063 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
jpayne@69 18064 __Pyx_sys_getdefaultencoding_not_ascii &&
jpayne@69 18065 #endif
jpayne@69 18066 PyUnicode_Check(o)) {
jpayne@69 18067 return __Pyx_PyUnicode_AsStringAndSize(o, length);
jpayne@69 18068 } else
jpayne@69 18069 #endif
jpayne@69 18070 #if (!CYTHON_COMPILING_IN_PYPY && !CYTHON_COMPILING_IN_LIMITED_API) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
jpayne@69 18071 if (PyByteArray_Check(o)) {
jpayne@69 18072 *length = PyByteArray_GET_SIZE(o);
jpayne@69 18073 return PyByteArray_AS_STRING(o);
jpayne@69 18074 } else
jpayne@69 18075 #endif
jpayne@69 18076 {
jpayne@69 18077 char* result;
jpayne@69 18078 int r = PyBytes_AsStringAndSize(o, &result, length);
jpayne@69 18079 if (unlikely(r < 0)) {
jpayne@69 18080 return NULL;
jpayne@69 18081 } else {
jpayne@69 18082 return result;
jpayne@69 18083 }
jpayne@69 18084 }
jpayne@69 18085 }
jpayne@69 18086 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
jpayne@69 18087 int is_true = x == Py_True;
jpayne@69 18088 if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
jpayne@69 18089 else return PyObject_IsTrue(x);
jpayne@69 18090 }
jpayne@69 18091 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
jpayne@69 18092 int retval;
jpayne@69 18093 if (unlikely(!x)) return -1;
jpayne@69 18094 retval = __Pyx_PyObject_IsTrue(x);
jpayne@69 18095 Py_DECREF(x);
jpayne@69 18096 return retval;
jpayne@69 18097 }
jpayne@69 18098 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
jpayne@69 18099 __Pyx_TypeName result_type_name = __Pyx_PyType_GetName(Py_TYPE(result));
jpayne@69 18100 #if PY_MAJOR_VERSION >= 3
jpayne@69 18101 if (PyLong_Check(result)) {
jpayne@69 18102 if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
jpayne@69 18103 "__int__ returned non-int (type " __Pyx_FMT_TYPENAME "). "
jpayne@69 18104 "The ability to return an instance of a strict subclass of int is deprecated, "
jpayne@69 18105 "and may be removed in a future version of Python.",
jpayne@69 18106 result_type_name)) {
jpayne@69 18107 __Pyx_DECREF_TypeName(result_type_name);
jpayne@69 18108 Py_DECREF(result);
jpayne@69 18109 return NULL;
jpayne@69 18110 }
jpayne@69 18111 __Pyx_DECREF_TypeName(result_type_name);
jpayne@69 18112 return result;
jpayne@69 18113 }
jpayne@69 18114 #endif
jpayne@69 18115 PyErr_Format(PyExc_TypeError,
jpayne@69 18116 "__%.4s__ returned non-%.4s (type " __Pyx_FMT_TYPENAME ")",
jpayne@69 18117 type_name, type_name, result_type_name);
jpayne@69 18118 __Pyx_DECREF_TypeName(result_type_name);
jpayne@69 18119 Py_DECREF(result);
jpayne@69 18120 return NULL;
jpayne@69 18121 }
jpayne@69 18122 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
jpayne@69 18123 #if CYTHON_USE_TYPE_SLOTS
jpayne@69 18124 PyNumberMethods *m;
jpayne@69 18125 #endif
jpayne@69 18126 const char *name = NULL;
jpayne@69 18127 PyObject *res = NULL;
jpayne@69 18128 #if PY_MAJOR_VERSION < 3
jpayne@69 18129 if (likely(PyInt_Check(x) || PyLong_Check(x)))
jpayne@69 18130 #else
jpayne@69 18131 if (likely(PyLong_Check(x)))
jpayne@69 18132 #endif
jpayne@69 18133 return __Pyx_NewRef(x);
jpayne@69 18134 #if CYTHON_USE_TYPE_SLOTS
jpayne@69 18135 m = Py_TYPE(x)->tp_as_number;
jpayne@69 18136 #if PY_MAJOR_VERSION < 3
jpayne@69 18137 if (m && m->nb_int) {
jpayne@69 18138 name = "int";
jpayne@69 18139 res = m->nb_int(x);
jpayne@69 18140 }
jpayne@69 18141 else if (m && m->nb_long) {
jpayne@69 18142 name = "long";
jpayne@69 18143 res = m->nb_long(x);
jpayne@69 18144 }
jpayne@69 18145 #else
jpayne@69 18146 if (likely(m && m->nb_int)) {
jpayne@69 18147 name = "int";
jpayne@69 18148 res = m->nb_int(x);
jpayne@69 18149 }
jpayne@69 18150 #endif
jpayne@69 18151 #else
jpayne@69 18152 if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
jpayne@69 18153 res = PyNumber_Int(x);
jpayne@69 18154 }
jpayne@69 18155 #endif
jpayne@69 18156 if (likely(res)) {
jpayne@69 18157 #if PY_MAJOR_VERSION < 3
jpayne@69 18158 if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
jpayne@69 18159 #else
jpayne@69 18160 if (unlikely(!PyLong_CheckExact(res))) {
jpayne@69 18161 #endif
jpayne@69 18162 return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
jpayne@69 18163 }
jpayne@69 18164 }
jpayne@69 18165 else if (!PyErr_Occurred()) {
jpayne@69 18166 PyErr_SetString(PyExc_TypeError,
jpayne@69 18167 "an integer is required");
jpayne@69 18168 }
jpayne@69 18169 return res;
jpayne@69 18170 }
jpayne@69 18171 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
jpayne@69 18172 Py_ssize_t ival;
jpayne@69 18173 PyObject *x;
jpayne@69 18174 #if PY_MAJOR_VERSION < 3
jpayne@69 18175 if (likely(PyInt_CheckExact(b))) {
jpayne@69 18176 if (sizeof(Py_ssize_t) >= sizeof(long))
jpayne@69 18177 return PyInt_AS_LONG(b);
jpayne@69 18178 else
jpayne@69 18179 return PyInt_AsSsize_t(b);
jpayne@69 18180 }
jpayne@69 18181 #endif
jpayne@69 18182 if (likely(PyLong_CheckExact(b))) {
jpayne@69 18183 #if CYTHON_USE_PYLONG_INTERNALS
jpayne@69 18184 if (likely(__Pyx_PyLong_IsCompact(b))) {
jpayne@69 18185 return __Pyx_PyLong_CompactValue(b);
jpayne@69 18186 } else {
jpayne@69 18187 const digit* digits = __Pyx_PyLong_Digits(b);
jpayne@69 18188 const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(b);
jpayne@69 18189 switch (size) {
jpayne@69 18190 case 2:
jpayne@69 18191 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
jpayne@69 18192 return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
jpayne@69 18193 }
jpayne@69 18194 break;
jpayne@69 18195 case -2:
jpayne@69 18196 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
jpayne@69 18197 return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
jpayne@69 18198 }
jpayne@69 18199 break;
jpayne@69 18200 case 3:
jpayne@69 18201 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
jpayne@69 18202 return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
jpayne@69 18203 }
jpayne@69 18204 break;
jpayne@69 18205 case -3:
jpayne@69 18206 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
jpayne@69 18207 return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
jpayne@69 18208 }
jpayne@69 18209 break;
jpayne@69 18210 case 4:
jpayne@69 18211 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
jpayne@69 18212 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]));
jpayne@69 18213 }
jpayne@69 18214 break;
jpayne@69 18215 case -4:
jpayne@69 18216 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
jpayne@69 18217 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]));
jpayne@69 18218 }
jpayne@69 18219 break;
jpayne@69 18220 }
jpayne@69 18221 }
jpayne@69 18222 #endif
jpayne@69 18223 return PyLong_AsSsize_t(b);
jpayne@69 18224 }
jpayne@69 18225 x = PyNumber_Index(b);
jpayne@69 18226 if (!x) return -1;
jpayne@69 18227 ival = PyInt_AsSsize_t(x);
jpayne@69 18228 Py_DECREF(x);
jpayne@69 18229 return ival;
jpayne@69 18230 }
jpayne@69 18231 static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) {
jpayne@69 18232 if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) {
jpayne@69 18233 return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o);
jpayne@69 18234 #if PY_MAJOR_VERSION < 3
jpayne@69 18235 } else if (likely(PyInt_CheckExact(o))) {
jpayne@69 18236 return PyInt_AS_LONG(o);
jpayne@69 18237 #endif
jpayne@69 18238 } else {
jpayne@69 18239 Py_ssize_t ival;
jpayne@69 18240 PyObject *x;
jpayne@69 18241 x = PyNumber_Index(o);
jpayne@69 18242 if (!x) return -1;
jpayne@69 18243 ival = PyInt_AsLong(x);
jpayne@69 18244 Py_DECREF(x);
jpayne@69 18245 return ival;
jpayne@69 18246 }
jpayne@69 18247 }
jpayne@69 18248 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
jpayne@69 18249 return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
jpayne@69 18250 }
jpayne@69 18251 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
jpayne@69 18252 return PyInt_FromSize_t(ival);
jpayne@69 18253 }
jpayne@69 18254
jpayne@69 18255
jpayne@69 18256 /* #### Code section: utility_code_pragmas_end ### */
jpayne@69 18257 #ifdef _MSC_VER
jpayne@69 18258 #pragma warning( pop )
jpayne@69 18259 #endif
jpayne@69 18260
jpayne@69 18261
jpayne@69 18262
jpayne@69 18263 /* #### Code section: end ### */
jpayne@69 18264 #endif /* Py_PYTHON_H */