annotate CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/lib/python3.8/site-packages/pysam/libcutils.c @ 68:5028fdace37b

planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author jpayne
date Tue, 18 Mar 2025 16:23:26 -0400
parents
children
rev   line source
jpayne@68 1 /* Generated by Cython 3.0.11 */
jpayne@68 2
jpayne@68 3 /* BEGIN: Cython Metadata
jpayne@68 4 {
jpayne@68 5 "distutils": {
jpayne@68 6 "define_macros": [
jpayne@68 7 [
jpayne@68 8 "BUILDING_WHEEL",
jpayne@68 9 null
jpayne@68 10 ]
jpayne@68 11 ],
jpayne@68 12 "depends": [
jpayne@68 13 "/project/bcftools/bcftools.pysam.h",
jpayne@68 14 "/project/samtools/samtools.pysam.h"
jpayne@68 15 ],
jpayne@68 16 "extra_compile_args": [
jpayne@68 17 "-Wno-unused",
jpayne@68 18 "-Wno-strict-prototypes",
jpayne@68 19 "-Wno-sign-compare",
jpayne@68 20 "-Wno-error=declaration-after-statement"
jpayne@68 21 ],
jpayne@68 22 "extra_link_args": [
jpayne@68 23 "-Wl,-rpath,$ORIGIN"
jpayne@68 24 ],
jpayne@68 25 "include_dirs": [
jpayne@68 26 "/project/pysam",
jpayne@68 27 "/project/htslib",
jpayne@68 28 "/project/samtools",
jpayne@68 29 "/project/samtools/lz4",
jpayne@68 30 "/project/bcftools",
jpayne@68 31 "/project"
jpayne@68 32 ],
jpayne@68 33 "language": "c",
jpayne@68 34 "libraries": [
jpayne@68 35 "z",
jpayne@68 36 "lzma",
jpayne@68 37 "bz2",
jpayne@68 38 "z",
jpayne@68 39 "m",
jpayne@68 40 "curl",
jpayne@68 41 "crypto",
jpayne@68 42 "chtslib.cpython-37m-x86_64-linux-gnu",
jpayne@68 43 "csamtools.cpython-37m-x86_64-linux-gnu",
jpayne@68 44 "cbcftools.cpython-37m-x86_64-linux-gnu"
jpayne@68 45 ],
jpayne@68 46 "library_dirs": [
jpayne@68 47 "/project/pysam",
jpayne@68 48 "/project",
jpayne@68 49 "build/lib.linux-x86_64-cpython-37/pysam",
jpayne@68 50 "build/lib.linux-x86_64-cpython-37/pysam",
jpayne@68 51 "build/lib.linux-x86_64-cpython-37/pysam",
jpayne@68 52 "build/lib.linux-x86_64-cpython-37/pysam"
jpayne@68 53 ],
jpayne@68 54 "name": "pysam.libcutils",
jpayne@68 55 "sources": [
jpayne@68 56 "pysam/libcutils.pyx",
jpayne@68 57 "pysam/pysam_util.c"
jpayne@68 58 ]
jpayne@68 59 },
jpayne@68 60 "module_name": "pysam.libcutils"
jpayne@68 61 }
jpayne@68 62 END: Cython Metadata */
jpayne@68 63
jpayne@68 64 #ifndef PY_SSIZE_T_CLEAN
jpayne@68 65 #define PY_SSIZE_T_CLEAN
jpayne@68 66 #endif /* PY_SSIZE_T_CLEAN */
jpayne@68 67 #if defined(CYTHON_LIMITED_API) && 0
jpayne@68 68 #ifndef Py_LIMITED_API
jpayne@68 69 #if CYTHON_LIMITED_API+0 > 0x03030000
jpayne@68 70 #define Py_LIMITED_API CYTHON_LIMITED_API
jpayne@68 71 #else
jpayne@68 72 #define Py_LIMITED_API 0x03030000
jpayne@68 73 #endif
jpayne@68 74 #endif
jpayne@68 75 #endif
jpayne@68 76
jpayne@68 77 #include "Python.h"
jpayne@68 78
jpayne@68 79 #if PY_MAJOR_VERSION >= 3
jpayne@68 80 #define __Pyx_PyFloat_FromString(obj) PyFloat_FromString(obj)
jpayne@68 81 #else
jpayne@68 82 #define __Pyx_PyFloat_FromString(obj) PyFloat_FromString(obj, NULL)
jpayne@68 83 #endif
jpayne@68 84
jpayne@68 85
jpayne@68 86 #if PY_MAJOR_VERSION <= 2
jpayne@68 87 #define PyDict_GetItemWithError _PyDict_GetItemWithError
jpayne@68 88 #endif
jpayne@68 89
jpayne@68 90
jpayne@68 91 #if (PY_VERSION_HEX < 0x030700b1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030600)) && !defined(PyContextVar_Get)
jpayne@68 92 #define PyContextVar_Get(var, d, v) ((d) ? ((void)(var), Py_INCREF(d), (v)[0] = (d), 0) : ((v)[0] = NULL, 0) )
jpayne@68 93 #endif
jpayne@68 94
jpayne@68 95 #ifndef Py_PYTHON_H
jpayne@68 96 #error Python headers needed to compile C extensions, please install development version of Python.
jpayne@68 97 #elif PY_VERSION_HEX < 0x02070000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
jpayne@68 98 #error Cython requires Python 2.7+ or Python 3.3+.
jpayne@68 99 #else
jpayne@68 100 #if defined(CYTHON_LIMITED_API) && CYTHON_LIMITED_API
jpayne@68 101 #define __PYX_EXTRA_ABI_MODULE_NAME "limited"
jpayne@68 102 #else
jpayne@68 103 #define __PYX_EXTRA_ABI_MODULE_NAME ""
jpayne@68 104 #endif
jpayne@68 105 #define CYTHON_ABI "3_0_11" __PYX_EXTRA_ABI_MODULE_NAME
jpayne@68 106 #define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI
jpayne@68 107 #define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "."
jpayne@68 108 #define CYTHON_HEX_VERSION 0x03000BF0
jpayne@68 109 #define CYTHON_FUTURE_DIVISION 1
jpayne@68 110 #include <stddef.h>
jpayne@68 111 #ifndef offsetof
jpayne@68 112 #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
jpayne@68 113 #endif
jpayne@68 114 #if !defined(_WIN32) && !defined(WIN32) && !defined(MS_WINDOWS)
jpayne@68 115 #ifndef __stdcall
jpayne@68 116 #define __stdcall
jpayne@68 117 #endif
jpayne@68 118 #ifndef __cdecl
jpayne@68 119 #define __cdecl
jpayne@68 120 #endif
jpayne@68 121 #ifndef __fastcall
jpayne@68 122 #define __fastcall
jpayne@68 123 #endif
jpayne@68 124 #endif
jpayne@68 125 #ifndef DL_IMPORT
jpayne@68 126 #define DL_IMPORT(t) t
jpayne@68 127 #endif
jpayne@68 128 #ifndef DL_EXPORT
jpayne@68 129 #define DL_EXPORT(t) t
jpayne@68 130 #endif
jpayne@68 131 #define __PYX_COMMA ,
jpayne@68 132 #ifndef HAVE_LONG_LONG
jpayne@68 133 #define HAVE_LONG_LONG
jpayne@68 134 #endif
jpayne@68 135 #ifndef PY_LONG_LONG
jpayne@68 136 #define PY_LONG_LONG LONG_LONG
jpayne@68 137 #endif
jpayne@68 138 #ifndef Py_HUGE_VAL
jpayne@68 139 #define Py_HUGE_VAL HUGE_VAL
jpayne@68 140 #endif
jpayne@68 141 #define __PYX_LIMITED_VERSION_HEX PY_VERSION_HEX
jpayne@68 142 #if defined(GRAALVM_PYTHON)
jpayne@68 143 /* For very preliminary testing purposes. Most variables are set the same as PyPy.
jpayne@68 144 The existence of this section does not imply that anything works or is even tested */
jpayne@68 145 #define CYTHON_COMPILING_IN_PYPY 0
jpayne@68 146 #define CYTHON_COMPILING_IN_CPYTHON 0
jpayne@68 147 #define CYTHON_COMPILING_IN_LIMITED_API 0
jpayne@68 148 #define CYTHON_COMPILING_IN_GRAAL 1
jpayne@68 149 #define CYTHON_COMPILING_IN_NOGIL 0
jpayne@68 150 #undef CYTHON_USE_TYPE_SLOTS
jpayne@68 151 #define CYTHON_USE_TYPE_SLOTS 0
jpayne@68 152 #undef CYTHON_USE_TYPE_SPECS
jpayne@68 153 #define CYTHON_USE_TYPE_SPECS 0
jpayne@68 154 #undef CYTHON_USE_PYTYPE_LOOKUP
jpayne@68 155 #define CYTHON_USE_PYTYPE_LOOKUP 0
jpayne@68 156 #if PY_VERSION_HEX < 0x03050000
jpayne@68 157 #undef CYTHON_USE_ASYNC_SLOTS
jpayne@68 158 #define CYTHON_USE_ASYNC_SLOTS 0
jpayne@68 159 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
jpayne@68 160 #define CYTHON_USE_ASYNC_SLOTS 1
jpayne@68 161 #endif
jpayne@68 162 #undef CYTHON_USE_PYLIST_INTERNALS
jpayne@68 163 #define CYTHON_USE_PYLIST_INTERNALS 0
jpayne@68 164 #undef CYTHON_USE_UNICODE_INTERNALS
jpayne@68 165 #define CYTHON_USE_UNICODE_INTERNALS 0
jpayne@68 166 #undef CYTHON_USE_UNICODE_WRITER
jpayne@68 167 #define CYTHON_USE_UNICODE_WRITER 0
jpayne@68 168 #undef CYTHON_USE_PYLONG_INTERNALS
jpayne@68 169 #define CYTHON_USE_PYLONG_INTERNALS 0
jpayne@68 170 #undef CYTHON_AVOID_BORROWED_REFS
jpayne@68 171 #define CYTHON_AVOID_BORROWED_REFS 1
jpayne@68 172 #undef CYTHON_ASSUME_SAFE_MACROS
jpayne@68 173 #define CYTHON_ASSUME_SAFE_MACROS 0
jpayne@68 174 #undef CYTHON_UNPACK_METHODS
jpayne@68 175 #define CYTHON_UNPACK_METHODS 0
jpayne@68 176 #undef CYTHON_FAST_THREAD_STATE
jpayne@68 177 #define CYTHON_FAST_THREAD_STATE 0
jpayne@68 178 #undef CYTHON_FAST_GIL
jpayne@68 179 #define CYTHON_FAST_GIL 0
jpayne@68 180 #undef CYTHON_METH_FASTCALL
jpayne@68 181 #define CYTHON_METH_FASTCALL 0
jpayne@68 182 #undef CYTHON_FAST_PYCALL
jpayne@68 183 #define CYTHON_FAST_PYCALL 0
jpayne@68 184 #ifndef CYTHON_PEP487_INIT_SUBCLASS
jpayne@68 185 #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3)
jpayne@68 186 #endif
jpayne@68 187 #undef CYTHON_PEP489_MULTI_PHASE_INIT
jpayne@68 188 #define CYTHON_PEP489_MULTI_PHASE_INIT 1
jpayne@68 189 #undef CYTHON_USE_MODULE_STATE
jpayne@68 190 #define CYTHON_USE_MODULE_STATE 0
jpayne@68 191 #undef CYTHON_USE_TP_FINALIZE
jpayne@68 192 #define CYTHON_USE_TP_FINALIZE 0
jpayne@68 193 #undef CYTHON_USE_DICT_VERSIONS
jpayne@68 194 #define CYTHON_USE_DICT_VERSIONS 0
jpayne@68 195 #undef CYTHON_USE_EXC_INFO_STACK
jpayne@68 196 #define CYTHON_USE_EXC_INFO_STACK 0
jpayne@68 197 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
jpayne@68 198 #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
jpayne@68 199 #endif
jpayne@68 200 #undef CYTHON_USE_FREELISTS
jpayne@68 201 #define CYTHON_USE_FREELISTS 0
jpayne@68 202 #elif defined(PYPY_VERSION)
jpayne@68 203 #define CYTHON_COMPILING_IN_PYPY 1
jpayne@68 204 #define CYTHON_COMPILING_IN_CPYTHON 0
jpayne@68 205 #define CYTHON_COMPILING_IN_LIMITED_API 0
jpayne@68 206 #define CYTHON_COMPILING_IN_GRAAL 0
jpayne@68 207 #define CYTHON_COMPILING_IN_NOGIL 0
jpayne@68 208 #undef CYTHON_USE_TYPE_SLOTS
jpayne@68 209 #define CYTHON_USE_TYPE_SLOTS 0
jpayne@68 210 #ifndef CYTHON_USE_TYPE_SPECS
jpayne@68 211 #define CYTHON_USE_TYPE_SPECS 0
jpayne@68 212 #endif
jpayne@68 213 #undef CYTHON_USE_PYTYPE_LOOKUP
jpayne@68 214 #define CYTHON_USE_PYTYPE_LOOKUP 0
jpayne@68 215 #if PY_VERSION_HEX < 0x03050000
jpayne@68 216 #undef CYTHON_USE_ASYNC_SLOTS
jpayne@68 217 #define CYTHON_USE_ASYNC_SLOTS 0
jpayne@68 218 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
jpayne@68 219 #define CYTHON_USE_ASYNC_SLOTS 1
jpayne@68 220 #endif
jpayne@68 221 #undef CYTHON_USE_PYLIST_INTERNALS
jpayne@68 222 #define CYTHON_USE_PYLIST_INTERNALS 0
jpayne@68 223 #undef CYTHON_USE_UNICODE_INTERNALS
jpayne@68 224 #define CYTHON_USE_UNICODE_INTERNALS 0
jpayne@68 225 #undef CYTHON_USE_UNICODE_WRITER
jpayne@68 226 #define CYTHON_USE_UNICODE_WRITER 0
jpayne@68 227 #undef CYTHON_USE_PYLONG_INTERNALS
jpayne@68 228 #define CYTHON_USE_PYLONG_INTERNALS 0
jpayne@68 229 #undef CYTHON_AVOID_BORROWED_REFS
jpayne@68 230 #define CYTHON_AVOID_BORROWED_REFS 1
jpayne@68 231 #undef CYTHON_ASSUME_SAFE_MACROS
jpayne@68 232 #define CYTHON_ASSUME_SAFE_MACROS 0
jpayne@68 233 #undef CYTHON_UNPACK_METHODS
jpayne@68 234 #define CYTHON_UNPACK_METHODS 0
jpayne@68 235 #undef CYTHON_FAST_THREAD_STATE
jpayne@68 236 #define CYTHON_FAST_THREAD_STATE 0
jpayne@68 237 #undef CYTHON_FAST_GIL
jpayne@68 238 #define CYTHON_FAST_GIL 0
jpayne@68 239 #undef CYTHON_METH_FASTCALL
jpayne@68 240 #define CYTHON_METH_FASTCALL 0
jpayne@68 241 #undef CYTHON_FAST_PYCALL
jpayne@68 242 #define CYTHON_FAST_PYCALL 0
jpayne@68 243 #ifndef CYTHON_PEP487_INIT_SUBCLASS
jpayne@68 244 #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3)
jpayne@68 245 #endif
jpayne@68 246 #if PY_VERSION_HEX < 0x03090000
jpayne@68 247 #undef CYTHON_PEP489_MULTI_PHASE_INIT
jpayne@68 248 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
jpayne@68 249 #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT)
jpayne@68 250 #define CYTHON_PEP489_MULTI_PHASE_INIT 1
jpayne@68 251 #endif
jpayne@68 252 #undef CYTHON_USE_MODULE_STATE
jpayne@68 253 #define CYTHON_USE_MODULE_STATE 0
jpayne@68 254 #undef CYTHON_USE_TP_FINALIZE
jpayne@68 255 #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1 && PYPY_VERSION_NUM >= 0x07030C00)
jpayne@68 256 #undef CYTHON_USE_DICT_VERSIONS
jpayne@68 257 #define CYTHON_USE_DICT_VERSIONS 0
jpayne@68 258 #undef CYTHON_USE_EXC_INFO_STACK
jpayne@68 259 #define CYTHON_USE_EXC_INFO_STACK 0
jpayne@68 260 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
jpayne@68 261 #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
jpayne@68 262 #endif
jpayne@68 263 #undef CYTHON_USE_FREELISTS
jpayne@68 264 #define CYTHON_USE_FREELISTS 0
jpayne@68 265 #elif defined(CYTHON_LIMITED_API)
jpayne@68 266 #ifdef Py_LIMITED_API
jpayne@68 267 #undef __PYX_LIMITED_VERSION_HEX
jpayne@68 268 #define __PYX_LIMITED_VERSION_HEX Py_LIMITED_API
jpayne@68 269 #endif
jpayne@68 270 #define CYTHON_COMPILING_IN_PYPY 0
jpayne@68 271 #define CYTHON_COMPILING_IN_CPYTHON 0
jpayne@68 272 #define CYTHON_COMPILING_IN_LIMITED_API 1
jpayne@68 273 #define CYTHON_COMPILING_IN_GRAAL 0
jpayne@68 274 #define CYTHON_COMPILING_IN_NOGIL 0
jpayne@68 275 #undef CYTHON_CLINE_IN_TRACEBACK
jpayne@68 276 #define CYTHON_CLINE_IN_TRACEBACK 0
jpayne@68 277 #undef CYTHON_USE_TYPE_SLOTS
jpayne@68 278 #define CYTHON_USE_TYPE_SLOTS 0
jpayne@68 279 #undef CYTHON_USE_TYPE_SPECS
jpayne@68 280 #define CYTHON_USE_TYPE_SPECS 1
jpayne@68 281 #undef CYTHON_USE_PYTYPE_LOOKUP
jpayne@68 282 #define CYTHON_USE_PYTYPE_LOOKUP 0
jpayne@68 283 #undef CYTHON_USE_ASYNC_SLOTS
jpayne@68 284 #define CYTHON_USE_ASYNC_SLOTS 0
jpayne@68 285 #undef CYTHON_USE_PYLIST_INTERNALS
jpayne@68 286 #define CYTHON_USE_PYLIST_INTERNALS 0
jpayne@68 287 #undef CYTHON_USE_UNICODE_INTERNALS
jpayne@68 288 #define CYTHON_USE_UNICODE_INTERNALS 0
jpayne@68 289 #ifndef CYTHON_USE_UNICODE_WRITER
jpayne@68 290 #define CYTHON_USE_UNICODE_WRITER 0
jpayne@68 291 #endif
jpayne@68 292 #undef CYTHON_USE_PYLONG_INTERNALS
jpayne@68 293 #define CYTHON_USE_PYLONG_INTERNALS 0
jpayne@68 294 #ifndef CYTHON_AVOID_BORROWED_REFS
jpayne@68 295 #define CYTHON_AVOID_BORROWED_REFS 0
jpayne@68 296 #endif
jpayne@68 297 #undef CYTHON_ASSUME_SAFE_MACROS
jpayne@68 298 #define CYTHON_ASSUME_SAFE_MACROS 0
jpayne@68 299 #undef CYTHON_UNPACK_METHODS
jpayne@68 300 #define CYTHON_UNPACK_METHODS 0
jpayne@68 301 #undef CYTHON_FAST_THREAD_STATE
jpayne@68 302 #define CYTHON_FAST_THREAD_STATE 0
jpayne@68 303 #undef CYTHON_FAST_GIL
jpayne@68 304 #define CYTHON_FAST_GIL 0
jpayne@68 305 #undef CYTHON_METH_FASTCALL
jpayne@68 306 #define CYTHON_METH_FASTCALL 0
jpayne@68 307 #undef CYTHON_FAST_PYCALL
jpayne@68 308 #define CYTHON_FAST_PYCALL 0
jpayne@68 309 #ifndef CYTHON_PEP487_INIT_SUBCLASS
jpayne@68 310 #define CYTHON_PEP487_INIT_SUBCLASS 1
jpayne@68 311 #endif
jpayne@68 312 #undef CYTHON_PEP489_MULTI_PHASE_INIT
jpayne@68 313 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
jpayne@68 314 #undef CYTHON_USE_MODULE_STATE
jpayne@68 315 #define CYTHON_USE_MODULE_STATE 1
jpayne@68 316 #ifndef CYTHON_USE_TP_FINALIZE
jpayne@68 317 #define CYTHON_USE_TP_FINALIZE 0
jpayne@68 318 #endif
jpayne@68 319 #undef CYTHON_USE_DICT_VERSIONS
jpayne@68 320 #define CYTHON_USE_DICT_VERSIONS 0
jpayne@68 321 #undef CYTHON_USE_EXC_INFO_STACK
jpayne@68 322 #define CYTHON_USE_EXC_INFO_STACK 0
jpayne@68 323 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
jpayne@68 324 #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
jpayne@68 325 #endif
jpayne@68 326 #undef CYTHON_USE_FREELISTS
jpayne@68 327 #define CYTHON_USE_FREELISTS 0
jpayne@68 328 #elif defined(Py_GIL_DISABLED) || defined(Py_NOGIL)
jpayne@68 329 #define CYTHON_COMPILING_IN_PYPY 0
jpayne@68 330 #define CYTHON_COMPILING_IN_CPYTHON 0
jpayne@68 331 #define CYTHON_COMPILING_IN_LIMITED_API 0
jpayne@68 332 #define CYTHON_COMPILING_IN_GRAAL 0
jpayne@68 333 #define CYTHON_COMPILING_IN_NOGIL 1
jpayne@68 334 #ifndef CYTHON_USE_TYPE_SLOTS
jpayne@68 335 #define CYTHON_USE_TYPE_SLOTS 1
jpayne@68 336 #endif
jpayne@68 337 #ifndef CYTHON_USE_TYPE_SPECS
jpayne@68 338 #define CYTHON_USE_TYPE_SPECS 0
jpayne@68 339 #endif
jpayne@68 340 #undef CYTHON_USE_PYTYPE_LOOKUP
jpayne@68 341 #define CYTHON_USE_PYTYPE_LOOKUP 0
jpayne@68 342 #ifndef CYTHON_USE_ASYNC_SLOTS
jpayne@68 343 #define CYTHON_USE_ASYNC_SLOTS 1
jpayne@68 344 #endif
jpayne@68 345 #ifndef CYTHON_USE_PYLONG_INTERNALS
jpayne@68 346 #define CYTHON_USE_PYLONG_INTERNALS 0
jpayne@68 347 #endif
jpayne@68 348 #undef CYTHON_USE_PYLIST_INTERNALS
jpayne@68 349 #define CYTHON_USE_PYLIST_INTERNALS 0
jpayne@68 350 #ifndef CYTHON_USE_UNICODE_INTERNALS
jpayne@68 351 #define CYTHON_USE_UNICODE_INTERNALS 1
jpayne@68 352 #endif
jpayne@68 353 #undef CYTHON_USE_UNICODE_WRITER
jpayne@68 354 #define CYTHON_USE_UNICODE_WRITER 0
jpayne@68 355 #ifndef CYTHON_AVOID_BORROWED_REFS
jpayne@68 356 #define CYTHON_AVOID_BORROWED_REFS 0
jpayne@68 357 #endif
jpayne@68 358 #ifndef CYTHON_ASSUME_SAFE_MACROS
jpayne@68 359 #define CYTHON_ASSUME_SAFE_MACROS 1
jpayne@68 360 #endif
jpayne@68 361 #ifndef CYTHON_UNPACK_METHODS
jpayne@68 362 #define CYTHON_UNPACK_METHODS 1
jpayne@68 363 #endif
jpayne@68 364 #undef CYTHON_FAST_THREAD_STATE
jpayne@68 365 #define CYTHON_FAST_THREAD_STATE 0
jpayne@68 366 #undef CYTHON_FAST_GIL
jpayne@68 367 #define CYTHON_FAST_GIL 0
jpayne@68 368 #ifndef CYTHON_METH_FASTCALL
jpayne@68 369 #define CYTHON_METH_FASTCALL 1
jpayne@68 370 #endif
jpayne@68 371 #undef CYTHON_FAST_PYCALL
jpayne@68 372 #define CYTHON_FAST_PYCALL 0
jpayne@68 373 #ifndef CYTHON_PEP487_INIT_SUBCLASS
jpayne@68 374 #define CYTHON_PEP487_INIT_SUBCLASS 1
jpayne@68 375 #endif
jpayne@68 376 #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
jpayne@68 377 #define CYTHON_PEP489_MULTI_PHASE_INIT 1
jpayne@68 378 #endif
jpayne@68 379 #ifndef CYTHON_USE_MODULE_STATE
jpayne@68 380 #define CYTHON_USE_MODULE_STATE 0
jpayne@68 381 #endif
jpayne@68 382 #ifndef CYTHON_USE_TP_FINALIZE
jpayne@68 383 #define CYTHON_USE_TP_FINALIZE 1
jpayne@68 384 #endif
jpayne@68 385 #undef CYTHON_USE_DICT_VERSIONS
jpayne@68 386 #define CYTHON_USE_DICT_VERSIONS 0
jpayne@68 387 #undef CYTHON_USE_EXC_INFO_STACK
jpayne@68 388 #define CYTHON_USE_EXC_INFO_STACK 0
jpayne@68 389 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
jpayne@68 390 #define CYTHON_UPDATE_DESCRIPTOR_DOC 1
jpayne@68 391 #endif
jpayne@68 392 #ifndef CYTHON_USE_FREELISTS
jpayne@68 393 #define CYTHON_USE_FREELISTS 0
jpayne@68 394 #endif
jpayne@68 395 #else
jpayne@68 396 #define CYTHON_COMPILING_IN_PYPY 0
jpayne@68 397 #define CYTHON_COMPILING_IN_CPYTHON 1
jpayne@68 398 #define CYTHON_COMPILING_IN_LIMITED_API 0
jpayne@68 399 #define CYTHON_COMPILING_IN_GRAAL 0
jpayne@68 400 #define CYTHON_COMPILING_IN_NOGIL 0
jpayne@68 401 #ifndef CYTHON_USE_TYPE_SLOTS
jpayne@68 402 #define CYTHON_USE_TYPE_SLOTS 1
jpayne@68 403 #endif
jpayne@68 404 #ifndef CYTHON_USE_TYPE_SPECS
jpayne@68 405 #define CYTHON_USE_TYPE_SPECS 0
jpayne@68 406 #endif
jpayne@68 407 #ifndef CYTHON_USE_PYTYPE_LOOKUP
jpayne@68 408 #define CYTHON_USE_PYTYPE_LOOKUP 1
jpayne@68 409 #endif
jpayne@68 410 #if PY_MAJOR_VERSION < 3
jpayne@68 411 #undef CYTHON_USE_ASYNC_SLOTS
jpayne@68 412 #define CYTHON_USE_ASYNC_SLOTS 0
jpayne@68 413 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
jpayne@68 414 #define CYTHON_USE_ASYNC_SLOTS 1
jpayne@68 415 #endif
jpayne@68 416 #ifndef CYTHON_USE_PYLONG_INTERNALS
jpayne@68 417 #define CYTHON_USE_PYLONG_INTERNALS 1
jpayne@68 418 #endif
jpayne@68 419 #ifndef CYTHON_USE_PYLIST_INTERNALS
jpayne@68 420 #define CYTHON_USE_PYLIST_INTERNALS 1
jpayne@68 421 #endif
jpayne@68 422 #ifndef CYTHON_USE_UNICODE_INTERNALS
jpayne@68 423 #define CYTHON_USE_UNICODE_INTERNALS 1
jpayne@68 424 #endif
jpayne@68 425 #if PY_VERSION_HEX < 0x030300F0 || PY_VERSION_HEX >= 0x030B00A2
jpayne@68 426 #undef CYTHON_USE_UNICODE_WRITER
jpayne@68 427 #define CYTHON_USE_UNICODE_WRITER 0
jpayne@68 428 #elif !defined(CYTHON_USE_UNICODE_WRITER)
jpayne@68 429 #define CYTHON_USE_UNICODE_WRITER 1
jpayne@68 430 #endif
jpayne@68 431 #ifndef CYTHON_AVOID_BORROWED_REFS
jpayne@68 432 #define CYTHON_AVOID_BORROWED_REFS 0
jpayne@68 433 #endif
jpayne@68 434 #ifndef CYTHON_ASSUME_SAFE_MACROS
jpayne@68 435 #define CYTHON_ASSUME_SAFE_MACROS 1
jpayne@68 436 #endif
jpayne@68 437 #ifndef CYTHON_UNPACK_METHODS
jpayne@68 438 #define CYTHON_UNPACK_METHODS 1
jpayne@68 439 #endif
jpayne@68 440 #ifndef CYTHON_FAST_THREAD_STATE
jpayne@68 441 #define CYTHON_FAST_THREAD_STATE 1
jpayne@68 442 #endif
jpayne@68 443 #ifndef CYTHON_FAST_GIL
jpayne@68 444 #define CYTHON_FAST_GIL (PY_MAJOR_VERSION < 3 || PY_VERSION_HEX >= 0x03060000 && PY_VERSION_HEX < 0x030C00A6)
jpayne@68 445 #endif
jpayne@68 446 #ifndef CYTHON_METH_FASTCALL
jpayne@68 447 #define CYTHON_METH_FASTCALL (PY_VERSION_HEX >= 0x030700A1)
jpayne@68 448 #endif
jpayne@68 449 #ifndef CYTHON_FAST_PYCALL
jpayne@68 450 #define CYTHON_FAST_PYCALL 1
jpayne@68 451 #endif
jpayne@68 452 #ifndef CYTHON_PEP487_INIT_SUBCLASS
jpayne@68 453 #define CYTHON_PEP487_INIT_SUBCLASS 1
jpayne@68 454 #endif
jpayne@68 455 #if PY_VERSION_HEX < 0x03050000
jpayne@68 456 #undef CYTHON_PEP489_MULTI_PHASE_INIT
jpayne@68 457 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
jpayne@68 458 #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT)
jpayne@68 459 #define CYTHON_PEP489_MULTI_PHASE_INIT 1
jpayne@68 460 #endif
jpayne@68 461 #ifndef CYTHON_USE_MODULE_STATE
jpayne@68 462 #define CYTHON_USE_MODULE_STATE 0
jpayne@68 463 #endif
jpayne@68 464 #if PY_VERSION_HEX < 0x030400a1
jpayne@68 465 #undef CYTHON_USE_TP_FINALIZE
jpayne@68 466 #define CYTHON_USE_TP_FINALIZE 0
jpayne@68 467 #elif !defined(CYTHON_USE_TP_FINALIZE)
jpayne@68 468 #define CYTHON_USE_TP_FINALIZE 1
jpayne@68 469 #endif
jpayne@68 470 #if PY_VERSION_HEX < 0x030600B1
jpayne@68 471 #undef CYTHON_USE_DICT_VERSIONS
jpayne@68 472 #define CYTHON_USE_DICT_VERSIONS 0
jpayne@68 473 #elif !defined(CYTHON_USE_DICT_VERSIONS)
jpayne@68 474 #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX < 0x030C00A5)
jpayne@68 475 #endif
jpayne@68 476 #if PY_VERSION_HEX < 0x030700A3
jpayne@68 477 #undef CYTHON_USE_EXC_INFO_STACK
jpayne@68 478 #define CYTHON_USE_EXC_INFO_STACK 0
jpayne@68 479 #elif !defined(CYTHON_USE_EXC_INFO_STACK)
jpayne@68 480 #define CYTHON_USE_EXC_INFO_STACK 1
jpayne@68 481 #endif
jpayne@68 482 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
jpayne@68 483 #define CYTHON_UPDATE_DESCRIPTOR_DOC 1
jpayne@68 484 #endif
jpayne@68 485 #ifndef CYTHON_USE_FREELISTS
jpayne@68 486 #define CYTHON_USE_FREELISTS 1
jpayne@68 487 #endif
jpayne@68 488 #endif
jpayne@68 489 #if !defined(CYTHON_FAST_PYCCALL)
jpayne@68 490 #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
jpayne@68 491 #endif
jpayne@68 492 #if !defined(CYTHON_VECTORCALL)
jpayne@68 493 #define CYTHON_VECTORCALL (CYTHON_FAST_PYCCALL && PY_VERSION_HEX >= 0x030800B1)
jpayne@68 494 #endif
jpayne@68 495 #define CYTHON_BACKPORT_VECTORCALL (CYTHON_METH_FASTCALL && PY_VERSION_HEX < 0x030800B1)
jpayne@68 496 #if CYTHON_USE_PYLONG_INTERNALS
jpayne@68 497 #if PY_MAJOR_VERSION < 3
jpayne@68 498 #include "longintrepr.h"
jpayne@68 499 #endif
jpayne@68 500 #undef SHIFT
jpayne@68 501 #undef BASE
jpayne@68 502 #undef MASK
jpayne@68 503 #ifdef SIZEOF_VOID_P
jpayne@68 504 enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
jpayne@68 505 #endif
jpayne@68 506 #endif
jpayne@68 507 #ifndef __has_attribute
jpayne@68 508 #define __has_attribute(x) 0
jpayne@68 509 #endif
jpayne@68 510 #ifndef __has_cpp_attribute
jpayne@68 511 #define __has_cpp_attribute(x) 0
jpayne@68 512 #endif
jpayne@68 513 #ifndef CYTHON_RESTRICT
jpayne@68 514 #if defined(__GNUC__)
jpayne@68 515 #define CYTHON_RESTRICT __restrict__
jpayne@68 516 #elif defined(_MSC_VER) && _MSC_VER >= 1400
jpayne@68 517 #define CYTHON_RESTRICT __restrict
jpayne@68 518 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
jpayne@68 519 #define CYTHON_RESTRICT restrict
jpayne@68 520 #else
jpayne@68 521 #define CYTHON_RESTRICT
jpayne@68 522 #endif
jpayne@68 523 #endif
jpayne@68 524 #ifndef CYTHON_UNUSED
jpayne@68 525 #if defined(__cplusplus)
jpayne@68 526 /* for clang __has_cpp_attribute(maybe_unused) is true even before C++17
jpayne@68 527 * but leads to warnings with -pedantic, since it is a C++17 feature */
jpayne@68 528 #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
jpayne@68 529 #if __has_cpp_attribute(maybe_unused)
jpayne@68 530 #define CYTHON_UNUSED [[maybe_unused]]
jpayne@68 531 #endif
jpayne@68 532 #endif
jpayne@68 533 #endif
jpayne@68 534 #endif
jpayne@68 535 #ifndef CYTHON_UNUSED
jpayne@68 536 # if defined(__GNUC__)
jpayne@68 537 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
jpayne@68 538 # define CYTHON_UNUSED __attribute__ ((__unused__))
jpayne@68 539 # else
jpayne@68 540 # define CYTHON_UNUSED
jpayne@68 541 # endif
jpayne@68 542 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
jpayne@68 543 # define CYTHON_UNUSED __attribute__ ((__unused__))
jpayne@68 544 # else
jpayne@68 545 # define CYTHON_UNUSED
jpayne@68 546 # endif
jpayne@68 547 #endif
jpayne@68 548 #ifndef CYTHON_UNUSED_VAR
jpayne@68 549 # if defined(__cplusplus)
jpayne@68 550 template<class T> void CYTHON_UNUSED_VAR( const T& ) { }
jpayne@68 551 # else
jpayne@68 552 # define CYTHON_UNUSED_VAR(x) (void)(x)
jpayne@68 553 # endif
jpayne@68 554 #endif
jpayne@68 555 #ifndef CYTHON_MAYBE_UNUSED_VAR
jpayne@68 556 #define CYTHON_MAYBE_UNUSED_VAR(x) CYTHON_UNUSED_VAR(x)
jpayne@68 557 #endif
jpayne@68 558 #ifndef CYTHON_NCP_UNUSED
jpayne@68 559 # if CYTHON_COMPILING_IN_CPYTHON
jpayne@68 560 # define CYTHON_NCP_UNUSED
jpayne@68 561 # else
jpayne@68 562 # define CYTHON_NCP_UNUSED CYTHON_UNUSED
jpayne@68 563 # endif
jpayne@68 564 #endif
jpayne@68 565 #ifndef CYTHON_USE_CPP_STD_MOVE
jpayne@68 566 #if defined(__cplusplus) && (\
jpayne@68 567 __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600))
jpayne@68 568 #define CYTHON_USE_CPP_STD_MOVE 1
jpayne@68 569 #else
jpayne@68 570 #define CYTHON_USE_CPP_STD_MOVE 0
jpayne@68 571 #endif
jpayne@68 572 #endif
jpayne@68 573 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
jpayne@68 574 #ifdef _MSC_VER
jpayne@68 575 #ifndef _MSC_STDINT_H_
jpayne@68 576 #if _MSC_VER < 1300
jpayne@68 577 typedef unsigned char uint8_t;
jpayne@68 578 typedef unsigned short uint16_t;
jpayne@68 579 typedef unsigned int uint32_t;
jpayne@68 580 #else
jpayne@68 581 typedef unsigned __int8 uint8_t;
jpayne@68 582 typedef unsigned __int16 uint16_t;
jpayne@68 583 typedef unsigned __int32 uint32_t;
jpayne@68 584 #endif
jpayne@68 585 #endif
jpayne@68 586 #if _MSC_VER < 1300
jpayne@68 587 #ifdef _WIN64
jpayne@68 588 typedef unsigned long long __pyx_uintptr_t;
jpayne@68 589 #else
jpayne@68 590 typedef unsigned int __pyx_uintptr_t;
jpayne@68 591 #endif
jpayne@68 592 #else
jpayne@68 593 #ifdef _WIN64
jpayne@68 594 typedef unsigned __int64 __pyx_uintptr_t;
jpayne@68 595 #else
jpayne@68 596 typedef unsigned __int32 __pyx_uintptr_t;
jpayne@68 597 #endif
jpayne@68 598 #endif
jpayne@68 599 #else
jpayne@68 600 #include <stdint.h>
jpayne@68 601 typedef uintptr_t __pyx_uintptr_t;
jpayne@68 602 #endif
jpayne@68 603 #ifndef CYTHON_FALLTHROUGH
jpayne@68 604 #if defined(__cplusplus)
jpayne@68 605 /* for clang __has_cpp_attribute(fallthrough) is true even before C++17
jpayne@68 606 * but leads to warnings with -pedantic, since it is a C++17 feature */
jpayne@68 607 #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
jpayne@68 608 #if __has_cpp_attribute(fallthrough)
jpayne@68 609 #define CYTHON_FALLTHROUGH [[fallthrough]]
jpayne@68 610 #endif
jpayne@68 611 #endif
jpayne@68 612 #ifndef CYTHON_FALLTHROUGH
jpayne@68 613 #if __has_cpp_attribute(clang::fallthrough)
jpayne@68 614 #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
jpayne@68 615 #elif __has_cpp_attribute(gnu::fallthrough)
jpayne@68 616 #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
jpayne@68 617 #endif
jpayne@68 618 #endif
jpayne@68 619 #endif
jpayne@68 620 #ifndef CYTHON_FALLTHROUGH
jpayne@68 621 #if __has_attribute(fallthrough)
jpayne@68 622 #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
jpayne@68 623 #else
jpayne@68 624 #define CYTHON_FALLTHROUGH
jpayne@68 625 #endif
jpayne@68 626 #endif
jpayne@68 627 #if defined(__clang__) && defined(__apple_build_version__)
jpayne@68 628 #if __apple_build_version__ < 7000000
jpayne@68 629 #undef CYTHON_FALLTHROUGH
jpayne@68 630 #define CYTHON_FALLTHROUGH
jpayne@68 631 #endif
jpayne@68 632 #endif
jpayne@68 633 #endif
jpayne@68 634 #ifdef __cplusplus
jpayne@68 635 template <typename T>
jpayne@68 636 struct __PYX_IS_UNSIGNED_IMPL {static const bool value = T(0) < T(-1);};
jpayne@68 637 #define __PYX_IS_UNSIGNED(type) (__PYX_IS_UNSIGNED_IMPL<type>::value)
jpayne@68 638 #else
jpayne@68 639 #define __PYX_IS_UNSIGNED(type) (((type)-1) > 0)
jpayne@68 640 #endif
jpayne@68 641 #if CYTHON_COMPILING_IN_PYPY == 1
jpayne@68 642 #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x030A0000)
jpayne@68 643 #else
jpayne@68 644 #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000)
jpayne@68 645 #endif
jpayne@68 646 #define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer))
jpayne@68 647
jpayne@68 648 #ifndef CYTHON_INLINE
jpayne@68 649 #if defined(__clang__)
jpayne@68 650 #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
jpayne@68 651 #elif defined(__GNUC__)
jpayne@68 652 #define CYTHON_INLINE __inline__
jpayne@68 653 #elif defined(_MSC_VER)
jpayne@68 654 #define CYTHON_INLINE __inline
jpayne@68 655 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
jpayne@68 656 #define CYTHON_INLINE inline
jpayne@68 657 #else
jpayne@68 658 #define CYTHON_INLINE
jpayne@68 659 #endif
jpayne@68 660 #endif
jpayne@68 661
jpayne@68 662 #define __PYX_BUILD_PY_SSIZE_T "n"
jpayne@68 663 #define CYTHON_FORMAT_SSIZE_T "z"
jpayne@68 664 #if PY_MAJOR_VERSION < 3
jpayne@68 665 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
jpayne@68 666 #define __Pyx_DefaultClassType PyClass_Type
jpayne@68 667 #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
jpayne@68 668 PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
jpayne@68 669 #else
jpayne@68 670 #define __Pyx_BUILTIN_MODULE_NAME "builtins"
jpayne@68 671 #define __Pyx_DefaultClassType PyType_Type
jpayne@68 672 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 673 static CYTHON_INLINE PyObject* __Pyx_PyCode_New(int a, int p, int k, int l, int s, int f,
jpayne@68 674 PyObject *code, PyObject *c, PyObject* n, PyObject *v,
jpayne@68 675 PyObject *fv, PyObject *cell, PyObject* fn,
jpayne@68 676 PyObject *name, int fline, PyObject *lnos) {
jpayne@68 677 PyObject *exception_table = NULL;
jpayne@68 678 PyObject *types_module=NULL, *code_type=NULL, *result=NULL;
jpayne@68 679 #if __PYX_LIMITED_VERSION_HEX < 0x030B0000
jpayne@68 680 PyObject *version_info;
jpayne@68 681 PyObject *py_minor_version = NULL;
jpayne@68 682 #endif
jpayne@68 683 long minor_version = 0;
jpayne@68 684 PyObject *type, *value, *traceback;
jpayne@68 685 PyErr_Fetch(&type, &value, &traceback);
jpayne@68 686 #if __PYX_LIMITED_VERSION_HEX >= 0x030B0000
jpayne@68 687 minor_version = 11;
jpayne@68 688 #else
jpayne@68 689 if (!(version_info = PySys_GetObject("version_info"))) goto end;
jpayne@68 690 if (!(py_minor_version = PySequence_GetItem(version_info, 1))) goto end;
jpayne@68 691 minor_version = PyLong_AsLong(py_minor_version);
jpayne@68 692 Py_DECREF(py_minor_version);
jpayne@68 693 if (minor_version == -1 && PyErr_Occurred()) goto end;
jpayne@68 694 #endif
jpayne@68 695 if (!(types_module = PyImport_ImportModule("types"))) goto end;
jpayne@68 696 if (!(code_type = PyObject_GetAttrString(types_module, "CodeType"))) goto end;
jpayne@68 697 if (minor_version <= 7) {
jpayne@68 698 (void)p;
jpayne@68 699 result = PyObject_CallFunction(code_type, "iiiiiOOOOOOiOO", a, k, l, s, f, code,
jpayne@68 700 c, n, v, fn, name, fline, lnos, fv, cell);
jpayne@68 701 } else if (minor_version <= 10) {
jpayne@68 702 result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOiOO", a,p, k, l, s, f, code,
jpayne@68 703 c, n, v, fn, name, fline, lnos, fv, cell);
jpayne@68 704 } else {
jpayne@68 705 if (!(exception_table = PyBytes_FromStringAndSize(NULL, 0))) goto end;
jpayne@68 706 result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOOiOO", a,p, k, l, s, f, code,
jpayne@68 707 c, n, v, fn, name, name, fline, lnos, exception_table, fv, cell);
jpayne@68 708 }
jpayne@68 709 end:
jpayne@68 710 Py_XDECREF(code_type);
jpayne@68 711 Py_XDECREF(exception_table);
jpayne@68 712 Py_XDECREF(types_module);
jpayne@68 713 if (type) {
jpayne@68 714 PyErr_Restore(type, value, traceback);
jpayne@68 715 }
jpayne@68 716 return result;
jpayne@68 717 }
jpayne@68 718 #ifndef CO_OPTIMIZED
jpayne@68 719 #define CO_OPTIMIZED 0x0001
jpayne@68 720 #endif
jpayne@68 721 #ifndef CO_NEWLOCALS
jpayne@68 722 #define CO_NEWLOCALS 0x0002
jpayne@68 723 #endif
jpayne@68 724 #ifndef CO_VARARGS
jpayne@68 725 #define CO_VARARGS 0x0004
jpayne@68 726 #endif
jpayne@68 727 #ifndef CO_VARKEYWORDS
jpayne@68 728 #define CO_VARKEYWORDS 0x0008
jpayne@68 729 #endif
jpayne@68 730 #ifndef CO_ASYNC_GENERATOR
jpayne@68 731 #define CO_ASYNC_GENERATOR 0x0200
jpayne@68 732 #endif
jpayne@68 733 #ifndef CO_GENERATOR
jpayne@68 734 #define CO_GENERATOR 0x0020
jpayne@68 735 #endif
jpayne@68 736 #ifndef CO_COROUTINE
jpayne@68 737 #define CO_COROUTINE 0x0080
jpayne@68 738 #endif
jpayne@68 739 #elif PY_VERSION_HEX >= 0x030B0000
jpayne@68 740 static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int p, int k, int l, int s, int f,
jpayne@68 741 PyObject *code, PyObject *c, PyObject* n, PyObject *v,
jpayne@68 742 PyObject *fv, PyObject *cell, PyObject* fn,
jpayne@68 743 PyObject *name, int fline, PyObject *lnos) {
jpayne@68 744 PyCodeObject *result;
jpayne@68 745 PyObject *empty_bytes = PyBytes_FromStringAndSize("", 0);
jpayne@68 746 if (!empty_bytes) return NULL;
jpayne@68 747 result =
jpayne@68 748 #if PY_VERSION_HEX >= 0x030C0000
jpayne@68 749 PyUnstable_Code_NewWithPosOnlyArgs
jpayne@68 750 #else
jpayne@68 751 PyCode_NewWithPosOnlyArgs
jpayne@68 752 #endif
jpayne@68 753 (a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, name, fline, lnos, empty_bytes);
jpayne@68 754 Py_DECREF(empty_bytes);
jpayne@68 755 return result;
jpayne@68 756 }
jpayne@68 757 #elif PY_VERSION_HEX >= 0x030800B2 && !CYTHON_COMPILING_IN_PYPY
jpayne@68 758 #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
jpayne@68 759 PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
jpayne@68 760 #else
jpayne@68 761 #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
jpayne@68 762 PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
jpayne@68 763 #endif
jpayne@68 764 #endif
jpayne@68 765 #if PY_VERSION_HEX >= 0x030900A4 || defined(Py_IS_TYPE)
jpayne@68 766 #define __Pyx_IS_TYPE(ob, type) Py_IS_TYPE(ob, type)
jpayne@68 767 #else
jpayne@68 768 #define __Pyx_IS_TYPE(ob, type) (((const PyObject*)ob)->ob_type == (type))
jpayne@68 769 #endif
jpayne@68 770 #if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_Is)
jpayne@68 771 #define __Pyx_Py_Is(x, y) Py_Is(x, y)
jpayne@68 772 #else
jpayne@68 773 #define __Pyx_Py_Is(x, y) ((x) == (y))
jpayne@68 774 #endif
jpayne@68 775 #if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsNone)
jpayne@68 776 #define __Pyx_Py_IsNone(ob) Py_IsNone(ob)
jpayne@68 777 #else
jpayne@68 778 #define __Pyx_Py_IsNone(ob) __Pyx_Py_Is((ob), Py_None)
jpayne@68 779 #endif
jpayne@68 780 #if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsTrue)
jpayne@68 781 #define __Pyx_Py_IsTrue(ob) Py_IsTrue(ob)
jpayne@68 782 #else
jpayne@68 783 #define __Pyx_Py_IsTrue(ob) __Pyx_Py_Is((ob), Py_True)
jpayne@68 784 #endif
jpayne@68 785 #if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsFalse)
jpayne@68 786 #define __Pyx_Py_IsFalse(ob) Py_IsFalse(ob)
jpayne@68 787 #else
jpayne@68 788 #define __Pyx_Py_IsFalse(ob) __Pyx_Py_Is((ob), Py_False)
jpayne@68 789 #endif
jpayne@68 790 #define __Pyx_NoneAsNull(obj) (__Pyx_Py_IsNone(obj) ? NULL : (obj))
jpayne@68 791 #if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY
jpayne@68 792 #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o)
jpayne@68 793 #else
jpayne@68 794 #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o)
jpayne@68 795 #endif
jpayne@68 796 #ifndef CO_COROUTINE
jpayne@68 797 #define CO_COROUTINE 0x80
jpayne@68 798 #endif
jpayne@68 799 #ifndef CO_ASYNC_GENERATOR
jpayne@68 800 #define CO_ASYNC_GENERATOR 0x200
jpayne@68 801 #endif
jpayne@68 802 #ifndef Py_TPFLAGS_CHECKTYPES
jpayne@68 803 #define Py_TPFLAGS_CHECKTYPES 0
jpayne@68 804 #endif
jpayne@68 805 #ifndef Py_TPFLAGS_HAVE_INDEX
jpayne@68 806 #define Py_TPFLAGS_HAVE_INDEX 0
jpayne@68 807 #endif
jpayne@68 808 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
jpayne@68 809 #define Py_TPFLAGS_HAVE_NEWBUFFER 0
jpayne@68 810 #endif
jpayne@68 811 #ifndef Py_TPFLAGS_HAVE_FINALIZE
jpayne@68 812 #define Py_TPFLAGS_HAVE_FINALIZE 0
jpayne@68 813 #endif
jpayne@68 814 #ifndef Py_TPFLAGS_SEQUENCE
jpayne@68 815 #define Py_TPFLAGS_SEQUENCE 0
jpayne@68 816 #endif
jpayne@68 817 #ifndef Py_TPFLAGS_MAPPING
jpayne@68 818 #define Py_TPFLAGS_MAPPING 0
jpayne@68 819 #endif
jpayne@68 820 #ifndef METH_STACKLESS
jpayne@68 821 #define METH_STACKLESS 0
jpayne@68 822 #endif
jpayne@68 823 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
jpayne@68 824 #ifndef METH_FASTCALL
jpayne@68 825 #define METH_FASTCALL 0x80
jpayne@68 826 #endif
jpayne@68 827 typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
jpayne@68 828 typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
jpayne@68 829 Py_ssize_t nargs, PyObject *kwnames);
jpayne@68 830 #else
jpayne@68 831 #if PY_VERSION_HEX >= 0x030d00A4
jpayne@68 832 # define __Pyx_PyCFunctionFast PyCFunctionFast
jpayne@68 833 # define __Pyx_PyCFunctionFastWithKeywords PyCFunctionFastWithKeywords
jpayne@68 834 #else
jpayne@68 835 # define __Pyx_PyCFunctionFast _PyCFunctionFast
jpayne@68 836 # define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
jpayne@68 837 #endif
jpayne@68 838 #endif
jpayne@68 839 #if CYTHON_METH_FASTCALL
jpayne@68 840 #define __Pyx_METH_FASTCALL METH_FASTCALL
jpayne@68 841 #define __Pyx_PyCFunction_FastCall __Pyx_PyCFunctionFast
jpayne@68 842 #define __Pyx_PyCFunction_FastCallWithKeywords __Pyx_PyCFunctionFastWithKeywords
jpayne@68 843 #else
jpayne@68 844 #define __Pyx_METH_FASTCALL METH_VARARGS
jpayne@68 845 #define __Pyx_PyCFunction_FastCall PyCFunction
jpayne@68 846 #define __Pyx_PyCFunction_FastCallWithKeywords PyCFunctionWithKeywords
jpayne@68 847 #endif
jpayne@68 848 #if CYTHON_VECTORCALL
jpayne@68 849 #define __pyx_vectorcallfunc vectorcallfunc
jpayne@68 850 #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET PY_VECTORCALL_ARGUMENTS_OFFSET
jpayne@68 851 #define __Pyx_PyVectorcall_NARGS(n) PyVectorcall_NARGS((size_t)(n))
jpayne@68 852 #elif CYTHON_BACKPORT_VECTORCALL
jpayne@68 853 typedef PyObject *(*__pyx_vectorcallfunc)(PyObject *callable, PyObject *const *args,
jpayne@68 854 size_t nargsf, PyObject *kwnames);
jpayne@68 855 #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET ((size_t)1 << (8 * sizeof(size_t) - 1))
jpayne@68 856 #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(((size_t)(n)) & ~__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET))
jpayne@68 857 #else
jpayne@68 858 #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET 0
jpayne@68 859 #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(n))
jpayne@68 860 #endif
jpayne@68 861 #if PY_MAJOR_VERSION >= 0x030900B1
jpayne@68 862 #define __Pyx_PyCFunction_CheckExact(func) PyCFunction_CheckExact(func)
jpayne@68 863 #else
jpayne@68 864 #define __Pyx_PyCFunction_CheckExact(func) PyCFunction_Check(func)
jpayne@68 865 #endif
jpayne@68 866 #define __Pyx_CyOrPyCFunction_Check(func) PyCFunction_Check(func)
jpayne@68 867 #if CYTHON_COMPILING_IN_CPYTHON
jpayne@68 868 #define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) (((PyCFunctionObject*)(func))->m_ml->ml_meth)
jpayne@68 869 #elif !CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 870 #define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) PyCFunction_GET_FUNCTION(func)
jpayne@68 871 #endif
jpayne@68 872 #if CYTHON_COMPILING_IN_CPYTHON
jpayne@68 873 #define __Pyx_CyOrPyCFunction_GET_FLAGS(func) (((PyCFunctionObject*)(func))->m_ml->ml_flags)
jpayne@68 874 static CYTHON_INLINE PyObject* __Pyx_CyOrPyCFunction_GET_SELF(PyObject *func) {
jpayne@68 875 return (__Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_STATIC) ? NULL : ((PyCFunctionObject*)func)->m_self;
jpayne@68 876 }
jpayne@68 877 #endif
jpayne@68 878 static CYTHON_INLINE int __Pyx__IsSameCFunction(PyObject *func, void *cfunc) {
jpayne@68 879 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 880 return PyCFunction_Check(func) && PyCFunction_GetFunction(func) == (PyCFunction) cfunc;
jpayne@68 881 #else
jpayne@68 882 return PyCFunction_Check(func) && PyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc;
jpayne@68 883 #endif
jpayne@68 884 }
jpayne@68 885 #define __Pyx_IsSameCFunction(func, cfunc) __Pyx__IsSameCFunction(func, cfunc)
jpayne@68 886 #if __PYX_LIMITED_VERSION_HEX < 0x030900B1
jpayne@68 887 #define __Pyx_PyType_FromModuleAndSpec(m, s, b) ((void)m, PyType_FromSpecWithBases(s, b))
jpayne@68 888 typedef PyObject *(*__Pyx_PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *, size_t, PyObject *);
jpayne@68 889 #else
jpayne@68 890 #define __Pyx_PyType_FromModuleAndSpec(m, s, b) PyType_FromModuleAndSpec(m, s, b)
jpayne@68 891 #define __Pyx_PyCMethod PyCMethod
jpayne@68 892 #endif
jpayne@68 893 #ifndef METH_METHOD
jpayne@68 894 #define METH_METHOD 0x200
jpayne@68 895 #endif
jpayne@68 896 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
jpayne@68 897 #define PyObject_Malloc(s) PyMem_Malloc(s)
jpayne@68 898 #define PyObject_Free(p) PyMem_Free(p)
jpayne@68 899 #define PyObject_Realloc(p) PyMem_Realloc(p)
jpayne@68 900 #endif
jpayne@68 901 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 902 #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
jpayne@68 903 #define __Pyx_PyFrame_SetLineNumber(frame, lineno)
jpayne@68 904 #else
jpayne@68 905 #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
jpayne@68 906 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
jpayne@68 907 #endif
jpayne@68 908 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 909 #define __Pyx_PyThreadState_Current PyThreadState_Get()
jpayne@68 910 #elif !CYTHON_FAST_THREAD_STATE
jpayne@68 911 #define __Pyx_PyThreadState_Current PyThreadState_GET()
jpayne@68 912 #elif PY_VERSION_HEX >= 0x030d00A1
jpayne@68 913 #define __Pyx_PyThreadState_Current PyThreadState_GetUnchecked()
jpayne@68 914 #elif PY_VERSION_HEX >= 0x03060000
jpayne@68 915 #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
jpayne@68 916 #elif PY_VERSION_HEX >= 0x03000000
jpayne@68 917 #define __Pyx_PyThreadState_Current PyThreadState_GET()
jpayne@68 918 #else
jpayne@68 919 #define __Pyx_PyThreadState_Current _PyThreadState_Current
jpayne@68 920 #endif
jpayne@68 921 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 922 static CYTHON_INLINE void *__Pyx_PyModule_GetState(PyObject *op)
jpayne@68 923 {
jpayne@68 924 void *result;
jpayne@68 925 result = PyModule_GetState(op);
jpayne@68 926 if (!result)
jpayne@68 927 Py_FatalError("Couldn't find the module state");
jpayne@68 928 return result;
jpayne@68 929 }
jpayne@68 930 #endif
jpayne@68 931 #define __Pyx_PyObject_GetSlot(obj, name, func_ctype) __Pyx_PyType_GetSlot(Py_TYPE(obj), name, func_ctype)
jpayne@68 932 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 933 #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((func_ctype) PyType_GetSlot((type), Py_##name))
jpayne@68 934 #else
jpayne@68 935 #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((type)->name)
jpayne@68 936 #endif
jpayne@68 937 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
jpayne@68 938 #include "pythread.h"
jpayne@68 939 #define Py_tss_NEEDS_INIT 0
jpayne@68 940 typedef int Py_tss_t;
jpayne@68 941 static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
jpayne@68 942 *key = PyThread_create_key();
jpayne@68 943 return 0;
jpayne@68 944 }
jpayne@68 945 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
jpayne@68 946 Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
jpayne@68 947 *key = Py_tss_NEEDS_INIT;
jpayne@68 948 return key;
jpayne@68 949 }
jpayne@68 950 static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
jpayne@68 951 PyObject_Free(key);
jpayne@68 952 }
jpayne@68 953 static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
jpayne@68 954 return *key != Py_tss_NEEDS_INIT;
jpayne@68 955 }
jpayne@68 956 static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
jpayne@68 957 PyThread_delete_key(*key);
jpayne@68 958 *key = Py_tss_NEEDS_INIT;
jpayne@68 959 }
jpayne@68 960 static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
jpayne@68 961 return PyThread_set_key_value(*key, value);
jpayne@68 962 }
jpayne@68 963 static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
jpayne@68 964 return PyThread_get_key_value(*key);
jpayne@68 965 }
jpayne@68 966 #endif
jpayne@68 967 #if PY_MAJOR_VERSION < 3
jpayne@68 968 #if CYTHON_COMPILING_IN_PYPY
jpayne@68 969 #if PYPY_VERSION_NUM < 0x07030600
jpayne@68 970 #if defined(__cplusplus) && __cplusplus >= 201402L
jpayne@68 971 [[deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")]]
jpayne@68 972 #elif defined(__GNUC__) || defined(__clang__)
jpayne@68 973 __attribute__ ((__deprecated__("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")))
jpayne@68 974 #elif defined(_MSC_VER)
jpayne@68 975 __declspec(deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6"))
jpayne@68 976 #endif
jpayne@68 977 static CYTHON_INLINE int PyGILState_Check(void) {
jpayne@68 978 return 0;
jpayne@68 979 }
jpayne@68 980 #else // PYPY_VERSION_NUM < 0x07030600
jpayne@68 981 #endif // PYPY_VERSION_NUM < 0x07030600
jpayne@68 982 #else
jpayne@68 983 static CYTHON_INLINE int PyGILState_Check(void) {
jpayne@68 984 PyThreadState * tstate = _PyThreadState_Current;
jpayne@68 985 return tstate && (tstate == PyGILState_GetThisThreadState());
jpayne@68 986 }
jpayne@68 987 #endif
jpayne@68 988 #endif
jpayne@68 989 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000 || defined(_PyDict_NewPresized)
jpayne@68 990 #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
jpayne@68 991 #else
jpayne@68 992 #define __Pyx_PyDict_NewPresized(n) PyDict_New()
jpayne@68 993 #endif
jpayne@68 994 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
jpayne@68 995 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
jpayne@68 996 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
jpayne@68 997 #else
jpayne@68 998 #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
jpayne@68 999 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
jpayne@68 1000 #endif
jpayne@68 1001 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX > 0x030600B4 && PY_VERSION_HEX < 0x030d0000 && CYTHON_USE_UNICODE_INTERNALS
jpayne@68 1002 #define __Pyx_PyDict_GetItemStrWithError(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
jpayne@68 1003 static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStr(PyObject *dict, PyObject *name) {
jpayne@68 1004 PyObject *res = __Pyx_PyDict_GetItemStrWithError(dict, name);
jpayne@68 1005 if (res == NULL) PyErr_Clear();
jpayne@68 1006 return res;
jpayne@68 1007 }
jpayne@68 1008 #elif PY_MAJOR_VERSION >= 3 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000)
jpayne@68 1009 #define __Pyx_PyDict_GetItemStrWithError PyDict_GetItemWithError
jpayne@68 1010 #define __Pyx_PyDict_GetItemStr PyDict_GetItem
jpayne@68 1011 #else
jpayne@68 1012 static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, PyObject *name) {
jpayne@68 1013 #if CYTHON_COMPILING_IN_PYPY
jpayne@68 1014 return PyDict_GetItem(dict, name);
jpayne@68 1015 #else
jpayne@68 1016 PyDictEntry *ep;
jpayne@68 1017 PyDictObject *mp = (PyDictObject*) dict;
jpayne@68 1018 long hash = ((PyStringObject *) name)->ob_shash;
jpayne@68 1019 assert(hash != -1);
jpayne@68 1020 ep = (mp->ma_lookup)(mp, name, hash);
jpayne@68 1021 if (ep == NULL) {
jpayne@68 1022 return NULL;
jpayne@68 1023 }
jpayne@68 1024 return ep->me_value;
jpayne@68 1025 #endif
jpayne@68 1026 }
jpayne@68 1027 #define __Pyx_PyDict_GetItemStr PyDict_GetItem
jpayne@68 1028 #endif
jpayne@68 1029 #if CYTHON_USE_TYPE_SLOTS
jpayne@68 1030 #define __Pyx_PyType_GetFlags(tp) (((PyTypeObject *)tp)->tp_flags)
jpayne@68 1031 #define __Pyx_PyType_HasFeature(type, feature) ((__Pyx_PyType_GetFlags(type) & (feature)) != 0)
jpayne@68 1032 #define __Pyx_PyObject_GetIterNextFunc(obj) (Py_TYPE(obj)->tp_iternext)
jpayne@68 1033 #else
jpayne@68 1034 #define __Pyx_PyType_GetFlags(tp) (PyType_GetFlags((PyTypeObject *)tp))
jpayne@68 1035 #define __Pyx_PyType_HasFeature(type, feature) PyType_HasFeature(type, feature)
jpayne@68 1036 #define __Pyx_PyObject_GetIterNextFunc(obj) PyIter_Next
jpayne@68 1037 #endif
jpayne@68 1038 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 1039 #define __Pyx_SetItemOnTypeDict(tp, k, v) PyObject_GenericSetAttr((PyObject*)tp, k, v)
jpayne@68 1040 #else
jpayne@68 1041 #define __Pyx_SetItemOnTypeDict(tp, k, v) PyDict_SetItem(tp->tp_dict, k, v)
jpayne@68 1042 #endif
jpayne@68 1043 #if CYTHON_USE_TYPE_SPECS && PY_VERSION_HEX >= 0x03080000
jpayne@68 1044 #define __Pyx_PyHeapTypeObject_GC_Del(obj) {\
jpayne@68 1045 PyTypeObject *type = Py_TYPE((PyObject*)obj);\
jpayne@68 1046 assert(__Pyx_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE));\
jpayne@68 1047 PyObject_GC_Del(obj);\
jpayne@68 1048 Py_DECREF(type);\
jpayne@68 1049 }
jpayne@68 1050 #else
jpayne@68 1051 #define __Pyx_PyHeapTypeObject_GC_Del(obj) PyObject_GC_Del(obj)
jpayne@68 1052 #endif
jpayne@68 1053 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 1054 #define CYTHON_PEP393_ENABLED 1
jpayne@68 1055 #define __Pyx_PyUnicode_READY(op) (0)
jpayne@68 1056 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GetLength(u)
jpayne@68 1057 #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_ReadChar(u, i)
jpayne@68 1058 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((void)u, 1114111U)
jpayne@68 1059 #define __Pyx_PyUnicode_KIND(u) ((void)u, (0))
jpayne@68 1060 #define __Pyx_PyUnicode_DATA(u) ((void*)u)
jpayne@68 1061 #define __Pyx_PyUnicode_READ(k, d, i) ((void)k, PyUnicode_ReadChar((PyObject*)(d), i))
jpayne@68 1062 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GetLength(u))
jpayne@68 1063 #elif PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
jpayne@68 1064 #define CYTHON_PEP393_ENABLED 1
jpayne@68 1065 #if PY_VERSION_HEX >= 0x030C0000
jpayne@68 1066 #define __Pyx_PyUnicode_READY(op) (0)
jpayne@68 1067 #else
jpayne@68 1068 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
jpayne@68 1069 0 : _PyUnicode_Ready((PyObject *)(op)))
jpayne@68 1070 #endif
jpayne@68 1071 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
jpayne@68 1072 #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
jpayne@68 1073 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
jpayne@68 1074 #define __Pyx_PyUnicode_KIND(u) ((int)PyUnicode_KIND(u))
jpayne@68 1075 #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
jpayne@68 1076 #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
jpayne@68 1077 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, (Py_UCS4) ch)
jpayne@68 1078 #if PY_VERSION_HEX >= 0x030C0000
jpayne@68 1079 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u))
jpayne@68 1080 #else
jpayne@68 1081 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000
jpayne@68 1082 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length))
jpayne@68 1083 #else
jpayne@68 1084 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
jpayne@68 1085 #endif
jpayne@68 1086 #endif
jpayne@68 1087 #else
jpayne@68 1088 #define CYTHON_PEP393_ENABLED 0
jpayne@68 1089 #define PyUnicode_1BYTE_KIND 1
jpayne@68 1090 #define PyUnicode_2BYTE_KIND 2
jpayne@68 1091 #define PyUnicode_4BYTE_KIND 4
jpayne@68 1092 #define __Pyx_PyUnicode_READY(op) (0)
jpayne@68 1093 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
jpayne@68 1094 #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
jpayne@68 1095 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535U : 1114111U)
jpayne@68 1096 #define __Pyx_PyUnicode_KIND(u) ((int)sizeof(Py_UNICODE))
jpayne@68 1097 #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
jpayne@68 1098 #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
jpayne@68 1099 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = (Py_UNICODE) ch)
jpayne@68 1100 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
jpayne@68 1101 #endif
jpayne@68 1102 #if CYTHON_COMPILING_IN_PYPY
jpayne@68 1103 #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
jpayne@68 1104 #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
jpayne@68 1105 #else
jpayne@68 1106 #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
jpayne@68 1107 #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
jpayne@68 1108 PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
jpayne@68 1109 #endif
jpayne@68 1110 #if CYTHON_COMPILING_IN_PYPY
jpayne@68 1111 #if !defined(PyUnicode_DecodeUnicodeEscape)
jpayne@68 1112 #define PyUnicode_DecodeUnicodeEscape(s, size, errors) PyUnicode_Decode(s, size, "unicode_escape", errors)
jpayne@68 1113 #endif
jpayne@68 1114 #if !defined(PyUnicode_Contains) || (PY_MAJOR_VERSION == 2 && PYPY_VERSION_NUM < 0x07030500)
jpayne@68 1115 #undef PyUnicode_Contains
jpayne@68 1116 #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
jpayne@68 1117 #endif
jpayne@68 1118 #if !defined(PyByteArray_Check)
jpayne@68 1119 #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
jpayne@68 1120 #endif
jpayne@68 1121 #if !defined(PyObject_Format)
jpayne@68 1122 #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
jpayne@68 1123 #endif
jpayne@68 1124 #endif
jpayne@68 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@68 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@68 1127 #if PY_MAJOR_VERSION >= 3
jpayne@68 1128 #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
jpayne@68 1129 #else
jpayne@68 1130 #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
jpayne@68 1131 #endif
jpayne@68 1132 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
jpayne@68 1133 #define PyObject_ASCII(o) PyObject_Repr(o)
jpayne@68 1134 #endif
jpayne@68 1135 #if PY_MAJOR_VERSION >= 3
jpayne@68 1136 #define PyBaseString_Type PyUnicode_Type
jpayne@68 1137 #define PyStringObject PyUnicodeObject
jpayne@68 1138 #define PyString_Type PyUnicode_Type
jpayne@68 1139 #define PyString_Check PyUnicode_Check
jpayne@68 1140 #define PyString_CheckExact PyUnicode_CheckExact
jpayne@68 1141 #ifndef PyObject_Unicode
jpayne@68 1142 #define PyObject_Unicode PyObject_Str
jpayne@68 1143 #endif
jpayne@68 1144 #endif
jpayne@68 1145 #if PY_MAJOR_VERSION >= 3
jpayne@68 1146 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
jpayne@68 1147 #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
jpayne@68 1148 #else
jpayne@68 1149 #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
jpayne@68 1150 #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
jpayne@68 1151 #endif
jpayne@68 1152 #if CYTHON_COMPILING_IN_CPYTHON
jpayne@68 1153 #define __Pyx_PySequence_ListKeepNew(obj)\
jpayne@68 1154 (likely(PyList_CheckExact(obj) && Py_REFCNT(obj) == 1) ? __Pyx_NewRef(obj) : PySequence_List(obj))
jpayne@68 1155 #else
jpayne@68 1156 #define __Pyx_PySequence_ListKeepNew(obj) PySequence_List(obj)
jpayne@68 1157 #endif
jpayne@68 1158 #ifndef PySet_CheckExact
jpayne@68 1159 #define PySet_CheckExact(obj) __Pyx_IS_TYPE(obj, &PySet_Type)
jpayne@68 1160 #endif
jpayne@68 1161 #if PY_VERSION_HEX >= 0x030900A4
jpayne@68 1162 #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
jpayne@68 1163 #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
jpayne@68 1164 #else
jpayne@68 1165 #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
jpayne@68 1166 #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
jpayne@68 1167 #endif
jpayne@68 1168 #if CYTHON_ASSUME_SAFE_MACROS
jpayne@68 1169 #define __Pyx_PySequence_ITEM(o, i) PySequence_ITEM(o, i)
jpayne@68 1170 #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
jpayne@68 1171 #define __Pyx_PyTuple_SET_ITEM(o, i, v) (PyTuple_SET_ITEM(o, i, v), (0))
jpayne@68 1172 #define __Pyx_PyList_SET_ITEM(o, i, v) (PyList_SET_ITEM(o, i, v), (0))
jpayne@68 1173 #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_GET_SIZE(o)
jpayne@68 1174 #define __Pyx_PyList_GET_SIZE(o) PyList_GET_SIZE(o)
jpayne@68 1175 #define __Pyx_PySet_GET_SIZE(o) PySet_GET_SIZE(o)
jpayne@68 1176 #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_GET_SIZE(o)
jpayne@68 1177 #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_GET_SIZE(o)
jpayne@68 1178 #else
jpayne@68 1179 #define __Pyx_PySequence_ITEM(o, i) PySequence_GetItem(o, i)
jpayne@68 1180 #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
jpayne@68 1181 #define __Pyx_PyTuple_SET_ITEM(o, i, v) PyTuple_SetItem(o, i, v)
jpayne@68 1182 #define __Pyx_PyList_SET_ITEM(o, i, v) PyList_SetItem(o, i, v)
jpayne@68 1183 #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_Size(o)
jpayne@68 1184 #define __Pyx_PyList_GET_SIZE(o) PyList_Size(o)
jpayne@68 1185 #define __Pyx_PySet_GET_SIZE(o) PySet_Size(o)
jpayne@68 1186 #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_Size(o)
jpayne@68 1187 #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_Size(o)
jpayne@68 1188 #endif
jpayne@68 1189 #if __PYX_LIMITED_VERSION_HEX >= 0x030d00A1
jpayne@68 1190 #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name)
jpayne@68 1191 #else
jpayne@68 1192 static CYTHON_INLINE PyObject *__Pyx_PyImport_AddModuleRef(const char *name) {
jpayne@68 1193 PyObject *module = PyImport_AddModule(name);
jpayne@68 1194 Py_XINCREF(module);
jpayne@68 1195 return module;
jpayne@68 1196 }
jpayne@68 1197 #endif
jpayne@68 1198 #if PY_MAJOR_VERSION >= 3
jpayne@68 1199 #define PyIntObject PyLongObject
jpayne@68 1200 #define PyInt_Type PyLong_Type
jpayne@68 1201 #define PyInt_Check(op) PyLong_Check(op)
jpayne@68 1202 #define PyInt_CheckExact(op) PyLong_CheckExact(op)
jpayne@68 1203 #define __Pyx_Py3Int_Check(op) PyLong_Check(op)
jpayne@68 1204 #define __Pyx_Py3Int_CheckExact(op) PyLong_CheckExact(op)
jpayne@68 1205 #define PyInt_FromString PyLong_FromString
jpayne@68 1206 #define PyInt_FromUnicode PyLong_FromUnicode
jpayne@68 1207 #define PyInt_FromLong PyLong_FromLong
jpayne@68 1208 #define PyInt_FromSize_t PyLong_FromSize_t
jpayne@68 1209 #define PyInt_FromSsize_t PyLong_FromSsize_t
jpayne@68 1210 #define PyInt_AsLong PyLong_AsLong
jpayne@68 1211 #define PyInt_AS_LONG PyLong_AS_LONG
jpayne@68 1212 #define PyInt_AsSsize_t PyLong_AsSsize_t
jpayne@68 1213 #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
jpayne@68 1214 #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
jpayne@68 1215 #define PyNumber_Int PyNumber_Long
jpayne@68 1216 #else
jpayne@68 1217 #define __Pyx_Py3Int_Check(op) (PyLong_Check(op) || PyInt_Check(op))
jpayne@68 1218 #define __Pyx_Py3Int_CheckExact(op) (PyLong_CheckExact(op) || PyInt_CheckExact(op))
jpayne@68 1219 #endif
jpayne@68 1220 #if PY_MAJOR_VERSION >= 3
jpayne@68 1221 #define PyBoolObject PyLongObject
jpayne@68 1222 #endif
jpayne@68 1223 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
jpayne@68 1224 #ifndef PyUnicode_InternFromString
jpayne@68 1225 #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
jpayne@68 1226 #endif
jpayne@68 1227 #endif
jpayne@68 1228 #if PY_VERSION_HEX < 0x030200A4
jpayne@68 1229 typedef long Py_hash_t;
jpayne@68 1230 #define __Pyx_PyInt_FromHash_t PyInt_FromLong
jpayne@68 1231 #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsHash_t
jpayne@68 1232 #else
jpayne@68 1233 #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
jpayne@68 1234 #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t
jpayne@68 1235 #endif
jpayne@68 1236 #if CYTHON_USE_ASYNC_SLOTS
jpayne@68 1237 #if PY_VERSION_HEX >= 0x030500B1
jpayne@68 1238 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
jpayne@68 1239 #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
jpayne@68 1240 #else
jpayne@68 1241 #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
jpayne@68 1242 #endif
jpayne@68 1243 #else
jpayne@68 1244 #define __Pyx_PyType_AsAsync(obj) NULL
jpayne@68 1245 #endif
jpayne@68 1246 #ifndef __Pyx_PyAsyncMethodsStruct
jpayne@68 1247 typedef struct {
jpayne@68 1248 unaryfunc am_await;
jpayne@68 1249 unaryfunc am_aiter;
jpayne@68 1250 unaryfunc am_anext;
jpayne@68 1251 } __Pyx_PyAsyncMethodsStruct;
jpayne@68 1252 #endif
jpayne@68 1253
jpayne@68 1254 #if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)
jpayne@68 1255 #if !defined(_USE_MATH_DEFINES)
jpayne@68 1256 #define _USE_MATH_DEFINES
jpayne@68 1257 #endif
jpayne@68 1258 #endif
jpayne@68 1259 #include <math.h>
jpayne@68 1260 #ifdef NAN
jpayne@68 1261 #define __PYX_NAN() ((float) NAN)
jpayne@68 1262 #else
jpayne@68 1263 static CYTHON_INLINE float __PYX_NAN() {
jpayne@68 1264 float value;
jpayne@68 1265 memset(&value, 0xFF, sizeof(value));
jpayne@68 1266 return value;
jpayne@68 1267 }
jpayne@68 1268 #endif
jpayne@68 1269 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
jpayne@68 1270 #define __Pyx_truncl trunc
jpayne@68 1271 #else
jpayne@68 1272 #define __Pyx_truncl truncl
jpayne@68 1273 #endif
jpayne@68 1274
jpayne@68 1275 #define __PYX_MARK_ERR_POS(f_index, lineno) \
jpayne@68 1276 { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
jpayne@68 1277 #define __PYX_ERR(f_index, lineno, Ln_error) \
jpayne@68 1278 { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }
jpayne@68 1279
jpayne@68 1280 #ifdef CYTHON_EXTERN_C
jpayne@68 1281 #undef __PYX_EXTERN_C
jpayne@68 1282 #define __PYX_EXTERN_C CYTHON_EXTERN_C
jpayne@68 1283 #elif defined(__PYX_EXTERN_C)
jpayne@68 1284 #ifdef _MSC_VER
jpayne@68 1285 #pragma message ("Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.")
jpayne@68 1286 #else
jpayne@68 1287 #warning Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.
jpayne@68 1288 #endif
jpayne@68 1289 #else
jpayne@68 1290 #ifdef __cplusplus
jpayne@68 1291 #define __PYX_EXTERN_C extern "C"
jpayne@68 1292 #else
jpayne@68 1293 #define __PYX_EXTERN_C extern
jpayne@68 1294 #endif
jpayne@68 1295 #endif
jpayne@68 1296
jpayne@68 1297 #define __PYX_HAVE__pysam__libcutils
jpayne@68 1298 #define __PYX_HAVE_API__pysam__libcutils
jpayne@68 1299 /* Early includes */
jpayne@68 1300 #include <string.h>
jpayne@68 1301 #include <stdio.h>
jpayne@68 1302 #include <stddef.h>
jpayne@68 1303 #include "pythread.h"
jpayne@68 1304
jpayne@68 1305 #if CYTHON_COMPILING_IN_PYPY
jpayne@68 1306 #ifdef _MSC_VER
jpayne@68 1307 #pragma message ("This module uses CPython specific internals of 'array.array', which are not available in PyPy.")
jpayne@68 1308 #else
jpayne@68 1309 #warning This module uses CPython specific internals of 'array.array', which are not available in PyPy.
jpayne@68 1310 #endif
jpayne@68 1311 #endif
jpayne@68 1312
jpayne@68 1313 #include <errno.h>
jpayne@68 1314 #include <stdlib.h>
jpayne@68 1315 #include <stdint.h>
jpayne@68 1316 #include <sys/types.h>
jpayne@68 1317 #include <fcntl.h>
jpayne@68 1318 #include <unistd.h>
jpayne@68 1319 #include "samtools.pysam.h"
jpayne@68 1320 #include "bcftools.pysam.h"
jpayne@68 1321 #ifdef _OPENMP
jpayne@68 1322 #include <omp.h>
jpayne@68 1323 #endif /* _OPENMP */
jpayne@68 1324
jpayne@68 1325 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
jpayne@68 1326 #define CYTHON_WITHOUT_ASSERTIONS
jpayne@68 1327 #endif
jpayne@68 1328
jpayne@68 1329 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
jpayne@68 1330 const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
jpayne@68 1331
jpayne@68 1332 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
jpayne@68 1333 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
jpayne@68 1334 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
jpayne@68 1335 #define __PYX_DEFAULT_STRING_ENCODING ""
jpayne@68 1336 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
jpayne@68 1337 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
jpayne@68 1338 #define __Pyx_uchar_cast(c) ((unsigned char)c)
jpayne@68 1339 #define __Pyx_long_cast(x) ((long)x)
jpayne@68 1340 #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
jpayne@68 1341 (sizeof(type) < sizeof(Py_ssize_t)) ||\
jpayne@68 1342 (sizeof(type) > sizeof(Py_ssize_t) &&\
jpayne@68 1343 likely(v < (type)PY_SSIZE_T_MAX ||\
jpayne@68 1344 v == (type)PY_SSIZE_T_MAX) &&\
jpayne@68 1345 (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
jpayne@68 1346 v == (type)PY_SSIZE_T_MIN))) ||\
jpayne@68 1347 (sizeof(type) == sizeof(Py_ssize_t) &&\
jpayne@68 1348 (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
jpayne@68 1349 v == (type)PY_SSIZE_T_MAX))) )
jpayne@68 1350 static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
jpayne@68 1351 return (size_t) i < (size_t) limit;
jpayne@68 1352 }
jpayne@68 1353 #if defined (__cplusplus) && __cplusplus >= 201103L
jpayne@68 1354 #include <cstdlib>
jpayne@68 1355 #define __Pyx_sst_abs(value) std::abs(value)
jpayne@68 1356 #elif SIZEOF_INT >= SIZEOF_SIZE_T
jpayne@68 1357 #define __Pyx_sst_abs(value) abs(value)
jpayne@68 1358 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
jpayne@68 1359 #define __Pyx_sst_abs(value) labs(value)
jpayne@68 1360 #elif defined (_MSC_VER)
jpayne@68 1361 #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
jpayne@68 1362 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
jpayne@68 1363 #define __Pyx_sst_abs(value) llabs(value)
jpayne@68 1364 #elif defined (__GNUC__)
jpayne@68 1365 #define __Pyx_sst_abs(value) __builtin_llabs(value)
jpayne@68 1366 #else
jpayne@68 1367 #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
jpayne@68 1368 #endif
jpayne@68 1369 static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s);
jpayne@68 1370 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
jpayne@68 1371 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
jpayne@68 1372 static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char*);
jpayne@68 1373 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
jpayne@68 1374 #define __Pyx_PyBytes_FromString PyBytes_FromString
jpayne@68 1375 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
jpayne@68 1376 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
jpayne@68 1377 #if PY_MAJOR_VERSION < 3
jpayne@68 1378 #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
jpayne@68 1379 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
jpayne@68 1380 #else
jpayne@68 1381 #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
jpayne@68 1382 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
jpayne@68 1383 #endif
jpayne@68 1384 #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
jpayne@68 1385 #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
jpayne@68 1386 #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
jpayne@68 1387 #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
jpayne@68 1388 #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
jpayne@68 1389 #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
jpayne@68 1390 #define __Pyx_PyObject_AsWritableString(s) ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
jpayne@68 1391 #define __Pyx_PyObject_AsWritableSString(s) ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
jpayne@68 1392 #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
jpayne@68 1393 #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
jpayne@68 1394 #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
jpayne@68 1395 #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
jpayne@68 1396 #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
jpayne@68 1397 #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
jpayne@68 1398 #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
jpayne@68 1399 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
jpayne@68 1400 #define __Pyx_PyUnicode_FromOrdinal(o) PyUnicode_FromOrdinal((int)o)
jpayne@68 1401 #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
jpayne@68 1402 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
jpayne@68 1403 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
jpayne@68 1404 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
jpayne@68 1405 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
jpayne@68 1406 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
jpayne@68 1407 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
jpayne@68 1408 #define __Pyx_PySequence_Tuple(obj)\
jpayne@68 1409 (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
jpayne@68 1410 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
jpayne@68 1411 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
jpayne@68 1412 static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*);
jpayne@68 1413 #if CYTHON_ASSUME_SAFE_MACROS
jpayne@68 1414 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
jpayne@68 1415 #else
jpayne@68 1416 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
jpayne@68 1417 #endif
jpayne@68 1418 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
jpayne@68 1419 #if PY_MAJOR_VERSION >= 3
jpayne@68 1420 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
jpayne@68 1421 #else
jpayne@68 1422 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
jpayne@68 1423 #endif
jpayne@68 1424 #if CYTHON_USE_PYLONG_INTERNALS
jpayne@68 1425 #if PY_VERSION_HEX >= 0x030C00A7
jpayne@68 1426 #ifndef _PyLong_SIGN_MASK
jpayne@68 1427 #define _PyLong_SIGN_MASK 3
jpayne@68 1428 #endif
jpayne@68 1429 #ifndef _PyLong_NON_SIZE_BITS
jpayne@68 1430 #define _PyLong_NON_SIZE_BITS 3
jpayne@68 1431 #endif
jpayne@68 1432 #define __Pyx_PyLong_Sign(x) (((PyLongObject*)x)->long_value.lv_tag & _PyLong_SIGN_MASK)
jpayne@68 1433 #define __Pyx_PyLong_IsNeg(x) ((__Pyx_PyLong_Sign(x) & 2) != 0)
jpayne@68 1434 #define __Pyx_PyLong_IsNonNeg(x) (!__Pyx_PyLong_IsNeg(x))
jpayne@68 1435 #define __Pyx_PyLong_IsZero(x) (__Pyx_PyLong_Sign(x) & 1)
jpayne@68 1436 #define __Pyx_PyLong_IsPos(x) (__Pyx_PyLong_Sign(x) == 0)
jpayne@68 1437 #define __Pyx_PyLong_CompactValueUnsigned(x) (__Pyx_PyLong_Digits(x)[0])
jpayne@68 1438 #define __Pyx_PyLong_DigitCount(x) ((Py_ssize_t) (((PyLongObject*)x)->long_value.lv_tag >> _PyLong_NON_SIZE_BITS))
jpayne@68 1439 #define __Pyx_PyLong_SignedDigitCount(x)\
jpayne@68 1440 ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * __Pyx_PyLong_DigitCount(x))
jpayne@68 1441 #if defined(PyUnstable_Long_IsCompact) && defined(PyUnstable_Long_CompactValue)
jpayne@68 1442 #define __Pyx_PyLong_IsCompact(x) PyUnstable_Long_IsCompact((PyLongObject*) x)
jpayne@68 1443 #define __Pyx_PyLong_CompactValue(x) PyUnstable_Long_CompactValue((PyLongObject*) x)
jpayne@68 1444 #else
jpayne@68 1445 #define __Pyx_PyLong_IsCompact(x) (((PyLongObject*)x)->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS))
jpayne@68 1446 #define __Pyx_PyLong_CompactValue(x) ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0])
jpayne@68 1447 #endif
jpayne@68 1448 typedef Py_ssize_t __Pyx_compact_pylong;
jpayne@68 1449 typedef size_t __Pyx_compact_upylong;
jpayne@68 1450 #else
jpayne@68 1451 #define __Pyx_PyLong_IsNeg(x) (Py_SIZE(x) < 0)
jpayne@68 1452 #define __Pyx_PyLong_IsNonNeg(x) (Py_SIZE(x) >= 0)
jpayne@68 1453 #define __Pyx_PyLong_IsZero(x) (Py_SIZE(x) == 0)
jpayne@68 1454 #define __Pyx_PyLong_IsPos(x) (Py_SIZE(x) > 0)
jpayne@68 1455 #define __Pyx_PyLong_CompactValueUnsigned(x) ((Py_SIZE(x) == 0) ? 0 : __Pyx_PyLong_Digits(x)[0])
jpayne@68 1456 #define __Pyx_PyLong_DigitCount(x) __Pyx_sst_abs(Py_SIZE(x))
jpayne@68 1457 #define __Pyx_PyLong_SignedDigitCount(x) Py_SIZE(x)
jpayne@68 1458 #define __Pyx_PyLong_IsCompact(x) (Py_SIZE(x) == 0 || Py_SIZE(x) == 1 || Py_SIZE(x) == -1)
jpayne@68 1459 #define __Pyx_PyLong_CompactValue(x)\
jpayne@68 1460 ((Py_SIZE(x) == 0) ? (sdigit) 0 : ((Py_SIZE(x) < 0) ? -(sdigit)__Pyx_PyLong_Digits(x)[0] : (sdigit)__Pyx_PyLong_Digits(x)[0]))
jpayne@68 1461 typedef sdigit __Pyx_compact_pylong;
jpayne@68 1462 typedef digit __Pyx_compact_upylong;
jpayne@68 1463 #endif
jpayne@68 1464 #if PY_VERSION_HEX >= 0x030C00A5
jpayne@68 1465 #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->long_value.ob_digit)
jpayne@68 1466 #else
jpayne@68 1467 #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->ob_digit)
jpayne@68 1468 #endif
jpayne@68 1469 #endif
jpayne@68 1470 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
jpayne@68 1471 #include <string.h>
jpayne@68 1472 static int __Pyx_sys_getdefaultencoding_not_ascii;
jpayne@68 1473 static int __Pyx_init_sys_getdefaultencoding_params(void) {
jpayne@68 1474 PyObject* sys;
jpayne@68 1475 PyObject* default_encoding = NULL;
jpayne@68 1476 PyObject* ascii_chars_u = NULL;
jpayne@68 1477 PyObject* ascii_chars_b = NULL;
jpayne@68 1478 const char* default_encoding_c;
jpayne@68 1479 sys = PyImport_ImportModule("sys");
jpayne@68 1480 if (!sys) goto bad;
jpayne@68 1481 default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
jpayne@68 1482 Py_DECREF(sys);
jpayne@68 1483 if (!default_encoding) goto bad;
jpayne@68 1484 default_encoding_c = PyBytes_AsString(default_encoding);
jpayne@68 1485 if (!default_encoding_c) goto bad;
jpayne@68 1486 if (strcmp(default_encoding_c, "ascii") == 0) {
jpayne@68 1487 __Pyx_sys_getdefaultencoding_not_ascii = 0;
jpayne@68 1488 } else {
jpayne@68 1489 char ascii_chars[128];
jpayne@68 1490 int c;
jpayne@68 1491 for (c = 0; c < 128; c++) {
jpayne@68 1492 ascii_chars[c] = (char) c;
jpayne@68 1493 }
jpayne@68 1494 __Pyx_sys_getdefaultencoding_not_ascii = 1;
jpayne@68 1495 ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
jpayne@68 1496 if (!ascii_chars_u) goto bad;
jpayne@68 1497 ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
jpayne@68 1498 if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
jpayne@68 1499 PyErr_Format(
jpayne@68 1500 PyExc_ValueError,
jpayne@68 1501 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
jpayne@68 1502 default_encoding_c);
jpayne@68 1503 goto bad;
jpayne@68 1504 }
jpayne@68 1505 Py_DECREF(ascii_chars_u);
jpayne@68 1506 Py_DECREF(ascii_chars_b);
jpayne@68 1507 }
jpayne@68 1508 Py_DECREF(default_encoding);
jpayne@68 1509 return 0;
jpayne@68 1510 bad:
jpayne@68 1511 Py_XDECREF(default_encoding);
jpayne@68 1512 Py_XDECREF(ascii_chars_u);
jpayne@68 1513 Py_XDECREF(ascii_chars_b);
jpayne@68 1514 return -1;
jpayne@68 1515 }
jpayne@68 1516 #endif
jpayne@68 1517 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
jpayne@68 1518 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
jpayne@68 1519 #else
jpayne@68 1520 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
jpayne@68 1521 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
jpayne@68 1522 #include <string.h>
jpayne@68 1523 static char* __PYX_DEFAULT_STRING_ENCODING;
jpayne@68 1524 static int __Pyx_init_sys_getdefaultencoding_params(void) {
jpayne@68 1525 PyObject* sys;
jpayne@68 1526 PyObject* default_encoding = NULL;
jpayne@68 1527 char* default_encoding_c;
jpayne@68 1528 sys = PyImport_ImportModule("sys");
jpayne@68 1529 if (!sys) goto bad;
jpayne@68 1530 default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
jpayne@68 1531 Py_DECREF(sys);
jpayne@68 1532 if (!default_encoding) goto bad;
jpayne@68 1533 default_encoding_c = PyBytes_AsString(default_encoding);
jpayne@68 1534 if (!default_encoding_c) goto bad;
jpayne@68 1535 __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
jpayne@68 1536 if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
jpayne@68 1537 strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
jpayne@68 1538 Py_DECREF(default_encoding);
jpayne@68 1539 return 0;
jpayne@68 1540 bad:
jpayne@68 1541 Py_XDECREF(default_encoding);
jpayne@68 1542 return -1;
jpayne@68 1543 }
jpayne@68 1544 #endif
jpayne@68 1545 #endif
jpayne@68 1546
jpayne@68 1547
jpayne@68 1548 /* Test for GCC > 2.95 */
jpayne@68 1549 #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
jpayne@68 1550 #define likely(x) __builtin_expect(!!(x), 1)
jpayne@68 1551 #define unlikely(x) __builtin_expect(!!(x), 0)
jpayne@68 1552 #else /* !__GNUC__ or GCC < 2.95 */
jpayne@68 1553 #define likely(x) (x)
jpayne@68 1554 #define unlikely(x) (x)
jpayne@68 1555 #endif /* __GNUC__ */
jpayne@68 1556 static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
jpayne@68 1557
jpayne@68 1558 #if !CYTHON_USE_MODULE_STATE
jpayne@68 1559 static PyObject *__pyx_m = NULL;
jpayne@68 1560 #endif
jpayne@68 1561 static int __pyx_lineno;
jpayne@68 1562 static int __pyx_clineno = 0;
jpayne@68 1563 static const char * __pyx_cfilenm = __FILE__;
jpayne@68 1564 static const char *__pyx_filename;
jpayne@68 1565
jpayne@68 1566 /* #### Code section: filename_table ### */
jpayne@68 1567
jpayne@68 1568 static const char *__pyx_f[] = {
jpayne@68 1569 "pysam/libcutils.pyx",
jpayne@68 1570 "contextvars.pxd",
jpayne@68 1571 "array.pxd",
jpayne@68 1572 "type.pxd",
jpayne@68 1573 "bool.pxd",
jpayne@68 1574 "complex.pxd",
jpayne@68 1575 };
jpayne@68 1576 /* #### Code section: utility_code_proto_before_types ### */
jpayne@68 1577 /* ForceInitThreads.proto */
jpayne@68 1578 #ifndef __PYX_FORCE_INIT_THREADS
jpayne@68 1579 #define __PYX_FORCE_INIT_THREADS 0
jpayne@68 1580 #endif
jpayne@68 1581
jpayne@68 1582 /* #### Code section: numeric_typedefs ### */
jpayne@68 1583 /* #### Code section: complex_type_declarations ### */
jpayne@68 1584 /* #### Code section: type_declarations ### */
jpayne@68 1585
jpayne@68 1586 /*--- Type declarations ---*/
jpayne@68 1587 #ifndef _ARRAYARRAY_H
jpayne@68 1588 struct arrayobject;
jpayne@68 1589 typedef struct arrayobject arrayobject;
jpayne@68 1590 #endif
jpayne@68 1591 struct __pyx_opt_args_7cpython_11contextvars_get_value;
jpayne@68 1592 struct __pyx_opt_args_7cpython_11contextvars_get_value_no_default;
jpayne@68 1593
jpayne@68 1594 /* "cpython/contextvars.pxd":112
jpayne@68 1595 *
jpayne@68 1596 *
jpayne@68 1597 * cdef inline object get_value(var, default_value=None): # <<<<<<<<<<<<<<
jpayne@68 1598 * """Return a new reference to the value of the context variable,
jpayne@68 1599 * or the default value of the context variable,
jpayne@68 1600 */
jpayne@68 1601 struct __pyx_opt_args_7cpython_11contextvars_get_value {
jpayne@68 1602 int __pyx_n;
jpayne@68 1603 PyObject *default_value;
jpayne@68 1604 };
jpayne@68 1605
jpayne@68 1606 /* "cpython/contextvars.pxd":129
jpayne@68 1607 *
jpayne@68 1608 *
jpayne@68 1609 * cdef inline object get_value_no_default(var, default_value=None): # <<<<<<<<<<<<<<
jpayne@68 1610 * """Return a new reference to the value of the context variable,
jpayne@68 1611 * or the provided default value if no such value was found.
jpayne@68 1612 */
jpayne@68 1613 struct __pyx_opt_args_7cpython_11contextvars_get_value_no_default {
jpayne@68 1614 int __pyx_n;
jpayne@68 1615 PyObject *default_value;
jpayne@68 1616 };
jpayne@68 1617 struct __pyx_opt_args_5pysam_9libcutils_parse_region;
jpayne@68 1618 struct __pyx_opt_args_5pysam_9libcutils_qualitystring_to_array;
jpayne@68 1619 struct __pyx_opt_args_5pysam_9libcutils_array_to_qualitystring;
jpayne@68 1620 struct __pyx_opt_args_5pysam_9libcutils_qualities_to_qualitystring;
jpayne@68 1621 struct __pyx_opt_args_5pysam_9libcutils_charptr_to_str;
jpayne@68 1622 struct __pyx_opt_args_5pysam_9libcutils_charptr_to_bytes;
jpayne@68 1623 struct __pyx_opt_args_5pysam_9libcutils_charptr_to_str_w_len;
jpayne@68 1624 struct __pyx_opt_args_5pysam_9libcutils_force_str;
jpayne@68 1625 struct __pyx_opt_args_5pysam_9libcutils_force_bytes;
jpayne@68 1626 struct __pyx_opt_args_5pysam_9libcutils_decode_bytes;
jpayne@68 1627
jpayne@68 1628 /* "pysam/libcutils.pxd":8
jpayne@68 1629 * from cpython cimport array as c_array
jpayne@68 1630 *
jpayne@68 1631 * cpdef parse_region(contig=*, start=*, stop=*, region=*, reference=*, end=*) # <<<<<<<<<<<<<<
jpayne@68 1632 *
jpayne@68 1633 * cdef int libc_whence_from_io(int whence)
jpayne@68 1634 */
jpayne@68 1635 struct __pyx_opt_args_5pysam_9libcutils_parse_region {
jpayne@68 1636 int __pyx_n;
jpayne@68 1637 PyObject *contig;
jpayne@68 1638 PyObject *start;
jpayne@68 1639 PyObject *stop;
jpayne@68 1640 PyObject *region;
jpayne@68 1641 PyObject *reference;
jpayne@68 1642 PyObject *end;
jpayne@68 1643 };
jpayne@68 1644
jpayne@68 1645 /* "pysam/libcutils.pxd":15
jpayne@68 1646 * # Utility functions for quality string conversions
jpayne@68 1647 *
jpayne@68 1648 * cpdef c_array.array qualitystring_to_array(input_str, int offset=*) # <<<<<<<<<<<<<<
jpayne@68 1649 * cpdef array_to_qualitystring(c_array.array arr, int offset=*)
jpayne@68 1650 * cpdef qualities_to_qualitystring(qualities, int offset=*)
jpayne@68 1651 */
jpayne@68 1652 struct __pyx_opt_args_5pysam_9libcutils_qualitystring_to_array {
jpayne@68 1653 int __pyx_n;
jpayne@68 1654 int offset;
jpayne@68 1655 };
jpayne@68 1656
jpayne@68 1657 /* "pysam/libcutils.pxd":16
jpayne@68 1658 *
jpayne@68 1659 * cpdef c_array.array qualitystring_to_array(input_str, int offset=*)
jpayne@68 1660 * cpdef array_to_qualitystring(c_array.array arr, int offset=*) # <<<<<<<<<<<<<<
jpayne@68 1661 * cpdef qualities_to_qualitystring(qualities, int offset=*)
jpayne@68 1662 *
jpayne@68 1663 */
jpayne@68 1664 struct __pyx_opt_args_5pysam_9libcutils_array_to_qualitystring {
jpayne@68 1665 int __pyx_n;
jpayne@68 1666 int offset;
jpayne@68 1667 };
jpayne@68 1668
jpayne@68 1669 /* "pysam/libcutils.pxd":17
jpayne@68 1670 * cpdef c_array.array qualitystring_to_array(input_str, int offset=*)
jpayne@68 1671 * cpdef array_to_qualitystring(c_array.array arr, int offset=*)
jpayne@68 1672 * cpdef qualities_to_qualitystring(qualities, int offset=*) # <<<<<<<<<<<<<<
jpayne@68 1673 *
jpayne@68 1674 * ########################################################################
jpayne@68 1675 */
jpayne@68 1676 struct __pyx_opt_args_5pysam_9libcutils_qualities_to_qualitystring {
jpayne@68 1677 int __pyx_n;
jpayne@68 1678 int offset;
jpayne@68 1679 };
jpayne@68 1680
jpayne@68 1681 /* "pysam/libcutils.pxd":29
jpayne@68 1682 * ## Python 3 compatibility functions
jpayne@68 1683 * ########################################################################
jpayne@68 1684 * cdef charptr_to_str(const char *s, encoding=*, errors=*) # <<<<<<<<<<<<<<
jpayne@68 1685 * cdef bytes charptr_to_bytes(const char *s, encoding=*, errors=*)
jpayne@68 1686 * cdef charptr_to_str_w_len(const char* s, size_t n, encoding=*, errors=*)
jpayne@68 1687 */
jpayne@68 1688 struct __pyx_opt_args_5pysam_9libcutils_charptr_to_str {
jpayne@68 1689 int __pyx_n;
jpayne@68 1690 PyObject *encoding;
jpayne@68 1691 PyObject *errors;
jpayne@68 1692 };
jpayne@68 1693
jpayne@68 1694 /* "pysam/libcutils.pxd":30
jpayne@68 1695 * ########################################################################
jpayne@68 1696 * cdef charptr_to_str(const char *s, encoding=*, errors=*)
jpayne@68 1697 * cdef bytes charptr_to_bytes(const char *s, encoding=*, errors=*) # <<<<<<<<<<<<<<
jpayne@68 1698 * cdef charptr_to_str_w_len(const char* s, size_t n, encoding=*, errors=*)
jpayne@68 1699 * cdef force_str(object s, encoding=*, errors=*)
jpayne@68 1700 */
jpayne@68 1701 struct __pyx_opt_args_5pysam_9libcutils_charptr_to_bytes {
jpayne@68 1702 int __pyx_n;
jpayne@68 1703 PyObject *encoding;
jpayne@68 1704 PyObject *errors;
jpayne@68 1705 };
jpayne@68 1706
jpayne@68 1707 /* "pysam/libcutils.pxd":31
jpayne@68 1708 * cdef charptr_to_str(const char *s, encoding=*, errors=*)
jpayne@68 1709 * cdef bytes charptr_to_bytes(const char *s, encoding=*, errors=*)
jpayne@68 1710 * cdef charptr_to_str_w_len(const char* s, size_t n, encoding=*, errors=*) # <<<<<<<<<<<<<<
jpayne@68 1711 * cdef force_str(object s, encoding=*, errors=*)
jpayne@68 1712 * cdef bytes force_bytes(object s, encoding=*, errors=*)
jpayne@68 1713 */
jpayne@68 1714 struct __pyx_opt_args_5pysam_9libcutils_charptr_to_str_w_len {
jpayne@68 1715 int __pyx_n;
jpayne@68 1716 PyObject *encoding;
jpayne@68 1717 PyObject *errors;
jpayne@68 1718 };
jpayne@68 1719
jpayne@68 1720 /* "pysam/libcutils.pxd":32
jpayne@68 1721 * cdef bytes charptr_to_bytes(const char *s, encoding=*, errors=*)
jpayne@68 1722 * cdef charptr_to_str_w_len(const char* s, size_t n, encoding=*, errors=*)
jpayne@68 1723 * cdef force_str(object s, encoding=*, errors=*) # <<<<<<<<<<<<<<
jpayne@68 1724 * cdef bytes force_bytes(object s, encoding=*, errors=*)
jpayne@68 1725 * cdef decode_bytes(bytes s, encoding=*, errors=*)
jpayne@68 1726 */
jpayne@68 1727 struct __pyx_opt_args_5pysam_9libcutils_force_str {
jpayne@68 1728 int __pyx_n;
jpayne@68 1729 PyObject *encoding;
jpayne@68 1730 PyObject *errors;
jpayne@68 1731 };
jpayne@68 1732
jpayne@68 1733 /* "pysam/libcutils.pxd":33
jpayne@68 1734 * cdef charptr_to_str_w_len(const char* s, size_t n, encoding=*, errors=*)
jpayne@68 1735 * cdef force_str(object s, encoding=*, errors=*)
jpayne@68 1736 * cdef bytes force_bytes(object s, encoding=*, errors=*) # <<<<<<<<<<<<<<
jpayne@68 1737 * cdef decode_bytes(bytes s, encoding=*, errors=*)
jpayne@68 1738 * cdef bytes encode_filename(object filename)
jpayne@68 1739 */
jpayne@68 1740 struct __pyx_opt_args_5pysam_9libcutils_force_bytes {
jpayne@68 1741 int __pyx_n;
jpayne@68 1742 PyObject *encoding;
jpayne@68 1743 PyObject *errors;
jpayne@68 1744 };
jpayne@68 1745
jpayne@68 1746 /* "pysam/libcutils.pxd":34
jpayne@68 1747 * cdef force_str(object s, encoding=*, errors=*)
jpayne@68 1748 * cdef bytes force_bytes(object s, encoding=*, errors=*)
jpayne@68 1749 * cdef decode_bytes(bytes s, encoding=*, errors=*) # <<<<<<<<<<<<<<
jpayne@68 1750 * cdef bytes encode_filename(object filename)
jpayne@68 1751 * cdef from_string_and_size(const char *s, size_t length)
jpayne@68 1752 */
jpayne@68 1753 struct __pyx_opt_args_5pysam_9libcutils_decode_bytes {
jpayne@68 1754 int __pyx_n;
jpayne@68 1755 PyObject *encoding;
jpayne@68 1756 PyObject *errors;
jpayne@68 1757 };
jpayne@68 1758 /* #### Code section: utility_code_proto ### */
jpayne@68 1759
jpayne@68 1760 /* --- Runtime support code (head) --- */
jpayne@68 1761 /* Refnanny.proto */
jpayne@68 1762 #ifndef CYTHON_REFNANNY
jpayne@68 1763 #define CYTHON_REFNANNY 0
jpayne@68 1764 #endif
jpayne@68 1765 #if CYTHON_REFNANNY
jpayne@68 1766 typedef struct {
jpayne@68 1767 void (*INCREF)(void*, PyObject*, Py_ssize_t);
jpayne@68 1768 void (*DECREF)(void*, PyObject*, Py_ssize_t);
jpayne@68 1769 void (*GOTREF)(void*, PyObject*, Py_ssize_t);
jpayne@68 1770 void (*GIVEREF)(void*, PyObject*, Py_ssize_t);
jpayne@68 1771 void* (*SetupContext)(const char*, Py_ssize_t, const char*);
jpayne@68 1772 void (*FinishContext)(void**);
jpayne@68 1773 } __Pyx_RefNannyAPIStruct;
jpayne@68 1774 static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
jpayne@68 1775 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
jpayne@68 1776 #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
jpayne@68 1777 #ifdef WITH_THREAD
jpayne@68 1778 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
jpayne@68 1779 if (acquire_gil) {\
jpayne@68 1780 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
jpayne@68 1781 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\
jpayne@68 1782 PyGILState_Release(__pyx_gilstate_save);\
jpayne@68 1783 } else {\
jpayne@68 1784 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\
jpayne@68 1785 }
jpayne@68 1786 #define __Pyx_RefNannyFinishContextNogil() {\
jpayne@68 1787 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
jpayne@68 1788 __Pyx_RefNannyFinishContext();\
jpayne@68 1789 PyGILState_Release(__pyx_gilstate_save);\
jpayne@68 1790 }
jpayne@68 1791 #else
jpayne@68 1792 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
jpayne@68 1793 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__))
jpayne@68 1794 #define __Pyx_RefNannyFinishContextNogil() __Pyx_RefNannyFinishContext()
jpayne@68 1795 #endif
jpayne@68 1796 #define __Pyx_RefNannyFinishContextNogil() {\
jpayne@68 1797 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
jpayne@68 1798 __Pyx_RefNannyFinishContext();\
jpayne@68 1799 PyGILState_Release(__pyx_gilstate_save);\
jpayne@68 1800 }
jpayne@68 1801 #define __Pyx_RefNannyFinishContext()\
jpayne@68 1802 __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
jpayne@68 1803 #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
jpayne@68 1804 #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
jpayne@68 1805 #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
jpayne@68 1806 #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
jpayne@68 1807 #define __Pyx_XINCREF(r) do { if((r) == NULL); else {__Pyx_INCREF(r); }} while(0)
jpayne@68 1808 #define __Pyx_XDECREF(r) do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0)
jpayne@68 1809 #define __Pyx_XGOTREF(r) do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0)
jpayne@68 1810 #define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0)
jpayne@68 1811 #else
jpayne@68 1812 #define __Pyx_RefNannyDeclarations
jpayne@68 1813 #define __Pyx_RefNannySetupContext(name, acquire_gil)
jpayne@68 1814 #define __Pyx_RefNannyFinishContextNogil()
jpayne@68 1815 #define __Pyx_RefNannyFinishContext()
jpayne@68 1816 #define __Pyx_INCREF(r) Py_INCREF(r)
jpayne@68 1817 #define __Pyx_DECREF(r) Py_DECREF(r)
jpayne@68 1818 #define __Pyx_GOTREF(r)
jpayne@68 1819 #define __Pyx_GIVEREF(r)
jpayne@68 1820 #define __Pyx_XINCREF(r) Py_XINCREF(r)
jpayne@68 1821 #define __Pyx_XDECREF(r) Py_XDECREF(r)
jpayne@68 1822 #define __Pyx_XGOTREF(r)
jpayne@68 1823 #define __Pyx_XGIVEREF(r)
jpayne@68 1824 #endif
jpayne@68 1825 #define __Pyx_Py_XDECREF_SET(r, v) do {\
jpayne@68 1826 PyObject *tmp = (PyObject *) r;\
jpayne@68 1827 r = v; Py_XDECREF(tmp);\
jpayne@68 1828 } while (0)
jpayne@68 1829 #define __Pyx_XDECREF_SET(r, v) do {\
jpayne@68 1830 PyObject *tmp = (PyObject *) r;\
jpayne@68 1831 r = v; __Pyx_XDECREF(tmp);\
jpayne@68 1832 } while (0)
jpayne@68 1833 #define __Pyx_DECREF_SET(r, v) do {\
jpayne@68 1834 PyObject *tmp = (PyObject *) r;\
jpayne@68 1835 r = v; __Pyx_DECREF(tmp);\
jpayne@68 1836 } while (0)
jpayne@68 1837 #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
jpayne@68 1838 #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
jpayne@68 1839
jpayne@68 1840 /* PyErrExceptionMatches.proto */
jpayne@68 1841 #if CYTHON_FAST_THREAD_STATE
jpayne@68 1842 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
jpayne@68 1843 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
jpayne@68 1844 #else
jpayne@68 1845 #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
jpayne@68 1846 #endif
jpayne@68 1847
jpayne@68 1848 /* PyThreadStateGet.proto */
jpayne@68 1849 #if CYTHON_FAST_THREAD_STATE
jpayne@68 1850 #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
jpayne@68 1851 #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
jpayne@68 1852 #if PY_VERSION_HEX >= 0x030C00A6
jpayne@68 1853 #define __Pyx_PyErr_Occurred() (__pyx_tstate->current_exception != NULL)
jpayne@68 1854 #define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->current_exception ? (PyObject*) Py_TYPE(__pyx_tstate->current_exception) : (PyObject*) NULL)
jpayne@68 1855 #else
jpayne@68 1856 #define __Pyx_PyErr_Occurred() (__pyx_tstate->curexc_type != NULL)
jpayne@68 1857 #define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->curexc_type)
jpayne@68 1858 #endif
jpayne@68 1859 #else
jpayne@68 1860 #define __Pyx_PyThreadState_declare
jpayne@68 1861 #define __Pyx_PyThreadState_assign
jpayne@68 1862 #define __Pyx_PyErr_Occurred() (PyErr_Occurred() != NULL)
jpayne@68 1863 #define __Pyx_PyErr_CurrentExceptionType() PyErr_Occurred()
jpayne@68 1864 #endif
jpayne@68 1865
jpayne@68 1866 /* PyErrFetchRestore.proto */
jpayne@68 1867 #if CYTHON_FAST_THREAD_STATE
jpayne@68 1868 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
jpayne@68 1869 #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
jpayne@68 1870 #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
jpayne@68 1871 #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
jpayne@68 1872 #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
jpayne@68 1873 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
jpayne@68 1874 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
jpayne@68 1875 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A6
jpayne@68 1876 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
jpayne@68 1877 #else
jpayne@68 1878 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
jpayne@68 1879 #endif
jpayne@68 1880 #else
jpayne@68 1881 #define __Pyx_PyErr_Clear() PyErr_Clear()
jpayne@68 1882 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
jpayne@68 1883 #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
jpayne@68 1884 #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
jpayne@68 1885 #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
jpayne@68 1886 #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
jpayne@68 1887 #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
jpayne@68 1888 #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
jpayne@68 1889 #endif
jpayne@68 1890
jpayne@68 1891 /* PyObjectGetAttrStr.proto */
jpayne@68 1892 #if CYTHON_USE_TYPE_SLOTS
jpayne@68 1893 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
jpayne@68 1894 #else
jpayne@68 1895 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
jpayne@68 1896 #endif
jpayne@68 1897
jpayne@68 1898 /* PyObjectGetAttrStrNoError.proto */
jpayne@68 1899 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);
jpayne@68 1900
jpayne@68 1901 /* GetBuiltinName.proto */
jpayne@68 1902 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
jpayne@68 1903
jpayne@68 1904 /* TupleAndListFromArray.proto */
jpayne@68 1905 #if CYTHON_COMPILING_IN_CPYTHON
jpayne@68 1906 static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n);
jpayne@68 1907 static CYTHON_INLINE PyObject* __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n);
jpayne@68 1908 #endif
jpayne@68 1909
jpayne@68 1910 /* IncludeStringH.proto */
jpayne@68 1911 #include <string.h>
jpayne@68 1912
jpayne@68 1913 /* BytesEquals.proto */
jpayne@68 1914 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);
jpayne@68 1915
jpayne@68 1916 /* UnicodeEquals.proto */
jpayne@68 1917 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);
jpayne@68 1918
jpayne@68 1919 /* fastcall.proto */
jpayne@68 1920 #if CYTHON_AVOID_BORROWED_REFS
jpayne@68 1921 #define __Pyx_Arg_VARARGS(args, i) PySequence_GetItem(args, i)
jpayne@68 1922 #elif CYTHON_ASSUME_SAFE_MACROS
jpayne@68 1923 #define __Pyx_Arg_VARARGS(args, i) PyTuple_GET_ITEM(args, i)
jpayne@68 1924 #else
jpayne@68 1925 #define __Pyx_Arg_VARARGS(args, i) PyTuple_GetItem(args, i)
jpayne@68 1926 #endif
jpayne@68 1927 #if CYTHON_AVOID_BORROWED_REFS
jpayne@68 1928 #define __Pyx_Arg_NewRef_VARARGS(arg) __Pyx_NewRef(arg)
jpayne@68 1929 #define __Pyx_Arg_XDECREF_VARARGS(arg) Py_XDECREF(arg)
jpayne@68 1930 #else
jpayne@68 1931 #define __Pyx_Arg_NewRef_VARARGS(arg) arg
jpayne@68 1932 #define __Pyx_Arg_XDECREF_VARARGS(arg)
jpayne@68 1933 #endif
jpayne@68 1934 #define __Pyx_NumKwargs_VARARGS(kwds) PyDict_Size(kwds)
jpayne@68 1935 #define __Pyx_KwValues_VARARGS(args, nargs) NULL
jpayne@68 1936 #define __Pyx_GetKwValue_VARARGS(kw, kwvalues, s) __Pyx_PyDict_GetItemStrWithError(kw, s)
jpayne@68 1937 #define __Pyx_KwargsAsDict_VARARGS(kw, kwvalues) PyDict_Copy(kw)
jpayne@68 1938 #if CYTHON_METH_FASTCALL
jpayne@68 1939 #define __Pyx_Arg_FASTCALL(args, i) args[i]
jpayne@68 1940 #define __Pyx_NumKwargs_FASTCALL(kwds) PyTuple_GET_SIZE(kwds)
jpayne@68 1941 #define __Pyx_KwValues_FASTCALL(args, nargs) ((args) + (nargs))
jpayne@68 1942 static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s);
jpayne@68 1943 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000
jpayne@68 1944 CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues);
jpayne@68 1945 #else
jpayne@68 1946 #define __Pyx_KwargsAsDict_FASTCALL(kw, kwvalues) _PyStack_AsDict(kwvalues, kw)
jpayne@68 1947 #endif
jpayne@68 1948 #define __Pyx_Arg_NewRef_FASTCALL(arg) arg /* no-op, __Pyx_Arg_FASTCALL is direct and this needs
jpayne@68 1949 to have the same reference counting */
jpayne@68 1950 #define __Pyx_Arg_XDECREF_FASTCALL(arg)
jpayne@68 1951 #else
jpayne@68 1952 #define __Pyx_Arg_FASTCALL __Pyx_Arg_VARARGS
jpayne@68 1953 #define __Pyx_NumKwargs_FASTCALL __Pyx_NumKwargs_VARARGS
jpayne@68 1954 #define __Pyx_KwValues_FASTCALL __Pyx_KwValues_VARARGS
jpayne@68 1955 #define __Pyx_GetKwValue_FASTCALL __Pyx_GetKwValue_VARARGS
jpayne@68 1956 #define __Pyx_KwargsAsDict_FASTCALL __Pyx_KwargsAsDict_VARARGS
jpayne@68 1957 #define __Pyx_Arg_NewRef_FASTCALL(arg) __Pyx_Arg_NewRef_VARARGS(arg)
jpayne@68 1958 #define __Pyx_Arg_XDECREF_FASTCALL(arg) __Pyx_Arg_XDECREF_VARARGS(arg)
jpayne@68 1959 #endif
jpayne@68 1960 #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
jpayne@68 1961 #define __Pyx_ArgsSlice_VARARGS(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_VARARGS(args, start), stop - start)
jpayne@68 1962 #define __Pyx_ArgsSlice_FASTCALL(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_FASTCALL(args, start), stop - start)
jpayne@68 1963 #else
jpayne@68 1964 #define __Pyx_ArgsSlice_VARARGS(args, start, stop) PyTuple_GetSlice(args, start, stop)
jpayne@68 1965 #define __Pyx_ArgsSlice_FASTCALL(args, start, stop) PyTuple_GetSlice(args, start, stop)
jpayne@68 1966 #endif
jpayne@68 1967
jpayne@68 1968 /* ListCompAppend.proto */
jpayne@68 1969 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
jpayne@68 1970 static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
jpayne@68 1971 PyListObject* L = (PyListObject*) list;
jpayne@68 1972 Py_ssize_t len = Py_SIZE(list);
jpayne@68 1973 if (likely(L->allocated > len)) {
jpayne@68 1974 Py_INCREF(x);
jpayne@68 1975 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000
jpayne@68 1976 L->ob_item[len] = x;
jpayne@68 1977 #else
jpayne@68 1978 PyList_SET_ITEM(list, len, x);
jpayne@68 1979 #endif
jpayne@68 1980 __Pyx_SET_SIZE(list, len + 1);
jpayne@68 1981 return 0;
jpayne@68 1982 }
jpayne@68 1983 return PyList_Append(list, x);
jpayne@68 1984 }
jpayne@68 1985 #else
jpayne@68 1986 #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
jpayne@68 1987 #endif
jpayne@68 1988
jpayne@68 1989 /* PyObjectCall.proto */
jpayne@68 1990 #if CYTHON_COMPILING_IN_CPYTHON
jpayne@68 1991 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
jpayne@68 1992 #else
jpayne@68 1993 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
jpayne@68 1994 #endif
jpayne@68 1995
jpayne@68 1996 /* RaiseDoubleKeywords.proto */
jpayne@68 1997 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
jpayne@68 1998
jpayne@68 1999 /* ParseKeywords.proto */
jpayne@68 2000 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject *const *kwvalues,
jpayne@68 2001 PyObject **argnames[],
jpayne@68 2002 PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,
jpayne@68 2003 const char* function_name);
jpayne@68 2004
jpayne@68 2005 /* RaiseArgTupleInvalid.proto */
jpayne@68 2006 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
jpayne@68 2007 Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
jpayne@68 2008
jpayne@68 2009 /* GetItemInt.proto */
jpayne@68 2010 #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
jpayne@68 2011 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
jpayne@68 2012 __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
jpayne@68 2013 (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
jpayne@68 2014 __Pyx_GetItemInt_Generic(o, to_py_func(i))))
jpayne@68 2015 #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
jpayne@68 2016 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
jpayne@68 2017 __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
jpayne@68 2018 (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
jpayne@68 2019 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
jpayne@68 2020 int wraparound, int boundscheck);
jpayne@68 2021 #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
jpayne@68 2022 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
jpayne@68 2023 __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
jpayne@68 2024 (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
jpayne@68 2025 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
jpayne@68 2026 int wraparound, int boundscheck);
jpayne@68 2027 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
jpayne@68 2028 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
jpayne@68 2029 int is_list, int wraparound, int boundscheck);
jpayne@68 2030
jpayne@68 2031 /* SetItemInt.proto */
jpayne@68 2032 #define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
jpayne@68 2033 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
jpayne@68 2034 __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck) :\
jpayne@68 2035 (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\
jpayne@68 2036 __Pyx_SetItemInt_Generic(o, to_py_func(i), v)))
jpayne@68 2037 static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v);
jpayne@68 2038 static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v,
jpayne@68 2039 int is_list, int wraparound, int boundscheck);
jpayne@68 2040
jpayne@68 2041 /* PyFunctionFastCall.proto */
jpayne@68 2042 #if CYTHON_FAST_PYCALL
jpayne@68 2043 #if !CYTHON_VECTORCALL
jpayne@68 2044 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
jpayne@68 2045 __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
jpayne@68 2046 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
jpayne@68 2047 #endif
jpayne@68 2048 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
jpayne@68 2049 (sizeof(char [1 - 2*!(cond)]) - 1)
jpayne@68 2050 #ifndef Py_MEMBER_SIZE
jpayne@68 2051 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
jpayne@68 2052 #endif
jpayne@68 2053 #if !CYTHON_VECTORCALL
jpayne@68 2054 #if PY_VERSION_HEX >= 0x03080000
jpayne@68 2055 #include "frameobject.h"
jpayne@68 2056 #if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 2057 #ifndef Py_BUILD_CORE
jpayne@68 2058 #define Py_BUILD_CORE 1
jpayne@68 2059 #endif
jpayne@68 2060 #include "internal/pycore_frame.h"
jpayne@68 2061 #endif
jpayne@68 2062 #define __Pxy_PyFrame_Initialize_Offsets()
jpayne@68 2063 #define __Pyx_PyFrame_GetLocalsplus(frame) ((frame)->f_localsplus)
jpayne@68 2064 #else
jpayne@68 2065 static size_t __pyx_pyframe_localsplus_offset = 0;
jpayne@68 2066 #include "frameobject.h"
jpayne@68 2067 #define __Pxy_PyFrame_Initialize_Offsets()\
jpayne@68 2068 ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
jpayne@68 2069 (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
jpayne@68 2070 #define __Pyx_PyFrame_GetLocalsplus(frame)\
jpayne@68 2071 (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
jpayne@68 2072 #endif
jpayne@68 2073 #endif
jpayne@68 2074 #endif
jpayne@68 2075
jpayne@68 2076 /* PyObjectCallMethO.proto */
jpayne@68 2077 #if CYTHON_COMPILING_IN_CPYTHON
jpayne@68 2078 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
jpayne@68 2079 #endif
jpayne@68 2080
jpayne@68 2081 /* PyObjectFastCall.proto */
jpayne@68 2082 #define __Pyx_PyObject_FastCall(func, args, nargs) __Pyx_PyObject_FastCallDict(func, args, (size_t)(nargs), NULL)
jpayne@68 2083 static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs);
jpayne@68 2084
jpayne@68 2085 /* ArgTypeTest.proto */
jpayne@68 2086 #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
jpayne@68 2087 ((likely(__Pyx_IS_TYPE(obj, type) | (none_allowed && (obj == Py_None)))) ? 1 :\
jpayne@68 2088 __Pyx__ArgTypeTest(obj, type, name, exact))
jpayne@68 2089 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);
jpayne@68 2090
jpayne@68 2091 /* ExtTypeTest.proto */
jpayne@68 2092 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
jpayne@68 2093
jpayne@68 2094 /* PyObjectCallOneArg.proto */
jpayne@68 2095 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
jpayne@68 2096
jpayne@68 2097 /* ObjectGetItem.proto */
jpayne@68 2098 #if CYTHON_USE_TYPE_SLOTS
jpayne@68 2099 static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key);
jpayne@68 2100 #else
jpayne@68 2101 #define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key)
jpayne@68 2102 #endif
jpayne@68 2103
jpayne@68 2104 /* RaiseUnexpectedTypeError.proto */
jpayne@68 2105 static int __Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj);
jpayne@68 2106
jpayne@68 2107 /* PyDictVersioning.proto */
jpayne@68 2108 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
jpayne@68 2109 #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
jpayne@68 2110 #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
jpayne@68 2111 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
jpayne@68 2112 (version_var) = __PYX_GET_DICT_VERSION(dict);\
jpayne@68 2113 (cache_var) = (value);
jpayne@68 2114 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
jpayne@68 2115 static PY_UINT64_T __pyx_dict_version = 0;\
jpayne@68 2116 static PyObject *__pyx_dict_cached_value = NULL;\
jpayne@68 2117 if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
jpayne@68 2118 (VAR) = __pyx_dict_cached_value;\
jpayne@68 2119 } else {\
jpayne@68 2120 (VAR) = __pyx_dict_cached_value = (LOOKUP);\
jpayne@68 2121 __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
jpayne@68 2122 }\
jpayne@68 2123 }
jpayne@68 2124 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
jpayne@68 2125 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
jpayne@68 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@68 2127 #else
jpayne@68 2128 #define __PYX_GET_DICT_VERSION(dict) (0)
jpayne@68 2129 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
jpayne@68 2130 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
jpayne@68 2131 #endif
jpayne@68 2132
jpayne@68 2133 /* GetModuleGlobalName.proto */
jpayne@68 2134 #if CYTHON_USE_DICT_VERSIONS
jpayne@68 2135 #define __Pyx_GetModuleGlobalName(var, name) do {\
jpayne@68 2136 static PY_UINT64_T __pyx_dict_version = 0;\
jpayne@68 2137 static PyObject *__pyx_dict_cached_value = NULL;\
jpayne@68 2138 (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
jpayne@68 2139 (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
jpayne@68 2140 __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
jpayne@68 2141 } while(0)
jpayne@68 2142 #define __Pyx_GetModuleGlobalNameUncached(var, name) do {\
jpayne@68 2143 PY_UINT64_T __pyx_dict_version;\
jpayne@68 2144 PyObject *__pyx_dict_cached_value;\
jpayne@68 2145 (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
jpayne@68 2146 } while(0)
jpayne@68 2147 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
jpayne@68 2148 #else
jpayne@68 2149 #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name)
jpayne@68 2150 #define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name)
jpayne@68 2151 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
jpayne@68 2152 #endif
jpayne@68 2153
jpayne@68 2154 /* RaiseException.proto */
jpayne@68 2155 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
jpayne@68 2156
jpayne@68 2157 /* GetTopmostException.proto */
jpayne@68 2158 #if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE
jpayne@68 2159 static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
jpayne@68 2160 #endif
jpayne@68 2161
jpayne@68 2162 /* SaveResetException.proto */
jpayne@68 2163 #if CYTHON_FAST_THREAD_STATE
jpayne@68 2164 #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
jpayne@68 2165 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
jpayne@68 2166 #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
jpayne@68 2167 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
jpayne@68 2168 #else
jpayne@68 2169 #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
jpayne@68 2170 #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
jpayne@68 2171 #endif
jpayne@68 2172
jpayne@68 2173 /* GetException.proto */
jpayne@68 2174 #if CYTHON_FAST_THREAD_STATE
jpayne@68 2175 #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
jpayne@68 2176 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
jpayne@68 2177 #else
jpayne@68 2178 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
jpayne@68 2179 #endif
jpayne@68 2180
jpayne@68 2181 /* PySequenceContains.proto */
jpayne@68 2182 static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) {
jpayne@68 2183 int result = PySequence_Contains(seq, item);
jpayne@68 2184 return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
jpayne@68 2185 }
jpayne@68 2186
jpayne@68 2187 /* RaiseTooManyValuesToUnpack.proto */
jpayne@68 2188 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
jpayne@68 2189
jpayne@68 2190 /* RaiseNeedMoreValuesToUnpack.proto */
jpayne@68 2191 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
jpayne@68 2192
jpayne@68 2193 /* IterFinish.proto */
jpayne@68 2194 static CYTHON_INLINE int __Pyx_IterFinish(void);
jpayne@68 2195
jpayne@68 2196 /* UnpackItemEndCheck.proto */
jpayne@68 2197 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);
jpayne@68 2198
jpayne@68 2199 /* PyIntBinop.proto */
jpayne@68 2200 #if !CYTHON_COMPILING_IN_PYPY
jpayne@68 2201 static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
jpayne@68 2202 #else
jpayne@68 2203 #define __Pyx_PyInt_SubtractObjC(op1, op2, intval, inplace, zerodivision_check)\
jpayne@68 2204 (inplace ? PyNumber_InPlaceSubtract(op1, op2) : PyNumber_Subtract(op1, op2))
jpayne@68 2205 #endif
jpayne@68 2206
jpayne@68 2207 /* PyObjectLookupSpecial.proto */
jpayne@68 2208 #if CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
jpayne@68 2209 #define __Pyx_PyObject_LookupSpecialNoError(obj, attr_name) __Pyx__PyObject_LookupSpecial(obj, attr_name, 0)
jpayne@68 2210 #define __Pyx_PyObject_LookupSpecial(obj, attr_name) __Pyx__PyObject_LookupSpecial(obj, attr_name, 1)
jpayne@68 2211 static CYTHON_INLINE PyObject* __Pyx__PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name, int with_error);
jpayne@68 2212 #else
jpayne@68 2213 #define __Pyx_PyObject_LookupSpecialNoError(o,n) __Pyx_PyObject_GetAttrStrNoError(o,n)
jpayne@68 2214 #define __Pyx_PyObject_LookupSpecial(o,n) __Pyx_PyObject_GetAttrStr(o,n)
jpayne@68 2215 #endif
jpayne@68 2216
jpayne@68 2217 /* SwapException.proto */
jpayne@68 2218 #if CYTHON_FAST_THREAD_STATE
jpayne@68 2219 #define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
jpayne@68 2220 static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
jpayne@68 2221 #else
jpayne@68 2222 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
jpayne@68 2223 #endif
jpayne@68 2224
jpayne@68 2225 /* PyIntCompare.proto */
jpayne@68 2226 static CYTHON_INLINE int __Pyx_PyInt_BoolEqObjC(PyObject *op1, PyObject *op2, long intval, long inplace);
jpayne@68 2227
jpayne@68 2228 /* DictGetItem.proto */
jpayne@68 2229 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
jpayne@68 2230 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
jpayne@68 2231 #define __Pyx_PyObject_Dict_GetItem(obj, name)\
jpayne@68 2232 (likely(PyDict_CheckExact(obj)) ?\
jpayne@68 2233 __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
jpayne@68 2234 #else
jpayne@68 2235 #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
jpayne@68 2236 #define __Pyx_PyObject_Dict_GetItem(obj, name) PyObject_GetItem(obj, name)
jpayne@68 2237 #endif
jpayne@68 2238
jpayne@68 2239 /* IncludeStructmemberH.proto */
jpayne@68 2240 #include <structmember.h>
jpayne@68 2241
jpayne@68 2242 /* FixUpExtensionType.proto */
jpayne@68 2243 #if CYTHON_USE_TYPE_SPECS
jpayne@68 2244 static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type);
jpayne@68 2245 #endif
jpayne@68 2246
jpayne@68 2247 /* FetchSharedCythonModule.proto */
jpayne@68 2248 static PyObject *__Pyx_FetchSharedCythonABIModule(void);
jpayne@68 2249
jpayne@68 2250 /* FetchCommonType.proto */
jpayne@68 2251 #if !CYTHON_USE_TYPE_SPECS
jpayne@68 2252 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);
jpayne@68 2253 #else
jpayne@68 2254 static PyTypeObject* __Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases);
jpayne@68 2255 #endif
jpayne@68 2256
jpayne@68 2257 /* PyMethodNew.proto */
jpayne@68 2258 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 2259 static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) {
jpayne@68 2260 PyObject *typesModule=NULL, *methodType=NULL, *result=NULL;
jpayne@68 2261 CYTHON_UNUSED_VAR(typ);
jpayne@68 2262 if (!self)
jpayne@68 2263 return __Pyx_NewRef(func);
jpayne@68 2264 typesModule = PyImport_ImportModule("types");
jpayne@68 2265 if (!typesModule) return NULL;
jpayne@68 2266 methodType = PyObject_GetAttrString(typesModule, "MethodType");
jpayne@68 2267 Py_DECREF(typesModule);
jpayne@68 2268 if (!methodType) return NULL;
jpayne@68 2269 result = PyObject_CallFunctionObjArgs(methodType, func, self, NULL);
jpayne@68 2270 Py_DECREF(methodType);
jpayne@68 2271 return result;
jpayne@68 2272 }
jpayne@68 2273 #elif PY_MAJOR_VERSION >= 3
jpayne@68 2274 static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) {
jpayne@68 2275 CYTHON_UNUSED_VAR(typ);
jpayne@68 2276 if (!self)
jpayne@68 2277 return __Pyx_NewRef(func);
jpayne@68 2278 return PyMethod_New(func, self);
jpayne@68 2279 }
jpayne@68 2280 #else
jpayne@68 2281 #define __Pyx_PyMethod_New PyMethod_New
jpayne@68 2282 #endif
jpayne@68 2283
jpayne@68 2284 /* PyVectorcallFastCallDict.proto */
jpayne@68 2285 #if CYTHON_METH_FASTCALL
jpayne@68 2286 static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw);
jpayne@68 2287 #endif
jpayne@68 2288
jpayne@68 2289 /* CythonFunctionShared.proto */
jpayne@68 2290 #define __Pyx_CyFunction_USED
jpayne@68 2291 #define __Pyx_CYFUNCTION_STATICMETHOD 0x01
jpayne@68 2292 #define __Pyx_CYFUNCTION_CLASSMETHOD 0x02
jpayne@68 2293 #define __Pyx_CYFUNCTION_CCLASS 0x04
jpayne@68 2294 #define __Pyx_CYFUNCTION_COROUTINE 0x08
jpayne@68 2295 #define __Pyx_CyFunction_GetClosure(f)\
jpayne@68 2296 (((__pyx_CyFunctionObject *) (f))->func_closure)
jpayne@68 2297 #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 2298 #define __Pyx_CyFunction_GetClassObj(f)\
jpayne@68 2299 (((__pyx_CyFunctionObject *) (f))->func_classobj)
jpayne@68 2300 #else
jpayne@68 2301 #define __Pyx_CyFunction_GetClassObj(f)\
jpayne@68 2302 ((PyObject*) ((PyCMethodObject *) (f))->mm_class)
jpayne@68 2303 #endif
jpayne@68 2304 #define __Pyx_CyFunction_SetClassObj(f, classobj)\
jpayne@68 2305 __Pyx__CyFunction_SetClassObj((__pyx_CyFunctionObject *) (f), (classobj))
jpayne@68 2306 #define __Pyx_CyFunction_Defaults(type, f)\
jpayne@68 2307 ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
jpayne@68 2308 #define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
jpayne@68 2309 ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
jpayne@68 2310 typedef struct {
jpayne@68 2311 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 2312 PyObject_HEAD
jpayne@68 2313 PyObject *func;
jpayne@68 2314 #elif PY_VERSION_HEX < 0x030900B1
jpayne@68 2315 PyCFunctionObject func;
jpayne@68 2316 #else
jpayne@68 2317 PyCMethodObject func;
jpayne@68 2318 #endif
jpayne@68 2319 #if CYTHON_BACKPORT_VECTORCALL
jpayne@68 2320 __pyx_vectorcallfunc func_vectorcall;
jpayne@68 2321 #endif
jpayne@68 2322 #if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 2323 PyObject *func_weakreflist;
jpayne@68 2324 #endif
jpayne@68 2325 PyObject *func_dict;
jpayne@68 2326 PyObject *func_name;
jpayne@68 2327 PyObject *func_qualname;
jpayne@68 2328 PyObject *func_doc;
jpayne@68 2329 PyObject *func_globals;
jpayne@68 2330 PyObject *func_code;
jpayne@68 2331 PyObject *func_closure;
jpayne@68 2332 #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 2333 PyObject *func_classobj;
jpayne@68 2334 #endif
jpayne@68 2335 void *defaults;
jpayne@68 2336 int defaults_pyobjects;
jpayne@68 2337 size_t defaults_size;
jpayne@68 2338 int flags;
jpayne@68 2339 PyObject *defaults_tuple;
jpayne@68 2340 PyObject *defaults_kwdict;
jpayne@68 2341 PyObject *(*defaults_getter)(PyObject *);
jpayne@68 2342 PyObject *func_annotations;
jpayne@68 2343 PyObject *func_is_coroutine;
jpayne@68 2344 } __pyx_CyFunctionObject;
jpayne@68 2345 #undef __Pyx_CyOrPyCFunction_Check
jpayne@68 2346 #define __Pyx_CyFunction_Check(obj) __Pyx_TypeCheck(obj, __pyx_CyFunctionType)
jpayne@68 2347 #define __Pyx_CyOrPyCFunction_Check(obj) __Pyx_TypeCheck2(obj, __pyx_CyFunctionType, &PyCFunction_Type)
jpayne@68 2348 #define __Pyx_CyFunction_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_CyFunctionType)
jpayne@68 2349 static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void *cfunc);
jpayne@68 2350 #undef __Pyx_IsSameCFunction
jpayne@68 2351 #define __Pyx_IsSameCFunction(func, cfunc) __Pyx__IsSameCyOrCFunction(func, cfunc)
jpayne@68 2352 static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml,
jpayne@68 2353 int flags, PyObject* qualname,
jpayne@68 2354 PyObject *closure,
jpayne@68 2355 PyObject *module, PyObject *globals,
jpayne@68 2356 PyObject* code);
jpayne@68 2357 static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj);
jpayne@68 2358 static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
jpayne@68 2359 size_t size,
jpayne@68 2360 int pyobjects);
jpayne@68 2361 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
jpayne@68 2362 PyObject *tuple);
jpayne@68 2363 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
jpayne@68 2364 PyObject *dict);
jpayne@68 2365 static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
jpayne@68 2366 PyObject *dict);
jpayne@68 2367 static int __pyx_CyFunction_init(PyObject *module);
jpayne@68 2368 #if CYTHON_METH_FASTCALL
jpayne@68 2369 static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
jpayne@68 2370 static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
jpayne@68 2371 static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
jpayne@68 2372 static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
jpayne@68 2373 #if CYTHON_BACKPORT_VECTORCALL
jpayne@68 2374 #define __Pyx_CyFunction_func_vectorcall(f) (((__pyx_CyFunctionObject*)f)->func_vectorcall)
jpayne@68 2375 #else
jpayne@68 2376 #define __Pyx_CyFunction_func_vectorcall(f) (((PyCFunctionObject*)f)->vectorcall)
jpayne@68 2377 #endif
jpayne@68 2378 #endif
jpayne@68 2379
jpayne@68 2380 /* CythonFunction.proto */
jpayne@68 2381 static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml,
jpayne@68 2382 int flags, PyObject* qualname,
jpayne@68 2383 PyObject *closure,
jpayne@68 2384 PyObject *module, PyObject *globals,
jpayne@68 2385 PyObject* code);
jpayne@68 2386
jpayne@68 2387 /* RaiseUnboundLocalError.proto */
jpayne@68 2388 static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);
jpayne@68 2389
jpayne@68 2390 /* TypeImport.proto */
jpayne@68 2391 #ifndef __PYX_HAVE_RT_ImportType_proto_3_0_11
jpayne@68 2392 #define __PYX_HAVE_RT_ImportType_proto_3_0_11
jpayne@68 2393 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
jpayne@68 2394 #include <stdalign.h>
jpayne@68 2395 #endif
jpayne@68 2396 #if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || __cplusplus >= 201103L
jpayne@68 2397 #define __PYX_GET_STRUCT_ALIGNMENT_3_0_11(s) alignof(s)
jpayne@68 2398 #else
jpayne@68 2399 #define __PYX_GET_STRUCT_ALIGNMENT_3_0_11(s) sizeof(void*)
jpayne@68 2400 #endif
jpayne@68 2401 enum __Pyx_ImportType_CheckSize_3_0_11 {
jpayne@68 2402 __Pyx_ImportType_CheckSize_Error_3_0_11 = 0,
jpayne@68 2403 __Pyx_ImportType_CheckSize_Warn_3_0_11 = 1,
jpayne@68 2404 __Pyx_ImportType_CheckSize_Ignore_3_0_11 = 2
jpayne@68 2405 };
jpayne@68 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@68 2407 #endif
jpayne@68 2408
jpayne@68 2409 /* Import.proto */
jpayne@68 2410 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
jpayne@68 2411
jpayne@68 2412 /* ImportDottedModule.proto */
jpayne@68 2413 static PyObject *__Pyx_ImportDottedModule(PyObject *name, PyObject *parts_tuple);
jpayne@68 2414 #if PY_MAJOR_VERSION >= 3
jpayne@68 2415 static PyObject *__Pyx_ImportDottedModule_WalkParts(PyObject *module, PyObject *name, PyObject *parts_tuple);
jpayne@68 2416 #endif
jpayne@68 2417
jpayne@68 2418 /* ImportFrom.proto */
jpayne@68 2419 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
jpayne@68 2420
jpayne@68 2421 /* PyObjectCallNoArg.proto */
jpayne@68 2422 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
jpayne@68 2423
jpayne@68 2424 /* CLineInTraceback.proto */
jpayne@68 2425 #ifdef CYTHON_CLINE_IN_TRACEBACK
jpayne@68 2426 #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
jpayne@68 2427 #else
jpayne@68 2428 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
jpayne@68 2429 #endif
jpayne@68 2430
jpayne@68 2431 /* CodeObjectCache.proto */
jpayne@68 2432 #if !CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 2433 typedef struct {
jpayne@68 2434 PyCodeObject* code_object;
jpayne@68 2435 int code_line;
jpayne@68 2436 } __Pyx_CodeObjectCacheEntry;
jpayne@68 2437 struct __Pyx_CodeObjectCache {
jpayne@68 2438 int count;
jpayne@68 2439 int max_count;
jpayne@68 2440 __Pyx_CodeObjectCacheEntry* entries;
jpayne@68 2441 };
jpayne@68 2442 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
jpayne@68 2443 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
jpayne@68 2444 static PyCodeObject *__pyx_find_code_object(int code_line);
jpayne@68 2445 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
jpayne@68 2446 #endif
jpayne@68 2447
jpayne@68 2448 /* AddTraceback.proto */
jpayne@68 2449 static void __Pyx_AddTraceback(const char *funcname, int c_line,
jpayne@68 2450 int py_line, const char *filename);
jpayne@68 2451
jpayne@68 2452 /* ArrayAPI.proto */
jpayne@68 2453 #ifndef _ARRAYARRAY_H
jpayne@68 2454 #define _ARRAYARRAY_H
jpayne@68 2455 typedef struct arraydescr {
jpayne@68 2456 int typecode;
jpayne@68 2457 int itemsize;
jpayne@68 2458 PyObject * (*getitem)(struct arrayobject *, Py_ssize_t);
jpayne@68 2459 int (*setitem)(struct arrayobject *, Py_ssize_t, PyObject *);
jpayne@68 2460 #if PY_MAJOR_VERSION >= 3
jpayne@68 2461 char *formats;
jpayne@68 2462 #endif
jpayne@68 2463 } arraydescr;
jpayne@68 2464 struct arrayobject {
jpayne@68 2465 PyObject_HEAD
jpayne@68 2466 Py_ssize_t ob_size;
jpayne@68 2467 union {
jpayne@68 2468 char *ob_item;
jpayne@68 2469 float *as_floats;
jpayne@68 2470 double *as_doubles;
jpayne@68 2471 int *as_ints;
jpayne@68 2472 unsigned int *as_uints;
jpayne@68 2473 unsigned char *as_uchars;
jpayne@68 2474 signed char *as_schars;
jpayne@68 2475 char *as_chars;
jpayne@68 2476 unsigned long *as_ulongs;
jpayne@68 2477 long *as_longs;
jpayne@68 2478 #if PY_MAJOR_VERSION >= 3
jpayne@68 2479 unsigned long long *as_ulonglongs;
jpayne@68 2480 long long *as_longlongs;
jpayne@68 2481 #endif
jpayne@68 2482 short *as_shorts;
jpayne@68 2483 unsigned short *as_ushorts;
jpayne@68 2484 Py_UNICODE *as_pyunicodes;
jpayne@68 2485 void *as_voidptr;
jpayne@68 2486 } data;
jpayne@68 2487 Py_ssize_t allocated;
jpayne@68 2488 struct arraydescr *ob_descr;
jpayne@68 2489 PyObject *weakreflist;
jpayne@68 2490 #if PY_MAJOR_VERSION >= 3
jpayne@68 2491 int ob_exports;
jpayne@68 2492 #endif
jpayne@68 2493 };
jpayne@68 2494 #ifndef NO_NEWARRAY_INLINE
jpayne@68 2495 static CYTHON_INLINE PyObject * newarrayobject(PyTypeObject *type, Py_ssize_t size,
jpayne@68 2496 struct arraydescr *descr) {
jpayne@68 2497 arrayobject *op;
jpayne@68 2498 size_t nbytes;
jpayne@68 2499 if (size < 0) {
jpayne@68 2500 PyErr_BadInternalCall();
jpayne@68 2501 return NULL;
jpayne@68 2502 }
jpayne@68 2503 nbytes = size * descr->itemsize;
jpayne@68 2504 if (nbytes / descr->itemsize != (size_t)size) {
jpayne@68 2505 return PyErr_NoMemory();
jpayne@68 2506 }
jpayne@68 2507 op = (arrayobject *) type->tp_alloc(type, 0);
jpayne@68 2508 if (op == NULL) {
jpayne@68 2509 return NULL;
jpayne@68 2510 }
jpayne@68 2511 op->ob_descr = descr;
jpayne@68 2512 op->allocated = size;
jpayne@68 2513 op->weakreflist = NULL;
jpayne@68 2514 __Pyx_SET_SIZE(op, size);
jpayne@68 2515 if (size <= 0) {
jpayne@68 2516 op->data.ob_item = NULL;
jpayne@68 2517 }
jpayne@68 2518 else {
jpayne@68 2519 op->data.ob_item = PyMem_NEW(char, nbytes);
jpayne@68 2520 if (op->data.ob_item == NULL) {
jpayne@68 2521 Py_DECREF(op);
jpayne@68 2522 return PyErr_NoMemory();
jpayne@68 2523 }
jpayne@68 2524 }
jpayne@68 2525 return (PyObject *) op;
jpayne@68 2526 }
jpayne@68 2527 #else
jpayne@68 2528 PyObject* newarrayobject(PyTypeObject *type, Py_ssize_t size,
jpayne@68 2529 struct arraydescr *descr);
jpayne@68 2530 #endif
jpayne@68 2531 static CYTHON_INLINE int resize(arrayobject *self, Py_ssize_t n) {
jpayne@68 2532 void *items = (void*) self->data.ob_item;
jpayne@68 2533 PyMem_Resize(items, char, (size_t)(n * self->ob_descr->itemsize));
jpayne@68 2534 if (items == NULL) {
jpayne@68 2535 PyErr_NoMemory();
jpayne@68 2536 return -1;
jpayne@68 2537 }
jpayne@68 2538 self->data.ob_item = (char*) items;
jpayne@68 2539 __Pyx_SET_SIZE(self, n);
jpayne@68 2540 self->allocated = n;
jpayne@68 2541 return 0;
jpayne@68 2542 }
jpayne@68 2543 static CYTHON_INLINE int resize_smart(arrayobject *self, Py_ssize_t n) {
jpayne@68 2544 void *items = (void*) self->data.ob_item;
jpayne@68 2545 Py_ssize_t newsize;
jpayne@68 2546 if (n < self->allocated && n*4 > self->allocated) {
jpayne@68 2547 __Pyx_SET_SIZE(self, n);
jpayne@68 2548 return 0;
jpayne@68 2549 }
jpayne@68 2550 newsize = n + (n / 2) + 1;
jpayne@68 2551 if (newsize <= n) {
jpayne@68 2552 PyErr_NoMemory();
jpayne@68 2553 return -1;
jpayne@68 2554 }
jpayne@68 2555 PyMem_Resize(items, char, (size_t)(newsize * self->ob_descr->itemsize));
jpayne@68 2556 if (items == NULL) {
jpayne@68 2557 PyErr_NoMemory();
jpayne@68 2558 return -1;
jpayne@68 2559 }
jpayne@68 2560 self->data.ob_item = (char*) items;
jpayne@68 2561 __Pyx_SET_SIZE(self, n);
jpayne@68 2562 self->allocated = newsize;
jpayne@68 2563 return 0;
jpayne@68 2564 }
jpayne@68 2565 #endif
jpayne@68 2566
jpayne@68 2567 /* GCCDiagnostics.proto */
jpayne@68 2568 #if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
jpayne@68 2569 #define __Pyx_HAS_GCC_DIAGNOSTIC
jpayne@68 2570 #endif
jpayne@68 2571
jpayne@68 2572 /* CIntFromPy.proto */
jpayne@68 2573 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
jpayne@68 2574
jpayne@68 2575 /* CIntFromPy.proto */
jpayne@68 2576 static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *);
jpayne@68 2577
jpayne@68 2578 /* CIntToPy.proto */
jpayne@68 2579 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
jpayne@68 2580
jpayne@68 2581 /* CIntFromPy.proto */
jpayne@68 2582 static CYTHON_INLINE int32_t __Pyx_PyInt_As_int32_t(PyObject *);
jpayne@68 2583
jpayne@68 2584 /* CIntToPy.proto */
jpayne@68 2585 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
jpayne@68 2586
jpayne@68 2587 /* CIntToPy.proto */
jpayne@68 2588 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int32_t(int32_t value);
jpayne@68 2589
jpayne@68 2590 /* FormatTypeName.proto */
jpayne@68 2591 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 2592 typedef PyObject *__Pyx_TypeName;
jpayne@68 2593 #define __Pyx_FMT_TYPENAME "%U"
jpayne@68 2594 static __Pyx_TypeName __Pyx_PyType_GetName(PyTypeObject* tp);
jpayne@68 2595 #define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj)
jpayne@68 2596 #else
jpayne@68 2597 typedef const char *__Pyx_TypeName;
jpayne@68 2598 #define __Pyx_FMT_TYPENAME "%.200s"
jpayne@68 2599 #define __Pyx_PyType_GetName(tp) ((tp)->tp_name)
jpayne@68 2600 #define __Pyx_DECREF_TypeName(obj)
jpayne@68 2601 #endif
jpayne@68 2602
jpayne@68 2603 /* CIntFromPy.proto */
jpayne@68 2604 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
jpayne@68 2605
jpayne@68 2606 /* FastTypeChecks.proto */
jpayne@68 2607 #if CYTHON_COMPILING_IN_CPYTHON
jpayne@68 2608 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
jpayne@68 2609 #define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2)
jpayne@68 2610 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
jpayne@68 2611 static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b);
jpayne@68 2612 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
jpayne@68 2613 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
jpayne@68 2614 #else
jpayne@68 2615 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
jpayne@68 2616 #define __Pyx_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2))
jpayne@68 2617 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
jpayne@68 2618 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
jpayne@68 2619 #endif
jpayne@68 2620 #define __Pyx_PyErr_ExceptionMatches2(err1, err2) __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_CurrentExceptionType(), err1, err2)
jpayne@68 2621 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
jpayne@68 2622
jpayne@68 2623 /* CheckBinaryVersion.proto */
jpayne@68 2624 static unsigned long __Pyx_get_runtime_version(void);
jpayne@68 2625 static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer);
jpayne@68 2626
jpayne@68 2627 /* FunctionExport.proto */
jpayne@68 2628 static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig);
jpayne@68 2629
jpayne@68 2630 /* InitStrings.proto */
jpayne@68 2631 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
jpayne@68 2632
jpayne@68 2633 /* #### Code section: module_declarations ### */
jpayne@68 2634 static CYTHON_INLINE double __pyx_f_7cpython_7complex_7complex_4real_real(PyComplexObject *__pyx_v_self); /* proto*/
jpayne@68 2635 static CYTHON_INLINE double __pyx_f_7cpython_7complex_7complex_4imag_imag(PyComplexObject *__pyx_v_self); /* proto*/
jpayne@68 2636
jpayne@68 2637 /* Module declarations from "cython" */
jpayne@68 2638
jpayne@68 2639 /* Module declarations from "cpython.version" */
jpayne@68 2640
jpayne@68 2641 /* Module declarations from "__builtin__" */
jpayne@68 2642
jpayne@68 2643 /* Module declarations from "cpython.type" */
jpayne@68 2644
jpayne@68 2645 /* Module declarations from "libc.string" */
jpayne@68 2646
jpayne@68 2647 /* Module declarations from "libc.stdio" */
jpayne@68 2648
jpayne@68 2649 /* Module declarations from "cpython.object" */
jpayne@68 2650
jpayne@68 2651 /* Module declarations from "cpython.ref" */
jpayne@68 2652
jpayne@68 2653 /* Module declarations from "cpython.exc" */
jpayne@68 2654
jpayne@68 2655 /* Module declarations from "cpython.module" */
jpayne@68 2656
jpayne@68 2657 /* Module declarations from "cpython.mem" */
jpayne@68 2658
jpayne@68 2659 /* Module declarations from "cpython.tuple" */
jpayne@68 2660
jpayne@68 2661 /* Module declarations from "cpython.list" */
jpayne@68 2662
jpayne@68 2663 /* Module declarations from "cpython.sequence" */
jpayne@68 2664
jpayne@68 2665 /* Module declarations from "cpython.mapping" */
jpayne@68 2666
jpayne@68 2667 /* Module declarations from "cpython.iterator" */
jpayne@68 2668
jpayne@68 2669 /* Module declarations from "cpython.number" */
jpayne@68 2670
jpayne@68 2671 /* Module declarations from "cpython.int" */
jpayne@68 2672
jpayne@68 2673 /* Module declarations from "__builtin__" */
jpayne@68 2674
jpayne@68 2675 /* Module declarations from "cpython.bool" */
jpayne@68 2676
jpayne@68 2677 /* Module declarations from "cpython.long" */
jpayne@68 2678
jpayne@68 2679 /* Module declarations from "cpython.float" */
jpayne@68 2680
jpayne@68 2681 /* Module declarations from "__builtin__" */
jpayne@68 2682
jpayne@68 2683 /* Module declarations from "cpython.complex" */
jpayne@68 2684
jpayne@68 2685 /* Module declarations from "cpython.string" */
jpayne@68 2686
jpayne@68 2687 /* Module declarations from "libc.stddef" */
jpayne@68 2688
jpayne@68 2689 /* Module declarations from "cpython.unicode" */
jpayne@68 2690
jpayne@68 2691 /* Module declarations from "cpython.pyport" */
jpayne@68 2692
jpayne@68 2693 /* Module declarations from "cpython.dict" */
jpayne@68 2694
jpayne@68 2695 /* Module declarations from "cpython.instance" */
jpayne@68 2696
jpayne@68 2697 /* Module declarations from "cpython.function" */
jpayne@68 2698
jpayne@68 2699 /* Module declarations from "cpython.method" */
jpayne@68 2700
jpayne@68 2701 /* Module declarations from "cpython.weakref" */
jpayne@68 2702
jpayne@68 2703 /* Module declarations from "cpython.getargs" */
jpayne@68 2704
jpayne@68 2705 /* Module declarations from "cpython.pythread" */
jpayne@68 2706
jpayne@68 2707 /* Module declarations from "cpython.pystate" */
jpayne@68 2708
jpayne@68 2709 /* Module declarations from "cpython.cobject" */
jpayne@68 2710
jpayne@68 2711 /* Module declarations from "cpython.oldbuffer" */
jpayne@68 2712
jpayne@68 2713 /* Module declarations from "cpython.set" */
jpayne@68 2714
jpayne@68 2715 /* Module declarations from "cpython.buffer" */
jpayne@68 2716
jpayne@68 2717 /* Module declarations from "cpython.bytes" */
jpayne@68 2718
jpayne@68 2719 /* Module declarations from "cpython.pycapsule" */
jpayne@68 2720
jpayne@68 2721 /* Module declarations from "cpython.contextvars" */
jpayne@68 2722
jpayne@68 2723 /* Module declarations from "cpython" */
jpayne@68 2724
jpayne@68 2725 /* Module declarations from "array" */
jpayne@68 2726
jpayne@68 2727 /* Module declarations from "cpython.array" */
jpayne@68 2728 static CYTHON_INLINE arrayobject *__pyx_f_7cpython_5array_clone(arrayobject *, Py_ssize_t, int); /*proto*/
jpayne@68 2729 static CYTHON_INLINE int __pyx_f_7cpython_5array_extend_buffer(arrayobject *, char *, Py_ssize_t); /*proto*/
jpayne@68 2730
jpayne@68 2731 /* Module declarations from "libc.errno" */
jpayne@68 2732
jpayne@68 2733 /* Module declarations from "libc.stdlib" */
jpayne@68 2734
jpayne@68 2735 /* Module declarations from "libc.stdint" */
jpayne@68 2736
jpayne@68 2737 /* Module declarations from "posix.types" */
jpayne@68 2738
jpayne@68 2739 /* Module declarations from "posix.fcntl" */
jpayne@68 2740
jpayne@68 2741 /* Module declarations from "posix.unistd" */
jpayne@68 2742
jpayne@68 2743 /* Module declarations from "pysam.libcsamtools" */
jpayne@68 2744
jpayne@68 2745 /* Module declarations from "pysam.libcbcftools" */
jpayne@68 2746
jpayne@68 2747 /* Module declarations from "pysam.libcutils" */
jpayne@68 2748 static int __pyx_v_5pysam_9libcutils_MAX_POS;
jpayne@68 2749 static PyObject *__pyx_v_5pysam_9libcutils_ERROR_HANDLER = 0;
jpayne@68 2750 static PyObject *__pyx_v_5pysam_9libcutils_FILENAME_ENCODING = 0;
jpayne@68 2751 static PyObject *__pyx_v_5pysam_9libcutils_TEXT_ENCODING = 0;
jpayne@68 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@68 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@68 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@68 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@68 2756 static PyObject *__pyx_f_5pysam_9libcutils_get_encoding_error_handler(int __pyx_skip_dispatch); /*proto*/
jpayne@68 2757 static PyObject *__pyx_f_5pysam_9libcutils_set_encoding_error_handler(PyObject *, int __pyx_skip_dispatch); /*proto*/
jpayne@68 2758 static PyObject *__pyx_f_5pysam_9libcutils_force_str(PyObject *, struct __pyx_opt_args_5pysam_9libcutils_force_str *__pyx_optional_args); /*proto*/
jpayne@68 2759 static PyObject *__pyx_f_5pysam_9libcutils_force_bytes(PyObject *, struct __pyx_opt_args_5pysam_9libcutils_force_bytes *__pyx_optional_args); /*proto*/
jpayne@68 2760 /* #### Code section: typeinfo ### */
jpayne@68 2761 /* #### Code section: before_global_var ### */
jpayne@68 2762 #define __Pyx_MODULE_NAME "pysam.libcutils"
jpayne@68 2763 extern int __pyx_module_is_main_pysam__libcutils;
jpayne@68 2764 int __pyx_module_is_main_pysam__libcutils = 0;
jpayne@68 2765
jpayne@68 2766 /* Implementation of "pysam.libcutils" */
jpayne@68 2767 /* #### Code section: global_var ### */
jpayne@68 2768 static PyObject *__pyx_builtin_chr;
jpayne@68 2769 static PyObject *__pyx_builtin_TypeError;
jpayne@68 2770 static PyObject *__pyx_builtin_ValueError;
jpayne@68 2771 static PyObject *__pyx_builtin_OverflowError;
jpayne@68 2772 static PyObject *__pyx_builtin_IOError;
jpayne@68 2773 static PyObject *__pyx_builtin_OSError;
jpayne@68 2774 static PyObject *__pyx_builtin_open;
jpayne@68 2775 static PyObject *__pyx_builtin_UnicodeDecodeError;
jpayne@68 2776 static PyObject *__pyx_builtin_MemoryError;
jpayne@68 2777 /* #### Code section: string_decls ### */
jpayne@68 2778 static const char __pyx_k_[] = "";
jpayne@68 2779 static const char __pyx_k_B[] = "B";
jpayne@68 2780 static const char __pyx_k_a[] = "a";
jpayne@68 2781 static const char __pyx_k_c[] = "-c";
jpayne@68 2782 static const char __pyx_k_i[] = "i";
jpayne@68 2783 static const char __pyx_k_l[] = "l";
jpayne@68 2784 static const char __pyx_k_m[] = "-m";
jpayne@68 2785 static const char __pyx_k_n[] = "n";
jpayne@68 2786 static const char __pyx_k_o[] = "-o";
jpayne@68 2787 static const char __pyx_k_r[] = "r";
jpayne@68 2788 static const char __pyx_k__7[] = ":";
jpayne@68 2789 static const char __pyx_k__8[] = "-";
jpayne@68 2790 static const char __pyx_k_fn[] = "fn";
jpayne@68 2791 static const char __pyx_k_io[] = "io";
jpayne@68 2792 static const char __pyx_k_os[] = "os";
jpayne@68 2793 static const char __pyx_k_rb[] = "rb";
jpayne@68 2794 static const char __pyx_k_re[] = "re";
jpayne@68 2795 static const char __pyx_k__10[] = "-@";
jpayne@68 2796 static const char __pyx_k__11[] = " ";
jpayne@68 2797 static const char __pyx_k__14[] = "*";
jpayne@68 2798 static const char __pyx_k__15[] = ".";
jpayne@68 2799 static const char __pyx_k__33[] = "?";
jpayne@68 2800 static const char __pyx_k_all[] = "__all__";
jpayne@68 2801 static const char __pyx_k_arg[] = "arg";
jpayne@68 2802 static const char __pyx_k_chr[] = "chr";
jpayne@68 2803 static const char __pyx_k_end[] = "end";
jpayne@68 2804 static const char __pyx_k_inf[] = "inf";
jpayne@68 2805 static const char __pyx_k_o_2[] = "-o {}";
jpayne@68 2806 static const char __pyx_k_out[] = "out";
jpayne@68 2807 static const char __pyx_k_roh[] = "roh";
jpayne@68 2808 static const char __pyx_k_sys[] = "sys";
jpayne@68 2809 static const char __pyx_k_args[] = "args";
jpayne@68 2810 static const char __pyx_k_exit[] = "__exit__";
jpayne@68 2811 static const char __pyx_k_head[] = "head";
jpayne@68 2812 static const char __pyx_k_main[] = "__main__";
jpayne@68 2813 static const char __pyx_k_name[] = "name";
jpayne@68 2814 static const char __pyx_k_open[] = "open";
jpayne@68 2815 static const char __pyx_k_path[] = "path";
jpayne@68 2816 static const char __pyx_k_read[] = "read";
jpayne@68 2817 static const char __pyx_k_spec[] = "__spec__";
jpayne@68 2818 static const char __pyx_k_stop[] = "stop";
jpayne@68 2819 static const char __pyx_k_test[] = "__test__";
jpayne@68 2820 static const char __pyx_k_view[] = "view";
jpayne@68 2821 static const char __pyx_k_ascii[] = "ascii";
jpayne@68 2822 static const char __pyx_k_calmd[] = "calmd";
jpayne@68 2823 static const char __pyx_k_cargs[] = "cargs";
jpayne@68 2824 static const char __pyx_k_close[] = "close";
jpayne@68 2825 static const char __pyx_k_depad[] = "depad";
jpayne@68 2826 static const char __pyx_k_enter[] = "__enter__";
jpayne@68 2827 static const char __pyx_k_index[] = "index";
jpayne@68 2828 static const char __pyx_k_split[] = "split";
jpayne@68 2829 static const char __pyx_k_start[] = "start";
jpayne@68 2830 static const char __pyx_k_stats[] = "stats";
jpayne@68 2831 static const char __pyx_k_types[] = "types";
jpayne@68 2832 static const char __pyx_k_utf_8[] = "utf-8";
jpayne@68 2833 static const char __pyx_k_codecs[] = "codecs";
jpayne@68 2834 static const char __pyx_k_contig[] = "contig";
jpayne@68 2835 static const char __pyx_k_decode[] = "decode";
jpayne@68 2836 static const char __pyx_k_encode[] = "encode";
jpayne@68 2837 static const char __pyx_k_exists[] = "exists";
jpayne@68 2838 static const char __pyx_k_extend[] = "extend";
jpayne@68 2839 static const char __pyx_k_format[] = "format";
jpayne@68 2840 static const char __pyx_k_import[] = "__import__";
jpayne@68 2841 static const char __pyx_k_method[] = "method";
jpayne@68 2842 static const char __pyx_k_name_2[] = "__name__";
jpayne@68 2843 static const char __pyx_k_object[] = "object";
jpayne@68 2844 static const char __pyx_k_offset[] = "offset";
jpayne@68 2845 static const char __pyx_k_output[] = "--output";
jpayne@68 2846 static const char __pyx_k_region[] = "region";
jpayne@68 2847 static const char __pyx_k_remove[] = "remove";
jpayne@68 2848 static const char __pyx_k_retval[] = "retval";
jpayne@68 2849 static const char __pyx_k_strict[] = "strict";
jpayne@68 2850 static const char __pyx_k_string[] = "string";
jpayne@68 2851 static const char __pyx_k_IOError[] = "IOError";
jpayne@68 2852 static const char __pyx_k_OSError[] = "OSError";
jpayne@68 2853 static const char __pyx_k_collect[] = "_collect";
jpayne@68 2854 static const char __pyx_k_mkstemp[] = "mkstemp";
jpayne@68 2855 static const char __pyx_k_mpileup[] = "mpileup";
jpayne@68 2856 static const char __pyx_k_threads[] = "--threads";
jpayne@68 2857 static const char __pyx_k_tobytes[] = "tobytes";
jpayne@68 2858 static const char __pyx_k_bcftools[] = "bcftools";
jpayne@68 2859 static const char __pyx_k_fsencode[] = "fsencode";
jpayne@68 2860 static const char __pyx_k_is_usage[] = "is_usage";
jpayne@68 2861 static const char __pyx_k_samtools[] = "samtools";
jpayne@68 2862 static const char __pyx_k_stderr_f[] = "stderr_f";
jpayne@68 2863 static const char __pyx_k_stderr_h[] = "stderr_h";
jpayne@68 2864 static const char __pyx_k_stdout_f[] = "stdout_f";
jpayne@68 2865 static const char __pyx_k_stdout_h[] = "stdout_h";
jpayne@68 2866 static const char __pyx_k_tempfile[] = "tempfile";
jpayne@68 2867 static const char __pyx_k_ARGUMENTS[] = "ARGUMENTS";
jpayne@68 2868 static const char __pyx_k_TypeError[] = "TypeError";
jpayne@68 2869 static const char __pyx_k_exception[] = "exception";
jpayne@68 2870 static const char __pyx_k_input_str[] = "input_str";
jpayne@68 2871 static const char __pyx_k_min_shift[] = "--min-shift";
jpayne@68 2872 static const char __pyx_k_qualities[] = "qualities";
jpayne@68 2873 static const char __pyx_k_reference[] = "reference";
jpayne@68 2874 static const char __pyx_k_skip_next[] = "skip_next";
jpayne@68 2875 static const char __pyx_k_ValueError[] = "ValueError";
jpayne@68 2876 static const char __pyx_k_collection[] = "collection";
jpayne@68 2877 static const char __pyx_k_contextlib[] = "contextlib";
jpayne@68 2878 static const char __pyx_k_extra_args[] = "extra_args";
jpayne@68 2879 static const char __pyx_k_out_stderr[] = "out_stderr";
jpayne@68 2880 static const char __pyx_k_out_stdout[] = "out_stdout";
jpayne@68 2881 static const char __pyx_k_startswith[] = "startswith";
jpayne@68 2882 static const char __pyx_k_MemoryError[] = "MemoryError";
jpayne@68 2883 static const char __pyx_k_output_file[] = "--output-file";
jpayne@68 2884 static const char __pyx_k_save_stdout[] = "save_stdout";
jpayne@68 2885 static const char __pyx_k_catch_stdout[] = "catch_stdout";
jpayne@68 2886 static const char __pyx_k_initializing[] = "_initializing";
jpayne@68 2887 static const char __pyx_k_is_coroutine[] = "_is_coroutine";
jpayne@68 2888 static const char __pyx_k_parse_region[] = "parse_region";
jpayne@68 2889 static const char __pyx_k_OverflowError[] = "OverflowError";
jpayne@68 2890 static const char __pyx_k_class_getitem[] = "__class_getitem__";
jpayne@68 2891 static const char __pyx_k_stdout_option[] = "stdout_option";
jpayne@68 2892 static const char __pyx_k_contextmanager[] = "contextmanager";
jpayne@68 2893 static const char __pyx_k_latin1_replace[] = "latin1_replace";
jpayne@68 2894 static const char __pyx_k_pysam_dispatch[] = "_pysam_dispatch";
jpayne@68 2895 static const char __pyx_k_register_error[] = "register_error";
jpayne@68 2896 static const char __pyx_k_pysam_libcutils[] = "pysam.libcutils";
jpayne@68 2897 static const char __pyx_k_MAP_STDOUT_OPTIONS[] = "MAP_STDOUT_OPTIONS";
jpayne@68 2898 static const char __pyx_k_UnicodeDecodeError[] = "UnicodeDecodeError";
jpayne@68 2899 static const char __pyx_k_asyncio_coroutines[] = "asyncio.coroutines";
jpayne@68 2900 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
jpayne@68 2901 static const char __pyx_k_getdefaultencoding[] = "getdefaultencoding";
jpayne@68 2902 static const char __pyx_k_pysam_latin1replace[] = "pysam.latin1replace";
jpayne@68 2903 static const char __pyx_k_pysam_libcutils_pyx[] = "pysam/libcutils.pyx";
jpayne@68 2904 static const char __pyx_k_stop_out_of_range_i[] = "stop out of range (%i)";
jpayne@68 2905 static const char __pyx_k_start_out_of_range_i[] = "start out of range (%i)";
jpayne@68 2906 static const char __pyx_k_getfilesystemencoding[] = "getfilesystemencoding";
jpayne@68 2907 static const char __pyx_k_array_to_qualitystring[] = "array_to_qualitystring";
jpayne@68 2908 static const char __pyx_k_qualitystring_to_array[] = "qualitystring_to_array";
jpayne@68 2909 static const char __pyx_k_get_encoding_error_handler[] = "get_encoding_error_handler";
jpayne@68 2910 static const char __pyx_k_qualities_to_qualitystring[] = "qualities_to_qualitystring";
jpayne@68 2911 static const char __pyx_k_set_encoding_error_handler[] = "set_encoding_error_handler";
jpayne@68 2912 static const char __pyx_k_No_such_file_or_directory_s[] = "No such file or directory: '%s'";
jpayne@68 2913 static const char __pyx_k_pysam_dispatch_locals__collect[] = "_pysam_dispatch.<locals>._collect";
jpayne@68 2914 static const char __pyx_k_contig_and_reference_should_not[] = "contig and reference should not both be specified";
jpayne@68 2915 static const char __pyx_k_stop_and_end_should_not_both_be[] = "stop and end should not both be specified";
jpayne@68 2916 static const char __pyx_k_Argument_must_be_string_bytes_or[] = "Argument must be string, bytes or unicode.";
jpayne@68 2917 static const char __pyx_k_contig_reference_and_region_shou[] = "contig/reference and region should not both be specified";
jpayne@68 2918 static const char __pyx_k_error_while_opening_file_for_wri[] = "error while opening file for writing";
jpayne@68 2919 static const char __pyx_k_invalid_coordinates_start_i_stop[] = "invalid coordinates: start (%i) > stop (%i)";
jpayne@68 2920 static const char __pyx_k_neither_contig_nor_region_are_gi[] = "neither contig nor region are given";
jpayne@68 2921 /* #### Code section: decls ### */
jpayne@68 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@68 2923 static void __pyx_pf_7cpython_5array_5array_2__releasebuffer__(CYTHON_UNUSED arrayobject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */
jpayne@68 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@68 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@68 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@68 2927 static PyObject *__pyx_pf_5pysam_9libcutils_6latin1_replace(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_exception); /* proto */
jpayne@68 2928 static PyObject *__pyx_pf_5pysam_9libcutils_8get_encoding_error_handler(CYTHON_UNUSED PyObject *__pyx_self); /* proto */
jpayne@68 2929 static PyObject *__pyx_pf_5pysam_9libcutils_10set_encoding_error_handler(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_name); /* proto */
jpayne@68 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@68 2931 static PyObject *__pyx_pf_5pysam_9libcutils_15_pysam_dispatch__collect(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fn); /* proto */
jpayne@68 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@68 2933 /* #### Code section: late_includes ### */
jpayne@68 2934 /* #### Code section: module_state ### */
jpayne@68 2935 typedef struct {
jpayne@68 2936 PyObject *__pyx_d;
jpayne@68 2937 PyObject *__pyx_b;
jpayne@68 2938 PyObject *__pyx_cython_runtime;
jpayne@68 2939 PyObject *__pyx_empty_tuple;
jpayne@68 2940 PyObject *__pyx_empty_bytes;
jpayne@68 2941 PyObject *__pyx_empty_unicode;
jpayne@68 2942 #ifdef __Pyx_CyFunction_USED
jpayne@68 2943 PyTypeObject *__pyx_CyFunctionType;
jpayne@68 2944 #endif
jpayne@68 2945 #ifdef __Pyx_FusedFunction_USED
jpayne@68 2946 PyTypeObject *__pyx_FusedFunctionType;
jpayne@68 2947 #endif
jpayne@68 2948 #ifdef __Pyx_Generator_USED
jpayne@68 2949 PyTypeObject *__pyx_GeneratorType;
jpayne@68 2950 #endif
jpayne@68 2951 #ifdef __Pyx_IterableCoroutine_USED
jpayne@68 2952 PyTypeObject *__pyx_IterableCoroutineType;
jpayne@68 2953 #endif
jpayne@68 2954 #ifdef __Pyx_Coroutine_USED
jpayne@68 2955 PyTypeObject *__pyx_CoroutineAwaitType;
jpayne@68 2956 #endif
jpayne@68 2957 #ifdef __Pyx_Coroutine_USED
jpayne@68 2958 PyTypeObject *__pyx_CoroutineType;
jpayne@68 2959 #endif
jpayne@68 2960 #if CYTHON_USE_MODULE_STATE
jpayne@68 2961 #endif
jpayne@68 2962 #if CYTHON_USE_MODULE_STATE
jpayne@68 2963 #endif
jpayne@68 2964 #if CYTHON_USE_MODULE_STATE
jpayne@68 2965 #endif
jpayne@68 2966 #if CYTHON_USE_MODULE_STATE
jpayne@68 2967 #endif
jpayne@68 2968 PyTypeObject *__pyx_ptype_7cpython_4type_type;
jpayne@68 2969 #if CYTHON_USE_MODULE_STATE
jpayne@68 2970 #endif
jpayne@68 2971 #if CYTHON_USE_MODULE_STATE
jpayne@68 2972 #endif
jpayne@68 2973 #if CYTHON_USE_MODULE_STATE
jpayne@68 2974 #endif
jpayne@68 2975 #if CYTHON_USE_MODULE_STATE
jpayne@68 2976 #endif
jpayne@68 2977 #if CYTHON_USE_MODULE_STATE
jpayne@68 2978 #endif
jpayne@68 2979 #if CYTHON_USE_MODULE_STATE
jpayne@68 2980 #endif
jpayne@68 2981 #if CYTHON_USE_MODULE_STATE
jpayne@68 2982 #endif
jpayne@68 2983 #if CYTHON_USE_MODULE_STATE
jpayne@68 2984 #endif
jpayne@68 2985 #if CYTHON_USE_MODULE_STATE
jpayne@68 2986 #endif
jpayne@68 2987 #if CYTHON_USE_MODULE_STATE
jpayne@68 2988 #endif
jpayne@68 2989 #if CYTHON_USE_MODULE_STATE
jpayne@68 2990 #endif
jpayne@68 2991 #if CYTHON_USE_MODULE_STATE
jpayne@68 2992 #endif
jpayne@68 2993 #if CYTHON_USE_MODULE_STATE
jpayne@68 2994 #endif
jpayne@68 2995 #if CYTHON_USE_MODULE_STATE
jpayne@68 2996 #endif
jpayne@68 2997 #if CYTHON_USE_MODULE_STATE
jpayne@68 2998 #endif
jpayne@68 2999 #if CYTHON_USE_MODULE_STATE
jpayne@68 3000 #endif
jpayne@68 3001 PyTypeObject *__pyx_ptype_7cpython_4bool_bool;
jpayne@68 3002 #if CYTHON_USE_MODULE_STATE
jpayne@68 3003 #endif
jpayne@68 3004 #if CYTHON_USE_MODULE_STATE
jpayne@68 3005 #endif
jpayne@68 3006 #if CYTHON_USE_MODULE_STATE
jpayne@68 3007 #endif
jpayne@68 3008 #if CYTHON_USE_MODULE_STATE
jpayne@68 3009 #endif
jpayne@68 3010 PyTypeObject *__pyx_ptype_7cpython_7complex_complex;
jpayne@68 3011 #if CYTHON_USE_MODULE_STATE
jpayne@68 3012 #endif
jpayne@68 3013 #if CYTHON_USE_MODULE_STATE
jpayne@68 3014 #endif
jpayne@68 3015 #if CYTHON_USE_MODULE_STATE
jpayne@68 3016 #endif
jpayne@68 3017 #if CYTHON_USE_MODULE_STATE
jpayne@68 3018 #endif
jpayne@68 3019 #if CYTHON_USE_MODULE_STATE
jpayne@68 3020 #endif
jpayne@68 3021 #if CYTHON_USE_MODULE_STATE
jpayne@68 3022 #endif
jpayne@68 3023 #if CYTHON_USE_MODULE_STATE
jpayne@68 3024 #endif
jpayne@68 3025 #if CYTHON_USE_MODULE_STATE
jpayne@68 3026 #endif
jpayne@68 3027 #if CYTHON_USE_MODULE_STATE
jpayne@68 3028 #endif
jpayne@68 3029 #if CYTHON_USE_MODULE_STATE
jpayne@68 3030 #endif
jpayne@68 3031 #if CYTHON_USE_MODULE_STATE
jpayne@68 3032 #endif
jpayne@68 3033 #if CYTHON_USE_MODULE_STATE
jpayne@68 3034 #endif
jpayne@68 3035 #if CYTHON_USE_MODULE_STATE
jpayne@68 3036 #endif
jpayne@68 3037 #if CYTHON_USE_MODULE_STATE
jpayne@68 3038 #endif
jpayne@68 3039 #if CYTHON_USE_MODULE_STATE
jpayne@68 3040 #endif
jpayne@68 3041 #if CYTHON_USE_MODULE_STATE
jpayne@68 3042 #endif
jpayne@68 3043 #if CYTHON_USE_MODULE_STATE
jpayne@68 3044 #endif
jpayne@68 3045 #if CYTHON_USE_MODULE_STATE
jpayne@68 3046 #endif
jpayne@68 3047 #if CYTHON_USE_MODULE_STATE
jpayne@68 3048 #endif
jpayne@68 3049 #if CYTHON_USE_MODULE_STATE
jpayne@68 3050 #endif
jpayne@68 3051 #if CYTHON_USE_MODULE_STATE
jpayne@68 3052 #endif
jpayne@68 3053 #if CYTHON_USE_MODULE_STATE
jpayne@68 3054 #endif
jpayne@68 3055 PyTypeObject *__pyx_ptype_7cpython_5array_array;
jpayne@68 3056 #if CYTHON_USE_MODULE_STATE
jpayne@68 3057 #endif
jpayne@68 3058 #if CYTHON_USE_MODULE_STATE
jpayne@68 3059 #endif
jpayne@68 3060 #if CYTHON_USE_MODULE_STATE
jpayne@68 3061 #endif
jpayne@68 3062 #if CYTHON_USE_MODULE_STATE
jpayne@68 3063 #endif
jpayne@68 3064 #if CYTHON_USE_MODULE_STATE
jpayne@68 3065 #endif
jpayne@68 3066 #if CYTHON_USE_MODULE_STATE
jpayne@68 3067 #endif
jpayne@68 3068 #if CYTHON_USE_MODULE_STATE
jpayne@68 3069 #endif
jpayne@68 3070 #if CYTHON_USE_MODULE_STATE
jpayne@68 3071 #endif
jpayne@68 3072 #if CYTHON_USE_MODULE_STATE
jpayne@68 3073 #endif
jpayne@68 3074 PyObject *__pyx_kp_u_;
jpayne@68 3075 PyObject *__pyx_n_s_ARGUMENTS;
jpayne@68 3076 PyObject *__pyx_kp_u_Argument_must_be_string_bytes_or;
jpayne@68 3077 PyObject *__pyx_n_u_B;
jpayne@68 3078 PyObject *__pyx_n_s_IOError;
jpayne@68 3079 PyObject *__pyx_n_s_MAP_STDOUT_OPTIONS;
jpayne@68 3080 PyObject *__pyx_n_s_MemoryError;
jpayne@68 3081 PyObject *__pyx_kp_u_No_such_file_or_directory_s;
jpayne@68 3082 PyObject *__pyx_n_s_OSError;
jpayne@68 3083 PyObject *__pyx_n_s_OverflowError;
jpayne@68 3084 PyObject *__pyx_n_s_TypeError;
jpayne@68 3085 PyObject *__pyx_n_s_UnicodeDecodeError;
jpayne@68 3086 PyObject *__pyx_n_s_ValueError;
jpayne@68 3087 PyObject *__pyx_kp_u__10;
jpayne@68 3088 PyObject *__pyx_kp_u__11;
jpayne@68 3089 PyObject *__pyx_n_s__14;
jpayne@68 3090 PyObject *__pyx_kp_u__15;
jpayne@68 3091 PyObject *__pyx_n_s__33;
jpayne@68 3092 PyObject *__pyx_kp_u__7;
jpayne@68 3093 PyObject *__pyx_kp_u__8;
jpayne@68 3094 PyObject *__pyx_n_s_a;
jpayne@68 3095 PyObject *__pyx_n_s_all;
jpayne@68 3096 PyObject *__pyx_n_s_arg;
jpayne@68 3097 PyObject *__pyx_n_s_args;
jpayne@68 3098 PyObject *__pyx_n_s_array_to_qualitystring;
jpayne@68 3099 PyObject *__pyx_n_u_array_to_qualitystring;
jpayne@68 3100 PyObject *__pyx_n_u_ascii;
jpayne@68 3101 PyObject *__pyx_n_s_asyncio_coroutines;
jpayne@68 3102 PyObject *__pyx_n_b_bcftools;
jpayne@68 3103 PyObject *__pyx_n_u_bcftools;
jpayne@68 3104 PyObject *__pyx_kp_u_c;
jpayne@68 3105 PyObject *__pyx_n_u_calmd;
jpayne@68 3106 PyObject *__pyx_n_s_cargs;
jpayne@68 3107 PyObject *__pyx_n_s_catch_stdout;
jpayne@68 3108 PyObject *__pyx_n_s_chr;
jpayne@68 3109 PyObject *__pyx_n_s_class_getitem;
jpayne@68 3110 PyObject *__pyx_n_s_cline_in_traceback;
jpayne@68 3111 PyObject *__pyx_n_s_close;
jpayne@68 3112 PyObject *__pyx_n_s_codecs;
jpayne@68 3113 PyObject *__pyx_n_s_collect;
jpayne@68 3114 PyObject *__pyx_n_s_collection;
jpayne@68 3115 PyObject *__pyx_n_s_contextlib;
jpayne@68 3116 PyObject *__pyx_n_s_contextmanager;
jpayne@68 3117 PyObject *__pyx_n_s_contig;
jpayne@68 3118 PyObject *__pyx_kp_u_contig_and_reference_should_not;
jpayne@68 3119 PyObject *__pyx_kp_u_contig_reference_and_region_shou;
jpayne@68 3120 PyObject *__pyx_n_s_decode;
jpayne@68 3121 PyObject *__pyx_n_u_depad;
jpayne@68 3122 PyObject *__pyx_n_s_encode;
jpayne@68 3123 PyObject *__pyx_n_s_end;
jpayne@68 3124 PyObject *__pyx_n_s_enter;
jpayne@68 3125 PyObject *__pyx_kp_u_error_while_opening_file_for_wri;
jpayne@68 3126 PyObject *__pyx_n_s_exception;
jpayne@68 3127 PyObject *__pyx_n_s_exists;
jpayne@68 3128 PyObject *__pyx_n_s_exit;
jpayne@68 3129 PyObject *__pyx_n_s_extend;
jpayne@68 3130 PyObject *__pyx_n_s_extra_args;
jpayne@68 3131 PyObject *__pyx_n_s_fn;
jpayne@68 3132 PyObject *__pyx_n_s_format;
jpayne@68 3133 PyObject *__pyx_n_s_fsencode;
jpayne@68 3134 PyObject *__pyx_n_s_get_encoding_error_handler;
jpayne@68 3135 PyObject *__pyx_n_u_get_encoding_error_handler;
jpayne@68 3136 PyObject *__pyx_n_s_getdefaultencoding;
jpayne@68 3137 PyObject *__pyx_n_s_getfilesystemencoding;
jpayne@68 3138 PyObject *__pyx_n_u_head;
jpayne@68 3139 PyObject *__pyx_n_s_i;
jpayne@68 3140 PyObject *__pyx_n_s_import;
jpayne@68 3141 PyObject *__pyx_n_b_index;
jpayne@68 3142 PyObject *__pyx_n_u_index;
jpayne@68 3143 PyObject *__pyx_n_s_inf;
jpayne@68 3144 PyObject *__pyx_n_s_initializing;
jpayne@68 3145 PyObject *__pyx_n_s_input_str;
jpayne@68 3146 PyObject *__pyx_kp_u_invalid_coordinates_start_i_stop;
jpayne@68 3147 PyObject *__pyx_n_s_io;
jpayne@68 3148 PyObject *__pyx_n_s_is_coroutine;
jpayne@68 3149 PyObject *__pyx_n_s_is_usage;
jpayne@68 3150 PyObject *__pyx_n_s_l;
jpayne@68 3151 PyObject *__pyx_n_s_latin1_replace;
jpayne@68 3152 PyObject *__pyx_kp_u_m;
jpayne@68 3153 PyObject *__pyx_n_s_main;
jpayne@68 3154 PyObject *__pyx_n_s_method;
jpayne@68 3155 PyObject *__pyx_kp_u_min_shift;
jpayne@68 3156 PyObject *__pyx_n_s_mkstemp;
jpayne@68 3157 PyObject *__pyx_n_u_mpileup;
jpayne@68 3158 PyObject *__pyx_n_s_n;
jpayne@68 3159 PyObject *__pyx_n_s_name;
jpayne@68 3160 PyObject *__pyx_n_s_name_2;
jpayne@68 3161 PyObject *__pyx_kp_u_neither_contig_nor_region_are_gi;
jpayne@68 3162 PyObject *__pyx_kp_u_o;
jpayne@68 3163 PyObject *__pyx_kp_u_o_2;
jpayne@68 3164 PyObject *__pyx_n_s_object;
jpayne@68 3165 PyObject *__pyx_n_s_offset;
jpayne@68 3166 PyObject *__pyx_n_s_open;
jpayne@68 3167 PyObject *__pyx_n_s_os;
jpayne@68 3168 PyObject *__pyx_n_s_out;
jpayne@68 3169 PyObject *__pyx_n_s_out_stderr;
jpayne@68 3170 PyObject *__pyx_n_s_out_stdout;
jpayne@68 3171 PyObject *__pyx_kp_u_output;
jpayne@68 3172 PyObject *__pyx_kp_u_output_file;
jpayne@68 3173 PyObject *__pyx_n_s_parse_region;
jpayne@68 3174 PyObject *__pyx_n_s_path;
jpayne@68 3175 PyObject *__pyx_n_s_pysam_dispatch;
jpayne@68 3176 PyObject *__pyx_n_s_pysam_dispatch_locals__collect;
jpayne@68 3177 PyObject *__pyx_kp_u_pysam_latin1replace;
jpayne@68 3178 PyObject *__pyx_n_s_pysam_libcutils;
jpayne@68 3179 PyObject *__pyx_kp_s_pysam_libcutils_pyx;
jpayne@68 3180 PyObject *__pyx_n_s_qualities;
jpayne@68 3181 PyObject *__pyx_n_s_qualities_to_qualitystring;
jpayne@68 3182 PyObject *__pyx_n_u_qualities_to_qualitystring;
jpayne@68 3183 PyObject *__pyx_n_s_qualitystring_to_array;
jpayne@68 3184 PyObject *__pyx_n_u_qualitystring_to_array;
jpayne@68 3185 PyObject *__pyx_n_u_r;
jpayne@68 3186 PyObject *__pyx_n_u_rb;
jpayne@68 3187 PyObject *__pyx_n_s_re;
jpayne@68 3188 PyObject *__pyx_n_s_read;
jpayne@68 3189 PyObject *__pyx_n_s_reference;
jpayne@68 3190 PyObject *__pyx_n_s_region;
jpayne@68 3191 PyObject *__pyx_n_s_register_error;
jpayne@68 3192 PyObject *__pyx_n_s_remove;
jpayne@68 3193 PyObject *__pyx_n_s_retval;
jpayne@68 3194 PyObject *__pyx_n_u_roh;
jpayne@68 3195 PyObject *__pyx_n_b_samtools;
jpayne@68 3196 PyObject *__pyx_n_u_samtools;
jpayne@68 3197 PyObject *__pyx_n_s_save_stdout;
jpayne@68 3198 PyObject *__pyx_n_s_set_encoding_error_handler;
jpayne@68 3199 PyObject *__pyx_n_u_set_encoding_error_handler;
jpayne@68 3200 PyObject *__pyx_n_s_skip_next;
jpayne@68 3201 PyObject *__pyx_n_s_spec;
jpayne@68 3202 PyObject *__pyx_n_s_split;
jpayne@68 3203 PyObject *__pyx_n_s_start;
jpayne@68 3204 PyObject *__pyx_kp_u_start_out_of_range_i;
jpayne@68 3205 PyObject *__pyx_n_s_startswith;
jpayne@68 3206 PyObject *__pyx_n_u_stats;
jpayne@68 3207 PyObject *__pyx_n_s_stderr_f;
jpayne@68 3208 PyObject *__pyx_n_s_stderr_h;
jpayne@68 3209 PyObject *__pyx_n_s_stdout_f;
jpayne@68 3210 PyObject *__pyx_n_s_stdout_h;
jpayne@68 3211 PyObject *__pyx_n_s_stdout_option;
jpayne@68 3212 PyObject *__pyx_n_s_stop;
jpayne@68 3213 PyObject *__pyx_kp_u_stop_and_end_should_not_both_be;
jpayne@68 3214 PyObject *__pyx_kp_u_stop_out_of_range_i;
jpayne@68 3215 PyObject *__pyx_n_u_strict;
jpayne@68 3216 PyObject *__pyx_n_s_string;
jpayne@68 3217 PyObject *__pyx_n_s_sys;
jpayne@68 3218 PyObject *__pyx_n_s_tempfile;
jpayne@68 3219 PyObject *__pyx_n_s_test;
jpayne@68 3220 PyObject *__pyx_kp_u_threads;
jpayne@68 3221 PyObject *__pyx_n_s_tobytes;
jpayne@68 3222 PyObject *__pyx_n_s_types;
jpayne@68 3223 PyObject *__pyx_kp_u_utf_8;
jpayne@68 3224 PyObject *__pyx_n_u_view;
jpayne@68 3225 PyObject *__pyx_int_1;
jpayne@68 3226 PyObject *__pyx_int_33;
jpayne@68 3227 PyObject *__pyx_int_neg_1;
jpayne@68 3228 PyObject *__pyx_tuple__2;
jpayne@68 3229 PyObject *__pyx_tuple__3;
jpayne@68 3230 PyObject *__pyx_tuple__4;
jpayne@68 3231 PyObject *__pyx_tuple__5;
jpayne@68 3232 PyObject *__pyx_tuple__6;
jpayne@68 3233 PyObject *__pyx_tuple__9;
jpayne@68 3234 PyObject *__pyx_tuple__12;
jpayne@68 3235 PyObject *__pyx_tuple__16;
jpayne@68 3236 PyObject *__pyx_tuple__18;
jpayne@68 3237 PyObject *__pyx_tuple__19;
jpayne@68 3238 PyObject *__pyx_tuple__22;
jpayne@68 3239 PyObject *__pyx_tuple__25;
jpayne@68 3240 PyObject *__pyx_tuple__27;
jpayne@68 3241 PyObject *__pyx_tuple__29;
jpayne@68 3242 PyObject *__pyx_tuple__30;
jpayne@68 3243 PyObject *__pyx_tuple__32;
jpayne@68 3244 PyObject *__pyx_codeobj__13;
jpayne@68 3245 PyObject *__pyx_codeobj__17;
jpayne@68 3246 PyObject *__pyx_codeobj__20;
jpayne@68 3247 PyObject *__pyx_codeobj__21;
jpayne@68 3248 PyObject *__pyx_codeobj__23;
jpayne@68 3249 PyObject *__pyx_codeobj__24;
jpayne@68 3250 PyObject *__pyx_codeobj__26;
jpayne@68 3251 PyObject *__pyx_codeobj__28;
jpayne@68 3252 PyObject *__pyx_codeobj__31;
jpayne@68 3253 } __pyx_mstate;
jpayne@68 3254
jpayne@68 3255 #if CYTHON_USE_MODULE_STATE
jpayne@68 3256 #ifdef __cplusplus
jpayne@68 3257 namespace {
jpayne@68 3258 extern struct PyModuleDef __pyx_moduledef;
jpayne@68 3259 } /* anonymous namespace */
jpayne@68 3260 #else
jpayne@68 3261 static struct PyModuleDef __pyx_moduledef;
jpayne@68 3262 #endif
jpayne@68 3263
jpayne@68 3264 #define __pyx_mstate(o) ((__pyx_mstate *)__Pyx_PyModule_GetState(o))
jpayne@68 3265
jpayne@68 3266 #define __pyx_mstate_global (__pyx_mstate(PyState_FindModule(&__pyx_moduledef)))
jpayne@68 3267
jpayne@68 3268 #define __pyx_m (PyState_FindModule(&__pyx_moduledef))
jpayne@68 3269 #else
jpayne@68 3270 static __pyx_mstate __pyx_mstate_global_static =
jpayne@68 3271 #ifdef __cplusplus
jpayne@68 3272 {};
jpayne@68 3273 #else
jpayne@68 3274 {0};
jpayne@68 3275 #endif
jpayne@68 3276 static __pyx_mstate *__pyx_mstate_global = &__pyx_mstate_global_static;
jpayne@68 3277 #endif
jpayne@68 3278 /* #### Code section: module_state_clear ### */
jpayne@68 3279 #if CYTHON_USE_MODULE_STATE
jpayne@68 3280 static int __pyx_m_clear(PyObject *m) {
jpayne@68 3281 __pyx_mstate *clear_module_state = __pyx_mstate(m);
jpayne@68 3282 if (!clear_module_state) return 0;
jpayne@68 3283 Py_CLEAR(clear_module_state->__pyx_d);
jpayne@68 3284 Py_CLEAR(clear_module_state->__pyx_b);
jpayne@68 3285 Py_CLEAR(clear_module_state->__pyx_cython_runtime);
jpayne@68 3286 Py_CLEAR(clear_module_state->__pyx_empty_tuple);
jpayne@68 3287 Py_CLEAR(clear_module_state->__pyx_empty_bytes);
jpayne@68 3288 Py_CLEAR(clear_module_state->__pyx_empty_unicode);
jpayne@68 3289 #ifdef __Pyx_CyFunction_USED
jpayne@68 3290 Py_CLEAR(clear_module_state->__pyx_CyFunctionType);
jpayne@68 3291 #endif
jpayne@68 3292 #ifdef __Pyx_FusedFunction_USED
jpayne@68 3293 Py_CLEAR(clear_module_state->__pyx_FusedFunctionType);
jpayne@68 3294 #endif
jpayne@68 3295 Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_4type_type);
jpayne@68 3296 Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_4bool_bool);
jpayne@68 3297 Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_7complex_complex);
jpayne@68 3298 Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_5array_array);
jpayne@68 3299 Py_CLEAR(clear_module_state->__pyx_kp_u_);
jpayne@68 3300 Py_CLEAR(clear_module_state->__pyx_n_s_ARGUMENTS);
jpayne@68 3301 Py_CLEAR(clear_module_state->__pyx_kp_u_Argument_must_be_string_bytes_or);
jpayne@68 3302 Py_CLEAR(clear_module_state->__pyx_n_u_B);
jpayne@68 3303 Py_CLEAR(clear_module_state->__pyx_n_s_IOError);
jpayne@68 3304 Py_CLEAR(clear_module_state->__pyx_n_s_MAP_STDOUT_OPTIONS);
jpayne@68 3305 Py_CLEAR(clear_module_state->__pyx_n_s_MemoryError);
jpayne@68 3306 Py_CLEAR(clear_module_state->__pyx_kp_u_No_such_file_or_directory_s);
jpayne@68 3307 Py_CLEAR(clear_module_state->__pyx_n_s_OSError);
jpayne@68 3308 Py_CLEAR(clear_module_state->__pyx_n_s_OverflowError);
jpayne@68 3309 Py_CLEAR(clear_module_state->__pyx_n_s_TypeError);
jpayne@68 3310 Py_CLEAR(clear_module_state->__pyx_n_s_UnicodeDecodeError);
jpayne@68 3311 Py_CLEAR(clear_module_state->__pyx_n_s_ValueError);
jpayne@68 3312 Py_CLEAR(clear_module_state->__pyx_kp_u__10);
jpayne@68 3313 Py_CLEAR(clear_module_state->__pyx_kp_u__11);
jpayne@68 3314 Py_CLEAR(clear_module_state->__pyx_n_s__14);
jpayne@68 3315 Py_CLEAR(clear_module_state->__pyx_kp_u__15);
jpayne@68 3316 Py_CLEAR(clear_module_state->__pyx_n_s__33);
jpayne@68 3317 Py_CLEAR(clear_module_state->__pyx_kp_u__7);
jpayne@68 3318 Py_CLEAR(clear_module_state->__pyx_kp_u__8);
jpayne@68 3319 Py_CLEAR(clear_module_state->__pyx_n_s_a);
jpayne@68 3320 Py_CLEAR(clear_module_state->__pyx_n_s_all);
jpayne@68 3321 Py_CLEAR(clear_module_state->__pyx_n_s_arg);
jpayne@68 3322 Py_CLEAR(clear_module_state->__pyx_n_s_args);
jpayne@68 3323 Py_CLEAR(clear_module_state->__pyx_n_s_array_to_qualitystring);
jpayne@68 3324 Py_CLEAR(clear_module_state->__pyx_n_u_array_to_qualitystring);
jpayne@68 3325 Py_CLEAR(clear_module_state->__pyx_n_u_ascii);
jpayne@68 3326 Py_CLEAR(clear_module_state->__pyx_n_s_asyncio_coroutines);
jpayne@68 3327 Py_CLEAR(clear_module_state->__pyx_n_b_bcftools);
jpayne@68 3328 Py_CLEAR(clear_module_state->__pyx_n_u_bcftools);
jpayne@68 3329 Py_CLEAR(clear_module_state->__pyx_kp_u_c);
jpayne@68 3330 Py_CLEAR(clear_module_state->__pyx_n_u_calmd);
jpayne@68 3331 Py_CLEAR(clear_module_state->__pyx_n_s_cargs);
jpayne@68 3332 Py_CLEAR(clear_module_state->__pyx_n_s_catch_stdout);
jpayne@68 3333 Py_CLEAR(clear_module_state->__pyx_n_s_chr);
jpayne@68 3334 Py_CLEAR(clear_module_state->__pyx_n_s_class_getitem);
jpayne@68 3335 Py_CLEAR(clear_module_state->__pyx_n_s_cline_in_traceback);
jpayne@68 3336 Py_CLEAR(clear_module_state->__pyx_n_s_close);
jpayne@68 3337 Py_CLEAR(clear_module_state->__pyx_n_s_codecs);
jpayne@68 3338 Py_CLEAR(clear_module_state->__pyx_n_s_collect);
jpayne@68 3339 Py_CLEAR(clear_module_state->__pyx_n_s_collection);
jpayne@68 3340 Py_CLEAR(clear_module_state->__pyx_n_s_contextlib);
jpayne@68 3341 Py_CLEAR(clear_module_state->__pyx_n_s_contextmanager);
jpayne@68 3342 Py_CLEAR(clear_module_state->__pyx_n_s_contig);
jpayne@68 3343 Py_CLEAR(clear_module_state->__pyx_kp_u_contig_and_reference_should_not);
jpayne@68 3344 Py_CLEAR(clear_module_state->__pyx_kp_u_contig_reference_and_region_shou);
jpayne@68 3345 Py_CLEAR(clear_module_state->__pyx_n_s_decode);
jpayne@68 3346 Py_CLEAR(clear_module_state->__pyx_n_u_depad);
jpayne@68 3347 Py_CLEAR(clear_module_state->__pyx_n_s_encode);
jpayne@68 3348 Py_CLEAR(clear_module_state->__pyx_n_s_end);
jpayne@68 3349 Py_CLEAR(clear_module_state->__pyx_n_s_enter);
jpayne@68 3350 Py_CLEAR(clear_module_state->__pyx_kp_u_error_while_opening_file_for_wri);
jpayne@68 3351 Py_CLEAR(clear_module_state->__pyx_n_s_exception);
jpayne@68 3352 Py_CLEAR(clear_module_state->__pyx_n_s_exists);
jpayne@68 3353 Py_CLEAR(clear_module_state->__pyx_n_s_exit);
jpayne@68 3354 Py_CLEAR(clear_module_state->__pyx_n_s_extend);
jpayne@68 3355 Py_CLEAR(clear_module_state->__pyx_n_s_extra_args);
jpayne@68 3356 Py_CLEAR(clear_module_state->__pyx_n_s_fn);
jpayne@68 3357 Py_CLEAR(clear_module_state->__pyx_n_s_format);
jpayne@68 3358 Py_CLEAR(clear_module_state->__pyx_n_s_fsencode);
jpayne@68 3359 Py_CLEAR(clear_module_state->__pyx_n_s_get_encoding_error_handler);
jpayne@68 3360 Py_CLEAR(clear_module_state->__pyx_n_u_get_encoding_error_handler);
jpayne@68 3361 Py_CLEAR(clear_module_state->__pyx_n_s_getdefaultencoding);
jpayne@68 3362 Py_CLEAR(clear_module_state->__pyx_n_s_getfilesystemencoding);
jpayne@68 3363 Py_CLEAR(clear_module_state->__pyx_n_u_head);
jpayne@68 3364 Py_CLEAR(clear_module_state->__pyx_n_s_i);
jpayne@68 3365 Py_CLEAR(clear_module_state->__pyx_n_s_import);
jpayne@68 3366 Py_CLEAR(clear_module_state->__pyx_n_b_index);
jpayne@68 3367 Py_CLEAR(clear_module_state->__pyx_n_u_index);
jpayne@68 3368 Py_CLEAR(clear_module_state->__pyx_n_s_inf);
jpayne@68 3369 Py_CLEAR(clear_module_state->__pyx_n_s_initializing);
jpayne@68 3370 Py_CLEAR(clear_module_state->__pyx_n_s_input_str);
jpayne@68 3371 Py_CLEAR(clear_module_state->__pyx_kp_u_invalid_coordinates_start_i_stop);
jpayne@68 3372 Py_CLEAR(clear_module_state->__pyx_n_s_io);
jpayne@68 3373 Py_CLEAR(clear_module_state->__pyx_n_s_is_coroutine);
jpayne@68 3374 Py_CLEAR(clear_module_state->__pyx_n_s_is_usage);
jpayne@68 3375 Py_CLEAR(clear_module_state->__pyx_n_s_l);
jpayne@68 3376 Py_CLEAR(clear_module_state->__pyx_n_s_latin1_replace);
jpayne@68 3377 Py_CLEAR(clear_module_state->__pyx_kp_u_m);
jpayne@68 3378 Py_CLEAR(clear_module_state->__pyx_n_s_main);
jpayne@68 3379 Py_CLEAR(clear_module_state->__pyx_n_s_method);
jpayne@68 3380 Py_CLEAR(clear_module_state->__pyx_kp_u_min_shift);
jpayne@68 3381 Py_CLEAR(clear_module_state->__pyx_n_s_mkstemp);
jpayne@68 3382 Py_CLEAR(clear_module_state->__pyx_n_u_mpileup);
jpayne@68 3383 Py_CLEAR(clear_module_state->__pyx_n_s_n);
jpayne@68 3384 Py_CLEAR(clear_module_state->__pyx_n_s_name);
jpayne@68 3385 Py_CLEAR(clear_module_state->__pyx_n_s_name_2);
jpayne@68 3386 Py_CLEAR(clear_module_state->__pyx_kp_u_neither_contig_nor_region_are_gi);
jpayne@68 3387 Py_CLEAR(clear_module_state->__pyx_kp_u_o);
jpayne@68 3388 Py_CLEAR(clear_module_state->__pyx_kp_u_o_2);
jpayne@68 3389 Py_CLEAR(clear_module_state->__pyx_n_s_object);
jpayne@68 3390 Py_CLEAR(clear_module_state->__pyx_n_s_offset);
jpayne@68 3391 Py_CLEAR(clear_module_state->__pyx_n_s_open);
jpayne@68 3392 Py_CLEAR(clear_module_state->__pyx_n_s_os);
jpayne@68 3393 Py_CLEAR(clear_module_state->__pyx_n_s_out);
jpayne@68 3394 Py_CLEAR(clear_module_state->__pyx_n_s_out_stderr);
jpayne@68 3395 Py_CLEAR(clear_module_state->__pyx_n_s_out_stdout);
jpayne@68 3396 Py_CLEAR(clear_module_state->__pyx_kp_u_output);
jpayne@68 3397 Py_CLEAR(clear_module_state->__pyx_kp_u_output_file);
jpayne@68 3398 Py_CLEAR(clear_module_state->__pyx_n_s_parse_region);
jpayne@68 3399 Py_CLEAR(clear_module_state->__pyx_n_s_path);
jpayne@68 3400 Py_CLEAR(clear_module_state->__pyx_n_s_pysam_dispatch);
jpayne@68 3401 Py_CLEAR(clear_module_state->__pyx_n_s_pysam_dispatch_locals__collect);
jpayne@68 3402 Py_CLEAR(clear_module_state->__pyx_kp_u_pysam_latin1replace);
jpayne@68 3403 Py_CLEAR(clear_module_state->__pyx_n_s_pysam_libcutils);
jpayne@68 3404 Py_CLEAR(clear_module_state->__pyx_kp_s_pysam_libcutils_pyx);
jpayne@68 3405 Py_CLEAR(clear_module_state->__pyx_n_s_qualities);
jpayne@68 3406 Py_CLEAR(clear_module_state->__pyx_n_s_qualities_to_qualitystring);
jpayne@68 3407 Py_CLEAR(clear_module_state->__pyx_n_u_qualities_to_qualitystring);
jpayne@68 3408 Py_CLEAR(clear_module_state->__pyx_n_s_qualitystring_to_array);
jpayne@68 3409 Py_CLEAR(clear_module_state->__pyx_n_u_qualitystring_to_array);
jpayne@68 3410 Py_CLEAR(clear_module_state->__pyx_n_u_r);
jpayne@68 3411 Py_CLEAR(clear_module_state->__pyx_n_u_rb);
jpayne@68 3412 Py_CLEAR(clear_module_state->__pyx_n_s_re);
jpayne@68 3413 Py_CLEAR(clear_module_state->__pyx_n_s_read);
jpayne@68 3414 Py_CLEAR(clear_module_state->__pyx_n_s_reference);
jpayne@68 3415 Py_CLEAR(clear_module_state->__pyx_n_s_region);
jpayne@68 3416 Py_CLEAR(clear_module_state->__pyx_n_s_register_error);
jpayne@68 3417 Py_CLEAR(clear_module_state->__pyx_n_s_remove);
jpayne@68 3418 Py_CLEAR(clear_module_state->__pyx_n_s_retval);
jpayne@68 3419 Py_CLEAR(clear_module_state->__pyx_n_u_roh);
jpayne@68 3420 Py_CLEAR(clear_module_state->__pyx_n_b_samtools);
jpayne@68 3421 Py_CLEAR(clear_module_state->__pyx_n_u_samtools);
jpayne@68 3422 Py_CLEAR(clear_module_state->__pyx_n_s_save_stdout);
jpayne@68 3423 Py_CLEAR(clear_module_state->__pyx_n_s_set_encoding_error_handler);
jpayne@68 3424 Py_CLEAR(clear_module_state->__pyx_n_u_set_encoding_error_handler);
jpayne@68 3425 Py_CLEAR(clear_module_state->__pyx_n_s_skip_next);
jpayne@68 3426 Py_CLEAR(clear_module_state->__pyx_n_s_spec);
jpayne@68 3427 Py_CLEAR(clear_module_state->__pyx_n_s_split);
jpayne@68 3428 Py_CLEAR(clear_module_state->__pyx_n_s_start);
jpayne@68 3429 Py_CLEAR(clear_module_state->__pyx_kp_u_start_out_of_range_i);
jpayne@68 3430 Py_CLEAR(clear_module_state->__pyx_n_s_startswith);
jpayne@68 3431 Py_CLEAR(clear_module_state->__pyx_n_u_stats);
jpayne@68 3432 Py_CLEAR(clear_module_state->__pyx_n_s_stderr_f);
jpayne@68 3433 Py_CLEAR(clear_module_state->__pyx_n_s_stderr_h);
jpayne@68 3434 Py_CLEAR(clear_module_state->__pyx_n_s_stdout_f);
jpayne@68 3435 Py_CLEAR(clear_module_state->__pyx_n_s_stdout_h);
jpayne@68 3436 Py_CLEAR(clear_module_state->__pyx_n_s_stdout_option);
jpayne@68 3437 Py_CLEAR(clear_module_state->__pyx_n_s_stop);
jpayne@68 3438 Py_CLEAR(clear_module_state->__pyx_kp_u_stop_and_end_should_not_both_be);
jpayne@68 3439 Py_CLEAR(clear_module_state->__pyx_kp_u_stop_out_of_range_i);
jpayne@68 3440 Py_CLEAR(clear_module_state->__pyx_n_u_strict);
jpayne@68 3441 Py_CLEAR(clear_module_state->__pyx_n_s_string);
jpayne@68 3442 Py_CLEAR(clear_module_state->__pyx_n_s_sys);
jpayne@68 3443 Py_CLEAR(clear_module_state->__pyx_n_s_tempfile);
jpayne@68 3444 Py_CLEAR(clear_module_state->__pyx_n_s_test);
jpayne@68 3445 Py_CLEAR(clear_module_state->__pyx_kp_u_threads);
jpayne@68 3446 Py_CLEAR(clear_module_state->__pyx_n_s_tobytes);
jpayne@68 3447 Py_CLEAR(clear_module_state->__pyx_n_s_types);
jpayne@68 3448 Py_CLEAR(clear_module_state->__pyx_kp_u_utf_8);
jpayne@68 3449 Py_CLEAR(clear_module_state->__pyx_n_u_view);
jpayne@68 3450 Py_CLEAR(clear_module_state->__pyx_int_1);
jpayne@68 3451 Py_CLEAR(clear_module_state->__pyx_int_33);
jpayne@68 3452 Py_CLEAR(clear_module_state->__pyx_int_neg_1);
jpayne@68 3453 Py_CLEAR(clear_module_state->__pyx_tuple__2);
jpayne@68 3454 Py_CLEAR(clear_module_state->__pyx_tuple__3);
jpayne@68 3455 Py_CLEAR(clear_module_state->__pyx_tuple__4);
jpayne@68 3456 Py_CLEAR(clear_module_state->__pyx_tuple__5);
jpayne@68 3457 Py_CLEAR(clear_module_state->__pyx_tuple__6);
jpayne@68 3458 Py_CLEAR(clear_module_state->__pyx_tuple__9);
jpayne@68 3459 Py_CLEAR(clear_module_state->__pyx_tuple__12);
jpayne@68 3460 Py_CLEAR(clear_module_state->__pyx_tuple__16);
jpayne@68 3461 Py_CLEAR(clear_module_state->__pyx_tuple__18);
jpayne@68 3462 Py_CLEAR(clear_module_state->__pyx_tuple__19);
jpayne@68 3463 Py_CLEAR(clear_module_state->__pyx_tuple__22);
jpayne@68 3464 Py_CLEAR(clear_module_state->__pyx_tuple__25);
jpayne@68 3465 Py_CLEAR(clear_module_state->__pyx_tuple__27);
jpayne@68 3466 Py_CLEAR(clear_module_state->__pyx_tuple__29);
jpayne@68 3467 Py_CLEAR(clear_module_state->__pyx_tuple__30);
jpayne@68 3468 Py_CLEAR(clear_module_state->__pyx_tuple__32);
jpayne@68 3469 Py_CLEAR(clear_module_state->__pyx_codeobj__13);
jpayne@68 3470 Py_CLEAR(clear_module_state->__pyx_codeobj__17);
jpayne@68 3471 Py_CLEAR(clear_module_state->__pyx_codeobj__20);
jpayne@68 3472 Py_CLEAR(clear_module_state->__pyx_codeobj__21);
jpayne@68 3473 Py_CLEAR(clear_module_state->__pyx_codeobj__23);
jpayne@68 3474 Py_CLEAR(clear_module_state->__pyx_codeobj__24);
jpayne@68 3475 Py_CLEAR(clear_module_state->__pyx_codeobj__26);
jpayne@68 3476 Py_CLEAR(clear_module_state->__pyx_codeobj__28);
jpayne@68 3477 Py_CLEAR(clear_module_state->__pyx_codeobj__31);
jpayne@68 3478 return 0;
jpayne@68 3479 }
jpayne@68 3480 #endif
jpayne@68 3481 /* #### Code section: module_state_traverse ### */
jpayne@68 3482 #if CYTHON_USE_MODULE_STATE
jpayne@68 3483 static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) {
jpayne@68 3484 __pyx_mstate *traverse_module_state = __pyx_mstate(m);
jpayne@68 3485 if (!traverse_module_state) return 0;
jpayne@68 3486 Py_VISIT(traverse_module_state->__pyx_d);
jpayne@68 3487 Py_VISIT(traverse_module_state->__pyx_b);
jpayne@68 3488 Py_VISIT(traverse_module_state->__pyx_cython_runtime);
jpayne@68 3489 Py_VISIT(traverse_module_state->__pyx_empty_tuple);
jpayne@68 3490 Py_VISIT(traverse_module_state->__pyx_empty_bytes);
jpayne@68 3491 Py_VISIT(traverse_module_state->__pyx_empty_unicode);
jpayne@68 3492 #ifdef __Pyx_CyFunction_USED
jpayne@68 3493 Py_VISIT(traverse_module_state->__pyx_CyFunctionType);
jpayne@68 3494 #endif
jpayne@68 3495 #ifdef __Pyx_FusedFunction_USED
jpayne@68 3496 Py_VISIT(traverse_module_state->__pyx_FusedFunctionType);
jpayne@68 3497 #endif
jpayne@68 3498 Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_4type_type);
jpayne@68 3499 Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_4bool_bool);
jpayne@68 3500 Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_7complex_complex);
jpayne@68 3501 Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_5array_array);
jpayne@68 3502 Py_VISIT(traverse_module_state->__pyx_kp_u_);
jpayne@68 3503 Py_VISIT(traverse_module_state->__pyx_n_s_ARGUMENTS);
jpayne@68 3504 Py_VISIT(traverse_module_state->__pyx_kp_u_Argument_must_be_string_bytes_or);
jpayne@68 3505 Py_VISIT(traverse_module_state->__pyx_n_u_B);
jpayne@68 3506 Py_VISIT(traverse_module_state->__pyx_n_s_IOError);
jpayne@68 3507 Py_VISIT(traverse_module_state->__pyx_n_s_MAP_STDOUT_OPTIONS);
jpayne@68 3508 Py_VISIT(traverse_module_state->__pyx_n_s_MemoryError);
jpayne@68 3509 Py_VISIT(traverse_module_state->__pyx_kp_u_No_such_file_or_directory_s);
jpayne@68 3510 Py_VISIT(traverse_module_state->__pyx_n_s_OSError);
jpayne@68 3511 Py_VISIT(traverse_module_state->__pyx_n_s_OverflowError);
jpayne@68 3512 Py_VISIT(traverse_module_state->__pyx_n_s_TypeError);
jpayne@68 3513 Py_VISIT(traverse_module_state->__pyx_n_s_UnicodeDecodeError);
jpayne@68 3514 Py_VISIT(traverse_module_state->__pyx_n_s_ValueError);
jpayne@68 3515 Py_VISIT(traverse_module_state->__pyx_kp_u__10);
jpayne@68 3516 Py_VISIT(traverse_module_state->__pyx_kp_u__11);
jpayne@68 3517 Py_VISIT(traverse_module_state->__pyx_n_s__14);
jpayne@68 3518 Py_VISIT(traverse_module_state->__pyx_kp_u__15);
jpayne@68 3519 Py_VISIT(traverse_module_state->__pyx_n_s__33);
jpayne@68 3520 Py_VISIT(traverse_module_state->__pyx_kp_u__7);
jpayne@68 3521 Py_VISIT(traverse_module_state->__pyx_kp_u__8);
jpayne@68 3522 Py_VISIT(traverse_module_state->__pyx_n_s_a);
jpayne@68 3523 Py_VISIT(traverse_module_state->__pyx_n_s_all);
jpayne@68 3524 Py_VISIT(traverse_module_state->__pyx_n_s_arg);
jpayne@68 3525 Py_VISIT(traverse_module_state->__pyx_n_s_args);
jpayne@68 3526 Py_VISIT(traverse_module_state->__pyx_n_s_array_to_qualitystring);
jpayne@68 3527 Py_VISIT(traverse_module_state->__pyx_n_u_array_to_qualitystring);
jpayne@68 3528 Py_VISIT(traverse_module_state->__pyx_n_u_ascii);
jpayne@68 3529 Py_VISIT(traverse_module_state->__pyx_n_s_asyncio_coroutines);
jpayne@68 3530 Py_VISIT(traverse_module_state->__pyx_n_b_bcftools);
jpayne@68 3531 Py_VISIT(traverse_module_state->__pyx_n_u_bcftools);
jpayne@68 3532 Py_VISIT(traverse_module_state->__pyx_kp_u_c);
jpayne@68 3533 Py_VISIT(traverse_module_state->__pyx_n_u_calmd);
jpayne@68 3534 Py_VISIT(traverse_module_state->__pyx_n_s_cargs);
jpayne@68 3535 Py_VISIT(traverse_module_state->__pyx_n_s_catch_stdout);
jpayne@68 3536 Py_VISIT(traverse_module_state->__pyx_n_s_chr);
jpayne@68 3537 Py_VISIT(traverse_module_state->__pyx_n_s_class_getitem);
jpayne@68 3538 Py_VISIT(traverse_module_state->__pyx_n_s_cline_in_traceback);
jpayne@68 3539 Py_VISIT(traverse_module_state->__pyx_n_s_close);
jpayne@68 3540 Py_VISIT(traverse_module_state->__pyx_n_s_codecs);
jpayne@68 3541 Py_VISIT(traverse_module_state->__pyx_n_s_collect);
jpayne@68 3542 Py_VISIT(traverse_module_state->__pyx_n_s_collection);
jpayne@68 3543 Py_VISIT(traverse_module_state->__pyx_n_s_contextlib);
jpayne@68 3544 Py_VISIT(traverse_module_state->__pyx_n_s_contextmanager);
jpayne@68 3545 Py_VISIT(traverse_module_state->__pyx_n_s_contig);
jpayne@68 3546 Py_VISIT(traverse_module_state->__pyx_kp_u_contig_and_reference_should_not);
jpayne@68 3547 Py_VISIT(traverse_module_state->__pyx_kp_u_contig_reference_and_region_shou);
jpayne@68 3548 Py_VISIT(traverse_module_state->__pyx_n_s_decode);
jpayne@68 3549 Py_VISIT(traverse_module_state->__pyx_n_u_depad);
jpayne@68 3550 Py_VISIT(traverse_module_state->__pyx_n_s_encode);
jpayne@68 3551 Py_VISIT(traverse_module_state->__pyx_n_s_end);
jpayne@68 3552 Py_VISIT(traverse_module_state->__pyx_n_s_enter);
jpayne@68 3553 Py_VISIT(traverse_module_state->__pyx_kp_u_error_while_opening_file_for_wri);
jpayne@68 3554 Py_VISIT(traverse_module_state->__pyx_n_s_exception);
jpayne@68 3555 Py_VISIT(traverse_module_state->__pyx_n_s_exists);
jpayne@68 3556 Py_VISIT(traverse_module_state->__pyx_n_s_exit);
jpayne@68 3557 Py_VISIT(traverse_module_state->__pyx_n_s_extend);
jpayne@68 3558 Py_VISIT(traverse_module_state->__pyx_n_s_extra_args);
jpayne@68 3559 Py_VISIT(traverse_module_state->__pyx_n_s_fn);
jpayne@68 3560 Py_VISIT(traverse_module_state->__pyx_n_s_format);
jpayne@68 3561 Py_VISIT(traverse_module_state->__pyx_n_s_fsencode);
jpayne@68 3562 Py_VISIT(traverse_module_state->__pyx_n_s_get_encoding_error_handler);
jpayne@68 3563 Py_VISIT(traverse_module_state->__pyx_n_u_get_encoding_error_handler);
jpayne@68 3564 Py_VISIT(traverse_module_state->__pyx_n_s_getdefaultencoding);
jpayne@68 3565 Py_VISIT(traverse_module_state->__pyx_n_s_getfilesystemencoding);
jpayne@68 3566 Py_VISIT(traverse_module_state->__pyx_n_u_head);
jpayne@68 3567 Py_VISIT(traverse_module_state->__pyx_n_s_i);
jpayne@68 3568 Py_VISIT(traverse_module_state->__pyx_n_s_import);
jpayne@68 3569 Py_VISIT(traverse_module_state->__pyx_n_b_index);
jpayne@68 3570 Py_VISIT(traverse_module_state->__pyx_n_u_index);
jpayne@68 3571 Py_VISIT(traverse_module_state->__pyx_n_s_inf);
jpayne@68 3572 Py_VISIT(traverse_module_state->__pyx_n_s_initializing);
jpayne@68 3573 Py_VISIT(traverse_module_state->__pyx_n_s_input_str);
jpayne@68 3574 Py_VISIT(traverse_module_state->__pyx_kp_u_invalid_coordinates_start_i_stop);
jpayne@68 3575 Py_VISIT(traverse_module_state->__pyx_n_s_io);
jpayne@68 3576 Py_VISIT(traverse_module_state->__pyx_n_s_is_coroutine);
jpayne@68 3577 Py_VISIT(traverse_module_state->__pyx_n_s_is_usage);
jpayne@68 3578 Py_VISIT(traverse_module_state->__pyx_n_s_l);
jpayne@68 3579 Py_VISIT(traverse_module_state->__pyx_n_s_latin1_replace);
jpayne@68 3580 Py_VISIT(traverse_module_state->__pyx_kp_u_m);
jpayne@68 3581 Py_VISIT(traverse_module_state->__pyx_n_s_main);
jpayne@68 3582 Py_VISIT(traverse_module_state->__pyx_n_s_method);
jpayne@68 3583 Py_VISIT(traverse_module_state->__pyx_kp_u_min_shift);
jpayne@68 3584 Py_VISIT(traverse_module_state->__pyx_n_s_mkstemp);
jpayne@68 3585 Py_VISIT(traverse_module_state->__pyx_n_u_mpileup);
jpayne@68 3586 Py_VISIT(traverse_module_state->__pyx_n_s_n);
jpayne@68 3587 Py_VISIT(traverse_module_state->__pyx_n_s_name);
jpayne@68 3588 Py_VISIT(traverse_module_state->__pyx_n_s_name_2);
jpayne@68 3589 Py_VISIT(traverse_module_state->__pyx_kp_u_neither_contig_nor_region_are_gi);
jpayne@68 3590 Py_VISIT(traverse_module_state->__pyx_kp_u_o);
jpayne@68 3591 Py_VISIT(traverse_module_state->__pyx_kp_u_o_2);
jpayne@68 3592 Py_VISIT(traverse_module_state->__pyx_n_s_object);
jpayne@68 3593 Py_VISIT(traverse_module_state->__pyx_n_s_offset);
jpayne@68 3594 Py_VISIT(traverse_module_state->__pyx_n_s_open);
jpayne@68 3595 Py_VISIT(traverse_module_state->__pyx_n_s_os);
jpayne@68 3596 Py_VISIT(traverse_module_state->__pyx_n_s_out);
jpayne@68 3597 Py_VISIT(traverse_module_state->__pyx_n_s_out_stderr);
jpayne@68 3598 Py_VISIT(traverse_module_state->__pyx_n_s_out_stdout);
jpayne@68 3599 Py_VISIT(traverse_module_state->__pyx_kp_u_output);
jpayne@68 3600 Py_VISIT(traverse_module_state->__pyx_kp_u_output_file);
jpayne@68 3601 Py_VISIT(traverse_module_state->__pyx_n_s_parse_region);
jpayne@68 3602 Py_VISIT(traverse_module_state->__pyx_n_s_path);
jpayne@68 3603 Py_VISIT(traverse_module_state->__pyx_n_s_pysam_dispatch);
jpayne@68 3604 Py_VISIT(traverse_module_state->__pyx_n_s_pysam_dispatch_locals__collect);
jpayne@68 3605 Py_VISIT(traverse_module_state->__pyx_kp_u_pysam_latin1replace);
jpayne@68 3606 Py_VISIT(traverse_module_state->__pyx_n_s_pysam_libcutils);
jpayne@68 3607 Py_VISIT(traverse_module_state->__pyx_kp_s_pysam_libcutils_pyx);
jpayne@68 3608 Py_VISIT(traverse_module_state->__pyx_n_s_qualities);
jpayne@68 3609 Py_VISIT(traverse_module_state->__pyx_n_s_qualities_to_qualitystring);
jpayne@68 3610 Py_VISIT(traverse_module_state->__pyx_n_u_qualities_to_qualitystring);
jpayne@68 3611 Py_VISIT(traverse_module_state->__pyx_n_s_qualitystring_to_array);
jpayne@68 3612 Py_VISIT(traverse_module_state->__pyx_n_u_qualitystring_to_array);
jpayne@68 3613 Py_VISIT(traverse_module_state->__pyx_n_u_r);
jpayne@68 3614 Py_VISIT(traverse_module_state->__pyx_n_u_rb);
jpayne@68 3615 Py_VISIT(traverse_module_state->__pyx_n_s_re);
jpayne@68 3616 Py_VISIT(traverse_module_state->__pyx_n_s_read);
jpayne@68 3617 Py_VISIT(traverse_module_state->__pyx_n_s_reference);
jpayne@68 3618 Py_VISIT(traverse_module_state->__pyx_n_s_region);
jpayne@68 3619 Py_VISIT(traverse_module_state->__pyx_n_s_register_error);
jpayne@68 3620 Py_VISIT(traverse_module_state->__pyx_n_s_remove);
jpayne@68 3621 Py_VISIT(traverse_module_state->__pyx_n_s_retval);
jpayne@68 3622 Py_VISIT(traverse_module_state->__pyx_n_u_roh);
jpayne@68 3623 Py_VISIT(traverse_module_state->__pyx_n_b_samtools);
jpayne@68 3624 Py_VISIT(traverse_module_state->__pyx_n_u_samtools);
jpayne@68 3625 Py_VISIT(traverse_module_state->__pyx_n_s_save_stdout);
jpayne@68 3626 Py_VISIT(traverse_module_state->__pyx_n_s_set_encoding_error_handler);
jpayne@68 3627 Py_VISIT(traverse_module_state->__pyx_n_u_set_encoding_error_handler);
jpayne@68 3628 Py_VISIT(traverse_module_state->__pyx_n_s_skip_next);
jpayne@68 3629 Py_VISIT(traverse_module_state->__pyx_n_s_spec);
jpayne@68 3630 Py_VISIT(traverse_module_state->__pyx_n_s_split);
jpayne@68 3631 Py_VISIT(traverse_module_state->__pyx_n_s_start);
jpayne@68 3632 Py_VISIT(traverse_module_state->__pyx_kp_u_start_out_of_range_i);
jpayne@68 3633 Py_VISIT(traverse_module_state->__pyx_n_s_startswith);
jpayne@68 3634 Py_VISIT(traverse_module_state->__pyx_n_u_stats);
jpayne@68 3635 Py_VISIT(traverse_module_state->__pyx_n_s_stderr_f);
jpayne@68 3636 Py_VISIT(traverse_module_state->__pyx_n_s_stderr_h);
jpayne@68 3637 Py_VISIT(traverse_module_state->__pyx_n_s_stdout_f);
jpayne@68 3638 Py_VISIT(traverse_module_state->__pyx_n_s_stdout_h);
jpayne@68 3639 Py_VISIT(traverse_module_state->__pyx_n_s_stdout_option);
jpayne@68 3640 Py_VISIT(traverse_module_state->__pyx_n_s_stop);
jpayne@68 3641 Py_VISIT(traverse_module_state->__pyx_kp_u_stop_and_end_should_not_both_be);
jpayne@68 3642 Py_VISIT(traverse_module_state->__pyx_kp_u_stop_out_of_range_i);
jpayne@68 3643 Py_VISIT(traverse_module_state->__pyx_n_u_strict);
jpayne@68 3644 Py_VISIT(traverse_module_state->__pyx_n_s_string);
jpayne@68 3645 Py_VISIT(traverse_module_state->__pyx_n_s_sys);
jpayne@68 3646 Py_VISIT(traverse_module_state->__pyx_n_s_tempfile);
jpayne@68 3647 Py_VISIT(traverse_module_state->__pyx_n_s_test);
jpayne@68 3648 Py_VISIT(traverse_module_state->__pyx_kp_u_threads);
jpayne@68 3649 Py_VISIT(traverse_module_state->__pyx_n_s_tobytes);
jpayne@68 3650 Py_VISIT(traverse_module_state->__pyx_n_s_types);
jpayne@68 3651 Py_VISIT(traverse_module_state->__pyx_kp_u_utf_8);
jpayne@68 3652 Py_VISIT(traverse_module_state->__pyx_n_u_view);
jpayne@68 3653 Py_VISIT(traverse_module_state->__pyx_int_1);
jpayne@68 3654 Py_VISIT(traverse_module_state->__pyx_int_33);
jpayne@68 3655 Py_VISIT(traverse_module_state->__pyx_int_neg_1);
jpayne@68 3656 Py_VISIT(traverse_module_state->__pyx_tuple__2);
jpayne@68 3657 Py_VISIT(traverse_module_state->__pyx_tuple__3);
jpayne@68 3658 Py_VISIT(traverse_module_state->__pyx_tuple__4);
jpayne@68 3659 Py_VISIT(traverse_module_state->__pyx_tuple__5);
jpayne@68 3660 Py_VISIT(traverse_module_state->__pyx_tuple__6);
jpayne@68 3661 Py_VISIT(traverse_module_state->__pyx_tuple__9);
jpayne@68 3662 Py_VISIT(traverse_module_state->__pyx_tuple__12);
jpayne@68 3663 Py_VISIT(traverse_module_state->__pyx_tuple__16);
jpayne@68 3664 Py_VISIT(traverse_module_state->__pyx_tuple__18);
jpayne@68 3665 Py_VISIT(traverse_module_state->__pyx_tuple__19);
jpayne@68 3666 Py_VISIT(traverse_module_state->__pyx_tuple__22);
jpayne@68 3667 Py_VISIT(traverse_module_state->__pyx_tuple__25);
jpayne@68 3668 Py_VISIT(traverse_module_state->__pyx_tuple__27);
jpayne@68 3669 Py_VISIT(traverse_module_state->__pyx_tuple__29);
jpayne@68 3670 Py_VISIT(traverse_module_state->__pyx_tuple__30);
jpayne@68 3671 Py_VISIT(traverse_module_state->__pyx_tuple__32);
jpayne@68 3672 Py_VISIT(traverse_module_state->__pyx_codeobj__13);
jpayne@68 3673 Py_VISIT(traverse_module_state->__pyx_codeobj__17);
jpayne@68 3674 Py_VISIT(traverse_module_state->__pyx_codeobj__20);
jpayne@68 3675 Py_VISIT(traverse_module_state->__pyx_codeobj__21);
jpayne@68 3676 Py_VISIT(traverse_module_state->__pyx_codeobj__23);
jpayne@68 3677 Py_VISIT(traverse_module_state->__pyx_codeobj__24);
jpayne@68 3678 Py_VISIT(traverse_module_state->__pyx_codeobj__26);
jpayne@68 3679 Py_VISIT(traverse_module_state->__pyx_codeobj__28);
jpayne@68 3680 Py_VISIT(traverse_module_state->__pyx_codeobj__31);
jpayne@68 3681 return 0;
jpayne@68 3682 }
jpayne@68 3683 #endif
jpayne@68 3684 /* #### Code section: module_state_defines ### */
jpayne@68 3685 #define __pyx_d __pyx_mstate_global->__pyx_d
jpayne@68 3686 #define __pyx_b __pyx_mstate_global->__pyx_b
jpayne@68 3687 #define __pyx_cython_runtime __pyx_mstate_global->__pyx_cython_runtime
jpayne@68 3688 #define __pyx_empty_tuple __pyx_mstate_global->__pyx_empty_tuple
jpayne@68 3689 #define __pyx_empty_bytes __pyx_mstate_global->__pyx_empty_bytes
jpayne@68 3690 #define __pyx_empty_unicode __pyx_mstate_global->__pyx_empty_unicode
jpayne@68 3691 #ifdef __Pyx_CyFunction_USED
jpayne@68 3692 #define __pyx_CyFunctionType __pyx_mstate_global->__pyx_CyFunctionType
jpayne@68 3693 #endif
jpayne@68 3694 #ifdef __Pyx_FusedFunction_USED
jpayne@68 3695 #define __pyx_FusedFunctionType __pyx_mstate_global->__pyx_FusedFunctionType
jpayne@68 3696 #endif
jpayne@68 3697 #ifdef __Pyx_Generator_USED
jpayne@68 3698 #define __pyx_GeneratorType __pyx_mstate_global->__pyx_GeneratorType
jpayne@68 3699 #endif
jpayne@68 3700 #ifdef __Pyx_IterableCoroutine_USED
jpayne@68 3701 #define __pyx_IterableCoroutineType __pyx_mstate_global->__pyx_IterableCoroutineType
jpayne@68 3702 #endif
jpayne@68 3703 #ifdef __Pyx_Coroutine_USED
jpayne@68 3704 #define __pyx_CoroutineAwaitType __pyx_mstate_global->__pyx_CoroutineAwaitType
jpayne@68 3705 #endif
jpayne@68 3706 #ifdef __Pyx_Coroutine_USED
jpayne@68 3707 #define __pyx_CoroutineType __pyx_mstate_global->__pyx_CoroutineType
jpayne@68 3708 #endif
jpayne@68 3709 #if CYTHON_USE_MODULE_STATE
jpayne@68 3710 #endif
jpayne@68 3711 #if CYTHON_USE_MODULE_STATE
jpayne@68 3712 #endif
jpayne@68 3713 #if CYTHON_USE_MODULE_STATE
jpayne@68 3714 #endif
jpayne@68 3715 #if CYTHON_USE_MODULE_STATE
jpayne@68 3716 #endif
jpayne@68 3717 #define __pyx_ptype_7cpython_4type_type __pyx_mstate_global->__pyx_ptype_7cpython_4type_type
jpayne@68 3718 #if CYTHON_USE_MODULE_STATE
jpayne@68 3719 #endif
jpayne@68 3720 #if CYTHON_USE_MODULE_STATE
jpayne@68 3721 #endif
jpayne@68 3722 #if CYTHON_USE_MODULE_STATE
jpayne@68 3723 #endif
jpayne@68 3724 #if CYTHON_USE_MODULE_STATE
jpayne@68 3725 #endif
jpayne@68 3726 #if CYTHON_USE_MODULE_STATE
jpayne@68 3727 #endif
jpayne@68 3728 #if CYTHON_USE_MODULE_STATE
jpayne@68 3729 #endif
jpayne@68 3730 #if CYTHON_USE_MODULE_STATE
jpayne@68 3731 #endif
jpayne@68 3732 #if CYTHON_USE_MODULE_STATE
jpayne@68 3733 #endif
jpayne@68 3734 #if CYTHON_USE_MODULE_STATE
jpayne@68 3735 #endif
jpayne@68 3736 #if CYTHON_USE_MODULE_STATE
jpayne@68 3737 #endif
jpayne@68 3738 #if CYTHON_USE_MODULE_STATE
jpayne@68 3739 #endif
jpayne@68 3740 #if CYTHON_USE_MODULE_STATE
jpayne@68 3741 #endif
jpayne@68 3742 #if CYTHON_USE_MODULE_STATE
jpayne@68 3743 #endif
jpayne@68 3744 #if CYTHON_USE_MODULE_STATE
jpayne@68 3745 #endif
jpayne@68 3746 #if CYTHON_USE_MODULE_STATE
jpayne@68 3747 #endif
jpayne@68 3748 #if CYTHON_USE_MODULE_STATE
jpayne@68 3749 #endif
jpayne@68 3750 #define __pyx_ptype_7cpython_4bool_bool __pyx_mstate_global->__pyx_ptype_7cpython_4bool_bool
jpayne@68 3751 #if CYTHON_USE_MODULE_STATE
jpayne@68 3752 #endif
jpayne@68 3753 #if CYTHON_USE_MODULE_STATE
jpayne@68 3754 #endif
jpayne@68 3755 #if CYTHON_USE_MODULE_STATE
jpayne@68 3756 #endif
jpayne@68 3757 #if CYTHON_USE_MODULE_STATE
jpayne@68 3758 #endif
jpayne@68 3759 #define __pyx_ptype_7cpython_7complex_complex __pyx_mstate_global->__pyx_ptype_7cpython_7complex_complex
jpayne@68 3760 #if CYTHON_USE_MODULE_STATE
jpayne@68 3761 #endif
jpayne@68 3762 #if CYTHON_USE_MODULE_STATE
jpayne@68 3763 #endif
jpayne@68 3764 #if CYTHON_USE_MODULE_STATE
jpayne@68 3765 #endif
jpayne@68 3766 #if CYTHON_USE_MODULE_STATE
jpayne@68 3767 #endif
jpayne@68 3768 #if CYTHON_USE_MODULE_STATE
jpayne@68 3769 #endif
jpayne@68 3770 #if CYTHON_USE_MODULE_STATE
jpayne@68 3771 #endif
jpayne@68 3772 #if CYTHON_USE_MODULE_STATE
jpayne@68 3773 #endif
jpayne@68 3774 #if CYTHON_USE_MODULE_STATE
jpayne@68 3775 #endif
jpayne@68 3776 #if CYTHON_USE_MODULE_STATE
jpayne@68 3777 #endif
jpayne@68 3778 #if CYTHON_USE_MODULE_STATE
jpayne@68 3779 #endif
jpayne@68 3780 #if CYTHON_USE_MODULE_STATE
jpayne@68 3781 #endif
jpayne@68 3782 #if CYTHON_USE_MODULE_STATE
jpayne@68 3783 #endif
jpayne@68 3784 #if CYTHON_USE_MODULE_STATE
jpayne@68 3785 #endif
jpayne@68 3786 #if CYTHON_USE_MODULE_STATE
jpayne@68 3787 #endif
jpayne@68 3788 #if CYTHON_USE_MODULE_STATE
jpayne@68 3789 #endif
jpayne@68 3790 #if CYTHON_USE_MODULE_STATE
jpayne@68 3791 #endif
jpayne@68 3792 #if CYTHON_USE_MODULE_STATE
jpayne@68 3793 #endif
jpayne@68 3794 #if CYTHON_USE_MODULE_STATE
jpayne@68 3795 #endif
jpayne@68 3796 #if CYTHON_USE_MODULE_STATE
jpayne@68 3797 #endif
jpayne@68 3798 #if CYTHON_USE_MODULE_STATE
jpayne@68 3799 #endif
jpayne@68 3800 #if CYTHON_USE_MODULE_STATE
jpayne@68 3801 #endif
jpayne@68 3802 #if CYTHON_USE_MODULE_STATE
jpayne@68 3803 #endif
jpayne@68 3804 #define __pyx_ptype_7cpython_5array_array __pyx_mstate_global->__pyx_ptype_7cpython_5array_array
jpayne@68 3805 #if CYTHON_USE_MODULE_STATE
jpayne@68 3806 #endif
jpayne@68 3807 #if CYTHON_USE_MODULE_STATE
jpayne@68 3808 #endif
jpayne@68 3809 #if CYTHON_USE_MODULE_STATE
jpayne@68 3810 #endif
jpayne@68 3811 #if CYTHON_USE_MODULE_STATE
jpayne@68 3812 #endif
jpayne@68 3813 #if CYTHON_USE_MODULE_STATE
jpayne@68 3814 #endif
jpayne@68 3815 #if CYTHON_USE_MODULE_STATE
jpayne@68 3816 #endif
jpayne@68 3817 #if CYTHON_USE_MODULE_STATE
jpayne@68 3818 #endif
jpayne@68 3819 #if CYTHON_USE_MODULE_STATE
jpayne@68 3820 #endif
jpayne@68 3821 #if CYTHON_USE_MODULE_STATE
jpayne@68 3822 #endif
jpayne@68 3823 #define __pyx_kp_u_ __pyx_mstate_global->__pyx_kp_u_
jpayne@68 3824 #define __pyx_n_s_ARGUMENTS __pyx_mstate_global->__pyx_n_s_ARGUMENTS
jpayne@68 3825 #define __pyx_kp_u_Argument_must_be_string_bytes_or __pyx_mstate_global->__pyx_kp_u_Argument_must_be_string_bytes_or
jpayne@68 3826 #define __pyx_n_u_B __pyx_mstate_global->__pyx_n_u_B
jpayne@68 3827 #define __pyx_n_s_IOError __pyx_mstate_global->__pyx_n_s_IOError
jpayne@68 3828 #define __pyx_n_s_MAP_STDOUT_OPTIONS __pyx_mstate_global->__pyx_n_s_MAP_STDOUT_OPTIONS
jpayne@68 3829 #define __pyx_n_s_MemoryError __pyx_mstate_global->__pyx_n_s_MemoryError
jpayne@68 3830 #define __pyx_kp_u_No_such_file_or_directory_s __pyx_mstate_global->__pyx_kp_u_No_such_file_or_directory_s
jpayne@68 3831 #define __pyx_n_s_OSError __pyx_mstate_global->__pyx_n_s_OSError
jpayne@68 3832 #define __pyx_n_s_OverflowError __pyx_mstate_global->__pyx_n_s_OverflowError
jpayne@68 3833 #define __pyx_n_s_TypeError __pyx_mstate_global->__pyx_n_s_TypeError
jpayne@68 3834 #define __pyx_n_s_UnicodeDecodeError __pyx_mstate_global->__pyx_n_s_UnicodeDecodeError
jpayne@68 3835 #define __pyx_n_s_ValueError __pyx_mstate_global->__pyx_n_s_ValueError
jpayne@68 3836 #define __pyx_kp_u__10 __pyx_mstate_global->__pyx_kp_u__10
jpayne@68 3837 #define __pyx_kp_u__11 __pyx_mstate_global->__pyx_kp_u__11
jpayne@68 3838 #define __pyx_n_s__14 __pyx_mstate_global->__pyx_n_s__14
jpayne@68 3839 #define __pyx_kp_u__15 __pyx_mstate_global->__pyx_kp_u__15
jpayne@68 3840 #define __pyx_n_s__33 __pyx_mstate_global->__pyx_n_s__33
jpayne@68 3841 #define __pyx_kp_u__7 __pyx_mstate_global->__pyx_kp_u__7
jpayne@68 3842 #define __pyx_kp_u__8 __pyx_mstate_global->__pyx_kp_u__8
jpayne@68 3843 #define __pyx_n_s_a __pyx_mstate_global->__pyx_n_s_a
jpayne@68 3844 #define __pyx_n_s_all __pyx_mstate_global->__pyx_n_s_all
jpayne@68 3845 #define __pyx_n_s_arg __pyx_mstate_global->__pyx_n_s_arg
jpayne@68 3846 #define __pyx_n_s_args __pyx_mstate_global->__pyx_n_s_args
jpayne@68 3847 #define __pyx_n_s_array_to_qualitystring __pyx_mstate_global->__pyx_n_s_array_to_qualitystring
jpayne@68 3848 #define __pyx_n_u_array_to_qualitystring __pyx_mstate_global->__pyx_n_u_array_to_qualitystring
jpayne@68 3849 #define __pyx_n_u_ascii __pyx_mstate_global->__pyx_n_u_ascii
jpayne@68 3850 #define __pyx_n_s_asyncio_coroutines __pyx_mstate_global->__pyx_n_s_asyncio_coroutines
jpayne@68 3851 #define __pyx_n_b_bcftools __pyx_mstate_global->__pyx_n_b_bcftools
jpayne@68 3852 #define __pyx_n_u_bcftools __pyx_mstate_global->__pyx_n_u_bcftools
jpayne@68 3853 #define __pyx_kp_u_c __pyx_mstate_global->__pyx_kp_u_c
jpayne@68 3854 #define __pyx_n_u_calmd __pyx_mstate_global->__pyx_n_u_calmd
jpayne@68 3855 #define __pyx_n_s_cargs __pyx_mstate_global->__pyx_n_s_cargs
jpayne@68 3856 #define __pyx_n_s_catch_stdout __pyx_mstate_global->__pyx_n_s_catch_stdout
jpayne@68 3857 #define __pyx_n_s_chr __pyx_mstate_global->__pyx_n_s_chr
jpayne@68 3858 #define __pyx_n_s_class_getitem __pyx_mstate_global->__pyx_n_s_class_getitem
jpayne@68 3859 #define __pyx_n_s_cline_in_traceback __pyx_mstate_global->__pyx_n_s_cline_in_traceback
jpayne@68 3860 #define __pyx_n_s_close __pyx_mstate_global->__pyx_n_s_close
jpayne@68 3861 #define __pyx_n_s_codecs __pyx_mstate_global->__pyx_n_s_codecs
jpayne@68 3862 #define __pyx_n_s_collect __pyx_mstate_global->__pyx_n_s_collect
jpayne@68 3863 #define __pyx_n_s_collection __pyx_mstate_global->__pyx_n_s_collection
jpayne@68 3864 #define __pyx_n_s_contextlib __pyx_mstate_global->__pyx_n_s_contextlib
jpayne@68 3865 #define __pyx_n_s_contextmanager __pyx_mstate_global->__pyx_n_s_contextmanager
jpayne@68 3866 #define __pyx_n_s_contig __pyx_mstate_global->__pyx_n_s_contig
jpayne@68 3867 #define __pyx_kp_u_contig_and_reference_should_not __pyx_mstate_global->__pyx_kp_u_contig_and_reference_should_not
jpayne@68 3868 #define __pyx_kp_u_contig_reference_and_region_shou __pyx_mstate_global->__pyx_kp_u_contig_reference_and_region_shou
jpayne@68 3869 #define __pyx_n_s_decode __pyx_mstate_global->__pyx_n_s_decode
jpayne@68 3870 #define __pyx_n_u_depad __pyx_mstate_global->__pyx_n_u_depad
jpayne@68 3871 #define __pyx_n_s_encode __pyx_mstate_global->__pyx_n_s_encode
jpayne@68 3872 #define __pyx_n_s_end __pyx_mstate_global->__pyx_n_s_end
jpayne@68 3873 #define __pyx_n_s_enter __pyx_mstate_global->__pyx_n_s_enter
jpayne@68 3874 #define __pyx_kp_u_error_while_opening_file_for_wri __pyx_mstate_global->__pyx_kp_u_error_while_opening_file_for_wri
jpayne@68 3875 #define __pyx_n_s_exception __pyx_mstate_global->__pyx_n_s_exception
jpayne@68 3876 #define __pyx_n_s_exists __pyx_mstate_global->__pyx_n_s_exists
jpayne@68 3877 #define __pyx_n_s_exit __pyx_mstate_global->__pyx_n_s_exit
jpayne@68 3878 #define __pyx_n_s_extend __pyx_mstate_global->__pyx_n_s_extend
jpayne@68 3879 #define __pyx_n_s_extra_args __pyx_mstate_global->__pyx_n_s_extra_args
jpayne@68 3880 #define __pyx_n_s_fn __pyx_mstate_global->__pyx_n_s_fn
jpayne@68 3881 #define __pyx_n_s_format __pyx_mstate_global->__pyx_n_s_format
jpayne@68 3882 #define __pyx_n_s_fsencode __pyx_mstate_global->__pyx_n_s_fsencode
jpayne@68 3883 #define __pyx_n_s_get_encoding_error_handler __pyx_mstate_global->__pyx_n_s_get_encoding_error_handler
jpayne@68 3884 #define __pyx_n_u_get_encoding_error_handler __pyx_mstate_global->__pyx_n_u_get_encoding_error_handler
jpayne@68 3885 #define __pyx_n_s_getdefaultencoding __pyx_mstate_global->__pyx_n_s_getdefaultencoding
jpayne@68 3886 #define __pyx_n_s_getfilesystemencoding __pyx_mstate_global->__pyx_n_s_getfilesystemencoding
jpayne@68 3887 #define __pyx_n_u_head __pyx_mstate_global->__pyx_n_u_head
jpayne@68 3888 #define __pyx_n_s_i __pyx_mstate_global->__pyx_n_s_i
jpayne@68 3889 #define __pyx_n_s_import __pyx_mstate_global->__pyx_n_s_import
jpayne@68 3890 #define __pyx_n_b_index __pyx_mstate_global->__pyx_n_b_index
jpayne@68 3891 #define __pyx_n_u_index __pyx_mstate_global->__pyx_n_u_index
jpayne@68 3892 #define __pyx_n_s_inf __pyx_mstate_global->__pyx_n_s_inf
jpayne@68 3893 #define __pyx_n_s_initializing __pyx_mstate_global->__pyx_n_s_initializing
jpayne@68 3894 #define __pyx_n_s_input_str __pyx_mstate_global->__pyx_n_s_input_str
jpayne@68 3895 #define __pyx_kp_u_invalid_coordinates_start_i_stop __pyx_mstate_global->__pyx_kp_u_invalid_coordinates_start_i_stop
jpayne@68 3896 #define __pyx_n_s_io __pyx_mstate_global->__pyx_n_s_io
jpayne@68 3897 #define __pyx_n_s_is_coroutine __pyx_mstate_global->__pyx_n_s_is_coroutine
jpayne@68 3898 #define __pyx_n_s_is_usage __pyx_mstate_global->__pyx_n_s_is_usage
jpayne@68 3899 #define __pyx_n_s_l __pyx_mstate_global->__pyx_n_s_l
jpayne@68 3900 #define __pyx_n_s_latin1_replace __pyx_mstate_global->__pyx_n_s_latin1_replace
jpayne@68 3901 #define __pyx_kp_u_m __pyx_mstate_global->__pyx_kp_u_m
jpayne@68 3902 #define __pyx_n_s_main __pyx_mstate_global->__pyx_n_s_main
jpayne@68 3903 #define __pyx_n_s_method __pyx_mstate_global->__pyx_n_s_method
jpayne@68 3904 #define __pyx_kp_u_min_shift __pyx_mstate_global->__pyx_kp_u_min_shift
jpayne@68 3905 #define __pyx_n_s_mkstemp __pyx_mstate_global->__pyx_n_s_mkstemp
jpayne@68 3906 #define __pyx_n_u_mpileup __pyx_mstate_global->__pyx_n_u_mpileup
jpayne@68 3907 #define __pyx_n_s_n __pyx_mstate_global->__pyx_n_s_n
jpayne@68 3908 #define __pyx_n_s_name __pyx_mstate_global->__pyx_n_s_name
jpayne@68 3909 #define __pyx_n_s_name_2 __pyx_mstate_global->__pyx_n_s_name_2
jpayne@68 3910 #define __pyx_kp_u_neither_contig_nor_region_are_gi __pyx_mstate_global->__pyx_kp_u_neither_contig_nor_region_are_gi
jpayne@68 3911 #define __pyx_kp_u_o __pyx_mstate_global->__pyx_kp_u_o
jpayne@68 3912 #define __pyx_kp_u_o_2 __pyx_mstate_global->__pyx_kp_u_o_2
jpayne@68 3913 #define __pyx_n_s_object __pyx_mstate_global->__pyx_n_s_object
jpayne@68 3914 #define __pyx_n_s_offset __pyx_mstate_global->__pyx_n_s_offset
jpayne@68 3915 #define __pyx_n_s_open __pyx_mstate_global->__pyx_n_s_open
jpayne@68 3916 #define __pyx_n_s_os __pyx_mstate_global->__pyx_n_s_os
jpayne@68 3917 #define __pyx_n_s_out __pyx_mstate_global->__pyx_n_s_out
jpayne@68 3918 #define __pyx_n_s_out_stderr __pyx_mstate_global->__pyx_n_s_out_stderr
jpayne@68 3919 #define __pyx_n_s_out_stdout __pyx_mstate_global->__pyx_n_s_out_stdout
jpayne@68 3920 #define __pyx_kp_u_output __pyx_mstate_global->__pyx_kp_u_output
jpayne@68 3921 #define __pyx_kp_u_output_file __pyx_mstate_global->__pyx_kp_u_output_file
jpayne@68 3922 #define __pyx_n_s_parse_region __pyx_mstate_global->__pyx_n_s_parse_region
jpayne@68 3923 #define __pyx_n_s_path __pyx_mstate_global->__pyx_n_s_path
jpayne@68 3924 #define __pyx_n_s_pysam_dispatch __pyx_mstate_global->__pyx_n_s_pysam_dispatch
jpayne@68 3925 #define __pyx_n_s_pysam_dispatch_locals__collect __pyx_mstate_global->__pyx_n_s_pysam_dispatch_locals__collect
jpayne@68 3926 #define __pyx_kp_u_pysam_latin1replace __pyx_mstate_global->__pyx_kp_u_pysam_latin1replace
jpayne@68 3927 #define __pyx_n_s_pysam_libcutils __pyx_mstate_global->__pyx_n_s_pysam_libcutils
jpayne@68 3928 #define __pyx_kp_s_pysam_libcutils_pyx __pyx_mstate_global->__pyx_kp_s_pysam_libcutils_pyx
jpayne@68 3929 #define __pyx_n_s_qualities __pyx_mstate_global->__pyx_n_s_qualities
jpayne@68 3930 #define __pyx_n_s_qualities_to_qualitystring __pyx_mstate_global->__pyx_n_s_qualities_to_qualitystring
jpayne@68 3931 #define __pyx_n_u_qualities_to_qualitystring __pyx_mstate_global->__pyx_n_u_qualities_to_qualitystring
jpayne@68 3932 #define __pyx_n_s_qualitystring_to_array __pyx_mstate_global->__pyx_n_s_qualitystring_to_array
jpayne@68 3933 #define __pyx_n_u_qualitystring_to_array __pyx_mstate_global->__pyx_n_u_qualitystring_to_array
jpayne@68 3934 #define __pyx_n_u_r __pyx_mstate_global->__pyx_n_u_r
jpayne@68 3935 #define __pyx_n_u_rb __pyx_mstate_global->__pyx_n_u_rb
jpayne@68 3936 #define __pyx_n_s_re __pyx_mstate_global->__pyx_n_s_re
jpayne@68 3937 #define __pyx_n_s_read __pyx_mstate_global->__pyx_n_s_read
jpayne@68 3938 #define __pyx_n_s_reference __pyx_mstate_global->__pyx_n_s_reference
jpayne@68 3939 #define __pyx_n_s_region __pyx_mstate_global->__pyx_n_s_region
jpayne@68 3940 #define __pyx_n_s_register_error __pyx_mstate_global->__pyx_n_s_register_error
jpayne@68 3941 #define __pyx_n_s_remove __pyx_mstate_global->__pyx_n_s_remove
jpayne@68 3942 #define __pyx_n_s_retval __pyx_mstate_global->__pyx_n_s_retval
jpayne@68 3943 #define __pyx_n_u_roh __pyx_mstate_global->__pyx_n_u_roh
jpayne@68 3944 #define __pyx_n_b_samtools __pyx_mstate_global->__pyx_n_b_samtools
jpayne@68 3945 #define __pyx_n_u_samtools __pyx_mstate_global->__pyx_n_u_samtools
jpayne@68 3946 #define __pyx_n_s_save_stdout __pyx_mstate_global->__pyx_n_s_save_stdout
jpayne@68 3947 #define __pyx_n_s_set_encoding_error_handler __pyx_mstate_global->__pyx_n_s_set_encoding_error_handler
jpayne@68 3948 #define __pyx_n_u_set_encoding_error_handler __pyx_mstate_global->__pyx_n_u_set_encoding_error_handler
jpayne@68 3949 #define __pyx_n_s_skip_next __pyx_mstate_global->__pyx_n_s_skip_next
jpayne@68 3950 #define __pyx_n_s_spec __pyx_mstate_global->__pyx_n_s_spec
jpayne@68 3951 #define __pyx_n_s_split __pyx_mstate_global->__pyx_n_s_split
jpayne@68 3952 #define __pyx_n_s_start __pyx_mstate_global->__pyx_n_s_start
jpayne@68 3953 #define __pyx_kp_u_start_out_of_range_i __pyx_mstate_global->__pyx_kp_u_start_out_of_range_i
jpayne@68 3954 #define __pyx_n_s_startswith __pyx_mstate_global->__pyx_n_s_startswith
jpayne@68 3955 #define __pyx_n_u_stats __pyx_mstate_global->__pyx_n_u_stats
jpayne@68 3956 #define __pyx_n_s_stderr_f __pyx_mstate_global->__pyx_n_s_stderr_f
jpayne@68 3957 #define __pyx_n_s_stderr_h __pyx_mstate_global->__pyx_n_s_stderr_h
jpayne@68 3958 #define __pyx_n_s_stdout_f __pyx_mstate_global->__pyx_n_s_stdout_f
jpayne@68 3959 #define __pyx_n_s_stdout_h __pyx_mstate_global->__pyx_n_s_stdout_h
jpayne@68 3960 #define __pyx_n_s_stdout_option __pyx_mstate_global->__pyx_n_s_stdout_option
jpayne@68 3961 #define __pyx_n_s_stop __pyx_mstate_global->__pyx_n_s_stop
jpayne@68 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@68 3963 #define __pyx_kp_u_stop_out_of_range_i __pyx_mstate_global->__pyx_kp_u_stop_out_of_range_i
jpayne@68 3964 #define __pyx_n_u_strict __pyx_mstate_global->__pyx_n_u_strict
jpayne@68 3965 #define __pyx_n_s_string __pyx_mstate_global->__pyx_n_s_string
jpayne@68 3966 #define __pyx_n_s_sys __pyx_mstate_global->__pyx_n_s_sys
jpayne@68 3967 #define __pyx_n_s_tempfile __pyx_mstate_global->__pyx_n_s_tempfile
jpayne@68 3968 #define __pyx_n_s_test __pyx_mstate_global->__pyx_n_s_test
jpayne@68 3969 #define __pyx_kp_u_threads __pyx_mstate_global->__pyx_kp_u_threads
jpayne@68 3970 #define __pyx_n_s_tobytes __pyx_mstate_global->__pyx_n_s_tobytes
jpayne@68 3971 #define __pyx_n_s_types __pyx_mstate_global->__pyx_n_s_types
jpayne@68 3972 #define __pyx_kp_u_utf_8 __pyx_mstate_global->__pyx_kp_u_utf_8
jpayne@68 3973 #define __pyx_n_u_view __pyx_mstate_global->__pyx_n_u_view
jpayne@68 3974 #define __pyx_int_1 __pyx_mstate_global->__pyx_int_1
jpayne@68 3975 #define __pyx_int_33 __pyx_mstate_global->__pyx_int_33
jpayne@68 3976 #define __pyx_int_neg_1 __pyx_mstate_global->__pyx_int_neg_1
jpayne@68 3977 #define __pyx_tuple__2 __pyx_mstate_global->__pyx_tuple__2
jpayne@68 3978 #define __pyx_tuple__3 __pyx_mstate_global->__pyx_tuple__3
jpayne@68 3979 #define __pyx_tuple__4 __pyx_mstate_global->__pyx_tuple__4
jpayne@68 3980 #define __pyx_tuple__5 __pyx_mstate_global->__pyx_tuple__5
jpayne@68 3981 #define __pyx_tuple__6 __pyx_mstate_global->__pyx_tuple__6
jpayne@68 3982 #define __pyx_tuple__9 __pyx_mstate_global->__pyx_tuple__9
jpayne@68 3983 #define __pyx_tuple__12 __pyx_mstate_global->__pyx_tuple__12
jpayne@68 3984 #define __pyx_tuple__16 __pyx_mstate_global->__pyx_tuple__16
jpayne@68 3985 #define __pyx_tuple__18 __pyx_mstate_global->__pyx_tuple__18
jpayne@68 3986 #define __pyx_tuple__19 __pyx_mstate_global->__pyx_tuple__19
jpayne@68 3987 #define __pyx_tuple__22 __pyx_mstate_global->__pyx_tuple__22
jpayne@68 3988 #define __pyx_tuple__25 __pyx_mstate_global->__pyx_tuple__25
jpayne@68 3989 #define __pyx_tuple__27 __pyx_mstate_global->__pyx_tuple__27
jpayne@68 3990 #define __pyx_tuple__29 __pyx_mstate_global->__pyx_tuple__29
jpayne@68 3991 #define __pyx_tuple__30 __pyx_mstate_global->__pyx_tuple__30
jpayne@68 3992 #define __pyx_tuple__32 __pyx_mstate_global->__pyx_tuple__32
jpayne@68 3993 #define __pyx_codeobj__13 __pyx_mstate_global->__pyx_codeobj__13
jpayne@68 3994 #define __pyx_codeobj__17 __pyx_mstate_global->__pyx_codeobj__17
jpayne@68 3995 #define __pyx_codeobj__20 __pyx_mstate_global->__pyx_codeobj__20
jpayne@68 3996 #define __pyx_codeobj__21 __pyx_mstate_global->__pyx_codeobj__21
jpayne@68 3997 #define __pyx_codeobj__23 __pyx_mstate_global->__pyx_codeobj__23
jpayne@68 3998 #define __pyx_codeobj__24 __pyx_mstate_global->__pyx_codeobj__24
jpayne@68 3999 #define __pyx_codeobj__26 __pyx_mstate_global->__pyx_codeobj__26
jpayne@68 4000 #define __pyx_codeobj__28 __pyx_mstate_global->__pyx_codeobj__28
jpayne@68 4001 #define __pyx_codeobj__31 __pyx_mstate_global->__pyx_codeobj__31
jpayne@68 4002 /* #### Code section: module_code ### */
jpayne@68 4003
jpayne@68 4004 /* "cpython/complex.pxd":19
jpayne@68 4005 *
jpayne@68 4006 * @property
jpayne@68 4007 * cdef inline double real(self) noexcept: # <<<<<<<<<<<<<<
jpayne@68 4008 * return self.cval.real
jpayne@68 4009 *
jpayne@68 4010 */
jpayne@68 4011
jpayne@68 4012 static CYTHON_INLINE double __pyx_f_7cpython_7complex_7complex_4real_real(PyComplexObject *__pyx_v_self) {
jpayne@68 4013 double __pyx_r;
jpayne@68 4014
jpayne@68 4015 /* "cpython/complex.pxd":20
jpayne@68 4016 * @property
jpayne@68 4017 * cdef inline double real(self) noexcept:
jpayne@68 4018 * return self.cval.real # <<<<<<<<<<<<<<
jpayne@68 4019 *
jpayne@68 4020 * @property
jpayne@68 4021 */
jpayne@68 4022 __pyx_r = __pyx_v_self->cval.real;
jpayne@68 4023 goto __pyx_L0;
jpayne@68 4024
jpayne@68 4025 /* "cpython/complex.pxd":19
jpayne@68 4026 *
jpayne@68 4027 * @property
jpayne@68 4028 * cdef inline double real(self) noexcept: # <<<<<<<<<<<<<<
jpayne@68 4029 * return self.cval.real
jpayne@68 4030 *
jpayne@68 4031 */
jpayne@68 4032
jpayne@68 4033 /* function exit code */
jpayne@68 4034 __pyx_L0:;
jpayne@68 4035 return __pyx_r;
jpayne@68 4036 }
jpayne@68 4037
jpayne@68 4038 /* "cpython/complex.pxd":23
jpayne@68 4039 *
jpayne@68 4040 * @property
jpayne@68 4041 * cdef inline double imag(self) noexcept: # <<<<<<<<<<<<<<
jpayne@68 4042 * return self.cval.imag
jpayne@68 4043 *
jpayne@68 4044 */
jpayne@68 4045
jpayne@68 4046 static CYTHON_INLINE double __pyx_f_7cpython_7complex_7complex_4imag_imag(PyComplexObject *__pyx_v_self) {
jpayne@68 4047 double __pyx_r;
jpayne@68 4048
jpayne@68 4049 /* "cpython/complex.pxd":24
jpayne@68 4050 * @property
jpayne@68 4051 * cdef inline double imag(self) noexcept:
jpayne@68 4052 * return self.cval.imag # <<<<<<<<<<<<<<
jpayne@68 4053 *
jpayne@68 4054 * # PyTypeObject PyComplex_Type
jpayne@68 4055 */
jpayne@68 4056 __pyx_r = __pyx_v_self->cval.imag;
jpayne@68 4057 goto __pyx_L0;
jpayne@68 4058
jpayne@68 4059 /* "cpython/complex.pxd":23
jpayne@68 4060 *
jpayne@68 4061 * @property
jpayne@68 4062 * cdef inline double imag(self) noexcept: # <<<<<<<<<<<<<<
jpayne@68 4063 * return self.cval.imag
jpayne@68 4064 *
jpayne@68 4065 */
jpayne@68 4066
jpayne@68 4067 /* function exit code */
jpayne@68 4068 __pyx_L0:;
jpayne@68 4069 return __pyx_r;
jpayne@68 4070 }
jpayne@68 4071
jpayne@68 4072 /* "cpython/contextvars.pxd":112
jpayne@68 4073 *
jpayne@68 4074 *
jpayne@68 4075 * cdef inline object get_value(var, default_value=None): # <<<<<<<<<<<<<<
jpayne@68 4076 * """Return a new reference to the value of the context variable,
jpayne@68 4077 * or the default value of the context variable,
jpayne@68 4078 */
jpayne@68 4079
jpayne@68 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@68 4081 PyObject *__pyx_v_default_value = ((PyObject *)Py_None);
jpayne@68 4082 PyObject *__pyx_v_value;
jpayne@68 4083 PyObject *__pyx_v_pyvalue = NULL;
jpayne@68 4084 PyObject *__pyx_r = NULL;
jpayne@68 4085 __Pyx_RefNannyDeclarations
jpayne@68 4086 int __pyx_t_1;
jpayne@68 4087 int __pyx_t_2;
jpayne@68 4088 PyObject *__pyx_t_3 = NULL;
jpayne@68 4089 int __pyx_lineno = 0;
jpayne@68 4090 const char *__pyx_filename = NULL;
jpayne@68 4091 int __pyx_clineno = 0;
jpayne@68 4092 __Pyx_RefNannySetupContext("get_value", 1);
jpayne@68 4093 if (__pyx_optional_args) {
jpayne@68 4094 if (__pyx_optional_args->__pyx_n > 0) {
jpayne@68 4095 __pyx_v_default_value = __pyx_optional_args->default_value;
jpayne@68 4096 }
jpayne@68 4097 }
jpayne@68 4098
jpayne@68 4099 /* "cpython/contextvars.pxd":117
jpayne@68 4100 * or None if no such value or default was found.
jpayne@68 4101 * """
jpayne@68 4102 * cdef PyObject *value = NULL # <<<<<<<<<<<<<<
jpayne@68 4103 * PyContextVar_Get(var, NULL, &value)
jpayne@68 4104 * if value is NULL:
jpayne@68 4105 */
jpayne@68 4106 __pyx_v_value = NULL;
jpayne@68 4107
jpayne@68 4108 /* "cpython/contextvars.pxd":118
jpayne@68 4109 * """
jpayne@68 4110 * cdef PyObject *value = NULL
jpayne@68 4111 * PyContextVar_Get(var, NULL, &value) # <<<<<<<<<<<<<<
jpayne@68 4112 * if value is NULL:
jpayne@68 4113 * # context variable does not have a default
jpayne@68 4114 */
jpayne@68 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@68 4116
jpayne@68 4117 /* "cpython/contextvars.pxd":119
jpayne@68 4118 * cdef PyObject *value = NULL
jpayne@68 4119 * PyContextVar_Get(var, NULL, &value)
jpayne@68 4120 * if value is NULL: # <<<<<<<<<<<<<<
jpayne@68 4121 * # context variable does not have a default
jpayne@68 4122 * pyvalue = default_value
jpayne@68 4123 */
jpayne@68 4124 __pyx_t_2 = (__pyx_v_value == NULL);
jpayne@68 4125 if (__pyx_t_2) {
jpayne@68 4126
jpayne@68 4127 /* "cpython/contextvars.pxd":121
jpayne@68 4128 * if value is NULL:
jpayne@68 4129 * # context variable does not have a default
jpayne@68 4130 * pyvalue = default_value # <<<<<<<<<<<<<<
jpayne@68 4131 * else:
jpayne@68 4132 * # value or default value of context variable
jpayne@68 4133 */
jpayne@68 4134 __Pyx_INCREF(__pyx_v_default_value);
jpayne@68 4135 __pyx_v_pyvalue = __pyx_v_default_value;
jpayne@68 4136
jpayne@68 4137 /* "cpython/contextvars.pxd":119
jpayne@68 4138 * cdef PyObject *value = NULL
jpayne@68 4139 * PyContextVar_Get(var, NULL, &value)
jpayne@68 4140 * if value is NULL: # <<<<<<<<<<<<<<
jpayne@68 4141 * # context variable does not have a default
jpayne@68 4142 * pyvalue = default_value
jpayne@68 4143 */
jpayne@68 4144 goto __pyx_L3;
jpayne@68 4145 }
jpayne@68 4146
jpayne@68 4147 /* "cpython/contextvars.pxd":124
jpayne@68 4148 * else:
jpayne@68 4149 * # value or default value of context variable
jpayne@68 4150 * pyvalue = <object>value # <<<<<<<<<<<<<<
jpayne@68 4151 * Py_XDECREF(value) # PyContextVar_Get() returned an owned reference as 'PyObject*'
jpayne@68 4152 * return pyvalue
jpayne@68 4153 */
jpayne@68 4154 /*else*/ {
jpayne@68 4155 __pyx_t_3 = ((PyObject *)__pyx_v_value);
jpayne@68 4156 __Pyx_INCREF(__pyx_t_3);
jpayne@68 4157 __pyx_v_pyvalue = __pyx_t_3;
jpayne@68 4158 __pyx_t_3 = 0;
jpayne@68 4159
jpayne@68 4160 /* "cpython/contextvars.pxd":125
jpayne@68 4161 * # value or default value of context variable
jpayne@68 4162 * pyvalue = <object>value
jpayne@68 4163 * Py_XDECREF(value) # PyContextVar_Get() returned an owned reference as 'PyObject*' # <<<<<<<<<<<<<<
jpayne@68 4164 * return pyvalue
jpayne@68 4165 *
jpayne@68 4166 */
jpayne@68 4167 Py_XDECREF(__pyx_v_value);
jpayne@68 4168 }
jpayne@68 4169 __pyx_L3:;
jpayne@68 4170
jpayne@68 4171 /* "cpython/contextvars.pxd":126
jpayne@68 4172 * pyvalue = <object>value
jpayne@68 4173 * Py_XDECREF(value) # PyContextVar_Get() returned an owned reference as 'PyObject*'
jpayne@68 4174 * return pyvalue # <<<<<<<<<<<<<<
jpayne@68 4175 *
jpayne@68 4176 *
jpayne@68 4177 */
jpayne@68 4178 __Pyx_XDECREF(__pyx_r);
jpayne@68 4179 __Pyx_INCREF(__pyx_v_pyvalue);
jpayne@68 4180 __pyx_r = __pyx_v_pyvalue;
jpayne@68 4181 goto __pyx_L0;
jpayne@68 4182
jpayne@68 4183 /* "cpython/contextvars.pxd":112
jpayne@68 4184 *
jpayne@68 4185 *
jpayne@68 4186 * cdef inline object get_value(var, default_value=None): # <<<<<<<<<<<<<<
jpayne@68 4187 * """Return a new reference to the value of the context variable,
jpayne@68 4188 * or the default value of the context variable,
jpayne@68 4189 */
jpayne@68 4190
jpayne@68 4191 /* function exit code */
jpayne@68 4192 __pyx_L1_error:;
jpayne@68 4193 __Pyx_XDECREF(__pyx_t_3);
jpayne@68 4194 __Pyx_AddTraceback("cpython.contextvars.get_value", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@68 4195 __pyx_r = 0;
jpayne@68 4196 __pyx_L0:;
jpayne@68 4197 __Pyx_XDECREF(__pyx_v_pyvalue);
jpayne@68 4198 __Pyx_XGIVEREF(__pyx_r);
jpayne@68 4199 __Pyx_RefNannyFinishContext();
jpayne@68 4200 return __pyx_r;
jpayne@68 4201 }
jpayne@68 4202
jpayne@68 4203 /* "cpython/contextvars.pxd":129
jpayne@68 4204 *
jpayne@68 4205 *
jpayne@68 4206 * cdef inline object get_value_no_default(var, default_value=None): # <<<<<<<<<<<<<<
jpayne@68 4207 * """Return a new reference to the value of the context variable,
jpayne@68 4208 * or the provided default value if no such value was found.
jpayne@68 4209 */
jpayne@68 4210
jpayne@68 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@68 4212 PyObject *__pyx_v_default_value = ((PyObject *)Py_None);
jpayne@68 4213 PyObject *__pyx_v_value;
jpayne@68 4214 PyObject *__pyx_v_pyvalue = NULL;
jpayne@68 4215 PyObject *__pyx_r = NULL;
jpayne@68 4216 __Pyx_RefNannyDeclarations
jpayne@68 4217 int __pyx_t_1;
jpayne@68 4218 PyObject *__pyx_t_2 = NULL;
jpayne@68 4219 int __pyx_lineno = 0;
jpayne@68 4220 const char *__pyx_filename = NULL;
jpayne@68 4221 int __pyx_clineno = 0;
jpayne@68 4222 __Pyx_RefNannySetupContext("get_value_no_default", 1);
jpayne@68 4223 if (__pyx_optional_args) {
jpayne@68 4224 if (__pyx_optional_args->__pyx_n > 0) {
jpayne@68 4225 __pyx_v_default_value = __pyx_optional_args->default_value;
jpayne@68 4226 }
jpayne@68 4227 }
jpayne@68 4228
jpayne@68 4229 /* "cpython/contextvars.pxd":135
jpayne@68 4230 * Ignores the default value of the context variable, if any.
jpayne@68 4231 * """
jpayne@68 4232 * cdef PyObject *value = NULL # <<<<<<<<<<<<<<
jpayne@68 4233 * PyContextVar_Get(var, <PyObject*>default_value, &value)
jpayne@68 4234 * # value of context variable or 'default_value'
jpayne@68 4235 */
jpayne@68 4236 __pyx_v_value = NULL;
jpayne@68 4237
jpayne@68 4238 /* "cpython/contextvars.pxd":136
jpayne@68 4239 * """
jpayne@68 4240 * cdef PyObject *value = NULL
jpayne@68 4241 * PyContextVar_Get(var, <PyObject*>default_value, &value) # <<<<<<<<<<<<<<
jpayne@68 4242 * # value of context variable or 'default_value'
jpayne@68 4243 * pyvalue = <object>value
jpayne@68 4244 */
jpayne@68 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@68 4246
jpayne@68 4247 /* "cpython/contextvars.pxd":138
jpayne@68 4248 * PyContextVar_Get(var, <PyObject*>default_value, &value)
jpayne@68 4249 * # value of context variable or 'default_value'
jpayne@68 4250 * pyvalue = <object>value # <<<<<<<<<<<<<<
jpayne@68 4251 * Py_XDECREF(value) # PyContextVar_Get() returned an owned reference as 'PyObject*'
jpayne@68 4252 * return pyvalue
jpayne@68 4253 */
jpayne@68 4254 __pyx_t_2 = ((PyObject *)__pyx_v_value);
jpayne@68 4255 __Pyx_INCREF(__pyx_t_2);
jpayne@68 4256 __pyx_v_pyvalue = __pyx_t_2;
jpayne@68 4257 __pyx_t_2 = 0;
jpayne@68 4258
jpayne@68 4259 /* "cpython/contextvars.pxd":139
jpayne@68 4260 * # value of context variable or 'default_value'
jpayne@68 4261 * pyvalue = <object>value
jpayne@68 4262 * Py_XDECREF(value) # PyContextVar_Get() returned an owned reference as 'PyObject*' # <<<<<<<<<<<<<<
jpayne@68 4263 * return pyvalue
jpayne@68 4264 */
jpayne@68 4265 Py_XDECREF(__pyx_v_value);
jpayne@68 4266
jpayne@68 4267 /* "cpython/contextvars.pxd":140
jpayne@68 4268 * pyvalue = <object>value
jpayne@68 4269 * Py_XDECREF(value) # PyContextVar_Get() returned an owned reference as 'PyObject*'
jpayne@68 4270 * return pyvalue # <<<<<<<<<<<<<<
jpayne@68 4271 */
jpayne@68 4272 __Pyx_XDECREF(__pyx_r);
jpayne@68 4273 __Pyx_INCREF(__pyx_v_pyvalue);
jpayne@68 4274 __pyx_r = __pyx_v_pyvalue;
jpayne@68 4275 goto __pyx_L0;
jpayne@68 4276
jpayne@68 4277 /* "cpython/contextvars.pxd":129
jpayne@68 4278 *
jpayne@68 4279 *
jpayne@68 4280 * cdef inline object get_value_no_default(var, default_value=None): # <<<<<<<<<<<<<<
jpayne@68 4281 * """Return a new reference to the value of the context variable,
jpayne@68 4282 * or the provided default value if no such value was found.
jpayne@68 4283 */
jpayne@68 4284
jpayne@68 4285 /* function exit code */
jpayne@68 4286 __pyx_L1_error:;
jpayne@68 4287 __Pyx_XDECREF(__pyx_t_2);
jpayne@68 4288 __Pyx_AddTraceback("cpython.contextvars.get_value_no_default", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@68 4289 __pyx_r = 0;
jpayne@68 4290 __pyx_L0:;
jpayne@68 4291 __Pyx_XDECREF(__pyx_v_pyvalue);
jpayne@68 4292 __Pyx_XGIVEREF(__pyx_r);
jpayne@68 4293 __Pyx_RefNannyFinishContext();
jpayne@68 4294 return __pyx_r;
jpayne@68 4295 }
jpayne@68 4296
jpayne@68 4297 /* "array.pxd":104
jpayne@68 4298 * __data_union data
jpayne@68 4299 *
jpayne@68 4300 * def __getbuffer__(self, Py_buffer* info, int flags): # <<<<<<<<<<<<<<
jpayne@68 4301 * # This implementation of getbuffer is geared towards Cython
jpayne@68 4302 * # requirements, and does not yet fulfill the PEP.
jpayne@68 4303 */
jpayne@68 4304
jpayne@68 4305 /* Python wrapper */
jpayne@68 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@68 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@68 4308 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
jpayne@68 4309 int __pyx_r;
jpayne@68 4310 __Pyx_RefNannyDeclarations
jpayne@68 4311 __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
jpayne@68 4312 __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
jpayne@68 4313 __pyx_r = __pyx_pf_7cpython_5array_5array___getbuffer__(((arrayobject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));
jpayne@68 4314
jpayne@68 4315 /* function exit code */
jpayne@68 4316 __Pyx_RefNannyFinishContext();
jpayne@68 4317 return __pyx_r;
jpayne@68 4318 }
jpayne@68 4319
jpayne@68 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@68 4321 PyObject *__pyx_v_item_count = NULL;
jpayne@68 4322 int __pyx_r;
jpayne@68 4323 __Pyx_RefNannyDeclarations
jpayne@68 4324 PyObject *__pyx_t_1 = NULL;
jpayne@68 4325 char *__pyx_t_2;
jpayne@68 4326 int __pyx_t_3;
jpayne@68 4327 PyObject *__pyx_t_4 = NULL;
jpayne@68 4328 Py_ssize_t __pyx_t_5;
jpayne@68 4329 int __pyx_t_6;
jpayne@68 4330 char __pyx_t_7;
jpayne@68 4331 int __pyx_lineno = 0;
jpayne@68 4332 const char *__pyx_filename = NULL;
jpayne@68 4333 int __pyx_clineno = 0;
jpayne@68 4334 if (unlikely(__pyx_v_info == NULL)) {
jpayne@68 4335 PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
jpayne@68 4336 return -1;
jpayne@68 4337 }
jpayne@68 4338 __Pyx_RefNannySetupContext("__getbuffer__", 0);
jpayne@68 4339 __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
jpayne@68 4340 __Pyx_GIVEREF(__pyx_v_info->obj);
jpayne@68 4341
jpayne@68 4342 /* "array.pxd":109
jpayne@68 4343 * # In particular strided access is always provided regardless
jpayne@68 4344 * # of flags
jpayne@68 4345 * item_count = Py_SIZE(self) # <<<<<<<<<<<<<<
jpayne@68 4346 *
jpayne@68 4347 * info.suboffsets = NULL
jpayne@68 4348 */
jpayne@68 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@68 4350 __Pyx_GOTREF(__pyx_t_1);
jpayne@68 4351 __pyx_v_item_count = __pyx_t_1;
jpayne@68 4352 __pyx_t_1 = 0;
jpayne@68 4353
jpayne@68 4354 /* "array.pxd":111
jpayne@68 4355 * item_count = Py_SIZE(self)
jpayne@68 4356 *
jpayne@68 4357 * info.suboffsets = NULL # <<<<<<<<<<<<<<
jpayne@68 4358 * info.buf = self.data.as_chars
jpayne@68 4359 * info.readonly = 0
jpayne@68 4360 */
jpayne@68 4361 __pyx_v_info->suboffsets = NULL;
jpayne@68 4362
jpayne@68 4363 /* "array.pxd":112
jpayne@68 4364 *
jpayne@68 4365 * info.suboffsets = NULL
jpayne@68 4366 * info.buf = self.data.as_chars # <<<<<<<<<<<<<<
jpayne@68 4367 * info.readonly = 0
jpayne@68 4368 * info.ndim = 1
jpayne@68 4369 */
jpayne@68 4370 __pyx_t_2 = __pyx_v_self->data.as_chars;
jpayne@68 4371 __pyx_v_info->buf = __pyx_t_2;
jpayne@68 4372
jpayne@68 4373 /* "array.pxd":113
jpayne@68 4374 * info.suboffsets = NULL
jpayne@68 4375 * info.buf = self.data.as_chars
jpayne@68 4376 * info.readonly = 0 # <<<<<<<<<<<<<<
jpayne@68 4377 * info.ndim = 1
jpayne@68 4378 * info.itemsize = self.ob_descr.itemsize # e.g. sizeof(float)
jpayne@68 4379 */
jpayne@68 4380 __pyx_v_info->readonly = 0;
jpayne@68 4381
jpayne@68 4382 /* "array.pxd":114
jpayne@68 4383 * info.buf = self.data.as_chars
jpayne@68 4384 * info.readonly = 0
jpayne@68 4385 * info.ndim = 1 # <<<<<<<<<<<<<<
jpayne@68 4386 * info.itemsize = self.ob_descr.itemsize # e.g. sizeof(float)
jpayne@68 4387 * info.len = info.itemsize * item_count
jpayne@68 4388 */
jpayne@68 4389 __pyx_v_info->ndim = 1;
jpayne@68 4390
jpayne@68 4391 /* "array.pxd":115
jpayne@68 4392 * info.readonly = 0
jpayne@68 4393 * info.ndim = 1
jpayne@68 4394 * info.itemsize = self.ob_descr.itemsize # e.g. sizeof(float) # <<<<<<<<<<<<<<
jpayne@68 4395 * info.len = info.itemsize * item_count
jpayne@68 4396 *
jpayne@68 4397 */
jpayne@68 4398 __pyx_t_3 = __pyx_v_self->ob_descr->itemsize;
jpayne@68 4399 __pyx_v_info->itemsize = __pyx_t_3;
jpayne@68 4400
jpayne@68 4401 /* "array.pxd":116
jpayne@68 4402 * info.ndim = 1
jpayne@68 4403 * info.itemsize = self.ob_descr.itemsize # e.g. sizeof(float)
jpayne@68 4404 * info.len = info.itemsize * item_count # <<<<<<<<<<<<<<
jpayne@68 4405 *
jpayne@68 4406 * info.shape = <Py_ssize_t*> PyObject_Malloc(sizeof(Py_ssize_t) + 2)
jpayne@68 4407 */
jpayne@68 4408 __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_info->itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 116, __pyx_L1_error)
jpayne@68 4409 __Pyx_GOTREF(__pyx_t_1);
jpayne@68 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@68 4411 __Pyx_GOTREF(__pyx_t_4);
jpayne@68 4412 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
jpayne@68 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@68 4414 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
jpayne@68 4415 __pyx_v_info->len = __pyx_t_5;
jpayne@68 4416
jpayne@68 4417 /* "array.pxd":118
jpayne@68 4418 * info.len = info.itemsize * item_count
jpayne@68 4419 *
jpayne@68 4420 * info.shape = <Py_ssize_t*> PyObject_Malloc(sizeof(Py_ssize_t) + 2) # <<<<<<<<<<<<<<
jpayne@68 4421 * if not info.shape:
jpayne@68 4422 * raise MemoryError()
jpayne@68 4423 */
jpayne@68 4424 __pyx_v_info->shape = ((Py_ssize_t *)PyObject_Malloc(((sizeof(Py_ssize_t)) + 2)));
jpayne@68 4425
jpayne@68 4426 /* "array.pxd":119
jpayne@68 4427 *
jpayne@68 4428 * info.shape = <Py_ssize_t*> PyObject_Malloc(sizeof(Py_ssize_t) + 2)
jpayne@68 4429 * if not info.shape: # <<<<<<<<<<<<<<
jpayne@68 4430 * raise MemoryError()
jpayne@68 4431 * info.shape[0] = item_count # constant regardless of resizing
jpayne@68 4432 */
jpayne@68 4433 __pyx_t_6 = (!(__pyx_v_info->shape != 0));
jpayne@68 4434 if (unlikely(__pyx_t_6)) {
jpayne@68 4435
jpayne@68 4436 /* "array.pxd":120
jpayne@68 4437 * info.shape = <Py_ssize_t*> PyObject_Malloc(sizeof(Py_ssize_t) + 2)
jpayne@68 4438 * if not info.shape:
jpayne@68 4439 * raise MemoryError() # <<<<<<<<<<<<<<
jpayne@68 4440 * info.shape[0] = item_count # constant regardless of resizing
jpayne@68 4441 * info.strides = &info.itemsize
jpayne@68 4442 */
jpayne@68 4443 PyErr_NoMemory(); __PYX_ERR(2, 120, __pyx_L1_error)
jpayne@68 4444
jpayne@68 4445 /* "array.pxd":119
jpayne@68 4446 *
jpayne@68 4447 * info.shape = <Py_ssize_t*> PyObject_Malloc(sizeof(Py_ssize_t) + 2)
jpayne@68 4448 * if not info.shape: # <<<<<<<<<<<<<<
jpayne@68 4449 * raise MemoryError()
jpayne@68 4450 * info.shape[0] = item_count # constant regardless of resizing
jpayne@68 4451 */
jpayne@68 4452 }
jpayne@68 4453
jpayne@68 4454 /* "array.pxd":121
jpayne@68 4455 * if not info.shape:
jpayne@68 4456 * raise MemoryError()
jpayne@68 4457 * info.shape[0] = item_count # constant regardless of resizing # <<<<<<<<<<<<<<
jpayne@68 4458 * info.strides = &info.itemsize
jpayne@68 4459 *
jpayne@68 4460 */
jpayne@68 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@68 4462 (__pyx_v_info->shape[0]) = __pyx_t_5;
jpayne@68 4463
jpayne@68 4464 /* "array.pxd":122
jpayne@68 4465 * raise MemoryError()
jpayne@68 4466 * info.shape[0] = item_count # constant regardless of resizing
jpayne@68 4467 * info.strides = &info.itemsize # <<<<<<<<<<<<<<
jpayne@68 4468 *
jpayne@68 4469 * info.format = <char*> (info.shape + 1)
jpayne@68 4470 */
jpayne@68 4471 __pyx_v_info->strides = (&__pyx_v_info->itemsize);
jpayne@68 4472
jpayne@68 4473 /* "array.pxd":124
jpayne@68 4474 * info.strides = &info.itemsize
jpayne@68 4475 *
jpayne@68 4476 * info.format = <char*> (info.shape + 1) # <<<<<<<<<<<<<<
jpayne@68 4477 * info.format[0] = self.ob_descr.typecode
jpayne@68 4478 * info.format[1] = 0
jpayne@68 4479 */
jpayne@68 4480 __pyx_v_info->format = ((char *)(__pyx_v_info->shape + 1));
jpayne@68 4481
jpayne@68 4482 /* "array.pxd":125
jpayne@68 4483 *
jpayne@68 4484 * info.format = <char*> (info.shape + 1)
jpayne@68 4485 * info.format[0] = self.ob_descr.typecode # <<<<<<<<<<<<<<
jpayne@68 4486 * info.format[1] = 0
jpayne@68 4487 * info.obj = self
jpayne@68 4488 */
jpayne@68 4489 __pyx_t_7 = __pyx_v_self->ob_descr->typecode;
jpayne@68 4490 (__pyx_v_info->format[0]) = __pyx_t_7;
jpayne@68 4491
jpayne@68 4492 /* "array.pxd":126
jpayne@68 4493 * info.format = <char*> (info.shape + 1)
jpayne@68 4494 * info.format[0] = self.ob_descr.typecode
jpayne@68 4495 * info.format[1] = 0 # <<<<<<<<<<<<<<
jpayne@68 4496 * info.obj = self
jpayne@68 4497 *
jpayne@68 4498 */
jpayne@68 4499 (__pyx_v_info->format[1]) = 0;
jpayne@68 4500
jpayne@68 4501 /* "array.pxd":127
jpayne@68 4502 * info.format[0] = self.ob_descr.typecode
jpayne@68 4503 * info.format[1] = 0
jpayne@68 4504 * info.obj = self # <<<<<<<<<<<<<<
jpayne@68 4505 *
jpayne@68 4506 * def __releasebuffer__(self, Py_buffer* info):
jpayne@68 4507 */
jpayne@68 4508 __Pyx_INCREF((PyObject *)__pyx_v_self);
jpayne@68 4509 __Pyx_GIVEREF((PyObject *)__pyx_v_self);
jpayne@68 4510 __Pyx_GOTREF(__pyx_v_info->obj);
jpayne@68 4511 __Pyx_DECREF(__pyx_v_info->obj);
jpayne@68 4512 __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
jpayne@68 4513
jpayne@68 4514 /* "array.pxd":104
jpayne@68 4515 * __data_union data
jpayne@68 4516 *
jpayne@68 4517 * def __getbuffer__(self, Py_buffer* info, int flags): # <<<<<<<<<<<<<<
jpayne@68 4518 * # This implementation of getbuffer is geared towards Cython
jpayne@68 4519 * # requirements, and does not yet fulfill the PEP.
jpayne@68 4520 */
jpayne@68 4521
jpayne@68 4522 /* function exit code */
jpayne@68 4523 __pyx_r = 0;
jpayne@68 4524 goto __pyx_L0;
jpayne@68 4525 __pyx_L1_error:;
jpayne@68 4526 __Pyx_XDECREF(__pyx_t_1);
jpayne@68 4527 __Pyx_XDECREF(__pyx_t_4);
jpayne@68 4528 __Pyx_AddTraceback("cpython.array.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@68 4529 __pyx_r = -1;
jpayne@68 4530 if (__pyx_v_info->obj != NULL) {
jpayne@68 4531 __Pyx_GOTREF(__pyx_v_info->obj);
jpayne@68 4532 __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
jpayne@68 4533 }
jpayne@68 4534 goto __pyx_L2;
jpayne@68 4535 __pyx_L0:;
jpayne@68 4536 if (__pyx_v_info->obj == Py_None) {
jpayne@68 4537 __Pyx_GOTREF(__pyx_v_info->obj);
jpayne@68 4538 __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
jpayne@68 4539 }
jpayne@68 4540 __pyx_L2:;
jpayne@68 4541 __Pyx_XDECREF(__pyx_v_item_count);
jpayne@68 4542 __Pyx_RefNannyFinishContext();
jpayne@68 4543 return __pyx_r;
jpayne@68 4544 }
jpayne@68 4545
jpayne@68 4546 /* "array.pxd":129
jpayne@68 4547 * info.obj = self
jpayne@68 4548 *
jpayne@68 4549 * def __releasebuffer__(self, Py_buffer* info): # <<<<<<<<<<<<<<
jpayne@68 4550 * PyObject_Free(info.shape)
jpayne@68 4551 *
jpayne@68 4552 */
jpayne@68 4553
jpayne@68 4554 /* Python wrapper */
jpayne@68 4555 CYTHON_UNUSED static void __pyx_pw_7cpython_5array_5array_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
jpayne@68 4556 CYTHON_UNUSED static void __pyx_pw_7cpython_5array_5array_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
jpayne@68 4557 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
jpayne@68 4558 __Pyx_RefNannyDeclarations
jpayne@68 4559 __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0);
jpayne@68 4560 __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
jpayne@68 4561 __pyx_pf_7cpython_5array_5array_2__releasebuffer__(((arrayobject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info));
jpayne@68 4562
jpayne@68 4563 /* function exit code */
jpayne@68 4564 __Pyx_RefNannyFinishContext();
jpayne@68 4565 }
jpayne@68 4566
jpayne@68 4567 static void __pyx_pf_7cpython_5array_5array_2__releasebuffer__(CYTHON_UNUSED arrayobject *__pyx_v_self, Py_buffer *__pyx_v_info) {
jpayne@68 4568
jpayne@68 4569 /* "array.pxd":130
jpayne@68 4570 *
jpayne@68 4571 * def __releasebuffer__(self, Py_buffer* info):
jpayne@68 4572 * PyObject_Free(info.shape) # <<<<<<<<<<<<<<
jpayne@68 4573 *
jpayne@68 4574 * array newarrayobject(PyTypeObject* type, Py_ssize_t size, arraydescr *descr)
jpayne@68 4575 */
jpayne@68 4576 PyObject_Free(__pyx_v_info->shape);
jpayne@68 4577
jpayne@68 4578 /* "array.pxd":129
jpayne@68 4579 * info.obj = self
jpayne@68 4580 *
jpayne@68 4581 * def __releasebuffer__(self, Py_buffer* info): # <<<<<<<<<<<<<<
jpayne@68 4582 * PyObject_Free(info.shape)
jpayne@68 4583 *
jpayne@68 4584 */
jpayne@68 4585
jpayne@68 4586 /* function exit code */
jpayne@68 4587 }
jpayne@68 4588
jpayne@68 4589 /* "array.pxd":141
jpayne@68 4590 *
jpayne@68 4591 *
jpayne@68 4592 * cdef inline array clone(array template, Py_ssize_t length, bint zero): # <<<<<<<<<<<<<<
jpayne@68 4593 * """ fast creation of a new array, given a template array.
jpayne@68 4594 * type will be same as template.
jpayne@68 4595 */
jpayne@68 4596
jpayne@68 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@68 4598 arrayobject *__pyx_v_op = 0;
jpayne@68 4599 arrayobject *__pyx_r = NULL;
jpayne@68 4600 __Pyx_RefNannyDeclarations
jpayne@68 4601 PyObject *__pyx_t_1 = NULL;
jpayne@68 4602 int __pyx_t_2;
jpayne@68 4603 int __pyx_t_3;
jpayne@68 4604 int __pyx_lineno = 0;
jpayne@68 4605 const char *__pyx_filename = NULL;
jpayne@68 4606 int __pyx_clineno = 0;
jpayne@68 4607 __Pyx_RefNannySetupContext("clone", 1);
jpayne@68 4608
jpayne@68 4609 /* "array.pxd":145
jpayne@68 4610 * type will be same as template.
jpayne@68 4611 * if zero is true, new array will be initialized with zeroes."""
jpayne@68 4612 * cdef array op = newarrayobject(Py_TYPE(template), length, template.ob_descr) # <<<<<<<<<<<<<<
jpayne@68 4613 * if zero and op is not None:
jpayne@68 4614 * memset(op.data.as_chars, 0, length * op.ob_descr.itemsize)
jpayne@68 4615 */
jpayne@68 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@68 4617 __Pyx_GOTREF(__pyx_t_1);
jpayne@68 4618 __pyx_v_op = ((arrayobject *)__pyx_t_1);
jpayne@68 4619 __pyx_t_1 = 0;
jpayne@68 4620
jpayne@68 4621 /* "array.pxd":146
jpayne@68 4622 * if zero is true, new array will be initialized with zeroes."""
jpayne@68 4623 * cdef array op = newarrayobject(Py_TYPE(template), length, template.ob_descr)
jpayne@68 4624 * if zero and op is not None: # <<<<<<<<<<<<<<
jpayne@68 4625 * memset(op.data.as_chars, 0, length * op.ob_descr.itemsize)
jpayne@68 4626 * return op
jpayne@68 4627 */
jpayne@68 4628 if (__pyx_v_zero) {
jpayne@68 4629 } else {
jpayne@68 4630 __pyx_t_2 = __pyx_v_zero;
jpayne@68 4631 goto __pyx_L4_bool_binop_done;
jpayne@68 4632 }
jpayne@68 4633 __pyx_t_3 = (((PyObject *)__pyx_v_op) != Py_None);
jpayne@68 4634 __pyx_t_2 = __pyx_t_3;
jpayne@68 4635 __pyx_L4_bool_binop_done:;
jpayne@68 4636 if (__pyx_t_2) {
jpayne@68 4637
jpayne@68 4638 /* "array.pxd":147
jpayne@68 4639 * cdef array op = newarrayobject(Py_TYPE(template), length, template.ob_descr)
jpayne@68 4640 * if zero and op is not None:
jpayne@68 4641 * memset(op.data.as_chars, 0, length * op.ob_descr.itemsize) # <<<<<<<<<<<<<<
jpayne@68 4642 * return op
jpayne@68 4643 *
jpayne@68 4644 */
jpayne@68 4645 (void)(memset(__pyx_v_op->data.as_chars, 0, (__pyx_v_length * __pyx_v_op->ob_descr->itemsize)));
jpayne@68 4646
jpayne@68 4647 /* "array.pxd":146
jpayne@68 4648 * if zero is true, new array will be initialized with zeroes."""
jpayne@68 4649 * cdef array op = newarrayobject(Py_TYPE(template), length, template.ob_descr)
jpayne@68 4650 * if zero and op is not None: # <<<<<<<<<<<<<<
jpayne@68 4651 * memset(op.data.as_chars, 0, length * op.ob_descr.itemsize)
jpayne@68 4652 * return op
jpayne@68 4653 */
jpayne@68 4654 }
jpayne@68 4655
jpayne@68 4656 /* "array.pxd":148
jpayne@68 4657 * if zero and op is not None:
jpayne@68 4658 * memset(op.data.as_chars, 0, length * op.ob_descr.itemsize)
jpayne@68 4659 * return op # <<<<<<<<<<<<<<
jpayne@68 4660 *
jpayne@68 4661 * cdef inline array copy(array self):
jpayne@68 4662 */
jpayne@68 4663 __Pyx_XDECREF((PyObject *)__pyx_r);
jpayne@68 4664 __Pyx_INCREF((PyObject *)__pyx_v_op);
jpayne@68 4665 __pyx_r = __pyx_v_op;
jpayne@68 4666 goto __pyx_L0;
jpayne@68 4667
jpayne@68 4668 /* "array.pxd":141
jpayne@68 4669 *
jpayne@68 4670 *
jpayne@68 4671 * cdef inline array clone(array template, Py_ssize_t length, bint zero): # <<<<<<<<<<<<<<
jpayne@68 4672 * """ fast creation of a new array, given a template array.
jpayne@68 4673 * type will be same as template.
jpayne@68 4674 */
jpayne@68 4675
jpayne@68 4676 /* function exit code */
jpayne@68 4677 __pyx_L1_error:;
jpayne@68 4678 __Pyx_XDECREF(__pyx_t_1);
jpayne@68 4679 __Pyx_AddTraceback("cpython.array.clone", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@68 4680 __pyx_r = 0;
jpayne@68 4681 __pyx_L0:;
jpayne@68 4682 __Pyx_XDECREF((PyObject *)__pyx_v_op);
jpayne@68 4683 __Pyx_XGIVEREF((PyObject *)__pyx_r);
jpayne@68 4684 __Pyx_RefNannyFinishContext();
jpayne@68 4685 return __pyx_r;
jpayne@68 4686 }
jpayne@68 4687
jpayne@68 4688 /* "array.pxd":150
jpayne@68 4689 * return op
jpayne@68 4690 *
jpayne@68 4691 * cdef inline array copy(array self): # <<<<<<<<<<<<<<
jpayne@68 4692 * """ make a copy of an array. """
jpayne@68 4693 * cdef array op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr)
jpayne@68 4694 */
jpayne@68 4695
jpayne@68 4696 static CYTHON_INLINE arrayobject *__pyx_f_7cpython_5array_copy(arrayobject *__pyx_v_self) {
jpayne@68 4697 arrayobject *__pyx_v_op = 0;
jpayne@68 4698 arrayobject *__pyx_r = NULL;
jpayne@68 4699 __Pyx_RefNannyDeclarations
jpayne@68 4700 PyObject *__pyx_t_1 = NULL;
jpayne@68 4701 int __pyx_lineno = 0;
jpayne@68 4702 const char *__pyx_filename = NULL;
jpayne@68 4703 int __pyx_clineno = 0;
jpayne@68 4704 __Pyx_RefNannySetupContext("copy", 1);
jpayne@68 4705
jpayne@68 4706 /* "array.pxd":152
jpayne@68 4707 * cdef inline array copy(array self):
jpayne@68 4708 * """ make a copy of an array. """
jpayne@68 4709 * cdef array op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr) # <<<<<<<<<<<<<<
jpayne@68 4710 * memcpy(op.data.as_chars, self.data.as_chars, Py_SIZE(op) * op.ob_descr.itemsize)
jpayne@68 4711 * return op
jpayne@68 4712 */
jpayne@68 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@68 4714 __Pyx_GOTREF(__pyx_t_1);
jpayne@68 4715 __pyx_v_op = ((arrayobject *)__pyx_t_1);
jpayne@68 4716 __pyx_t_1 = 0;
jpayne@68 4717
jpayne@68 4718 /* "array.pxd":153
jpayne@68 4719 * """ make a copy of an array. """
jpayne@68 4720 * cdef array op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr)
jpayne@68 4721 * memcpy(op.data.as_chars, self.data.as_chars, Py_SIZE(op) * op.ob_descr.itemsize) # <<<<<<<<<<<<<<
jpayne@68 4722 * return op
jpayne@68 4723 *
jpayne@68 4724 */
jpayne@68 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@68 4726
jpayne@68 4727 /* "array.pxd":154
jpayne@68 4728 * cdef array op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr)
jpayne@68 4729 * memcpy(op.data.as_chars, self.data.as_chars, Py_SIZE(op) * op.ob_descr.itemsize)
jpayne@68 4730 * return op # <<<<<<<<<<<<<<
jpayne@68 4731 *
jpayne@68 4732 * cdef inline int extend_buffer(array self, char* stuff, Py_ssize_t n) except -1:
jpayne@68 4733 */
jpayne@68 4734 __Pyx_XDECREF((PyObject *)__pyx_r);
jpayne@68 4735 __Pyx_INCREF((PyObject *)__pyx_v_op);
jpayne@68 4736 __pyx_r = __pyx_v_op;
jpayne@68 4737 goto __pyx_L0;
jpayne@68 4738
jpayne@68 4739 /* "array.pxd":150
jpayne@68 4740 * return op
jpayne@68 4741 *
jpayne@68 4742 * cdef inline array copy(array self): # <<<<<<<<<<<<<<
jpayne@68 4743 * """ make a copy of an array. """
jpayne@68 4744 * cdef array op = newarrayobject(Py_TYPE(self), Py_SIZE(self), self.ob_descr)
jpayne@68 4745 */
jpayne@68 4746
jpayne@68 4747 /* function exit code */
jpayne@68 4748 __pyx_L1_error:;
jpayne@68 4749 __Pyx_XDECREF(__pyx_t_1);
jpayne@68 4750 __Pyx_AddTraceback("cpython.array.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@68 4751 __pyx_r = 0;
jpayne@68 4752 __pyx_L0:;
jpayne@68 4753 __Pyx_XDECREF((PyObject *)__pyx_v_op);
jpayne@68 4754 __Pyx_XGIVEREF((PyObject *)__pyx_r);
jpayne@68 4755 __Pyx_RefNannyFinishContext();
jpayne@68 4756 return __pyx_r;
jpayne@68 4757 }
jpayne@68 4758
jpayne@68 4759 /* "array.pxd":156
jpayne@68 4760 * return op
jpayne@68 4761 *
jpayne@68 4762 * cdef inline int extend_buffer(array self, char* stuff, Py_ssize_t n) except -1: # <<<<<<<<<<<<<<
jpayne@68 4763 * """ efficient appending of new stuff of same type
jpayne@68 4764 * (e.g. of same array type)
jpayne@68 4765 */
jpayne@68 4766
jpayne@68 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@68 4768 Py_ssize_t __pyx_v_itemsize;
jpayne@68 4769 Py_ssize_t __pyx_v_origsize;
jpayne@68 4770 int __pyx_r;
jpayne@68 4771 int __pyx_t_1;
jpayne@68 4772 int __pyx_lineno = 0;
jpayne@68 4773 const char *__pyx_filename = NULL;
jpayne@68 4774 int __pyx_clineno = 0;
jpayne@68 4775
jpayne@68 4776 /* "array.pxd":160
jpayne@68 4777 * (e.g. of same array type)
jpayne@68 4778 * n: number of elements (not number of bytes!) """
jpayne@68 4779 * cdef Py_ssize_t itemsize = self.ob_descr.itemsize # <<<<<<<<<<<<<<
jpayne@68 4780 * cdef Py_ssize_t origsize = Py_SIZE(self)
jpayne@68 4781 * resize_smart(self, origsize + n)
jpayne@68 4782 */
jpayne@68 4783 __pyx_t_1 = __pyx_v_self->ob_descr->itemsize;
jpayne@68 4784 __pyx_v_itemsize = __pyx_t_1;
jpayne@68 4785
jpayne@68 4786 /* "array.pxd":161
jpayne@68 4787 * n: number of elements (not number of bytes!) """
jpayne@68 4788 * cdef Py_ssize_t itemsize = self.ob_descr.itemsize
jpayne@68 4789 * cdef Py_ssize_t origsize = Py_SIZE(self) # <<<<<<<<<<<<<<
jpayne@68 4790 * resize_smart(self, origsize + n)
jpayne@68 4791 * memcpy(self.data.as_chars + origsize * itemsize, stuff, n * itemsize)
jpayne@68 4792 */
jpayne@68 4793 __pyx_v_origsize = Py_SIZE(((PyObject *)__pyx_v_self));
jpayne@68 4794
jpayne@68 4795 /* "array.pxd":162
jpayne@68 4796 * cdef Py_ssize_t itemsize = self.ob_descr.itemsize
jpayne@68 4797 * cdef Py_ssize_t origsize = Py_SIZE(self)
jpayne@68 4798 * resize_smart(self, origsize + n) # <<<<<<<<<<<<<<
jpayne@68 4799 * memcpy(self.data.as_chars + origsize * itemsize, stuff, n * itemsize)
jpayne@68 4800 * return 0
jpayne@68 4801 */
jpayne@68 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@68 4803
jpayne@68 4804 /* "array.pxd":163
jpayne@68 4805 * cdef Py_ssize_t origsize = Py_SIZE(self)
jpayne@68 4806 * resize_smart(self, origsize + n)
jpayne@68 4807 * memcpy(self.data.as_chars + origsize * itemsize, stuff, n * itemsize) # <<<<<<<<<<<<<<
jpayne@68 4808 * return 0
jpayne@68 4809 *
jpayne@68 4810 */
jpayne@68 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@68 4812
jpayne@68 4813 /* "array.pxd":164
jpayne@68 4814 * resize_smart(self, origsize + n)
jpayne@68 4815 * memcpy(self.data.as_chars + origsize * itemsize, stuff, n * itemsize)
jpayne@68 4816 * return 0 # <<<<<<<<<<<<<<
jpayne@68 4817 *
jpayne@68 4818 * cdef inline int extend(array self, array other) except -1:
jpayne@68 4819 */
jpayne@68 4820 __pyx_r = 0;
jpayne@68 4821 goto __pyx_L0;
jpayne@68 4822
jpayne@68 4823 /* "array.pxd":156
jpayne@68 4824 * return op
jpayne@68 4825 *
jpayne@68 4826 * cdef inline int extend_buffer(array self, char* stuff, Py_ssize_t n) except -1: # <<<<<<<<<<<<<<
jpayne@68 4827 * """ efficient appending of new stuff of same type
jpayne@68 4828 * (e.g. of same array type)
jpayne@68 4829 */
jpayne@68 4830
jpayne@68 4831 /* function exit code */
jpayne@68 4832 __pyx_L1_error:;
jpayne@68 4833 __Pyx_AddTraceback("cpython.array.extend_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@68 4834 __pyx_r = -1;
jpayne@68 4835 __pyx_L0:;
jpayne@68 4836 return __pyx_r;
jpayne@68 4837 }
jpayne@68 4838
jpayne@68 4839 /* "array.pxd":166
jpayne@68 4840 * return 0
jpayne@68 4841 *
jpayne@68 4842 * cdef inline int extend(array self, array other) except -1: # <<<<<<<<<<<<<<
jpayne@68 4843 * """ extend array with data from another array; types must match. """
jpayne@68 4844 * if self.ob_descr.typecode != other.ob_descr.typecode:
jpayne@68 4845 */
jpayne@68 4846
jpayne@68 4847 static CYTHON_INLINE int __pyx_f_7cpython_5array_extend(arrayobject *__pyx_v_self, arrayobject *__pyx_v_other) {
jpayne@68 4848 int __pyx_r;
jpayne@68 4849 int __pyx_t_1;
jpayne@68 4850 int __pyx_t_2;
jpayne@68 4851 int __pyx_lineno = 0;
jpayne@68 4852 const char *__pyx_filename = NULL;
jpayne@68 4853 int __pyx_clineno = 0;
jpayne@68 4854
jpayne@68 4855 /* "array.pxd":168
jpayne@68 4856 * cdef inline int extend(array self, array other) except -1:
jpayne@68 4857 * """ extend array with data from another array; types must match. """
jpayne@68 4858 * if self.ob_descr.typecode != other.ob_descr.typecode: # <<<<<<<<<<<<<<
jpayne@68 4859 * PyErr_BadArgument()
jpayne@68 4860 * return extend_buffer(self, other.data.as_chars, Py_SIZE(other))
jpayne@68 4861 */
jpayne@68 4862 __pyx_t_1 = (__pyx_v_self->ob_descr->typecode != __pyx_v_other->ob_descr->typecode);
jpayne@68 4863 if (__pyx_t_1) {
jpayne@68 4864
jpayne@68 4865 /* "array.pxd":169
jpayne@68 4866 * """ extend array with data from another array; types must match. """
jpayne@68 4867 * if self.ob_descr.typecode != other.ob_descr.typecode:
jpayne@68 4868 * PyErr_BadArgument() # <<<<<<<<<<<<<<
jpayne@68 4869 * return extend_buffer(self, other.data.as_chars, Py_SIZE(other))
jpayne@68 4870 *
jpayne@68 4871 */
jpayne@68 4872 __pyx_t_2 = PyErr_BadArgument(); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(2, 169, __pyx_L1_error)
jpayne@68 4873
jpayne@68 4874 /* "array.pxd":168
jpayne@68 4875 * cdef inline int extend(array self, array other) except -1:
jpayne@68 4876 * """ extend array with data from another array; types must match. """
jpayne@68 4877 * if self.ob_descr.typecode != other.ob_descr.typecode: # <<<<<<<<<<<<<<
jpayne@68 4878 * PyErr_BadArgument()
jpayne@68 4879 * return extend_buffer(self, other.data.as_chars, Py_SIZE(other))
jpayne@68 4880 */
jpayne@68 4881 }
jpayne@68 4882
jpayne@68 4883 /* "array.pxd":170
jpayne@68 4884 * if self.ob_descr.typecode != other.ob_descr.typecode:
jpayne@68 4885 * PyErr_BadArgument()
jpayne@68 4886 * return extend_buffer(self, other.data.as_chars, Py_SIZE(other)) # <<<<<<<<<<<<<<
jpayne@68 4887 *
jpayne@68 4888 * cdef inline void zero(array self) noexcept:
jpayne@68 4889 */
jpayne@68 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@68 4891 __pyx_r = __pyx_t_2;
jpayne@68 4892 goto __pyx_L0;
jpayne@68 4893
jpayne@68 4894 /* "array.pxd":166
jpayne@68 4895 * return 0
jpayne@68 4896 *
jpayne@68 4897 * cdef inline int extend(array self, array other) except -1: # <<<<<<<<<<<<<<
jpayne@68 4898 * """ extend array with data from another array; types must match. """
jpayne@68 4899 * if self.ob_descr.typecode != other.ob_descr.typecode:
jpayne@68 4900 */
jpayne@68 4901
jpayne@68 4902 /* function exit code */
jpayne@68 4903 __pyx_L1_error:;
jpayne@68 4904 __Pyx_AddTraceback("cpython.array.extend", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@68 4905 __pyx_r = -1;
jpayne@68 4906 __pyx_L0:;
jpayne@68 4907 return __pyx_r;
jpayne@68 4908 }
jpayne@68 4909
jpayne@68 4910 /* "array.pxd":172
jpayne@68 4911 * return extend_buffer(self, other.data.as_chars, Py_SIZE(other))
jpayne@68 4912 *
jpayne@68 4913 * cdef inline void zero(array self) noexcept: # <<<<<<<<<<<<<<
jpayne@68 4914 * """ set all elements of array to zero. """
jpayne@68 4915 * memset(self.data.as_chars, 0, Py_SIZE(self) * self.ob_descr.itemsize)
jpayne@68 4916 */
jpayne@68 4917
jpayne@68 4918 static CYTHON_INLINE void __pyx_f_7cpython_5array_zero(arrayobject *__pyx_v_self) {
jpayne@68 4919
jpayne@68 4920 /* "array.pxd":174
jpayne@68 4921 * cdef inline void zero(array self) noexcept:
jpayne@68 4922 * """ set all elements of array to zero. """
jpayne@68 4923 * memset(self.data.as_chars, 0, Py_SIZE(self) * self.ob_descr.itemsize) # <<<<<<<<<<<<<<
jpayne@68 4924 */
jpayne@68 4925 (void)(memset(__pyx_v_self->data.as_chars, 0, (Py_SIZE(((PyObject *)__pyx_v_self)) * __pyx_v_self->ob_descr->itemsize)));
jpayne@68 4926
jpayne@68 4927 /* "array.pxd":172
jpayne@68 4928 * return extend_buffer(self, other.data.as_chars, Py_SIZE(other))
jpayne@68 4929 *
jpayne@68 4930 * cdef inline void zero(array self) noexcept: # <<<<<<<<<<<<<<
jpayne@68 4931 * """ set all elements of array to zero. """
jpayne@68 4932 * memset(self.data.as_chars, 0, Py_SIZE(self) * self.ob_descr.itemsize)
jpayne@68 4933 */
jpayne@68 4934
jpayne@68 4935 /* function exit code */
jpayne@68 4936 }
jpayne@68 4937
jpayne@68 4938 /* "pysam/libcutils.pyx":36
jpayne@68 4939 * #################################################################
jpayne@68 4940 * # Utility functions for quality string conversions
jpayne@68 4941 * cpdef c_array.array qualitystring_to_array(input_str, int offset=33): # <<<<<<<<<<<<<<
jpayne@68 4942 * """convert a qualitystring to an array of quality values."""
jpayne@68 4943 * if input_str is None:
jpayne@68 4944 */
jpayne@68 4945
jpayne@68 4946 static PyObject *__pyx_pw_5pysam_9libcutils_1qualitystring_to_array(PyObject *__pyx_self,
jpayne@68 4947 #if CYTHON_METH_FASTCALL
jpayne@68 4948 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
jpayne@68 4949 #else
jpayne@68 4950 PyObject *__pyx_args, PyObject *__pyx_kwds
jpayne@68 4951 #endif
jpayne@68 4952 ); /*proto*/
jpayne@68 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@68 4954 int __pyx_v_offset = ((int)33);
jpayne@68 4955 PyObject *__pyx_v_qs = NULL;
jpayne@68 4956 char __pyx_7genexpr__pyx_v_i;
jpayne@68 4957 arrayobject *__pyx_r = NULL;
jpayne@68 4958 __Pyx_RefNannyDeclarations
jpayne@68 4959 int __pyx_t_1;
jpayne@68 4960 PyObject *__pyx_t_2 = NULL;
jpayne@68 4961 PyObject *__pyx_t_3 = NULL;
jpayne@68 4962 char *__pyx_t_4;
jpayne@68 4963 char *__pyx_t_5;
jpayne@68 4964 char *__pyx_t_6;
jpayne@68 4965 char *__pyx_t_7;
jpayne@68 4966 PyObject *__pyx_t_8 = NULL;
jpayne@68 4967 int __pyx_lineno = 0;
jpayne@68 4968 const char *__pyx_filename = NULL;
jpayne@68 4969 int __pyx_clineno = 0;
jpayne@68 4970 __Pyx_RefNannySetupContext("qualitystring_to_array", 1);
jpayne@68 4971 if (__pyx_optional_args) {
jpayne@68 4972 if (__pyx_optional_args->__pyx_n > 0) {
jpayne@68 4973 __pyx_v_offset = __pyx_optional_args->offset;
jpayne@68 4974 }
jpayne@68 4975 }
jpayne@68 4976
jpayne@68 4977 /* "pysam/libcutils.pyx":38
jpayne@68 4978 * cpdef c_array.array qualitystring_to_array(input_str, int offset=33):
jpayne@68 4979 * """convert a qualitystring to an array of quality values."""
jpayne@68 4980 * if input_str is None: # <<<<<<<<<<<<<<
jpayne@68 4981 * return None
jpayne@68 4982 * qs = force_bytes(input_str)
jpayne@68 4983 */
jpayne@68 4984 __pyx_t_1 = (__pyx_v_input_str == Py_None);
jpayne@68 4985 if (__pyx_t_1) {
jpayne@68 4986
jpayne@68 4987 /* "pysam/libcutils.pyx":39
jpayne@68 4988 * """convert a qualitystring to an array of quality values."""
jpayne@68 4989 * if input_str is None:
jpayne@68 4990 * return None # <<<<<<<<<<<<<<
jpayne@68 4991 * qs = force_bytes(input_str)
jpayne@68 4992 * cdef char i
jpayne@68 4993 */
jpayne@68 4994 __Pyx_XDECREF((PyObject *)__pyx_r);
jpayne@68 4995 __pyx_r = ((arrayobject *)Py_None); __Pyx_INCREF(Py_None);
jpayne@68 4996 goto __pyx_L0;
jpayne@68 4997
jpayne@68 4998 /* "pysam/libcutils.pyx":38
jpayne@68 4999 * cpdef c_array.array qualitystring_to_array(input_str, int offset=33):
jpayne@68 5000 * """convert a qualitystring to an array of quality values."""
jpayne@68 5001 * if input_str is None: # <<<<<<<<<<<<<<
jpayne@68 5002 * return None
jpayne@68 5003 * qs = force_bytes(input_str)
jpayne@68 5004 */
jpayne@68 5005 }
jpayne@68 5006
jpayne@68 5007 /* "pysam/libcutils.pyx":40
jpayne@68 5008 * if input_str is None:
jpayne@68 5009 * return None
jpayne@68 5010 * qs = force_bytes(input_str) # <<<<<<<<<<<<<<
jpayne@68 5011 * cdef char i
jpayne@68 5012 * return c_array.array('B', [i - offset for i in qs])
jpayne@68 5013 */
jpayne@68 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@68 5015 __Pyx_GOTREF(__pyx_t_2);
jpayne@68 5016 __pyx_v_qs = ((PyObject*)__pyx_t_2);
jpayne@68 5017 __pyx_t_2 = 0;
jpayne@68 5018
jpayne@68 5019 /* "pysam/libcutils.pyx":42
jpayne@68 5020 * qs = force_bytes(input_str)
jpayne@68 5021 * cdef char i
jpayne@68 5022 * return c_array.array('B', [i - offset for i in qs]) # <<<<<<<<<<<<<<
jpayne@68 5023 *
jpayne@68 5024 *
jpayne@68 5025 */
jpayne@68 5026 __Pyx_XDECREF((PyObject *)__pyx_r);
jpayne@68 5027 { /* enter inner scope */
jpayne@68 5028 __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 42, __pyx_L1_error)
jpayne@68 5029 __Pyx_GOTREF(__pyx_t_2);
jpayne@68 5030 if (unlikely(__pyx_v_qs == Py_None)) {
jpayne@68 5031 PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable");
jpayne@68 5032 __PYX_ERR(0, 42, __pyx_L1_error)
jpayne@68 5033 }
jpayne@68 5034 __Pyx_INCREF(__pyx_v_qs);
jpayne@68 5035 __pyx_t_3 = __pyx_v_qs;
jpayne@68 5036 __pyx_t_5 = PyBytes_AS_STRING(__pyx_t_3);
jpayne@68 5037 __pyx_t_6 = (__pyx_t_5 + PyBytes_GET_SIZE(__pyx_t_3));
jpayne@68 5038 for (__pyx_t_7 = __pyx_t_5; __pyx_t_7 < __pyx_t_6; __pyx_t_7++) {
jpayne@68 5039 __pyx_t_4 = __pyx_t_7;
jpayne@68 5040 __pyx_7genexpr__pyx_v_i = (__pyx_t_4[0]);
jpayne@68 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@68 5042 __Pyx_GOTREF(__pyx_t_8);
jpayne@68 5043 if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_8))) __PYX_ERR(0, 42, __pyx_L1_error)
jpayne@68 5044 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
jpayne@68 5045 }
jpayne@68 5046 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@68 5047 } /* exit inner scope */
jpayne@68 5048 __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 42, __pyx_L1_error)
jpayne@68 5049 __Pyx_GOTREF(__pyx_t_8);
jpayne@68 5050 __Pyx_INCREF(__pyx_n_u_B);
jpayne@68 5051 __Pyx_GIVEREF(__pyx_n_u_B);
jpayne@68 5052 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_n_u_B)) __PYX_ERR(0, 42, __pyx_L1_error);
jpayne@68 5053 __Pyx_GIVEREF(__pyx_t_2);
jpayne@68 5054 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_2)) __PYX_ERR(0, 42, __pyx_L1_error);
jpayne@68 5055 __pyx_t_2 = 0;
jpayne@68 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@68 5057 __Pyx_GOTREF(__pyx_t_2);
jpayne@68 5058 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
jpayne@68 5059 __pyx_r = ((arrayobject *)__pyx_t_2);
jpayne@68 5060 __pyx_t_2 = 0;
jpayne@68 5061 goto __pyx_L0;
jpayne@68 5062
jpayne@68 5063 /* "pysam/libcutils.pyx":36
jpayne@68 5064 * #################################################################
jpayne@68 5065 * # Utility functions for quality string conversions
jpayne@68 5066 * cpdef c_array.array qualitystring_to_array(input_str, int offset=33): # <<<<<<<<<<<<<<
jpayne@68 5067 * """convert a qualitystring to an array of quality values."""
jpayne@68 5068 * if input_str is None:
jpayne@68 5069 */
jpayne@68 5070
jpayne@68 5071 /* function exit code */
jpayne@68 5072 __pyx_L1_error:;
jpayne@68 5073 __Pyx_XDECREF(__pyx_t_2);
jpayne@68 5074 __Pyx_XDECREF(__pyx_t_3);
jpayne@68 5075 __Pyx_XDECREF(__pyx_t_8);
jpayne@68 5076 __Pyx_AddTraceback("pysam.libcutils.qualitystring_to_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@68 5077 __pyx_r = 0;
jpayne@68 5078 __pyx_L0:;
jpayne@68 5079 __Pyx_XDECREF(__pyx_v_qs);
jpayne@68 5080 __Pyx_XGIVEREF((PyObject *)__pyx_r);
jpayne@68 5081 __Pyx_RefNannyFinishContext();
jpayne@68 5082 return __pyx_r;
jpayne@68 5083 }
jpayne@68 5084
jpayne@68 5085 /* Python wrapper */
jpayne@68 5086 static PyObject *__pyx_pw_5pysam_9libcutils_1qualitystring_to_array(PyObject *__pyx_self,
jpayne@68 5087 #if CYTHON_METH_FASTCALL
jpayne@68 5088 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
jpayne@68 5089 #else
jpayne@68 5090 PyObject *__pyx_args, PyObject *__pyx_kwds
jpayne@68 5091 #endif
jpayne@68 5092 ); /*proto*/
jpayne@68 5093 PyDoc_STRVAR(__pyx_doc_5pysam_9libcutils_qualitystring_to_array, "convert a qualitystring to an array of quality values.");
jpayne@68 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@68 5095 static PyObject *__pyx_pw_5pysam_9libcutils_1qualitystring_to_array(PyObject *__pyx_self,
jpayne@68 5096 #if CYTHON_METH_FASTCALL
jpayne@68 5097 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
jpayne@68 5098 #else
jpayne@68 5099 PyObject *__pyx_args, PyObject *__pyx_kwds
jpayne@68 5100 #endif
jpayne@68 5101 ) {
jpayne@68 5102 PyObject *__pyx_v_input_str = 0;
jpayne@68 5103 int __pyx_v_offset;
jpayne@68 5104 #if !CYTHON_METH_FASTCALL
jpayne@68 5105 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
jpayne@68 5106 #endif
jpayne@68 5107 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
jpayne@68 5108 PyObject* values[2] = {0,0};
jpayne@68 5109 int __pyx_lineno = 0;
jpayne@68 5110 const char *__pyx_filename = NULL;
jpayne@68 5111 int __pyx_clineno = 0;
jpayne@68 5112 PyObject *__pyx_r = 0;
jpayne@68 5113 __Pyx_RefNannyDeclarations
jpayne@68 5114 __Pyx_RefNannySetupContext("qualitystring_to_array (wrapper)", 0);
jpayne@68 5115 #if !CYTHON_METH_FASTCALL
jpayne@68 5116 #if CYTHON_ASSUME_SAFE_MACROS
jpayne@68 5117 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
jpayne@68 5118 #else
jpayne@68 5119 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
jpayne@68 5120 #endif
jpayne@68 5121 #endif
jpayne@68 5122 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
jpayne@68 5123 {
jpayne@68 5124 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_input_str,&__pyx_n_s_offset,0};
jpayne@68 5125 if (__pyx_kwds) {
jpayne@68 5126 Py_ssize_t kw_args;
jpayne@68 5127 switch (__pyx_nargs) {
jpayne@68 5128 case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
jpayne@68 5129 CYTHON_FALLTHROUGH;
jpayne@68 5130 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
jpayne@68 5131 CYTHON_FALLTHROUGH;
jpayne@68 5132 case 0: break;
jpayne@68 5133 default: goto __pyx_L5_argtuple_error;
jpayne@68 5134 }
jpayne@68 5135 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
jpayne@68 5136 switch (__pyx_nargs) {
jpayne@68 5137 case 0:
jpayne@68 5138 if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_input_str)) != 0)) {
jpayne@68 5139 (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
jpayne@68 5140 kw_args--;
jpayne@68 5141 }
jpayne@68 5142 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 36, __pyx_L3_error)
jpayne@68 5143 else goto __pyx_L5_argtuple_error;
jpayne@68 5144 CYTHON_FALLTHROUGH;
jpayne@68 5145 case 1:
jpayne@68 5146 if (kw_args > 0) {
jpayne@68 5147 PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_offset);
jpayne@68 5148 if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
jpayne@68 5149 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 36, __pyx_L3_error)
jpayne@68 5150 }
jpayne@68 5151 }
jpayne@68 5152 if (unlikely(kw_args > 0)) {
jpayne@68 5153 const Py_ssize_t kwd_pos_args = __pyx_nargs;
jpayne@68 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@68 5155 }
jpayne@68 5156 } else {
jpayne@68 5157 switch (__pyx_nargs) {
jpayne@68 5158 case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
jpayne@68 5159 CYTHON_FALLTHROUGH;
jpayne@68 5160 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
jpayne@68 5161 break;
jpayne@68 5162 default: goto __pyx_L5_argtuple_error;
jpayne@68 5163 }
jpayne@68 5164 }
jpayne@68 5165 __pyx_v_input_str = values[0];
jpayne@68 5166 if (values[1]) {
jpayne@68 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@68 5168 } else {
jpayne@68 5169 __pyx_v_offset = ((int)33);
jpayne@68 5170 }
jpayne@68 5171 }
jpayne@68 5172 goto __pyx_L6_skip;
jpayne@68 5173 __pyx_L5_argtuple_error:;
jpayne@68 5174 __Pyx_RaiseArgtupleInvalid("qualitystring_to_array", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 36, __pyx_L3_error)
jpayne@68 5175 __pyx_L6_skip:;
jpayne@68 5176 goto __pyx_L4_argument_unpacking_done;
jpayne@68 5177 __pyx_L3_error:;
jpayne@68 5178 {
jpayne@68 5179 Py_ssize_t __pyx_temp;
jpayne@68 5180 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
jpayne@68 5181 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
jpayne@68 5182 }
jpayne@68 5183 }
jpayne@68 5184 __Pyx_AddTraceback("pysam.libcutils.qualitystring_to_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@68 5185 __Pyx_RefNannyFinishContext();
jpayne@68 5186 return NULL;
jpayne@68 5187 __pyx_L4_argument_unpacking_done:;
jpayne@68 5188 __pyx_r = __pyx_pf_5pysam_9libcutils_qualitystring_to_array(__pyx_self, __pyx_v_input_str, __pyx_v_offset);
jpayne@68 5189
jpayne@68 5190 /* function exit code */
jpayne@68 5191 {
jpayne@68 5192 Py_ssize_t __pyx_temp;
jpayne@68 5193 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
jpayne@68 5194 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
jpayne@68 5195 }
jpayne@68 5196 }
jpayne@68 5197 __Pyx_RefNannyFinishContext();
jpayne@68 5198 return __pyx_r;
jpayne@68 5199 }
jpayne@68 5200
jpayne@68 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@68 5202 PyObject *__pyx_r = NULL;
jpayne@68 5203 __Pyx_RefNannyDeclarations
jpayne@68 5204 PyObject *__pyx_t_1 = NULL;
jpayne@68 5205 struct __pyx_opt_args_5pysam_9libcutils_qualitystring_to_array __pyx_t_2;
jpayne@68 5206 int __pyx_lineno = 0;
jpayne@68 5207 const char *__pyx_filename = NULL;
jpayne@68 5208 int __pyx_clineno = 0;
jpayne@68 5209 __Pyx_RefNannySetupContext("qualitystring_to_array", 1);
jpayne@68 5210 __Pyx_XDECREF(__pyx_r);
jpayne@68 5211 __pyx_t_2.__pyx_n = 1;
jpayne@68 5212 __pyx_t_2.offset = __pyx_v_offset;
jpayne@68 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@68 5214 __Pyx_GOTREF(__pyx_t_1);
jpayne@68 5215 __pyx_r = __pyx_t_1;
jpayne@68 5216 __pyx_t_1 = 0;
jpayne@68 5217 goto __pyx_L0;
jpayne@68 5218
jpayne@68 5219 /* function exit code */
jpayne@68 5220 __pyx_L1_error:;
jpayne@68 5221 __Pyx_XDECREF(__pyx_t_1);
jpayne@68 5222 __Pyx_AddTraceback("pysam.libcutils.qualitystring_to_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@68 5223 __pyx_r = NULL;
jpayne@68 5224 __pyx_L0:;
jpayne@68 5225 __Pyx_XGIVEREF(__pyx_r);
jpayne@68 5226 __Pyx_RefNannyFinishContext();
jpayne@68 5227 return __pyx_r;
jpayne@68 5228 }
jpayne@68 5229
jpayne@68 5230 /* "pysam/libcutils.pyx":45
jpayne@68 5231 *
jpayne@68 5232 *
jpayne@68 5233 * cpdef array_to_qualitystring(c_array.array qualities, int offset=33): # <<<<<<<<<<<<<<
jpayne@68 5234 * """convert an array of quality values to a string."""
jpayne@68 5235 * if qualities is None:
jpayne@68 5236 */
jpayne@68 5237
jpayne@68 5238 static PyObject *__pyx_pw_5pysam_9libcutils_3array_to_qualitystring(PyObject *__pyx_self,
jpayne@68 5239 #if CYTHON_METH_FASTCALL
jpayne@68 5240 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
jpayne@68 5241 #else
jpayne@68 5242 PyObject *__pyx_args, PyObject *__pyx_kwds
jpayne@68 5243 #endif
jpayne@68 5244 ); /*proto*/
jpayne@68 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@68 5246 int __pyx_v_offset = ((int)33);
jpayne@68 5247 int __pyx_v_x;
jpayne@68 5248 arrayobject *__pyx_v_result = 0;
jpayne@68 5249 PyObject *__pyx_r = NULL;
jpayne@68 5250 __Pyx_RefNannyDeclarations
jpayne@68 5251 int __pyx_t_1;
jpayne@68 5252 Py_ssize_t __pyx_t_2;
jpayne@68 5253 PyObject *__pyx_t_3 = NULL;
jpayne@68 5254 PyObject *__pyx_t_4 = NULL;
jpayne@68 5255 PyObject *__pyx_t_5 = NULL;
jpayne@68 5256 unsigned int __pyx_t_6;
jpayne@68 5257 int __pyx_lineno = 0;
jpayne@68 5258 const char *__pyx_filename = NULL;
jpayne@68 5259 int __pyx_clineno = 0;
jpayne@68 5260 __Pyx_RefNannySetupContext("array_to_qualitystring", 1);
jpayne@68 5261 if (__pyx_optional_args) {
jpayne@68 5262 if (__pyx_optional_args->__pyx_n > 0) {
jpayne@68 5263 __pyx_v_offset = __pyx_optional_args->offset;
jpayne@68 5264 }
jpayne@68 5265 }
jpayne@68 5266
jpayne@68 5267 /* "pysam/libcutils.pyx":47
jpayne@68 5268 * cpdef array_to_qualitystring(c_array.array qualities, int offset=33):
jpayne@68 5269 * """convert an array of quality values to a string."""
jpayne@68 5270 * if qualities is None: # <<<<<<<<<<<<<<
jpayne@68 5271 * return None
jpayne@68 5272 * cdef int x
jpayne@68 5273 */
jpayne@68 5274 __pyx_t_1 = (((PyObject *)__pyx_v_qualities) == Py_None);
jpayne@68 5275 if (__pyx_t_1) {
jpayne@68 5276
jpayne@68 5277 /* "pysam/libcutils.pyx":48
jpayne@68 5278 * """convert an array of quality values to a string."""
jpayne@68 5279 * if qualities is None:
jpayne@68 5280 * return None # <<<<<<<<<<<<<<
jpayne@68 5281 * cdef int x
jpayne@68 5282 *
jpayne@68 5283 */
jpayne@68 5284 __Pyx_XDECREF(__pyx_r);
jpayne@68 5285 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
jpayne@68 5286 goto __pyx_L0;
jpayne@68 5287
jpayne@68 5288 /* "pysam/libcutils.pyx":47
jpayne@68 5289 * cpdef array_to_qualitystring(c_array.array qualities, int offset=33):
jpayne@68 5290 * """convert an array of quality values to a string."""
jpayne@68 5291 * if qualities is None: # <<<<<<<<<<<<<<
jpayne@68 5292 * return None
jpayne@68 5293 * cdef int x
jpayne@68 5294 */
jpayne@68 5295 }
jpayne@68 5296
jpayne@68 5297 /* "pysam/libcutils.pyx":52
jpayne@68 5298 *
jpayne@68 5299 * cdef c_array.array result
jpayne@68 5300 * result = c_array.clone(qualities, len(qualities), zero=False) # <<<<<<<<<<<<<<
jpayne@68 5301 *
jpayne@68 5302 * for x from 0 <= x < len(qualities):
jpayne@68 5303 */
jpayne@68 5304 if (unlikely(((PyObject *)__pyx_v_qualities) == Py_None)) {
jpayne@68 5305 PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
jpayne@68 5306 __PYX_ERR(0, 52, __pyx_L1_error)
jpayne@68 5307 }
jpayne@68 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@68 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@68 5310 __Pyx_GOTREF(__pyx_t_3);
jpayne@68 5311 __pyx_v_result = ((arrayobject *)__pyx_t_3);
jpayne@68 5312 __pyx_t_3 = 0;
jpayne@68 5313
jpayne@68 5314 /* "pysam/libcutils.pyx":54
jpayne@68 5315 * result = c_array.clone(qualities, len(qualities), zero=False)
jpayne@68 5316 *
jpayne@68 5317 * for x from 0 <= x < len(qualities): # <<<<<<<<<<<<<<
jpayne@68 5318 * result[x] = qualities[x] + offset
jpayne@68 5319 * return force_str(result.tobytes())
jpayne@68 5320 */
jpayne@68 5321 if (unlikely(((PyObject *)__pyx_v_qualities) == Py_None)) {
jpayne@68 5322 PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
jpayne@68 5323 __PYX_ERR(0, 54, __pyx_L1_error)
jpayne@68 5324 }
jpayne@68 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@68 5326 for (__pyx_v_x = 0; __pyx_v_x < __pyx_t_2; __pyx_v_x++) {
jpayne@68 5327
jpayne@68 5328 /* "pysam/libcutils.pyx":55
jpayne@68 5329 *
jpayne@68 5330 * for x from 0 <= x < len(qualities):
jpayne@68 5331 * result[x] = qualities[x] + offset # <<<<<<<<<<<<<<
jpayne@68 5332 * return force_str(result.tobytes())
jpayne@68 5333 *
jpayne@68 5334 */
jpayne@68 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@68 5336 __Pyx_GOTREF(__pyx_t_3);
jpayne@68 5337 __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_offset); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 55, __pyx_L1_error)
jpayne@68 5338 __Pyx_GOTREF(__pyx_t_4);
jpayne@68 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@68 5340 __Pyx_GOTREF(__pyx_t_5);
jpayne@68 5341 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@68 5342 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
jpayne@68 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@68 5344 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
jpayne@68 5345 }
jpayne@68 5346
jpayne@68 5347 /* "pysam/libcutils.pyx":56
jpayne@68 5348 * for x from 0 <= x < len(qualities):
jpayne@68 5349 * result[x] = qualities[x] + offset
jpayne@68 5350 * return force_str(result.tobytes()) # <<<<<<<<<<<<<<
jpayne@68 5351 *
jpayne@68 5352 *
jpayne@68 5353 */
jpayne@68 5354 __Pyx_XDECREF(__pyx_r);
jpayne@68 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@68 5356 __Pyx_GOTREF(__pyx_t_4);
jpayne@68 5357 __pyx_t_3 = NULL;
jpayne@68 5358 __pyx_t_6 = 0;
jpayne@68 5359 #if CYTHON_UNPACK_METHODS
jpayne@68 5360 if (likely(PyMethod_Check(__pyx_t_4))) {
jpayne@68 5361 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
jpayne@68 5362 if (likely(__pyx_t_3)) {
jpayne@68 5363 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
jpayne@68 5364 __Pyx_INCREF(__pyx_t_3);
jpayne@68 5365 __Pyx_INCREF(function);
jpayne@68 5366 __Pyx_DECREF_SET(__pyx_t_4, function);
jpayne@68 5367 __pyx_t_6 = 1;
jpayne@68 5368 }
jpayne@68 5369 }
jpayne@68 5370 #endif
jpayne@68 5371 {
jpayne@68 5372 PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
jpayne@68 5373 __pyx_t_5 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_6, 0+__pyx_t_6);
jpayne@68 5374 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@68 5375 if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 56, __pyx_L1_error)
jpayne@68 5376 __Pyx_GOTREF(__pyx_t_5);
jpayne@68 5377 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
jpayne@68 5378 }
jpayne@68 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@68 5380 __Pyx_GOTREF(__pyx_t_4);
jpayne@68 5381 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
jpayne@68 5382 __pyx_r = __pyx_t_4;
jpayne@68 5383 __pyx_t_4 = 0;
jpayne@68 5384 goto __pyx_L0;
jpayne@68 5385
jpayne@68 5386 /* "pysam/libcutils.pyx":45
jpayne@68 5387 *
jpayne@68 5388 *
jpayne@68 5389 * cpdef array_to_qualitystring(c_array.array qualities, int offset=33): # <<<<<<<<<<<<<<
jpayne@68 5390 * """convert an array of quality values to a string."""
jpayne@68 5391 * if qualities is None:
jpayne@68 5392 */
jpayne@68 5393
jpayne@68 5394 /* function exit code */
jpayne@68 5395 __pyx_L1_error:;
jpayne@68 5396 __Pyx_XDECREF(__pyx_t_3);
jpayne@68 5397 __Pyx_XDECREF(__pyx_t_4);
jpayne@68 5398 __Pyx_XDECREF(__pyx_t_5);
jpayne@68 5399 __Pyx_AddTraceback("pysam.libcutils.array_to_qualitystring", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@68 5400 __pyx_r = 0;
jpayne@68 5401 __pyx_L0:;
jpayne@68 5402 __Pyx_XDECREF((PyObject *)__pyx_v_result);
jpayne@68 5403 __Pyx_XGIVEREF(__pyx_r);
jpayne@68 5404 __Pyx_RefNannyFinishContext();
jpayne@68 5405 return __pyx_r;
jpayne@68 5406 }
jpayne@68 5407
jpayne@68 5408 /* Python wrapper */
jpayne@68 5409 static PyObject *__pyx_pw_5pysam_9libcutils_3array_to_qualitystring(PyObject *__pyx_self,
jpayne@68 5410 #if CYTHON_METH_FASTCALL
jpayne@68 5411 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
jpayne@68 5412 #else
jpayne@68 5413 PyObject *__pyx_args, PyObject *__pyx_kwds
jpayne@68 5414 #endif
jpayne@68 5415 ); /*proto*/
jpayne@68 5416 PyDoc_STRVAR(__pyx_doc_5pysam_9libcutils_2array_to_qualitystring, "convert an array of quality values to a string.");
jpayne@68 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@68 5418 static PyObject *__pyx_pw_5pysam_9libcutils_3array_to_qualitystring(PyObject *__pyx_self,
jpayne@68 5419 #if CYTHON_METH_FASTCALL
jpayne@68 5420 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
jpayne@68 5421 #else
jpayne@68 5422 PyObject *__pyx_args, PyObject *__pyx_kwds
jpayne@68 5423 #endif
jpayne@68 5424 ) {
jpayne@68 5425 arrayobject *__pyx_v_qualities = 0;
jpayne@68 5426 int __pyx_v_offset;
jpayne@68 5427 #if !CYTHON_METH_FASTCALL
jpayne@68 5428 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
jpayne@68 5429 #endif
jpayne@68 5430 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
jpayne@68 5431 PyObject* values[2] = {0,0};
jpayne@68 5432 int __pyx_lineno = 0;
jpayne@68 5433 const char *__pyx_filename = NULL;
jpayne@68 5434 int __pyx_clineno = 0;
jpayne@68 5435 PyObject *__pyx_r = 0;
jpayne@68 5436 __Pyx_RefNannyDeclarations
jpayne@68 5437 __Pyx_RefNannySetupContext("array_to_qualitystring (wrapper)", 0);
jpayne@68 5438 #if !CYTHON_METH_FASTCALL
jpayne@68 5439 #if CYTHON_ASSUME_SAFE_MACROS
jpayne@68 5440 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
jpayne@68 5441 #else
jpayne@68 5442 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
jpayne@68 5443 #endif
jpayne@68 5444 #endif
jpayne@68 5445 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
jpayne@68 5446 {
jpayne@68 5447 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_qualities,&__pyx_n_s_offset,0};
jpayne@68 5448 if (__pyx_kwds) {
jpayne@68 5449 Py_ssize_t kw_args;
jpayne@68 5450 switch (__pyx_nargs) {
jpayne@68 5451 case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
jpayne@68 5452 CYTHON_FALLTHROUGH;
jpayne@68 5453 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
jpayne@68 5454 CYTHON_FALLTHROUGH;
jpayne@68 5455 case 0: break;
jpayne@68 5456 default: goto __pyx_L5_argtuple_error;
jpayne@68 5457 }
jpayne@68 5458 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
jpayne@68 5459 switch (__pyx_nargs) {
jpayne@68 5460 case 0:
jpayne@68 5461 if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_qualities)) != 0)) {
jpayne@68 5462 (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
jpayne@68 5463 kw_args--;
jpayne@68 5464 }
jpayne@68 5465 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 45, __pyx_L3_error)
jpayne@68 5466 else goto __pyx_L5_argtuple_error;
jpayne@68 5467 CYTHON_FALLTHROUGH;
jpayne@68 5468 case 1:
jpayne@68 5469 if (kw_args > 0) {
jpayne@68 5470 PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_offset);
jpayne@68 5471 if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
jpayne@68 5472 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 45, __pyx_L3_error)
jpayne@68 5473 }
jpayne@68 5474 }
jpayne@68 5475 if (unlikely(kw_args > 0)) {
jpayne@68 5476 const Py_ssize_t kwd_pos_args = __pyx_nargs;
jpayne@68 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@68 5478 }
jpayne@68 5479 } else {
jpayne@68 5480 switch (__pyx_nargs) {
jpayne@68 5481 case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
jpayne@68 5482 CYTHON_FALLTHROUGH;
jpayne@68 5483 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
jpayne@68 5484 break;
jpayne@68 5485 default: goto __pyx_L5_argtuple_error;
jpayne@68 5486 }
jpayne@68 5487 }
jpayne@68 5488 __pyx_v_qualities = ((arrayobject *)values[0]);
jpayne@68 5489 if (values[1]) {
jpayne@68 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@68 5491 } else {
jpayne@68 5492 __pyx_v_offset = ((int)33);
jpayne@68 5493 }
jpayne@68 5494 }
jpayne@68 5495 goto __pyx_L6_skip;
jpayne@68 5496 __pyx_L5_argtuple_error:;
jpayne@68 5497 __Pyx_RaiseArgtupleInvalid("array_to_qualitystring", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 45, __pyx_L3_error)
jpayne@68 5498 __pyx_L6_skip:;
jpayne@68 5499 goto __pyx_L4_argument_unpacking_done;
jpayne@68 5500 __pyx_L3_error:;
jpayne@68 5501 {
jpayne@68 5502 Py_ssize_t __pyx_temp;
jpayne@68 5503 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
jpayne@68 5504 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
jpayne@68 5505 }
jpayne@68 5506 }
jpayne@68 5507 __Pyx_AddTraceback("pysam.libcutils.array_to_qualitystring", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@68 5508 __Pyx_RefNannyFinishContext();
jpayne@68 5509 return NULL;
jpayne@68 5510 __pyx_L4_argument_unpacking_done:;
jpayne@68 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@68 5512 __pyx_r = __pyx_pf_5pysam_9libcutils_2array_to_qualitystring(__pyx_self, __pyx_v_qualities, __pyx_v_offset);
jpayne@68 5513
jpayne@68 5514 /* function exit code */
jpayne@68 5515 goto __pyx_L0;
jpayne@68 5516 __pyx_L1_error:;
jpayne@68 5517 __pyx_r = NULL;
jpayne@68 5518 __pyx_L0:;
jpayne@68 5519 {
jpayne@68 5520 Py_ssize_t __pyx_temp;
jpayne@68 5521 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
jpayne@68 5522 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
jpayne@68 5523 }
jpayne@68 5524 }
jpayne@68 5525 __Pyx_RefNannyFinishContext();
jpayne@68 5526 return __pyx_r;
jpayne@68 5527 }
jpayne@68 5528
jpayne@68 5529 static PyObject *__pyx_pf_5pysam_9libcutils_2array_to_qualitystring(CYTHON_UNUSED PyObject *__pyx_self, arrayobject *__pyx_v_qualities, int __pyx_v_offset) {
jpayne@68 5530 PyObject *__pyx_r = NULL;
jpayne@68 5531 __Pyx_RefNannyDeclarations
jpayne@68 5532 PyObject *__pyx_t_1 = NULL;
jpayne@68 5533 struct __pyx_opt_args_5pysam_9libcutils_array_to_qualitystring __pyx_t_2;
jpayne@68 5534 int __pyx_lineno = 0;
jpayne@68 5535 const char *__pyx_filename = NULL;
jpayne@68 5536 int __pyx_clineno = 0;
jpayne@68 5537 __Pyx_RefNannySetupContext("array_to_qualitystring", 1);
jpayne@68 5538 __Pyx_XDECREF(__pyx_r);
jpayne@68 5539 __pyx_t_2.__pyx_n = 1;
jpayne@68 5540 __pyx_t_2.offset = __pyx_v_offset;
jpayne@68 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@68 5542 __Pyx_GOTREF(__pyx_t_1);
jpayne@68 5543 __pyx_r = __pyx_t_1;
jpayne@68 5544 __pyx_t_1 = 0;
jpayne@68 5545 goto __pyx_L0;
jpayne@68 5546
jpayne@68 5547 /* function exit code */
jpayne@68 5548 __pyx_L1_error:;
jpayne@68 5549 __Pyx_XDECREF(__pyx_t_1);
jpayne@68 5550 __Pyx_AddTraceback("pysam.libcutils.array_to_qualitystring", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@68 5551 __pyx_r = NULL;
jpayne@68 5552 __pyx_L0:;
jpayne@68 5553 __Pyx_XGIVEREF(__pyx_r);
jpayne@68 5554 __Pyx_RefNannyFinishContext();
jpayne@68 5555 return __pyx_r;
jpayne@68 5556 }
jpayne@68 5557
jpayne@68 5558 /* "pysam/libcutils.pyx":59
jpayne@68 5559 *
jpayne@68 5560 *
jpayne@68 5561 * cpdef qualities_to_qualitystring(qualities, int offset=33): # <<<<<<<<<<<<<<
jpayne@68 5562 * """convert a list or array of quality scores to the string
jpayne@68 5563 * representation used in the SAM format.
jpayne@68 5564 */
jpayne@68 5565
jpayne@68 5566 static PyObject *__pyx_pw_5pysam_9libcutils_5qualities_to_qualitystring(PyObject *__pyx_self,
jpayne@68 5567 #if CYTHON_METH_FASTCALL
jpayne@68 5568 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
jpayne@68 5569 #else
jpayne@68 5570 PyObject *__pyx_args, PyObject *__pyx_kwds
jpayne@68 5571 #endif
jpayne@68 5572 ); /*proto*/
jpayne@68 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@68 5574 int __pyx_v_offset = ((int)33);
jpayne@68 5575 char __pyx_8genexpr1__pyx_v_x;
jpayne@68 5576 PyObject *__pyx_r = NULL;
jpayne@68 5577 __Pyx_RefNannyDeclarations
jpayne@68 5578 int __pyx_t_1;
jpayne@68 5579 PyObject *__pyx_t_2 = NULL;
jpayne@68 5580 struct __pyx_opt_args_5pysam_9libcutils_array_to_qualitystring __pyx_t_3;
jpayne@68 5581 PyObject *__pyx_t_4 = NULL;
jpayne@68 5582 Py_ssize_t __pyx_t_5;
jpayne@68 5583 PyObject *(*__pyx_t_6)(PyObject *);
jpayne@68 5584 PyObject *__pyx_t_7 = NULL;
jpayne@68 5585 char __pyx_t_8;
jpayne@68 5586 PyObject *__pyx_t_9 = NULL;
jpayne@68 5587 int __pyx_lineno = 0;
jpayne@68 5588 const char *__pyx_filename = NULL;
jpayne@68 5589 int __pyx_clineno = 0;
jpayne@68 5590 __Pyx_RefNannySetupContext("qualities_to_qualitystring", 1);
jpayne@68 5591 if (__pyx_optional_args) {
jpayne@68 5592 if (__pyx_optional_args->__pyx_n > 0) {
jpayne@68 5593 __pyx_v_offset = __pyx_optional_args->offset;
jpayne@68 5594 }
jpayne@68 5595 }
jpayne@68 5596
jpayne@68 5597 /* "pysam/libcutils.pyx":76
jpayne@68 5598 * """
jpayne@68 5599 * cdef char x
jpayne@68 5600 * if qualities is None: # <<<<<<<<<<<<<<
jpayne@68 5601 * return None
jpayne@68 5602 * elif isinstance(qualities, c_array.array):
jpayne@68 5603 */
jpayne@68 5604 __pyx_t_1 = (__pyx_v_qualities == Py_None);
jpayne@68 5605 if (__pyx_t_1) {
jpayne@68 5606
jpayne@68 5607 /* "pysam/libcutils.pyx":77
jpayne@68 5608 * cdef char x
jpayne@68 5609 * if qualities is None:
jpayne@68 5610 * return None # <<<<<<<<<<<<<<
jpayne@68 5611 * elif isinstance(qualities, c_array.array):
jpayne@68 5612 * return array_to_qualitystring(qualities, offset=offset)
jpayne@68 5613 */
jpayne@68 5614 __Pyx_XDECREF(__pyx_r);
jpayne@68 5615 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
jpayne@68 5616 goto __pyx_L0;
jpayne@68 5617
jpayne@68 5618 /* "pysam/libcutils.pyx":76
jpayne@68 5619 * """
jpayne@68 5620 * cdef char x
jpayne@68 5621 * if qualities is None: # <<<<<<<<<<<<<<
jpayne@68 5622 * return None
jpayne@68 5623 * elif isinstance(qualities, c_array.array):
jpayne@68 5624 */
jpayne@68 5625 }
jpayne@68 5626
jpayne@68 5627 /* "pysam/libcutils.pyx":78
jpayne@68 5628 * if qualities is None:
jpayne@68 5629 * return None
jpayne@68 5630 * elif isinstance(qualities, c_array.array): # <<<<<<<<<<<<<<
jpayne@68 5631 * return array_to_qualitystring(qualities, offset=offset)
jpayne@68 5632 * else:
jpayne@68 5633 */
jpayne@68 5634 __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_qualities, __pyx_ptype_7cpython_5array_array);
jpayne@68 5635 if (__pyx_t_1) {
jpayne@68 5636
jpayne@68 5637 /* "pysam/libcutils.pyx":79
jpayne@68 5638 * return None
jpayne@68 5639 * elif isinstance(qualities, c_array.array):
jpayne@68 5640 * return array_to_qualitystring(qualities, offset=offset) # <<<<<<<<<<<<<<
jpayne@68 5641 * else:
jpayne@68 5642 * # tuples and lists
jpayne@68 5643 */
jpayne@68 5644 __Pyx_XDECREF(__pyx_r);
jpayne@68 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@68 5646 __pyx_t_3.__pyx_n = 1;
jpayne@68 5647 __pyx_t_3.offset = __pyx_v_offset;
jpayne@68 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@68 5649 __Pyx_GOTREF(__pyx_t_2);
jpayne@68 5650 __pyx_r = __pyx_t_2;
jpayne@68 5651 __pyx_t_2 = 0;
jpayne@68 5652 goto __pyx_L0;
jpayne@68 5653
jpayne@68 5654 /* "pysam/libcutils.pyx":78
jpayne@68 5655 * if qualities is None:
jpayne@68 5656 * return None
jpayne@68 5657 * elif isinstance(qualities, c_array.array): # <<<<<<<<<<<<<<
jpayne@68 5658 * return array_to_qualitystring(qualities, offset=offset)
jpayne@68 5659 * else:
jpayne@68 5660 */
jpayne@68 5661 }
jpayne@68 5662
jpayne@68 5663 /* "pysam/libcutils.pyx":82
jpayne@68 5664 * else:
jpayne@68 5665 * # tuples and lists
jpayne@68 5666 * return force_str("".join([chr(x + offset) for x in qualities])) # <<<<<<<<<<<<<<
jpayne@68 5667 *
jpayne@68 5668 *
jpayne@68 5669 */
jpayne@68 5670 /*else*/ {
jpayne@68 5671 __Pyx_XDECREF(__pyx_r);
jpayne@68 5672 { /* enter inner scope */
jpayne@68 5673 __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 82, __pyx_L1_error)
jpayne@68 5674 __Pyx_GOTREF(__pyx_t_2);
jpayne@68 5675 if (likely(PyList_CheckExact(__pyx_v_qualities)) || PyTuple_CheckExact(__pyx_v_qualities)) {
jpayne@68 5676 __pyx_t_4 = __pyx_v_qualities; __Pyx_INCREF(__pyx_t_4);
jpayne@68 5677 __pyx_t_5 = 0;
jpayne@68 5678 __pyx_t_6 = NULL;
jpayne@68 5679 } else {
jpayne@68 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@68 5681 __Pyx_GOTREF(__pyx_t_4);
jpayne@68 5682 __pyx_t_6 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 82, __pyx_L1_error)
jpayne@68 5683 }
jpayne@68 5684 for (;;) {
jpayne@68 5685 if (likely(!__pyx_t_6)) {
jpayne@68 5686 if (likely(PyList_CheckExact(__pyx_t_4))) {
jpayne@68 5687 {
jpayne@68 5688 Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_4);
jpayne@68 5689 #if !CYTHON_ASSUME_SAFE_MACROS
jpayne@68 5690 if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 82, __pyx_L1_error)
jpayne@68 5691 #endif
jpayne@68 5692 if (__pyx_t_5 >= __pyx_temp) break;
jpayne@68 5693 }
jpayne@68 5694 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
jpayne@68 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@68 5696 #else
jpayne@68 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@68 5698 __Pyx_GOTREF(__pyx_t_7);
jpayne@68 5699 #endif
jpayne@68 5700 } else {
jpayne@68 5701 {
jpayne@68 5702 Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4);
jpayne@68 5703 #if !CYTHON_ASSUME_SAFE_MACROS
jpayne@68 5704 if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 82, __pyx_L1_error)
jpayne@68 5705 #endif
jpayne@68 5706 if (__pyx_t_5 >= __pyx_temp) break;
jpayne@68 5707 }
jpayne@68 5708 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
jpayne@68 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@68 5710 #else
jpayne@68 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@68 5712 __Pyx_GOTREF(__pyx_t_7);
jpayne@68 5713 #endif
jpayne@68 5714 }
jpayne@68 5715 } else {
jpayne@68 5716 __pyx_t_7 = __pyx_t_6(__pyx_t_4);
jpayne@68 5717 if (unlikely(!__pyx_t_7)) {
jpayne@68 5718 PyObject* exc_type = PyErr_Occurred();
jpayne@68 5719 if (exc_type) {
jpayne@68 5720 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
jpayne@68 5721 else __PYX_ERR(0, 82, __pyx_L1_error)
jpayne@68 5722 }
jpayne@68 5723 break;
jpayne@68 5724 }
jpayne@68 5725 __Pyx_GOTREF(__pyx_t_7);
jpayne@68 5726 }
jpayne@68 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@68 5728 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
jpayne@68 5729 __pyx_8genexpr1__pyx_v_x = __pyx_t_8;
jpayne@68 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@68 5731 __Pyx_GOTREF(__pyx_t_7);
jpayne@68 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@68 5733 __Pyx_GOTREF(__pyx_t_9);
jpayne@68 5734 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
jpayne@68 5735 if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_9))) __PYX_ERR(0, 82, __pyx_L1_error)
jpayne@68 5736 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
jpayne@68 5737 }
jpayne@68 5738 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
jpayne@68 5739 } /* exit inner scope */
jpayne@68 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@68 5741 __Pyx_GOTREF(__pyx_t_4);
jpayne@68 5742 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@68 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@68 5744 __Pyx_GOTREF(__pyx_t_2);
jpayne@68 5745 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
jpayne@68 5746 __pyx_r = __pyx_t_2;
jpayne@68 5747 __pyx_t_2 = 0;
jpayne@68 5748 goto __pyx_L0;
jpayne@68 5749 }
jpayne@68 5750
jpayne@68 5751 /* "pysam/libcutils.pyx":59
jpayne@68 5752 *
jpayne@68 5753 *
jpayne@68 5754 * cpdef qualities_to_qualitystring(qualities, int offset=33): # <<<<<<<<<<<<<<
jpayne@68 5755 * """convert a list or array of quality scores to the string
jpayne@68 5756 * representation used in the SAM format.
jpayne@68 5757 */
jpayne@68 5758
jpayne@68 5759 /* function exit code */
jpayne@68 5760 __pyx_L1_error:;
jpayne@68 5761 __Pyx_XDECREF(__pyx_t_2);
jpayne@68 5762 __Pyx_XDECREF(__pyx_t_4);
jpayne@68 5763 __Pyx_XDECREF(__pyx_t_7);
jpayne@68 5764 __Pyx_XDECREF(__pyx_t_9);
jpayne@68 5765 __Pyx_AddTraceback("pysam.libcutils.qualities_to_qualitystring", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@68 5766 __pyx_r = 0;
jpayne@68 5767 __pyx_L0:;
jpayne@68 5768 __Pyx_XGIVEREF(__pyx_r);
jpayne@68 5769 __Pyx_RefNannyFinishContext();
jpayne@68 5770 return __pyx_r;
jpayne@68 5771 }
jpayne@68 5772
jpayne@68 5773 /* Python wrapper */
jpayne@68 5774 static PyObject *__pyx_pw_5pysam_9libcutils_5qualities_to_qualitystring(PyObject *__pyx_self,
jpayne@68 5775 #if CYTHON_METH_FASTCALL
jpayne@68 5776 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
jpayne@68 5777 #else
jpayne@68 5778 PyObject *__pyx_args, PyObject *__pyx_kwds
jpayne@68 5779 #endif
jpayne@68 5780 ); /*proto*/
jpayne@68 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@68 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@68 5783 static PyObject *__pyx_pw_5pysam_9libcutils_5qualities_to_qualitystring(PyObject *__pyx_self,
jpayne@68 5784 #if CYTHON_METH_FASTCALL
jpayne@68 5785 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
jpayne@68 5786 #else
jpayne@68 5787 PyObject *__pyx_args, PyObject *__pyx_kwds
jpayne@68 5788 #endif
jpayne@68 5789 ) {
jpayne@68 5790 PyObject *__pyx_v_qualities = 0;
jpayne@68 5791 int __pyx_v_offset;
jpayne@68 5792 #if !CYTHON_METH_FASTCALL
jpayne@68 5793 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
jpayne@68 5794 #endif
jpayne@68 5795 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
jpayne@68 5796 PyObject* values[2] = {0,0};
jpayne@68 5797 int __pyx_lineno = 0;
jpayne@68 5798 const char *__pyx_filename = NULL;
jpayne@68 5799 int __pyx_clineno = 0;
jpayne@68 5800 PyObject *__pyx_r = 0;
jpayne@68 5801 __Pyx_RefNannyDeclarations
jpayne@68 5802 __Pyx_RefNannySetupContext("qualities_to_qualitystring (wrapper)", 0);
jpayne@68 5803 #if !CYTHON_METH_FASTCALL
jpayne@68 5804 #if CYTHON_ASSUME_SAFE_MACROS
jpayne@68 5805 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
jpayne@68 5806 #else
jpayne@68 5807 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
jpayne@68 5808 #endif
jpayne@68 5809 #endif
jpayne@68 5810 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
jpayne@68 5811 {
jpayne@68 5812 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_qualities,&__pyx_n_s_offset,0};
jpayne@68 5813 if (__pyx_kwds) {
jpayne@68 5814 Py_ssize_t kw_args;
jpayne@68 5815 switch (__pyx_nargs) {
jpayne@68 5816 case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
jpayne@68 5817 CYTHON_FALLTHROUGH;
jpayne@68 5818 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
jpayne@68 5819 CYTHON_FALLTHROUGH;
jpayne@68 5820 case 0: break;
jpayne@68 5821 default: goto __pyx_L5_argtuple_error;
jpayne@68 5822 }
jpayne@68 5823 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
jpayne@68 5824 switch (__pyx_nargs) {
jpayne@68 5825 case 0:
jpayne@68 5826 if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_qualities)) != 0)) {
jpayne@68 5827 (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
jpayne@68 5828 kw_args--;
jpayne@68 5829 }
jpayne@68 5830 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 59, __pyx_L3_error)
jpayne@68 5831 else goto __pyx_L5_argtuple_error;
jpayne@68 5832 CYTHON_FALLTHROUGH;
jpayne@68 5833 case 1:
jpayne@68 5834 if (kw_args > 0) {
jpayne@68 5835 PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_offset);
jpayne@68 5836 if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
jpayne@68 5837 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 59, __pyx_L3_error)
jpayne@68 5838 }
jpayne@68 5839 }
jpayne@68 5840 if (unlikely(kw_args > 0)) {
jpayne@68 5841 const Py_ssize_t kwd_pos_args = __pyx_nargs;
jpayne@68 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@68 5843 }
jpayne@68 5844 } else {
jpayne@68 5845 switch (__pyx_nargs) {
jpayne@68 5846 case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
jpayne@68 5847 CYTHON_FALLTHROUGH;
jpayne@68 5848 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
jpayne@68 5849 break;
jpayne@68 5850 default: goto __pyx_L5_argtuple_error;
jpayne@68 5851 }
jpayne@68 5852 }
jpayne@68 5853 __pyx_v_qualities = values[0];
jpayne@68 5854 if (values[1]) {
jpayne@68 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@68 5856 } else {
jpayne@68 5857 __pyx_v_offset = ((int)33);
jpayne@68 5858 }
jpayne@68 5859 }
jpayne@68 5860 goto __pyx_L6_skip;
jpayne@68 5861 __pyx_L5_argtuple_error:;
jpayne@68 5862 __Pyx_RaiseArgtupleInvalid("qualities_to_qualitystring", 0, 1, 2, __pyx_nargs); __PYX_ERR(0, 59, __pyx_L3_error)
jpayne@68 5863 __pyx_L6_skip:;
jpayne@68 5864 goto __pyx_L4_argument_unpacking_done;
jpayne@68 5865 __pyx_L3_error:;
jpayne@68 5866 {
jpayne@68 5867 Py_ssize_t __pyx_temp;
jpayne@68 5868 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
jpayne@68 5869 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
jpayne@68 5870 }
jpayne@68 5871 }
jpayne@68 5872 __Pyx_AddTraceback("pysam.libcutils.qualities_to_qualitystring", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@68 5873 __Pyx_RefNannyFinishContext();
jpayne@68 5874 return NULL;
jpayne@68 5875 __pyx_L4_argument_unpacking_done:;
jpayne@68 5876 __pyx_r = __pyx_pf_5pysam_9libcutils_4qualities_to_qualitystring(__pyx_self, __pyx_v_qualities, __pyx_v_offset);
jpayne@68 5877
jpayne@68 5878 /* function exit code */
jpayne@68 5879 {
jpayne@68 5880 Py_ssize_t __pyx_temp;
jpayne@68 5881 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
jpayne@68 5882 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
jpayne@68 5883 }
jpayne@68 5884 }
jpayne@68 5885 __Pyx_RefNannyFinishContext();
jpayne@68 5886 return __pyx_r;
jpayne@68 5887 }
jpayne@68 5888
jpayne@68 5889 static PyObject *__pyx_pf_5pysam_9libcutils_4qualities_to_qualitystring(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_qualities, int __pyx_v_offset) {
jpayne@68 5890 PyObject *__pyx_r = NULL;
jpayne@68 5891 __Pyx_RefNannyDeclarations
jpayne@68 5892 PyObject *__pyx_t_1 = NULL;
jpayne@68 5893 struct __pyx_opt_args_5pysam_9libcutils_qualities_to_qualitystring __pyx_t_2;
jpayne@68 5894 int __pyx_lineno = 0;
jpayne@68 5895 const char *__pyx_filename = NULL;
jpayne@68 5896 int __pyx_clineno = 0;
jpayne@68 5897 __Pyx_RefNannySetupContext("qualities_to_qualitystring", 1);
jpayne@68 5898 __Pyx_XDECREF(__pyx_r);
jpayne@68 5899 __pyx_t_2.__pyx_n = 1;
jpayne@68 5900 __pyx_t_2.offset = __pyx_v_offset;
jpayne@68 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@68 5902 __Pyx_GOTREF(__pyx_t_1);
jpayne@68 5903 __pyx_r = __pyx_t_1;
jpayne@68 5904 __pyx_t_1 = 0;
jpayne@68 5905 goto __pyx_L0;
jpayne@68 5906
jpayne@68 5907 /* function exit code */
jpayne@68 5908 __pyx_L1_error:;
jpayne@68 5909 __Pyx_XDECREF(__pyx_t_1);
jpayne@68 5910 __Pyx_AddTraceback("pysam.libcutils.qualities_to_qualitystring", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@68 5911 __pyx_r = NULL;
jpayne@68 5912 __pyx_L0:;
jpayne@68 5913 __Pyx_XGIVEREF(__pyx_r);
jpayne@68 5914 __Pyx_RefNannyFinishContext();
jpayne@68 5915 return __pyx_r;
jpayne@68 5916 }
jpayne@68 5917
jpayne@68 5918 /* "pysam/libcutils.pyx":90
jpayne@68 5919 *
jpayne@68 5920 * # Codec error handler that just interprets each bad byte as ISO-8859-1.
jpayne@68 5921 * def latin1_replace(exception): # <<<<<<<<<<<<<<
jpayne@68 5922 * return (chr(exception.object[exception.start]), exception.end)
jpayne@68 5923 *
jpayne@68 5924 */
jpayne@68 5925
jpayne@68 5926 /* Python wrapper */
jpayne@68 5927 static PyObject *__pyx_pw_5pysam_9libcutils_7latin1_replace(PyObject *__pyx_self,
jpayne@68 5928 #if CYTHON_METH_FASTCALL
jpayne@68 5929 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
jpayne@68 5930 #else
jpayne@68 5931 PyObject *__pyx_args, PyObject *__pyx_kwds
jpayne@68 5932 #endif
jpayne@68 5933 ); /*proto*/
jpayne@68 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@68 5935 static PyObject *__pyx_pw_5pysam_9libcutils_7latin1_replace(PyObject *__pyx_self,
jpayne@68 5936 #if CYTHON_METH_FASTCALL
jpayne@68 5937 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
jpayne@68 5938 #else
jpayne@68 5939 PyObject *__pyx_args, PyObject *__pyx_kwds
jpayne@68 5940 #endif
jpayne@68 5941 ) {
jpayne@68 5942 PyObject *__pyx_v_exception = 0;
jpayne@68 5943 #if !CYTHON_METH_FASTCALL
jpayne@68 5944 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
jpayne@68 5945 #endif
jpayne@68 5946 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
jpayne@68 5947 PyObject* values[1] = {0};
jpayne@68 5948 int __pyx_lineno = 0;
jpayne@68 5949 const char *__pyx_filename = NULL;
jpayne@68 5950 int __pyx_clineno = 0;
jpayne@68 5951 PyObject *__pyx_r = 0;
jpayne@68 5952 __Pyx_RefNannyDeclarations
jpayne@68 5953 __Pyx_RefNannySetupContext("latin1_replace (wrapper)", 0);
jpayne@68 5954 #if !CYTHON_METH_FASTCALL
jpayne@68 5955 #if CYTHON_ASSUME_SAFE_MACROS
jpayne@68 5956 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
jpayne@68 5957 #else
jpayne@68 5958 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
jpayne@68 5959 #endif
jpayne@68 5960 #endif
jpayne@68 5961 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
jpayne@68 5962 {
jpayne@68 5963 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_exception,0};
jpayne@68 5964 if (__pyx_kwds) {
jpayne@68 5965 Py_ssize_t kw_args;
jpayne@68 5966 switch (__pyx_nargs) {
jpayne@68 5967 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
jpayne@68 5968 CYTHON_FALLTHROUGH;
jpayne@68 5969 case 0: break;
jpayne@68 5970 default: goto __pyx_L5_argtuple_error;
jpayne@68 5971 }
jpayne@68 5972 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
jpayne@68 5973 switch (__pyx_nargs) {
jpayne@68 5974 case 0:
jpayne@68 5975 if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_exception)) != 0)) {
jpayne@68 5976 (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
jpayne@68 5977 kw_args--;
jpayne@68 5978 }
jpayne@68 5979 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 90, __pyx_L3_error)
jpayne@68 5980 else goto __pyx_L5_argtuple_error;
jpayne@68 5981 }
jpayne@68 5982 if (unlikely(kw_args > 0)) {
jpayne@68 5983 const Py_ssize_t kwd_pos_args = __pyx_nargs;
jpayne@68 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@68 5985 }
jpayne@68 5986 } else if (unlikely(__pyx_nargs != 1)) {
jpayne@68 5987 goto __pyx_L5_argtuple_error;
jpayne@68 5988 } else {
jpayne@68 5989 values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
jpayne@68 5990 }
jpayne@68 5991 __pyx_v_exception = values[0];
jpayne@68 5992 }
jpayne@68 5993 goto __pyx_L6_skip;
jpayne@68 5994 __pyx_L5_argtuple_error:;
jpayne@68 5995 __Pyx_RaiseArgtupleInvalid("latin1_replace", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 90, __pyx_L3_error)
jpayne@68 5996 __pyx_L6_skip:;
jpayne@68 5997 goto __pyx_L4_argument_unpacking_done;
jpayne@68 5998 __pyx_L3_error:;
jpayne@68 5999 {
jpayne@68 6000 Py_ssize_t __pyx_temp;
jpayne@68 6001 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
jpayne@68 6002 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
jpayne@68 6003 }
jpayne@68 6004 }
jpayne@68 6005 __Pyx_AddTraceback("pysam.libcutils.latin1_replace", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@68 6006 __Pyx_RefNannyFinishContext();
jpayne@68 6007 return NULL;
jpayne@68 6008 __pyx_L4_argument_unpacking_done:;
jpayne@68 6009 __pyx_r = __pyx_pf_5pysam_9libcutils_6latin1_replace(__pyx_self, __pyx_v_exception);
jpayne@68 6010
jpayne@68 6011 /* function exit code */
jpayne@68 6012 {
jpayne@68 6013 Py_ssize_t __pyx_temp;
jpayne@68 6014 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
jpayne@68 6015 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
jpayne@68 6016 }
jpayne@68 6017 }
jpayne@68 6018 __Pyx_RefNannyFinishContext();
jpayne@68 6019 return __pyx_r;
jpayne@68 6020 }
jpayne@68 6021
jpayne@68 6022 static PyObject *__pyx_pf_5pysam_9libcutils_6latin1_replace(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_exception) {
jpayne@68 6023 PyObject *__pyx_r = NULL;
jpayne@68 6024 __Pyx_RefNannyDeclarations
jpayne@68 6025 PyObject *__pyx_t_1 = NULL;
jpayne@68 6026 PyObject *__pyx_t_2 = NULL;
jpayne@68 6027 PyObject *__pyx_t_3 = NULL;
jpayne@68 6028 int __pyx_lineno = 0;
jpayne@68 6029 const char *__pyx_filename = NULL;
jpayne@68 6030 int __pyx_clineno = 0;
jpayne@68 6031 __Pyx_RefNannySetupContext("latin1_replace", 1);
jpayne@68 6032
jpayne@68 6033 /* "pysam/libcutils.pyx":91
jpayne@68 6034 * # Codec error handler that just interprets each bad byte as ISO-8859-1.
jpayne@68 6035 * def latin1_replace(exception):
jpayne@68 6036 * return (chr(exception.object[exception.start]), exception.end) # <<<<<<<<<<<<<<
jpayne@68 6037 *
jpayne@68 6038 * register_error('pysam.latin1replace', latin1_replace)
jpayne@68 6039 */
jpayne@68 6040 __Pyx_XDECREF(__pyx_r);
jpayne@68 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@68 6042 __Pyx_GOTREF(__pyx_t_1);
jpayne@68 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@68 6044 __Pyx_GOTREF(__pyx_t_2);
jpayne@68 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@68 6046 __Pyx_GOTREF(__pyx_t_3);
jpayne@68 6047 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
jpayne@68 6048 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@68 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@68 6050 __Pyx_GOTREF(__pyx_t_2);
jpayne@68 6051 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@68 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@68 6053 __Pyx_GOTREF(__pyx_t_3);
jpayne@68 6054 __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 91, __pyx_L1_error)
jpayne@68 6055 __Pyx_GOTREF(__pyx_t_1);
jpayne@68 6056 __Pyx_GIVEREF(__pyx_t_2);
jpayne@68 6057 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2)) __PYX_ERR(0, 91, __pyx_L1_error);
jpayne@68 6058 __Pyx_GIVEREF(__pyx_t_3);
jpayne@68 6059 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3)) __PYX_ERR(0, 91, __pyx_L1_error);
jpayne@68 6060 __pyx_t_2 = 0;
jpayne@68 6061 __pyx_t_3 = 0;
jpayne@68 6062 __pyx_r = __pyx_t_1;
jpayne@68 6063 __pyx_t_1 = 0;
jpayne@68 6064 goto __pyx_L0;
jpayne@68 6065
jpayne@68 6066 /* "pysam/libcutils.pyx":90
jpayne@68 6067 *
jpayne@68 6068 * # Codec error handler that just interprets each bad byte as ISO-8859-1.
jpayne@68 6069 * def latin1_replace(exception): # <<<<<<<<<<<<<<
jpayne@68 6070 * return (chr(exception.object[exception.start]), exception.end)
jpayne@68 6071 *
jpayne@68 6072 */
jpayne@68 6073
jpayne@68 6074 /* function exit code */
jpayne@68 6075 __pyx_L1_error:;
jpayne@68 6076 __Pyx_XDECREF(__pyx_t_1);
jpayne@68 6077 __Pyx_XDECREF(__pyx_t_2);
jpayne@68 6078 __Pyx_XDECREF(__pyx_t_3);
jpayne@68 6079 __Pyx_AddTraceback("pysam.libcutils.latin1_replace", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@68 6080 __pyx_r = NULL;
jpayne@68 6081 __pyx_L0:;
jpayne@68 6082 __Pyx_XGIVEREF(__pyx_r);
jpayne@68 6083 __Pyx_RefNannyFinishContext();
jpayne@68 6084 return __pyx_r;
jpayne@68 6085 }
jpayne@68 6086
jpayne@68 6087 /* "pysam/libcutils.pyx":98
jpayne@68 6088 * cdef str ERROR_HANDLER = 'strict'
jpayne@68 6089 *
jpayne@68 6090 * cpdef get_encoding_error_handler(): # <<<<<<<<<<<<<<
jpayne@68 6091 * return ERROR_HANDLER
jpayne@68 6092 *
jpayne@68 6093 */
jpayne@68 6094
jpayne@68 6095 static PyObject *__pyx_pw_5pysam_9libcutils_9get_encoding_error_handler(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
jpayne@68 6096 static PyObject *__pyx_f_5pysam_9libcutils_get_encoding_error_handler(CYTHON_UNUSED int __pyx_skip_dispatch) {
jpayne@68 6097 PyObject *__pyx_r = NULL;
jpayne@68 6098 __Pyx_RefNannyDeclarations
jpayne@68 6099 __Pyx_RefNannySetupContext("get_encoding_error_handler", 1);
jpayne@68 6100
jpayne@68 6101 /* "pysam/libcutils.pyx":99
jpayne@68 6102 *
jpayne@68 6103 * cpdef get_encoding_error_handler():
jpayne@68 6104 * return ERROR_HANDLER # <<<<<<<<<<<<<<
jpayne@68 6105 *
jpayne@68 6106 * cpdef set_encoding_error_handler(name):
jpayne@68 6107 */
jpayne@68 6108 __Pyx_XDECREF(__pyx_r);
jpayne@68 6109 __Pyx_INCREF(__pyx_v_5pysam_9libcutils_ERROR_HANDLER);
jpayne@68 6110 __pyx_r = __pyx_v_5pysam_9libcutils_ERROR_HANDLER;
jpayne@68 6111 goto __pyx_L0;
jpayne@68 6112
jpayne@68 6113 /* "pysam/libcutils.pyx":98
jpayne@68 6114 * cdef str ERROR_HANDLER = 'strict'
jpayne@68 6115 *
jpayne@68 6116 * cpdef get_encoding_error_handler(): # <<<<<<<<<<<<<<
jpayne@68 6117 * return ERROR_HANDLER
jpayne@68 6118 *
jpayne@68 6119 */
jpayne@68 6120
jpayne@68 6121 /* function exit code */
jpayne@68 6122 __pyx_L0:;
jpayne@68 6123 __Pyx_XGIVEREF(__pyx_r);
jpayne@68 6124 __Pyx_RefNannyFinishContext();
jpayne@68 6125 return __pyx_r;
jpayne@68 6126 }
jpayne@68 6127
jpayne@68 6128 /* Python wrapper */
jpayne@68 6129 static PyObject *__pyx_pw_5pysam_9libcutils_9get_encoding_error_handler(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
jpayne@68 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@68 6131 static PyObject *__pyx_pw_5pysam_9libcutils_9get_encoding_error_handler(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
jpayne@68 6132 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
jpayne@68 6133 PyObject *__pyx_r = 0;
jpayne@68 6134 __Pyx_RefNannyDeclarations
jpayne@68 6135 __Pyx_RefNannySetupContext("get_encoding_error_handler (wrapper)", 0);
jpayne@68 6136 __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
jpayne@68 6137 __pyx_r = __pyx_pf_5pysam_9libcutils_8get_encoding_error_handler(__pyx_self);
jpayne@68 6138
jpayne@68 6139 /* function exit code */
jpayne@68 6140 __Pyx_RefNannyFinishContext();
jpayne@68 6141 return __pyx_r;
jpayne@68 6142 }
jpayne@68 6143
jpayne@68 6144 static PyObject *__pyx_pf_5pysam_9libcutils_8get_encoding_error_handler(CYTHON_UNUSED PyObject *__pyx_self) {
jpayne@68 6145 PyObject *__pyx_r = NULL;
jpayne@68 6146 __Pyx_RefNannyDeclarations
jpayne@68 6147 PyObject *__pyx_t_1 = NULL;
jpayne@68 6148 int __pyx_lineno = 0;
jpayne@68 6149 const char *__pyx_filename = NULL;
jpayne@68 6150 int __pyx_clineno = 0;
jpayne@68 6151 __Pyx_RefNannySetupContext("get_encoding_error_handler", 1);
jpayne@68 6152 __Pyx_XDECREF(__pyx_r);
jpayne@68 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@68 6154 __Pyx_GOTREF(__pyx_t_1);
jpayne@68 6155 __pyx_r = __pyx_t_1;
jpayne@68 6156 __pyx_t_1 = 0;
jpayne@68 6157 goto __pyx_L0;
jpayne@68 6158
jpayne@68 6159 /* function exit code */
jpayne@68 6160 __pyx_L1_error:;
jpayne@68 6161 __Pyx_XDECREF(__pyx_t_1);
jpayne@68 6162 __Pyx_AddTraceback("pysam.libcutils.get_encoding_error_handler", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@68 6163 __pyx_r = NULL;
jpayne@68 6164 __pyx_L0:;
jpayne@68 6165 __Pyx_XGIVEREF(__pyx_r);
jpayne@68 6166 __Pyx_RefNannyFinishContext();
jpayne@68 6167 return __pyx_r;
jpayne@68 6168 }
jpayne@68 6169
jpayne@68 6170 /* "pysam/libcutils.pyx":101
jpayne@68 6171 * return ERROR_HANDLER
jpayne@68 6172 *
jpayne@68 6173 * cpdef set_encoding_error_handler(name): # <<<<<<<<<<<<<<
jpayne@68 6174 * global ERROR_HANDLER
jpayne@68 6175 * previous = ERROR_HANDLER
jpayne@68 6176 */
jpayne@68 6177
jpayne@68 6178 static PyObject *__pyx_pw_5pysam_9libcutils_11set_encoding_error_handler(PyObject *__pyx_self,
jpayne@68 6179 #if CYTHON_METH_FASTCALL
jpayne@68 6180 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
jpayne@68 6181 #else
jpayne@68 6182 PyObject *__pyx_args, PyObject *__pyx_kwds
jpayne@68 6183 #endif
jpayne@68 6184 ); /*proto*/
jpayne@68 6185 static PyObject *__pyx_f_5pysam_9libcutils_set_encoding_error_handler(PyObject *__pyx_v_name, CYTHON_UNUSED int __pyx_skip_dispatch) {
jpayne@68 6186 PyObject *__pyx_v_previous = NULL;
jpayne@68 6187 PyObject *__pyx_r = NULL;
jpayne@68 6188 __Pyx_RefNannyDeclarations
jpayne@68 6189 PyObject *__pyx_t_1 = NULL;
jpayne@68 6190 int __pyx_lineno = 0;
jpayne@68 6191 const char *__pyx_filename = NULL;
jpayne@68 6192 int __pyx_clineno = 0;
jpayne@68 6193 __Pyx_RefNannySetupContext("set_encoding_error_handler", 1);
jpayne@68 6194
jpayne@68 6195 /* "pysam/libcutils.pyx":103
jpayne@68 6196 * cpdef set_encoding_error_handler(name):
jpayne@68 6197 * global ERROR_HANDLER
jpayne@68 6198 * previous = ERROR_HANDLER # <<<<<<<<<<<<<<
jpayne@68 6199 * ERROR_HANDLER = name
jpayne@68 6200 * return previous
jpayne@68 6201 */
jpayne@68 6202 __Pyx_INCREF(__pyx_v_5pysam_9libcutils_ERROR_HANDLER);
jpayne@68 6203 __pyx_v_previous = __pyx_v_5pysam_9libcutils_ERROR_HANDLER;
jpayne@68 6204
jpayne@68 6205 /* "pysam/libcutils.pyx":104
jpayne@68 6206 * global ERROR_HANDLER
jpayne@68 6207 * previous = ERROR_HANDLER
jpayne@68 6208 * ERROR_HANDLER = name # <<<<<<<<<<<<<<
jpayne@68 6209 * return previous
jpayne@68 6210 *
jpayne@68 6211 */
jpayne@68 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@68 6213 __pyx_t_1 = __pyx_v_name;
jpayne@68 6214 __Pyx_INCREF(__pyx_t_1);
jpayne@68 6215 __Pyx_XGOTREF(__pyx_v_5pysam_9libcutils_ERROR_HANDLER);
jpayne@68 6216 __Pyx_DECREF_SET(__pyx_v_5pysam_9libcutils_ERROR_HANDLER, ((PyObject*)__pyx_t_1));
jpayne@68 6217 __Pyx_GIVEREF(__pyx_t_1);
jpayne@68 6218 __pyx_t_1 = 0;
jpayne@68 6219
jpayne@68 6220 /* "pysam/libcutils.pyx":105
jpayne@68 6221 * previous = ERROR_HANDLER
jpayne@68 6222 * ERROR_HANDLER = name
jpayne@68 6223 * return previous # <<<<<<<<<<<<<<
jpayne@68 6224 *
jpayne@68 6225 * ########################################################################
jpayne@68 6226 */
jpayne@68 6227 __Pyx_XDECREF(__pyx_r);
jpayne@68 6228 __Pyx_INCREF(__pyx_v_previous);
jpayne@68 6229 __pyx_r = __pyx_v_previous;
jpayne@68 6230 goto __pyx_L0;
jpayne@68 6231
jpayne@68 6232 /* "pysam/libcutils.pyx":101
jpayne@68 6233 * return ERROR_HANDLER
jpayne@68 6234 *
jpayne@68 6235 * cpdef set_encoding_error_handler(name): # <<<<<<<<<<<<<<
jpayne@68 6236 * global ERROR_HANDLER
jpayne@68 6237 * previous = ERROR_HANDLER
jpayne@68 6238 */
jpayne@68 6239
jpayne@68 6240 /* function exit code */
jpayne@68 6241 __pyx_L1_error:;
jpayne@68 6242 __Pyx_XDECREF(__pyx_t_1);
jpayne@68 6243 __Pyx_AddTraceback("pysam.libcutils.set_encoding_error_handler", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@68 6244 __pyx_r = 0;
jpayne@68 6245 __pyx_L0:;
jpayne@68 6246 __Pyx_XDECREF(__pyx_v_previous);
jpayne@68 6247 __Pyx_XGIVEREF(__pyx_r);
jpayne@68 6248 __Pyx_RefNannyFinishContext();
jpayne@68 6249 return __pyx_r;
jpayne@68 6250 }
jpayne@68 6251
jpayne@68 6252 /* Python wrapper */
jpayne@68 6253 static PyObject *__pyx_pw_5pysam_9libcutils_11set_encoding_error_handler(PyObject *__pyx_self,
jpayne@68 6254 #if CYTHON_METH_FASTCALL
jpayne@68 6255 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
jpayne@68 6256 #else
jpayne@68 6257 PyObject *__pyx_args, PyObject *__pyx_kwds
jpayne@68 6258 #endif
jpayne@68 6259 ); /*proto*/
jpayne@68 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@68 6261 static PyObject *__pyx_pw_5pysam_9libcutils_11set_encoding_error_handler(PyObject *__pyx_self,
jpayne@68 6262 #if CYTHON_METH_FASTCALL
jpayne@68 6263 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
jpayne@68 6264 #else
jpayne@68 6265 PyObject *__pyx_args, PyObject *__pyx_kwds
jpayne@68 6266 #endif
jpayne@68 6267 ) {
jpayne@68 6268 PyObject *__pyx_v_name = 0;
jpayne@68 6269 #if !CYTHON_METH_FASTCALL
jpayne@68 6270 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
jpayne@68 6271 #endif
jpayne@68 6272 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
jpayne@68 6273 PyObject* values[1] = {0};
jpayne@68 6274 int __pyx_lineno = 0;
jpayne@68 6275 const char *__pyx_filename = NULL;
jpayne@68 6276 int __pyx_clineno = 0;
jpayne@68 6277 PyObject *__pyx_r = 0;
jpayne@68 6278 __Pyx_RefNannyDeclarations
jpayne@68 6279 __Pyx_RefNannySetupContext("set_encoding_error_handler (wrapper)", 0);
jpayne@68 6280 #if !CYTHON_METH_FASTCALL
jpayne@68 6281 #if CYTHON_ASSUME_SAFE_MACROS
jpayne@68 6282 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
jpayne@68 6283 #else
jpayne@68 6284 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
jpayne@68 6285 #endif
jpayne@68 6286 #endif
jpayne@68 6287 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
jpayne@68 6288 {
jpayne@68 6289 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,0};
jpayne@68 6290 if (__pyx_kwds) {
jpayne@68 6291 Py_ssize_t kw_args;
jpayne@68 6292 switch (__pyx_nargs) {
jpayne@68 6293 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
jpayne@68 6294 CYTHON_FALLTHROUGH;
jpayne@68 6295 case 0: break;
jpayne@68 6296 default: goto __pyx_L5_argtuple_error;
jpayne@68 6297 }
jpayne@68 6298 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
jpayne@68 6299 switch (__pyx_nargs) {
jpayne@68 6300 case 0:
jpayne@68 6301 if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_name)) != 0)) {
jpayne@68 6302 (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
jpayne@68 6303 kw_args--;
jpayne@68 6304 }
jpayne@68 6305 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 101, __pyx_L3_error)
jpayne@68 6306 else goto __pyx_L5_argtuple_error;
jpayne@68 6307 }
jpayne@68 6308 if (unlikely(kw_args > 0)) {
jpayne@68 6309 const Py_ssize_t kwd_pos_args = __pyx_nargs;
jpayne@68 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@68 6311 }
jpayne@68 6312 } else if (unlikely(__pyx_nargs != 1)) {
jpayne@68 6313 goto __pyx_L5_argtuple_error;
jpayne@68 6314 } else {
jpayne@68 6315 values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
jpayne@68 6316 }
jpayne@68 6317 __pyx_v_name = values[0];
jpayne@68 6318 }
jpayne@68 6319 goto __pyx_L6_skip;
jpayne@68 6320 __pyx_L5_argtuple_error:;
jpayne@68 6321 __Pyx_RaiseArgtupleInvalid("set_encoding_error_handler", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 101, __pyx_L3_error)
jpayne@68 6322 __pyx_L6_skip:;
jpayne@68 6323 goto __pyx_L4_argument_unpacking_done;
jpayne@68 6324 __pyx_L3_error:;
jpayne@68 6325 {
jpayne@68 6326 Py_ssize_t __pyx_temp;
jpayne@68 6327 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
jpayne@68 6328 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
jpayne@68 6329 }
jpayne@68 6330 }
jpayne@68 6331 __Pyx_AddTraceback("pysam.libcutils.set_encoding_error_handler", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@68 6332 __Pyx_RefNannyFinishContext();
jpayne@68 6333 return NULL;
jpayne@68 6334 __pyx_L4_argument_unpacking_done:;
jpayne@68 6335 __pyx_r = __pyx_pf_5pysam_9libcutils_10set_encoding_error_handler(__pyx_self, __pyx_v_name);
jpayne@68 6336
jpayne@68 6337 /* function exit code */
jpayne@68 6338 {
jpayne@68 6339 Py_ssize_t __pyx_temp;
jpayne@68 6340 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
jpayne@68 6341 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
jpayne@68 6342 }
jpayne@68 6343 }
jpayne@68 6344 __Pyx_RefNannyFinishContext();
jpayne@68 6345 return __pyx_r;
jpayne@68 6346 }
jpayne@68 6347
jpayne@68 6348 static PyObject *__pyx_pf_5pysam_9libcutils_10set_encoding_error_handler(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_name) {
jpayne@68 6349 PyObject *__pyx_r = NULL;
jpayne@68 6350 __Pyx_RefNannyDeclarations
jpayne@68 6351 PyObject *__pyx_t_1 = NULL;
jpayne@68 6352 int __pyx_lineno = 0;
jpayne@68 6353 const char *__pyx_filename = NULL;
jpayne@68 6354 int __pyx_clineno = 0;
jpayne@68 6355 __Pyx_RefNannySetupContext("set_encoding_error_handler", 1);
jpayne@68 6356 __Pyx_XDECREF(__pyx_r);
jpayne@68 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@68 6358 __Pyx_GOTREF(__pyx_t_1);
jpayne@68 6359 __pyx_r = __pyx_t_1;
jpayne@68 6360 __pyx_t_1 = 0;
jpayne@68 6361 goto __pyx_L0;
jpayne@68 6362
jpayne@68 6363 /* function exit code */
jpayne@68 6364 __pyx_L1_error:;
jpayne@68 6365 __Pyx_XDECREF(__pyx_t_1);
jpayne@68 6366 __Pyx_AddTraceback("pysam.libcutils.set_encoding_error_handler", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@68 6367 __pyx_r = NULL;
jpayne@68 6368 __pyx_L0:;
jpayne@68 6369 __Pyx_XGIVEREF(__pyx_r);
jpayne@68 6370 __Pyx_RefNannyFinishContext();
jpayne@68 6371 return __pyx_r;
jpayne@68 6372 }
jpayne@68 6373
jpayne@68 6374 /* "pysam/libcutils.pyx":111
jpayne@68 6375 * ########################################################################
jpayne@68 6376 *
jpayne@68 6377 * cdef from_string_and_size(const char* s, size_t length): # <<<<<<<<<<<<<<
jpayne@68 6378 * return s[:length].decode('utf-8', ERROR_HANDLER)
jpayne@68 6379 *
jpayne@68 6380 */
jpayne@68 6381
jpayne@68 6382 static PyObject *__pyx_f_5pysam_9libcutils_from_string_and_size(char const *__pyx_v_s, size_t __pyx_v_length) {
jpayne@68 6383 PyObject *__pyx_r = NULL;
jpayne@68 6384 __Pyx_RefNannyDeclarations
jpayne@68 6385 PyObject *__pyx_t_1 = NULL;
jpayne@68 6386 PyObject *__pyx_t_2 = NULL;
jpayne@68 6387 PyObject *__pyx_t_3 = NULL;
jpayne@68 6388 unsigned int __pyx_t_4;
jpayne@68 6389 int __pyx_lineno = 0;
jpayne@68 6390 const char *__pyx_filename = NULL;
jpayne@68 6391 int __pyx_clineno = 0;
jpayne@68 6392 __Pyx_RefNannySetupContext("from_string_and_size", 1);
jpayne@68 6393
jpayne@68 6394 /* "pysam/libcutils.pyx":112
jpayne@68 6395 *
jpayne@68 6396 * cdef from_string_and_size(const char* s, size_t length):
jpayne@68 6397 * return s[:length].decode('utf-8', ERROR_HANDLER) # <<<<<<<<<<<<<<
jpayne@68 6398 *
jpayne@68 6399 * # filename encoding (adapted from lxml.etree.pyx)
jpayne@68 6400 */
jpayne@68 6401 __Pyx_XDECREF(__pyx_r);
jpayne@68 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@68 6403 __Pyx_GOTREF(__pyx_t_2);
jpayne@68 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@68 6405 __Pyx_GOTREF(__pyx_t_3);
jpayne@68 6406 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@68 6407 __pyx_t_2 = NULL;
jpayne@68 6408 __pyx_t_4 = 0;
jpayne@68 6409 #if CYTHON_UNPACK_METHODS
jpayne@68 6410 if (likely(PyMethod_Check(__pyx_t_3))) {
jpayne@68 6411 __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
jpayne@68 6412 if (likely(__pyx_t_2)) {
jpayne@68 6413 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
jpayne@68 6414 __Pyx_INCREF(__pyx_t_2);
jpayne@68 6415 __Pyx_INCREF(function);
jpayne@68 6416 __Pyx_DECREF_SET(__pyx_t_3, function);
jpayne@68 6417 __pyx_t_4 = 1;
jpayne@68 6418 }
jpayne@68 6419 }
jpayne@68 6420 #endif
jpayne@68 6421 {
jpayne@68 6422 PyObject *__pyx_callargs[3] = {__pyx_t_2, __pyx_kp_u_utf_8, __pyx_v_5pysam_9libcutils_ERROR_HANDLER};
jpayne@68 6423 __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_4, 2+__pyx_t_4);
jpayne@68 6424 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@68 6425 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 112, __pyx_L1_error)
jpayne@68 6426 __Pyx_GOTREF(__pyx_t_1);
jpayne@68 6427 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@68 6428 }
jpayne@68 6429 __pyx_r = __pyx_t_1;
jpayne@68 6430 __pyx_t_1 = 0;
jpayne@68 6431 goto __pyx_L0;
jpayne@68 6432
jpayne@68 6433 /* "pysam/libcutils.pyx":111
jpayne@68 6434 * ########################################################################
jpayne@68 6435 *
jpayne@68 6436 * cdef from_string_and_size(const char* s, size_t length): # <<<<<<<<<<<<<<
jpayne@68 6437 * return s[:length].decode('utf-8', ERROR_HANDLER)
jpayne@68 6438 *
jpayne@68 6439 */
jpayne@68 6440
jpayne@68 6441 /* function exit code */
jpayne@68 6442 __pyx_L1_error:;
jpayne@68 6443 __Pyx_XDECREF(__pyx_t_1);
jpayne@68 6444 __Pyx_XDECREF(__pyx_t_2);
jpayne@68 6445 __Pyx_XDECREF(__pyx_t_3);
jpayne@68 6446 __Pyx_AddTraceback("pysam.libcutils.from_string_and_size", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@68 6447 __pyx_r = 0;
jpayne@68 6448 __pyx_L0:;
jpayne@68 6449 __Pyx_XGIVEREF(__pyx_r);
jpayne@68 6450 __Pyx_RefNannyFinishContext();
jpayne@68 6451 return __pyx_r;
jpayne@68 6452 }
jpayne@68 6453
jpayne@68 6454 /* "pysam/libcutils.pyx":118
jpayne@68 6455 * cdef str TEXT_ENCODING = 'utf-8'
jpayne@68 6456 *
jpayne@68 6457 * cdef bytes encode_filename(object filename): # <<<<<<<<<<<<<<
jpayne@68 6458 * """Make sure a filename is 8-bit encoded (or None)."""
jpayne@68 6459 * if filename is None:
jpayne@68 6460 */
jpayne@68 6461
jpayne@68 6462 static PyObject *__pyx_f_5pysam_9libcutils_encode_filename(PyObject *__pyx_v_filename) {
jpayne@68 6463 PyObject *__pyx_r = NULL;
jpayne@68 6464 __Pyx_RefNannyDeclarations
jpayne@68 6465 int __pyx_t_1;
jpayne@68 6466 PyObject *__pyx_t_2 = NULL;
jpayne@68 6467 PyObject *__pyx_t_3 = NULL;
jpayne@68 6468 PyObject *__pyx_t_4 = NULL;
jpayne@68 6469 unsigned int __pyx_t_5;
jpayne@68 6470 int __pyx_lineno = 0;
jpayne@68 6471 const char *__pyx_filename = NULL;
jpayne@68 6472 int __pyx_clineno = 0;
jpayne@68 6473 __Pyx_RefNannySetupContext("encode_filename", 1);
jpayne@68 6474
jpayne@68 6475 /* "pysam/libcutils.pyx":120
jpayne@68 6476 * cdef bytes encode_filename(object filename):
jpayne@68 6477 * """Make sure a filename is 8-bit encoded (or None)."""
jpayne@68 6478 * if filename is None: # <<<<<<<<<<<<<<
jpayne@68 6479 * return None
jpayne@68 6480 * return os.fsencode(filename)
jpayne@68 6481 */
jpayne@68 6482 __pyx_t_1 = (__pyx_v_filename == Py_None);
jpayne@68 6483 if (__pyx_t_1) {
jpayne@68 6484
jpayne@68 6485 /* "pysam/libcutils.pyx":121
jpayne@68 6486 * """Make sure a filename is 8-bit encoded (or None)."""
jpayne@68 6487 * if filename is None:
jpayne@68 6488 * return None # <<<<<<<<<<<<<<
jpayne@68 6489 * return os.fsencode(filename)
jpayne@68 6490 *
jpayne@68 6491 */
jpayne@68 6492 __Pyx_XDECREF(__pyx_r);
jpayne@68 6493 __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
jpayne@68 6494 goto __pyx_L0;
jpayne@68 6495
jpayne@68 6496 /* "pysam/libcutils.pyx":120
jpayne@68 6497 * cdef bytes encode_filename(object filename):
jpayne@68 6498 * """Make sure a filename is 8-bit encoded (or None)."""
jpayne@68 6499 * if filename is None: # <<<<<<<<<<<<<<
jpayne@68 6500 * return None
jpayne@68 6501 * return os.fsencode(filename)
jpayne@68 6502 */
jpayne@68 6503 }
jpayne@68 6504
jpayne@68 6505 /* "pysam/libcutils.pyx":122
jpayne@68 6506 * if filename is None:
jpayne@68 6507 * return None
jpayne@68 6508 * return os.fsencode(filename) # <<<<<<<<<<<<<<
jpayne@68 6509 *
jpayne@68 6510 *
jpayne@68 6511 */
jpayne@68 6512 __Pyx_XDECREF(__pyx_r);
jpayne@68 6513 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_os); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 122, __pyx_L1_error)
jpayne@68 6514 __Pyx_GOTREF(__pyx_t_3);
jpayne@68 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@68 6516 __Pyx_GOTREF(__pyx_t_4);
jpayne@68 6517 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@68 6518 __pyx_t_3 = NULL;
jpayne@68 6519 __pyx_t_5 = 0;
jpayne@68 6520 #if CYTHON_UNPACK_METHODS
jpayne@68 6521 if (unlikely(PyMethod_Check(__pyx_t_4))) {
jpayne@68 6522 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
jpayne@68 6523 if (likely(__pyx_t_3)) {
jpayne@68 6524 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
jpayne@68 6525 __Pyx_INCREF(__pyx_t_3);
jpayne@68 6526 __Pyx_INCREF(function);
jpayne@68 6527 __Pyx_DECREF_SET(__pyx_t_4, function);
jpayne@68 6528 __pyx_t_5 = 1;
jpayne@68 6529 }
jpayne@68 6530 }
jpayne@68 6531 #endif
jpayne@68 6532 {
jpayne@68 6533 PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_filename};
jpayne@68 6534 __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
jpayne@68 6535 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@68 6536 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 122, __pyx_L1_error)
jpayne@68 6537 __Pyx_GOTREF(__pyx_t_2);
jpayne@68 6538 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
jpayne@68 6539 }
jpayne@68 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@68 6541 __pyx_r = ((PyObject*)__pyx_t_2);
jpayne@68 6542 __pyx_t_2 = 0;
jpayne@68 6543 goto __pyx_L0;
jpayne@68 6544
jpayne@68 6545 /* "pysam/libcutils.pyx":118
jpayne@68 6546 * cdef str TEXT_ENCODING = 'utf-8'
jpayne@68 6547 *
jpayne@68 6548 * cdef bytes encode_filename(object filename): # <<<<<<<<<<<<<<
jpayne@68 6549 * """Make sure a filename is 8-bit encoded (or None)."""
jpayne@68 6550 * if filename is None:
jpayne@68 6551 */
jpayne@68 6552
jpayne@68 6553 /* function exit code */
jpayne@68 6554 __pyx_L1_error:;
jpayne@68 6555 __Pyx_XDECREF(__pyx_t_2);
jpayne@68 6556 __Pyx_XDECREF(__pyx_t_3);
jpayne@68 6557 __Pyx_XDECREF(__pyx_t_4);
jpayne@68 6558 __Pyx_AddTraceback("pysam.libcutils.encode_filename", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@68 6559 __pyx_r = 0;
jpayne@68 6560 __pyx_L0:;
jpayne@68 6561 __Pyx_XGIVEREF(__pyx_r);
jpayne@68 6562 __Pyx_RefNannyFinishContext();
jpayne@68 6563 return __pyx_r;
jpayne@68 6564 }
jpayne@68 6565
jpayne@68 6566 /* "pysam/libcutils.pyx":125
jpayne@68 6567 *
jpayne@68 6568 *
jpayne@68 6569 * cdef bytes force_bytes(object s, encoding=None, errors=None): # <<<<<<<<<<<<<<
jpayne@68 6570 * """convert string or unicode object to bytes, assuming
jpayne@68 6571 * utf8 encoding.
jpayne@68 6572 */
jpayne@68 6573
jpayne@68 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@68 6575 PyObject *__pyx_v_encoding = ((PyObject *)Py_None);
jpayne@68 6576 PyObject *__pyx_v_errors = ((PyObject *)Py_None);
jpayne@68 6577 PyObject *__pyx_r = NULL;
jpayne@68 6578 __Pyx_RefNannyDeclarations
jpayne@68 6579 int __pyx_t_1;
jpayne@68 6580 PyObject *__pyx_t_2 = NULL;
jpayne@68 6581 PyObject *__pyx_t_3 = NULL;
jpayne@68 6582 PyObject *__pyx_t_4 = NULL;
jpayne@68 6583 PyObject *__pyx_t_5 = NULL;
jpayne@68 6584 PyObject *__pyx_t_6 = NULL;
jpayne@68 6585 unsigned int __pyx_t_7;
jpayne@68 6586 int __pyx_lineno = 0;
jpayne@68 6587 const char *__pyx_filename = NULL;
jpayne@68 6588 int __pyx_clineno = 0;
jpayne@68 6589 __Pyx_RefNannySetupContext("force_bytes", 1);
jpayne@68 6590 if (__pyx_optional_args) {
jpayne@68 6591 if (__pyx_optional_args->__pyx_n > 0) {
jpayne@68 6592 __pyx_v_encoding = __pyx_optional_args->encoding;
jpayne@68 6593 if (__pyx_optional_args->__pyx_n > 1) {
jpayne@68 6594 __pyx_v_errors = __pyx_optional_args->errors;
jpayne@68 6595 }
jpayne@68 6596 }
jpayne@68 6597 }
jpayne@68 6598
jpayne@68 6599 /* "pysam/libcutils.pyx":129
jpayne@68 6600 * utf8 encoding.
jpayne@68 6601 * """
jpayne@68 6602 * if s is None: # <<<<<<<<<<<<<<
jpayne@68 6603 * return None
jpayne@68 6604 * elif PyBytes_Check(s):
jpayne@68 6605 */
jpayne@68 6606 __pyx_t_1 = (__pyx_v_s == Py_None);
jpayne@68 6607 if (__pyx_t_1) {
jpayne@68 6608
jpayne@68 6609 /* "pysam/libcutils.pyx":130
jpayne@68 6610 * """
jpayne@68 6611 * if s is None:
jpayne@68 6612 * return None # <<<<<<<<<<<<<<
jpayne@68 6613 * elif PyBytes_Check(s):
jpayne@68 6614 * return s
jpayne@68 6615 */
jpayne@68 6616 __Pyx_XDECREF(__pyx_r);
jpayne@68 6617 __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
jpayne@68 6618 goto __pyx_L0;
jpayne@68 6619
jpayne@68 6620 /* "pysam/libcutils.pyx":129
jpayne@68 6621 * utf8 encoding.
jpayne@68 6622 * """
jpayne@68 6623 * if s is None: # <<<<<<<<<<<<<<
jpayne@68 6624 * return None
jpayne@68 6625 * elif PyBytes_Check(s):
jpayne@68 6626 */
jpayne@68 6627 }
jpayne@68 6628
jpayne@68 6629 /* "pysam/libcutils.pyx":131
jpayne@68 6630 * if s is None:
jpayne@68 6631 * return None
jpayne@68 6632 * elif PyBytes_Check(s): # <<<<<<<<<<<<<<
jpayne@68 6633 * return s
jpayne@68 6634 * elif PyUnicode_Check(s):
jpayne@68 6635 */
jpayne@68 6636 __pyx_t_1 = PyBytes_Check(__pyx_v_s);
jpayne@68 6637 if (__pyx_t_1) {
jpayne@68 6638
jpayne@68 6639 /* "pysam/libcutils.pyx":132
jpayne@68 6640 * return None
jpayne@68 6641 * elif PyBytes_Check(s):
jpayne@68 6642 * return s # <<<<<<<<<<<<<<
jpayne@68 6643 * elif PyUnicode_Check(s):
jpayne@68 6644 * return s.encode(encoding or TEXT_ENCODING, errors or ERROR_HANDLER)
jpayne@68 6645 */
jpayne@68 6646 __Pyx_XDECREF(__pyx_r);
jpayne@68 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@68 6648 __Pyx_INCREF(__pyx_v_s);
jpayne@68 6649 __pyx_r = ((PyObject*)__pyx_v_s);
jpayne@68 6650 goto __pyx_L0;
jpayne@68 6651
jpayne@68 6652 /* "pysam/libcutils.pyx":131
jpayne@68 6653 * if s is None:
jpayne@68 6654 * return None
jpayne@68 6655 * elif PyBytes_Check(s): # <<<<<<<<<<<<<<
jpayne@68 6656 * return s
jpayne@68 6657 * elif PyUnicode_Check(s):
jpayne@68 6658 */
jpayne@68 6659 }
jpayne@68 6660
jpayne@68 6661 /* "pysam/libcutils.pyx":133
jpayne@68 6662 * elif PyBytes_Check(s):
jpayne@68 6663 * return s
jpayne@68 6664 * elif PyUnicode_Check(s): # <<<<<<<<<<<<<<
jpayne@68 6665 * return s.encode(encoding or TEXT_ENCODING, errors or ERROR_HANDLER)
jpayne@68 6666 * else:
jpayne@68 6667 */
jpayne@68 6668 __pyx_t_1 = PyUnicode_Check(__pyx_v_s);
jpayne@68 6669 if (likely(__pyx_t_1)) {
jpayne@68 6670
jpayne@68 6671 /* "pysam/libcutils.pyx":134
jpayne@68 6672 * return s
jpayne@68 6673 * elif PyUnicode_Check(s):
jpayne@68 6674 * return s.encode(encoding or TEXT_ENCODING, errors or ERROR_HANDLER) # <<<<<<<<<<<<<<
jpayne@68 6675 * else:
jpayne@68 6676 * raise TypeError("Argument must be string, bytes or unicode.")
jpayne@68 6677 */
jpayne@68 6678 __Pyx_XDECREF(__pyx_r);
jpayne@68 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@68 6680 __Pyx_GOTREF(__pyx_t_3);
jpayne@68 6681 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_encoding); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 134, __pyx_L1_error)
jpayne@68 6682 if (!__pyx_t_1) {
jpayne@68 6683 } else {
jpayne@68 6684 __Pyx_INCREF(__pyx_v_encoding);
jpayne@68 6685 __pyx_t_4 = __pyx_v_encoding;
jpayne@68 6686 goto __pyx_L4_bool_binop_done;
jpayne@68 6687 }
jpayne@68 6688 __Pyx_INCREF(__pyx_v_5pysam_9libcutils_TEXT_ENCODING);
jpayne@68 6689 __pyx_t_4 = __pyx_v_5pysam_9libcutils_TEXT_ENCODING;
jpayne@68 6690 __pyx_L4_bool_binop_done:;
jpayne@68 6691 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_errors); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 134, __pyx_L1_error)
jpayne@68 6692 if (!__pyx_t_1) {
jpayne@68 6693 } else {
jpayne@68 6694 __Pyx_INCREF(__pyx_v_errors);
jpayne@68 6695 __pyx_t_5 = __pyx_v_errors;
jpayne@68 6696 goto __pyx_L6_bool_binop_done;
jpayne@68 6697 }
jpayne@68 6698 __Pyx_INCREF(__pyx_v_5pysam_9libcutils_ERROR_HANDLER);
jpayne@68 6699 __pyx_t_5 = __pyx_v_5pysam_9libcutils_ERROR_HANDLER;
jpayne@68 6700 __pyx_L6_bool_binop_done:;
jpayne@68 6701 __pyx_t_6 = NULL;
jpayne@68 6702 __pyx_t_7 = 0;
jpayne@68 6703 #if CYTHON_UNPACK_METHODS
jpayne@68 6704 if (likely(PyMethod_Check(__pyx_t_3))) {
jpayne@68 6705 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
jpayne@68 6706 if (likely(__pyx_t_6)) {
jpayne@68 6707 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
jpayne@68 6708 __Pyx_INCREF(__pyx_t_6);
jpayne@68 6709 __Pyx_INCREF(function);
jpayne@68 6710 __Pyx_DECREF_SET(__pyx_t_3, function);
jpayne@68 6711 __pyx_t_7 = 1;
jpayne@68 6712 }
jpayne@68 6713 }
jpayne@68 6714 #endif
jpayne@68 6715 {
jpayne@68 6716 PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_t_4, __pyx_t_5};
jpayne@68 6717 __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_7, 2+__pyx_t_7);
jpayne@68 6718 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
jpayne@68 6719 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
jpayne@68 6720 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
jpayne@68 6721 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 134, __pyx_L1_error)
jpayne@68 6722 __Pyx_GOTREF(__pyx_t_2);
jpayne@68 6723 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@68 6724 }
jpayne@68 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@68 6726 __pyx_r = ((PyObject*)__pyx_t_2);
jpayne@68 6727 __pyx_t_2 = 0;
jpayne@68 6728 goto __pyx_L0;
jpayne@68 6729
jpayne@68 6730 /* "pysam/libcutils.pyx":133
jpayne@68 6731 * elif PyBytes_Check(s):
jpayne@68 6732 * return s
jpayne@68 6733 * elif PyUnicode_Check(s): # <<<<<<<<<<<<<<
jpayne@68 6734 * return s.encode(encoding or TEXT_ENCODING, errors or ERROR_HANDLER)
jpayne@68 6735 * else:
jpayne@68 6736 */
jpayne@68 6737 }
jpayne@68 6738
jpayne@68 6739 /* "pysam/libcutils.pyx":136
jpayne@68 6740 * return s.encode(encoding or TEXT_ENCODING, errors or ERROR_HANDLER)
jpayne@68 6741 * else:
jpayne@68 6742 * raise TypeError("Argument must be string, bytes or unicode.") # <<<<<<<<<<<<<<
jpayne@68 6743 *
jpayne@68 6744 *
jpayne@68 6745 */
jpayne@68 6746 /*else*/ {
jpayne@68 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@68 6748 __Pyx_GOTREF(__pyx_t_2);
jpayne@68 6749 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
jpayne@68 6750 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@68 6751 __PYX_ERR(0, 136, __pyx_L1_error)
jpayne@68 6752 }
jpayne@68 6753
jpayne@68 6754 /* "pysam/libcutils.pyx":125
jpayne@68 6755 *
jpayne@68 6756 *
jpayne@68 6757 * cdef bytes force_bytes(object s, encoding=None, errors=None): # <<<<<<<<<<<<<<
jpayne@68 6758 * """convert string or unicode object to bytes, assuming
jpayne@68 6759 * utf8 encoding.
jpayne@68 6760 */
jpayne@68 6761
jpayne@68 6762 /* function exit code */
jpayne@68 6763 __pyx_L1_error:;
jpayne@68 6764 __Pyx_XDECREF(__pyx_t_2);
jpayne@68 6765 __Pyx_XDECREF(__pyx_t_3);
jpayne@68 6766 __Pyx_XDECREF(__pyx_t_4);
jpayne@68 6767 __Pyx_XDECREF(__pyx_t_5);
jpayne@68 6768 __Pyx_XDECREF(__pyx_t_6);
jpayne@68 6769 __Pyx_AddTraceback("pysam.libcutils.force_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@68 6770 __pyx_r = 0;
jpayne@68 6771 __pyx_L0:;
jpayne@68 6772 __Pyx_XGIVEREF(__pyx_r);
jpayne@68 6773 __Pyx_RefNannyFinishContext();
jpayne@68 6774 return __pyx_r;
jpayne@68 6775 }
jpayne@68 6776
jpayne@68 6777 /* "pysam/libcutils.pyx":139
jpayne@68 6778 *
jpayne@68 6779 *
jpayne@68 6780 * cdef charptr_to_str(const char* s, encoding=None, errors=None): # <<<<<<<<<<<<<<
jpayne@68 6781 * if s == NULL:
jpayne@68 6782 * return None
jpayne@68 6783 */
jpayne@68 6784
jpayne@68 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@68 6786 PyObject *__pyx_v_encoding = ((PyObject *)Py_None);
jpayne@68 6787 PyObject *__pyx_v_errors = ((PyObject *)Py_None);
jpayne@68 6788 PyObject *__pyx_r = NULL;
jpayne@68 6789 __Pyx_RefNannyDeclarations
jpayne@68 6790 int __pyx_t_1;
jpayne@68 6791 PyObject *__pyx_t_2 = NULL;
jpayne@68 6792 PyObject *__pyx_t_3 = NULL;
jpayne@68 6793 PyObject *__pyx_t_4 = NULL;
jpayne@68 6794 PyObject *__pyx_t_5 = NULL;
jpayne@68 6795 PyObject *__pyx_t_6 = NULL;
jpayne@68 6796 unsigned int __pyx_t_7;
jpayne@68 6797 int __pyx_lineno = 0;
jpayne@68 6798 const char *__pyx_filename = NULL;
jpayne@68 6799 int __pyx_clineno = 0;
jpayne@68 6800 __Pyx_RefNannySetupContext("charptr_to_str", 1);
jpayne@68 6801 if (__pyx_optional_args) {
jpayne@68 6802 if (__pyx_optional_args->__pyx_n > 0) {
jpayne@68 6803 __pyx_v_encoding = __pyx_optional_args->encoding;
jpayne@68 6804 if (__pyx_optional_args->__pyx_n > 1) {
jpayne@68 6805 __pyx_v_errors = __pyx_optional_args->errors;
jpayne@68 6806 }
jpayne@68 6807 }
jpayne@68 6808 }
jpayne@68 6809
jpayne@68 6810 /* "pysam/libcutils.pyx":140
jpayne@68 6811 *
jpayne@68 6812 * cdef charptr_to_str(const char* s, encoding=None, errors=None):
jpayne@68 6813 * if s == NULL: # <<<<<<<<<<<<<<
jpayne@68 6814 * return None
jpayne@68 6815 * return s.decode(encoding or TEXT_ENCODING, errors or ERROR_HANDLER)
jpayne@68 6816 */
jpayne@68 6817 __pyx_t_1 = (__pyx_v_s == NULL);
jpayne@68 6818 if (__pyx_t_1) {
jpayne@68 6819
jpayne@68 6820 /* "pysam/libcutils.pyx":141
jpayne@68 6821 * cdef charptr_to_str(const char* s, encoding=None, errors=None):
jpayne@68 6822 * if s == NULL:
jpayne@68 6823 * return None # <<<<<<<<<<<<<<
jpayne@68 6824 * return s.decode(encoding or TEXT_ENCODING, errors or ERROR_HANDLER)
jpayne@68 6825 *
jpayne@68 6826 */
jpayne@68 6827 __Pyx_XDECREF(__pyx_r);
jpayne@68 6828 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
jpayne@68 6829 goto __pyx_L0;
jpayne@68 6830
jpayne@68 6831 /* "pysam/libcutils.pyx":140
jpayne@68 6832 *
jpayne@68 6833 * cdef charptr_to_str(const char* s, encoding=None, errors=None):
jpayne@68 6834 * if s == NULL: # <<<<<<<<<<<<<<
jpayne@68 6835 * return None
jpayne@68 6836 * return s.decode(encoding or TEXT_ENCODING, errors or ERROR_HANDLER)
jpayne@68 6837 */
jpayne@68 6838 }
jpayne@68 6839
jpayne@68 6840 /* "pysam/libcutils.pyx":142
jpayne@68 6841 * if s == NULL:
jpayne@68 6842 * return None
jpayne@68 6843 * return s.decode(encoding or TEXT_ENCODING, errors or ERROR_HANDLER) # <<<<<<<<<<<<<<
jpayne@68 6844 *
jpayne@68 6845 *
jpayne@68 6846 */
jpayne@68 6847 __Pyx_XDECREF(__pyx_r);
jpayne@68 6848 __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_s); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 142, __pyx_L1_error)
jpayne@68 6849 __Pyx_GOTREF(__pyx_t_3);
jpayne@68 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@68 6851 __Pyx_GOTREF(__pyx_t_4);
jpayne@68 6852 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@68 6853 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_encoding); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 142, __pyx_L1_error)
jpayne@68 6854 if (!__pyx_t_1) {
jpayne@68 6855 } else {
jpayne@68 6856 __Pyx_INCREF(__pyx_v_encoding);
jpayne@68 6857 __pyx_t_3 = __pyx_v_encoding;
jpayne@68 6858 goto __pyx_L4_bool_binop_done;
jpayne@68 6859 }
jpayne@68 6860 __Pyx_INCREF(__pyx_v_5pysam_9libcutils_TEXT_ENCODING);
jpayne@68 6861 __pyx_t_3 = __pyx_v_5pysam_9libcutils_TEXT_ENCODING;
jpayne@68 6862 __pyx_L4_bool_binop_done:;
jpayne@68 6863 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_errors); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 142, __pyx_L1_error)
jpayne@68 6864 if (!__pyx_t_1) {
jpayne@68 6865 } else {
jpayne@68 6866 __Pyx_INCREF(__pyx_v_errors);
jpayne@68 6867 __pyx_t_5 = __pyx_v_errors;
jpayne@68 6868 goto __pyx_L6_bool_binop_done;
jpayne@68 6869 }
jpayne@68 6870 __Pyx_INCREF(__pyx_v_5pysam_9libcutils_ERROR_HANDLER);
jpayne@68 6871 __pyx_t_5 = __pyx_v_5pysam_9libcutils_ERROR_HANDLER;
jpayne@68 6872 __pyx_L6_bool_binop_done:;
jpayne@68 6873 __pyx_t_6 = NULL;
jpayne@68 6874 __pyx_t_7 = 0;
jpayne@68 6875 #if CYTHON_UNPACK_METHODS
jpayne@68 6876 if (likely(PyMethod_Check(__pyx_t_4))) {
jpayne@68 6877 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
jpayne@68 6878 if (likely(__pyx_t_6)) {
jpayne@68 6879 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
jpayne@68 6880 __Pyx_INCREF(__pyx_t_6);
jpayne@68 6881 __Pyx_INCREF(function);
jpayne@68 6882 __Pyx_DECREF_SET(__pyx_t_4, function);
jpayne@68 6883 __pyx_t_7 = 1;
jpayne@68 6884 }
jpayne@68 6885 }
jpayne@68 6886 #endif
jpayne@68 6887 {
jpayne@68 6888 PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_t_3, __pyx_t_5};
jpayne@68 6889 __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_7, 2+__pyx_t_7);
jpayne@68 6890 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
jpayne@68 6891 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@68 6892 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
jpayne@68 6893 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 142, __pyx_L1_error)
jpayne@68 6894 __Pyx_GOTREF(__pyx_t_2);
jpayne@68 6895 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
jpayne@68 6896 }
jpayne@68 6897 __pyx_r = __pyx_t_2;
jpayne@68 6898 __pyx_t_2 = 0;
jpayne@68 6899 goto __pyx_L0;
jpayne@68 6900
jpayne@68 6901 /* "pysam/libcutils.pyx":139
jpayne@68 6902 *
jpayne@68 6903 *
jpayne@68 6904 * cdef charptr_to_str(const char* s, encoding=None, errors=None): # <<<<<<<<<<<<<<
jpayne@68 6905 * if s == NULL:
jpayne@68 6906 * return None
jpayne@68 6907 */
jpayne@68 6908
jpayne@68 6909 /* function exit code */
jpayne@68 6910 __pyx_L1_error:;
jpayne@68 6911 __Pyx_XDECREF(__pyx_t_2);
jpayne@68 6912 __Pyx_XDECREF(__pyx_t_3);
jpayne@68 6913 __Pyx_XDECREF(__pyx_t_4);
jpayne@68 6914 __Pyx_XDECREF(__pyx_t_5);
jpayne@68 6915 __Pyx_XDECREF(__pyx_t_6);
jpayne@68 6916 __Pyx_AddTraceback("pysam.libcutils.charptr_to_str", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@68 6917 __pyx_r = 0;
jpayne@68 6918 __pyx_L0:;
jpayne@68 6919 __Pyx_XGIVEREF(__pyx_r);
jpayne@68 6920 __Pyx_RefNannyFinishContext();
jpayne@68 6921 return __pyx_r;
jpayne@68 6922 }
jpayne@68 6923
jpayne@68 6924 /* "pysam/libcutils.pyx":145
jpayne@68 6925 *
jpayne@68 6926 *
jpayne@68 6927 * cdef charptr_to_str_w_len(const char* s, size_t n, encoding=None, errors=None): # <<<<<<<<<<<<<<
jpayne@68 6928 * if s == NULL:
jpayne@68 6929 * return None
jpayne@68 6930 */
jpayne@68 6931
jpayne@68 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@68 6933 PyObject *__pyx_v_encoding = ((PyObject *)Py_None);
jpayne@68 6934 PyObject *__pyx_v_errors = ((PyObject *)Py_None);
jpayne@68 6935 PyObject *__pyx_r = NULL;
jpayne@68 6936 __Pyx_RefNannyDeclarations
jpayne@68 6937 int __pyx_t_1;
jpayne@68 6938 PyObject *__pyx_t_2 = NULL;
jpayne@68 6939 PyObject *__pyx_t_3 = NULL;
jpayne@68 6940 PyObject *__pyx_t_4 = NULL;
jpayne@68 6941 PyObject *__pyx_t_5 = NULL;
jpayne@68 6942 PyObject *__pyx_t_6 = NULL;
jpayne@68 6943 unsigned int __pyx_t_7;
jpayne@68 6944 int __pyx_lineno = 0;
jpayne@68 6945 const char *__pyx_filename = NULL;
jpayne@68 6946 int __pyx_clineno = 0;
jpayne@68 6947 __Pyx_RefNannySetupContext("charptr_to_str_w_len", 1);
jpayne@68 6948 if (__pyx_optional_args) {
jpayne@68 6949 if (__pyx_optional_args->__pyx_n > 0) {
jpayne@68 6950 __pyx_v_encoding = __pyx_optional_args->encoding;
jpayne@68 6951 if (__pyx_optional_args->__pyx_n > 1) {
jpayne@68 6952 __pyx_v_errors = __pyx_optional_args->errors;
jpayne@68 6953 }
jpayne@68 6954 }
jpayne@68 6955 }
jpayne@68 6956
jpayne@68 6957 /* "pysam/libcutils.pyx":146
jpayne@68 6958 *
jpayne@68 6959 * cdef charptr_to_str_w_len(const char* s, size_t n, encoding=None, errors=None):
jpayne@68 6960 * if s == NULL: # <<<<<<<<<<<<<<
jpayne@68 6961 * return None
jpayne@68 6962 * return s[:n].decode(encoding or TEXT_ENCODING, errors or ERROR_HANDLER)
jpayne@68 6963 */
jpayne@68 6964 __pyx_t_1 = (__pyx_v_s == NULL);
jpayne@68 6965 if (__pyx_t_1) {
jpayne@68 6966
jpayne@68 6967 /* "pysam/libcutils.pyx":147
jpayne@68 6968 * cdef charptr_to_str_w_len(const char* s, size_t n, encoding=None, errors=None):
jpayne@68 6969 * if s == NULL:
jpayne@68 6970 * return None # <<<<<<<<<<<<<<
jpayne@68 6971 * return s[:n].decode(encoding or TEXT_ENCODING, errors or ERROR_HANDLER)
jpayne@68 6972 *
jpayne@68 6973 */
jpayne@68 6974 __Pyx_XDECREF(__pyx_r);
jpayne@68 6975 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
jpayne@68 6976 goto __pyx_L0;
jpayne@68 6977
jpayne@68 6978 /* "pysam/libcutils.pyx":146
jpayne@68 6979 *
jpayne@68 6980 * cdef charptr_to_str_w_len(const char* s, size_t n, encoding=None, errors=None):
jpayne@68 6981 * if s == NULL: # <<<<<<<<<<<<<<
jpayne@68 6982 * return None
jpayne@68 6983 * return s[:n].decode(encoding or TEXT_ENCODING, errors or ERROR_HANDLER)
jpayne@68 6984 */
jpayne@68 6985 }
jpayne@68 6986
jpayne@68 6987 /* "pysam/libcutils.pyx":148
jpayne@68 6988 * if s == NULL:
jpayne@68 6989 * return None
jpayne@68 6990 * return s[:n].decode(encoding or TEXT_ENCODING, errors or ERROR_HANDLER) # <<<<<<<<<<<<<<
jpayne@68 6991 *
jpayne@68 6992 *
jpayne@68 6993 */
jpayne@68 6994 __Pyx_XDECREF(__pyx_r);
jpayne@68 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@68 6996 __Pyx_GOTREF(__pyx_t_3);
jpayne@68 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@68 6998 __Pyx_GOTREF(__pyx_t_4);
jpayne@68 6999 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@68 7000 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_encoding); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 148, __pyx_L1_error)
jpayne@68 7001 if (!__pyx_t_1) {
jpayne@68 7002 } else {
jpayne@68 7003 __Pyx_INCREF(__pyx_v_encoding);
jpayne@68 7004 __pyx_t_3 = __pyx_v_encoding;
jpayne@68 7005 goto __pyx_L4_bool_binop_done;
jpayne@68 7006 }
jpayne@68 7007 __Pyx_INCREF(__pyx_v_5pysam_9libcutils_TEXT_ENCODING);
jpayne@68 7008 __pyx_t_3 = __pyx_v_5pysam_9libcutils_TEXT_ENCODING;
jpayne@68 7009 __pyx_L4_bool_binop_done:;
jpayne@68 7010 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_errors); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 148, __pyx_L1_error)
jpayne@68 7011 if (!__pyx_t_1) {
jpayne@68 7012 } else {
jpayne@68 7013 __Pyx_INCREF(__pyx_v_errors);
jpayne@68 7014 __pyx_t_5 = __pyx_v_errors;
jpayne@68 7015 goto __pyx_L6_bool_binop_done;
jpayne@68 7016 }
jpayne@68 7017 __Pyx_INCREF(__pyx_v_5pysam_9libcutils_ERROR_HANDLER);
jpayne@68 7018 __pyx_t_5 = __pyx_v_5pysam_9libcutils_ERROR_HANDLER;
jpayne@68 7019 __pyx_L6_bool_binop_done:;
jpayne@68 7020 __pyx_t_6 = NULL;
jpayne@68 7021 __pyx_t_7 = 0;
jpayne@68 7022 #if CYTHON_UNPACK_METHODS
jpayne@68 7023 if (likely(PyMethod_Check(__pyx_t_4))) {
jpayne@68 7024 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
jpayne@68 7025 if (likely(__pyx_t_6)) {
jpayne@68 7026 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
jpayne@68 7027 __Pyx_INCREF(__pyx_t_6);
jpayne@68 7028 __Pyx_INCREF(function);
jpayne@68 7029 __Pyx_DECREF_SET(__pyx_t_4, function);
jpayne@68 7030 __pyx_t_7 = 1;
jpayne@68 7031 }
jpayne@68 7032 }
jpayne@68 7033 #endif
jpayne@68 7034 {
jpayne@68 7035 PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_t_3, __pyx_t_5};
jpayne@68 7036 __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_4, __pyx_callargs+1-__pyx_t_7, 2+__pyx_t_7);
jpayne@68 7037 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
jpayne@68 7038 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@68 7039 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
jpayne@68 7040 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 148, __pyx_L1_error)
jpayne@68 7041 __Pyx_GOTREF(__pyx_t_2);
jpayne@68 7042 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
jpayne@68 7043 }
jpayne@68 7044 __pyx_r = __pyx_t_2;
jpayne@68 7045 __pyx_t_2 = 0;
jpayne@68 7046 goto __pyx_L0;
jpayne@68 7047
jpayne@68 7048 /* "pysam/libcutils.pyx":145
jpayne@68 7049 *
jpayne@68 7050 *
jpayne@68 7051 * cdef charptr_to_str_w_len(const char* s, size_t n, encoding=None, errors=None): # <<<<<<<<<<<<<<
jpayne@68 7052 * if s == NULL:
jpayne@68 7053 * return None
jpayne@68 7054 */
jpayne@68 7055
jpayne@68 7056 /* function exit code */
jpayne@68 7057 __pyx_L1_error:;
jpayne@68 7058 __Pyx_XDECREF(__pyx_t_2);
jpayne@68 7059 __Pyx_XDECREF(__pyx_t_3);
jpayne@68 7060 __Pyx_XDECREF(__pyx_t_4);
jpayne@68 7061 __Pyx_XDECREF(__pyx_t_5);
jpayne@68 7062 __Pyx_XDECREF(__pyx_t_6);
jpayne@68 7063 __Pyx_AddTraceback("pysam.libcutils.charptr_to_str_w_len", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@68 7064 __pyx_r = 0;
jpayne@68 7065 __pyx_L0:;
jpayne@68 7066 __Pyx_XGIVEREF(__pyx_r);
jpayne@68 7067 __Pyx_RefNannyFinishContext();
jpayne@68 7068 return __pyx_r;
jpayne@68 7069 }
jpayne@68 7070
jpayne@68 7071 /* "pysam/libcutils.pyx":151
jpayne@68 7072 *
jpayne@68 7073 *
jpayne@68 7074 * cdef bytes charptr_to_bytes(const char* s, encoding=None, errors=None): # <<<<<<<<<<<<<<
jpayne@68 7075 * if s == NULL:
jpayne@68 7076 * return None
jpayne@68 7077 */
jpayne@68 7078
jpayne@68 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@68 7080 PyObject *__pyx_r = NULL;
jpayne@68 7081 __Pyx_RefNannyDeclarations
jpayne@68 7082 int __pyx_t_1;
jpayne@68 7083 PyObject *__pyx_t_2 = NULL;
jpayne@68 7084 int __pyx_lineno = 0;
jpayne@68 7085 const char *__pyx_filename = NULL;
jpayne@68 7086 int __pyx_clineno = 0;
jpayne@68 7087 __Pyx_RefNannySetupContext("charptr_to_bytes", 1);
jpayne@68 7088 if (__pyx_optional_args) {
jpayne@68 7089 }
jpayne@68 7090
jpayne@68 7091 /* "pysam/libcutils.pyx":152
jpayne@68 7092 *
jpayne@68 7093 * cdef bytes charptr_to_bytes(const char* s, encoding=None, errors=None):
jpayne@68 7094 * if s == NULL: # <<<<<<<<<<<<<<
jpayne@68 7095 * return None
jpayne@68 7096 * else:
jpayne@68 7097 */
jpayne@68 7098 __pyx_t_1 = (__pyx_v_s == NULL);
jpayne@68 7099 if (__pyx_t_1) {
jpayne@68 7100
jpayne@68 7101 /* "pysam/libcutils.pyx":153
jpayne@68 7102 * cdef bytes charptr_to_bytes(const char* s, encoding=None, errors=None):
jpayne@68 7103 * if s == NULL:
jpayne@68 7104 * return None # <<<<<<<<<<<<<<
jpayne@68 7105 * else:
jpayne@68 7106 * return s
jpayne@68 7107 */
jpayne@68 7108 __Pyx_XDECREF(__pyx_r);
jpayne@68 7109 __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
jpayne@68 7110 goto __pyx_L0;
jpayne@68 7111
jpayne@68 7112 /* "pysam/libcutils.pyx":152
jpayne@68 7113 *
jpayne@68 7114 * cdef bytes charptr_to_bytes(const char* s, encoding=None, errors=None):
jpayne@68 7115 * if s == NULL: # <<<<<<<<<<<<<<
jpayne@68 7116 * return None
jpayne@68 7117 * else:
jpayne@68 7118 */
jpayne@68 7119 }
jpayne@68 7120
jpayne@68 7121 /* "pysam/libcutils.pyx":155
jpayne@68 7122 * return None
jpayne@68 7123 * else:
jpayne@68 7124 * return s # <<<<<<<<<<<<<<
jpayne@68 7125 *
jpayne@68 7126 *
jpayne@68 7127 */
jpayne@68 7128 /*else*/ {
jpayne@68 7129 __Pyx_XDECREF(__pyx_r);
jpayne@68 7130 __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v_s); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 155, __pyx_L1_error)
jpayne@68 7131 __Pyx_GOTREF(__pyx_t_2);
jpayne@68 7132 __pyx_r = ((PyObject*)__pyx_t_2);
jpayne@68 7133 __pyx_t_2 = 0;
jpayne@68 7134 goto __pyx_L0;
jpayne@68 7135 }
jpayne@68 7136
jpayne@68 7137 /* "pysam/libcutils.pyx":151
jpayne@68 7138 *
jpayne@68 7139 *
jpayne@68 7140 * cdef bytes charptr_to_bytes(const char* s, encoding=None, errors=None): # <<<<<<<<<<<<<<
jpayne@68 7141 * if s == NULL:
jpayne@68 7142 * return None
jpayne@68 7143 */
jpayne@68 7144
jpayne@68 7145 /* function exit code */
jpayne@68 7146 __pyx_L1_error:;
jpayne@68 7147 __Pyx_XDECREF(__pyx_t_2);
jpayne@68 7148 __Pyx_AddTraceback("pysam.libcutils.charptr_to_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@68 7149 __pyx_r = 0;
jpayne@68 7150 __pyx_L0:;
jpayne@68 7151 __Pyx_XGIVEREF(__pyx_r);
jpayne@68 7152 __Pyx_RefNannyFinishContext();
jpayne@68 7153 return __pyx_r;
jpayne@68 7154 }
jpayne@68 7155
jpayne@68 7156 /* "pysam/libcutils.pyx":158
jpayne@68 7157 *
jpayne@68 7158 *
jpayne@68 7159 * cdef force_str(object s, encoding=None, errors=None): # <<<<<<<<<<<<<<
jpayne@68 7160 * """Return s converted to str type of current Python
jpayne@68 7161 * (bytes in Py2, unicode in Py3)"""
jpayne@68 7162 */
jpayne@68 7163
jpayne@68 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@68 7165 PyObject *__pyx_v_encoding = ((PyObject *)Py_None);
jpayne@68 7166 PyObject *__pyx_v_errors = ((PyObject *)Py_None);
jpayne@68 7167 PyObject *__pyx_r = NULL;
jpayne@68 7168 __Pyx_RefNannyDeclarations
jpayne@68 7169 int __pyx_t_1;
jpayne@68 7170 PyObject *__pyx_t_2 = NULL;
jpayne@68 7171 PyObject *__pyx_t_3 = NULL;
jpayne@68 7172 PyObject *__pyx_t_4 = NULL;
jpayne@68 7173 PyObject *__pyx_t_5 = NULL;
jpayne@68 7174 PyObject *__pyx_t_6 = NULL;
jpayne@68 7175 unsigned int __pyx_t_7;
jpayne@68 7176 int __pyx_lineno = 0;
jpayne@68 7177 const char *__pyx_filename = NULL;
jpayne@68 7178 int __pyx_clineno = 0;
jpayne@68 7179 __Pyx_RefNannySetupContext("force_str", 1);
jpayne@68 7180 if (__pyx_optional_args) {
jpayne@68 7181 if (__pyx_optional_args->__pyx_n > 0) {
jpayne@68 7182 __pyx_v_encoding = __pyx_optional_args->encoding;
jpayne@68 7183 if (__pyx_optional_args->__pyx_n > 1) {
jpayne@68 7184 __pyx_v_errors = __pyx_optional_args->errors;
jpayne@68 7185 }
jpayne@68 7186 }
jpayne@68 7187 }
jpayne@68 7188
jpayne@68 7189 /* "pysam/libcutils.pyx":161
jpayne@68 7190 * """Return s converted to str type of current Python
jpayne@68 7191 * (bytes in Py2, unicode in Py3)"""
jpayne@68 7192 * if s is None: # <<<<<<<<<<<<<<
jpayne@68 7193 * return None
jpayne@68 7194 * if PyBytes_Check(s):
jpayne@68 7195 */
jpayne@68 7196 __pyx_t_1 = (__pyx_v_s == Py_None);
jpayne@68 7197 if (__pyx_t_1) {
jpayne@68 7198
jpayne@68 7199 /* "pysam/libcutils.pyx":162
jpayne@68 7200 * (bytes in Py2, unicode in Py3)"""
jpayne@68 7201 * if s is None:
jpayne@68 7202 * return None # <<<<<<<<<<<<<<
jpayne@68 7203 * if PyBytes_Check(s):
jpayne@68 7204 * return s.decode(encoding or TEXT_ENCODING, errors or ERROR_HANDLER)
jpayne@68 7205 */
jpayne@68 7206 __Pyx_XDECREF(__pyx_r);
jpayne@68 7207 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
jpayne@68 7208 goto __pyx_L0;
jpayne@68 7209
jpayne@68 7210 /* "pysam/libcutils.pyx":161
jpayne@68 7211 * """Return s converted to str type of current Python
jpayne@68 7212 * (bytes in Py2, unicode in Py3)"""
jpayne@68 7213 * if s is None: # <<<<<<<<<<<<<<
jpayne@68 7214 * return None
jpayne@68 7215 * if PyBytes_Check(s):
jpayne@68 7216 */
jpayne@68 7217 }
jpayne@68 7218
jpayne@68 7219 /* "pysam/libcutils.pyx":163
jpayne@68 7220 * if s is None:
jpayne@68 7221 * return None
jpayne@68 7222 * if PyBytes_Check(s): # <<<<<<<<<<<<<<
jpayne@68 7223 * return s.decode(encoding or TEXT_ENCODING, errors or ERROR_HANDLER)
jpayne@68 7224 * # assume unicode
jpayne@68 7225 */
jpayne@68 7226 __pyx_t_1 = PyBytes_Check(__pyx_v_s);
jpayne@68 7227 if (__pyx_t_1) {
jpayne@68 7228
jpayne@68 7229 /* "pysam/libcutils.pyx":164
jpayne@68 7230 * return None
jpayne@68 7231 * if PyBytes_Check(s):
jpayne@68 7232 * return s.decode(encoding or TEXT_ENCODING, errors or ERROR_HANDLER) # <<<<<<<<<<<<<<
jpayne@68 7233 * # assume unicode
jpayne@68 7234 * return s
jpayne@68 7235 */
jpayne@68 7236 __Pyx_XDECREF(__pyx_r);
jpayne@68 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@68 7238 __Pyx_GOTREF(__pyx_t_3);
jpayne@68 7239 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_encoding); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 164, __pyx_L1_error)
jpayne@68 7240 if (!__pyx_t_1) {
jpayne@68 7241 } else {
jpayne@68 7242 __Pyx_INCREF(__pyx_v_encoding);
jpayne@68 7243 __pyx_t_4 = __pyx_v_encoding;
jpayne@68 7244 goto __pyx_L5_bool_binop_done;
jpayne@68 7245 }
jpayne@68 7246 __Pyx_INCREF(__pyx_v_5pysam_9libcutils_TEXT_ENCODING);
jpayne@68 7247 __pyx_t_4 = __pyx_v_5pysam_9libcutils_TEXT_ENCODING;
jpayne@68 7248 __pyx_L5_bool_binop_done:;
jpayne@68 7249 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_errors); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 164, __pyx_L1_error)
jpayne@68 7250 if (!__pyx_t_1) {
jpayne@68 7251 } else {
jpayne@68 7252 __Pyx_INCREF(__pyx_v_errors);
jpayne@68 7253 __pyx_t_5 = __pyx_v_errors;
jpayne@68 7254 goto __pyx_L7_bool_binop_done;
jpayne@68 7255 }
jpayne@68 7256 __Pyx_INCREF(__pyx_v_5pysam_9libcutils_ERROR_HANDLER);
jpayne@68 7257 __pyx_t_5 = __pyx_v_5pysam_9libcutils_ERROR_HANDLER;
jpayne@68 7258 __pyx_L7_bool_binop_done:;
jpayne@68 7259 __pyx_t_6 = NULL;
jpayne@68 7260 __pyx_t_7 = 0;
jpayne@68 7261 #if CYTHON_UNPACK_METHODS
jpayne@68 7262 if (likely(PyMethod_Check(__pyx_t_3))) {
jpayne@68 7263 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
jpayne@68 7264 if (likely(__pyx_t_6)) {
jpayne@68 7265 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
jpayne@68 7266 __Pyx_INCREF(__pyx_t_6);
jpayne@68 7267 __Pyx_INCREF(function);
jpayne@68 7268 __Pyx_DECREF_SET(__pyx_t_3, function);
jpayne@68 7269 __pyx_t_7 = 1;
jpayne@68 7270 }
jpayne@68 7271 }
jpayne@68 7272 #endif
jpayne@68 7273 {
jpayne@68 7274 PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_t_4, __pyx_t_5};
jpayne@68 7275 __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_7, 2+__pyx_t_7);
jpayne@68 7276 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
jpayne@68 7277 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
jpayne@68 7278 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
jpayne@68 7279 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 164, __pyx_L1_error)
jpayne@68 7280 __Pyx_GOTREF(__pyx_t_2);
jpayne@68 7281 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@68 7282 }
jpayne@68 7283 __pyx_r = __pyx_t_2;
jpayne@68 7284 __pyx_t_2 = 0;
jpayne@68 7285 goto __pyx_L0;
jpayne@68 7286
jpayne@68 7287 /* "pysam/libcutils.pyx":163
jpayne@68 7288 * if s is None:
jpayne@68 7289 * return None
jpayne@68 7290 * if PyBytes_Check(s): # <<<<<<<<<<<<<<
jpayne@68 7291 * return s.decode(encoding or TEXT_ENCODING, errors or ERROR_HANDLER)
jpayne@68 7292 * # assume unicode
jpayne@68 7293 */
jpayne@68 7294 }
jpayne@68 7295
jpayne@68 7296 /* "pysam/libcutils.pyx":166
jpayne@68 7297 * return s.decode(encoding or TEXT_ENCODING, errors or ERROR_HANDLER)
jpayne@68 7298 * # assume unicode
jpayne@68 7299 * return s # <<<<<<<<<<<<<<
jpayne@68 7300 *
jpayne@68 7301 *
jpayne@68 7302 */
jpayne@68 7303 __Pyx_XDECREF(__pyx_r);
jpayne@68 7304 __Pyx_INCREF(__pyx_v_s);
jpayne@68 7305 __pyx_r = __pyx_v_s;
jpayne@68 7306 goto __pyx_L0;
jpayne@68 7307
jpayne@68 7308 /* "pysam/libcutils.pyx":158
jpayne@68 7309 *
jpayne@68 7310 *
jpayne@68 7311 * cdef force_str(object s, encoding=None, errors=None): # <<<<<<<<<<<<<<
jpayne@68 7312 * """Return s converted to str type of current Python
jpayne@68 7313 * (bytes in Py2, unicode in Py3)"""
jpayne@68 7314 */
jpayne@68 7315
jpayne@68 7316 /* function exit code */
jpayne@68 7317 __pyx_L1_error:;
jpayne@68 7318 __Pyx_XDECREF(__pyx_t_2);
jpayne@68 7319 __Pyx_XDECREF(__pyx_t_3);
jpayne@68 7320 __Pyx_XDECREF(__pyx_t_4);
jpayne@68 7321 __Pyx_XDECREF(__pyx_t_5);
jpayne@68 7322 __Pyx_XDECREF(__pyx_t_6);
jpayne@68 7323 __Pyx_AddTraceback("pysam.libcutils.force_str", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@68 7324 __pyx_r = 0;
jpayne@68 7325 __pyx_L0:;
jpayne@68 7326 __Pyx_XGIVEREF(__pyx_r);
jpayne@68 7327 __Pyx_RefNannyFinishContext();
jpayne@68 7328 return __pyx_r;
jpayne@68 7329 }
jpayne@68 7330
jpayne@68 7331 /* "pysam/libcutils.pyx":169
jpayne@68 7332 *
jpayne@68 7333 *
jpayne@68 7334 * cdef decode_bytes(bytes s, encoding=None, errors=None): # <<<<<<<<<<<<<<
jpayne@68 7335 * """Return s converted to current Python's str type,
jpayne@68 7336 * always decoding even in Python 2"""
jpayne@68 7337 */
jpayne@68 7338
jpayne@68 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@68 7340 PyObject *__pyx_v_encoding = ((PyObject *)Py_None);
jpayne@68 7341 PyObject *__pyx_v_errors = ((PyObject *)Py_None);
jpayne@68 7342 PyObject *__pyx_r = NULL;
jpayne@68 7343 __Pyx_RefNannyDeclarations
jpayne@68 7344 int __pyx_t_1;
jpayne@68 7345 PyObject *__pyx_t_2 = NULL;
jpayne@68 7346 PyObject *__pyx_t_3 = NULL;
jpayne@68 7347 PyObject *__pyx_t_4 = NULL;
jpayne@68 7348 PyObject *__pyx_t_5 = NULL;
jpayne@68 7349 PyObject *__pyx_t_6 = NULL;
jpayne@68 7350 unsigned int __pyx_t_7;
jpayne@68 7351 int __pyx_lineno = 0;
jpayne@68 7352 const char *__pyx_filename = NULL;
jpayne@68 7353 int __pyx_clineno = 0;
jpayne@68 7354 __Pyx_RefNannySetupContext("decode_bytes", 1);
jpayne@68 7355 if (__pyx_optional_args) {
jpayne@68 7356 if (__pyx_optional_args->__pyx_n > 0) {
jpayne@68 7357 __pyx_v_encoding = __pyx_optional_args->encoding;
jpayne@68 7358 if (__pyx_optional_args->__pyx_n > 1) {
jpayne@68 7359 __pyx_v_errors = __pyx_optional_args->errors;
jpayne@68 7360 }
jpayne@68 7361 }
jpayne@68 7362 }
jpayne@68 7363
jpayne@68 7364 /* "pysam/libcutils.pyx":172
jpayne@68 7365 * """Return s converted to current Python's str type,
jpayne@68 7366 * always decoding even in Python 2"""
jpayne@68 7367 * if s is None: # <<<<<<<<<<<<<<
jpayne@68 7368 * return None
jpayne@68 7369 * else:
jpayne@68 7370 */
jpayne@68 7371 __pyx_t_1 = (__pyx_v_s == ((PyObject*)Py_None));
jpayne@68 7372 if (__pyx_t_1) {
jpayne@68 7373
jpayne@68 7374 /* "pysam/libcutils.pyx":173
jpayne@68 7375 * always decoding even in Python 2"""
jpayne@68 7376 * if s is None:
jpayne@68 7377 * return None # <<<<<<<<<<<<<<
jpayne@68 7378 * else:
jpayne@68 7379 * return s.decode(encoding or TEXT_ENCODING, errors or ERROR_HANDLER)
jpayne@68 7380 */
jpayne@68 7381 __Pyx_XDECREF(__pyx_r);
jpayne@68 7382 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
jpayne@68 7383 goto __pyx_L0;
jpayne@68 7384
jpayne@68 7385 /* "pysam/libcutils.pyx":172
jpayne@68 7386 * """Return s converted to current Python's str type,
jpayne@68 7387 * always decoding even in Python 2"""
jpayne@68 7388 * if s is None: # <<<<<<<<<<<<<<
jpayne@68 7389 * return None
jpayne@68 7390 * else:
jpayne@68 7391 */
jpayne@68 7392 }
jpayne@68 7393
jpayne@68 7394 /* "pysam/libcutils.pyx":175
jpayne@68 7395 * return None
jpayne@68 7396 * else:
jpayne@68 7397 * return s.decode(encoding or TEXT_ENCODING, errors or ERROR_HANDLER) # <<<<<<<<<<<<<<
jpayne@68 7398 *
jpayne@68 7399 *
jpayne@68 7400 */
jpayne@68 7401 /*else*/ {
jpayne@68 7402 __Pyx_XDECREF(__pyx_r);
jpayne@68 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@68 7404 __Pyx_GOTREF(__pyx_t_3);
jpayne@68 7405 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_encoding); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 175, __pyx_L1_error)
jpayne@68 7406 if (!__pyx_t_1) {
jpayne@68 7407 } else {
jpayne@68 7408 __Pyx_INCREF(__pyx_v_encoding);
jpayne@68 7409 __pyx_t_4 = __pyx_v_encoding;
jpayne@68 7410 goto __pyx_L4_bool_binop_done;
jpayne@68 7411 }
jpayne@68 7412 __Pyx_INCREF(__pyx_v_5pysam_9libcutils_TEXT_ENCODING);
jpayne@68 7413 __pyx_t_4 = __pyx_v_5pysam_9libcutils_TEXT_ENCODING;
jpayne@68 7414 __pyx_L4_bool_binop_done:;
jpayne@68 7415 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_errors); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 175, __pyx_L1_error)
jpayne@68 7416 if (!__pyx_t_1) {
jpayne@68 7417 } else {
jpayne@68 7418 __Pyx_INCREF(__pyx_v_errors);
jpayne@68 7419 __pyx_t_5 = __pyx_v_errors;
jpayne@68 7420 goto __pyx_L6_bool_binop_done;
jpayne@68 7421 }
jpayne@68 7422 __Pyx_INCREF(__pyx_v_5pysam_9libcutils_ERROR_HANDLER);
jpayne@68 7423 __pyx_t_5 = __pyx_v_5pysam_9libcutils_ERROR_HANDLER;
jpayne@68 7424 __pyx_L6_bool_binop_done:;
jpayne@68 7425 __pyx_t_6 = NULL;
jpayne@68 7426 __pyx_t_7 = 0;
jpayne@68 7427 #if CYTHON_UNPACK_METHODS
jpayne@68 7428 if (likely(PyMethod_Check(__pyx_t_3))) {
jpayne@68 7429 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
jpayne@68 7430 if (likely(__pyx_t_6)) {
jpayne@68 7431 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
jpayne@68 7432 __Pyx_INCREF(__pyx_t_6);
jpayne@68 7433 __Pyx_INCREF(function);
jpayne@68 7434 __Pyx_DECREF_SET(__pyx_t_3, function);
jpayne@68 7435 __pyx_t_7 = 1;
jpayne@68 7436 }
jpayne@68 7437 }
jpayne@68 7438 #endif
jpayne@68 7439 {
jpayne@68 7440 PyObject *__pyx_callargs[3] = {__pyx_t_6, __pyx_t_4, __pyx_t_5};
jpayne@68 7441 __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_7, 2+__pyx_t_7);
jpayne@68 7442 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
jpayne@68 7443 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
jpayne@68 7444 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
jpayne@68 7445 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 175, __pyx_L1_error)
jpayne@68 7446 __Pyx_GOTREF(__pyx_t_2);
jpayne@68 7447 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@68 7448 }
jpayne@68 7449 __pyx_r = __pyx_t_2;
jpayne@68 7450 __pyx_t_2 = 0;
jpayne@68 7451 goto __pyx_L0;
jpayne@68 7452 }
jpayne@68 7453
jpayne@68 7454 /* "pysam/libcutils.pyx":169
jpayne@68 7455 *
jpayne@68 7456 *
jpayne@68 7457 * cdef decode_bytes(bytes s, encoding=None, errors=None): # <<<<<<<<<<<<<<
jpayne@68 7458 * """Return s converted to current Python's str type,
jpayne@68 7459 * always decoding even in Python 2"""
jpayne@68 7460 */
jpayne@68 7461
jpayne@68 7462 /* function exit code */
jpayne@68 7463 __pyx_L1_error:;
jpayne@68 7464 __Pyx_XDECREF(__pyx_t_2);
jpayne@68 7465 __Pyx_XDECREF(__pyx_t_3);
jpayne@68 7466 __Pyx_XDECREF(__pyx_t_4);
jpayne@68 7467 __Pyx_XDECREF(__pyx_t_5);
jpayne@68 7468 __Pyx_XDECREF(__pyx_t_6);
jpayne@68 7469 __Pyx_AddTraceback("pysam.libcutils.decode_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@68 7470 __pyx_r = 0;
jpayne@68 7471 __pyx_L0:;
jpayne@68 7472 __Pyx_XGIVEREF(__pyx_r);
jpayne@68 7473 __Pyx_RefNannyFinishContext();
jpayne@68 7474 return __pyx_r;
jpayne@68 7475 }
jpayne@68 7476
jpayne@68 7477 /* "pysam/libcutils.pyx":178
jpayne@68 7478 *
jpayne@68 7479 *
jpayne@68 7480 * cpdef parse_region(contig=None, # <<<<<<<<<<<<<<
jpayne@68 7481 * start=None,
jpayne@68 7482 * stop=None,
jpayne@68 7483 */
jpayne@68 7484
jpayne@68 7485 static PyObject *__pyx_pw_5pysam_9libcutils_13parse_region(PyObject *__pyx_self,
jpayne@68 7486 #if CYTHON_METH_FASTCALL
jpayne@68 7487 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
jpayne@68 7488 #else
jpayne@68 7489 PyObject *__pyx_args, PyObject *__pyx_kwds
jpayne@68 7490 #endif
jpayne@68 7491 ); /*proto*/
jpayne@68 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@68 7493 PyObject *__pyx_v_contig = ((PyObject *)Py_None);
jpayne@68 7494
jpayne@68 7495 /* "pysam/libcutils.pyx":179
jpayne@68 7496 *
jpayne@68 7497 * cpdef parse_region(contig=None,
jpayne@68 7498 * start=None, # <<<<<<<<<<<<<<
jpayne@68 7499 * stop=None,
jpayne@68 7500 * region=None,
jpayne@68 7501 */
jpayne@68 7502 PyObject *__pyx_v_start = ((PyObject *)Py_None);
jpayne@68 7503
jpayne@68 7504 /* "pysam/libcutils.pyx":180
jpayne@68 7505 * cpdef parse_region(contig=None,
jpayne@68 7506 * start=None,
jpayne@68 7507 * stop=None, # <<<<<<<<<<<<<<
jpayne@68 7508 * region=None,
jpayne@68 7509 * reference=None,
jpayne@68 7510 */
jpayne@68 7511 PyObject *__pyx_v_stop = ((PyObject *)Py_None);
jpayne@68 7512
jpayne@68 7513 /* "pysam/libcutils.pyx":181
jpayne@68 7514 * start=None,
jpayne@68 7515 * stop=None,
jpayne@68 7516 * region=None, # <<<<<<<<<<<<<<
jpayne@68 7517 * reference=None,
jpayne@68 7518 * end=None):
jpayne@68 7519 */
jpayne@68 7520 PyObject *__pyx_v_region = ((PyObject *)Py_None);
jpayne@68 7521
jpayne@68 7522 /* "pysam/libcutils.pyx":182
jpayne@68 7523 * stop=None,
jpayne@68 7524 * region=None,
jpayne@68 7525 * reference=None, # <<<<<<<<<<<<<<
jpayne@68 7526 * end=None):
jpayne@68 7527 * """parse alternative ways to specify a genomic region. A region can
jpayne@68 7528 */
jpayne@68 7529 PyObject *__pyx_v_reference = ((PyObject *)Py_None);
jpayne@68 7530
jpayne@68 7531 /* "pysam/libcutils.pyx":183
jpayne@68 7532 * region=None,
jpayne@68 7533 * reference=None,
jpayne@68 7534 * end=None): # <<<<<<<<<<<<<<
jpayne@68 7535 * """parse alternative ways to specify a genomic region. A region can
jpayne@68 7536 * either be specified by :term:`reference`, `start` and
jpayne@68 7537 */
jpayne@68 7538 PyObject *__pyx_v_end = ((PyObject *)Py_None);
jpayne@68 7539 int32_t __pyx_v_rstart;
jpayne@68 7540 int32_t __pyx_v_rstop;
jpayne@68 7541 PyObject *__pyx_v_coord = NULL;
jpayne@68 7542 PyObject *__pyx_v_parts = NULL;
jpayne@68 7543 PyObject *__pyx_r = NULL;
jpayne@68 7544 __Pyx_RefNannyDeclarations
jpayne@68 7545 int __pyx_t_1;
jpayne@68 7546 PyObject *__pyx_t_2 = NULL;
jpayne@68 7547 int __pyx_t_3;
jpayne@68 7548 PyObject *__pyx_t_4 = NULL;
jpayne@68 7549 PyObject *__pyx_t_5 = NULL;
jpayne@68 7550 PyObject *__pyx_t_6 = NULL;
jpayne@68 7551 int32_t __pyx_t_7;
jpayne@68 7552 int __pyx_t_8;
jpayne@68 7553 PyObject *__pyx_t_9 = NULL;
jpayne@68 7554 PyObject *__pyx_t_10 = NULL;
jpayne@68 7555 PyObject *__pyx_t_11 = NULL;
jpayne@68 7556 PyObject *__pyx_t_12 = NULL;
jpayne@68 7557 unsigned int __pyx_t_13;
jpayne@68 7558 PyObject *(*__pyx_t_14)(PyObject *);
jpayne@68 7559 Py_ssize_t __pyx_t_15;
jpayne@68 7560 int __pyx_lineno = 0;
jpayne@68 7561 const char *__pyx_filename = NULL;
jpayne@68 7562 int __pyx_clineno = 0;
jpayne@68 7563 __Pyx_RefNannySetupContext("parse_region", 0);
jpayne@68 7564 if (__pyx_optional_args) {
jpayne@68 7565 if (__pyx_optional_args->__pyx_n > 0) {
jpayne@68 7566 __pyx_v_contig = __pyx_optional_args->contig;
jpayne@68 7567 if (__pyx_optional_args->__pyx_n > 1) {
jpayne@68 7568 __pyx_v_start = __pyx_optional_args->start;
jpayne@68 7569 if (__pyx_optional_args->__pyx_n > 2) {
jpayne@68 7570 __pyx_v_stop = __pyx_optional_args->stop;
jpayne@68 7571 if (__pyx_optional_args->__pyx_n > 3) {
jpayne@68 7572 __pyx_v_region = __pyx_optional_args->region;
jpayne@68 7573 if (__pyx_optional_args->__pyx_n > 4) {
jpayne@68 7574 __pyx_v_reference = __pyx_optional_args->reference;
jpayne@68 7575 if (__pyx_optional_args->__pyx_n > 5) {
jpayne@68 7576 __pyx_v_end = __pyx_optional_args->end;
jpayne@68 7577 }
jpayne@68 7578 }
jpayne@68 7579 }
jpayne@68 7580 }
jpayne@68 7581 }
jpayne@68 7582 }
jpayne@68 7583 }
jpayne@68 7584 __Pyx_INCREF(__pyx_v_contig);
jpayne@68 7585 __Pyx_INCREF(__pyx_v_stop);
jpayne@68 7586
jpayne@68 7587 /* "pysam/libcutils.pyx":216
jpayne@68 7588 *
jpayne@68 7589 *
jpayne@68 7590 * if reference is not None: # <<<<<<<<<<<<<<
jpayne@68 7591 * if contig is not None:
jpayne@68 7592 * raise ValueError('contig and reference should not both be specified')
jpayne@68 7593 */
jpayne@68 7594 __pyx_t_1 = (__pyx_v_reference != Py_None);
jpayne@68 7595 if (__pyx_t_1) {
jpayne@68 7596
jpayne@68 7597 /* "pysam/libcutils.pyx":217
jpayne@68 7598 *
jpayne@68 7599 * if reference is not None:
jpayne@68 7600 * if contig is not None: # <<<<<<<<<<<<<<
jpayne@68 7601 * raise ValueError('contig and reference should not both be specified')
jpayne@68 7602 * contig = reference
jpayne@68 7603 */
jpayne@68 7604 __pyx_t_1 = (__pyx_v_contig != Py_None);
jpayne@68 7605 if (unlikely(__pyx_t_1)) {
jpayne@68 7606
jpayne@68 7607 /* "pysam/libcutils.pyx":218
jpayne@68 7608 * if reference is not None:
jpayne@68 7609 * if contig is not None:
jpayne@68 7610 * raise ValueError('contig and reference should not both be specified') # <<<<<<<<<<<<<<
jpayne@68 7611 * contig = reference
jpayne@68 7612 *
jpayne@68 7613 */
jpayne@68 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@68 7615 __Pyx_GOTREF(__pyx_t_2);
jpayne@68 7616 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
jpayne@68 7617 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@68 7618 __PYX_ERR(0, 218, __pyx_L1_error)
jpayne@68 7619
jpayne@68 7620 /* "pysam/libcutils.pyx":217
jpayne@68 7621 *
jpayne@68 7622 * if reference is not None:
jpayne@68 7623 * if contig is not None: # <<<<<<<<<<<<<<
jpayne@68 7624 * raise ValueError('contig and reference should not both be specified')
jpayne@68 7625 * contig = reference
jpayne@68 7626 */
jpayne@68 7627 }
jpayne@68 7628
jpayne@68 7629 /* "pysam/libcutils.pyx":219
jpayne@68 7630 * if contig is not None:
jpayne@68 7631 * raise ValueError('contig and reference should not both be specified')
jpayne@68 7632 * contig = reference # <<<<<<<<<<<<<<
jpayne@68 7633 *
jpayne@68 7634 * if contig is not None and region is not None:
jpayne@68 7635 */
jpayne@68 7636 __Pyx_INCREF(__pyx_v_reference);
jpayne@68 7637 __Pyx_DECREF_SET(__pyx_v_contig, __pyx_v_reference);
jpayne@68 7638
jpayne@68 7639 /* "pysam/libcutils.pyx":216
jpayne@68 7640 *
jpayne@68 7641 *
jpayne@68 7642 * if reference is not None: # <<<<<<<<<<<<<<
jpayne@68 7643 * if contig is not None:
jpayne@68 7644 * raise ValueError('contig and reference should not both be specified')
jpayne@68 7645 */
jpayne@68 7646 }
jpayne@68 7647
jpayne@68 7648 /* "pysam/libcutils.pyx":221
jpayne@68 7649 * contig = reference
jpayne@68 7650 *
jpayne@68 7651 * if contig is not None and region is not None: # <<<<<<<<<<<<<<
jpayne@68 7652 * raise ValueError('contig/reference and region should not both be specified')
jpayne@68 7653 *
jpayne@68 7654 */
jpayne@68 7655 __pyx_t_3 = (__pyx_v_contig != Py_None);
jpayne@68 7656 if (__pyx_t_3) {
jpayne@68 7657 } else {
jpayne@68 7658 __pyx_t_1 = __pyx_t_3;
jpayne@68 7659 goto __pyx_L6_bool_binop_done;
jpayne@68 7660 }
jpayne@68 7661 __pyx_t_3 = (__pyx_v_region != Py_None);
jpayne@68 7662 __pyx_t_1 = __pyx_t_3;
jpayne@68 7663 __pyx_L6_bool_binop_done:;
jpayne@68 7664 if (unlikely(__pyx_t_1)) {
jpayne@68 7665
jpayne@68 7666 /* "pysam/libcutils.pyx":222
jpayne@68 7667 *
jpayne@68 7668 * if contig is not None and region is not None:
jpayne@68 7669 * raise ValueError('contig/reference and region should not both be specified') # <<<<<<<<<<<<<<
jpayne@68 7670 *
jpayne@68 7671 * if end is not None:
jpayne@68 7672 */
jpayne@68 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@68 7674 __Pyx_GOTREF(__pyx_t_2);
jpayne@68 7675 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
jpayne@68 7676 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@68 7677 __PYX_ERR(0, 222, __pyx_L1_error)
jpayne@68 7678
jpayne@68 7679 /* "pysam/libcutils.pyx":221
jpayne@68 7680 * contig = reference
jpayne@68 7681 *
jpayne@68 7682 * if contig is not None and region is not None: # <<<<<<<<<<<<<<
jpayne@68 7683 * raise ValueError('contig/reference and region should not both be specified')
jpayne@68 7684 *
jpayne@68 7685 */
jpayne@68 7686 }
jpayne@68 7687
jpayne@68 7688 /* "pysam/libcutils.pyx":224
jpayne@68 7689 * raise ValueError('contig/reference and region should not both be specified')
jpayne@68 7690 *
jpayne@68 7691 * if end is not None: # <<<<<<<<<<<<<<
jpayne@68 7692 * if stop is not None:
jpayne@68 7693 * raise ValueError('stop and end should not both be specified')
jpayne@68 7694 */
jpayne@68 7695 __pyx_t_1 = (__pyx_v_end != Py_None);
jpayne@68 7696 if (__pyx_t_1) {
jpayne@68 7697
jpayne@68 7698 /* "pysam/libcutils.pyx":225
jpayne@68 7699 *
jpayne@68 7700 * if end is not None:
jpayne@68 7701 * if stop is not None: # <<<<<<<<<<<<<<
jpayne@68 7702 * raise ValueError('stop and end should not both be specified')
jpayne@68 7703 * stop = end
jpayne@68 7704 */
jpayne@68 7705 __pyx_t_1 = (__pyx_v_stop != Py_None);
jpayne@68 7706 if (unlikely(__pyx_t_1)) {
jpayne@68 7707
jpayne@68 7708 /* "pysam/libcutils.pyx":226
jpayne@68 7709 * if end is not None:
jpayne@68 7710 * if stop is not None:
jpayne@68 7711 * raise ValueError('stop and end should not both be specified') # <<<<<<<<<<<<<<
jpayne@68 7712 * stop = end
jpayne@68 7713 *
jpayne@68 7714 */
jpayne@68 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@68 7716 __Pyx_GOTREF(__pyx_t_2);
jpayne@68 7717 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
jpayne@68 7718 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@68 7719 __PYX_ERR(0, 226, __pyx_L1_error)
jpayne@68 7720
jpayne@68 7721 /* "pysam/libcutils.pyx":225
jpayne@68 7722 *
jpayne@68 7723 * if end is not None:
jpayne@68 7724 * if stop is not None: # <<<<<<<<<<<<<<
jpayne@68 7725 * raise ValueError('stop and end should not both be specified')
jpayne@68 7726 * stop = end
jpayne@68 7727 */
jpayne@68 7728 }
jpayne@68 7729
jpayne@68 7730 /* "pysam/libcutils.pyx":227
jpayne@68 7731 * if stop is not None:
jpayne@68 7732 * raise ValueError('stop and end should not both be specified')
jpayne@68 7733 * stop = end # <<<<<<<<<<<<<<
jpayne@68 7734 *
jpayne@68 7735 * if contig is None and region is None:
jpayne@68 7736 */
jpayne@68 7737 __Pyx_INCREF(__pyx_v_end);
jpayne@68 7738 __Pyx_DECREF_SET(__pyx_v_stop, __pyx_v_end);
jpayne@68 7739
jpayne@68 7740 /* "pysam/libcutils.pyx":224
jpayne@68 7741 * raise ValueError('contig/reference and region should not both be specified')
jpayne@68 7742 *
jpayne@68 7743 * if end is not None: # <<<<<<<<<<<<<<
jpayne@68 7744 * if stop is not None:
jpayne@68 7745 * raise ValueError('stop and end should not both be specified')
jpayne@68 7746 */
jpayne@68 7747 }
jpayne@68 7748
jpayne@68 7749 /* "pysam/libcutils.pyx":229
jpayne@68 7750 * stop = end
jpayne@68 7751 *
jpayne@68 7752 * if contig is None and region is None: # <<<<<<<<<<<<<<
jpayne@68 7753 * raise ValueError("neither contig nor region are given")
jpayne@68 7754 *
jpayne@68 7755 */
jpayne@68 7756 __pyx_t_3 = (__pyx_v_contig == Py_None);
jpayne@68 7757 if (__pyx_t_3) {
jpayne@68 7758 } else {
jpayne@68 7759 __pyx_t_1 = __pyx_t_3;
jpayne@68 7760 goto __pyx_L11_bool_binop_done;
jpayne@68 7761 }
jpayne@68 7762 __pyx_t_3 = (__pyx_v_region == Py_None);
jpayne@68 7763 __pyx_t_1 = __pyx_t_3;
jpayne@68 7764 __pyx_L11_bool_binop_done:;
jpayne@68 7765 if (unlikely(__pyx_t_1)) {
jpayne@68 7766
jpayne@68 7767 /* "pysam/libcutils.pyx":230
jpayne@68 7768 *
jpayne@68 7769 * if contig is None and region is None:
jpayne@68 7770 * raise ValueError("neither contig nor region are given") # <<<<<<<<<<<<<<
jpayne@68 7771 *
jpayne@68 7772 * rstart = 0
jpayne@68 7773 */
jpayne@68 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@68 7775 __Pyx_GOTREF(__pyx_t_2);
jpayne@68 7776 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
jpayne@68 7777 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@68 7778 __PYX_ERR(0, 230, __pyx_L1_error)
jpayne@68 7779
jpayne@68 7780 /* "pysam/libcutils.pyx":229
jpayne@68 7781 * stop = end
jpayne@68 7782 *
jpayne@68 7783 * if contig is None and region is None: # <<<<<<<<<<<<<<
jpayne@68 7784 * raise ValueError("neither contig nor region are given")
jpayne@68 7785 *
jpayne@68 7786 */
jpayne@68 7787 }
jpayne@68 7788
jpayne@68 7789 /* "pysam/libcutils.pyx":232
jpayne@68 7790 * raise ValueError("neither contig nor region are given")
jpayne@68 7791 *
jpayne@68 7792 * rstart = 0 # <<<<<<<<<<<<<<
jpayne@68 7793 * rstop = MAX_POS
jpayne@68 7794 * if start is not None:
jpayne@68 7795 */
jpayne@68 7796 __pyx_v_rstart = 0;
jpayne@68 7797
jpayne@68 7798 /* "pysam/libcutils.pyx":233
jpayne@68 7799 *
jpayne@68 7800 * rstart = 0
jpayne@68 7801 * rstop = MAX_POS # <<<<<<<<<<<<<<
jpayne@68 7802 * if start is not None:
jpayne@68 7803 * try:
jpayne@68 7804 */
jpayne@68 7805 __pyx_v_rstop = __pyx_v_5pysam_9libcutils_MAX_POS;
jpayne@68 7806
jpayne@68 7807 /* "pysam/libcutils.pyx":234
jpayne@68 7808 * rstart = 0
jpayne@68 7809 * rstop = MAX_POS
jpayne@68 7810 * if start is not None: # <<<<<<<<<<<<<<
jpayne@68 7811 * try:
jpayne@68 7812 * rstart = start
jpayne@68 7813 */
jpayne@68 7814 __pyx_t_1 = (__pyx_v_start != Py_None);
jpayne@68 7815 if (__pyx_t_1) {
jpayne@68 7816
jpayne@68 7817 /* "pysam/libcutils.pyx":235
jpayne@68 7818 * rstop = MAX_POS
jpayne@68 7819 * if start is not None:
jpayne@68 7820 * try: # <<<<<<<<<<<<<<
jpayne@68 7821 * rstart = start
jpayne@68 7822 * except OverflowError:
jpayne@68 7823 */
jpayne@68 7824 {
jpayne@68 7825 __Pyx_PyThreadState_declare
jpayne@68 7826 __Pyx_PyThreadState_assign
jpayne@68 7827 __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
jpayne@68 7828 __Pyx_XGOTREF(__pyx_t_4);
jpayne@68 7829 __Pyx_XGOTREF(__pyx_t_5);
jpayne@68 7830 __Pyx_XGOTREF(__pyx_t_6);
jpayne@68 7831 /*try:*/ {
jpayne@68 7832
jpayne@68 7833 /* "pysam/libcutils.pyx":236
jpayne@68 7834 * if start is not None:
jpayne@68 7835 * try:
jpayne@68 7836 * rstart = start # <<<<<<<<<<<<<<
jpayne@68 7837 * except OverflowError:
jpayne@68 7838 * raise ValueError('start out of range (%i)' % start)
jpayne@68 7839 */
jpayne@68 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@68 7841 __pyx_v_rstart = __pyx_t_7;
jpayne@68 7842
jpayne@68 7843 /* "pysam/libcutils.pyx":235
jpayne@68 7844 * rstop = MAX_POS
jpayne@68 7845 * if start is not None:
jpayne@68 7846 * try: # <<<<<<<<<<<<<<
jpayne@68 7847 * rstart = start
jpayne@68 7848 * except OverflowError:
jpayne@68 7849 */
jpayne@68 7850 }
jpayne@68 7851 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
jpayne@68 7852 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
jpayne@68 7853 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
jpayne@68 7854 goto __pyx_L19_try_end;
jpayne@68 7855 __pyx_L14_error:;
jpayne@68 7856 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@68 7857
jpayne@68 7858 /* "pysam/libcutils.pyx":237
jpayne@68 7859 * try:
jpayne@68 7860 * rstart = start
jpayne@68 7861 * except OverflowError: # <<<<<<<<<<<<<<
jpayne@68 7862 * raise ValueError('start out of range (%i)' % start)
jpayne@68 7863 *
jpayne@68 7864 */
jpayne@68 7865 __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_OverflowError);
jpayne@68 7866 if (__pyx_t_8) {
jpayne@68 7867 __Pyx_AddTraceback("pysam.libcutils.parse_region", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@68 7868 if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_9, &__pyx_t_10) < 0) __PYX_ERR(0, 237, __pyx_L16_except_error)
jpayne@68 7869 __Pyx_XGOTREF(__pyx_t_2);
jpayne@68 7870 __Pyx_XGOTREF(__pyx_t_9);
jpayne@68 7871 __Pyx_XGOTREF(__pyx_t_10);
jpayne@68 7872
jpayne@68 7873 /* "pysam/libcutils.pyx":238
jpayne@68 7874 * rstart = start
jpayne@68 7875 * except OverflowError:
jpayne@68 7876 * raise ValueError('start out of range (%i)' % start) # <<<<<<<<<<<<<<
jpayne@68 7877 *
jpayne@68 7878 * if stop is not None:
jpayne@68 7879 */
jpayne@68 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@68 7881 __Pyx_GOTREF(__pyx_t_11);
jpayne@68 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@68 7883 __Pyx_GOTREF(__pyx_t_12);
jpayne@68 7884 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
jpayne@68 7885 __Pyx_Raise(__pyx_t_12, 0, 0, 0);
jpayne@68 7886 __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
jpayne@68 7887 __PYX_ERR(0, 238, __pyx_L16_except_error)
jpayne@68 7888 }
jpayne@68 7889 goto __pyx_L16_except_error;
jpayne@68 7890
jpayne@68 7891 /* "pysam/libcutils.pyx":235
jpayne@68 7892 * rstop = MAX_POS
jpayne@68 7893 * if start is not None:
jpayne@68 7894 * try: # <<<<<<<<<<<<<<
jpayne@68 7895 * rstart = start
jpayne@68 7896 * except OverflowError:
jpayne@68 7897 */
jpayne@68 7898 __pyx_L16_except_error:;
jpayne@68 7899 __Pyx_XGIVEREF(__pyx_t_4);
jpayne@68 7900 __Pyx_XGIVEREF(__pyx_t_5);
jpayne@68 7901 __Pyx_XGIVEREF(__pyx_t_6);
jpayne@68 7902 __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
jpayne@68 7903 goto __pyx_L1_error;
jpayne@68 7904 __pyx_L19_try_end:;
jpayne@68 7905 }
jpayne@68 7906
jpayne@68 7907 /* "pysam/libcutils.pyx":234
jpayne@68 7908 * rstart = 0
jpayne@68 7909 * rstop = MAX_POS
jpayne@68 7910 * if start is not None: # <<<<<<<<<<<<<<
jpayne@68 7911 * try:
jpayne@68 7912 * rstart = start
jpayne@68 7913 */
jpayne@68 7914 }
jpayne@68 7915
jpayne@68 7916 /* "pysam/libcutils.pyx":240
jpayne@68 7917 * raise ValueError('start out of range (%i)' % start)
jpayne@68 7918 *
jpayne@68 7919 * if stop is not None: # <<<<<<<<<<<<<<
jpayne@68 7920 * try:
jpayne@68 7921 * rstop = stop
jpayne@68 7922 */
jpayne@68 7923 __pyx_t_1 = (__pyx_v_stop != Py_None);
jpayne@68 7924 if (__pyx_t_1) {
jpayne@68 7925
jpayne@68 7926 /* "pysam/libcutils.pyx":241
jpayne@68 7927 *
jpayne@68 7928 * if stop is not None:
jpayne@68 7929 * try: # <<<<<<<<<<<<<<
jpayne@68 7930 * rstop = stop
jpayne@68 7931 * except OverflowError:
jpayne@68 7932 */
jpayne@68 7933 {
jpayne@68 7934 __Pyx_PyThreadState_declare
jpayne@68 7935 __Pyx_PyThreadState_assign
jpayne@68 7936 __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4);
jpayne@68 7937 __Pyx_XGOTREF(__pyx_t_6);
jpayne@68 7938 __Pyx_XGOTREF(__pyx_t_5);
jpayne@68 7939 __Pyx_XGOTREF(__pyx_t_4);
jpayne@68 7940 /*try:*/ {
jpayne@68 7941
jpayne@68 7942 /* "pysam/libcutils.pyx":242
jpayne@68 7943 * if stop is not None:
jpayne@68 7944 * try:
jpayne@68 7945 * rstop = stop # <<<<<<<<<<<<<<
jpayne@68 7946 * except OverflowError:
jpayne@68 7947 * raise ValueError('stop out of range (%i)' % stop)
jpayne@68 7948 */
jpayne@68 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@68 7950 __pyx_v_rstop = __pyx_t_7;
jpayne@68 7951
jpayne@68 7952 /* "pysam/libcutils.pyx":241
jpayne@68 7953 *
jpayne@68 7954 * if stop is not None:
jpayne@68 7955 * try: # <<<<<<<<<<<<<<
jpayne@68 7956 * rstop = stop
jpayne@68 7957 * except OverflowError:
jpayne@68 7958 */
jpayne@68 7959 }
jpayne@68 7960 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
jpayne@68 7961 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
jpayne@68 7962 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
jpayne@68 7963 goto __pyx_L28_try_end;
jpayne@68 7964 __pyx_L23_error:;
jpayne@68 7965 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
jpayne@68 7966 __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
jpayne@68 7967 __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
jpayne@68 7968 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@68 7969 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
jpayne@68 7970
jpayne@68 7971 /* "pysam/libcutils.pyx":243
jpayne@68 7972 * try:
jpayne@68 7973 * rstop = stop
jpayne@68 7974 * except OverflowError: # <<<<<<<<<<<<<<
jpayne@68 7975 * raise ValueError('stop out of range (%i)' % stop)
jpayne@68 7976 *
jpayne@68 7977 */
jpayne@68 7978 __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_OverflowError);
jpayne@68 7979 if (__pyx_t_8) {
jpayne@68 7980 __Pyx_AddTraceback("pysam.libcutils.parse_region", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@68 7981 if (__Pyx_GetException(&__pyx_t_10, &__pyx_t_9, &__pyx_t_2) < 0) __PYX_ERR(0, 243, __pyx_L25_except_error)
jpayne@68 7982 __Pyx_XGOTREF(__pyx_t_10);
jpayne@68 7983 __Pyx_XGOTREF(__pyx_t_9);
jpayne@68 7984 __Pyx_XGOTREF(__pyx_t_2);
jpayne@68 7985
jpayne@68 7986 /* "pysam/libcutils.pyx":244
jpayne@68 7987 * rstop = stop
jpayne@68 7988 * except OverflowError:
jpayne@68 7989 * raise ValueError('stop out of range (%i)' % stop) # <<<<<<<<<<<<<<
jpayne@68 7990 *
jpayne@68 7991 * if region:
jpayne@68 7992 */
jpayne@68 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@68 7994 __Pyx_GOTREF(__pyx_t_12);
jpayne@68 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@68 7996 __Pyx_GOTREF(__pyx_t_11);
jpayne@68 7997 __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
jpayne@68 7998 __Pyx_Raise(__pyx_t_11, 0, 0, 0);
jpayne@68 7999 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
jpayne@68 8000 __PYX_ERR(0, 244, __pyx_L25_except_error)
jpayne@68 8001 }
jpayne@68 8002 goto __pyx_L25_except_error;
jpayne@68 8003
jpayne@68 8004 /* "pysam/libcutils.pyx":241
jpayne@68 8005 *
jpayne@68 8006 * if stop is not None:
jpayne@68 8007 * try: # <<<<<<<<<<<<<<
jpayne@68 8008 * rstop = stop
jpayne@68 8009 * except OverflowError:
jpayne@68 8010 */
jpayne@68 8011 __pyx_L25_except_error:;
jpayne@68 8012 __Pyx_XGIVEREF(__pyx_t_6);
jpayne@68 8013 __Pyx_XGIVEREF(__pyx_t_5);
jpayne@68 8014 __Pyx_XGIVEREF(__pyx_t_4);
jpayne@68 8015 __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_5, __pyx_t_4);
jpayne@68 8016 goto __pyx_L1_error;
jpayne@68 8017 __pyx_L28_try_end:;
jpayne@68 8018 }
jpayne@68 8019
jpayne@68 8020 /* "pysam/libcutils.pyx":240
jpayne@68 8021 * raise ValueError('start out of range (%i)' % start)
jpayne@68 8022 *
jpayne@68 8023 * if stop is not None: # <<<<<<<<<<<<<<
jpayne@68 8024 * try:
jpayne@68 8025 * rstop = stop
jpayne@68 8026 */
jpayne@68 8027 }
jpayne@68 8028
jpayne@68 8029 /* "pysam/libcutils.pyx":246
jpayne@68 8030 * raise ValueError('stop out of range (%i)' % stop)
jpayne@68 8031 *
jpayne@68 8032 * if region: # <<<<<<<<<<<<<<
jpayne@68 8033 * if ":" in region:
jpayne@68 8034 * contig, coord = region.split(":")
jpayne@68 8035 */
jpayne@68 8036 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_region); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 246, __pyx_L1_error)
jpayne@68 8037 if (__pyx_t_1) {
jpayne@68 8038
jpayne@68 8039 /* "pysam/libcutils.pyx":247
jpayne@68 8040 *
jpayne@68 8041 * if region:
jpayne@68 8042 * if ":" in region: # <<<<<<<<<<<<<<
jpayne@68 8043 * contig, coord = region.split(":")
jpayne@68 8044 * parts = coord.split("-")
jpayne@68 8045 */
jpayne@68 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@68 8047 if (__pyx_t_1) {
jpayne@68 8048
jpayne@68 8049 /* "pysam/libcutils.pyx":248
jpayne@68 8050 * if region:
jpayne@68 8051 * if ":" in region:
jpayne@68 8052 * contig, coord = region.split(":") # <<<<<<<<<<<<<<
jpayne@68 8053 * parts = coord.split("-")
jpayne@68 8054 * rstart = int(parts[0]) - 1
jpayne@68 8055 */
jpayne@68 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@68 8057 __Pyx_GOTREF(__pyx_t_9);
jpayne@68 8058 __pyx_t_10 = NULL;
jpayne@68 8059 __pyx_t_13 = 0;
jpayne@68 8060 #if CYTHON_UNPACK_METHODS
jpayne@68 8061 if (likely(PyMethod_Check(__pyx_t_9))) {
jpayne@68 8062 __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9);
jpayne@68 8063 if (likely(__pyx_t_10)) {
jpayne@68 8064 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
jpayne@68 8065 __Pyx_INCREF(__pyx_t_10);
jpayne@68 8066 __Pyx_INCREF(function);
jpayne@68 8067 __Pyx_DECREF_SET(__pyx_t_9, function);
jpayne@68 8068 __pyx_t_13 = 1;
jpayne@68 8069 }
jpayne@68 8070 }
jpayne@68 8071 #endif
jpayne@68 8072 {
jpayne@68 8073 PyObject *__pyx_callargs[2] = {__pyx_t_10, __pyx_kp_u__7};
jpayne@68 8074 __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_9, __pyx_callargs+1-__pyx_t_13, 1+__pyx_t_13);
jpayne@68 8075 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
jpayne@68 8076 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 248, __pyx_L1_error)
jpayne@68 8077 __Pyx_GOTREF(__pyx_t_2);
jpayne@68 8078 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
jpayne@68 8079 }
jpayne@68 8080 if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
jpayne@68 8081 PyObject* sequence = __pyx_t_2;
jpayne@68 8082 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
jpayne@68 8083 if (unlikely(size != 2)) {
jpayne@68 8084 if (size > 2) __Pyx_RaiseTooManyValuesError(2);
jpayne@68 8085 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
jpayne@68 8086 __PYX_ERR(0, 248, __pyx_L1_error)
jpayne@68 8087 }
jpayne@68 8088 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
jpayne@68 8089 if (likely(PyTuple_CheckExact(sequence))) {
jpayne@68 8090 __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0);
jpayne@68 8091 __pyx_t_10 = PyTuple_GET_ITEM(sequence, 1);
jpayne@68 8092 } else {
jpayne@68 8093 __pyx_t_9 = PyList_GET_ITEM(sequence, 0);
jpayne@68 8094 __pyx_t_10 = PyList_GET_ITEM(sequence, 1);
jpayne@68 8095 }
jpayne@68 8096 __Pyx_INCREF(__pyx_t_9);
jpayne@68 8097 __Pyx_INCREF(__pyx_t_10);
jpayne@68 8098 #else
jpayne@68 8099 __pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 248, __pyx_L1_error)
jpayne@68 8100 __Pyx_GOTREF(__pyx_t_9);
jpayne@68 8101 __pyx_t_10 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 248, __pyx_L1_error)
jpayne@68 8102 __Pyx_GOTREF(__pyx_t_10);
jpayne@68 8103 #endif
jpayne@68 8104 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@68 8105 } else {
jpayne@68 8106 Py_ssize_t index = -1;
jpayne@68 8107 __pyx_t_11 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 248, __pyx_L1_error)
jpayne@68 8108 __Pyx_GOTREF(__pyx_t_11);
jpayne@68 8109 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@68 8110 __pyx_t_14 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_11);
jpayne@68 8111 index = 0; __pyx_t_9 = __pyx_t_14(__pyx_t_11); if (unlikely(!__pyx_t_9)) goto __pyx_L33_unpacking_failed;
jpayne@68 8112 __Pyx_GOTREF(__pyx_t_9);
jpayne@68 8113 index = 1; __pyx_t_10 = __pyx_t_14(__pyx_t_11); if (unlikely(!__pyx_t_10)) goto __pyx_L33_unpacking_failed;
jpayne@68 8114 __Pyx_GOTREF(__pyx_t_10);
jpayne@68 8115 if (__Pyx_IternextUnpackEndCheck(__pyx_t_14(__pyx_t_11), 2) < 0) __PYX_ERR(0, 248, __pyx_L1_error)
jpayne@68 8116 __pyx_t_14 = NULL;
jpayne@68 8117 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
jpayne@68 8118 goto __pyx_L34_unpacking_done;
jpayne@68 8119 __pyx_L33_unpacking_failed:;
jpayne@68 8120 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
jpayne@68 8121 __pyx_t_14 = NULL;
jpayne@68 8122 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
jpayne@68 8123 __PYX_ERR(0, 248, __pyx_L1_error)
jpayne@68 8124 __pyx_L34_unpacking_done:;
jpayne@68 8125 }
jpayne@68 8126 __Pyx_DECREF_SET(__pyx_v_contig, __pyx_t_9);
jpayne@68 8127 __pyx_t_9 = 0;
jpayne@68 8128 __pyx_v_coord = __pyx_t_10;
jpayne@68 8129 __pyx_t_10 = 0;
jpayne@68 8130
jpayne@68 8131 /* "pysam/libcutils.pyx":249
jpayne@68 8132 * if ":" in region:
jpayne@68 8133 * contig, coord = region.split(":")
jpayne@68 8134 * parts = coord.split("-") # <<<<<<<<<<<<<<
jpayne@68 8135 * rstart = int(parts[0]) - 1
jpayne@68 8136 * if len(parts) >= 1:
jpayne@68 8137 */
jpayne@68 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@68 8139 __Pyx_GOTREF(__pyx_t_10);
jpayne@68 8140 __pyx_t_9 = NULL;
jpayne@68 8141 __pyx_t_13 = 0;
jpayne@68 8142 #if CYTHON_UNPACK_METHODS
jpayne@68 8143 if (likely(PyMethod_Check(__pyx_t_10))) {
jpayne@68 8144 __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_10);
jpayne@68 8145 if (likely(__pyx_t_9)) {
jpayne@68 8146 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
jpayne@68 8147 __Pyx_INCREF(__pyx_t_9);
jpayne@68 8148 __Pyx_INCREF(function);
jpayne@68 8149 __Pyx_DECREF_SET(__pyx_t_10, function);
jpayne@68 8150 __pyx_t_13 = 1;
jpayne@68 8151 }
jpayne@68 8152 }
jpayne@68 8153 #endif
jpayne@68 8154 {
jpayne@68 8155 PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_kp_u__8};
jpayne@68 8156 __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_10, __pyx_callargs+1-__pyx_t_13, 1+__pyx_t_13);
jpayne@68 8157 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
jpayne@68 8158 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 249, __pyx_L1_error)
jpayne@68 8159 __Pyx_GOTREF(__pyx_t_2);
jpayne@68 8160 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
jpayne@68 8161 }
jpayne@68 8162 __pyx_v_parts = __pyx_t_2;
jpayne@68 8163 __pyx_t_2 = 0;
jpayne@68 8164
jpayne@68 8165 /* "pysam/libcutils.pyx":250
jpayne@68 8166 * contig, coord = region.split(":")
jpayne@68 8167 * parts = coord.split("-")
jpayne@68 8168 * rstart = int(parts[0]) - 1 # <<<<<<<<<<<<<<
jpayne@68 8169 * if len(parts) >= 1:
jpayne@68 8170 * rstop = int(parts[1])
jpayne@68 8171 */
jpayne@68 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@68 8173 __Pyx_GOTREF(__pyx_t_2);
jpayne@68 8174 __pyx_t_10 = __Pyx_PyNumber_Int(__pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 250, __pyx_L1_error)
jpayne@68 8175 __Pyx_GOTREF(__pyx_t_10);
jpayne@68 8176 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@68 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@68 8178 __Pyx_GOTREF(__pyx_t_2);
jpayne@68 8179 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
jpayne@68 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@68 8181 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@68 8182 __pyx_v_rstart = __pyx_t_7;
jpayne@68 8183
jpayne@68 8184 /* "pysam/libcutils.pyx":251
jpayne@68 8185 * parts = coord.split("-")
jpayne@68 8186 * rstart = int(parts[0]) - 1
jpayne@68 8187 * if len(parts) >= 1: # <<<<<<<<<<<<<<
jpayne@68 8188 * rstop = int(parts[1])
jpayne@68 8189 * else:
jpayne@68 8190 */
jpayne@68 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@68 8192 __pyx_t_1 = (__pyx_t_15 >= 1);
jpayne@68 8193 if (__pyx_t_1) {
jpayne@68 8194
jpayne@68 8195 /* "pysam/libcutils.pyx":252
jpayne@68 8196 * rstart = int(parts[0]) - 1
jpayne@68 8197 * if len(parts) >= 1:
jpayne@68 8198 * rstop = int(parts[1]) # <<<<<<<<<<<<<<
jpayne@68 8199 * else:
jpayne@68 8200 * contig = region
jpayne@68 8201 */
jpayne@68 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@68 8203 __Pyx_GOTREF(__pyx_t_2);
jpayne@68 8204 __pyx_t_10 = __Pyx_PyNumber_Int(__pyx_t_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 252, __pyx_L1_error)
jpayne@68 8205 __Pyx_GOTREF(__pyx_t_10);
jpayne@68 8206 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@68 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@68 8208 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
jpayne@68 8209 __pyx_v_rstop = __pyx_t_7;
jpayne@68 8210
jpayne@68 8211 /* "pysam/libcutils.pyx":251
jpayne@68 8212 * parts = coord.split("-")
jpayne@68 8213 * rstart = int(parts[0]) - 1
jpayne@68 8214 * if len(parts) >= 1: # <<<<<<<<<<<<<<
jpayne@68 8215 * rstop = int(parts[1])
jpayne@68 8216 * else:
jpayne@68 8217 */
jpayne@68 8218 }
jpayne@68 8219
jpayne@68 8220 /* "pysam/libcutils.pyx":247
jpayne@68 8221 *
jpayne@68 8222 * if region:
jpayne@68 8223 * if ":" in region: # <<<<<<<<<<<<<<
jpayne@68 8224 * contig, coord = region.split(":")
jpayne@68 8225 * parts = coord.split("-")
jpayne@68 8226 */
jpayne@68 8227 goto __pyx_L32;
jpayne@68 8228 }
jpayne@68 8229
jpayne@68 8230 /* "pysam/libcutils.pyx":254
jpayne@68 8231 * rstop = int(parts[1])
jpayne@68 8232 * else:
jpayne@68 8233 * contig = region # <<<<<<<<<<<<<<
jpayne@68 8234 *
jpayne@68 8235 * if rstart > rstop:
jpayne@68 8236 */
jpayne@68 8237 /*else*/ {
jpayne@68 8238 __Pyx_INCREF(__pyx_v_region);
jpayne@68 8239 __Pyx_DECREF_SET(__pyx_v_contig, __pyx_v_region);
jpayne@68 8240 }
jpayne@68 8241 __pyx_L32:;
jpayne@68 8242
jpayne@68 8243 /* "pysam/libcutils.pyx":246
jpayne@68 8244 * raise ValueError('stop out of range (%i)' % stop)
jpayne@68 8245 *
jpayne@68 8246 * if region: # <<<<<<<<<<<<<<
jpayne@68 8247 * if ":" in region:
jpayne@68 8248 * contig, coord = region.split(":")
jpayne@68 8249 */
jpayne@68 8250 }
jpayne@68 8251
jpayne@68 8252 /* "pysam/libcutils.pyx":256
jpayne@68 8253 * contig = region
jpayne@68 8254 *
jpayne@68 8255 * if rstart > rstop: # <<<<<<<<<<<<<<
jpayne@68 8256 * raise ValueError('invalid coordinates: start (%i) > stop (%i)' % (rstart, rstop))
jpayne@68 8257 * if not 0 <= rstart < MAX_POS:
jpayne@68 8258 */
jpayne@68 8259 __pyx_t_1 = (__pyx_v_rstart > __pyx_v_rstop);
jpayne@68 8260 if (unlikely(__pyx_t_1)) {
jpayne@68 8261
jpayne@68 8262 /* "pysam/libcutils.pyx":257
jpayne@68 8263 *
jpayne@68 8264 * if rstart > rstop:
jpayne@68 8265 * raise ValueError('invalid coordinates: start (%i) > stop (%i)' % (rstart, rstop)) # <<<<<<<<<<<<<<
jpayne@68 8266 * if not 0 <= rstart < MAX_POS:
jpayne@68 8267 * raise ValueError('start out of range (%i)' % rstart)
jpayne@68 8268 */
jpayne@68 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@68 8270 __Pyx_GOTREF(__pyx_t_10);
jpayne@68 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@68 8272 __Pyx_GOTREF(__pyx_t_2);
jpayne@68 8273 __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 257, __pyx_L1_error)
jpayne@68 8274 __Pyx_GOTREF(__pyx_t_9);
jpayne@68 8275 __Pyx_GIVEREF(__pyx_t_10);
jpayne@68 8276 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_10)) __PYX_ERR(0, 257, __pyx_L1_error);
jpayne@68 8277 __Pyx_GIVEREF(__pyx_t_2);
jpayne@68 8278 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_2)) __PYX_ERR(0, 257, __pyx_L1_error);
jpayne@68 8279 __pyx_t_10 = 0;
jpayne@68 8280 __pyx_t_2 = 0;
jpayne@68 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@68 8282 __Pyx_GOTREF(__pyx_t_2);
jpayne@68 8283 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
jpayne@68 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@68 8285 __Pyx_GOTREF(__pyx_t_9);
jpayne@68 8286 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@68 8287 __Pyx_Raise(__pyx_t_9, 0, 0, 0);
jpayne@68 8288 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
jpayne@68 8289 __PYX_ERR(0, 257, __pyx_L1_error)
jpayne@68 8290
jpayne@68 8291 /* "pysam/libcutils.pyx":256
jpayne@68 8292 * contig = region
jpayne@68 8293 *
jpayne@68 8294 * if rstart > rstop: # <<<<<<<<<<<<<<
jpayne@68 8295 * raise ValueError('invalid coordinates: start (%i) > stop (%i)' % (rstart, rstop))
jpayne@68 8296 * if not 0 <= rstart < MAX_POS:
jpayne@68 8297 */
jpayne@68 8298 }
jpayne@68 8299
jpayne@68 8300 /* "pysam/libcutils.pyx":258
jpayne@68 8301 * if rstart > rstop:
jpayne@68 8302 * raise ValueError('invalid coordinates: start (%i) > stop (%i)' % (rstart, rstop))
jpayne@68 8303 * if not 0 <= rstart < MAX_POS: # <<<<<<<<<<<<<<
jpayne@68 8304 * raise ValueError('start out of range (%i)' % rstart)
jpayne@68 8305 * if not 0 <= rstop <= MAX_POS:
jpayne@68 8306 */
jpayne@68 8307 __pyx_t_1 = (0 <= __pyx_v_rstart);
jpayne@68 8308 if (__pyx_t_1) {
jpayne@68 8309 __pyx_t_1 = (__pyx_v_rstart < __pyx_v_5pysam_9libcutils_MAX_POS);
jpayne@68 8310 }
jpayne@68 8311 __pyx_t_3 = (!__pyx_t_1);
jpayne@68 8312 if (unlikely(__pyx_t_3)) {
jpayne@68 8313
jpayne@68 8314 /* "pysam/libcutils.pyx":259
jpayne@68 8315 * raise ValueError('invalid coordinates: start (%i) > stop (%i)' % (rstart, rstop))
jpayne@68 8316 * if not 0 <= rstart < MAX_POS:
jpayne@68 8317 * raise ValueError('start out of range (%i)' % rstart) # <<<<<<<<<<<<<<
jpayne@68 8318 * if not 0 <= rstop <= MAX_POS:
jpayne@68 8319 * raise ValueError('stop out of range (%i)' % rstop)
jpayne@68 8320 */
jpayne@68 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@68 8322 __Pyx_GOTREF(__pyx_t_9);
jpayne@68 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@68 8324 __Pyx_GOTREF(__pyx_t_2);
jpayne@68 8325 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
jpayne@68 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@68 8327 __Pyx_GOTREF(__pyx_t_9);
jpayne@68 8328 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@68 8329 __Pyx_Raise(__pyx_t_9, 0, 0, 0);
jpayne@68 8330 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
jpayne@68 8331 __PYX_ERR(0, 259, __pyx_L1_error)
jpayne@68 8332
jpayne@68 8333 /* "pysam/libcutils.pyx":258
jpayne@68 8334 * if rstart > rstop:
jpayne@68 8335 * raise ValueError('invalid coordinates: start (%i) > stop (%i)' % (rstart, rstop))
jpayne@68 8336 * if not 0 <= rstart < MAX_POS: # <<<<<<<<<<<<<<
jpayne@68 8337 * raise ValueError('start out of range (%i)' % rstart)
jpayne@68 8338 * if not 0 <= rstop <= MAX_POS:
jpayne@68 8339 */
jpayne@68 8340 }
jpayne@68 8341
jpayne@68 8342 /* "pysam/libcutils.pyx":260
jpayne@68 8343 * if not 0 <= rstart < MAX_POS:
jpayne@68 8344 * raise ValueError('start out of range (%i)' % rstart)
jpayne@68 8345 * if not 0 <= rstop <= MAX_POS: # <<<<<<<<<<<<<<
jpayne@68 8346 * raise ValueError('stop out of range (%i)' % rstop)
jpayne@68 8347 *
jpayne@68 8348 */
jpayne@68 8349 __pyx_t_3 = (0 <= __pyx_v_rstop);
jpayne@68 8350 if (__pyx_t_3) {
jpayne@68 8351 __pyx_t_3 = (__pyx_v_rstop <= __pyx_v_5pysam_9libcutils_MAX_POS);
jpayne@68 8352 }
jpayne@68 8353 __pyx_t_1 = (!__pyx_t_3);
jpayne@68 8354 if (unlikely(__pyx_t_1)) {
jpayne@68 8355
jpayne@68 8356 /* "pysam/libcutils.pyx":261
jpayne@68 8357 * raise ValueError('start out of range (%i)' % rstart)
jpayne@68 8358 * if not 0 <= rstop <= MAX_POS:
jpayne@68 8359 * raise ValueError('stop out of range (%i)' % rstop) # <<<<<<<<<<<<<<
jpayne@68 8360 *
jpayne@68 8361 * return contig, rstart, rstop
jpayne@68 8362 */
jpayne@68 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@68 8364 __Pyx_GOTREF(__pyx_t_9);
jpayne@68 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@68 8366 __Pyx_GOTREF(__pyx_t_2);
jpayne@68 8367 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
jpayne@68 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@68 8369 __Pyx_GOTREF(__pyx_t_9);
jpayne@68 8370 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@68 8371 __Pyx_Raise(__pyx_t_9, 0, 0, 0);
jpayne@68 8372 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
jpayne@68 8373 __PYX_ERR(0, 261, __pyx_L1_error)
jpayne@68 8374
jpayne@68 8375 /* "pysam/libcutils.pyx":260
jpayne@68 8376 * if not 0 <= rstart < MAX_POS:
jpayne@68 8377 * raise ValueError('start out of range (%i)' % rstart)
jpayne@68 8378 * if not 0 <= rstop <= MAX_POS: # <<<<<<<<<<<<<<
jpayne@68 8379 * raise ValueError('stop out of range (%i)' % rstop)
jpayne@68 8380 *
jpayne@68 8381 */
jpayne@68 8382 }
jpayne@68 8383
jpayne@68 8384 /* "pysam/libcutils.pyx":263
jpayne@68 8385 * raise ValueError('stop out of range (%i)' % rstop)
jpayne@68 8386 *
jpayne@68 8387 * return contig, rstart, rstop # <<<<<<<<<<<<<<
jpayne@68 8388 *
jpayne@68 8389 *
jpayne@68 8390 */
jpayne@68 8391 __Pyx_XDECREF(__pyx_r);
jpayne@68 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@68 8393 __Pyx_GOTREF(__pyx_t_9);
jpayne@68 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@68 8395 __Pyx_GOTREF(__pyx_t_2);
jpayne@68 8396 __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 263, __pyx_L1_error)
jpayne@68 8397 __Pyx_GOTREF(__pyx_t_10);
jpayne@68 8398 __Pyx_INCREF(__pyx_v_contig);
jpayne@68 8399 __Pyx_GIVEREF(__pyx_v_contig);
jpayne@68 8400 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_contig)) __PYX_ERR(0, 263, __pyx_L1_error);
jpayne@68 8401 __Pyx_GIVEREF(__pyx_t_9);
jpayne@68 8402 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_9)) __PYX_ERR(0, 263, __pyx_L1_error);
jpayne@68 8403 __Pyx_GIVEREF(__pyx_t_2);
jpayne@68 8404 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_2)) __PYX_ERR(0, 263, __pyx_L1_error);
jpayne@68 8405 __pyx_t_9 = 0;
jpayne@68 8406 __pyx_t_2 = 0;
jpayne@68 8407 __pyx_r = __pyx_t_10;
jpayne@68 8408 __pyx_t_10 = 0;
jpayne@68 8409 goto __pyx_L0;
jpayne@68 8410
jpayne@68 8411 /* "pysam/libcutils.pyx":178
jpayne@68 8412 *
jpayne@68 8413 *
jpayne@68 8414 * cpdef parse_region(contig=None, # <<<<<<<<<<<<<<
jpayne@68 8415 * start=None,
jpayne@68 8416 * stop=None,
jpayne@68 8417 */
jpayne@68 8418
jpayne@68 8419 /* function exit code */
jpayne@68 8420 __pyx_L1_error:;
jpayne@68 8421 __Pyx_XDECREF(__pyx_t_2);
jpayne@68 8422 __Pyx_XDECREF(__pyx_t_9);
jpayne@68 8423 __Pyx_XDECREF(__pyx_t_10);
jpayne@68 8424 __Pyx_XDECREF(__pyx_t_11);
jpayne@68 8425 __Pyx_XDECREF(__pyx_t_12);
jpayne@68 8426 __Pyx_AddTraceback("pysam.libcutils.parse_region", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@68 8427 __pyx_r = 0;
jpayne@68 8428 __pyx_L0:;
jpayne@68 8429 __Pyx_XDECREF(__pyx_v_coord);
jpayne@68 8430 __Pyx_XDECREF(__pyx_v_parts);
jpayne@68 8431 __Pyx_XDECREF(__pyx_v_contig);
jpayne@68 8432 __Pyx_XDECREF(__pyx_v_stop);
jpayne@68 8433 __Pyx_XGIVEREF(__pyx_r);
jpayne@68 8434 __Pyx_RefNannyFinishContext();
jpayne@68 8435 return __pyx_r;
jpayne@68 8436 }
jpayne@68 8437
jpayne@68 8438 /* Python wrapper */
jpayne@68 8439 static PyObject *__pyx_pw_5pysam_9libcutils_13parse_region(PyObject *__pyx_self,
jpayne@68 8440 #if CYTHON_METH_FASTCALL
jpayne@68 8441 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
jpayne@68 8442 #else
jpayne@68 8443 PyObject *__pyx_args, PyObject *__pyx_kwds
jpayne@68 8444 #endif
jpayne@68 8445 ); /*proto*/
jpayne@68 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@68 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@68 8448 static PyObject *__pyx_pw_5pysam_9libcutils_13parse_region(PyObject *__pyx_self,
jpayne@68 8449 #if CYTHON_METH_FASTCALL
jpayne@68 8450 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
jpayne@68 8451 #else
jpayne@68 8452 PyObject *__pyx_args, PyObject *__pyx_kwds
jpayne@68 8453 #endif
jpayne@68 8454 ) {
jpayne@68 8455 PyObject *__pyx_v_contig = 0;
jpayne@68 8456 PyObject *__pyx_v_start = 0;
jpayne@68 8457 PyObject *__pyx_v_stop = 0;
jpayne@68 8458 PyObject *__pyx_v_region = 0;
jpayne@68 8459 PyObject *__pyx_v_reference = 0;
jpayne@68 8460 PyObject *__pyx_v_end = 0;
jpayne@68 8461 #if !CYTHON_METH_FASTCALL
jpayne@68 8462 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
jpayne@68 8463 #endif
jpayne@68 8464 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
jpayne@68 8465 PyObject* values[6] = {0,0,0,0,0,0};
jpayne@68 8466 int __pyx_lineno = 0;
jpayne@68 8467 const char *__pyx_filename = NULL;
jpayne@68 8468 int __pyx_clineno = 0;
jpayne@68 8469 PyObject *__pyx_r = 0;
jpayne@68 8470 __Pyx_RefNannyDeclarations
jpayne@68 8471 __Pyx_RefNannySetupContext("parse_region (wrapper)", 0);
jpayne@68 8472 #if !CYTHON_METH_FASTCALL
jpayne@68 8473 #if CYTHON_ASSUME_SAFE_MACROS
jpayne@68 8474 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
jpayne@68 8475 #else
jpayne@68 8476 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
jpayne@68 8477 #endif
jpayne@68 8478 #endif
jpayne@68 8479 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
jpayne@68 8480 {
jpayne@68 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@68 8482 values[0] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
jpayne@68 8483
jpayne@68 8484 /* "pysam/libcutils.pyx":179
jpayne@68 8485 *
jpayne@68 8486 * cpdef parse_region(contig=None,
jpayne@68 8487 * start=None, # <<<<<<<<<<<<<<
jpayne@68 8488 * stop=None,
jpayne@68 8489 * region=None,
jpayne@68 8490 */
jpayne@68 8491 values[1] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
jpayne@68 8492
jpayne@68 8493 /* "pysam/libcutils.pyx":180
jpayne@68 8494 * cpdef parse_region(contig=None,
jpayne@68 8495 * start=None,
jpayne@68 8496 * stop=None, # <<<<<<<<<<<<<<
jpayne@68 8497 * region=None,
jpayne@68 8498 * reference=None,
jpayne@68 8499 */
jpayne@68 8500 values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
jpayne@68 8501
jpayne@68 8502 /* "pysam/libcutils.pyx":181
jpayne@68 8503 * start=None,
jpayne@68 8504 * stop=None,
jpayne@68 8505 * region=None, # <<<<<<<<<<<<<<
jpayne@68 8506 * reference=None,
jpayne@68 8507 * end=None):
jpayne@68 8508 */
jpayne@68 8509 values[3] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
jpayne@68 8510
jpayne@68 8511 /* "pysam/libcutils.pyx":182
jpayne@68 8512 * stop=None,
jpayne@68 8513 * region=None,
jpayne@68 8514 * reference=None, # <<<<<<<<<<<<<<
jpayne@68 8515 * end=None):
jpayne@68 8516 * """parse alternative ways to specify a genomic region. A region can
jpayne@68 8517 */
jpayne@68 8518 values[4] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
jpayne@68 8519
jpayne@68 8520 /* "pysam/libcutils.pyx":183
jpayne@68 8521 * region=None,
jpayne@68 8522 * reference=None,
jpayne@68 8523 * end=None): # <<<<<<<<<<<<<<
jpayne@68 8524 * """parse alternative ways to specify a genomic region. A region can
jpayne@68 8525 * either be specified by :term:`reference`, `start` and
jpayne@68 8526 */
jpayne@68 8527 values[5] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
jpayne@68 8528 if (__pyx_kwds) {
jpayne@68 8529 Py_ssize_t kw_args;
jpayne@68 8530 switch (__pyx_nargs) {
jpayne@68 8531 case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5);
jpayne@68 8532 CYTHON_FALLTHROUGH;
jpayne@68 8533 case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
jpayne@68 8534 CYTHON_FALLTHROUGH;
jpayne@68 8535 case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
jpayne@68 8536 CYTHON_FALLTHROUGH;
jpayne@68 8537 case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
jpayne@68 8538 CYTHON_FALLTHROUGH;
jpayne@68 8539 case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
jpayne@68 8540 CYTHON_FALLTHROUGH;
jpayne@68 8541 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
jpayne@68 8542 CYTHON_FALLTHROUGH;
jpayne@68 8543 case 0: break;
jpayne@68 8544 default: goto __pyx_L5_argtuple_error;
jpayne@68 8545 }
jpayne@68 8546 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
jpayne@68 8547 switch (__pyx_nargs) {
jpayne@68 8548 case 0:
jpayne@68 8549 if (kw_args > 0) {
jpayne@68 8550 PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_contig);
jpayne@68 8551 if (value) { values[0] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
jpayne@68 8552 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 178, __pyx_L3_error)
jpayne@68 8553 }
jpayne@68 8554 CYTHON_FALLTHROUGH;
jpayne@68 8555 case 1:
jpayne@68 8556 if (kw_args > 0) {
jpayne@68 8557 PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_start);
jpayne@68 8558 if (value) { values[1] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
jpayne@68 8559 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 178, __pyx_L3_error)
jpayne@68 8560 }
jpayne@68 8561 CYTHON_FALLTHROUGH;
jpayne@68 8562 case 2:
jpayne@68 8563 if (kw_args > 0) {
jpayne@68 8564 PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_stop);
jpayne@68 8565 if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
jpayne@68 8566 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 178, __pyx_L3_error)
jpayne@68 8567 }
jpayne@68 8568 CYTHON_FALLTHROUGH;
jpayne@68 8569 case 3:
jpayne@68 8570 if (kw_args > 0) {
jpayne@68 8571 PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_region);
jpayne@68 8572 if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
jpayne@68 8573 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 178, __pyx_L3_error)
jpayne@68 8574 }
jpayne@68 8575 CYTHON_FALLTHROUGH;
jpayne@68 8576 case 4:
jpayne@68 8577 if (kw_args > 0) {
jpayne@68 8578 PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_reference);
jpayne@68 8579 if (value) { values[4] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
jpayne@68 8580 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 178, __pyx_L3_error)
jpayne@68 8581 }
jpayne@68 8582 CYTHON_FALLTHROUGH;
jpayne@68 8583 case 5:
jpayne@68 8584 if (kw_args > 0) {
jpayne@68 8585 PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_end);
jpayne@68 8586 if (value) { values[5] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
jpayne@68 8587 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 178, __pyx_L3_error)
jpayne@68 8588 }
jpayne@68 8589 }
jpayne@68 8590 if (unlikely(kw_args > 0)) {
jpayne@68 8591 const Py_ssize_t kwd_pos_args = __pyx_nargs;
jpayne@68 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@68 8593 }
jpayne@68 8594 } else {
jpayne@68 8595 switch (__pyx_nargs) {
jpayne@68 8596 case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5);
jpayne@68 8597 CYTHON_FALLTHROUGH;
jpayne@68 8598 case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
jpayne@68 8599 CYTHON_FALLTHROUGH;
jpayne@68 8600 case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
jpayne@68 8601 CYTHON_FALLTHROUGH;
jpayne@68 8602 case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
jpayne@68 8603 CYTHON_FALLTHROUGH;
jpayne@68 8604 case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
jpayne@68 8605 CYTHON_FALLTHROUGH;
jpayne@68 8606 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
jpayne@68 8607 CYTHON_FALLTHROUGH;
jpayne@68 8608 case 0: break;
jpayne@68 8609 default: goto __pyx_L5_argtuple_error;
jpayne@68 8610 }
jpayne@68 8611 }
jpayne@68 8612 __pyx_v_contig = values[0];
jpayne@68 8613 __pyx_v_start = values[1];
jpayne@68 8614 __pyx_v_stop = values[2];
jpayne@68 8615 __pyx_v_region = values[3];
jpayne@68 8616 __pyx_v_reference = values[4];
jpayne@68 8617 __pyx_v_end = values[5];
jpayne@68 8618 }
jpayne@68 8619 goto __pyx_L6_skip;
jpayne@68 8620 __pyx_L5_argtuple_error:;
jpayne@68 8621 __Pyx_RaiseArgtupleInvalid("parse_region", 0, 0, 6, __pyx_nargs); __PYX_ERR(0, 178, __pyx_L3_error)
jpayne@68 8622 __pyx_L6_skip:;
jpayne@68 8623 goto __pyx_L4_argument_unpacking_done;
jpayne@68 8624 __pyx_L3_error:;
jpayne@68 8625 {
jpayne@68 8626 Py_ssize_t __pyx_temp;
jpayne@68 8627 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
jpayne@68 8628 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
jpayne@68 8629 }
jpayne@68 8630 }
jpayne@68 8631 __Pyx_AddTraceback("pysam.libcutils.parse_region", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@68 8632 __Pyx_RefNannyFinishContext();
jpayne@68 8633 return NULL;
jpayne@68 8634 __pyx_L4_argument_unpacking_done:;
jpayne@68 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@68 8636
jpayne@68 8637 /* "pysam/libcutils.pyx":178
jpayne@68 8638 *
jpayne@68 8639 *
jpayne@68 8640 * cpdef parse_region(contig=None, # <<<<<<<<<<<<<<
jpayne@68 8641 * start=None,
jpayne@68 8642 * stop=None,
jpayne@68 8643 */
jpayne@68 8644
jpayne@68 8645 /* function exit code */
jpayne@68 8646 {
jpayne@68 8647 Py_ssize_t __pyx_temp;
jpayne@68 8648 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
jpayne@68 8649 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
jpayne@68 8650 }
jpayne@68 8651 }
jpayne@68 8652 __Pyx_RefNannyFinishContext();
jpayne@68 8653 return __pyx_r;
jpayne@68 8654 }
jpayne@68 8655
jpayne@68 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@68 8657 PyObject *__pyx_r = NULL;
jpayne@68 8658 __Pyx_RefNannyDeclarations
jpayne@68 8659 PyObject *__pyx_t_1 = NULL;
jpayne@68 8660 struct __pyx_opt_args_5pysam_9libcutils_parse_region __pyx_t_2;
jpayne@68 8661 int __pyx_lineno = 0;
jpayne@68 8662 const char *__pyx_filename = NULL;
jpayne@68 8663 int __pyx_clineno = 0;
jpayne@68 8664 __Pyx_RefNannySetupContext("parse_region", 1);
jpayne@68 8665 __Pyx_XDECREF(__pyx_r);
jpayne@68 8666 __pyx_t_2.__pyx_n = 6;
jpayne@68 8667 __pyx_t_2.contig = __pyx_v_contig;
jpayne@68 8668 __pyx_t_2.start = __pyx_v_start;
jpayne@68 8669 __pyx_t_2.stop = __pyx_v_stop;
jpayne@68 8670 __pyx_t_2.region = __pyx_v_region;
jpayne@68 8671 __pyx_t_2.reference = __pyx_v_reference;
jpayne@68 8672 __pyx_t_2.end = __pyx_v_end;
jpayne@68 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@68 8674 __Pyx_GOTREF(__pyx_t_1);
jpayne@68 8675 __pyx_r = __pyx_t_1;
jpayne@68 8676 __pyx_t_1 = 0;
jpayne@68 8677 goto __pyx_L0;
jpayne@68 8678
jpayne@68 8679 /* function exit code */
jpayne@68 8680 __pyx_L1_error:;
jpayne@68 8681 __Pyx_XDECREF(__pyx_t_1);
jpayne@68 8682 __Pyx_AddTraceback("pysam.libcutils.parse_region", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@68 8683 __pyx_r = NULL;
jpayne@68 8684 __pyx_L0:;
jpayne@68 8685 __Pyx_XGIVEREF(__pyx_r);
jpayne@68 8686 __Pyx_RefNannyFinishContext();
jpayne@68 8687 return __pyx_r;
jpayne@68 8688 }
jpayne@68 8689
jpayne@68 8690 /* "pysam/libcutils.pyx":266
jpayne@68 8691 *
jpayne@68 8692 *
jpayne@68 8693 * cdef int libc_whence_from_io(int whence): # <<<<<<<<<<<<<<
jpayne@68 8694 * # io.SEEK_SET/_CUR/_END are by definition 0/1/2 but C/POSIX's equivalents
jpayne@68 8695 * # have unspecified values. So we must translate, but checking for 0/1/2
jpayne@68 8696 */
jpayne@68 8697
jpayne@68 8698 static int __pyx_f_5pysam_9libcutils_libc_whence_from_io(int __pyx_v_whence) {
jpayne@68 8699 int __pyx_r;
jpayne@68 8700 int __pyx_t_1;
jpayne@68 8701
jpayne@68 8702 /* "pysam/libcutils.pyx":270
jpayne@68 8703 * # have unspecified values. So we must translate, but checking for 0/1/2
jpayne@68 8704 * # rather than io.SEEK_SET/etc suffices.
jpayne@68 8705 * if whence == 0: return SEEK_SET # <<<<<<<<<<<<<<
jpayne@68 8706 * if whence == 1: return SEEK_CUR
jpayne@68 8707 * if whence == 2: return SEEK_END
jpayne@68 8708 */
jpayne@68 8709 __pyx_t_1 = (__pyx_v_whence == 0);
jpayne@68 8710 if (__pyx_t_1) {
jpayne@68 8711 __pyx_r = SEEK_SET;
jpayne@68 8712 goto __pyx_L0;
jpayne@68 8713 }
jpayne@68 8714
jpayne@68 8715 /* "pysam/libcutils.pyx":271
jpayne@68 8716 * # rather than io.SEEK_SET/etc suffices.
jpayne@68 8717 * if whence == 0: return SEEK_SET
jpayne@68 8718 * if whence == 1: return SEEK_CUR # <<<<<<<<<<<<<<
jpayne@68 8719 * if whence == 2: return SEEK_END
jpayne@68 8720 * return whence # Otherwise likely invalid, but let HTSlib or OS report it
jpayne@68 8721 */
jpayne@68 8722 __pyx_t_1 = (__pyx_v_whence == 1);
jpayne@68 8723 if (__pyx_t_1) {
jpayne@68 8724 __pyx_r = SEEK_CUR;
jpayne@68 8725 goto __pyx_L0;
jpayne@68 8726 }
jpayne@68 8727
jpayne@68 8728 /* "pysam/libcutils.pyx":272
jpayne@68 8729 * if whence == 0: return SEEK_SET
jpayne@68 8730 * if whence == 1: return SEEK_CUR
jpayne@68 8731 * if whence == 2: return SEEK_END # <<<<<<<<<<<<<<
jpayne@68 8732 * return whence # Otherwise likely invalid, but let HTSlib or OS report it
jpayne@68 8733 *
jpayne@68 8734 */
jpayne@68 8735 __pyx_t_1 = (__pyx_v_whence == 2);
jpayne@68 8736 if (__pyx_t_1) {
jpayne@68 8737 __pyx_r = SEEK_END;
jpayne@68 8738 goto __pyx_L0;
jpayne@68 8739 }
jpayne@68 8740
jpayne@68 8741 /* "pysam/libcutils.pyx":273
jpayne@68 8742 * if whence == 1: return SEEK_CUR
jpayne@68 8743 * if whence == 2: return SEEK_END
jpayne@68 8744 * return whence # Otherwise likely invalid, but let HTSlib or OS report it # <<<<<<<<<<<<<<
jpayne@68 8745 *
jpayne@68 8746 *
jpayne@68 8747 */
jpayne@68 8748 __pyx_r = __pyx_v_whence;
jpayne@68 8749 goto __pyx_L0;
jpayne@68 8750
jpayne@68 8751 /* "pysam/libcutils.pyx":266
jpayne@68 8752 *
jpayne@68 8753 *
jpayne@68 8754 * cdef int libc_whence_from_io(int whence): # <<<<<<<<<<<<<<
jpayne@68 8755 * # io.SEEK_SET/_CUR/_END are by definition 0/1/2 but C/POSIX's equivalents
jpayne@68 8756 * # have unspecified values. So we must translate, but checking for 0/1/2
jpayne@68 8757 */
jpayne@68 8758
jpayne@68 8759 /* function exit code */
jpayne@68 8760 __pyx_L0:;
jpayne@68 8761 return __pyx_r;
jpayne@68 8762 }
jpayne@68 8763
jpayne@68 8764 /* "pysam/libcutils.pyx":276
jpayne@68 8765 *
jpayne@68 8766 *
jpayne@68 8767 * def _pysam_dispatch(collection, # <<<<<<<<<<<<<<
jpayne@68 8768 * method,
jpayne@68 8769 * args=None,
jpayne@68 8770 */
jpayne@68 8771
jpayne@68 8772 /* Python wrapper */
jpayne@68 8773 static PyObject *__pyx_pw_5pysam_9libcutils_15_pysam_dispatch(PyObject *__pyx_self,
jpayne@68 8774 #if CYTHON_METH_FASTCALL
jpayne@68 8775 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
jpayne@68 8776 #else
jpayne@68 8777 PyObject *__pyx_args, PyObject *__pyx_kwds
jpayne@68 8778 #endif
jpayne@68 8779 ); /*proto*/
jpayne@68 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@68 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@68 8782 static PyObject *__pyx_pw_5pysam_9libcutils_15_pysam_dispatch(PyObject *__pyx_self,
jpayne@68 8783 #if CYTHON_METH_FASTCALL
jpayne@68 8784 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
jpayne@68 8785 #else
jpayne@68 8786 PyObject *__pyx_args, PyObject *__pyx_kwds
jpayne@68 8787 #endif
jpayne@68 8788 ) {
jpayne@68 8789 PyObject *__pyx_v_collection = 0;
jpayne@68 8790 PyObject *__pyx_v_method = 0;
jpayne@68 8791 PyObject *__pyx_v_args = 0;
jpayne@68 8792 PyObject *__pyx_v_catch_stdout = 0;
jpayne@68 8793 PyObject *__pyx_v_is_usage = 0;
jpayne@68 8794 PyObject *__pyx_v_save_stdout = 0;
jpayne@68 8795 #if !CYTHON_METH_FASTCALL
jpayne@68 8796 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
jpayne@68 8797 #endif
jpayne@68 8798 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
jpayne@68 8799 PyObject* values[6] = {0,0,0,0,0,0};
jpayne@68 8800 int __pyx_lineno = 0;
jpayne@68 8801 const char *__pyx_filename = NULL;
jpayne@68 8802 int __pyx_clineno = 0;
jpayne@68 8803 PyObject *__pyx_r = 0;
jpayne@68 8804 __Pyx_RefNannyDeclarations
jpayne@68 8805 __Pyx_RefNannySetupContext("_pysam_dispatch (wrapper)", 0);
jpayne@68 8806 #if !CYTHON_METH_FASTCALL
jpayne@68 8807 #if CYTHON_ASSUME_SAFE_MACROS
jpayne@68 8808 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
jpayne@68 8809 #else
jpayne@68 8810 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
jpayne@68 8811 #endif
jpayne@68 8812 #endif
jpayne@68 8813 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
jpayne@68 8814 {
jpayne@68 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@68 8816
jpayne@68 8817 /* "pysam/libcutils.pyx":278
jpayne@68 8818 * def _pysam_dispatch(collection,
jpayne@68 8819 * method,
jpayne@68 8820 * args=None, # <<<<<<<<<<<<<<
jpayne@68 8821 * catch_stdout=True,
jpayne@68 8822 * is_usage=False,
jpayne@68 8823 */
jpayne@68 8824 values[2] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
jpayne@68 8825
jpayne@68 8826 /* "pysam/libcutils.pyx":279
jpayne@68 8827 * method,
jpayne@68 8828 * args=None,
jpayne@68 8829 * catch_stdout=True, # <<<<<<<<<<<<<<
jpayne@68 8830 * is_usage=False,
jpayne@68 8831 * save_stdout=None):
jpayne@68 8832 */
jpayne@68 8833 values[3] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)((PyObject *)Py_True)));
jpayne@68 8834
jpayne@68 8835 /* "pysam/libcutils.pyx":280
jpayne@68 8836 * args=None,
jpayne@68 8837 * catch_stdout=True,
jpayne@68 8838 * is_usage=False, # <<<<<<<<<<<<<<
jpayne@68 8839 * save_stdout=None):
jpayne@68 8840 * '''call ``method`` in samtools/bcftools providing arguments in args.
jpayne@68 8841 */
jpayne@68 8842 values[4] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)((PyObject *)Py_False)));
jpayne@68 8843
jpayne@68 8844 /* "pysam/libcutils.pyx":281
jpayne@68 8845 * catch_stdout=True,
jpayne@68 8846 * is_usage=False,
jpayne@68 8847 * save_stdout=None): # <<<<<<<<<<<<<<
jpayne@68 8848 * '''call ``method`` in samtools/bcftools providing arguments in args.
jpayne@68 8849 *
jpayne@68 8850 */
jpayne@68 8851 values[5] = __Pyx_Arg_NewRef_FASTCALL(((PyObject *)Py_None));
jpayne@68 8852 if (__pyx_kwds) {
jpayne@68 8853 Py_ssize_t kw_args;
jpayne@68 8854 switch (__pyx_nargs) {
jpayne@68 8855 case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5);
jpayne@68 8856 CYTHON_FALLTHROUGH;
jpayne@68 8857 case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
jpayne@68 8858 CYTHON_FALLTHROUGH;
jpayne@68 8859 case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
jpayne@68 8860 CYTHON_FALLTHROUGH;
jpayne@68 8861 case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
jpayne@68 8862 CYTHON_FALLTHROUGH;
jpayne@68 8863 case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
jpayne@68 8864 CYTHON_FALLTHROUGH;
jpayne@68 8865 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
jpayne@68 8866 CYTHON_FALLTHROUGH;
jpayne@68 8867 case 0: break;
jpayne@68 8868 default: goto __pyx_L5_argtuple_error;
jpayne@68 8869 }
jpayne@68 8870 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
jpayne@68 8871 switch (__pyx_nargs) {
jpayne@68 8872 case 0:
jpayne@68 8873 if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_collection)) != 0)) {
jpayne@68 8874 (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
jpayne@68 8875 kw_args--;
jpayne@68 8876 }
jpayne@68 8877 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 276, __pyx_L3_error)
jpayne@68 8878 else goto __pyx_L5_argtuple_error;
jpayne@68 8879 CYTHON_FALLTHROUGH;
jpayne@68 8880 case 1:
jpayne@68 8881 if (likely((values[1] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_method)) != 0)) {
jpayne@68 8882 (void)__Pyx_Arg_NewRef_FASTCALL(values[1]);
jpayne@68 8883 kw_args--;
jpayne@68 8884 }
jpayne@68 8885 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 276, __pyx_L3_error)
jpayne@68 8886 else {
jpayne@68 8887 __Pyx_RaiseArgtupleInvalid("_pysam_dispatch", 0, 2, 6, 1); __PYX_ERR(0, 276, __pyx_L3_error)
jpayne@68 8888 }
jpayne@68 8889 CYTHON_FALLTHROUGH;
jpayne@68 8890 case 2:
jpayne@68 8891 if (kw_args > 0) {
jpayne@68 8892 PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_args);
jpayne@68 8893 if (value) { values[2] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
jpayne@68 8894 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 276, __pyx_L3_error)
jpayne@68 8895 }
jpayne@68 8896 CYTHON_FALLTHROUGH;
jpayne@68 8897 case 3:
jpayne@68 8898 if (kw_args > 0) {
jpayne@68 8899 PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_catch_stdout);
jpayne@68 8900 if (value) { values[3] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
jpayne@68 8901 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 276, __pyx_L3_error)
jpayne@68 8902 }
jpayne@68 8903 CYTHON_FALLTHROUGH;
jpayne@68 8904 case 4:
jpayne@68 8905 if (kw_args > 0) {
jpayne@68 8906 PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_is_usage);
jpayne@68 8907 if (value) { values[4] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
jpayne@68 8908 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 276, __pyx_L3_error)
jpayne@68 8909 }
jpayne@68 8910 CYTHON_FALLTHROUGH;
jpayne@68 8911 case 5:
jpayne@68 8912 if (kw_args > 0) {
jpayne@68 8913 PyObject* value = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_save_stdout);
jpayne@68 8914 if (value) { values[5] = __Pyx_Arg_NewRef_FASTCALL(value); kw_args--; }
jpayne@68 8915 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 276, __pyx_L3_error)
jpayne@68 8916 }
jpayne@68 8917 }
jpayne@68 8918 if (unlikely(kw_args > 0)) {
jpayne@68 8919 const Py_ssize_t kwd_pos_args = __pyx_nargs;
jpayne@68 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@68 8921 }
jpayne@68 8922 } else {
jpayne@68 8923 switch (__pyx_nargs) {
jpayne@68 8924 case 6: values[5] = __Pyx_Arg_FASTCALL(__pyx_args, 5);
jpayne@68 8925 CYTHON_FALLTHROUGH;
jpayne@68 8926 case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4);
jpayne@68 8927 CYTHON_FALLTHROUGH;
jpayne@68 8928 case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3);
jpayne@68 8929 CYTHON_FALLTHROUGH;
jpayne@68 8930 case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2);
jpayne@68 8931 CYTHON_FALLTHROUGH;
jpayne@68 8932 case 2: values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1);
jpayne@68 8933 values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
jpayne@68 8934 break;
jpayne@68 8935 default: goto __pyx_L5_argtuple_error;
jpayne@68 8936 }
jpayne@68 8937 }
jpayne@68 8938 __pyx_v_collection = values[0];
jpayne@68 8939 __pyx_v_method = values[1];
jpayne@68 8940 __pyx_v_args = values[2];
jpayne@68 8941 __pyx_v_catch_stdout = values[3];
jpayne@68 8942 __pyx_v_is_usage = values[4];
jpayne@68 8943 __pyx_v_save_stdout = values[5];
jpayne@68 8944 }
jpayne@68 8945 goto __pyx_L6_skip;
jpayne@68 8946 __pyx_L5_argtuple_error:;
jpayne@68 8947 __Pyx_RaiseArgtupleInvalid("_pysam_dispatch", 0, 2, 6, __pyx_nargs); __PYX_ERR(0, 276, __pyx_L3_error)
jpayne@68 8948 __pyx_L6_skip:;
jpayne@68 8949 goto __pyx_L4_argument_unpacking_done;
jpayne@68 8950 __pyx_L3_error:;
jpayne@68 8951 {
jpayne@68 8952 Py_ssize_t __pyx_temp;
jpayne@68 8953 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
jpayne@68 8954 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
jpayne@68 8955 }
jpayne@68 8956 }
jpayne@68 8957 __Pyx_AddTraceback("pysam.libcutils._pysam_dispatch", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@68 8958 __Pyx_RefNannyFinishContext();
jpayne@68 8959 return NULL;
jpayne@68 8960 __pyx_L4_argument_unpacking_done:;
jpayne@68 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@68 8962
jpayne@68 8963 /* "pysam/libcutils.pyx":276
jpayne@68 8964 *
jpayne@68 8965 *
jpayne@68 8966 * def _pysam_dispatch(collection, # <<<<<<<<<<<<<<
jpayne@68 8967 * method,
jpayne@68 8968 * args=None,
jpayne@68 8969 */
jpayne@68 8970
jpayne@68 8971 /* function exit code */
jpayne@68 8972 {
jpayne@68 8973 Py_ssize_t __pyx_temp;
jpayne@68 8974 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
jpayne@68 8975 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
jpayne@68 8976 }
jpayne@68 8977 }
jpayne@68 8978 __Pyx_RefNannyFinishContext();
jpayne@68 8979 return __pyx_r;
jpayne@68 8980 }
jpayne@68 8981
jpayne@68 8982 /* "pysam/libcutils.pyx":413
jpayne@68 8983 *
jpayne@68 8984 * # get error messages
jpayne@68 8985 * def _collect(fn): # <<<<<<<<<<<<<<
jpayne@68 8986 * out = []
jpayne@68 8987 * try:
jpayne@68 8988 */
jpayne@68 8989
jpayne@68 8990 /* Python wrapper */
jpayne@68 8991 static PyObject *__pyx_pw_5pysam_9libcutils_15_pysam_dispatch_1_collect(PyObject *__pyx_self,
jpayne@68 8992 #if CYTHON_METH_FASTCALL
jpayne@68 8993 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
jpayne@68 8994 #else
jpayne@68 8995 PyObject *__pyx_args, PyObject *__pyx_kwds
jpayne@68 8996 #endif
jpayne@68 8997 ); /*proto*/
jpayne@68 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@68 8999 static PyObject *__pyx_pw_5pysam_9libcutils_15_pysam_dispatch_1_collect(PyObject *__pyx_self,
jpayne@68 9000 #if CYTHON_METH_FASTCALL
jpayne@68 9001 PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
jpayne@68 9002 #else
jpayne@68 9003 PyObject *__pyx_args, PyObject *__pyx_kwds
jpayne@68 9004 #endif
jpayne@68 9005 ) {
jpayne@68 9006 PyObject *__pyx_v_fn = 0;
jpayne@68 9007 #if !CYTHON_METH_FASTCALL
jpayne@68 9008 CYTHON_UNUSED Py_ssize_t __pyx_nargs;
jpayne@68 9009 #endif
jpayne@68 9010 CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
jpayne@68 9011 PyObject* values[1] = {0};
jpayne@68 9012 int __pyx_lineno = 0;
jpayne@68 9013 const char *__pyx_filename = NULL;
jpayne@68 9014 int __pyx_clineno = 0;
jpayne@68 9015 PyObject *__pyx_r = 0;
jpayne@68 9016 __Pyx_RefNannyDeclarations
jpayne@68 9017 __Pyx_RefNannySetupContext("_collect (wrapper)", 0);
jpayne@68 9018 #if !CYTHON_METH_FASTCALL
jpayne@68 9019 #if CYTHON_ASSUME_SAFE_MACROS
jpayne@68 9020 __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
jpayne@68 9021 #else
jpayne@68 9022 __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
jpayne@68 9023 #endif
jpayne@68 9024 #endif
jpayne@68 9025 __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
jpayne@68 9026 {
jpayne@68 9027 PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fn,0};
jpayne@68 9028 if (__pyx_kwds) {
jpayne@68 9029 Py_ssize_t kw_args;
jpayne@68 9030 switch (__pyx_nargs) {
jpayne@68 9031 case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
jpayne@68 9032 CYTHON_FALLTHROUGH;
jpayne@68 9033 case 0: break;
jpayne@68 9034 default: goto __pyx_L5_argtuple_error;
jpayne@68 9035 }
jpayne@68 9036 kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
jpayne@68 9037 switch (__pyx_nargs) {
jpayne@68 9038 case 0:
jpayne@68 9039 if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_fn)) != 0)) {
jpayne@68 9040 (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
jpayne@68 9041 kw_args--;
jpayne@68 9042 }
jpayne@68 9043 else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 413, __pyx_L3_error)
jpayne@68 9044 else goto __pyx_L5_argtuple_error;
jpayne@68 9045 }
jpayne@68 9046 if (unlikely(kw_args > 0)) {
jpayne@68 9047 const Py_ssize_t kwd_pos_args = __pyx_nargs;
jpayne@68 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@68 9049 }
jpayne@68 9050 } else if (unlikely(__pyx_nargs != 1)) {
jpayne@68 9051 goto __pyx_L5_argtuple_error;
jpayne@68 9052 } else {
jpayne@68 9053 values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
jpayne@68 9054 }
jpayne@68 9055 __pyx_v_fn = values[0];
jpayne@68 9056 }
jpayne@68 9057 goto __pyx_L6_skip;
jpayne@68 9058 __pyx_L5_argtuple_error:;
jpayne@68 9059 __Pyx_RaiseArgtupleInvalid("_collect", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 413, __pyx_L3_error)
jpayne@68 9060 __pyx_L6_skip:;
jpayne@68 9061 goto __pyx_L4_argument_unpacking_done;
jpayne@68 9062 __pyx_L3_error:;
jpayne@68 9063 {
jpayne@68 9064 Py_ssize_t __pyx_temp;
jpayne@68 9065 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
jpayne@68 9066 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
jpayne@68 9067 }
jpayne@68 9068 }
jpayne@68 9069 __Pyx_AddTraceback("pysam.libcutils._pysam_dispatch._collect", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@68 9070 __Pyx_RefNannyFinishContext();
jpayne@68 9071 return NULL;
jpayne@68 9072 __pyx_L4_argument_unpacking_done:;
jpayne@68 9073 __pyx_r = __pyx_pf_5pysam_9libcutils_15_pysam_dispatch__collect(__pyx_self, __pyx_v_fn);
jpayne@68 9074
jpayne@68 9075 /* function exit code */
jpayne@68 9076 {
jpayne@68 9077 Py_ssize_t __pyx_temp;
jpayne@68 9078 for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
jpayne@68 9079 __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
jpayne@68 9080 }
jpayne@68 9081 }
jpayne@68 9082 __Pyx_RefNannyFinishContext();
jpayne@68 9083 return __pyx_r;
jpayne@68 9084 }
jpayne@68 9085
jpayne@68 9086 static PyObject *__pyx_pf_5pysam_9libcutils_15_pysam_dispatch__collect(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fn) {
jpayne@68 9087 PyObject *__pyx_v_out = NULL;
jpayne@68 9088 PyObject *__pyx_v_inf = NULL;
jpayne@68 9089 PyObject *__pyx_r = NULL;
jpayne@68 9090 __Pyx_RefNannyDeclarations
jpayne@68 9091 PyObject *__pyx_t_1 = NULL;
jpayne@68 9092 PyObject *__pyx_t_2 = NULL;
jpayne@68 9093 PyObject *__pyx_t_3 = NULL;
jpayne@68 9094 PyObject *__pyx_t_4 = NULL;
jpayne@68 9095 PyObject *__pyx_t_5 = NULL;
jpayne@68 9096 PyObject *__pyx_t_6 = NULL;
jpayne@68 9097 PyObject *__pyx_t_7 = NULL;
jpayne@68 9098 PyObject *__pyx_t_8 = NULL;
jpayne@68 9099 unsigned int __pyx_t_9;
jpayne@68 9100 PyObject *__pyx_t_10 = NULL;
jpayne@68 9101 PyObject *__pyx_t_11 = NULL;
jpayne@68 9102 PyObject *__pyx_t_12 = NULL;
jpayne@68 9103 PyObject *__pyx_t_13 = NULL;
jpayne@68 9104 int __pyx_t_14;
jpayne@68 9105 int __pyx_t_15;
jpayne@68 9106 int __pyx_t_16;
jpayne@68 9107 PyObject *__pyx_t_17 = NULL;
jpayne@68 9108 PyObject *__pyx_t_18 = NULL;
jpayne@68 9109 PyObject *__pyx_t_19 = NULL;
jpayne@68 9110 int __pyx_t_20;
jpayne@68 9111 char const *__pyx_t_21;
jpayne@68 9112 int __pyx_lineno = 0;
jpayne@68 9113 const char *__pyx_filename = NULL;
jpayne@68 9114 int __pyx_clineno = 0;
jpayne@68 9115 __Pyx_RefNannySetupContext("_collect", 1);
jpayne@68 9116
jpayne@68 9117 /* "pysam/libcutils.pyx":414
jpayne@68 9118 * # get error messages
jpayne@68 9119 * def _collect(fn):
jpayne@68 9120 * out = [] # <<<<<<<<<<<<<<
jpayne@68 9121 * try:
jpayne@68 9122 * with open(fn, "r") as inf:
jpayne@68 9123 */
jpayne@68 9124 __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 414, __pyx_L1_error)
jpayne@68 9125 __Pyx_GOTREF(__pyx_t_1);
jpayne@68 9126 __pyx_v_out = __pyx_t_1;
jpayne@68 9127 __pyx_t_1 = 0;
jpayne@68 9128
jpayne@68 9129 /* "pysam/libcutils.pyx":415
jpayne@68 9130 * def _collect(fn):
jpayne@68 9131 * out = []
jpayne@68 9132 * try: # <<<<<<<<<<<<<<
jpayne@68 9133 * with open(fn, "r") as inf:
jpayne@68 9134 * out = inf.read()
jpayne@68 9135 */
jpayne@68 9136 /*try:*/ {
jpayne@68 9137 {
jpayne@68 9138 __Pyx_PyThreadState_declare
jpayne@68 9139 __Pyx_PyThreadState_assign
jpayne@68 9140 __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
jpayne@68 9141 __Pyx_XGOTREF(__pyx_t_2);
jpayne@68 9142 __Pyx_XGOTREF(__pyx_t_3);
jpayne@68 9143 __Pyx_XGOTREF(__pyx_t_4);
jpayne@68 9144 /*try:*/ {
jpayne@68 9145
jpayne@68 9146 /* "pysam/libcutils.pyx":416
jpayne@68 9147 * out = []
jpayne@68 9148 * try:
jpayne@68 9149 * with open(fn, "r") as inf: # <<<<<<<<<<<<<<
jpayne@68 9150 * out = inf.read()
jpayne@68 9151 * except UnicodeDecodeError:
jpayne@68 9152 */
jpayne@68 9153 /*with:*/ {
jpayne@68 9154 __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 416, __pyx_L6_error)
jpayne@68 9155 __Pyx_GOTREF(__pyx_t_1);
jpayne@68 9156 __Pyx_INCREF(__pyx_v_fn);
jpayne@68 9157 __Pyx_GIVEREF(__pyx_v_fn);
jpayne@68 9158 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_fn)) __PYX_ERR(0, 416, __pyx_L6_error);
jpayne@68 9159 __Pyx_INCREF(__pyx_n_u_r);
jpayne@68 9160 __Pyx_GIVEREF(__pyx_n_u_r);
jpayne@68 9161 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_n_u_r)) __PYX_ERR(0, 416, __pyx_L6_error);
jpayne@68 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@68 9163 __Pyx_GOTREF(__pyx_t_5);
jpayne@68 9164 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
jpayne@68 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@68 9166 __Pyx_GOTREF(__pyx_t_6);
jpayne@68 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@68 9168 __Pyx_GOTREF(__pyx_t_7);
jpayne@68 9169 __pyx_t_8 = NULL;
jpayne@68 9170 __pyx_t_9 = 0;
jpayne@68 9171 #if CYTHON_UNPACK_METHODS
jpayne@68 9172 if (likely(PyMethod_Check(__pyx_t_7))) {
jpayne@68 9173 __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
jpayne@68 9174 if (likely(__pyx_t_8)) {
jpayne@68 9175 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
jpayne@68 9176 __Pyx_INCREF(__pyx_t_8);
jpayne@68 9177 __Pyx_INCREF(function);
jpayne@68 9178 __Pyx_DECREF_SET(__pyx_t_7, function);
jpayne@68 9179 __pyx_t_9 = 1;
jpayne@68 9180 }
jpayne@68 9181 }
jpayne@68 9182 #endif
jpayne@68 9183 {
jpayne@68 9184 PyObject *__pyx_callargs[2] = {__pyx_t_8, NULL};
jpayne@68 9185 __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_9, 0+__pyx_t_9);
jpayne@68 9186 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
jpayne@68 9187 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 416, __pyx_L12_error)
jpayne@68 9188 __Pyx_GOTREF(__pyx_t_1);
jpayne@68 9189 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
jpayne@68 9190 }
jpayne@68 9191 __pyx_t_7 = __pyx_t_1;
jpayne@68 9192 __pyx_t_1 = 0;
jpayne@68 9193 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
jpayne@68 9194 /*try:*/ {
jpayne@68 9195 {
jpayne@68 9196 __Pyx_PyThreadState_declare
jpayne@68 9197 __Pyx_PyThreadState_assign
jpayne@68 9198 __Pyx_ExceptionSave(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
jpayne@68 9199 __Pyx_XGOTREF(__pyx_t_10);
jpayne@68 9200 __Pyx_XGOTREF(__pyx_t_11);
jpayne@68 9201 __Pyx_XGOTREF(__pyx_t_12);
jpayne@68 9202 /*try:*/ {
jpayne@68 9203 __pyx_v_inf = __pyx_t_7;
jpayne@68 9204 __pyx_t_7 = 0;
jpayne@68 9205
jpayne@68 9206 /* "pysam/libcutils.pyx":417
jpayne@68 9207 * try:
jpayne@68 9208 * with open(fn, "r") as inf:
jpayne@68 9209 * out = inf.read() # <<<<<<<<<<<<<<
jpayne@68 9210 * except UnicodeDecodeError:
jpayne@68 9211 * with open(fn, "rb") as inf:
jpayne@68 9212 */
jpayne@68 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@68 9214 __Pyx_GOTREF(__pyx_t_5);
jpayne@68 9215 __pyx_t_1 = NULL;
jpayne@68 9216 __pyx_t_9 = 0;
jpayne@68 9217 #if CYTHON_UNPACK_METHODS
jpayne@68 9218 if (likely(PyMethod_Check(__pyx_t_5))) {
jpayne@68 9219 __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5);
jpayne@68 9220 if (likely(__pyx_t_1)) {
jpayne@68 9221 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
jpayne@68 9222 __Pyx_INCREF(__pyx_t_1);
jpayne@68 9223 __Pyx_INCREF(function);
jpayne@68 9224 __Pyx_DECREF_SET(__pyx_t_5, function);
jpayne@68 9225 __pyx_t_9 = 1;
jpayne@68 9226 }
jpayne@68 9227 }
jpayne@68 9228 #endif
jpayne@68 9229 {
jpayne@68 9230 PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL};
jpayne@68 9231 __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_9, 0+__pyx_t_9);
jpayne@68 9232 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
jpayne@68 9233 if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 417, __pyx_L16_error)
jpayne@68 9234 __Pyx_GOTREF(__pyx_t_7);
jpayne@68 9235 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
jpayne@68 9236 }
jpayne@68 9237 __Pyx_DECREF_SET(__pyx_v_out, __pyx_t_7);
jpayne@68 9238 __pyx_t_7 = 0;
jpayne@68 9239
jpayne@68 9240 /* "pysam/libcutils.pyx":416
jpayne@68 9241 * out = []
jpayne@68 9242 * try:
jpayne@68 9243 * with open(fn, "r") as inf: # <<<<<<<<<<<<<<
jpayne@68 9244 * out = inf.read()
jpayne@68 9245 * except UnicodeDecodeError:
jpayne@68 9246 */
jpayne@68 9247 }
jpayne@68 9248 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
jpayne@68 9249 __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
jpayne@68 9250 __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
jpayne@68 9251 goto __pyx_L21_try_end;
jpayne@68 9252 __pyx_L16_error:;
jpayne@68 9253 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
jpayne@68 9254 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
jpayne@68 9255 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
jpayne@68 9256 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
jpayne@68 9257 /*except:*/ {
jpayne@68 9258 __Pyx_AddTraceback("pysam.libcutils._pysam_dispatch._collect", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@68 9259 if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(0, 416, __pyx_L18_except_error)
jpayne@68 9260 __Pyx_XGOTREF(__pyx_t_7);
jpayne@68 9261 __Pyx_XGOTREF(__pyx_t_5);
jpayne@68 9262 __Pyx_XGOTREF(__pyx_t_1);
jpayne@68 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@68 9264 __Pyx_GOTREF(__pyx_t_8);
jpayne@68 9265 __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL);
jpayne@68 9266 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
jpayne@68 9267 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
jpayne@68 9268 if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 416, __pyx_L18_except_error)
jpayne@68 9269 __Pyx_GOTREF(__pyx_t_13);
jpayne@68 9270 __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_13);
jpayne@68 9271 __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
jpayne@68 9272 if (__pyx_t_14 < 0) __PYX_ERR(0, 416, __pyx_L18_except_error)
jpayne@68 9273 __pyx_t_15 = (!__pyx_t_14);
jpayne@68 9274 if (unlikely(__pyx_t_15)) {
jpayne@68 9275 __Pyx_GIVEREF(__pyx_t_7);
jpayne@68 9276 __Pyx_GIVEREF(__pyx_t_5);
jpayne@68 9277 __Pyx_XGIVEREF(__pyx_t_1);
jpayne@68 9278 __Pyx_ErrRestoreWithState(__pyx_t_7, __pyx_t_5, __pyx_t_1);
jpayne@68 9279 __pyx_t_7 = 0; __pyx_t_5 = 0; __pyx_t_1 = 0;
jpayne@68 9280 __PYX_ERR(0, 416, __pyx_L18_except_error)
jpayne@68 9281 }
jpayne@68 9282 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
jpayne@68 9283 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
jpayne@68 9284 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
jpayne@68 9285 goto __pyx_L17_exception_handled;
jpayne@68 9286 }
jpayne@68 9287 __pyx_L18_except_error:;
jpayne@68 9288 __Pyx_XGIVEREF(__pyx_t_10);
jpayne@68 9289 __Pyx_XGIVEREF(__pyx_t_11);
jpayne@68 9290 __Pyx_XGIVEREF(__pyx_t_12);
jpayne@68 9291 __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
jpayne@68 9292 goto __pyx_L6_error;
jpayne@68 9293 __pyx_L17_exception_handled:;
jpayne@68 9294 __Pyx_XGIVEREF(__pyx_t_10);
jpayne@68 9295 __Pyx_XGIVEREF(__pyx_t_11);
jpayne@68 9296 __Pyx_XGIVEREF(__pyx_t_12);
jpayne@68 9297 __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
jpayne@68 9298 __pyx_L21_try_end:;
jpayne@68 9299 }
jpayne@68 9300 }
jpayne@68 9301 /*finally:*/ {
jpayne@68 9302 /*normal exit:*/{
jpayne@68 9303 if (__pyx_t_6) {
jpayne@68 9304 __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__9, NULL);
jpayne@68 9305 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
jpayne@68 9306 if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 416, __pyx_L6_error)
jpayne@68 9307 __Pyx_GOTREF(__pyx_t_12);
jpayne@68 9308 __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
jpayne@68 9309 }
jpayne@68 9310 goto __pyx_L15;
jpayne@68 9311 }
jpayne@68 9312 __pyx_L15:;
jpayne@68 9313 }
jpayne@68 9314 goto __pyx_L25;
jpayne@68 9315 __pyx_L12_error:;
jpayne@68 9316 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
jpayne@68 9317 goto __pyx_L6_error;
jpayne@68 9318 __pyx_L25:;
jpayne@68 9319 }
jpayne@68 9320
jpayne@68 9321 /* "pysam/libcutils.pyx":415
jpayne@68 9322 * def _collect(fn):
jpayne@68 9323 * out = []
jpayne@68 9324 * try: # <<<<<<<<<<<<<<
jpayne@68 9325 * with open(fn, "r") as inf:
jpayne@68 9326 * out = inf.read()
jpayne@68 9327 */
jpayne@68 9328 }
jpayne@68 9329 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@68 9330 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@68 9331 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
jpayne@68 9332 goto __pyx_L11_try_end;
jpayne@68 9333 __pyx_L6_error:;
jpayne@68 9334 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
jpayne@68 9335 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
jpayne@68 9336 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
jpayne@68 9337 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
jpayne@68 9338
jpayne@68 9339 /* "pysam/libcutils.pyx":418
jpayne@68 9340 * with open(fn, "r") as inf:
jpayne@68 9341 * out = inf.read()
jpayne@68 9342 * except UnicodeDecodeError: # <<<<<<<<<<<<<<
jpayne@68 9343 * with open(fn, "rb") as inf:
jpayne@68 9344 * # read binary output
jpayne@68 9345 */
jpayne@68 9346 __pyx_t_16 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_UnicodeDecodeError);
jpayne@68 9347 if (__pyx_t_16) {
jpayne@68 9348 __Pyx_AddTraceback("pysam.libcutils._pysam_dispatch._collect", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@68 9349 if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_5, &__pyx_t_7) < 0) __PYX_ERR(0, 418, __pyx_L8_except_error)
jpayne@68 9350 __Pyx_XGOTREF(__pyx_t_1);
jpayne@68 9351 __Pyx_XGOTREF(__pyx_t_5);
jpayne@68 9352 __Pyx_XGOTREF(__pyx_t_7);
jpayne@68 9353
jpayne@68 9354 /* "pysam/libcutils.pyx":419
jpayne@68 9355 * out = inf.read()
jpayne@68 9356 * except UnicodeDecodeError:
jpayne@68 9357 * with open(fn, "rb") as inf: # <<<<<<<<<<<<<<
jpayne@68 9358 * # read binary output
jpayne@68 9359 * out = inf.read()
jpayne@68 9360 */
jpayne@68 9361 /*with:*/ {
jpayne@68 9362 __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 419, __pyx_L8_except_error)
jpayne@68 9363 __Pyx_GOTREF(__pyx_t_8);
jpayne@68 9364 __Pyx_INCREF(__pyx_v_fn);
jpayne@68 9365 __Pyx_GIVEREF(__pyx_v_fn);
jpayne@68 9366 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_fn)) __PYX_ERR(0, 419, __pyx_L8_except_error);
jpayne@68 9367 __Pyx_INCREF(__pyx_n_u_rb);
jpayne@68 9368 __Pyx_GIVEREF(__pyx_n_u_rb);
jpayne@68 9369 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_n_u_rb)) __PYX_ERR(0, 419, __pyx_L8_except_error);
jpayne@68 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@68 9371 __Pyx_GOTREF(__pyx_t_17);
jpayne@68 9372 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
jpayne@68 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@68 9374 __Pyx_GOTREF(__pyx_t_6);
jpayne@68 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@68 9376 __Pyx_GOTREF(__pyx_t_18);
jpayne@68 9377 __pyx_t_19 = NULL;
jpayne@68 9378 __pyx_t_9 = 0;
jpayne@68 9379 #if CYTHON_UNPACK_METHODS
jpayne@68 9380 if (likely(PyMethod_Check(__pyx_t_18))) {
jpayne@68 9381 __pyx_t_19 = PyMethod_GET_SELF(__pyx_t_18);
jpayne@68 9382 if (likely(__pyx_t_19)) {
jpayne@68 9383 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_18);
jpayne@68 9384 __Pyx_INCREF(__pyx_t_19);
jpayne@68 9385 __Pyx_INCREF(function);
jpayne@68 9386 __Pyx_DECREF_SET(__pyx_t_18, function);
jpayne@68 9387 __pyx_t_9 = 1;
jpayne@68 9388 }
jpayne@68 9389 }
jpayne@68 9390 #endif
jpayne@68 9391 {
jpayne@68 9392 PyObject *__pyx_callargs[2] = {__pyx_t_19, NULL};
jpayne@68 9393 __pyx_t_8 = __Pyx_PyObject_FastCall(__pyx_t_18, __pyx_callargs+1-__pyx_t_9, 0+__pyx_t_9);
jpayne@68 9394 __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
jpayne@68 9395 if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 419, __pyx_L28_error)
jpayne@68 9396 __Pyx_GOTREF(__pyx_t_8);
jpayne@68 9397 __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
jpayne@68 9398 }
jpayne@68 9399 __pyx_t_18 = __pyx_t_8;
jpayne@68 9400 __pyx_t_8 = 0;
jpayne@68 9401 __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
jpayne@68 9402 /*try:*/ {
jpayne@68 9403 {
jpayne@68 9404 __Pyx_PyThreadState_declare
jpayne@68 9405 __Pyx_PyThreadState_assign
jpayne@68 9406 __Pyx_ExceptionSave(&__pyx_t_12, &__pyx_t_11, &__pyx_t_10);
jpayne@68 9407 __Pyx_XGOTREF(__pyx_t_12);
jpayne@68 9408 __Pyx_XGOTREF(__pyx_t_11);
jpayne@68 9409 __Pyx_XGOTREF(__pyx_t_10);
jpayne@68 9410 /*try:*/ {
jpayne@68 9411 __Pyx_XDECREF_SET(__pyx_v_inf, __pyx_t_18);
jpayne@68 9412 __pyx_t_18 = 0;
jpayne@68 9413
jpayne@68 9414 /* "pysam/libcutils.pyx":421
jpayne@68 9415 * with open(fn, "rb") as inf:
jpayne@68 9416 * # read binary output
jpayne@68 9417 * out = inf.read() # <<<<<<<<<<<<<<
jpayne@68 9418 * finally:
jpayne@68 9419 * os.remove(fn)
jpayne@68 9420 */
jpayne@68 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@68 9422 __Pyx_GOTREF(__pyx_t_17);
jpayne@68 9423 __pyx_t_8 = NULL;
jpayne@68 9424 __pyx_t_9 = 0;
jpayne@68 9425 #if CYTHON_UNPACK_METHODS
jpayne@68 9426 if (likely(PyMethod_Check(__pyx_t_17))) {
jpayne@68 9427 __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_17);
jpayne@68 9428 if (likely(__pyx_t_8)) {
jpayne@68 9429 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_17);
jpayne@68 9430 __Pyx_INCREF(__pyx_t_8);
jpayne@68 9431 __Pyx_INCREF(function);
jpayne@68 9432 __Pyx_DECREF_SET(__pyx_t_17, function);
jpayne@68 9433 __pyx_t_9 = 1;
jpayne@68 9434 }
jpayne@68 9435 }
jpayne@68 9436 #endif
jpayne@68 9437 {
jpayne@68 9438 PyObject *__pyx_callargs[2] = {__pyx_t_8, NULL};
jpayne@68 9439 __pyx_t_18 = __Pyx_PyObject_FastCall(__pyx_t_17, __pyx_callargs+1-__pyx_t_9, 0+__pyx_t_9);
jpayne@68 9440 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
jpayne@68 9441 if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 421, __pyx_L34_error)
jpayne@68 9442 __Pyx_GOTREF(__pyx_t_18);
jpayne@68 9443 __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
jpayne@68 9444 }
jpayne@68 9445 __Pyx_DECREF_SET(__pyx_v_out, __pyx_t_18);
jpayne@68 9446 __pyx_t_18 = 0;
jpayne@68 9447
jpayne@68 9448 /* "pysam/libcutils.pyx":419
jpayne@68 9449 * out = inf.read()
jpayne@68 9450 * except UnicodeDecodeError:
jpayne@68 9451 * with open(fn, "rb") as inf: # <<<<<<<<<<<<<<
jpayne@68 9452 * # read binary output
jpayne@68 9453 * out = inf.read()
jpayne@68 9454 */
jpayne@68 9455 }
jpayne@68 9456 __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
jpayne@68 9457 __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
jpayne@68 9458 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
jpayne@68 9459 goto __pyx_L41_try_end;
jpayne@68 9460 __pyx_L34_error:;
jpayne@68 9461 __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
jpayne@68 9462 __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
jpayne@68 9463 __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
jpayne@68 9464 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
jpayne@68 9465 /*except:*/ {
jpayne@68 9466 __Pyx_AddTraceback("pysam.libcutils._pysam_dispatch._collect", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@68 9467 if (__Pyx_GetException(&__pyx_t_18, &__pyx_t_17, &__pyx_t_8) < 0) __PYX_ERR(0, 419, __pyx_L36_except_error)
jpayne@68 9468 __Pyx_XGOTREF(__pyx_t_18);
jpayne@68 9469 __Pyx_XGOTREF(__pyx_t_17);
jpayne@68 9470 __Pyx_XGOTREF(__pyx_t_8);
jpayne@68 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@68 9472 __Pyx_GOTREF(__pyx_t_19);
jpayne@68 9473 __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_19, NULL);
jpayne@68 9474 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
jpayne@68 9475 __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
jpayne@68 9476 if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 419, __pyx_L36_except_error)
jpayne@68 9477 __Pyx_GOTREF(__pyx_t_13);
jpayne@68 9478 __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_13);
jpayne@68 9479 __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
jpayne@68 9480 if (__pyx_t_15 < 0) __PYX_ERR(0, 419, __pyx_L36_except_error)
jpayne@68 9481 __pyx_t_14 = (!__pyx_t_15);
jpayne@68 9482 if (unlikely(__pyx_t_14)) {
jpayne@68 9483 __Pyx_GIVEREF(__pyx_t_18);
jpayne@68 9484 __Pyx_GIVEREF(__pyx_t_17);
jpayne@68 9485 __Pyx_XGIVEREF(__pyx_t_8);
jpayne@68 9486 __Pyx_ErrRestoreWithState(__pyx_t_18, __pyx_t_17, __pyx_t_8);
jpayne@68 9487 __pyx_t_18 = 0; __pyx_t_17 = 0; __pyx_t_8 = 0;
jpayne@68 9488 __PYX_ERR(0, 419, __pyx_L36_except_error)
jpayne@68 9489 }
jpayne@68 9490 __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
jpayne@68 9491 __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
jpayne@68 9492 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
jpayne@68 9493 goto __pyx_L35_exception_handled;
jpayne@68 9494 }
jpayne@68 9495 __pyx_L36_except_error:;
jpayne@68 9496 __Pyx_XGIVEREF(__pyx_t_12);
jpayne@68 9497 __Pyx_XGIVEREF(__pyx_t_11);
jpayne@68 9498 __Pyx_XGIVEREF(__pyx_t_10);
jpayne@68 9499 __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_11, __pyx_t_10);
jpayne@68 9500 goto __pyx_L8_except_error;
jpayne@68 9501 __pyx_L35_exception_handled:;
jpayne@68 9502 __Pyx_XGIVEREF(__pyx_t_12);
jpayne@68 9503 __Pyx_XGIVEREF(__pyx_t_11);
jpayne@68 9504 __Pyx_XGIVEREF(__pyx_t_10);
jpayne@68 9505 __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_11, __pyx_t_10);
jpayne@68 9506 __pyx_L41_try_end:;
jpayne@68 9507 }
jpayne@68 9508 }
jpayne@68 9509 /*finally:*/ {
jpayne@68 9510 /*normal exit:*/{
jpayne@68 9511 if (__pyx_t_6) {
jpayne@68 9512 __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__9, NULL);
jpayne@68 9513 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
jpayne@68 9514 if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 419, __pyx_L8_except_error)
jpayne@68 9515 __Pyx_GOTREF(__pyx_t_10);
jpayne@68 9516 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
jpayne@68 9517 }
jpayne@68 9518 goto __pyx_L33;
jpayne@68 9519 }
jpayne@68 9520 __pyx_L33:;
jpayne@68 9521 }
jpayne@68 9522 goto __pyx_L45;
jpayne@68 9523 __pyx_L28_error:;
jpayne@68 9524 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
jpayne@68 9525 goto __pyx_L8_except_error;
jpayne@68 9526 __pyx_L45:;
jpayne@68 9527 }
jpayne@68 9528 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
jpayne@68 9529 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
jpayne@68 9530 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
jpayne@68 9531 goto __pyx_L7_exception_handled;
jpayne@68 9532 }
jpayne@68 9533 goto __pyx_L8_except_error;
jpayne@68 9534
jpayne@68 9535 /* "pysam/libcutils.pyx":415
jpayne@68 9536 * def _collect(fn):
jpayne@68 9537 * out = []
jpayne@68 9538 * try: # <<<<<<<<<<<<<<
jpayne@68 9539 * with open(fn, "r") as inf:
jpayne@68 9540 * out = inf.read()
jpayne@68 9541 */
jpayne@68 9542 __pyx_L8_except_error:;
jpayne@68 9543 __Pyx_XGIVEREF(__pyx_t_2);
jpayne@68 9544 __Pyx_XGIVEREF(__pyx_t_3);
jpayne@68 9545 __Pyx_XGIVEREF(__pyx_t_4);
jpayne@68 9546 __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
jpayne@68 9547 goto __pyx_L4_error;
jpayne@68 9548 __pyx_L7_exception_handled:;
jpayne@68 9549 __Pyx_XGIVEREF(__pyx_t_2);
jpayne@68 9550 __Pyx_XGIVEREF(__pyx_t_3);
jpayne@68 9551 __Pyx_XGIVEREF(__pyx_t_4);
jpayne@68 9552 __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
jpayne@68 9553 __pyx_L11_try_end:;
jpayne@68 9554 }
jpayne@68 9555 }
jpayne@68 9556
jpayne@68 9557 /* "pysam/libcutils.pyx":423
jpayne@68 9558 * out = inf.read()
jpayne@68 9559 * finally:
jpayne@68 9560 * os.remove(fn) # <<<<<<<<<<<<<<
jpayne@68 9561 * return out
jpayne@68 9562 *
jpayne@68 9563 */
jpayne@68 9564 /*finally:*/ {
jpayne@68 9565 /*normal exit:*/{
jpayne@68 9566 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_os); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 423, __pyx_L1_error)
jpayne@68 9567 __Pyx_GOTREF(__pyx_t_5);
jpayne@68 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@68 9569 __Pyx_GOTREF(__pyx_t_1);
jpayne@68 9570 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
jpayne@68 9571 __pyx_t_5 = NULL;
jpayne@68 9572 __pyx_t_9 = 0;
jpayne@68 9573 #if CYTHON_UNPACK_METHODS
jpayne@68 9574 if (unlikely(PyMethod_Check(__pyx_t_1))) {
jpayne@68 9575 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
jpayne@68 9576 if (likely(__pyx_t_5)) {
jpayne@68 9577 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
jpayne@68 9578 __Pyx_INCREF(__pyx_t_5);
jpayne@68 9579 __Pyx_INCREF(function);
jpayne@68 9580 __Pyx_DECREF_SET(__pyx_t_1, function);
jpayne@68 9581 __pyx_t_9 = 1;
jpayne@68 9582 }
jpayne@68 9583 }
jpayne@68 9584 #endif
jpayne@68 9585 {
jpayne@68 9586 PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_fn};
jpayne@68 9587 __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9);
jpayne@68 9588 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
jpayne@68 9589 if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 423, __pyx_L1_error)
jpayne@68 9590 __Pyx_GOTREF(__pyx_t_7);
jpayne@68 9591 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
jpayne@68 9592 }
jpayne@68 9593 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
jpayne@68 9594 goto __pyx_L5;
jpayne@68 9595 }
jpayne@68 9596 __pyx_L4_error:;
jpayne@68 9597 /*exception exit:*/{
jpayne@68 9598 __Pyx_PyThreadState_declare
jpayne@68 9599 __Pyx_PyThreadState_assign
jpayne@68 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@68 9601 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
jpayne@68 9602 __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0;
jpayne@68 9603 __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0;
jpayne@68 9604 __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0;
jpayne@68 9605 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
jpayne@68 9606 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
jpayne@68 9607 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
jpayne@68 9608 if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_6, &__pyx_t_10, &__pyx_t_11);
jpayne@68 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@68 9610 __Pyx_XGOTREF(__pyx_t_4);
jpayne@68 9611 __Pyx_XGOTREF(__pyx_t_3);
jpayne@68 9612 __Pyx_XGOTREF(__pyx_t_2);
jpayne@68 9613 __Pyx_XGOTREF(__pyx_t_6);
jpayne@68 9614 __Pyx_XGOTREF(__pyx_t_10);
jpayne@68 9615 __Pyx_XGOTREF(__pyx_t_11);
jpayne@68 9616 __pyx_t_16 = __pyx_lineno; __pyx_t_20 = __pyx_clineno; __pyx_t_21 = __pyx_filename;
jpayne@68 9617 {
jpayne@68 9618 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_os); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 423, __pyx_L47_error)
jpayne@68 9619 __Pyx_GOTREF(__pyx_t_1);
jpayne@68 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@68 9621 __Pyx_GOTREF(__pyx_t_5);
jpayne@68 9622 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
jpayne@68 9623 __pyx_t_1 = NULL;
jpayne@68 9624 __pyx_t_9 = 0;
jpayne@68 9625 #if CYTHON_UNPACK_METHODS
jpayne@68 9626 if (unlikely(PyMethod_Check(__pyx_t_5))) {
jpayne@68 9627 __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_5);
jpayne@68 9628 if (likely(__pyx_t_1)) {
jpayne@68 9629 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
jpayne@68 9630 __Pyx_INCREF(__pyx_t_1);
jpayne@68 9631 __Pyx_INCREF(function);
jpayne@68 9632 __Pyx_DECREF_SET(__pyx_t_5, function);
jpayne@68 9633 __pyx_t_9 = 1;
jpayne@68 9634 }
jpayne@68 9635 }
jpayne@68 9636 #endif
jpayne@68 9637 {
jpayne@68 9638 PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_v_fn};
jpayne@68 9639 __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9);
jpayne@68 9640 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
jpayne@68 9641 if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 423, __pyx_L47_error)
jpayne@68 9642 __Pyx_GOTREF(__pyx_t_7);
jpayne@68 9643 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
jpayne@68 9644 }
jpayne@68 9645 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
jpayne@68 9646 }
jpayne@68 9647 if (PY_MAJOR_VERSION >= 3) {
jpayne@68 9648 __Pyx_XGIVEREF(__pyx_t_6);
jpayne@68 9649 __Pyx_XGIVEREF(__pyx_t_10);
jpayne@68 9650 __Pyx_XGIVEREF(__pyx_t_11);
jpayne@68 9651 __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_10, __pyx_t_11);
jpayne@68 9652 }
jpayne@68 9653 __Pyx_XGIVEREF(__pyx_t_4);
jpayne@68 9654 __Pyx_XGIVEREF(__pyx_t_3);
jpayne@68 9655 __Pyx_XGIVEREF(__pyx_t_2);
jpayne@68 9656 __Pyx_ErrRestore(__pyx_t_4, __pyx_t_3, __pyx_t_2);
jpayne@68 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@68 9658 __pyx_lineno = __pyx_t_16; __pyx_clineno = __pyx_t_20; __pyx_filename = __pyx_t_21;
jpayne@68 9659 goto __pyx_L1_error;
jpayne@68 9660 __pyx_L47_error:;
jpayne@68 9661 if (PY_MAJOR_VERSION >= 3) {
jpayne@68 9662 __Pyx_XGIVEREF(__pyx_t_6);
jpayne@68 9663 __Pyx_XGIVEREF(__pyx_t_10);
jpayne@68 9664 __Pyx_XGIVEREF(__pyx_t_11);
jpayne@68 9665 __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_10, __pyx_t_11);
jpayne@68 9666 }
jpayne@68 9667 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
jpayne@68 9668 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@68 9669 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@68 9670 __pyx_t_6 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0;
jpayne@68 9671 goto __pyx_L1_error;
jpayne@68 9672 }
jpayne@68 9673 __pyx_L5:;
jpayne@68 9674 }
jpayne@68 9675
jpayne@68 9676 /* "pysam/libcutils.pyx":424
jpayne@68 9677 * finally:
jpayne@68 9678 * os.remove(fn)
jpayne@68 9679 * return out # <<<<<<<<<<<<<<
jpayne@68 9680 *
jpayne@68 9681 * out_stderr = _collect(stderr_f)
jpayne@68 9682 */
jpayne@68 9683 __Pyx_XDECREF(__pyx_r);
jpayne@68 9684 __Pyx_INCREF(__pyx_v_out);
jpayne@68 9685 __pyx_r = __pyx_v_out;
jpayne@68 9686 goto __pyx_L0;
jpayne@68 9687
jpayne@68 9688 /* "pysam/libcutils.pyx":413
jpayne@68 9689 *
jpayne@68 9690 * # get error messages
jpayne@68 9691 * def _collect(fn): # <<<<<<<<<<<<<<
jpayne@68 9692 * out = []
jpayne@68 9693 * try:
jpayne@68 9694 */
jpayne@68 9695
jpayne@68 9696 /* function exit code */
jpayne@68 9697 __pyx_L1_error:;
jpayne@68 9698 __Pyx_XDECREF(__pyx_t_1);
jpayne@68 9699 __Pyx_XDECREF(__pyx_t_5);
jpayne@68 9700 __Pyx_XDECREF(__pyx_t_7);
jpayne@68 9701 __Pyx_XDECREF(__pyx_t_8);
jpayne@68 9702 __Pyx_XDECREF(__pyx_t_17);
jpayne@68 9703 __Pyx_XDECREF(__pyx_t_18);
jpayne@68 9704 __Pyx_XDECREF(__pyx_t_19);
jpayne@68 9705 __Pyx_AddTraceback("pysam.libcutils._pysam_dispatch._collect", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@68 9706 __pyx_r = NULL;
jpayne@68 9707 __pyx_L0:;
jpayne@68 9708 __Pyx_XDECREF(__pyx_v_out);
jpayne@68 9709 __Pyx_XDECREF(__pyx_v_inf);
jpayne@68 9710 __Pyx_XGIVEREF(__pyx_r);
jpayne@68 9711 __Pyx_RefNannyFinishContext();
jpayne@68 9712 return __pyx_r;
jpayne@68 9713 }
jpayne@68 9714
jpayne@68 9715 /* "pysam/libcutils.pyx":276
jpayne@68 9716 *
jpayne@68 9717 *
jpayne@68 9718 * def _pysam_dispatch(collection, # <<<<<<<<<<<<<<
jpayne@68 9719 * method,
jpayne@68 9720 * args=None,
jpayne@68 9721 */
jpayne@68 9722
jpayne@68 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@68 9724 PyObject *__pyx_v_ARGUMENTS = NULL;
jpayne@68 9725 int __pyx_v_skip_next;
jpayne@68 9726 PyObject *__pyx_v_arg = NULL;
jpayne@68 9727 PyObject *__pyx_v_stderr_h = NULL;
jpayne@68 9728 PyObject *__pyx_v_stderr_f = NULL;
jpayne@68 9729 PyObject *__pyx_v_stdout_f = NULL;
jpayne@68 9730 PyObject *__pyx_v_stdout_h = NULL;
jpayne@68 9731 PyObject *__pyx_v_MAP_STDOUT_OPTIONS = NULL;
jpayne@68 9732 PyObject *__pyx_v_stdout_option = NULL;
jpayne@68 9733 char **__pyx_v_cargs;
jpayne@68 9734 int __pyx_v_i;
jpayne@68 9735 int __pyx_v_n;
jpayne@68 9736 int __pyx_v_retval;
jpayne@68 9737 int __pyx_v_l;
jpayne@68 9738 int __pyx_v_extra_args;
jpayne@68 9739 PyObject *__pyx_v__collect = 0;
jpayne@68 9740 PyObject *__pyx_v_out_stderr = NULL;
jpayne@68 9741 PyObject *__pyx_v_out_stdout = NULL;
jpayne@68 9742 PyObject *__pyx_8genexpr2__pyx_v_a = NULL;
jpayne@68 9743 PyObject *__pyx_r = NULL;
jpayne@68 9744 __Pyx_RefNannyDeclarations
jpayne@68 9745 int __pyx_t_1;
jpayne@68 9746 int __pyx_t_2;
jpayne@68 9747 PyObject *__pyx_t_3 = NULL;
jpayne@68 9748 Py_ssize_t __pyx_t_4;
jpayne@68 9749 PyObject *(*__pyx_t_5)(PyObject *);
jpayne@68 9750 PyObject *__pyx_t_6 = NULL;
jpayne@68 9751 PyObject *__pyx_t_7 = NULL;
jpayne@68 9752 PyObject *__pyx_t_8 = NULL;
jpayne@68 9753 unsigned int __pyx_t_9;
jpayne@68 9754 PyObject *(*__pyx_t_10)(PyObject *);
jpayne@68 9755 char const *__pyx_t_11;
jpayne@68 9756 char const *__pyx_t_12;
jpayne@68 9757 char const *__pyx_t_13;
jpayne@68 9758 int __pyx_t_14;
jpayne@68 9759 PyObject *__pyx_t_15 = NULL;
jpayne@68 9760 PyObject *__pyx_t_16 = NULL;
jpayne@68 9761 char *__pyx_t_17;
jpayne@68 9762 int __pyx_t_18;
jpayne@68 9763 char const *__pyx_t_19;
jpayne@68 9764 int __pyx_lineno = 0;
jpayne@68 9765 const char *__pyx_filename = NULL;
jpayne@68 9766 int __pyx_clineno = 0;
jpayne@68 9767 __Pyx_RefNannySetupContext("_pysam_dispatch", 0);
jpayne@68 9768 __Pyx_INCREF(__pyx_v_collection);
jpayne@68 9769 __Pyx_INCREF(__pyx_v_method);
jpayne@68 9770 __Pyx_INCREF(__pyx_v_args);
jpayne@68 9771
jpayne@68 9772 /* "pysam/libcutils.pyx":294
jpayne@68 9773 * '''
jpayne@68 9774 *
jpayne@68 9775 * if method == "index" and args: # <<<<<<<<<<<<<<
jpayne@68 9776 * # We make sure that at least the first specified input file exists,
jpayne@68 9777 * # and if it doesn't we raise an IOError.
jpayne@68 9778 */
jpayne@68 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@68 9780 if (__pyx_t_2) {
jpayne@68 9781 } else {
jpayne@68 9782 __pyx_t_1 = __pyx_t_2;
jpayne@68 9783 goto __pyx_L4_bool_binop_done;
jpayne@68 9784 }
jpayne@68 9785 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_args); if (unlikely((__pyx_t_2 < 0))) __PYX_ERR(0, 294, __pyx_L1_error)
jpayne@68 9786 __pyx_t_1 = __pyx_t_2;
jpayne@68 9787 __pyx_L4_bool_binop_done:;
jpayne@68 9788 if (__pyx_t_1) {
jpayne@68 9789
jpayne@68 9790 /* "pysam/libcutils.pyx":297
jpayne@68 9791 * # We make sure that at least the first specified input file exists,
jpayne@68 9792 * # and if it doesn't we raise an IOError.
jpayne@68 9793 * ARGUMENTS = ['-m', '--min-shift', '-o', '--output', '--output-file', '-@', '--threads'] # <<<<<<<<<<<<<<
jpayne@68 9794 * skip_next = False
jpayne@68 9795 * for arg in args:
jpayne@68 9796 */
jpayne@68 9797 __pyx_t_3 = PyList_New(7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 297, __pyx_L1_error)
jpayne@68 9798 __Pyx_GOTREF(__pyx_t_3);
jpayne@68 9799 __Pyx_INCREF(__pyx_kp_u_m);
jpayne@68 9800 __Pyx_GIVEREF(__pyx_kp_u_m);
jpayne@68 9801 if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_m)) __PYX_ERR(0, 297, __pyx_L1_error);
jpayne@68 9802 __Pyx_INCREF(__pyx_kp_u_min_shift);
jpayne@68 9803 __Pyx_GIVEREF(__pyx_kp_u_min_shift);
jpayne@68 9804 if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 1, __pyx_kp_u_min_shift)) __PYX_ERR(0, 297, __pyx_L1_error);
jpayne@68 9805 __Pyx_INCREF(__pyx_kp_u_o);
jpayne@68 9806 __Pyx_GIVEREF(__pyx_kp_u_o);
jpayne@68 9807 if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u_o)) __PYX_ERR(0, 297, __pyx_L1_error);
jpayne@68 9808 __Pyx_INCREF(__pyx_kp_u_output);
jpayne@68 9809 __Pyx_GIVEREF(__pyx_kp_u_output);
jpayne@68 9810 if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 3, __pyx_kp_u_output)) __PYX_ERR(0, 297, __pyx_L1_error);
jpayne@68 9811 __Pyx_INCREF(__pyx_kp_u_output_file);
jpayne@68 9812 __Pyx_GIVEREF(__pyx_kp_u_output_file);
jpayne@68 9813 if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 4, __pyx_kp_u_output_file)) __PYX_ERR(0, 297, __pyx_L1_error);
jpayne@68 9814 __Pyx_INCREF(__pyx_kp_u__10);
jpayne@68 9815 __Pyx_GIVEREF(__pyx_kp_u__10);
jpayne@68 9816 if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 5, __pyx_kp_u__10)) __PYX_ERR(0, 297, __pyx_L1_error);
jpayne@68 9817 __Pyx_INCREF(__pyx_kp_u_threads);
jpayne@68 9818 __Pyx_GIVEREF(__pyx_kp_u_threads);
jpayne@68 9819 if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 6, __pyx_kp_u_threads)) __PYX_ERR(0, 297, __pyx_L1_error);
jpayne@68 9820 __pyx_v_ARGUMENTS = ((PyObject*)__pyx_t_3);
jpayne@68 9821 __pyx_t_3 = 0;
jpayne@68 9822
jpayne@68 9823 /* "pysam/libcutils.pyx":298
jpayne@68 9824 * # and if it doesn't we raise an IOError.
jpayne@68 9825 * ARGUMENTS = ['-m', '--min-shift', '-o', '--output', '--output-file', '-@', '--threads']
jpayne@68 9826 * skip_next = False # <<<<<<<<<<<<<<
jpayne@68 9827 * for arg in args:
jpayne@68 9828 * if skip_next:
jpayne@68 9829 */
jpayne@68 9830 __pyx_v_skip_next = 0;
jpayne@68 9831
jpayne@68 9832 /* "pysam/libcutils.pyx":299
jpayne@68 9833 * ARGUMENTS = ['-m', '--min-shift', '-o', '--output', '--output-file', '-@', '--threads']
jpayne@68 9834 * skip_next = False
jpayne@68 9835 * for arg in args: # <<<<<<<<<<<<<<
jpayne@68 9836 * if skip_next:
jpayne@68 9837 * skip_next = False
jpayne@68 9838 */
jpayne@68 9839 if (likely(PyList_CheckExact(__pyx_v_args)) || PyTuple_CheckExact(__pyx_v_args)) {
jpayne@68 9840 __pyx_t_3 = __pyx_v_args; __Pyx_INCREF(__pyx_t_3);
jpayne@68 9841 __pyx_t_4 = 0;
jpayne@68 9842 __pyx_t_5 = NULL;
jpayne@68 9843 } else {
jpayne@68 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@68 9845 __Pyx_GOTREF(__pyx_t_3);
jpayne@68 9846 __pyx_t_5 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 299, __pyx_L1_error)
jpayne@68 9847 }
jpayne@68 9848 for (;;) {
jpayne@68 9849 if (likely(!__pyx_t_5)) {
jpayne@68 9850 if (likely(PyList_CheckExact(__pyx_t_3))) {
jpayne@68 9851 {
jpayne@68 9852 Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_3);
jpayne@68 9853 #if !CYTHON_ASSUME_SAFE_MACROS
jpayne@68 9854 if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 299, __pyx_L1_error)
jpayne@68 9855 #endif
jpayne@68 9856 if (__pyx_t_4 >= __pyx_temp) break;
jpayne@68 9857 }
jpayne@68 9858 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
jpayne@68 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@68 9860 #else
jpayne@68 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@68 9862 __Pyx_GOTREF(__pyx_t_6);
jpayne@68 9863 #endif
jpayne@68 9864 } else {
jpayne@68 9865 {
jpayne@68 9866 Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_3);
jpayne@68 9867 #if !CYTHON_ASSUME_SAFE_MACROS
jpayne@68 9868 if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 299, __pyx_L1_error)
jpayne@68 9869 #endif
jpayne@68 9870 if (__pyx_t_4 >= __pyx_temp) break;
jpayne@68 9871 }
jpayne@68 9872 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
jpayne@68 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@68 9874 #else
jpayne@68 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@68 9876 __Pyx_GOTREF(__pyx_t_6);
jpayne@68 9877 #endif
jpayne@68 9878 }
jpayne@68 9879 } else {
jpayne@68 9880 __pyx_t_6 = __pyx_t_5(__pyx_t_3);
jpayne@68 9881 if (unlikely(!__pyx_t_6)) {
jpayne@68 9882 PyObject* exc_type = PyErr_Occurred();
jpayne@68 9883 if (exc_type) {
jpayne@68 9884 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
jpayne@68 9885 else __PYX_ERR(0, 299, __pyx_L1_error)
jpayne@68 9886 }
jpayne@68 9887 break;
jpayne@68 9888 }
jpayne@68 9889 __Pyx_GOTREF(__pyx_t_6);
jpayne@68 9890 }
jpayne@68 9891 __Pyx_XDECREF_SET(__pyx_v_arg, __pyx_t_6);
jpayne@68 9892 __pyx_t_6 = 0;
jpayne@68 9893
jpayne@68 9894 /* "pysam/libcutils.pyx":300
jpayne@68 9895 * skip_next = False
jpayne@68 9896 * for arg in args:
jpayne@68 9897 * if skip_next: # <<<<<<<<<<<<<<
jpayne@68 9898 * skip_next = False
jpayne@68 9899 * continue
jpayne@68 9900 */
jpayne@68 9901 if (__pyx_v_skip_next) {
jpayne@68 9902
jpayne@68 9903 /* "pysam/libcutils.pyx":301
jpayne@68 9904 * for arg in args:
jpayne@68 9905 * if skip_next:
jpayne@68 9906 * skip_next = False # <<<<<<<<<<<<<<
jpayne@68 9907 * continue
jpayne@68 9908 * if arg.startswith('-'):
jpayne@68 9909 */
jpayne@68 9910 __pyx_v_skip_next = 0;
jpayne@68 9911
jpayne@68 9912 /* "pysam/libcutils.pyx":302
jpayne@68 9913 * if skip_next:
jpayne@68 9914 * skip_next = False
jpayne@68 9915 * continue # <<<<<<<<<<<<<<
jpayne@68 9916 * if arg.startswith('-'):
jpayne@68 9917 * # Skip next argument for e.g. '--min-shift' '12' or '-m' '12' but not '-m12'
jpayne@68 9918 */
jpayne@68 9919 goto __pyx_L6_continue;
jpayne@68 9920
jpayne@68 9921 /* "pysam/libcutils.pyx":300
jpayne@68 9922 * skip_next = False
jpayne@68 9923 * for arg in args:
jpayne@68 9924 * if skip_next: # <<<<<<<<<<<<<<
jpayne@68 9925 * skip_next = False
jpayne@68 9926 * continue
jpayne@68 9927 */
jpayne@68 9928 }
jpayne@68 9929
jpayne@68 9930 /* "pysam/libcutils.pyx":303
jpayne@68 9931 * skip_next = False
jpayne@68 9932 * continue
jpayne@68 9933 * if arg.startswith('-'): # <<<<<<<<<<<<<<
jpayne@68 9934 * # Skip next argument for e.g. '--min-shift' '12' or '-m' '12' but not '-m12'
jpayne@68 9935 * if arg in ARGUMENTS:
jpayne@68 9936 */
jpayne@68 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@68 9938 __Pyx_GOTREF(__pyx_t_7);
jpayne@68 9939 __pyx_t_8 = NULL;
jpayne@68 9940 __pyx_t_9 = 0;
jpayne@68 9941 #if CYTHON_UNPACK_METHODS
jpayne@68 9942 if (likely(PyMethod_Check(__pyx_t_7))) {
jpayne@68 9943 __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
jpayne@68 9944 if (likely(__pyx_t_8)) {
jpayne@68 9945 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
jpayne@68 9946 __Pyx_INCREF(__pyx_t_8);
jpayne@68 9947 __Pyx_INCREF(function);
jpayne@68 9948 __Pyx_DECREF_SET(__pyx_t_7, function);
jpayne@68 9949 __pyx_t_9 = 1;
jpayne@68 9950 }
jpayne@68 9951 }
jpayne@68 9952 #endif
jpayne@68 9953 {
jpayne@68 9954 PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_kp_u__8};
jpayne@68 9955 __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9);
jpayne@68 9956 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
jpayne@68 9957 if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 303, __pyx_L1_error)
jpayne@68 9958 __Pyx_GOTREF(__pyx_t_6);
jpayne@68 9959 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
jpayne@68 9960 }
jpayne@68 9961 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 303, __pyx_L1_error)
jpayne@68 9962 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
jpayne@68 9963 if (__pyx_t_1) {
jpayne@68 9964
jpayne@68 9965 /* "pysam/libcutils.pyx":305
jpayne@68 9966 * if arg.startswith('-'):
jpayne@68 9967 * # Skip next argument for e.g. '--min-shift' '12' or '-m' '12' but not '-m12'
jpayne@68 9968 * if arg in ARGUMENTS: # <<<<<<<<<<<<<<
jpayne@68 9969 * skip_next = True
jpayne@68 9970 * continue
jpayne@68 9971 */
jpayne@68 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@68 9973 if (__pyx_t_1) {
jpayne@68 9974
jpayne@68 9975 /* "pysam/libcutils.pyx":306
jpayne@68 9976 * # Skip next argument for e.g. '--min-shift' '12' or '-m' '12' but not '-m12'
jpayne@68 9977 * if arg in ARGUMENTS:
jpayne@68 9978 * skip_next = True # <<<<<<<<<<<<<<
jpayne@68 9979 * continue
jpayne@68 9980 * if not os.path.exists(arg):
jpayne@68 9981 */
jpayne@68 9982 __pyx_v_skip_next = 1;
jpayne@68 9983
jpayne@68 9984 /* "pysam/libcutils.pyx":305
jpayne@68 9985 * if arg.startswith('-'):
jpayne@68 9986 * # Skip next argument for e.g. '--min-shift' '12' or '-m' '12' but not '-m12'
jpayne@68 9987 * if arg in ARGUMENTS: # <<<<<<<<<<<<<<
jpayne@68 9988 * skip_next = True
jpayne@68 9989 * continue
jpayne@68 9990 */
jpayne@68 9991 }
jpayne@68 9992
jpayne@68 9993 /* "pysam/libcutils.pyx":307
jpayne@68 9994 * if arg in ARGUMENTS:
jpayne@68 9995 * skip_next = True
jpayne@68 9996 * continue # <<<<<<<<<<<<<<
jpayne@68 9997 * if not os.path.exists(arg):
jpayne@68 9998 * raise IOError("No such file or directory: '%s'" % arg)
jpayne@68 9999 */
jpayne@68 10000 goto __pyx_L6_continue;
jpayne@68 10001
jpayne@68 10002 /* "pysam/libcutils.pyx":303
jpayne@68 10003 * skip_next = False
jpayne@68 10004 * continue
jpayne@68 10005 * if arg.startswith('-'): # <<<<<<<<<<<<<<
jpayne@68 10006 * # Skip next argument for e.g. '--min-shift' '12' or '-m' '12' but not '-m12'
jpayne@68 10007 * if arg in ARGUMENTS:
jpayne@68 10008 */
jpayne@68 10009 }
jpayne@68 10010
jpayne@68 10011 /* "pysam/libcutils.pyx":308
jpayne@68 10012 * skip_next = True
jpayne@68 10013 * continue
jpayne@68 10014 * if not os.path.exists(arg): # <<<<<<<<<<<<<<
jpayne@68 10015 * raise IOError("No such file or directory: '%s'" % arg)
jpayne@68 10016 * else:
jpayne@68 10017 */
jpayne@68 10018 __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_os); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 308, __pyx_L1_error)
jpayne@68 10019 __Pyx_GOTREF(__pyx_t_7);
jpayne@68 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@68 10021 __Pyx_GOTREF(__pyx_t_8);
jpayne@68 10022 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
jpayne@68 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@68 10024 __Pyx_GOTREF(__pyx_t_7);
jpayne@68 10025 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
jpayne@68 10026 __pyx_t_8 = NULL;
jpayne@68 10027 __pyx_t_9 = 0;
jpayne@68 10028 #if CYTHON_UNPACK_METHODS
jpayne@68 10029 if (likely(PyMethod_Check(__pyx_t_7))) {
jpayne@68 10030 __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
jpayne@68 10031 if (likely(__pyx_t_8)) {
jpayne@68 10032 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
jpayne@68 10033 __Pyx_INCREF(__pyx_t_8);
jpayne@68 10034 __Pyx_INCREF(function);
jpayne@68 10035 __Pyx_DECREF_SET(__pyx_t_7, function);
jpayne@68 10036 __pyx_t_9 = 1;
jpayne@68 10037 }
jpayne@68 10038 }
jpayne@68 10039 #endif
jpayne@68 10040 {
jpayne@68 10041 PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_v_arg};
jpayne@68 10042 __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9);
jpayne@68 10043 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
jpayne@68 10044 if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 308, __pyx_L1_error)
jpayne@68 10045 __Pyx_GOTREF(__pyx_t_6);
jpayne@68 10046 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
jpayne@68 10047 }
jpayne@68 10048 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 308, __pyx_L1_error)
jpayne@68 10049 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
jpayne@68 10050 __pyx_t_2 = (!__pyx_t_1);
jpayne@68 10051 if (unlikely(__pyx_t_2)) {
jpayne@68 10052
jpayne@68 10053 /* "pysam/libcutils.pyx":309
jpayne@68 10054 * continue
jpayne@68 10055 * if not os.path.exists(arg):
jpayne@68 10056 * raise IOError("No such file or directory: '%s'" % arg) # <<<<<<<<<<<<<<
jpayne@68 10057 * else:
jpayne@68 10058 * break
jpayne@68 10059 */
jpayne@68 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@68 10061 __Pyx_GOTREF(__pyx_t_6);
jpayne@68 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@68 10063 __Pyx_GOTREF(__pyx_t_7);
jpayne@68 10064 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
jpayne@68 10065 __Pyx_Raise(__pyx_t_7, 0, 0, 0);
jpayne@68 10066 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
jpayne@68 10067 __PYX_ERR(0, 309, __pyx_L1_error)
jpayne@68 10068
jpayne@68 10069 /* "pysam/libcutils.pyx":308
jpayne@68 10070 * skip_next = True
jpayne@68 10071 * continue
jpayne@68 10072 * if not os.path.exists(arg): # <<<<<<<<<<<<<<
jpayne@68 10073 * raise IOError("No such file or directory: '%s'" % arg)
jpayne@68 10074 * else:
jpayne@68 10075 */
jpayne@68 10076 }
jpayne@68 10077
jpayne@68 10078 /* "pysam/libcutils.pyx":311
jpayne@68 10079 * raise IOError("No such file or directory: '%s'" % arg)
jpayne@68 10080 * else:
jpayne@68 10081 * break # <<<<<<<<<<<<<<
jpayne@68 10082 *
jpayne@68 10083 * if args is None:
jpayne@68 10084 */
jpayne@68 10085 /*else*/ {
jpayne@68 10086 goto __pyx_L7_break;
jpayne@68 10087 }
jpayne@68 10088
jpayne@68 10089 /* "pysam/libcutils.pyx":299
jpayne@68 10090 * ARGUMENTS = ['-m', '--min-shift', '-o', '--output', '--output-file', '-@', '--threads']
jpayne@68 10091 * skip_next = False
jpayne@68 10092 * for arg in args: # <<<<<<<<<<<<<<
jpayne@68 10093 * if skip_next:
jpayne@68 10094 * skip_next = False
jpayne@68 10095 */
jpayne@68 10096 __pyx_L6_continue:;
jpayne@68 10097 }
jpayne@68 10098 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@68 10099 goto __pyx_L12_for_end;
jpayne@68 10100 __pyx_L7_break:;
jpayne@68 10101 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@68 10102 goto __pyx_L12_for_end;
jpayne@68 10103 __pyx_L12_for_end:;
jpayne@68 10104
jpayne@68 10105 /* "pysam/libcutils.pyx":294
jpayne@68 10106 * '''
jpayne@68 10107 *
jpayne@68 10108 * if method == "index" and args: # <<<<<<<<<<<<<<
jpayne@68 10109 * # We make sure that at least the first specified input file exists,
jpayne@68 10110 * # and if it doesn't we raise an IOError.
jpayne@68 10111 */
jpayne@68 10112 }
jpayne@68 10113
jpayne@68 10114 /* "pysam/libcutils.pyx":313
jpayne@68 10115 * break
jpayne@68 10116 *
jpayne@68 10117 * if args is None: # <<<<<<<<<<<<<<
jpayne@68 10118 * args = []
jpayne@68 10119 * else:
jpayne@68 10120 */
jpayne@68 10121 __pyx_t_2 = (__pyx_v_args == Py_None);
jpayne@68 10122 if (__pyx_t_2) {
jpayne@68 10123
jpayne@68 10124 /* "pysam/libcutils.pyx":314
jpayne@68 10125 *
jpayne@68 10126 * if args is None:
jpayne@68 10127 * args = [] # <<<<<<<<<<<<<<
jpayne@68 10128 * else:
jpayne@68 10129 * args = list(args)
jpayne@68 10130 */
jpayne@68 10131 __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 314, __pyx_L1_error)
jpayne@68 10132 __Pyx_GOTREF(__pyx_t_3);
jpayne@68 10133 __Pyx_DECREF_SET(__pyx_v_args, __pyx_t_3);
jpayne@68 10134 __pyx_t_3 = 0;
jpayne@68 10135
jpayne@68 10136 /* "pysam/libcutils.pyx":313
jpayne@68 10137 * break
jpayne@68 10138 *
jpayne@68 10139 * if args is None: # <<<<<<<<<<<<<<
jpayne@68 10140 * args = []
jpayne@68 10141 * else:
jpayne@68 10142 */
jpayne@68 10143 goto __pyx_L13;
jpayne@68 10144 }
jpayne@68 10145
jpayne@68 10146 /* "pysam/libcutils.pyx":316
jpayne@68 10147 * args = []
jpayne@68 10148 * else:
jpayne@68 10149 * args = list(args) # <<<<<<<<<<<<<<
jpayne@68 10150 *
jpayne@68 10151 * # redirect stderr to file
jpayne@68 10152 */
jpayne@68 10153 /*else*/ {
jpayne@68 10154 __pyx_t_3 = PySequence_List(__pyx_v_args); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 316, __pyx_L1_error)
jpayne@68 10155 __Pyx_GOTREF(__pyx_t_3);
jpayne@68 10156 __Pyx_DECREF_SET(__pyx_v_args, __pyx_t_3);
jpayne@68 10157 __pyx_t_3 = 0;
jpayne@68 10158 }
jpayne@68 10159 __pyx_L13:;
jpayne@68 10160
jpayne@68 10161 /* "pysam/libcutils.pyx":319
jpayne@68 10162 *
jpayne@68 10163 * # redirect stderr to file
jpayne@68 10164 * stderr_h, stderr_f = tempfile.mkstemp() # <<<<<<<<<<<<<<
jpayne@68 10165 *
jpayne@68 10166 * # redirect stdout to file
jpayne@68 10167 */
jpayne@68 10168 __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_tempfile); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 319, __pyx_L1_error)
jpayne@68 10169 __Pyx_GOTREF(__pyx_t_7);
jpayne@68 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@68 10171 __Pyx_GOTREF(__pyx_t_6);
jpayne@68 10172 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
jpayne@68 10173 __pyx_t_7 = NULL;
jpayne@68 10174 __pyx_t_9 = 0;
jpayne@68 10175 #if CYTHON_UNPACK_METHODS
jpayne@68 10176 if (unlikely(PyMethod_Check(__pyx_t_6))) {
jpayne@68 10177 __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
jpayne@68 10178 if (likely(__pyx_t_7)) {
jpayne@68 10179 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
jpayne@68 10180 __Pyx_INCREF(__pyx_t_7);
jpayne@68 10181 __Pyx_INCREF(function);
jpayne@68 10182 __Pyx_DECREF_SET(__pyx_t_6, function);
jpayne@68 10183 __pyx_t_9 = 1;
jpayne@68 10184 }
jpayne@68 10185 }
jpayne@68 10186 #endif
jpayne@68 10187 {
jpayne@68 10188 PyObject *__pyx_callargs[2] = {__pyx_t_7, NULL};
jpayne@68 10189 __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_9, 0+__pyx_t_9);
jpayne@68 10190 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
jpayne@68 10191 if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 319, __pyx_L1_error)
jpayne@68 10192 __Pyx_GOTREF(__pyx_t_3);
jpayne@68 10193 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
jpayne@68 10194 }
jpayne@68 10195 if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
jpayne@68 10196 PyObject* sequence = __pyx_t_3;
jpayne@68 10197 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
jpayne@68 10198 if (unlikely(size != 2)) {
jpayne@68 10199 if (size > 2) __Pyx_RaiseTooManyValuesError(2);
jpayne@68 10200 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
jpayne@68 10201 __PYX_ERR(0, 319, __pyx_L1_error)
jpayne@68 10202 }
jpayne@68 10203 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
jpayne@68 10204 if (likely(PyTuple_CheckExact(sequence))) {
jpayne@68 10205 __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0);
jpayne@68 10206 __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1);
jpayne@68 10207 } else {
jpayne@68 10208 __pyx_t_6 = PyList_GET_ITEM(sequence, 0);
jpayne@68 10209 __pyx_t_7 = PyList_GET_ITEM(sequence, 1);
jpayne@68 10210 }
jpayne@68 10211 __Pyx_INCREF(__pyx_t_6);
jpayne@68 10212 __Pyx_INCREF(__pyx_t_7);
jpayne@68 10213 #else
jpayne@68 10214 __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 319, __pyx_L1_error)
jpayne@68 10215 __Pyx_GOTREF(__pyx_t_6);
jpayne@68 10216 __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 319, __pyx_L1_error)
jpayne@68 10217 __Pyx_GOTREF(__pyx_t_7);
jpayne@68 10218 #endif
jpayne@68 10219 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@68 10220 } else {
jpayne@68 10221 Py_ssize_t index = -1;
jpayne@68 10222 __pyx_t_8 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 319, __pyx_L1_error)
jpayne@68 10223 __Pyx_GOTREF(__pyx_t_8);
jpayne@68 10224 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@68 10225 __pyx_t_10 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_8);
jpayne@68 10226 index = 0; __pyx_t_6 = __pyx_t_10(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L14_unpacking_failed;
jpayne@68 10227 __Pyx_GOTREF(__pyx_t_6);
jpayne@68 10228 index = 1; __pyx_t_7 = __pyx_t_10(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L14_unpacking_failed;
jpayne@68 10229 __Pyx_GOTREF(__pyx_t_7);
jpayne@68 10230 if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_8), 2) < 0) __PYX_ERR(0, 319, __pyx_L1_error)
jpayne@68 10231 __pyx_t_10 = NULL;
jpayne@68 10232 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
jpayne@68 10233 goto __pyx_L15_unpacking_done;
jpayne@68 10234 __pyx_L14_unpacking_failed:;
jpayne@68 10235 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
jpayne@68 10236 __pyx_t_10 = NULL;
jpayne@68 10237 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
jpayne@68 10238 __PYX_ERR(0, 319, __pyx_L1_error)
jpayne@68 10239 __pyx_L15_unpacking_done:;
jpayne@68 10240 }
jpayne@68 10241 __pyx_v_stderr_h = __pyx_t_6;
jpayne@68 10242 __pyx_t_6 = 0;
jpayne@68 10243 __pyx_v_stderr_f = __pyx_t_7;
jpayne@68 10244 __pyx_t_7 = 0;
jpayne@68 10245
jpayne@68 10246 /* "pysam/libcutils.pyx":322
jpayne@68 10247 *
jpayne@68 10248 * # redirect stdout to file
jpayne@68 10249 * if save_stdout: # <<<<<<<<<<<<<<
jpayne@68 10250 * stdout_f = save_stdout
jpayne@68 10251 * stdout_h = c_open(force_bytes(stdout_f),
jpayne@68 10252 */
jpayne@68 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@68 10254 if (__pyx_t_2) {
jpayne@68 10255
jpayne@68 10256 /* "pysam/libcutils.pyx":323
jpayne@68 10257 * # redirect stdout to file
jpayne@68 10258 * if save_stdout:
jpayne@68 10259 * stdout_f = save_stdout # <<<<<<<<<<<<<<
jpayne@68 10260 * stdout_h = c_open(force_bytes(stdout_f),
jpayne@68 10261 * O_WRONLY|O_CREAT|O_TRUNC, 0666)
jpayne@68 10262 */
jpayne@68 10263 __Pyx_INCREF(__pyx_v_save_stdout);
jpayne@68 10264 __pyx_v_stdout_f = __pyx_v_save_stdout;
jpayne@68 10265
jpayne@68 10266 /* "pysam/libcutils.pyx":324
jpayne@68 10267 * if save_stdout:
jpayne@68 10268 * stdout_f = save_stdout
jpayne@68 10269 * stdout_h = c_open(force_bytes(stdout_f), # <<<<<<<<<<<<<<
jpayne@68 10270 * O_WRONLY|O_CREAT|O_TRUNC, 0666)
jpayne@68 10271 * if stdout_h == -1:
jpayne@68 10272 */
jpayne@68 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@68 10274 __Pyx_GOTREF(__pyx_t_3);
jpayne@68 10275 if (unlikely(__pyx_t_3 == Py_None)) {
jpayne@68 10276 PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
jpayne@68 10277 __PYX_ERR(0, 324, __pyx_L1_error)
jpayne@68 10278 }
jpayne@68 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@68 10280
jpayne@68 10281 /* "pysam/libcutils.pyx":325
jpayne@68 10282 * stdout_f = save_stdout
jpayne@68 10283 * stdout_h = c_open(force_bytes(stdout_f),
jpayne@68 10284 * O_WRONLY|O_CREAT|O_TRUNC, 0666) # <<<<<<<<<<<<<<
jpayne@68 10285 * if stdout_h == -1:
jpayne@68 10286 * raise OSError(errno, "error while opening file for writing", stdout_f)
jpayne@68 10287 */
jpayne@68 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@68 10289 __Pyx_GOTREF(__pyx_t_7);
jpayne@68 10290 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@68 10291 __pyx_v_stdout_h = __pyx_t_7;
jpayne@68 10292 __pyx_t_7 = 0;
jpayne@68 10293
jpayne@68 10294 /* "pysam/libcutils.pyx":326
jpayne@68 10295 * stdout_h = c_open(force_bytes(stdout_f),
jpayne@68 10296 * O_WRONLY|O_CREAT|O_TRUNC, 0666)
jpayne@68 10297 * if stdout_h == -1: # <<<<<<<<<<<<<<
jpayne@68 10298 * raise OSError(errno, "error while opening file for writing", stdout_f)
jpayne@68 10299 *
jpayne@68 10300 */
jpayne@68 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@68 10302 if (unlikely(__pyx_t_2)) {
jpayne@68 10303
jpayne@68 10304 /* "pysam/libcutils.pyx":327
jpayne@68 10305 * O_WRONLY|O_CREAT|O_TRUNC, 0666)
jpayne@68 10306 * if stdout_h == -1:
jpayne@68 10307 * raise OSError(errno, "error while opening file for writing", stdout_f) # <<<<<<<<<<<<<<
jpayne@68 10308 *
jpayne@68 10309 * samtools_set_stdout_fn(force_bytes(stdout_f))
jpayne@68 10310 */
jpayne@68 10311 __pyx_t_7 = __Pyx_PyInt_From_int(errno); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 327, __pyx_L1_error)
jpayne@68 10312 __Pyx_GOTREF(__pyx_t_7);
jpayne@68 10313 __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 327, __pyx_L1_error)
jpayne@68 10314 __Pyx_GOTREF(__pyx_t_3);
jpayne@68 10315 __Pyx_GIVEREF(__pyx_t_7);
jpayne@68 10316 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_7)) __PYX_ERR(0, 327, __pyx_L1_error);
jpayne@68 10317 __Pyx_INCREF(__pyx_kp_u_error_while_opening_file_for_wri);
jpayne@68 10318 __Pyx_GIVEREF(__pyx_kp_u_error_while_opening_file_for_wri);
jpayne@68 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@68 10320 __Pyx_INCREF(__pyx_v_stdout_f);
jpayne@68 10321 __Pyx_GIVEREF(__pyx_v_stdout_f);
jpayne@68 10322 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_stdout_f)) __PYX_ERR(0, 327, __pyx_L1_error);
jpayne@68 10323 __pyx_t_7 = 0;
jpayne@68 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@68 10325 __Pyx_GOTREF(__pyx_t_7);
jpayne@68 10326 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@68 10327 __Pyx_Raise(__pyx_t_7, 0, 0, 0);
jpayne@68 10328 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
jpayne@68 10329 __PYX_ERR(0, 327, __pyx_L1_error)
jpayne@68 10330
jpayne@68 10331 /* "pysam/libcutils.pyx":326
jpayne@68 10332 * stdout_h = c_open(force_bytes(stdout_f),
jpayne@68 10333 * O_WRONLY|O_CREAT|O_TRUNC, 0666)
jpayne@68 10334 * if stdout_h == -1: # <<<<<<<<<<<<<<
jpayne@68 10335 * raise OSError(errno, "error while opening file for writing", stdout_f)
jpayne@68 10336 *
jpayne@68 10337 */
jpayne@68 10338 }
jpayne@68 10339
jpayne@68 10340 /* "pysam/libcutils.pyx":329
jpayne@68 10341 * raise OSError(errno, "error while opening file for writing", stdout_f)
jpayne@68 10342 *
jpayne@68 10343 * samtools_set_stdout_fn(force_bytes(stdout_f)) # <<<<<<<<<<<<<<
jpayne@68 10344 * bcftools_set_stdout_fn(force_bytes(stdout_f))
jpayne@68 10345 *
jpayne@68 10346 */
jpayne@68 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@68 10348 __Pyx_GOTREF(__pyx_t_7);
jpayne@68 10349 if (unlikely(__pyx_t_7 == Py_None)) {
jpayne@68 10350 PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
jpayne@68 10351 __PYX_ERR(0, 329, __pyx_L1_error)
jpayne@68 10352 }
jpayne@68 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@68 10354 samtools_set_stdout_fn(__pyx_t_12);
jpayne@68 10355 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
jpayne@68 10356
jpayne@68 10357 /* "pysam/libcutils.pyx":330
jpayne@68 10358 *
jpayne@68 10359 * samtools_set_stdout_fn(force_bytes(stdout_f))
jpayne@68 10360 * bcftools_set_stdout_fn(force_bytes(stdout_f)) # <<<<<<<<<<<<<<
jpayne@68 10361 *
jpayne@68 10362 * elif catch_stdout:
jpayne@68 10363 */
jpayne@68 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@68 10365 __Pyx_GOTREF(__pyx_t_7);
jpayne@68 10366 if (unlikely(__pyx_t_7 == Py_None)) {
jpayne@68 10367 PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
jpayne@68 10368 __PYX_ERR(0, 330, __pyx_L1_error)
jpayne@68 10369 }
jpayne@68 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@68 10371 bcftools_set_stdout_fn(__pyx_t_13);
jpayne@68 10372 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
jpayne@68 10373
jpayne@68 10374 /* "pysam/libcutils.pyx":322
jpayne@68 10375 *
jpayne@68 10376 * # redirect stdout to file
jpayne@68 10377 * if save_stdout: # <<<<<<<<<<<<<<
jpayne@68 10378 * stdout_f = save_stdout
jpayne@68 10379 * stdout_h = c_open(force_bytes(stdout_f),
jpayne@68 10380 */
jpayne@68 10381 goto __pyx_L16;
jpayne@68 10382 }
jpayne@68 10383
jpayne@68 10384 /* "pysam/libcutils.pyx":332
jpayne@68 10385 * bcftools_set_stdout_fn(force_bytes(stdout_f))
jpayne@68 10386 *
jpayne@68 10387 * elif catch_stdout: # <<<<<<<<<<<<<<
jpayne@68 10388 * stdout_h, stdout_f = tempfile.mkstemp()
jpayne@68 10389 * MAP_STDOUT_OPTIONS = {
jpayne@68 10390 */
jpayne@68 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@68 10392 if (__pyx_t_2) {
jpayne@68 10393
jpayne@68 10394 /* "pysam/libcutils.pyx":333
jpayne@68 10395 *
jpayne@68 10396 * elif catch_stdout:
jpayne@68 10397 * stdout_h, stdout_f = tempfile.mkstemp() # <<<<<<<<<<<<<<
jpayne@68 10398 * MAP_STDOUT_OPTIONS = {
jpayne@68 10399 * "samtools": {
jpayne@68 10400 */
jpayne@68 10401 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_tempfile); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 333, __pyx_L1_error)
jpayne@68 10402 __Pyx_GOTREF(__pyx_t_3);
jpayne@68 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@68 10404 __Pyx_GOTREF(__pyx_t_6);
jpayne@68 10405 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@68 10406 __pyx_t_3 = NULL;
jpayne@68 10407 __pyx_t_9 = 0;
jpayne@68 10408 #if CYTHON_UNPACK_METHODS
jpayne@68 10409 if (unlikely(PyMethod_Check(__pyx_t_6))) {
jpayne@68 10410 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6);
jpayne@68 10411 if (likely(__pyx_t_3)) {
jpayne@68 10412 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
jpayne@68 10413 __Pyx_INCREF(__pyx_t_3);
jpayne@68 10414 __Pyx_INCREF(function);
jpayne@68 10415 __Pyx_DECREF_SET(__pyx_t_6, function);
jpayne@68 10416 __pyx_t_9 = 1;
jpayne@68 10417 }
jpayne@68 10418 }
jpayne@68 10419 #endif
jpayne@68 10420 {
jpayne@68 10421 PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
jpayne@68 10422 __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_9, 0+__pyx_t_9);
jpayne@68 10423 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@68 10424 if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 333, __pyx_L1_error)
jpayne@68 10425 __Pyx_GOTREF(__pyx_t_7);
jpayne@68 10426 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
jpayne@68 10427 }
jpayne@68 10428 if ((likely(PyTuple_CheckExact(__pyx_t_7))) || (PyList_CheckExact(__pyx_t_7))) {
jpayne@68 10429 PyObject* sequence = __pyx_t_7;
jpayne@68 10430 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
jpayne@68 10431 if (unlikely(size != 2)) {
jpayne@68 10432 if (size > 2) __Pyx_RaiseTooManyValuesError(2);
jpayne@68 10433 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
jpayne@68 10434 __PYX_ERR(0, 333, __pyx_L1_error)
jpayne@68 10435 }
jpayne@68 10436 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
jpayne@68 10437 if (likely(PyTuple_CheckExact(sequence))) {
jpayne@68 10438 __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0);
jpayne@68 10439 __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
jpayne@68 10440 } else {
jpayne@68 10441 __pyx_t_6 = PyList_GET_ITEM(sequence, 0);
jpayne@68 10442 __pyx_t_3 = PyList_GET_ITEM(sequence, 1);
jpayne@68 10443 }
jpayne@68 10444 __Pyx_INCREF(__pyx_t_6);
jpayne@68 10445 __Pyx_INCREF(__pyx_t_3);
jpayne@68 10446 #else
jpayne@68 10447 __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 333, __pyx_L1_error)
jpayne@68 10448 __Pyx_GOTREF(__pyx_t_6);
jpayne@68 10449 __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 333, __pyx_L1_error)
jpayne@68 10450 __Pyx_GOTREF(__pyx_t_3);
jpayne@68 10451 #endif
jpayne@68 10452 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
jpayne@68 10453 } else {
jpayne@68 10454 Py_ssize_t index = -1;
jpayne@68 10455 __pyx_t_8 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 333, __pyx_L1_error)
jpayne@68 10456 __Pyx_GOTREF(__pyx_t_8);
jpayne@68 10457 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
jpayne@68 10458 __pyx_t_10 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_8);
jpayne@68 10459 index = 0; __pyx_t_6 = __pyx_t_10(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L18_unpacking_failed;
jpayne@68 10460 __Pyx_GOTREF(__pyx_t_6);
jpayne@68 10461 index = 1; __pyx_t_3 = __pyx_t_10(__pyx_t_8); if (unlikely(!__pyx_t_3)) goto __pyx_L18_unpacking_failed;
jpayne@68 10462 __Pyx_GOTREF(__pyx_t_3);
jpayne@68 10463 if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_8), 2) < 0) __PYX_ERR(0, 333, __pyx_L1_error)
jpayne@68 10464 __pyx_t_10 = NULL;
jpayne@68 10465 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
jpayne@68 10466 goto __pyx_L19_unpacking_done;
jpayne@68 10467 __pyx_L18_unpacking_failed:;
jpayne@68 10468 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
jpayne@68 10469 __pyx_t_10 = NULL;
jpayne@68 10470 if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
jpayne@68 10471 __PYX_ERR(0, 333, __pyx_L1_error)
jpayne@68 10472 __pyx_L19_unpacking_done:;
jpayne@68 10473 }
jpayne@68 10474 __pyx_v_stdout_h = __pyx_t_6;
jpayne@68 10475 __pyx_t_6 = 0;
jpayne@68 10476 __pyx_v_stdout_f = __pyx_t_3;
jpayne@68 10477 __pyx_t_3 = 0;
jpayne@68 10478
jpayne@68 10479 /* "pysam/libcutils.pyx":335
jpayne@68 10480 * stdout_h, stdout_f = tempfile.mkstemp()
jpayne@68 10481 * MAP_STDOUT_OPTIONS = {
jpayne@68 10482 * "samtools": { # <<<<<<<<<<<<<<
jpayne@68 10483 * "view": "-o {}",
jpayne@68 10484 * "mpileup": "-o {}",
jpayne@68 10485 */
jpayne@68 10486 __pyx_t_7 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 335, __pyx_L1_error)
jpayne@68 10487 __Pyx_GOTREF(__pyx_t_7);
jpayne@68 10488
jpayne@68 10489 /* "pysam/libcutils.pyx":336
jpayne@68 10490 * MAP_STDOUT_OPTIONS = {
jpayne@68 10491 * "samtools": {
jpayne@68 10492 * "view": "-o {}", # <<<<<<<<<<<<<<
jpayne@68 10493 * "mpileup": "-o {}",
jpayne@68 10494 * "depad": "-o {}",
jpayne@68 10495 */
jpayne@68 10496 __pyx_t_3 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 336, __pyx_L1_error)
jpayne@68 10497 __Pyx_GOTREF(__pyx_t_3);
jpayne@68 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@68 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@68 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@68 10501 if (PyDict_SetItem(__pyx_t_3, __pyx_n_u_calmd, __pyx_kp_u_) < 0) __PYX_ERR(0, 336, __pyx_L1_error)
jpayne@68 10502 if (PyDict_SetItem(__pyx_t_7, __pyx_n_u_samtools, __pyx_t_3) < 0) __PYX_ERR(0, 335, __pyx_L1_error)
jpayne@68 10503 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@68 10504
jpayne@68 10505 /* "pysam/libcutils.pyx":341
jpayne@68 10506 * "calmd": "", # uses pysam_stdout_fn
jpayne@68 10507 * },
jpayne@68 10508 * "bcftools": {} # <<<<<<<<<<<<<<
jpayne@68 10509 * }
jpayne@68 10510 *
jpayne@68 10511 */
jpayne@68 10512 __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 341, __pyx_L1_error)
jpayne@68 10513 __Pyx_GOTREF(__pyx_t_3);
jpayne@68 10514 if (PyDict_SetItem(__pyx_t_7, __pyx_n_u_bcftools, __pyx_t_3) < 0) __PYX_ERR(0, 335, __pyx_L1_error)
jpayne@68 10515 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@68 10516 __pyx_v_MAP_STDOUT_OPTIONS = ((PyObject*)__pyx_t_7);
jpayne@68 10517 __pyx_t_7 = 0;
jpayne@68 10518
jpayne@68 10519 /* "pysam/libcutils.pyx":344
jpayne@68 10520 * }
jpayne@68 10521 *
jpayne@68 10522 * stdout_option = None # <<<<<<<<<<<<<<
jpayne@68 10523 * if collection == "bcftools":
jpayne@68 10524 * # in bcftools, most methods accept -o, the exceptions
jpayne@68 10525 */
jpayne@68 10526 __Pyx_INCREF(Py_None);
jpayne@68 10527 __pyx_v_stdout_option = Py_None;
jpayne@68 10528
jpayne@68 10529 /* "pysam/libcutils.pyx":345
jpayne@68 10530 *
jpayne@68 10531 * stdout_option = None
jpayne@68 10532 * if collection == "bcftools": # <<<<<<<<<<<<<<
jpayne@68 10533 * # in bcftools, most methods accept -o, the exceptions
jpayne@68 10534 * # are below:
jpayne@68 10535 */
jpayne@68 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@68 10537 if (__pyx_t_2) {
jpayne@68 10538
jpayne@68 10539 /* "pysam/libcutils.pyx":348
jpayne@68 10540 * # in bcftools, most methods accept -o, the exceptions
jpayne@68 10541 * # are below:
jpayne@68 10542 * if method not in ("head", "index", "roh", "stats"): # <<<<<<<<<<<<<<
jpayne@68 10543 * stdout_option = "-o {}"
jpayne@68 10544 * elif method in MAP_STDOUT_OPTIONS[collection]:
jpayne@68 10545 */
jpayne@68 10546 __Pyx_INCREF(__pyx_v_method);
jpayne@68 10547 __pyx_t_7 = __pyx_v_method;
jpayne@68 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@68 10549 if (__pyx_t_1) {
jpayne@68 10550 } else {
jpayne@68 10551 __pyx_t_2 = __pyx_t_1;
jpayne@68 10552 goto __pyx_L22_bool_binop_done;
jpayne@68 10553 }
jpayne@68 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@68 10555 if (__pyx_t_1) {
jpayne@68 10556 } else {
jpayne@68 10557 __pyx_t_2 = __pyx_t_1;
jpayne@68 10558 goto __pyx_L22_bool_binop_done;
jpayne@68 10559 }
jpayne@68 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@68 10561 if (__pyx_t_1) {
jpayne@68 10562 } else {
jpayne@68 10563 __pyx_t_2 = __pyx_t_1;
jpayne@68 10564 goto __pyx_L22_bool_binop_done;
jpayne@68 10565 }
jpayne@68 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@68 10567 __pyx_t_2 = __pyx_t_1;
jpayne@68 10568 __pyx_L22_bool_binop_done:;
jpayne@68 10569 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
jpayne@68 10570 __pyx_t_1 = __pyx_t_2;
jpayne@68 10571 if (__pyx_t_1) {
jpayne@68 10572
jpayne@68 10573 /* "pysam/libcutils.pyx":349
jpayne@68 10574 * # are below:
jpayne@68 10575 * if method not in ("head", "index", "roh", "stats"):
jpayne@68 10576 * stdout_option = "-o {}" # <<<<<<<<<<<<<<
jpayne@68 10577 * elif method in MAP_STDOUT_OPTIONS[collection]:
jpayne@68 10578 * # special case - samtools view -c outputs on stdout
jpayne@68 10579 */
jpayne@68 10580 __Pyx_INCREF(__pyx_kp_u_o_2);
jpayne@68 10581 __Pyx_DECREF_SET(__pyx_v_stdout_option, __pyx_kp_u_o_2);
jpayne@68 10582
jpayne@68 10583 /* "pysam/libcutils.pyx":348
jpayne@68 10584 * # in bcftools, most methods accept -o, the exceptions
jpayne@68 10585 * # are below:
jpayne@68 10586 * if method not in ("head", "index", "roh", "stats"): # <<<<<<<<<<<<<<
jpayne@68 10587 * stdout_option = "-o {}"
jpayne@68 10588 * elif method in MAP_STDOUT_OPTIONS[collection]:
jpayne@68 10589 */
jpayne@68 10590 }
jpayne@68 10591
jpayne@68 10592 /* "pysam/libcutils.pyx":345
jpayne@68 10593 *
jpayne@68 10594 * stdout_option = None
jpayne@68 10595 * if collection == "bcftools": # <<<<<<<<<<<<<<
jpayne@68 10596 * # in bcftools, most methods accept -o, the exceptions
jpayne@68 10597 * # are below:
jpayne@68 10598 */
jpayne@68 10599 goto __pyx_L20;
jpayne@68 10600 }
jpayne@68 10601
jpayne@68 10602 /* "pysam/libcutils.pyx":350
jpayne@68 10603 * if method not in ("head", "index", "roh", "stats"):
jpayne@68 10604 * stdout_option = "-o {}"
jpayne@68 10605 * elif method in MAP_STDOUT_OPTIONS[collection]: # <<<<<<<<<<<<<<
jpayne@68 10606 * # special case - samtools view -c outputs on stdout
jpayne@68 10607 * if not(method == "view" and "-c" in args):
jpayne@68 10608 */
jpayne@68 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@68 10610 __Pyx_GOTREF(__pyx_t_7);
jpayne@68 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@68 10612 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
jpayne@68 10613 if (__pyx_t_1) {
jpayne@68 10614
jpayne@68 10615 /* "pysam/libcutils.pyx":352
jpayne@68 10616 * elif method in MAP_STDOUT_OPTIONS[collection]:
jpayne@68 10617 * # special case - samtools view -c outputs on stdout
jpayne@68 10618 * if not(method == "view" and "-c" in args): # <<<<<<<<<<<<<<
jpayne@68 10619 * stdout_option = MAP_STDOUT_OPTIONS[collection][method]
jpayne@68 10620 *
jpayne@68 10621 */
jpayne@68 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@68 10623 if (__pyx_t_2) {
jpayne@68 10624 } else {
jpayne@68 10625 __pyx_t_1 = __pyx_t_2;
jpayne@68 10626 goto __pyx_L27_bool_binop_done;
jpayne@68 10627 }
jpayne@68 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@68 10629 __pyx_t_1 = __pyx_t_2;
jpayne@68 10630 __pyx_L27_bool_binop_done:;
jpayne@68 10631 __pyx_t_2 = (!__pyx_t_1);
jpayne@68 10632 if (__pyx_t_2) {
jpayne@68 10633
jpayne@68 10634 /* "pysam/libcutils.pyx":353
jpayne@68 10635 * # special case - samtools view -c outputs on stdout
jpayne@68 10636 * if not(method == "view" and "-c" in args):
jpayne@68 10637 * stdout_option = MAP_STDOUT_OPTIONS[collection][method] # <<<<<<<<<<<<<<
jpayne@68 10638 *
jpayne@68 10639 * if stdout_option is not None and not is_usage:
jpayne@68 10640 */
jpayne@68 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@68 10642 __Pyx_GOTREF(__pyx_t_7);
jpayne@68 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@68 10644 __Pyx_GOTREF(__pyx_t_3);
jpayne@68 10645 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
jpayne@68 10646 __Pyx_DECREF_SET(__pyx_v_stdout_option, __pyx_t_3);
jpayne@68 10647 __pyx_t_3 = 0;
jpayne@68 10648
jpayne@68 10649 /* "pysam/libcutils.pyx":352
jpayne@68 10650 * elif method in MAP_STDOUT_OPTIONS[collection]:
jpayne@68 10651 * # special case - samtools view -c outputs on stdout
jpayne@68 10652 * if not(method == "view" and "-c" in args): # <<<<<<<<<<<<<<
jpayne@68 10653 * stdout_option = MAP_STDOUT_OPTIONS[collection][method]
jpayne@68 10654 *
jpayne@68 10655 */
jpayne@68 10656 }
jpayne@68 10657
jpayne@68 10658 /* "pysam/libcutils.pyx":350
jpayne@68 10659 * if method not in ("head", "index", "roh", "stats"):
jpayne@68 10660 * stdout_option = "-o {}"
jpayne@68 10661 * elif method in MAP_STDOUT_OPTIONS[collection]: # <<<<<<<<<<<<<<
jpayne@68 10662 * # special case - samtools view -c outputs on stdout
jpayne@68 10663 * if not(method == "view" and "-c" in args):
jpayne@68 10664 */
jpayne@68 10665 }
jpayne@68 10666 __pyx_L20:;
jpayne@68 10667
jpayne@68 10668 /* "pysam/libcutils.pyx":355
jpayne@68 10669 * stdout_option = MAP_STDOUT_OPTIONS[collection][method]
jpayne@68 10670 *
jpayne@68 10671 * if stdout_option is not None and not is_usage: # <<<<<<<<<<<<<<
jpayne@68 10672 * os.close(stdout_h)
jpayne@68 10673 * samtools_set_stdout_fn(force_bytes(stdout_f))
jpayne@68 10674 */
jpayne@68 10675 __pyx_t_1 = (__pyx_v_stdout_option != Py_None);
jpayne@68 10676 if (__pyx_t_1) {
jpayne@68 10677 } else {
jpayne@68 10678 __pyx_t_2 = __pyx_t_1;
jpayne@68 10679 goto __pyx_L30_bool_binop_done;
jpayne@68 10680 }
jpayne@68 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@68 10682 __pyx_t_14 = (!__pyx_t_1);
jpayne@68 10683 __pyx_t_2 = __pyx_t_14;
jpayne@68 10684 __pyx_L30_bool_binop_done:;
jpayne@68 10685 if (__pyx_t_2) {
jpayne@68 10686
jpayne@68 10687 /* "pysam/libcutils.pyx":356
jpayne@68 10688 *
jpayne@68 10689 * if stdout_option is not None and not is_usage:
jpayne@68 10690 * os.close(stdout_h) # <<<<<<<<<<<<<<
jpayne@68 10691 * samtools_set_stdout_fn(force_bytes(stdout_f))
jpayne@68 10692 * bcftools_set_stdout_fn(force_bytes(stdout_f))
jpayne@68 10693 */
jpayne@68 10694 __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_os); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 356, __pyx_L1_error)
jpayne@68 10695 __Pyx_GOTREF(__pyx_t_7);
jpayne@68 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@68 10697 __Pyx_GOTREF(__pyx_t_6);
jpayne@68 10698 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
jpayne@68 10699 __pyx_t_7 = NULL;
jpayne@68 10700 __pyx_t_9 = 0;
jpayne@68 10701 #if CYTHON_UNPACK_METHODS
jpayne@68 10702 if (unlikely(PyMethod_Check(__pyx_t_6))) {
jpayne@68 10703 __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
jpayne@68 10704 if (likely(__pyx_t_7)) {
jpayne@68 10705 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
jpayne@68 10706 __Pyx_INCREF(__pyx_t_7);
jpayne@68 10707 __Pyx_INCREF(function);
jpayne@68 10708 __Pyx_DECREF_SET(__pyx_t_6, function);
jpayne@68 10709 __pyx_t_9 = 1;
jpayne@68 10710 }
jpayne@68 10711 }
jpayne@68 10712 #endif
jpayne@68 10713 {
jpayne@68 10714 PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_v_stdout_h};
jpayne@68 10715 __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9);
jpayne@68 10716 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
jpayne@68 10717 if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 356, __pyx_L1_error)
jpayne@68 10718 __Pyx_GOTREF(__pyx_t_3);
jpayne@68 10719 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
jpayne@68 10720 }
jpayne@68 10721 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@68 10722
jpayne@68 10723 /* "pysam/libcutils.pyx":357
jpayne@68 10724 * if stdout_option is not None and not is_usage:
jpayne@68 10725 * os.close(stdout_h)
jpayne@68 10726 * samtools_set_stdout_fn(force_bytes(stdout_f)) # <<<<<<<<<<<<<<
jpayne@68 10727 * bcftools_set_stdout_fn(force_bytes(stdout_f))
jpayne@68 10728 * args.extend(stdout_option.format(stdout_f).split(" "))
jpayne@68 10729 */
jpayne@68 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@68 10731 __Pyx_GOTREF(__pyx_t_3);
jpayne@68 10732 if (unlikely(__pyx_t_3 == Py_None)) {
jpayne@68 10733 PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
jpayne@68 10734 __PYX_ERR(0, 357, __pyx_L1_error)
jpayne@68 10735 }
jpayne@68 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@68 10737 samtools_set_stdout_fn(__pyx_t_12);
jpayne@68 10738 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@68 10739
jpayne@68 10740 /* "pysam/libcutils.pyx":358
jpayne@68 10741 * os.close(stdout_h)
jpayne@68 10742 * samtools_set_stdout_fn(force_bytes(stdout_f))
jpayne@68 10743 * bcftools_set_stdout_fn(force_bytes(stdout_f)) # <<<<<<<<<<<<<<
jpayne@68 10744 * args.extend(stdout_option.format(stdout_f).split(" "))
jpayne@68 10745 * stdout_h = c_open(b"/dev/null", O_WRONLY)
jpayne@68 10746 */
jpayne@68 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@68 10748 __Pyx_GOTREF(__pyx_t_3);
jpayne@68 10749 if (unlikely(__pyx_t_3 == Py_None)) {
jpayne@68 10750 PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
jpayne@68 10751 __PYX_ERR(0, 358, __pyx_L1_error)
jpayne@68 10752 }
jpayne@68 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@68 10754 bcftools_set_stdout_fn(__pyx_t_13);
jpayne@68 10755 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@68 10756
jpayne@68 10757 /* "pysam/libcutils.pyx":359
jpayne@68 10758 * samtools_set_stdout_fn(force_bytes(stdout_f))
jpayne@68 10759 * bcftools_set_stdout_fn(force_bytes(stdout_f))
jpayne@68 10760 * args.extend(stdout_option.format(stdout_f).split(" ")) # <<<<<<<<<<<<<<
jpayne@68 10761 * stdout_h = c_open(b"/dev/null", O_WRONLY)
jpayne@68 10762 * else:
jpayne@68 10763 */
jpayne@68 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@68 10765 __Pyx_GOTREF(__pyx_t_6);
jpayne@68 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@68 10767 __Pyx_GOTREF(__pyx_t_15);
jpayne@68 10768 __pyx_t_16 = NULL;
jpayne@68 10769 __pyx_t_9 = 0;
jpayne@68 10770 #if CYTHON_UNPACK_METHODS
jpayne@68 10771 if (likely(PyMethod_Check(__pyx_t_15))) {
jpayne@68 10772 __pyx_t_16 = PyMethod_GET_SELF(__pyx_t_15);
jpayne@68 10773 if (likely(__pyx_t_16)) {
jpayne@68 10774 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
jpayne@68 10775 __Pyx_INCREF(__pyx_t_16);
jpayne@68 10776 __Pyx_INCREF(function);
jpayne@68 10777 __Pyx_DECREF_SET(__pyx_t_15, function);
jpayne@68 10778 __pyx_t_9 = 1;
jpayne@68 10779 }
jpayne@68 10780 }
jpayne@68 10781 #endif
jpayne@68 10782 {
jpayne@68 10783 PyObject *__pyx_callargs[2] = {__pyx_t_16, __pyx_v_stdout_f};
jpayne@68 10784 __pyx_t_8 = __Pyx_PyObject_FastCall(__pyx_t_15, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9);
jpayne@68 10785 __Pyx_XDECREF(__pyx_t_16); __pyx_t_16 = 0;
jpayne@68 10786 if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 359, __pyx_L1_error)
jpayne@68 10787 __Pyx_GOTREF(__pyx_t_8);
jpayne@68 10788 __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
jpayne@68 10789 }
jpayne@68 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@68 10791 __Pyx_GOTREF(__pyx_t_15);
jpayne@68 10792 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
jpayne@68 10793 __pyx_t_8 = NULL;
jpayne@68 10794 __pyx_t_9 = 0;
jpayne@68 10795 #if CYTHON_UNPACK_METHODS
jpayne@68 10796 if (likely(PyMethod_Check(__pyx_t_15))) {
jpayne@68 10797 __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_15);
jpayne@68 10798 if (likely(__pyx_t_8)) {
jpayne@68 10799 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
jpayne@68 10800 __Pyx_INCREF(__pyx_t_8);
jpayne@68 10801 __Pyx_INCREF(function);
jpayne@68 10802 __Pyx_DECREF_SET(__pyx_t_15, function);
jpayne@68 10803 __pyx_t_9 = 1;
jpayne@68 10804 }
jpayne@68 10805 }
jpayne@68 10806 #endif
jpayne@68 10807 {
jpayne@68 10808 PyObject *__pyx_callargs[2] = {__pyx_t_8, __pyx_kp_u__11};
jpayne@68 10809 __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_15, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9);
jpayne@68 10810 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
jpayne@68 10811 if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 359, __pyx_L1_error)
jpayne@68 10812 __Pyx_GOTREF(__pyx_t_7);
jpayne@68 10813 __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
jpayne@68 10814 }
jpayne@68 10815 __pyx_t_15 = NULL;
jpayne@68 10816 __pyx_t_9 = 0;
jpayne@68 10817 #if CYTHON_UNPACK_METHODS
jpayne@68 10818 if (likely(PyMethod_Check(__pyx_t_6))) {
jpayne@68 10819 __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_6);
jpayne@68 10820 if (likely(__pyx_t_15)) {
jpayne@68 10821 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
jpayne@68 10822 __Pyx_INCREF(__pyx_t_15);
jpayne@68 10823 __Pyx_INCREF(function);
jpayne@68 10824 __Pyx_DECREF_SET(__pyx_t_6, function);
jpayne@68 10825 __pyx_t_9 = 1;
jpayne@68 10826 }
jpayne@68 10827 }
jpayne@68 10828 #endif
jpayne@68 10829 {
jpayne@68 10830 PyObject *__pyx_callargs[2] = {__pyx_t_15, __pyx_t_7};
jpayne@68 10831 __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_9, 1+__pyx_t_9);
jpayne@68 10832 __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
jpayne@68 10833 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
jpayne@68 10834 if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 359, __pyx_L1_error)
jpayne@68 10835 __Pyx_GOTREF(__pyx_t_3);
jpayne@68 10836 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
jpayne@68 10837 }
jpayne@68 10838 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@68 10839
jpayne@68 10840 /* "pysam/libcutils.pyx":360
jpayne@68 10841 * bcftools_set_stdout_fn(force_bytes(stdout_f))
jpayne@68 10842 * args.extend(stdout_option.format(stdout_f).split(" "))
jpayne@68 10843 * stdout_h = c_open(b"/dev/null", O_WRONLY) # <<<<<<<<<<<<<<
jpayne@68 10844 * else:
jpayne@68 10845 * samtools_set_stdout_fn("-")
jpayne@68 10846 */
jpayne@68 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@68 10848 __Pyx_GOTREF(__pyx_t_3);
jpayne@68 10849 __Pyx_DECREF_SET(__pyx_v_stdout_h, __pyx_t_3);
jpayne@68 10850 __pyx_t_3 = 0;
jpayne@68 10851
jpayne@68 10852 /* "pysam/libcutils.pyx":355
jpayne@68 10853 * stdout_option = MAP_STDOUT_OPTIONS[collection][method]
jpayne@68 10854 *
jpayne@68 10855 * if stdout_option is not None and not is_usage: # <<<<<<<<<<<<<<
jpayne@68 10856 * os.close(stdout_h)
jpayne@68 10857 * samtools_set_stdout_fn(force_bytes(stdout_f))
jpayne@68 10858 */
jpayne@68 10859 }
jpayne@68 10860
jpayne@68 10861 /* "pysam/libcutils.pyx":332
jpayne@68 10862 * bcftools_set_stdout_fn(force_bytes(stdout_f))
jpayne@68 10863 *
jpayne@68 10864 * elif catch_stdout: # <<<<<<<<<<<<<<
jpayne@68 10865 * stdout_h, stdout_f = tempfile.mkstemp()
jpayne@68 10866 * MAP_STDOUT_OPTIONS = {
jpayne@68 10867 */
jpayne@68 10868 goto __pyx_L16;
jpayne@68 10869 }
jpayne@68 10870
jpayne@68 10871 /* "pysam/libcutils.pyx":362
jpayne@68 10872 * stdout_h = c_open(b"/dev/null", O_WRONLY)
jpayne@68 10873 * else:
jpayne@68 10874 * samtools_set_stdout_fn("-") # <<<<<<<<<<<<<<
jpayne@68 10875 * bcftools_set_stdout_fn("-")
jpayne@68 10876 * stdout_h = c_open(b"/dev/null", O_WRONLY)
jpayne@68 10877 */
jpayne@68 10878 /*else*/ {
jpayne@68 10879 samtools_set_stdout_fn(((char const *)"-"));
jpayne@68 10880
jpayne@68 10881 /* "pysam/libcutils.pyx":363
jpayne@68 10882 * else:
jpayne@68 10883 * samtools_set_stdout_fn("-")
jpayne@68 10884 * bcftools_set_stdout_fn("-") # <<<<<<<<<<<<<<
jpayne@68 10885 * stdout_h = c_open(b"/dev/null", O_WRONLY)
jpayne@68 10886 *
jpayne@68 10887 */
jpayne@68 10888 bcftools_set_stdout_fn(((char const *)"-"));
jpayne@68 10889
jpayne@68 10890 /* "pysam/libcutils.pyx":364
jpayne@68 10891 * samtools_set_stdout_fn("-")
jpayne@68 10892 * bcftools_set_stdout_fn("-")
jpayne@68 10893 * stdout_h = c_open(b"/dev/null", O_WRONLY) # <<<<<<<<<<<<<<
jpayne@68 10894 *
jpayne@68 10895 * # setup the function call to samtools/bcftools main
jpayne@68 10896 */
jpayne@68 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@68 10898 __Pyx_GOTREF(__pyx_t_3);
jpayne@68 10899 __pyx_v_stdout_h = __pyx_t_3;
jpayne@68 10900 __pyx_t_3 = 0;
jpayne@68 10901 }
jpayne@68 10902 __pyx_L16:;
jpayne@68 10903
jpayne@68 10904 /* "pysam/libcutils.pyx":369
jpayne@68 10905 * cdef char ** cargs
jpayne@68 10906 * cdef int i, n, retval, l
jpayne@68 10907 * n = len(args) # <<<<<<<<<<<<<<
jpayne@68 10908 * method = force_bytes(method)
jpayne@68 10909 * collection = force_bytes(collection)
jpayne@68 10910 */
jpayne@68 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@68 10912 __pyx_v_n = __pyx_t_4;
jpayne@68 10913
jpayne@68 10914 /* "pysam/libcutils.pyx":370
jpayne@68 10915 * cdef int i, n, retval, l
jpayne@68 10916 * n = len(args)
jpayne@68 10917 * method = force_bytes(method) # <<<<<<<<<<<<<<
jpayne@68 10918 * collection = force_bytes(collection)
jpayne@68 10919 * args = [force_bytes(a) for a in args]
jpayne@68 10920 */
jpayne@68 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@68 10922 __Pyx_GOTREF(__pyx_t_3);
jpayne@68 10923 __Pyx_DECREF_SET(__pyx_v_method, __pyx_t_3);
jpayne@68 10924 __pyx_t_3 = 0;
jpayne@68 10925
jpayne@68 10926 /* "pysam/libcutils.pyx":371
jpayne@68 10927 * n = len(args)
jpayne@68 10928 * method = force_bytes(method)
jpayne@68 10929 * collection = force_bytes(collection) # <<<<<<<<<<<<<<
jpayne@68 10930 * args = [force_bytes(a) for a in args]
jpayne@68 10931 *
jpayne@68 10932 */
jpayne@68 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@68 10934 __Pyx_GOTREF(__pyx_t_3);
jpayne@68 10935 __Pyx_DECREF_SET(__pyx_v_collection, __pyx_t_3);
jpayne@68 10936 __pyx_t_3 = 0;
jpayne@68 10937
jpayne@68 10938 /* "pysam/libcutils.pyx":372
jpayne@68 10939 * method = force_bytes(method)
jpayne@68 10940 * collection = force_bytes(collection)
jpayne@68 10941 * args = [force_bytes(a) for a in args] # <<<<<<<<<<<<<<
jpayne@68 10942 *
jpayne@68 10943 * # allocate two more for first (dummy) argument (contains command)
jpayne@68 10944 */
jpayne@68 10945 { /* enter inner scope */
jpayne@68 10946 __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 372, __pyx_L34_error)
jpayne@68 10947 __Pyx_GOTREF(__pyx_t_3);
jpayne@68 10948 if (likely(PyList_CheckExact(__pyx_v_args)) || PyTuple_CheckExact(__pyx_v_args)) {
jpayne@68 10949 __pyx_t_6 = __pyx_v_args; __Pyx_INCREF(__pyx_t_6);
jpayne@68 10950 __pyx_t_4 = 0;
jpayne@68 10951 __pyx_t_5 = NULL;
jpayne@68 10952 } else {
jpayne@68 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@68 10954 __Pyx_GOTREF(__pyx_t_6);
jpayne@68 10955 __pyx_t_5 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 372, __pyx_L34_error)
jpayne@68 10956 }
jpayne@68 10957 for (;;) {
jpayne@68 10958 if (likely(!__pyx_t_5)) {
jpayne@68 10959 if (likely(PyList_CheckExact(__pyx_t_6))) {
jpayne@68 10960 {
jpayne@68 10961 Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_6);
jpayne@68 10962 #if !CYTHON_ASSUME_SAFE_MACROS
jpayne@68 10963 if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 372, __pyx_L34_error)
jpayne@68 10964 #endif
jpayne@68 10965 if (__pyx_t_4 >= __pyx_temp) break;
jpayne@68 10966 }
jpayne@68 10967 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
jpayne@68 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@68 10969 #else
jpayne@68 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@68 10971 __Pyx_GOTREF(__pyx_t_7);
jpayne@68 10972 #endif
jpayne@68 10973 } else {
jpayne@68 10974 {
jpayne@68 10975 Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_6);
jpayne@68 10976 #if !CYTHON_ASSUME_SAFE_MACROS
jpayne@68 10977 if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 372, __pyx_L34_error)
jpayne@68 10978 #endif
jpayne@68 10979 if (__pyx_t_4 >= __pyx_temp) break;
jpayne@68 10980 }
jpayne@68 10981 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
jpayne@68 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@68 10983 #else
jpayne@68 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@68 10985 __Pyx_GOTREF(__pyx_t_7);
jpayne@68 10986 #endif
jpayne@68 10987 }
jpayne@68 10988 } else {
jpayne@68 10989 __pyx_t_7 = __pyx_t_5(__pyx_t_6);
jpayne@68 10990 if (unlikely(!__pyx_t_7)) {
jpayne@68 10991 PyObject* exc_type = PyErr_Occurred();
jpayne@68 10992 if (exc_type) {
jpayne@68 10993 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
jpayne@68 10994 else __PYX_ERR(0, 372, __pyx_L34_error)
jpayne@68 10995 }
jpayne@68 10996 break;
jpayne@68 10997 }
jpayne@68 10998 __Pyx_GOTREF(__pyx_t_7);
jpayne@68 10999 }
jpayne@68 11000 __Pyx_XDECREF_SET(__pyx_8genexpr2__pyx_v_a, __pyx_t_7);
jpayne@68 11001 __pyx_t_7 = 0;
jpayne@68 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@68 11003 __Pyx_GOTREF(__pyx_t_7);
jpayne@68 11004 if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_7))) __PYX_ERR(0, 372, __pyx_L34_error)
jpayne@68 11005 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
jpayne@68 11006 }
jpayne@68 11007 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
jpayne@68 11008 __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_a); __pyx_8genexpr2__pyx_v_a = 0;
jpayne@68 11009 goto __pyx_L38_exit_scope;
jpayne@68 11010 __pyx_L34_error:;
jpayne@68 11011 __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_a); __pyx_8genexpr2__pyx_v_a = 0;
jpayne@68 11012 goto __pyx_L1_error;
jpayne@68 11013 __pyx_L38_exit_scope:;
jpayne@68 11014 } /* exit inner scope */
jpayne@68 11015 __Pyx_DECREF_SET(__pyx_v_args, __pyx_t_3);
jpayne@68 11016 __pyx_t_3 = 0;
jpayne@68 11017
jpayne@68 11018 /* "pysam/libcutils.pyx":375
jpayne@68 11019 *
jpayne@68 11020 * # allocate two more for first (dummy) argument (contains command)
jpayne@68 11021 * cdef int extra_args = 0 # <<<<<<<<<<<<<<
jpayne@68 11022 * if method == b"index":
jpayne@68 11023 * extra_args = 1
jpayne@68 11024 */
jpayne@68 11025 __pyx_v_extra_args = 0;
jpayne@68 11026
jpayne@68 11027 /* "pysam/libcutils.pyx":376
jpayne@68 11028 * # allocate two more for first (dummy) argument (contains command)
jpayne@68 11029 * cdef int extra_args = 0
jpayne@68 11030 * if method == b"index": # <<<<<<<<<<<<<<
jpayne@68 11031 * extra_args = 1
jpayne@68 11032 * # add extra arguments for commands accepting optional arguments
jpayne@68 11033 */
jpayne@68 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@68 11035 if (__pyx_t_2) {
jpayne@68 11036
jpayne@68 11037 /* "pysam/libcutils.pyx":377
jpayne@68 11038 * cdef int extra_args = 0
jpayne@68 11039 * if method == b"index":
jpayne@68 11040 * extra_args = 1 # <<<<<<<<<<<<<<
jpayne@68 11041 * # add extra arguments for commands accepting optional arguments
jpayne@68 11042 * # such as 'samtools index x.bam [out.index]'
jpayne@68 11043 */
jpayne@68 11044 __pyx_v_extra_args = 1;
jpayne@68 11045
jpayne@68 11046 /* "pysam/libcutils.pyx":376
jpayne@68 11047 * # allocate two more for first (dummy) argument (contains command)
jpayne@68 11048 * cdef int extra_args = 0
jpayne@68 11049 * if method == b"index": # <<<<<<<<<<<<<<
jpayne@68 11050 * extra_args = 1
jpayne@68 11051 * # add extra arguments for commands accepting optional arguments
jpayne@68 11052 */
jpayne@68 11053 }
jpayne@68 11054
jpayne@68 11055 /* "pysam/libcutils.pyx":380
jpayne@68 11056 * # add extra arguments for commands accepting optional arguments
jpayne@68 11057 * # such as 'samtools index x.bam [out.index]'
jpayne@68 11058 * cargs = <char**>calloc(n + 2 + extra_args, sizeof(char *)) # <<<<<<<<<<<<<<
jpayne@68 11059 * cargs[0] = collection
jpayne@68 11060 * cargs[1] = method
jpayne@68 11061 */
jpayne@68 11062 __pyx_v_cargs = ((char **)calloc(((__pyx_v_n + 2) + __pyx_v_extra_args), (sizeof(char *))));
jpayne@68 11063
jpayne@68 11064 /* "pysam/libcutils.pyx":381
jpayne@68 11065 * # such as 'samtools index x.bam [out.index]'
jpayne@68 11066 * cargs = <char**>calloc(n + 2 + extra_args, sizeof(char *))
jpayne@68 11067 * cargs[0] = collection # <<<<<<<<<<<<<<
jpayne@68 11068 * cargs[1] = method
jpayne@68 11069 *
jpayne@68 11070 */
jpayne@68 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@68 11072 (__pyx_v_cargs[0]) = __pyx_t_17;
jpayne@68 11073
jpayne@68 11074 /* "pysam/libcutils.pyx":382
jpayne@68 11075 * cargs = <char**>calloc(n + 2 + extra_args, sizeof(char *))
jpayne@68 11076 * cargs[0] = collection
jpayne@68 11077 * cargs[1] = method # <<<<<<<<<<<<<<
jpayne@68 11078 *
jpayne@68 11079 * # create copies of strings - getopt for long options permutes
jpayne@68 11080 */
jpayne@68 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@68 11082 (__pyx_v_cargs[1]) = __pyx_t_17;
jpayne@68 11083
jpayne@68 11084 /* "pysam/libcutils.pyx":386
jpayne@68 11085 * # create copies of strings - getopt for long options permutes
jpayne@68 11086 * # arguments
jpayne@68 11087 * for i from 0 <= i < n: # <<<<<<<<<<<<<<
jpayne@68 11088 * l = len(args[i])
jpayne@68 11089 * cargs[i + 2] = <char *>calloc(l + 1, sizeof(char))
jpayne@68 11090 */
jpayne@68 11091 __pyx_t_18 = __pyx_v_n;
jpayne@68 11092 for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_18; __pyx_v_i++) {
jpayne@68 11093
jpayne@68 11094 /* "pysam/libcutils.pyx":387
jpayne@68 11095 * # arguments
jpayne@68 11096 * for i from 0 <= i < n:
jpayne@68 11097 * l = len(args[i]) # <<<<<<<<<<<<<<
jpayne@68 11098 * cargs[i + 2] = <char *>calloc(l + 1, sizeof(char))
jpayne@68 11099 * strncpy(cargs[i + 2], args[i], l)
jpayne@68 11100 */
jpayne@68 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@68 11102 __Pyx_GOTREF(__pyx_t_3);
jpayne@68 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@68 11104 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@68 11105 __pyx_v_l = __pyx_t_4;
jpayne@68 11106
jpayne@68 11107 /* "pysam/libcutils.pyx":388
jpayne@68 11108 * for i from 0 <= i < n:
jpayne@68 11109 * l = len(args[i])
jpayne@68 11110 * cargs[i + 2] = <char *>calloc(l + 1, sizeof(char)) # <<<<<<<<<<<<<<
jpayne@68 11111 * strncpy(cargs[i + 2], args[i], l)
jpayne@68 11112 *
jpayne@68 11113 */
jpayne@68 11114 (__pyx_v_cargs[(__pyx_v_i + 2)]) = ((char *)calloc((__pyx_v_l + 1), (sizeof(char))));
jpayne@68 11115
jpayne@68 11116 /* "pysam/libcutils.pyx":389
jpayne@68 11117 * l = len(args[i])
jpayne@68 11118 * cargs[i + 2] = <char *>calloc(l + 1, sizeof(char))
jpayne@68 11119 * strncpy(cargs[i + 2], args[i], l) # <<<<<<<<<<<<<<
jpayne@68 11120 *
jpayne@68 11121 * # call samtools/bcftools
jpayne@68 11122 */
jpayne@68 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@68 11124 __Pyx_GOTREF(__pyx_t_3);
jpayne@68 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@68 11126 (void)(strncpy((__pyx_v_cargs[(__pyx_v_i + 2)]), __pyx_t_19, __pyx_v_l));
jpayne@68 11127 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@68 11128 }
jpayne@68 11129
jpayne@68 11130 /* "pysam/libcutils.pyx":392
jpayne@68 11131 *
jpayne@68 11132 * # call samtools/bcftools
jpayne@68 11133 * if collection == b"samtools": # <<<<<<<<<<<<<<
jpayne@68 11134 * samtools_set_stdout(stdout_h)
jpayne@68 11135 * samtools_set_stderr(stderr_h)
jpayne@68 11136 */
jpayne@68 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@68 11138 if (__pyx_t_2) {
jpayne@68 11139
jpayne@68 11140 /* "pysam/libcutils.pyx":393
jpayne@68 11141 * # call samtools/bcftools
jpayne@68 11142 * if collection == b"samtools":
jpayne@68 11143 * samtools_set_stdout(stdout_h) # <<<<<<<<<<<<<<
jpayne@68 11144 * samtools_set_stderr(stderr_h)
jpayne@68 11145 * retval = samtools_dispatch(n + 2, cargs)
jpayne@68 11146 */
jpayne@68 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@68 11148 samtools_set_stdout(__pyx_t_18);
jpayne@68 11149
jpayne@68 11150 /* "pysam/libcutils.pyx":394
jpayne@68 11151 * if collection == b"samtools":
jpayne@68 11152 * samtools_set_stdout(stdout_h)
jpayne@68 11153 * samtools_set_stderr(stderr_h) # <<<<<<<<<<<<<<
jpayne@68 11154 * retval = samtools_dispatch(n + 2, cargs)
jpayne@68 11155 * samtools_close_stdout()
jpayne@68 11156 */
jpayne@68 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@68 11158 samtools_set_stderr(__pyx_t_18);
jpayne@68 11159
jpayne@68 11160 /* "pysam/libcutils.pyx":395
jpayne@68 11161 * samtools_set_stdout(stdout_h)
jpayne@68 11162 * samtools_set_stderr(stderr_h)
jpayne@68 11163 * retval = samtools_dispatch(n + 2, cargs) # <<<<<<<<<<<<<<
jpayne@68 11164 * samtools_close_stdout()
jpayne@68 11165 * samtools_close_stderr()
jpayne@68 11166 */
jpayne@68 11167 __pyx_v_retval = samtools_dispatch((__pyx_v_n + 2), __pyx_v_cargs);
jpayne@68 11168
jpayne@68 11169 /* "pysam/libcutils.pyx":396
jpayne@68 11170 * samtools_set_stderr(stderr_h)
jpayne@68 11171 * retval = samtools_dispatch(n + 2, cargs)
jpayne@68 11172 * samtools_close_stdout() # <<<<<<<<<<<<<<
jpayne@68 11173 * samtools_close_stderr()
jpayne@68 11174 * elif collection == b"bcftools":
jpayne@68 11175 */
jpayne@68 11176 samtools_close_stdout();
jpayne@68 11177
jpayne@68 11178 /* "pysam/libcutils.pyx":397
jpayne@68 11179 * retval = samtools_dispatch(n + 2, cargs)
jpayne@68 11180 * samtools_close_stdout()
jpayne@68 11181 * samtools_close_stderr() # <<<<<<<<<<<<<<
jpayne@68 11182 * elif collection == b"bcftools":
jpayne@68 11183 * bcftools_set_stdout(stdout_h)
jpayne@68 11184 */
jpayne@68 11185 samtools_close_stderr();
jpayne@68 11186
jpayne@68 11187 /* "pysam/libcutils.pyx":392
jpayne@68 11188 *
jpayne@68 11189 * # call samtools/bcftools
jpayne@68 11190 * if collection == b"samtools": # <<<<<<<<<<<<<<
jpayne@68 11191 * samtools_set_stdout(stdout_h)
jpayne@68 11192 * samtools_set_stderr(stderr_h)
jpayne@68 11193 */
jpayne@68 11194 goto __pyx_L42;
jpayne@68 11195 }
jpayne@68 11196
jpayne@68 11197 /* "pysam/libcutils.pyx":398
jpayne@68 11198 * samtools_close_stdout()
jpayne@68 11199 * samtools_close_stderr()
jpayne@68 11200 * elif collection == b"bcftools": # <<<<<<<<<<<<<<
jpayne@68 11201 * bcftools_set_stdout(stdout_h)
jpayne@68 11202 * bcftools_set_stderr(stderr_h)
jpayne@68 11203 */
jpayne@68 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@68 11205 if (__pyx_t_2) {
jpayne@68 11206
jpayne@68 11207 /* "pysam/libcutils.pyx":399
jpayne@68 11208 * samtools_close_stderr()
jpayne@68 11209 * elif collection == b"bcftools":
jpayne@68 11210 * bcftools_set_stdout(stdout_h) # <<<<<<<<<<<<<<
jpayne@68 11211 * bcftools_set_stderr(stderr_h)
jpayne@68 11212 * retval = bcftools_dispatch(n + 2, cargs)
jpayne@68 11213 */
jpayne@68 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@68 11215 bcftools_set_stdout(__pyx_t_18);
jpayne@68 11216
jpayne@68 11217 /* "pysam/libcutils.pyx":400
jpayne@68 11218 * elif collection == b"bcftools":
jpayne@68 11219 * bcftools_set_stdout(stdout_h)
jpayne@68 11220 * bcftools_set_stderr(stderr_h) # <<<<<<<<<<<<<<
jpayne@68 11221 * retval = bcftools_dispatch(n + 2, cargs)
jpayne@68 11222 * bcftools_close_stdout()
jpayne@68 11223 */
jpayne@68 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@68 11225 bcftools_set_stderr(__pyx_t_18);
jpayne@68 11226
jpayne@68 11227 /* "pysam/libcutils.pyx":401
jpayne@68 11228 * bcftools_set_stdout(stdout_h)
jpayne@68 11229 * bcftools_set_stderr(stderr_h)
jpayne@68 11230 * retval = bcftools_dispatch(n + 2, cargs) # <<<<<<<<<<<<<<
jpayne@68 11231 * bcftools_close_stdout()
jpayne@68 11232 * bcftools_close_stderr()
jpayne@68 11233 */
jpayne@68 11234 __pyx_v_retval = bcftools_dispatch((__pyx_v_n + 2), __pyx_v_cargs);
jpayne@68 11235
jpayne@68 11236 /* "pysam/libcutils.pyx":402
jpayne@68 11237 * bcftools_set_stderr(stderr_h)
jpayne@68 11238 * retval = bcftools_dispatch(n + 2, cargs)
jpayne@68 11239 * bcftools_close_stdout() # <<<<<<<<<<<<<<
jpayne@68 11240 * bcftools_close_stderr()
jpayne@68 11241 * else:
jpayne@68 11242 */
jpayne@68 11243 bcftools_close_stdout();
jpayne@68 11244
jpayne@68 11245 /* "pysam/libcutils.pyx":403
jpayne@68 11246 * retval = bcftools_dispatch(n + 2, cargs)
jpayne@68 11247 * bcftools_close_stdout()
jpayne@68 11248 * bcftools_close_stderr() # <<<<<<<<<<<<<<
jpayne@68 11249 * else:
jpayne@68 11250 * # unknown -- just return a Unix shell's "command not found" exit status
jpayne@68 11251 */
jpayne@68 11252 bcftools_close_stderr();
jpayne@68 11253
jpayne@68 11254 /* "pysam/libcutils.pyx":398
jpayne@68 11255 * samtools_close_stdout()
jpayne@68 11256 * samtools_close_stderr()
jpayne@68 11257 * elif collection == b"bcftools": # <<<<<<<<<<<<<<
jpayne@68 11258 * bcftools_set_stdout(stdout_h)
jpayne@68 11259 * bcftools_set_stderr(stderr_h)
jpayne@68 11260 */
jpayne@68 11261 goto __pyx_L42;
jpayne@68 11262 }
jpayne@68 11263
jpayne@68 11264 /* "pysam/libcutils.pyx":406
jpayne@68 11265 * else:
jpayne@68 11266 * # unknown -- just return a Unix shell's "command not found" exit status
jpayne@68 11267 * retval = 127 # <<<<<<<<<<<<<<
jpayne@68 11268 *
jpayne@68 11269 * for i from 0 <= i < n:
jpayne@68 11270 */
jpayne@68 11271 /*else*/ {
jpayne@68 11272 __pyx_v_retval = 0x7F;
jpayne@68 11273 }
jpayne@68 11274 __pyx_L42:;
jpayne@68 11275
jpayne@68 11276 /* "pysam/libcutils.pyx":408
jpayne@68 11277 * retval = 127
jpayne@68 11278 *
jpayne@68 11279 * for i from 0 <= i < n: # <<<<<<<<<<<<<<
jpayne@68 11280 * free(cargs[i + 2])
jpayne@68 11281 * free(cargs)
jpayne@68 11282 */
jpayne@68 11283 __pyx_t_18 = __pyx_v_n;
jpayne@68 11284 for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_18; __pyx_v_i++) {
jpayne@68 11285
jpayne@68 11286 /* "pysam/libcutils.pyx":409
jpayne@68 11287 *
jpayne@68 11288 * for i from 0 <= i < n:
jpayne@68 11289 * free(cargs[i + 2]) # <<<<<<<<<<<<<<
jpayne@68 11290 * free(cargs)
jpayne@68 11291 *
jpayne@68 11292 */
jpayne@68 11293 free((__pyx_v_cargs[(__pyx_v_i + 2)]));
jpayne@68 11294 }
jpayne@68 11295
jpayne@68 11296 /* "pysam/libcutils.pyx":410
jpayne@68 11297 * for i from 0 <= i < n:
jpayne@68 11298 * free(cargs[i + 2])
jpayne@68 11299 * free(cargs) # <<<<<<<<<<<<<<
jpayne@68 11300 *
jpayne@68 11301 * # get error messages
jpayne@68 11302 */
jpayne@68 11303 free(__pyx_v_cargs);
jpayne@68 11304
jpayne@68 11305 /* "pysam/libcutils.pyx":413
jpayne@68 11306 *
jpayne@68 11307 * # get error messages
jpayne@68 11308 * def _collect(fn): # <<<<<<<<<<<<<<
jpayne@68 11309 * out = []
jpayne@68 11310 * try:
jpayne@68 11311 */
jpayne@68 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@68 11313 __Pyx_GOTREF(__pyx_t_3);
jpayne@68 11314 __pyx_v__collect = __pyx_t_3;
jpayne@68 11315 __pyx_t_3 = 0;
jpayne@68 11316
jpayne@68 11317 /* "pysam/libcutils.pyx":426
jpayne@68 11318 * return out
jpayne@68 11319 *
jpayne@68 11320 * out_stderr = _collect(stderr_f) # <<<<<<<<<<<<<<
jpayne@68 11321 * if save_stdout:
jpayne@68 11322 * out_stdout = None
jpayne@68 11323 */
jpayne@68 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@68 11325 __Pyx_GOTREF(__pyx_t_3);
jpayne@68 11326 __pyx_v_out_stderr = __pyx_t_3;
jpayne@68 11327 __pyx_t_3 = 0;
jpayne@68 11328
jpayne@68 11329 /* "pysam/libcutils.pyx":427
jpayne@68 11330 *
jpayne@68 11331 * out_stderr = _collect(stderr_f)
jpayne@68 11332 * if save_stdout: # <<<<<<<<<<<<<<
jpayne@68 11333 * out_stdout = None
jpayne@68 11334 * elif catch_stdout:
jpayne@68 11335 */
jpayne@68 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@68 11337 if (__pyx_t_2) {
jpayne@68 11338
jpayne@68 11339 /* "pysam/libcutils.pyx":428
jpayne@68 11340 * out_stderr = _collect(stderr_f)
jpayne@68 11341 * if save_stdout:
jpayne@68 11342 * out_stdout = None # <<<<<<<<<<<<<<
jpayne@68 11343 * elif catch_stdout:
jpayne@68 11344 * out_stdout = _collect(stdout_f)
jpayne@68 11345 */
jpayne@68 11346 __Pyx_INCREF(Py_None);
jpayne@68 11347 __pyx_v_out_stdout = Py_None;
jpayne@68 11348
jpayne@68 11349 /* "pysam/libcutils.pyx":427
jpayne@68 11350 *
jpayne@68 11351 * out_stderr = _collect(stderr_f)
jpayne@68 11352 * if save_stdout: # <<<<<<<<<<<<<<
jpayne@68 11353 * out_stdout = None
jpayne@68 11354 * elif catch_stdout:
jpayne@68 11355 */
jpayne@68 11356 goto __pyx_L45;
jpayne@68 11357 }
jpayne@68 11358
jpayne@68 11359 /* "pysam/libcutils.pyx":429
jpayne@68 11360 * if save_stdout:
jpayne@68 11361 * out_stdout = None
jpayne@68 11362 * elif catch_stdout: # <<<<<<<<<<<<<<
jpayne@68 11363 * out_stdout = _collect(stdout_f)
jpayne@68 11364 * else:
jpayne@68 11365 */
jpayne@68 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@68 11367 if (__pyx_t_2) {
jpayne@68 11368
jpayne@68 11369 /* "pysam/libcutils.pyx":430
jpayne@68 11370 * out_stdout = None
jpayne@68 11371 * elif catch_stdout:
jpayne@68 11372 * out_stdout = _collect(stdout_f) # <<<<<<<<<<<<<<
jpayne@68 11373 * else:
jpayne@68 11374 * out_stdout = None
jpayne@68 11375 */
jpayne@68 11376 if (unlikely(!__pyx_v_stdout_f)) { __Pyx_RaiseUnboundLocalError("stdout_f"); __PYX_ERR(0, 430, __pyx_L1_error) }
jpayne@68 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@68 11378 __Pyx_GOTREF(__pyx_t_3);
jpayne@68 11379 __pyx_v_out_stdout = __pyx_t_3;
jpayne@68 11380 __pyx_t_3 = 0;
jpayne@68 11381
jpayne@68 11382 /* "pysam/libcutils.pyx":429
jpayne@68 11383 * if save_stdout:
jpayne@68 11384 * out_stdout = None
jpayne@68 11385 * elif catch_stdout: # <<<<<<<<<<<<<<
jpayne@68 11386 * out_stdout = _collect(stdout_f)
jpayne@68 11387 * else:
jpayne@68 11388 */
jpayne@68 11389 goto __pyx_L45;
jpayne@68 11390 }
jpayne@68 11391
jpayne@68 11392 /* "pysam/libcutils.pyx":432
jpayne@68 11393 * out_stdout = _collect(stdout_f)
jpayne@68 11394 * else:
jpayne@68 11395 * out_stdout = None # <<<<<<<<<<<<<<
jpayne@68 11396 *
jpayne@68 11397 * return retval, out_stderr, out_stdout
jpayne@68 11398 */
jpayne@68 11399 /*else*/ {
jpayne@68 11400 __Pyx_INCREF(Py_None);
jpayne@68 11401 __pyx_v_out_stdout = Py_None;
jpayne@68 11402 }
jpayne@68 11403 __pyx_L45:;
jpayne@68 11404
jpayne@68 11405 /* "pysam/libcutils.pyx":434
jpayne@68 11406 * out_stdout = None
jpayne@68 11407 *
jpayne@68 11408 * return retval, out_stderr, out_stdout # <<<<<<<<<<<<<<
jpayne@68 11409 *
jpayne@68 11410 *
jpayne@68 11411 */
jpayne@68 11412 __Pyx_XDECREF(__pyx_r);
jpayne@68 11413 __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_retval); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 434, __pyx_L1_error)
jpayne@68 11414 __Pyx_GOTREF(__pyx_t_3);
jpayne@68 11415 __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 434, __pyx_L1_error)
jpayne@68 11416 __Pyx_GOTREF(__pyx_t_6);
jpayne@68 11417 __Pyx_GIVEREF(__pyx_t_3);
jpayne@68 11418 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3)) __PYX_ERR(0, 434, __pyx_L1_error);
jpayne@68 11419 __Pyx_INCREF(__pyx_v_out_stderr);
jpayne@68 11420 __Pyx_GIVEREF(__pyx_v_out_stderr);
jpayne@68 11421 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_out_stderr)) __PYX_ERR(0, 434, __pyx_L1_error);
jpayne@68 11422 __Pyx_INCREF(__pyx_v_out_stdout);
jpayne@68 11423 __Pyx_GIVEREF(__pyx_v_out_stdout);
jpayne@68 11424 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_out_stdout)) __PYX_ERR(0, 434, __pyx_L1_error);
jpayne@68 11425 __pyx_t_3 = 0;
jpayne@68 11426 __pyx_r = __pyx_t_6;
jpayne@68 11427 __pyx_t_6 = 0;
jpayne@68 11428 goto __pyx_L0;
jpayne@68 11429
jpayne@68 11430 /* "pysam/libcutils.pyx":276
jpayne@68 11431 *
jpayne@68 11432 *
jpayne@68 11433 * def _pysam_dispatch(collection, # <<<<<<<<<<<<<<
jpayne@68 11434 * method,
jpayne@68 11435 * args=None,
jpayne@68 11436 */
jpayne@68 11437
jpayne@68 11438 /* function exit code */
jpayne@68 11439 __pyx_L1_error:;
jpayne@68 11440 __Pyx_XDECREF(__pyx_t_3);
jpayne@68 11441 __Pyx_XDECREF(__pyx_t_6);
jpayne@68 11442 __Pyx_XDECREF(__pyx_t_7);
jpayne@68 11443 __Pyx_XDECREF(__pyx_t_8);
jpayne@68 11444 __Pyx_XDECREF(__pyx_t_15);
jpayne@68 11445 __Pyx_XDECREF(__pyx_t_16);
jpayne@68 11446 __Pyx_AddTraceback("pysam.libcutils._pysam_dispatch", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@68 11447 __pyx_r = NULL;
jpayne@68 11448 __pyx_L0:;
jpayne@68 11449 __Pyx_XDECREF(__pyx_v_ARGUMENTS);
jpayne@68 11450 __Pyx_XDECREF(__pyx_v_arg);
jpayne@68 11451 __Pyx_XDECREF(__pyx_v_stderr_h);
jpayne@68 11452 __Pyx_XDECREF(__pyx_v_stderr_f);
jpayne@68 11453 __Pyx_XDECREF(__pyx_v_stdout_f);
jpayne@68 11454 __Pyx_XDECREF(__pyx_v_stdout_h);
jpayne@68 11455 __Pyx_XDECREF(__pyx_v_MAP_STDOUT_OPTIONS);
jpayne@68 11456 __Pyx_XDECREF(__pyx_v_stdout_option);
jpayne@68 11457 __Pyx_XDECREF(__pyx_v__collect);
jpayne@68 11458 __Pyx_XDECREF(__pyx_v_out_stderr);
jpayne@68 11459 __Pyx_XDECREF(__pyx_v_out_stdout);
jpayne@68 11460 __Pyx_XDECREF(__pyx_8genexpr2__pyx_v_a);
jpayne@68 11461 __Pyx_XDECREF(__pyx_v_collection);
jpayne@68 11462 __Pyx_XDECREF(__pyx_v_method);
jpayne@68 11463 __Pyx_XDECREF(__pyx_v_args);
jpayne@68 11464 __Pyx_XGIVEREF(__pyx_r);
jpayne@68 11465 __Pyx_RefNannyFinishContext();
jpayne@68 11466 return __pyx_r;
jpayne@68 11467 }
jpayne@68 11468
jpayne@68 11469 static PyMethodDef __pyx_methods[] = {
jpayne@68 11470 {0, 0, 0, 0}
jpayne@68 11471 };
jpayne@68 11472 #ifndef CYTHON_SMALL_CODE
jpayne@68 11473 #if defined(__clang__)
jpayne@68 11474 #define CYTHON_SMALL_CODE
jpayne@68 11475 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
jpayne@68 11476 #define CYTHON_SMALL_CODE __attribute__((cold))
jpayne@68 11477 #else
jpayne@68 11478 #define CYTHON_SMALL_CODE
jpayne@68 11479 #endif
jpayne@68 11480 #endif
jpayne@68 11481 /* #### Code section: pystring_table ### */
jpayne@68 11482
jpayne@68 11483 static int __Pyx_CreateStringTabAndInitStrings(void) {
jpayne@68 11484 __Pyx_StringTabEntry __pyx_string_tab[] = {
jpayne@68 11485 {&__pyx_kp_u_, __pyx_k_, sizeof(__pyx_k_), 0, 1, 0, 0},
jpayne@68 11486 {&__pyx_n_s_ARGUMENTS, __pyx_k_ARGUMENTS, sizeof(__pyx_k_ARGUMENTS), 0, 0, 1, 1},
jpayne@68 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@68 11488 {&__pyx_n_u_B, __pyx_k_B, sizeof(__pyx_k_B), 0, 1, 0, 1},
jpayne@68 11489 {&__pyx_n_s_IOError, __pyx_k_IOError, sizeof(__pyx_k_IOError), 0, 0, 1, 1},
jpayne@68 11490 {&__pyx_n_s_MAP_STDOUT_OPTIONS, __pyx_k_MAP_STDOUT_OPTIONS, sizeof(__pyx_k_MAP_STDOUT_OPTIONS), 0, 0, 1, 1},
jpayne@68 11491 {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
jpayne@68 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@68 11493 {&__pyx_n_s_OSError, __pyx_k_OSError, sizeof(__pyx_k_OSError), 0, 0, 1, 1},
jpayne@68 11494 {&__pyx_n_s_OverflowError, __pyx_k_OverflowError, sizeof(__pyx_k_OverflowError), 0, 0, 1, 1},
jpayne@68 11495 {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
jpayne@68 11496 {&__pyx_n_s_UnicodeDecodeError, __pyx_k_UnicodeDecodeError, sizeof(__pyx_k_UnicodeDecodeError), 0, 0, 1, 1},
jpayne@68 11497 {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
jpayne@68 11498 {&__pyx_kp_u__10, __pyx_k__10, sizeof(__pyx_k__10), 0, 1, 0, 0},
jpayne@68 11499 {&__pyx_kp_u__11, __pyx_k__11, sizeof(__pyx_k__11), 0, 1, 0, 0},
jpayne@68 11500 {&__pyx_n_s__14, __pyx_k__14, sizeof(__pyx_k__14), 0, 0, 1, 1},
jpayne@68 11501 {&__pyx_kp_u__15, __pyx_k__15, sizeof(__pyx_k__15), 0, 1, 0, 0},
jpayne@68 11502 {&__pyx_n_s__33, __pyx_k__33, sizeof(__pyx_k__33), 0, 0, 1, 1},
jpayne@68 11503 {&__pyx_kp_u__7, __pyx_k__7, sizeof(__pyx_k__7), 0, 1, 0, 0},
jpayne@68 11504 {&__pyx_kp_u__8, __pyx_k__8, sizeof(__pyx_k__8), 0, 1, 0, 0},
jpayne@68 11505 {&__pyx_n_s_a, __pyx_k_a, sizeof(__pyx_k_a), 0, 0, 1, 1},
jpayne@68 11506 {&__pyx_n_s_all, __pyx_k_all, sizeof(__pyx_k_all), 0, 0, 1, 1},
jpayne@68 11507 {&__pyx_n_s_arg, __pyx_k_arg, sizeof(__pyx_k_arg), 0, 0, 1, 1},
jpayne@68 11508 {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1},
jpayne@68 11509 {&__pyx_n_s_array_to_qualitystring, __pyx_k_array_to_qualitystring, sizeof(__pyx_k_array_to_qualitystring), 0, 0, 1, 1},
jpayne@68 11510 {&__pyx_n_u_array_to_qualitystring, __pyx_k_array_to_qualitystring, sizeof(__pyx_k_array_to_qualitystring), 0, 1, 0, 1},
jpayne@68 11511 {&__pyx_n_u_ascii, __pyx_k_ascii, sizeof(__pyx_k_ascii), 0, 1, 0, 1},
jpayne@68 11512 {&__pyx_n_s_asyncio_coroutines, __pyx_k_asyncio_coroutines, sizeof(__pyx_k_asyncio_coroutines), 0, 0, 1, 1},
jpayne@68 11513 {&__pyx_n_b_bcftools, __pyx_k_bcftools, sizeof(__pyx_k_bcftools), 0, 0, 0, 1},
jpayne@68 11514 {&__pyx_n_u_bcftools, __pyx_k_bcftools, sizeof(__pyx_k_bcftools), 0, 1, 0, 1},
jpayne@68 11515 {&__pyx_kp_u_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 1, 0, 0},
jpayne@68 11516 {&__pyx_n_u_calmd, __pyx_k_calmd, sizeof(__pyx_k_calmd), 0, 1, 0, 1},
jpayne@68 11517 {&__pyx_n_s_cargs, __pyx_k_cargs, sizeof(__pyx_k_cargs), 0, 0, 1, 1},
jpayne@68 11518 {&__pyx_n_s_catch_stdout, __pyx_k_catch_stdout, sizeof(__pyx_k_catch_stdout), 0, 0, 1, 1},
jpayne@68 11519 {&__pyx_n_s_chr, __pyx_k_chr, sizeof(__pyx_k_chr), 0, 0, 1, 1},
jpayne@68 11520 {&__pyx_n_s_class_getitem, __pyx_k_class_getitem, sizeof(__pyx_k_class_getitem), 0, 0, 1, 1},
jpayne@68 11521 {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
jpayne@68 11522 {&__pyx_n_s_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1},
jpayne@68 11523 {&__pyx_n_s_codecs, __pyx_k_codecs, sizeof(__pyx_k_codecs), 0, 0, 1, 1},
jpayne@68 11524 {&__pyx_n_s_collect, __pyx_k_collect, sizeof(__pyx_k_collect), 0, 0, 1, 1},
jpayne@68 11525 {&__pyx_n_s_collection, __pyx_k_collection, sizeof(__pyx_k_collection), 0, 0, 1, 1},
jpayne@68 11526 {&__pyx_n_s_contextlib, __pyx_k_contextlib, sizeof(__pyx_k_contextlib), 0, 0, 1, 1},
jpayne@68 11527 {&__pyx_n_s_contextmanager, __pyx_k_contextmanager, sizeof(__pyx_k_contextmanager), 0, 0, 1, 1},
jpayne@68 11528 {&__pyx_n_s_contig, __pyx_k_contig, sizeof(__pyx_k_contig), 0, 0, 1, 1},
jpayne@68 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@68 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@68 11531 {&__pyx_n_s_decode, __pyx_k_decode, sizeof(__pyx_k_decode), 0, 0, 1, 1},
jpayne@68 11532 {&__pyx_n_u_depad, __pyx_k_depad, sizeof(__pyx_k_depad), 0, 1, 0, 1},
jpayne@68 11533 {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1},
jpayne@68 11534 {&__pyx_n_s_end, __pyx_k_end, sizeof(__pyx_k_end), 0, 0, 1, 1},
jpayne@68 11535 {&__pyx_n_s_enter, __pyx_k_enter, sizeof(__pyx_k_enter), 0, 0, 1, 1},
jpayne@68 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@68 11537 {&__pyx_n_s_exception, __pyx_k_exception, sizeof(__pyx_k_exception), 0, 0, 1, 1},
jpayne@68 11538 {&__pyx_n_s_exists, __pyx_k_exists, sizeof(__pyx_k_exists), 0, 0, 1, 1},
jpayne@68 11539 {&__pyx_n_s_exit, __pyx_k_exit, sizeof(__pyx_k_exit), 0, 0, 1, 1},
jpayne@68 11540 {&__pyx_n_s_extend, __pyx_k_extend, sizeof(__pyx_k_extend), 0, 0, 1, 1},
jpayne@68 11541 {&__pyx_n_s_extra_args, __pyx_k_extra_args, sizeof(__pyx_k_extra_args), 0, 0, 1, 1},
jpayne@68 11542 {&__pyx_n_s_fn, __pyx_k_fn, sizeof(__pyx_k_fn), 0, 0, 1, 1},
jpayne@68 11543 {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1},
jpayne@68 11544 {&__pyx_n_s_fsencode, __pyx_k_fsencode, sizeof(__pyx_k_fsencode), 0, 0, 1, 1},
jpayne@68 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@68 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@68 11547 {&__pyx_n_s_getdefaultencoding, __pyx_k_getdefaultencoding, sizeof(__pyx_k_getdefaultencoding), 0, 0, 1, 1},
jpayne@68 11548 {&__pyx_n_s_getfilesystemencoding, __pyx_k_getfilesystemencoding, sizeof(__pyx_k_getfilesystemencoding), 0, 0, 1, 1},
jpayne@68 11549 {&__pyx_n_u_head, __pyx_k_head, sizeof(__pyx_k_head), 0, 1, 0, 1},
jpayne@68 11550 {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
jpayne@68 11551 {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
jpayne@68 11552 {&__pyx_n_b_index, __pyx_k_index, sizeof(__pyx_k_index), 0, 0, 0, 1},
jpayne@68 11553 {&__pyx_n_u_index, __pyx_k_index, sizeof(__pyx_k_index), 0, 1, 0, 1},
jpayne@68 11554 {&__pyx_n_s_inf, __pyx_k_inf, sizeof(__pyx_k_inf), 0, 0, 1, 1},
jpayne@68 11555 {&__pyx_n_s_initializing, __pyx_k_initializing, sizeof(__pyx_k_initializing), 0, 0, 1, 1},
jpayne@68 11556 {&__pyx_n_s_input_str, __pyx_k_input_str, sizeof(__pyx_k_input_str), 0, 0, 1, 1},
jpayne@68 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@68 11558 {&__pyx_n_s_io, __pyx_k_io, sizeof(__pyx_k_io), 0, 0, 1, 1},
jpayne@68 11559 {&__pyx_n_s_is_coroutine, __pyx_k_is_coroutine, sizeof(__pyx_k_is_coroutine), 0, 0, 1, 1},
jpayne@68 11560 {&__pyx_n_s_is_usage, __pyx_k_is_usage, sizeof(__pyx_k_is_usage), 0, 0, 1, 1},
jpayne@68 11561 {&__pyx_n_s_l, __pyx_k_l, sizeof(__pyx_k_l), 0, 0, 1, 1},
jpayne@68 11562 {&__pyx_n_s_latin1_replace, __pyx_k_latin1_replace, sizeof(__pyx_k_latin1_replace), 0, 0, 1, 1},
jpayne@68 11563 {&__pyx_kp_u_m, __pyx_k_m, sizeof(__pyx_k_m), 0, 1, 0, 0},
jpayne@68 11564 {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
jpayne@68 11565 {&__pyx_n_s_method, __pyx_k_method, sizeof(__pyx_k_method), 0, 0, 1, 1},
jpayne@68 11566 {&__pyx_kp_u_min_shift, __pyx_k_min_shift, sizeof(__pyx_k_min_shift), 0, 1, 0, 0},
jpayne@68 11567 {&__pyx_n_s_mkstemp, __pyx_k_mkstemp, sizeof(__pyx_k_mkstemp), 0, 0, 1, 1},
jpayne@68 11568 {&__pyx_n_u_mpileup, __pyx_k_mpileup, sizeof(__pyx_k_mpileup), 0, 1, 0, 1},
jpayne@68 11569 {&__pyx_n_s_n, __pyx_k_n, sizeof(__pyx_k_n), 0, 0, 1, 1},
jpayne@68 11570 {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
jpayne@68 11571 {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1},
jpayne@68 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@68 11573 {&__pyx_kp_u_o, __pyx_k_o, sizeof(__pyx_k_o), 0, 1, 0, 0},
jpayne@68 11574 {&__pyx_kp_u_o_2, __pyx_k_o_2, sizeof(__pyx_k_o_2), 0, 1, 0, 0},
jpayne@68 11575 {&__pyx_n_s_object, __pyx_k_object, sizeof(__pyx_k_object), 0, 0, 1, 1},
jpayne@68 11576 {&__pyx_n_s_offset, __pyx_k_offset, sizeof(__pyx_k_offset), 0, 0, 1, 1},
jpayne@68 11577 {&__pyx_n_s_open, __pyx_k_open, sizeof(__pyx_k_open), 0, 0, 1, 1},
jpayne@68 11578 {&__pyx_n_s_os, __pyx_k_os, sizeof(__pyx_k_os), 0, 0, 1, 1},
jpayne@68 11579 {&__pyx_n_s_out, __pyx_k_out, sizeof(__pyx_k_out), 0, 0, 1, 1},
jpayne@68 11580 {&__pyx_n_s_out_stderr, __pyx_k_out_stderr, sizeof(__pyx_k_out_stderr), 0, 0, 1, 1},
jpayne@68 11581 {&__pyx_n_s_out_stdout, __pyx_k_out_stdout, sizeof(__pyx_k_out_stdout), 0, 0, 1, 1},
jpayne@68 11582 {&__pyx_kp_u_output, __pyx_k_output, sizeof(__pyx_k_output), 0, 1, 0, 0},
jpayne@68 11583 {&__pyx_kp_u_output_file, __pyx_k_output_file, sizeof(__pyx_k_output_file), 0, 1, 0, 0},
jpayne@68 11584 {&__pyx_n_s_parse_region, __pyx_k_parse_region, sizeof(__pyx_k_parse_region), 0, 0, 1, 1},
jpayne@68 11585 {&__pyx_n_s_path, __pyx_k_path, sizeof(__pyx_k_path), 0, 0, 1, 1},
jpayne@68 11586 {&__pyx_n_s_pysam_dispatch, __pyx_k_pysam_dispatch, sizeof(__pyx_k_pysam_dispatch), 0, 0, 1, 1},
jpayne@68 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@68 11588 {&__pyx_kp_u_pysam_latin1replace, __pyx_k_pysam_latin1replace, sizeof(__pyx_k_pysam_latin1replace), 0, 1, 0, 0},
jpayne@68 11589 {&__pyx_n_s_pysam_libcutils, __pyx_k_pysam_libcutils, sizeof(__pyx_k_pysam_libcutils), 0, 0, 1, 1},
jpayne@68 11590 {&__pyx_kp_s_pysam_libcutils_pyx, __pyx_k_pysam_libcutils_pyx, sizeof(__pyx_k_pysam_libcutils_pyx), 0, 0, 1, 0},
jpayne@68 11591 {&__pyx_n_s_qualities, __pyx_k_qualities, sizeof(__pyx_k_qualities), 0, 0, 1, 1},
jpayne@68 11592 {&__pyx_n_s_qualities_to_qualitystring, __pyx_k_qualities_to_qualitystring, sizeof(__pyx_k_qualities_to_qualitystring), 0, 0, 1, 1},
jpayne@68 11593 {&__pyx_n_u_qualities_to_qualitystring, __pyx_k_qualities_to_qualitystring, sizeof(__pyx_k_qualities_to_qualitystring), 0, 1, 0, 1},
jpayne@68 11594 {&__pyx_n_s_qualitystring_to_array, __pyx_k_qualitystring_to_array, sizeof(__pyx_k_qualitystring_to_array), 0, 0, 1, 1},
jpayne@68 11595 {&__pyx_n_u_qualitystring_to_array, __pyx_k_qualitystring_to_array, sizeof(__pyx_k_qualitystring_to_array), 0, 1, 0, 1},
jpayne@68 11596 {&__pyx_n_u_r, __pyx_k_r, sizeof(__pyx_k_r), 0, 1, 0, 1},
jpayne@68 11597 {&__pyx_n_u_rb, __pyx_k_rb, sizeof(__pyx_k_rb), 0, 1, 0, 1},
jpayne@68 11598 {&__pyx_n_s_re, __pyx_k_re, sizeof(__pyx_k_re), 0, 0, 1, 1},
jpayne@68 11599 {&__pyx_n_s_read, __pyx_k_read, sizeof(__pyx_k_read), 0, 0, 1, 1},
jpayne@68 11600 {&__pyx_n_s_reference, __pyx_k_reference, sizeof(__pyx_k_reference), 0, 0, 1, 1},
jpayne@68 11601 {&__pyx_n_s_region, __pyx_k_region, sizeof(__pyx_k_region), 0, 0, 1, 1},
jpayne@68 11602 {&__pyx_n_s_register_error, __pyx_k_register_error, sizeof(__pyx_k_register_error), 0, 0, 1, 1},
jpayne@68 11603 {&__pyx_n_s_remove, __pyx_k_remove, sizeof(__pyx_k_remove), 0, 0, 1, 1},
jpayne@68 11604 {&__pyx_n_s_retval, __pyx_k_retval, sizeof(__pyx_k_retval), 0, 0, 1, 1},
jpayne@68 11605 {&__pyx_n_u_roh, __pyx_k_roh, sizeof(__pyx_k_roh), 0, 1, 0, 1},
jpayne@68 11606 {&__pyx_n_b_samtools, __pyx_k_samtools, sizeof(__pyx_k_samtools), 0, 0, 0, 1},
jpayne@68 11607 {&__pyx_n_u_samtools, __pyx_k_samtools, sizeof(__pyx_k_samtools), 0, 1, 0, 1},
jpayne@68 11608 {&__pyx_n_s_save_stdout, __pyx_k_save_stdout, sizeof(__pyx_k_save_stdout), 0, 0, 1, 1},
jpayne@68 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@68 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@68 11611 {&__pyx_n_s_skip_next, __pyx_k_skip_next, sizeof(__pyx_k_skip_next), 0, 0, 1, 1},
jpayne@68 11612 {&__pyx_n_s_spec, __pyx_k_spec, sizeof(__pyx_k_spec), 0, 0, 1, 1},
jpayne@68 11613 {&__pyx_n_s_split, __pyx_k_split, sizeof(__pyx_k_split), 0, 0, 1, 1},
jpayne@68 11614 {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1},
jpayne@68 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@68 11616 {&__pyx_n_s_startswith, __pyx_k_startswith, sizeof(__pyx_k_startswith), 0, 0, 1, 1},
jpayne@68 11617 {&__pyx_n_u_stats, __pyx_k_stats, sizeof(__pyx_k_stats), 0, 1, 0, 1},
jpayne@68 11618 {&__pyx_n_s_stderr_f, __pyx_k_stderr_f, sizeof(__pyx_k_stderr_f), 0, 0, 1, 1},
jpayne@68 11619 {&__pyx_n_s_stderr_h, __pyx_k_stderr_h, sizeof(__pyx_k_stderr_h), 0, 0, 1, 1},
jpayne@68 11620 {&__pyx_n_s_stdout_f, __pyx_k_stdout_f, sizeof(__pyx_k_stdout_f), 0, 0, 1, 1},
jpayne@68 11621 {&__pyx_n_s_stdout_h, __pyx_k_stdout_h, sizeof(__pyx_k_stdout_h), 0, 0, 1, 1},
jpayne@68 11622 {&__pyx_n_s_stdout_option, __pyx_k_stdout_option, sizeof(__pyx_k_stdout_option), 0, 0, 1, 1},
jpayne@68 11623 {&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1},
jpayne@68 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@68 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@68 11626 {&__pyx_n_u_strict, __pyx_k_strict, sizeof(__pyx_k_strict), 0, 1, 0, 1},
jpayne@68 11627 {&__pyx_n_s_string, __pyx_k_string, sizeof(__pyx_k_string), 0, 0, 1, 1},
jpayne@68 11628 {&__pyx_n_s_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 0, 0, 1, 1},
jpayne@68 11629 {&__pyx_n_s_tempfile, __pyx_k_tempfile, sizeof(__pyx_k_tempfile), 0, 0, 1, 1},
jpayne@68 11630 {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
jpayne@68 11631 {&__pyx_kp_u_threads, __pyx_k_threads, sizeof(__pyx_k_threads), 0, 1, 0, 0},
jpayne@68 11632 {&__pyx_n_s_tobytes, __pyx_k_tobytes, sizeof(__pyx_k_tobytes), 0, 0, 1, 1},
jpayne@68 11633 {&__pyx_n_s_types, __pyx_k_types, sizeof(__pyx_k_types), 0, 0, 1, 1},
jpayne@68 11634 {&__pyx_kp_u_utf_8, __pyx_k_utf_8, sizeof(__pyx_k_utf_8), 0, 1, 0, 0},
jpayne@68 11635 {&__pyx_n_u_view, __pyx_k_view, sizeof(__pyx_k_view), 0, 1, 0, 1},
jpayne@68 11636 {0, 0, 0, 0, 0, 0, 0}
jpayne@68 11637 };
jpayne@68 11638 return __Pyx_InitStrings(__pyx_string_tab);
jpayne@68 11639 }
jpayne@68 11640 /* #### Code section: cached_builtins ### */
jpayne@68 11641 static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
jpayne@68 11642 __pyx_builtin_chr = __Pyx_GetBuiltinName(__pyx_n_s_chr); if (!__pyx_builtin_chr) __PYX_ERR(0, 82, __pyx_L1_error)
jpayne@68 11643 __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 136, __pyx_L1_error)
jpayne@68 11644 __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 218, __pyx_L1_error)
jpayne@68 11645 __pyx_builtin_OverflowError = __Pyx_GetBuiltinName(__pyx_n_s_OverflowError); if (!__pyx_builtin_OverflowError) __PYX_ERR(0, 237, __pyx_L1_error)
jpayne@68 11646 __pyx_builtin_IOError = __Pyx_GetBuiltinName(__pyx_n_s_IOError); if (!__pyx_builtin_IOError) __PYX_ERR(0, 309, __pyx_L1_error)
jpayne@68 11647 __pyx_builtin_OSError = __Pyx_GetBuiltinName(__pyx_n_s_OSError); if (!__pyx_builtin_OSError) __PYX_ERR(0, 327, __pyx_L1_error)
jpayne@68 11648 __pyx_builtin_open = __Pyx_GetBuiltinName(__pyx_n_s_open); if (!__pyx_builtin_open) __PYX_ERR(0, 416, __pyx_L1_error)
jpayne@68 11649 __pyx_builtin_UnicodeDecodeError = __Pyx_GetBuiltinName(__pyx_n_s_UnicodeDecodeError); if (!__pyx_builtin_UnicodeDecodeError) __PYX_ERR(0, 418, __pyx_L1_error)
jpayne@68 11650 __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(2, 120, __pyx_L1_error)
jpayne@68 11651 return 0;
jpayne@68 11652 __pyx_L1_error:;
jpayne@68 11653 return -1;
jpayne@68 11654 }
jpayne@68 11655 /* #### Code section: cached_constants ### */
jpayne@68 11656
jpayne@68 11657 static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
jpayne@68 11658 __Pyx_RefNannyDeclarations
jpayne@68 11659 __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
jpayne@68 11660
jpayne@68 11661 /* "pysam/libcutils.pyx":136
jpayne@68 11662 * return s.encode(encoding or TEXT_ENCODING, errors or ERROR_HANDLER)
jpayne@68 11663 * else:
jpayne@68 11664 * raise TypeError("Argument must be string, bytes or unicode.") # <<<<<<<<<<<<<<
jpayne@68 11665 *
jpayne@68 11666 *
jpayne@68 11667 */
jpayne@68 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@68 11669 __Pyx_GOTREF(__pyx_tuple__2);
jpayne@68 11670 __Pyx_GIVEREF(__pyx_tuple__2);
jpayne@68 11671
jpayne@68 11672 /* "pysam/libcutils.pyx":218
jpayne@68 11673 * if reference is not None:
jpayne@68 11674 * if contig is not None:
jpayne@68 11675 * raise ValueError('contig and reference should not both be specified') # <<<<<<<<<<<<<<
jpayne@68 11676 * contig = reference
jpayne@68 11677 *
jpayne@68 11678 */
jpayne@68 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@68 11680 __Pyx_GOTREF(__pyx_tuple__3);
jpayne@68 11681 __Pyx_GIVEREF(__pyx_tuple__3);
jpayne@68 11682
jpayne@68 11683 /* "pysam/libcutils.pyx":222
jpayne@68 11684 *
jpayne@68 11685 * if contig is not None and region is not None:
jpayne@68 11686 * raise ValueError('contig/reference and region should not both be specified') # <<<<<<<<<<<<<<
jpayne@68 11687 *
jpayne@68 11688 * if end is not None:
jpayne@68 11689 */
jpayne@68 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@68 11691 __Pyx_GOTREF(__pyx_tuple__4);
jpayne@68 11692 __Pyx_GIVEREF(__pyx_tuple__4);
jpayne@68 11693
jpayne@68 11694 /* "pysam/libcutils.pyx":226
jpayne@68 11695 * if end is not None:
jpayne@68 11696 * if stop is not None:
jpayne@68 11697 * raise ValueError('stop and end should not both be specified') # <<<<<<<<<<<<<<
jpayne@68 11698 * stop = end
jpayne@68 11699 *
jpayne@68 11700 */
jpayne@68 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@68 11702 __Pyx_GOTREF(__pyx_tuple__5);
jpayne@68 11703 __Pyx_GIVEREF(__pyx_tuple__5);
jpayne@68 11704
jpayne@68 11705 /* "pysam/libcutils.pyx":230
jpayne@68 11706 *
jpayne@68 11707 * if contig is None and region is None:
jpayne@68 11708 * raise ValueError("neither contig nor region are given") # <<<<<<<<<<<<<<
jpayne@68 11709 *
jpayne@68 11710 * rstart = 0
jpayne@68 11711 */
jpayne@68 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@68 11713 __Pyx_GOTREF(__pyx_tuple__6);
jpayne@68 11714 __Pyx_GIVEREF(__pyx_tuple__6);
jpayne@68 11715
jpayne@68 11716 /* "pysam/libcutils.pyx":416
jpayne@68 11717 * out = []
jpayne@68 11718 * try:
jpayne@68 11719 * with open(fn, "r") as inf: # <<<<<<<<<<<<<<
jpayne@68 11720 * out = inf.read()
jpayne@68 11721 * except UnicodeDecodeError:
jpayne@68 11722 */
jpayne@68 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@68 11724 __Pyx_GOTREF(__pyx_tuple__9);
jpayne@68 11725 __Pyx_GIVEREF(__pyx_tuple__9);
jpayne@68 11726
jpayne@68 11727 /* "pysam/libcutils.pyx":413
jpayne@68 11728 *
jpayne@68 11729 * # get error messages
jpayne@68 11730 * def _collect(fn): # <<<<<<<<<<<<<<
jpayne@68 11731 * out = []
jpayne@68 11732 * try:
jpayne@68 11733 */
jpayne@68 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@68 11735 __Pyx_GOTREF(__pyx_tuple__12);
jpayne@68 11736 __Pyx_GIVEREF(__pyx_tuple__12);
jpayne@68 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@68 11738
jpayne@68 11739 /* "pysam/libcutils.pyx":36
jpayne@68 11740 * #################################################################
jpayne@68 11741 * # Utility functions for quality string conversions
jpayne@68 11742 * cpdef c_array.array qualitystring_to_array(input_str, int offset=33): # <<<<<<<<<<<<<<
jpayne@68 11743 * """convert a qualitystring to an array of quality values."""
jpayne@68 11744 * if input_str is None:
jpayne@68 11745 */
jpayne@68 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@68 11747 __Pyx_GOTREF(__pyx_tuple__16);
jpayne@68 11748 __Pyx_GIVEREF(__pyx_tuple__16);
jpayne@68 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@68 11750 __pyx_tuple__18 = PyTuple_Pack(1, __pyx_int_33); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 36, __pyx_L1_error)
jpayne@68 11751 __Pyx_GOTREF(__pyx_tuple__18);
jpayne@68 11752 __Pyx_GIVEREF(__pyx_tuple__18);
jpayne@68 11753
jpayne@68 11754 /* "pysam/libcutils.pyx":45
jpayne@68 11755 *
jpayne@68 11756 *
jpayne@68 11757 * cpdef array_to_qualitystring(c_array.array qualities, int offset=33): # <<<<<<<<<<<<<<
jpayne@68 11758 * """convert an array of quality values to a string."""
jpayne@68 11759 * if qualities is None:
jpayne@68 11760 */
jpayne@68 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@68 11762 __Pyx_GOTREF(__pyx_tuple__19);
jpayne@68 11763 __Pyx_GIVEREF(__pyx_tuple__19);
jpayne@68 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@68 11765
jpayne@68 11766 /* "pysam/libcutils.pyx":59
jpayne@68 11767 *
jpayne@68 11768 *
jpayne@68 11769 * cpdef qualities_to_qualitystring(qualities, int offset=33): # <<<<<<<<<<<<<<
jpayne@68 11770 * """convert a list or array of quality scores to the string
jpayne@68 11771 * representation used in the SAM format.
jpayne@68 11772 */
jpayne@68 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@68 11774
jpayne@68 11775 /* "pysam/libcutils.pyx":90
jpayne@68 11776 *
jpayne@68 11777 * # Codec error handler that just interprets each bad byte as ISO-8859-1.
jpayne@68 11778 * def latin1_replace(exception): # <<<<<<<<<<<<<<
jpayne@68 11779 * return (chr(exception.object[exception.start]), exception.end)
jpayne@68 11780 *
jpayne@68 11781 */
jpayne@68 11782 __pyx_tuple__22 = PyTuple_Pack(1, __pyx_n_s_exception); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 90, __pyx_L1_error)
jpayne@68 11783 __Pyx_GOTREF(__pyx_tuple__22);
jpayne@68 11784 __Pyx_GIVEREF(__pyx_tuple__22);
jpayne@68 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@68 11786
jpayne@68 11787 /* "pysam/libcutils.pyx":98
jpayne@68 11788 * cdef str ERROR_HANDLER = 'strict'
jpayne@68 11789 *
jpayne@68 11790 * cpdef get_encoding_error_handler(): # <<<<<<<<<<<<<<
jpayne@68 11791 * return ERROR_HANDLER
jpayne@68 11792 *
jpayne@68 11793 */
jpayne@68 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@68 11795
jpayne@68 11796 /* "pysam/libcutils.pyx":101
jpayne@68 11797 * return ERROR_HANDLER
jpayne@68 11798 *
jpayne@68 11799 * cpdef set_encoding_error_handler(name): # <<<<<<<<<<<<<<
jpayne@68 11800 * global ERROR_HANDLER
jpayne@68 11801 * previous = ERROR_HANDLER
jpayne@68 11802 */
jpayne@68 11803 __pyx_tuple__25 = PyTuple_Pack(1, __pyx_n_s_name); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 101, __pyx_L1_error)
jpayne@68 11804 __Pyx_GOTREF(__pyx_tuple__25);
jpayne@68 11805 __Pyx_GIVEREF(__pyx_tuple__25);
jpayne@68 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@68 11807
jpayne@68 11808 /* "pysam/libcutils.pyx":178
jpayne@68 11809 *
jpayne@68 11810 *
jpayne@68 11811 * cpdef parse_region(contig=None, # <<<<<<<<<<<<<<
jpayne@68 11812 * start=None,
jpayne@68 11813 * stop=None,
jpayne@68 11814 */
jpayne@68 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@68 11816 __Pyx_GOTREF(__pyx_tuple__27);
jpayne@68 11817 __Pyx_GIVEREF(__pyx_tuple__27);
jpayne@68 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@68 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@68 11820 __Pyx_GOTREF(__pyx_tuple__29);
jpayne@68 11821 __Pyx_GIVEREF(__pyx_tuple__29);
jpayne@68 11822
jpayne@68 11823 /* "pysam/libcutils.pyx":276
jpayne@68 11824 *
jpayne@68 11825 *
jpayne@68 11826 * def _pysam_dispatch(collection, # <<<<<<<<<<<<<<
jpayne@68 11827 * method,
jpayne@68 11828 * args=None,
jpayne@68 11829 */
jpayne@68 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@68 11831 __Pyx_GOTREF(__pyx_tuple__30);
jpayne@68 11832 __Pyx_GIVEREF(__pyx_tuple__30);
jpayne@68 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@68 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@68 11835 __Pyx_GOTREF(__pyx_tuple__32);
jpayne@68 11836 __Pyx_GIVEREF(__pyx_tuple__32);
jpayne@68 11837 __Pyx_RefNannyFinishContext();
jpayne@68 11838 return 0;
jpayne@68 11839 __pyx_L1_error:;
jpayne@68 11840 __Pyx_RefNannyFinishContext();
jpayne@68 11841 return -1;
jpayne@68 11842 }
jpayne@68 11843 /* #### Code section: init_constants ### */
jpayne@68 11844
jpayne@68 11845 static CYTHON_SMALL_CODE int __Pyx_InitConstants(void) {
jpayne@68 11846 if (__Pyx_CreateStringTabAndInitStrings() < 0) __PYX_ERR(0, 1, __pyx_L1_error);
jpayne@68 11847 __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@68 11848 __pyx_int_33 = PyInt_FromLong(33); if (unlikely(!__pyx_int_33)) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@68 11849 __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@68 11850 return 0;
jpayne@68 11851 __pyx_L1_error:;
jpayne@68 11852 return -1;
jpayne@68 11853 }
jpayne@68 11854 /* #### Code section: init_globals ### */
jpayne@68 11855
jpayne@68 11856 static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
jpayne@68 11857 return 0;
jpayne@68 11858 }
jpayne@68 11859 /* #### Code section: init_module ### */
jpayne@68 11860
jpayne@68 11861 static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
jpayne@68 11862 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
jpayne@68 11863 static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
jpayne@68 11864 static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
jpayne@68 11865 static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
jpayne@68 11866 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
jpayne@68 11867 static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
jpayne@68 11868
jpayne@68 11869 static int __Pyx_modinit_global_init_code(void) {
jpayne@68 11870 __Pyx_RefNannyDeclarations
jpayne@68 11871 __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
jpayne@68 11872 /*--- Global init code ---*/
jpayne@68 11873 __pyx_v_5pysam_9libcutils_ERROR_HANDLER = ((PyObject*)Py_None); Py_INCREF(Py_None);
jpayne@68 11874 __pyx_v_5pysam_9libcutils_FILENAME_ENCODING = ((PyObject*)Py_None); Py_INCREF(Py_None);
jpayne@68 11875 __pyx_v_5pysam_9libcutils_TEXT_ENCODING = ((PyObject*)Py_None); Py_INCREF(Py_None);
jpayne@68 11876 __Pyx_RefNannyFinishContext();
jpayne@68 11877 return 0;
jpayne@68 11878 }
jpayne@68 11879
jpayne@68 11880 static int __Pyx_modinit_variable_export_code(void) {
jpayne@68 11881 __Pyx_RefNannyDeclarations
jpayne@68 11882 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
jpayne@68 11883 /*--- Variable export code ---*/
jpayne@68 11884 __Pyx_RefNannyFinishContext();
jpayne@68 11885 return 0;
jpayne@68 11886 }
jpayne@68 11887
jpayne@68 11888 static int __Pyx_modinit_function_export_code(void) {
jpayne@68 11889 __Pyx_RefNannyDeclarations
jpayne@68 11890 int __pyx_lineno = 0;
jpayne@68 11891 const char *__pyx_filename = NULL;
jpayne@68 11892 int __pyx_clineno = 0;
jpayne@68 11893 __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
jpayne@68 11894 /*--- Function export code ---*/
jpayne@68 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@68 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@68 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@68 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@68 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@68 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@68 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@68 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@68 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@68 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@68 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@68 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@68 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@68 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@68 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@68 11910 __Pyx_RefNannyFinishContext();
jpayne@68 11911 return 0;
jpayne@68 11912 __pyx_L1_error:;
jpayne@68 11913 __Pyx_RefNannyFinishContext();
jpayne@68 11914 return -1;
jpayne@68 11915 }
jpayne@68 11916
jpayne@68 11917 static int __Pyx_modinit_type_init_code(void) {
jpayne@68 11918 __Pyx_RefNannyDeclarations
jpayne@68 11919 __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
jpayne@68 11920 /*--- Type init code ---*/
jpayne@68 11921 __Pyx_RefNannyFinishContext();
jpayne@68 11922 return 0;
jpayne@68 11923 }
jpayne@68 11924
jpayne@68 11925 static int __Pyx_modinit_type_import_code(void) {
jpayne@68 11926 __Pyx_RefNannyDeclarations
jpayne@68 11927 PyObject *__pyx_t_1 = NULL;
jpayne@68 11928 int __pyx_lineno = 0;
jpayne@68 11929 const char *__pyx_filename = NULL;
jpayne@68 11930 int __pyx_clineno = 0;
jpayne@68 11931 __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
jpayne@68 11932 /*--- Type import code ---*/
jpayne@68 11933 __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 9, __pyx_L1_error)
jpayne@68 11934 __Pyx_GOTREF(__pyx_t_1);
jpayne@68 11935 __pyx_ptype_7cpython_4type_type = __Pyx_ImportType_3_0_11(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type",
jpayne@68 11936 #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
jpayne@68 11937 sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(PyTypeObject),
jpayne@68 11938 #elif CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 11939 sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(PyTypeObject),
jpayne@68 11940 #else
jpayne@68 11941 sizeof(PyHeapTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(PyHeapTypeObject),
jpayne@68 11942 #endif
jpayne@68 11943 __Pyx_ImportType_CheckSize_Warn_3_0_11); if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(3, 9, __pyx_L1_error)
jpayne@68 11944 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
jpayne@68 11945 __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 8, __pyx_L1_error)
jpayne@68 11946 __Pyx_GOTREF(__pyx_t_1);
jpayne@68 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@68 11948 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
jpayne@68 11949 __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 15, __pyx_L1_error)
jpayne@68 11950 __Pyx_GOTREF(__pyx_t_1);
jpayne@68 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@68 11952 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
jpayne@68 11953 __pyx_t_1 = PyImport_ImportModule("array"); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 69, __pyx_L1_error)
jpayne@68 11954 __Pyx_GOTREF(__pyx_t_1);
jpayne@68 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@68 11956 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
jpayne@68 11957 __Pyx_RefNannyFinishContext();
jpayne@68 11958 return 0;
jpayne@68 11959 __pyx_L1_error:;
jpayne@68 11960 __Pyx_XDECREF(__pyx_t_1);
jpayne@68 11961 __Pyx_RefNannyFinishContext();
jpayne@68 11962 return -1;
jpayne@68 11963 }
jpayne@68 11964
jpayne@68 11965 static int __Pyx_modinit_variable_import_code(void) {
jpayne@68 11966 __Pyx_RefNannyDeclarations
jpayne@68 11967 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
jpayne@68 11968 /*--- Variable import code ---*/
jpayne@68 11969 __Pyx_RefNannyFinishContext();
jpayne@68 11970 return 0;
jpayne@68 11971 }
jpayne@68 11972
jpayne@68 11973 static int __Pyx_modinit_function_import_code(void) {
jpayne@68 11974 __Pyx_RefNannyDeclarations
jpayne@68 11975 __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
jpayne@68 11976 /*--- Function import code ---*/
jpayne@68 11977 __Pyx_RefNannyFinishContext();
jpayne@68 11978 return 0;
jpayne@68 11979 }
jpayne@68 11980
jpayne@68 11981
jpayne@68 11982 #if PY_MAJOR_VERSION >= 3
jpayne@68 11983 #if CYTHON_PEP489_MULTI_PHASE_INIT
jpayne@68 11984 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
jpayne@68 11985 static int __pyx_pymod_exec_libcutils(PyObject* module); /*proto*/
jpayne@68 11986 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
jpayne@68 11987 {Py_mod_create, (void*)__pyx_pymod_create},
jpayne@68 11988 {Py_mod_exec, (void*)__pyx_pymod_exec_libcutils},
jpayne@68 11989 {0, NULL}
jpayne@68 11990 };
jpayne@68 11991 #endif
jpayne@68 11992
jpayne@68 11993 #ifdef __cplusplus
jpayne@68 11994 namespace {
jpayne@68 11995 struct PyModuleDef __pyx_moduledef =
jpayne@68 11996 #else
jpayne@68 11997 static struct PyModuleDef __pyx_moduledef =
jpayne@68 11998 #endif
jpayne@68 11999 {
jpayne@68 12000 PyModuleDef_HEAD_INIT,
jpayne@68 12001 "libcutils",
jpayne@68 12002 0, /* m_doc */
jpayne@68 12003 #if CYTHON_PEP489_MULTI_PHASE_INIT
jpayne@68 12004 0, /* m_size */
jpayne@68 12005 #elif CYTHON_USE_MODULE_STATE
jpayne@68 12006 sizeof(__pyx_mstate), /* m_size */
jpayne@68 12007 #else
jpayne@68 12008 -1, /* m_size */
jpayne@68 12009 #endif
jpayne@68 12010 __pyx_methods /* m_methods */,
jpayne@68 12011 #if CYTHON_PEP489_MULTI_PHASE_INIT
jpayne@68 12012 __pyx_moduledef_slots, /* m_slots */
jpayne@68 12013 #else
jpayne@68 12014 NULL, /* m_reload */
jpayne@68 12015 #endif
jpayne@68 12016 #if CYTHON_USE_MODULE_STATE
jpayne@68 12017 __pyx_m_traverse, /* m_traverse */
jpayne@68 12018 __pyx_m_clear, /* m_clear */
jpayne@68 12019 NULL /* m_free */
jpayne@68 12020 #else
jpayne@68 12021 NULL, /* m_traverse */
jpayne@68 12022 NULL, /* m_clear */
jpayne@68 12023 NULL /* m_free */
jpayne@68 12024 #endif
jpayne@68 12025 };
jpayne@68 12026 #ifdef __cplusplus
jpayne@68 12027 } /* anonymous namespace */
jpayne@68 12028 #endif
jpayne@68 12029 #endif
jpayne@68 12030
jpayne@68 12031 #ifndef CYTHON_NO_PYINIT_EXPORT
jpayne@68 12032 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
jpayne@68 12033 #elif PY_MAJOR_VERSION < 3
jpayne@68 12034 #ifdef __cplusplus
jpayne@68 12035 #define __Pyx_PyMODINIT_FUNC extern "C" void
jpayne@68 12036 #else
jpayne@68 12037 #define __Pyx_PyMODINIT_FUNC void
jpayne@68 12038 #endif
jpayne@68 12039 #else
jpayne@68 12040 #ifdef __cplusplus
jpayne@68 12041 #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
jpayne@68 12042 #else
jpayne@68 12043 #define __Pyx_PyMODINIT_FUNC PyObject *
jpayne@68 12044 #endif
jpayne@68 12045 #endif
jpayne@68 12046
jpayne@68 12047
jpayne@68 12048 #if PY_MAJOR_VERSION < 3
jpayne@68 12049 __Pyx_PyMODINIT_FUNC initlibcutils(void) CYTHON_SMALL_CODE; /*proto*/
jpayne@68 12050 __Pyx_PyMODINIT_FUNC initlibcutils(void)
jpayne@68 12051 #else
jpayne@68 12052 __Pyx_PyMODINIT_FUNC PyInit_libcutils(void) CYTHON_SMALL_CODE; /*proto*/
jpayne@68 12053 __Pyx_PyMODINIT_FUNC PyInit_libcutils(void)
jpayne@68 12054 #if CYTHON_PEP489_MULTI_PHASE_INIT
jpayne@68 12055 {
jpayne@68 12056 return PyModuleDef_Init(&__pyx_moduledef);
jpayne@68 12057 }
jpayne@68 12058 static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
jpayne@68 12059 #if PY_VERSION_HEX >= 0x030700A1
jpayne@68 12060 static PY_INT64_T main_interpreter_id = -1;
jpayne@68 12061 PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
jpayne@68 12062 if (main_interpreter_id == -1) {
jpayne@68 12063 main_interpreter_id = current_id;
jpayne@68 12064 return (unlikely(current_id == -1)) ? -1 : 0;
jpayne@68 12065 } else if (unlikely(main_interpreter_id != current_id))
jpayne@68 12066 #else
jpayne@68 12067 static PyInterpreterState *main_interpreter = NULL;
jpayne@68 12068 PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
jpayne@68 12069 if (!main_interpreter) {
jpayne@68 12070 main_interpreter = current_interpreter;
jpayne@68 12071 } else if (unlikely(main_interpreter != current_interpreter))
jpayne@68 12072 #endif
jpayne@68 12073 {
jpayne@68 12074 PyErr_SetString(
jpayne@68 12075 PyExc_ImportError,
jpayne@68 12076 "Interpreter change detected - this module can only be loaded into one interpreter per process.");
jpayne@68 12077 return -1;
jpayne@68 12078 }
jpayne@68 12079 return 0;
jpayne@68 12080 }
jpayne@68 12081 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 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@68 12083 #else
jpayne@68 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@68 12085 #endif
jpayne@68 12086 {
jpayne@68 12087 PyObject *value = PyObject_GetAttrString(spec, from_name);
jpayne@68 12088 int result = 0;
jpayne@68 12089 if (likely(value)) {
jpayne@68 12090 if (allow_none || value != Py_None) {
jpayne@68 12091 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 12092 result = PyModule_AddObject(module, to_name, value);
jpayne@68 12093 #else
jpayne@68 12094 result = PyDict_SetItemString(moddict, to_name, value);
jpayne@68 12095 #endif
jpayne@68 12096 }
jpayne@68 12097 Py_DECREF(value);
jpayne@68 12098 } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
jpayne@68 12099 PyErr_Clear();
jpayne@68 12100 } else {
jpayne@68 12101 result = -1;
jpayne@68 12102 }
jpayne@68 12103 return result;
jpayne@68 12104 }
jpayne@68 12105 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def) {
jpayne@68 12106 PyObject *module = NULL, *moddict, *modname;
jpayne@68 12107 CYTHON_UNUSED_VAR(def);
jpayne@68 12108 if (__Pyx_check_single_interpreter())
jpayne@68 12109 return NULL;
jpayne@68 12110 if (__pyx_m)
jpayne@68 12111 return __Pyx_NewRef(__pyx_m);
jpayne@68 12112 modname = PyObject_GetAttrString(spec, "name");
jpayne@68 12113 if (unlikely(!modname)) goto bad;
jpayne@68 12114 module = PyModule_NewObject(modname);
jpayne@68 12115 Py_DECREF(modname);
jpayne@68 12116 if (unlikely(!module)) goto bad;
jpayne@68 12117 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 12118 moddict = module;
jpayne@68 12119 #else
jpayne@68 12120 moddict = PyModule_GetDict(module);
jpayne@68 12121 if (unlikely(!moddict)) goto bad;
jpayne@68 12122 #endif
jpayne@68 12123 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
jpayne@68 12124 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
jpayne@68 12125 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
jpayne@68 12126 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
jpayne@68 12127 return module;
jpayne@68 12128 bad:
jpayne@68 12129 Py_XDECREF(module);
jpayne@68 12130 return NULL;
jpayne@68 12131 }
jpayne@68 12132
jpayne@68 12133
jpayne@68 12134 static CYTHON_SMALL_CODE int __pyx_pymod_exec_libcutils(PyObject *__pyx_pyinit_module)
jpayne@68 12135 #endif
jpayne@68 12136 #endif
jpayne@68 12137 {
jpayne@68 12138 int stringtab_initialized = 0;
jpayne@68 12139 #if CYTHON_USE_MODULE_STATE
jpayne@68 12140 int pystate_addmodule_run = 0;
jpayne@68 12141 #endif
jpayne@68 12142 PyObject *__pyx_t_1 = NULL;
jpayne@68 12143 PyObject *__pyx_t_2 = NULL;
jpayne@68 12144 PyObject *__pyx_t_3 = NULL;
jpayne@68 12145 PyObject *__pyx_t_4 = NULL;
jpayne@68 12146 int __pyx_t_5;
jpayne@68 12147 int __pyx_lineno = 0;
jpayne@68 12148 const char *__pyx_filename = NULL;
jpayne@68 12149 int __pyx_clineno = 0;
jpayne@68 12150 __Pyx_RefNannyDeclarations
jpayne@68 12151 #if CYTHON_PEP489_MULTI_PHASE_INIT
jpayne@68 12152 if (__pyx_m) {
jpayne@68 12153 if (__pyx_m == __pyx_pyinit_module) return 0;
jpayne@68 12154 PyErr_SetString(PyExc_RuntimeError, "Module 'libcutils' has already been imported. Re-initialisation is not supported.");
jpayne@68 12155 return -1;
jpayne@68 12156 }
jpayne@68 12157 #elif PY_MAJOR_VERSION >= 3
jpayne@68 12158 if (__pyx_m) return __Pyx_NewRef(__pyx_m);
jpayne@68 12159 #endif
jpayne@68 12160 /*--- Module creation code ---*/
jpayne@68 12161 #if CYTHON_PEP489_MULTI_PHASE_INIT
jpayne@68 12162 __pyx_m = __pyx_pyinit_module;
jpayne@68 12163 Py_INCREF(__pyx_m);
jpayne@68 12164 #else
jpayne@68 12165 #if PY_MAJOR_VERSION < 3
jpayne@68 12166 __pyx_m = Py_InitModule4("libcutils", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
jpayne@68 12167 if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@68 12168 #elif CYTHON_USE_MODULE_STATE
jpayne@68 12169 __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@68 12170 {
jpayne@68 12171 int add_module_result = PyState_AddModule(__pyx_t_1, &__pyx_moduledef);
jpayne@68 12172 __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to "libcutils" pseudovariable */
jpayne@68 12173 if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@68 12174 pystate_addmodule_run = 1;
jpayne@68 12175 }
jpayne@68 12176 #else
jpayne@68 12177 __pyx_m = PyModule_Create(&__pyx_moduledef);
jpayne@68 12178 if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@68 12179 #endif
jpayne@68 12180 #endif
jpayne@68 12181 CYTHON_UNUSED_VAR(__pyx_t_1);
jpayne@68 12182 __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@68 12183 Py_INCREF(__pyx_d);
jpayne@68 12184 __pyx_b = __Pyx_PyImport_AddModuleRef(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@68 12185 __pyx_cython_runtime = __Pyx_PyImport_AddModuleRef((const char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@68 12186 if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@68 12187 #if CYTHON_REFNANNY
jpayne@68 12188 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
jpayne@68 12189 if (!__Pyx_RefNanny) {
jpayne@68 12190 PyErr_Clear();
jpayne@68 12191 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
jpayne@68 12192 if (!__Pyx_RefNanny)
jpayne@68 12193 Py_FatalError("failed to import 'refnanny' module");
jpayne@68 12194 }
jpayne@68 12195 #endif
jpayne@68 12196 __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_libcutils(void)", 0);
jpayne@68 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@68 12198 #ifdef __Pxy_PyFrame_Initialize_Offsets
jpayne@68 12199 __Pxy_PyFrame_Initialize_Offsets();
jpayne@68 12200 #endif
jpayne@68 12201 __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@68 12202 __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@68 12203 __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@68 12204 #ifdef __Pyx_CyFunction_USED
jpayne@68 12205 if (__pyx_CyFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@68 12206 #endif
jpayne@68 12207 #ifdef __Pyx_FusedFunction_USED
jpayne@68 12208 if (__pyx_FusedFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@68 12209 #endif
jpayne@68 12210 #ifdef __Pyx_Coroutine_USED
jpayne@68 12211 if (__pyx_Coroutine_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@68 12212 #endif
jpayne@68 12213 #ifdef __Pyx_Generator_USED
jpayne@68 12214 if (__pyx_Generator_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@68 12215 #endif
jpayne@68 12216 #ifdef __Pyx_AsyncGen_USED
jpayne@68 12217 if (__pyx_AsyncGen_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@68 12218 #endif
jpayne@68 12219 #ifdef __Pyx_StopAsyncIteration_USED
jpayne@68 12220 if (__pyx_StopAsyncIteration_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@68 12221 #endif
jpayne@68 12222 /*--- Library function declarations ---*/
jpayne@68 12223 /*--- Threads initialization code ---*/
jpayne@68 12224 #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
jpayne@68 12225 PyEval_InitThreads();
jpayne@68 12226 #endif
jpayne@68 12227 /*--- Initialize various global constants etc. ---*/
jpayne@68 12228 if (__Pyx_InitConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@68 12229 stringtab_initialized = 1;
jpayne@68 12230 if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@68 12231 #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
jpayne@68 12232 if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@68 12233 #endif
jpayne@68 12234 if (__pyx_module_is_main_pysam__libcutils) {
jpayne@68 12235 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@68 12236 }
jpayne@68 12237 #if PY_MAJOR_VERSION >= 3
jpayne@68 12238 {
jpayne@68 12239 PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@68 12240 if (!PyDict_GetItemString(modules, "pysam.libcutils")) {
jpayne@68 12241 if (unlikely((PyDict_SetItemString(modules, "pysam.libcutils", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@68 12242 }
jpayne@68 12243 }
jpayne@68 12244 #endif
jpayne@68 12245 /*--- Builtin init code ---*/
jpayne@68 12246 if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@68 12247 /*--- Constants init code ---*/
jpayne@68 12248 if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@68 12249 /*--- Global type/function init code ---*/
jpayne@68 12250 (void)__Pyx_modinit_global_init_code();
jpayne@68 12251 (void)__Pyx_modinit_variable_export_code();
jpayne@68 12252 if (unlikely((__Pyx_modinit_function_export_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@68 12253 (void)__Pyx_modinit_type_init_code();
jpayne@68 12254 if (unlikely((__Pyx_modinit_type_import_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@68 12255 (void)__Pyx_modinit_variable_import_code();
jpayne@68 12256 (void)__Pyx_modinit_function_import_code();
jpayne@68 12257 /*--- Execution code ---*/
jpayne@68 12258 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
jpayne@68 12259 if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@68 12260 #endif
jpayne@68 12261
jpayne@68 12262 /* "pysam/libcutils.pyx":2
jpayne@68 12263 * # cython: language_level=3
jpayne@68 12264 * import types # <<<<<<<<<<<<<<
jpayne@68 12265 * import sys
jpayne@68 12266 * import string
jpayne@68 12267 */
jpayne@68 12268 __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_n_s_types, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2, __pyx_L1_error)
jpayne@68 12269 __Pyx_GOTREF(__pyx_t_2);
jpayne@68 12270 if (PyDict_SetItem(__pyx_d, __pyx_n_s_types, __pyx_t_2) < 0) __PYX_ERR(0, 2, __pyx_L1_error)
jpayne@68 12271 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@68 12272
jpayne@68 12273 /* "pysam/libcutils.pyx":3
jpayne@68 12274 * # cython: language_level=3
jpayne@68 12275 * import types
jpayne@68 12276 * import sys # <<<<<<<<<<<<<<
jpayne@68 12277 * import string
jpayne@68 12278 * import re
jpayne@68 12279 */
jpayne@68 12280 __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_n_s_sys, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3, __pyx_L1_error)
jpayne@68 12281 __Pyx_GOTREF(__pyx_t_2);
jpayne@68 12282 if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys, __pyx_t_2) < 0) __PYX_ERR(0, 3, __pyx_L1_error)
jpayne@68 12283 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@68 12284
jpayne@68 12285 /* "pysam/libcutils.pyx":4
jpayne@68 12286 * import types
jpayne@68 12287 * import sys
jpayne@68 12288 * import string # <<<<<<<<<<<<<<
jpayne@68 12289 * import re
jpayne@68 12290 * import tempfile
jpayne@68 12291 */
jpayne@68 12292 __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_n_s_string, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4, __pyx_L1_error)
jpayne@68 12293 __Pyx_GOTREF(__pyx_t_2);
jpayne@68 12294 if (PyDict_SetItem(__pyx_d, __pyx_n_s_string, __pyx_t_2) < 0) __PYX_ERR(0, 4, __pyx_L1_error)
jpayne@68 12295 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@68 12296
jpayne@68 12297 /* "pysam/libcutils.pyx":5
jpayne@68 12298 * import sys
jpayne@68 12299 * import string
jpayne@68 12300 * import re # <<<<<<<<<<<<<<
jpayne@68 12301 * import tempfile
jpayne@68 12302 * import os
jpayne@68 12303 */
jpayne@68 12304 __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_n_s_re, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5, __pyx_L1_error)
jpayne@68 12305 __Pyx_GOTREF(__pyx_t_2);
jpayne@68 12306 if (PyDict_SetItem(__pyx_d, __pyx_n_s_re, __pyx_t_2) < 0) __PYX_ERR(0, 5, __pyx_L1_error)
jpayne@68 12307 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@68 12308
jpayne@68 12309 /* "pysam/libcutils.pyx":6
jpayne@68 12310 * import string
jpayne@68 12311 * import re
jpayne@68 12312 * import tempfile # <<<<<<<<<<<<<<
jpayne@68 12313 * import os
jpayne@68 12314 * import io
jpayne@68 12315 */
jpayne@68 12316 __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_n_s_tempfile, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 6, __pyx_L1_error)
jpayne@68 12317 __Pyx_GOTREF(__pyx_t_2);
jpayne@68 12318 if (PyDict_SetItem(__pyx_d, __pyx_n_s_tempfile, __pyx_t_2) < 0) __PYX_ERR(0, 6, __pyx_L1_error)
jpayne@68 12319 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@68 12320
jpayne@68 12321 /* "pysam/libcutils.pyx":7
jpayne@68 12322 * import re
jpayne@68 12323 * import tempfile
jpayne@68 12324 * import os # <<<<<<<<<<<<<<
jpayne@68 12325 * import io
jpayne@68 12326 * from contextlib import contextmanager
jpayne@68 12327 */
jpayne@68 12328 __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_n_s_os, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 7, __pyx_L1_error)
jpayne@68 12329 __Pyx_GOTREF(__pyx_t_2);
jpayne@68 12330 if (PyDict_SetItem(__pyx_d, __pyx_n_s_os, __pyx_t_2) < 0) __PYX_ERR(0, 7, __pyx_L1_error)
jpayne@68 12331 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@68 12332
jpayne@68 12333 /* "pysam/libcutils.pyx":8
jpayne@68 12334 * import tempfile
jpayne@68 12335 * import os
jpayne@68 12336 * import io # <<<<<<<<<<<<<<
jpayne@68 12337 * from contextlib import contextmanager
jpayne@68 12338 * from codecs import register_error
jpayne@68 12339 */
jpayne@68 12340 __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_n_s_io, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 8, __pyx_L1_error)
jpayne@68 12341 __Pyx_GOTREF(__pyx_t_2);
jpayne@68 12342 if (PyDict_SetItem(__pyx_d, __pyx_n_s_io, __pyx_t_2) < 0) __PYX_ERR(0, 8, __pyx_L1_error)
jpayne@68 12343 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@68 12344
jpayne@68 12345 /* "pysam/libcutils.pyx":9
jpayne@68 12346 * import os
jpayne@68 12347 * import io
jpayne@68 12348 * from contextlib import contextmanager # <<<<<<<<<<<<<<
jpayne@68 12349 * from codecs import register_error
jpayne@68 12350 *
jpayne@68 12351 */
jpayne@68 12352 __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 9, __pyx_L1_error)
jpayne@68 12353 __Pyx_GOTREF(__pyx_t_2);
jpayne@68 12354 __Pyx_INCREF(__pyx_n_s_contextmanager);
jpayne@68 12355 __Pyx_GIVEREF(__pyx_n_s_contextmanager);
jpayne@68 12356 if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_contextmanager)) __PYX_ERR(0, 9, __pyx_L1_error);
jpayne@68 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@68 12358 __Pyx_GOTREF(__pyx_t_3);
jpayne@68 12359 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@68 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@68 12361 __Pyx_GOTREF(__pyx_t_2);
jpayne@68 12362 if (PyDict_SetItem(__pyx_d, __pyx_n_s_contextmanager, __pyx_t_2) < 0) __PYX_ERR(0, 9, __pyx_L1_error)
jpayne@68 12363 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@68 12364 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@68 12365
jpayne@68 12366 /* "pysam/libcutils.pyx":10
jpayne@68 12367 * import io
jpayne@68 12368 * from contextlib import contextmanager
jpayne@68 12369 * from codecs import register_error # <<<<<<<<<<<<<<
jpayne@68 12370 *
jpayne@68 12371 * from cpython.version cimport PY_MAJOR_VERSION, PY_MINOR_VERSION
jpayne@68 12372 */
jpayne@68 12373 __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 10, __pyx_L1_error)
jpayne@68 12374 __Pyx_GOTREF(__pyx_t_3);
jpayne@68 12375 __Pyx_INCREF(__pyx_n_s_register_error);
jpayne@68 12376 __Pyx_GIVEREF(__pyx_n_s_register_error);
jpayne@68 12377 if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_register_error)) __PYX_ERR(0, 10, __pyx_L1_error);
jpayne@68 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@68 12379 __Pyx_GOTREF(__pyx_t_2);
jpayne@68 12380 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@68 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@68 12382 __Pyx_GOTREF(__pyx_t_3);
jpayne@68 12383 if (PyDict_SetItem(__pyx_d, __pyx_n_s_register_error, __pyx_t_3) < 0) __PYX_ERR(0, 10, __pyx_L1_error)
jpayne@68 12384 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@68 12385 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@68 12386
jpayne@68 12387 /* "pysam/libcutils.pyx":32
jpayne@68 12388 * #####################################################################
jpayne@68 12389 * # hard-coded constants
jpayne@68 12390 * cdef int MAX_POS = (1 << 31) - 1 # <<<<<<<<<<<<<<
jpayne@68 12391 *
jpayne@68 12392 * #################################################################
jpayne@68 12393 */
jpayne@68 12394 __pyx_v_5pysam_9libcutils_MAX_POS = 0x7fffffff;
jpayne@68 12395
jpayne@68 12396 /* "pysam/libcutils.pyx":36
jpayne@68 12397 * #################################################################
jpayne@68 12398 * # Utility functions for quality string conversions
jpayne@68 12399 * cpdef c_array.array qualitystring_to_array(input_str, int offset=33): # <<<<<<<<<<<<<<
jpayne@68 12400 * """convert a qualitystring to an array of quality values."""
jpayne@68 12401 * if input_str is None:
jpayne@68 12402 */
jpayne@68 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@68 12404 __Pyx_GOTREF(__pyx_t_2);
jpayne@68 12405 __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__18);
jpayne@68 12406 if (PyDict_SetItem(__pyx_d, __pyx_n_s_qualitystring_to_array, __pyx_t_2) < 0) __PYX_ERR(0, 36, __pyx_L1_error)
jpayne@68 12407 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@68 12408
jpayne@68 12409 /* "pysam/libcutils.pyx":45
jpayne@68 12410 *
jpayne@68 12411 *
jpayne@68 12412 * cpdef array_to_qualitystring(c_array.array qualities, int offset=33): # <<<<<<<<<<<<<<
jpayne@68 12413 * """convert an array of quality values to a string."""
jpayne@68 12414 * if qualities is None:
jpayne@68 12415 */
jpayne@68 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@68 12417 __Pyx_GOTREF(__pyx_t_2);
jpayne@68 12418 __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__18);
jpayne@68 12419 if (PyDict_SetItem(__pyx_d, __pyx_n_s_array_to_qualitystring, __pyx_t_2) < 0) __PYX_ERR(0, 45, __pyx_L1_error)
jpayne@68 12420 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@68 12421
jpayne@68 12422 /* "pysam/libcutils.pyx":59
jpayne@68 12423 *
jpayne@68 12424 *
jpayne@68 12425 * cpdef qualities_to_qualitystring(qualities, int offset=33): # <<<<<<<<<<<<<<
jpayne@68 12426 * """convert a list or array of quality scores to the string
jpayne@68 12427 * representation used in the SAM format.
jpayne@68 12428 */
jpayne@68 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@68 12430 __Pyx_GOTREF(__pyx_t_2);
jpayne@68 12431 __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__18);
jpayne@68 12432 if (PyDict_SetItem(__pyx_d, __pyx_n_s_qualities_to_qualitystring, __pyx_t_2) < 0) __PYX_ERR(0, 59, __pyx_L1_error)
jpayne@68 12433 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@68 12434
jpayne@68 12435 /* "pysam/libcutils.pyx":90
jpayne@68 12436 *
jpayne@68 12437 * # Codec error handler that just interprets each bad byte as ISO-8859-1.
jpayne@68 12438 * def latin1_replace(exception): # <<<<<<<<<<<<<<
jpayne@68 12439 * return (chr(exception.object[exception.start]), exception.end)
jpayne@68 12440 *
jpayne@68 12441 */
jpayne@68 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@68 12443 __Pyx_GOTREF(__pyx_t_2);
jpayne@68 12444 if (PyDict_SetItem(__pyx_d, __pyx_n_s_latin1_replace, __pyx_t_2) < 0) __PYX_ERR(0, 90, __pyx_L1_error)
jpayne@68 12445 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@68 12446
jpayne@68 12447 /* "pysam/libcutils.pyx":93
jpayne@68 12448 * return (chr(exception.object[exception.start]), exception.end)
jpayne@68 12449 *
jpayne@68 12450 * register_error('pysam.latin1replace', latin1_replace) # <<<<<<<<<<<<<<
jpayne@68 12451 *
jpayne@68 12452 *
jpayne@68 12453 */
jpayne@68 12454 __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_register_error); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 93, __pyx_L1_error)
jpayne@68 12455 __Pyx_GOTREF(__pyx_t_2);
jpayne@68 12456 __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_latin1_replace); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 93, __pyx_L1_error)
jpayne@68 12457 __Pyx_GOTREF(__pyx_t_3);
jpayne@68 12458 __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 93, __pyx_L1_error)
jpayne@68 12459 __Pyx_GOTREF(__pyx_t_4);
jpayne@68 12460 __Pyx_INCREF(__pyx_kp_u_pysam_latin1replace);
jpayne@68 12461 __Pyx_GIVEREF(__pyx_kp_u_pysam_latin1replace);
jpayne@68 12462 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_u_pysam_latin1replace)) __PYX_ERR(0, 93, __pyx_L1_error);
jpayne@68 12463 __Pyx_GIVEREF(__pyx_t_3);
jpayne@68 12464 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3)) __PYX_ERR(0, 93, __pyx_L1_error);
jpayne@68 12465 __pyx_t_3 = 0;
jpayne@68 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@68 12467 __Pyx_GOTREF(__pyx_t_3);
jpayne@68 12468 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@68 12469 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
jpayne@68 12470 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@68 12471
jpayne@68 12472 /* "pysam/libcutils.pyx":96
jpayne@68 12473 *
jpayne@68 12474 *
jpayne@68 12475 * cdef str ERROR_HANDLER = 'strict' # <<<<<<<<<<<<<<
jpayne@68 12476 *
jpayne@68 12477 * cpdef get_encoding_error_handler():
jpayne@68 12478 */
jpayne@68 12479 __Pyx_INCREF(__pyx_n_u_strict);
jpayne@68 12480 __Pyx_XGOTREF(__pyx_v_5pysam_9libcutils_ERROR_HANDLER);
jpayne@68 12481 __Pyx_DECREF_SET(__pyx_v_5pysam_9libcutils_ERROR_HANDLER, __pyx_n_u_strict);
jpayne@68 12482 __Pyx_GIVEREF(__pyx_n_u_strict);
jpayne@68 12483
jpayne@68 12484 /* "pysam/libcutils.pyx":98
jpayne@68 12485 * cdef str ERROR_HANDLER = 'strict'
jpayne@68 12486 *
jpayne@68 12487 * cpdef get_encoding_error_handler(): # <<<<<<<<<<<<<<
jpayne@68 12488 * return ERROR_HANDLER
jpayne@68 12489 *
jpayne@68 12490 */
jpayne@68 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@68 12492 __Pyx_GOTREF(__pyx_t_3);
jpayne@68 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@68 12494 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@68 12495
jpayne@68 12496 /* "pysam/libcutils.pyx":101
jpayne@68 12497 * return ERROR_HANDLER
jpayne@68 12498 *
jpayne@68 12499 * cpdef set_encoding_error_handler(name): # <<<<<<<<<<<<<<
jpayne@68 12500 * global ERROR_HANDLER
jpayne@68 12501 * previous = ERROR_HANDLER
jpayne@68 12502 */
jpayne@68 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@68 12504 __Pyx_GOTREF(__pyx_t_3);
jpayne@68 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@68 12506 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@68 12507
jpayne@68 12508 /* "pysam/libcutils.pyx":115
jpayne@68 12509 *
jpayne@68 12510 * # filename encoding (adapted from lxml.etree.pyx)
jpayne@68 12511 * cdef str FILENAME_ENCODING = sys.getfilesystemencoding() or sys.getdefaultencoding() or 'ascii' # <<<<<<<<<<<<<<
jpayne@68 12512 * cdef str TEXT_ENCODING = 'utf-8'
jpayne@68 12513 *
jpayne@68 12514 */
jpayne@68 12515 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_sys); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 115, __pyx_L1_error)
jpayne@68 12516 __Pyx_GOTREF(__pyx_t_4);
jpayne@68 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@68 12518 __Pyx_GOTREF(__pyx_t_2);
jpayne@68 12519 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
jpayne@68 12520 __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 115, __pyx_L1_error)
jpayne@68 12521 __Pyx_GOTREF(__pyx_t_4);
jpayne@68 12522 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@68 12523 __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 115, __pyx_L1_error)
jpayne@68 12524 if (!__pyx_t_5) {
jpayne@68 12525 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
jpayne@68 12526 } else {
jpayne@68 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@68 12528 __Pyx_INCREF(__pyx_t_4);
jpayne@68 12529 __pyx_t_3 = __pyx_t_4;
jpayne@68 12530 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
jpayne@68 12531 goto __pyx_L2_bool_binop_done;
jpayne@68 12532 }
jpayne@68 12533 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_sys); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 115, __pyx_L1_error)
jpayne@68 12534 __Pyx_GOTREF(__pyx_t_4);
jpayne@68 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@68 12536 __Pyx_GOTREF(__pyx_t_2);
jpayne@68 12537 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
jpayne@68 12538 __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 115, __pyx_L1_error)
jpayne@68 12539 __Pyx_GOTREF(__pyx_t_4);
jpayne@68 12540 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
jpayne@68 12541 __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 115, __pyx_L1_error)
jpayne@68 12542 if (!__pyx_t_5) {
jpayne@68 12543 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
jpayne@68 12544 } else {
jpayne@68 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@68 12546 __Pyx_INCREF(__pyx_t_4);
jpayne@68 12547 __pyx_t_3 = __pyx_t_4;
jpayne@68 12548 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
jpayne@68 12549 goto __pyx_L2_bool_binop_done;
jpayne@68 12550 }
jpayne@68 12551 __Pyx_INCREF(__pyx_n_u_ascii);
jpayne@68 12552 __pyx_t_3 = __pyx_n_u_ascii;
jpayne@68 12553 __pyx_L2_bool_binop_done:;
jpayne@68 12554 __Pyx_XGOTREF(__pyx_v_5pysam_9libcutils_FILENAME_ENCODING);
jpayne@68 12555 __Pyx_DECREF_SET(__pyx_v_5pysam_9libcutils_FILENAME_ENCODING, ((PyObject*)__pyx_t_3));
jpayne@68 12556 __Pyx_GIVEREF(__pyx_t_3);
jpayne@68 12557 __pyx_t_3 = 0;
jpayne@68 12558
jpayne@68 12559 /* "pysam/libcutils.pyx":116
jpayne@68 12560 * # filename encoding (adapted from lxml.etree.pyx)
jpayne@68 12561 * cdef str FILENAME_ENCODING = sys.getfilesystemencoding() or sys.getdefaultencoding() or 'ascii'
jpayne@68 12562 * cdef str TEXT_ENCODING = 'utf-8' # <<<<<<<<<<<<<<
jpayne@68 12563 *
jpayne@68 12564 * cdef bytes encode_filename(object filename):
jpayne@68 12565 */
jpayne@68 12566 __Pyx_INCREF(__pyx_kp_u_utf_8);
jpayne@68 12567 __Pyx_XGOTREF(__pyx_v_5pysam_9libcutils_TEXT_ENCODING);
jpayne@68 12568 __Pyx_DECREF_SET(__pyx_v_5pysam_9libcutils_TEXT_ENCODING, __pyx_kp_u_utf_8);
jpayne@68 12569 __Pyx_GIVEREF(__pyx_kp_u_utf_8);
jpayne@68 12570
jpayne@68 12571 /* "pysam/libcutils.pyx":178
jpayne@68 12572 *
jpayne@68 12573 *
jpayne@68 12574 * cpdef parse_region(contig=None, # <<<<<<<<<<<<<<
jpayne@68 12575 * start=None,
jpayne@68 12576 * stop=None,
jpayne@68 12577 */
jpayne@68 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@68 12579 __Pyx_GOTREF(__pyx_t_3);
jpayne@68 12580 __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__29);
jpayne@68 12581 if (PyDict_SetItem(__pyx_d, __pyx_n_s_parse_region, __pyx_t_3) < 0) __PYX_ERR(0, 178, __pyx_L1_error)
jpayne@68 12582 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@68 12583
jpayne@68 12584 /* "pysam/libcutils.pyx":276
jpayne@68 12585 *
jpayne@68 12586 *
jpayne@68 12587 * def _pysam_dispatch(collection, # <<<<<<<<<<<<<<
jpayne@68 12588 * method,
jpayne@68 12589 * args=None,
jpayne@68 12590 */
jpayne@68 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@68 12592 __Pyx_GOTREF(__pyx_t_3);
jpayne@68 12593 __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__32);
jpayne@68 12594 if (PyDict_SetItem(__pyx_d, __pyx_n_s_pysam_dispatch, __pyx_t_3) < 0) __PYX_ERR(0, 276, __pyx_L1_error)
jpayne@68 12595 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@68 12596
jpayne@68 12597 /* "pysam/libcutils.pyx":437
jpayne@68 12598 *
jpayne@68 12599 *
jpayne@68 12600 * __all__ = [ # <<<<<<<<<<<<<<
jpayne@68 12601 * "qualitystring_to_array",
jpayne@68 12602 * "array_to_qualitystring",
jpayne@68 12603 */
jpayne@68 12604 __pyx_t_3 = PyList_New(5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 437, __pyx_L1_error)
jpayne@68 12605 __Pyx_GOTREF(__pyx_t_3);
jpayne@68 12606 __Pyx_INCREF(__pyx_n_u_qualitystring_to_array);
jpayne@68 12607 __Pyx_GIVEREF(__pyx_n_u_qualitystring_to_array);
jpayne@68 12608 if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_u_qualitystring_to_array)) __PYX_ERR(0, 437, __pyx_L1_error);
jpayne@68 12609 __Pyx_INCREF(__pyx_n_u_array_to_qualitystring);
jpayne@68 12610 __Pyx_GIVEREF(__pyx_n_u_array_to_qualitystring);
jpayne@68 12611 if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 1, __pyx_n_u_array_to_qualitystring)) __PYX_ERR(0, 437, __pyx_L1_error);
jpayne@68 12612 __Pyx_INCREF(__pyx_n_u_qualities_to_qualitystring);
jpayne@68 12613 __Pyx_GIVEREF(__pyx_n_u_qualities_to_qualitystring);
jpayne@68 12614 if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 2, __pyx_n_u_qualities_to_qualitystring)) __PYX_ERR(0, 437, __pyx_L1_error);
jpayne@68 12615 __Pyx_INCREF(__pyx_n_u_get_encoding_error_handler);
jpayne@68 12616 __Pyx_GIVEREF(__pyx_n_u_get_encoding_error_handler);
jpayne@68 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@68 12618 __Pyx_INCREF(__pyx_n_u_set_encoding_error_handler);
jpayne@68 12619 __Pyx_GIVEREF(__pyx_n_u_set_encoding_error_handler);
jpayne@68 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@68 12621 if (PyDict_SetItem(__pyx_d, __pyx_n_s_all, __pyx_t_3) < 0) __PYX_ERR(0, 437, __pyx_L1_error)
jpayne@68 12622 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@68 12623
jpayne@68 12624 /* "pysam/libcutils.pyx":1
jpayne@68 12625 * # cython: language_level=3 # <<<<<<<<<<<<<<
jpayne@68 12626 * import types
jpayne@68 12627 * import sys
jpayne@68 12628 */
jpayne@68 12629 __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@68 12630 __Pyx_GOTREF(__pyx_t_3);
jpayne@68 12631 if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_3) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
jpayne@68 12632 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
jpayne@68 12633
jpayne@68 12634 /*--- Wrapped vars code ---*/
jpayne@68 12635
jpayne@68 12636 goto __pyx_L0;
jpayne@68 12637 __pyx_L1_error:;
jpayne@68 12638 __Pyx_XDECREF(__pyx_t_2);
jpayne@68 12639 __Pyx_XDECREF(__pyx_t_3);
jpayne@68 12640 __Pyx_XDECREF(__pyx_t_4);
jpayne@68 12641 if (__pyx_m) {
jpayne@68 12642 if (__pyx_d && stringtab_initialized) {
jpayne@68 12643 __Pyx_AddTraceback("init pysam.libcutils", __pyx_clineno, __pyx_lineno, __pyx_filename);
jpayne@68 12644 }
jpayne@68 12645 #if !CYTHON_USE_MODULE_STATE
jpayne@68 12646 Py_CLEAR(__pyx_m);
jpayne@68 12647 #else
jpayne@68 12648 Py_DECREF(__pyx_m);
jpayne@68 12649 if (pystate_addmodule_run) {
jpayne@68 12650 PyObject *tp, *value, *tb;
jpayne@68 12651 PyErr_Fetch(&tp, &value, &tb);
jpayne@68 12652 PyState_RemoveModule(&__pyx_moduledef);
jpayne@68 12653 PyErr_Restore(tp, value, tb);
jpayne@68 12654 }
jpayne@68 12655 #endif
jpayne@68 12656 } else if (!PyErr_Occurred()) {
jpayne@68 12657 PyErr_SetString(PyExc_ImportError, "init pysam.libcutils");
jpayne@68 12658 }
jpayne@68 12659 __pyx_L0:;
jpayne@68 12660 __Pyx_RefNannyFinishContext();
jpayne@68 12661 #if CYTHON_PEP489_MULTI_PHASE_INIT
jpayne@68 12662 return (__pyx_m != NULL) ? 0 : -1;
jpayne@68 12663 #elif PY_MAJOR_VERSION >= 3
jpayne@68 12664 return __pyx_m;
jpayne@68 12665 #else
jpayne@68 12666 return;
jpayne@68 12667 #endif
jpayne@68 12668 }
jpayne@68 12669 /* #### Code section: cleanup_globals ### */
jpayne@68 12670 /* #### Code section: cleanup_module ### */
jpayne@68 12671 /* #### Code section: main_method ### */
jpayne@68 12672 /* #### Code section: utility_code_pragmas ### */
jpayne@68 12673 #ifdef _MSC_VER
jpayne@68 12674 #pragma warning( push )
jpayne@68 12675 /* Warning 4127: conditional expression is constant
jpayne@68 12676 * Cython uses constant conditional expressions to allow in inline functions to be optimized at
jpayne@68 12677 * compile-time, so this warning is not useful
jpayne@68 12678 */
jpayne@68 12679 #pragma warning( disable : 4127 )
jpayne@68 12680 #endif
jpayne@68 12681
jpayne@68 12682
jpayne@68 12683
jpayne@68 12684 /* #### Code section: utility_code_def ### */
jpayne@68 12685
jpayne@68 12686 /* --- Runtime support code --- */
jpayne@68 12687 /* Refnanny */
jpayne@68 12688 #if CYTHON_REFNANNY
jpayne@68 12689 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
jpayne@68 12690 PyObject *m = NULL, *p = NULL;
jpayne@68 12691 void *r = NULL;
jpayne@68 12692 m = PyImport_ImportModule(modname);
jpayne@68 12693 if (!m) goto end;
jpayne@68 12694 p = PyObject_GetAttrString(m, "RefNannyAPI");
jpayne@68 12695 if (!p) goto end;
jpayne@68 12696 r = PyLong_AsVoidPtr(p);
jpayne@68 12697 end:
jpayne@68 12698 Py_XDECREF(p);
jpayne@68 12699 Py_XDECREF(m);
jpayne@68 12700 return (__Pyx_RefNannyAPIStruct *)r;
jpayne@68 12701 }
jpayne@68 12702 #endif
jpayne@68 12703
jpayne@68 12704 /* PyErrExceptionMatches */
jpayne@68 12705 #if CYTHON_FAST_THREAD_STATE
jpayne@68 12706 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
jpayne@68 12707 Py_ssize_t i, n;
jpayne@68 12708 n = PyTuple_GET_SIZE(tuple);
jpayne@68 12709 #if PY_MAJOR_VERSION >= 3
jpayne@68 12710 for (i=0; i<n; i++) {
jpayne@68 12711 if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
jpayne@68 12712 }
jpayne@68 12713 #endif
jpayne@68 12714 for (i=0; i<n; i++) {
jpayne@68 12715 if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
jpayne@68 12716 }
jpayne@68 12717 return 0;
jpayne@68 12718 }
jpayne@68 12719 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
jpayne@68 12720 int result;
jpayne@68 12721 PyObject *exc_type;
jpayne@68 12722 #if PY_VERSION_HEX >= 0x030C00A6
jpayne@68 12723 PyObject *current_exception = tstate->current_exception;
jpayne@68 12724 if (unlikely(!current_exception)) return 0;
jpayne@68 12725 exc_type = (PyObject*) Py_TYPE(current_exception);
jpayne@68 12726 if (exc_type == err) return 1;
jpayne@68 12727 #else
jpayne@68 12728 exc_type = tstate->curexc_type;
jpayne@68 12729 if (exc_type == err) return 1;
jpayne@68 12730 if (unlikely(!exc_type)) return 0;
jpayne@68 12731 #endif
jpayne@68 12732 #if CYTHON_AVOID_BORROWED_REFS
jpayne@68 12733 Py_INCREF(exc_type);
jpayne@68 12734 #endif
jpayne@68 12735 if (unlikely(PyTuple_Check(err))) {
jpayne@68 12736 result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
jpayne@68 12737 } else {
jpayne@68 12738 result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
jpayne@68 12739 }
jpayne@68 12740 #if CYTHON_AVOID_BORROWED_REFS
jpayne@68 12741 Py_DECREF(exc_type);
jpayne@68 12742 #endif
jpayne@68 12743 return result;
jpayne@68 12744 }
jpayne@68 12745 #endif
jpayne@68 12746
jpayne@68 12747 /* PyErrFetchRestore */
jpayne@68 12748 #if CYTHON_FAST_THREAD_STATE
jpayne@68 12749 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
jpayne@68 12750 #if PY_VERSION_HEX >= 0x030C00A6
jpayne@68 12751 PyObject *tmp_value;
jpayne@68 12752 assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value)));
jpayne@68 12753 if (value) {
jpayne@68 12754 #if CYTHON_COMPILING_IN_CPYTHON
jpayne@68 12755 if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb))
jpayne@68 12756 #endif
jpayne@68 12757 PyException_SetTraceback(value, tb);
jpayne@68 12758 }
jpayne@68 12759 tmp_value = tstate->current_exception;
jpayne@68 12760 tstate->current_exception = value;
jpayne@68 12761 Py_XDECREF(tmp_value);
jpayne@68 12762 Py_XDECREF(type);
jpayne@68 12763 Py_XDECREF(tb);
jpayne@68 12764 #else
jpayne@68 12765 PyObject *tmp_type, *tmp_value, *tmp_tb;
jpayne@68 12766 tmp_type = tstate->curexc_type;
jpayne@68 12767 tmp_value = tstate->curexc_value;
jpayne@68 12768 tmp_tb = tstate->curexc_traceback;
jpayne@68 12769 tstate->curexc_type = type;
jpayne@68 12770 tstate->curexc_value = value;
jpayne@68 12771 tstate->curexc_traceback = tb;
jpayne@68 12772 Py_XDECREF(tmp_type);
jpayne@68 12773 Py_XDECREF(tmp_value);
jpayne@68 12774 Py_XDECREF(tmp_tb);
jpayne@68 12775 #endif
jpayne@68 12776 }
jpayne@68 12777 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
jpayne@68 12778 #if PY_VERSION_HEX >= 0x030C00A6
jpayne@68 12779 PyObject* exc_value;
jpayne@68 12780 exc_value = tstate->current_exception;
jpayne@68 12781 tstate->current_exception = 0;
jpayne@68 12782 *value = exc_value;
jpayne@68 12783 *type = NULL;
jpayne@68 12784 *tb = NULL;
jpayne@68 12785 if (exc_value) {
jpayne@68 12786 *type = (PyObject*) Py_TYPE(exc_value);
jpayne@68 12787 Py_INCREF(*type);
jpayne@68 12788 #if CYTHON_COMPILING_IN_CPYTHON
jpayne@68 12789 *tb = ((PyBaseExceptionObject*) exc_value)->traceback;
jpayne@68 12790 Py_XINCREF(*tb);
jpayne@68 12791 #else
jpayne@68 12792 *tb = PyException_GetTraceback(exc_value);
jpayne@68 12793 #endif
jpayne@68 12794 }
jpayne@68 12795 #else
jpayne@68 12796 *type = tstate->curexc_type;
jpayne@68 12797 *value = tstate->curexc_value;
jpayne@68 12798 *tb = tstate->curexc_traceback;
jpayne@68 12799 tstate->curexc_type = 0;
jpayne@68 12800 tstate->curexc_value = 0;
jpayne@68 12801 tstate->curexc_traceback = 0;
jpayne@68 12802 #endif
jpayne@68 12803 }
jpayne@68 12804 #endif
jpayne@68 12805
jpayne@68 12806 /* PyObjectGetAttrStr */
jpayne@68 12807 #if CYTHON_USE_TYPE_SLOTS
jpayne@68 12808 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
jpayne@68 12809 PyTypeObject* tp = Py_TYPE(obj);
jpayne@68 12810 if (likely(tp->tp_getattro))
jpayne@68 12811 return tp->tp_getattro(obj, attr_name);
jpayne@68 12812 #if PY_MAJOR_VERSION < 3
jpayne@68 12813 if (likely(tp->tp_getattr))
jpayne@68 12814 return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
jpayne@68 12815 #endif
jpayne@68 12816 return PyObject_GetAttr(obj, attr_name);
jpayne@68 12817 }
jpayne@68 12818 #endif
jpayne@68 12819
jpayne@68 12820 /* PyObjectGetAttrStrNoError */
jpayne@68 12821 #if __PYX_LIMITED_VERSION_HEX < 0x030d00A1
jpayne@68 12822 static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
jpayne@68 12823 __Pyx_PyThreadState_declare
jpayne@68 12824 __Pyx_PyThreadState_assign
jpayne@68 12825 if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
jpayne@68 12826 __Pyx_PyErr_Clear();
jpayne@68 12827 }
jpayne@68 12828 #endif
jpayne@68 12829 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
jpayne@68 12830 PyObject *result;
jpayne@68 12831 #if __PYX_LIMITED_VERSION_HEX >= 0x030d00A1
jpayne@68 12832 (void) PyObject_GetOptionalAttr(obj, attr_name, &result);
jpayne@68 12833 return result;
jpayne@68 12834 #else
jpayne@68 12835 #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1
jpayne@68 12836 PyTypeObject* tp = Py_TYPE(obj);
jpayne@68 12837 if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
jpayne@68 12838 return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
jpayne@68 12839 }
jpayne@68 12840 #endif
jpayne@68 12841 result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
jpayne@68 12842 if (unlikely(!result)) {
jpayne@68 12843 __Pyx_PyObject_GetAttrStr_ClearAttributeError();
jpayne@68 12844 }
jpayne@68 12845 return result;
jpayne@68 12846 #endif
jpayne@68 12847 }
jpayne@68 12848
jpayne@68 12849 /* GetBuiltinName */
jpayne@68 12850 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
jpayne@68 12851 PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_b, name);
jpayne@68 12852 if (unlikely(!result) && !PyErr_Occurred()) {
jpayne@68 12853 PyErr_Format(PyExc_NameError,
jpayne@68 12854 #if PY_MAJOR_VERSION >= 3
jpayne@68 12855 "name '%U' is not defined", name);
jpayne@68 12856 #else
jpayne@68 12857 "name '%.200s' is not defined", PyString_AS_STRING(name));
jpayne@68 12858 #endif
jpayne@68 12859 }
jpayne@68 12860 return result;
jpayne@68 12861 }
jpayne@68 12862
jpayne@68 12863 /* TupleAndListFromArray */
jpayne@68 12864 #if CYTHON_COMPILING_IN_CPYTHON
jpayne@68 12865 static CYTHON_INLINE void __Pyx_copy_object_array(PyObject *const *CYTHON_RESTRICT src, PyObject** CYTHON_RESTRICT dest, Py_ssize_t length) {
jpayne@68 12866 PyObject *v;
jpayne@68 12867 Py_ssize_t i;
jpayne@68 12868 for (i = 0; i < length; i++) {
jpayne@68 12869 v = dest[i] = src[i];
jpayne@68 12870 Py_INCREF(v);
jpayne@68 12871 }
jpayne@68 12872 }
jpayne@68 12873 static CYTHON_INLINE PyObject *
jpayne@68 12874 __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n)
jpayne@68 12875 {
jpayne@68 12876 PyObject *res;
jpayne@68 12877 if (n <= 0) {
jpayne@68 12878 Py_INCREF(__pyx_empty_tuple);
jpayne@68 12879 return __pyx_empty_tuple;
jpayne@68 12880 }
jpayne@68 12881 res = PyTuple_New(n);
jpayne@68 12882 if (unlikely(res == NULL)) return NULL;
jpayne@68 12883 __Pyx_copy_object_array(src, ((PyTupleObject*)res)->ob_item, n);
jpayne@68 12884 return res;
jpayne@68 12885 }
jpayne@68 12886 static CYTHON_INLINE PyObject *
jpayne@68 12887 __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n)
jpayne@68 12888 {
jpayne@68 12889 PyObject *res;
jpayne@68 12890 if (n <= 0) {
jpayne@68 12891 return PyList_New(0);
jpayne@68 12892 }
jpayne@68 12893 res = PyList_New(n);
jpayne@68 12894 if (unlikely(res == NULL)) return NULL;
jpayne@68 12895 __Pyx_copy_object_array(src, ((PyListObject*)res)->ob_item, n);
jpayne@68 12896 return res;
jpayne@68 12897 }
jpayne@68 12898 #endif
jpayne@68 12899
jpayne@68 12900 /* BytesEquals */
jpayne@68 12901 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
jpayne@68 12902 #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 12903 return PyObject_RichCompareBool(s1, s2, equals);
jpayne@68 12904 #else
jpayne@68 12905 if (s1 == s2) {
jpayne@68 12906 return (equals == Py_EQ);
jpayne@68 12907 } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
jpayne@68 12908 const char *ps1, *ps2;
jpayne@68 12909 Py_ssize_t length = PyBytes_GET_SIZE(s1);
jpayne@68 12910 if (length != PyBytes_GET_SIZE(s2))
jpayne@68 12911 return (equals == Py_NE);
jpayne@68 12912 ps1 = PyBytes_AS_STRING(s1);
jpayne@68 12913 ps2 = PyBytes_AS_STRING(s2);
jpayne@68 12914 if (ps1[0] != ps2[0]) {
jpayne@68 12915 return (equals == Py_NE);
jpayne@68 12916 } else if (length == 1) {
jpayne@68 12917 return (equals == Py_EQ);
jpayne@68 12918 } else {
jpayne@68 12919 int result;
jpayne@68 12920 #if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000)
jpayne@68 12921 Py_hash_t hash1, hash2;
jpayne@68 12922 hash1 = ((PyBytesObject*)s1)->ob_shash;
jpayne@68 12923 hash2 = ((PyBytesObject*)s2)->ob_shash;
jpayne@68 12924 if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
jpayne@68 12925 return (equals == Py_NE);
jpayne@68 12926 }
jpayne@68 12927 #endif
jpayne@68 12928 result = memcmp(ps1, ps2, (size_t)length);
jpayne@68 12929 return (equals == Py_EQ) ? (result == 0) : (result != 0);
jpayne@68 12930 }
jpayne@68 12931 } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
jpayne@68 12932 return (equals == Py_NE);
jpayne@68 12933 } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
jpayne@68 12934 return (equals == Py_NE);
jpayne@68 12935 } else {
jpayne@68 12936 int result;
jpayne@68 12937 PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
jpayne@68 12938 if (!py_result)
jpayne@68 12939 return -1;
jpayne@68 12940 result = __Pyx_PyObject_IsTrue(py_result);
jpayne@68 12941 Py_DECREF(py_result);
jpayne@68 12942 return result;
jpayne@68 12943 }
jpayne@68 12944 #endif
jpayne@68 12945 }
jpayne@68 12946
jpayne@68 12947 /* UnicodeEquals */
jpayne@68 12948 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
jpayne@68 12949 #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 12950 return PyObject_RichCompareBool(s1, s2, equals);
jpayne@68 12951 #else
jpayne@68 12952 #if PY_MAJOR_VERSION < 3
jpayne@68 12953 PyObject* owned_ref = NULL;
jpayne@68 12954 #endif
jpayne@68 12955 int s1_is_unicode, s2_is_unicode;
jpayne@68 12956 if (s1 == s2) {
jpayne@68 12957 goto return_eq;
jpayne@68 12958 }
jpayne@68 12959 s1_is_unicode = PyUnicode_CheckExact(s1);
jpayne@68 12960 s2_is_unicode = PyUnicode_CheckExact(s2);
jpayne@68 12961 #if PY_MAJOR_VERSION < 3
jpayne@68 12962 if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
jpayne@68 12963 owned_ref = PyUnicode_FromObject(s2);
jpayne@68 12964 if (unlikely(!owned_ref))
jpayne@68 12965 return -1;
jpayne@68 12966 s2 = owned_ref;
jpayne@68 12967 s2_is_unicode = 1;
jpayne@68 12968 } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
jpayne@68 12969 owned_ref = PyUnicode_FromObject(s1);
jpayne@68 12970 if (unlikely(!owned_ref))
jpayne@68 12971 return -1;
jpayne@68 12972 s1 = owned_ref;
jpayne@68 12973 s1_is_unicode = 1;
jpayne@68 12974 } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
jpayne@68 12975 return __Pyx_PyBytes_Equals(s1, s2, equals);
jpayne@68 12976 }
jpayne@68 12977 #endif
jpayne@68 12978 if (s1_is_unicode & s2_is_unicode) {
jpayne@68 12979 Py_ssize_t length;
jpayne@68 12980 int kind;
jpayne@68 12981 void *data1, *data2;
jpayne@68 12982 if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
jpayne@68 12983 return -1;
jpayne@68 12984 length = __Pyx_PyUnicode_GET_LENGTH(s1);
jpayne@68 12985 if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
jpayne@68 12986 goto return_ne;
jpayne@68 12987 }
jpayne@68 12988 #if CYTHON_USE_UNICODE_INTERNALS
jpayne@68 12989 {
jpayne@68 12990 Py_hash_t hash1, hash2;
jpayne@68 12991 #if CYTHON_PEP393_ENABLED
jpayne@68 12992 hash1 = ((PyASCIIObject*)s1)->hash;
jpayne@68 12993 hash2 = ((PyASCIIObject*)s2)->hash;
jpayne@68 12994 #else
jpayne@68 12995 hash1 = ((PyUnicodeObject*)s1)->hash;
jpayne@68 12996 hash2 = ((PyUnicodeObject*)s2)->hash;
jpayne@68 12997 #endif
jpayne@68 12998 if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
jpayne@68 12999 goto return_ne;
jpayne@68 13000 }
jpayne@68 13001 }
jpayne@68 13002 #endif
jpayne@68 13003 kind = __Pyx_PyUnicode_KIND(s1);
jpayne@68 13004 if (kind != __Pyx_PyUnicode_KIND(s2)) {
jpayne@68 13005 goto return_ne;
jpayne@68 13006 }
jpayne@68 13007 data1 = __Pyx_PyUnicode_DATA(s1);
jpayne@68 13008 data2 = __Pyx_PyUnicode_DATA(s2);
jpayne@68 13009 if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
jpayne@68 13010 goto return_ne;
jpayne@68 13011 } else if (length == 1) {
jpayne@68 13012 goto return_eq;
jpayne@68 13013 } else {
jpayne@68 13014 int result = memcmp(data1, data2, (size_t)(length * kind));
jpayne@68 13015 #if PY_MAJOR_VERSION < 3
jpayne@68 13016 Py_XDECREF(owned_ref);
jpayne@68 13017 #endif
jpayne@68 13018 return (equals == Py_EQ) ? (result == 0) : (result != 0);
jpayne@68 13019 }
jpayne@68 13020 } else if ((s1 == Py_None) & s2_is_unicode) {
jpayne@68 13021 goto return_ne;
jpayne@68 13022 } else if ((s2 == Py_None) & s1_is_unicode) {
jpayne@68 13023 goto return_ne;
jpayne@68 13024 } else {
jpayne@68 13025 int result;
jpayne@68 13026 PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
jpayne@68 13027 #if PY_MAJOR_VERSION < 3
jpayne@68 13028 Py_XDECREF(owned_ref);
jpayne@68 13029 #endif
jpayne@68 13030 if (!py_result)
jpayne@68 13031 return -1;
jpayne@68 13032 result = __Pyx_PyObject_IsTrue(py_result);
jpayne@68 13033 Py_DECREF(py_result);
jpayne@68 13034 return result;
jpayne@68 13035 }
jpayne@68 13036 return_eq:
jpayne@68 13037 #if PY_MAJOR_VERSION < 3
jpayne@68 13038 Py_XDECREF(owned_ref);
jpayne@68 13039 #endif
jpayne@68 13040 return (equals == Py_EQ);
jpayne@68 13041 return_ne:
jpayne@68 13042 #if PY_MAJOR_VERSION < 3
jpayne@68 13043 Py_XDECREF(owned_ref);
jpayne@68 13044 #endif
jpayne@68 13045 return (equals == Py_NE);
jpayne@68 13046 #endif
jpayne@68 13047 }
jpayne@68 13048
jpayne@68 13049 /* fastcall */
jpayne@68 13050 #if CYTHON_METH_FASTCALL
jpayne@68 13051 static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s)
jpayne@68 13052 {
jpayne@68 13053 Py_ssize_t i, n = PyTuple_GET_SIZE(kwnames);
jpayne@68 13054 for (i = 0; i < n; i++)
jpayne@68 13055 {
jpayne@68 13056 if (s == PyTuple_GET_ITEM(kwnames, i)) return kwvalues[i];
jpayne@68 13057 }
jpayne@68 13058 for (i = 0; i < n; i++)
jpayne@68 13059 {
jpayne@68 13060 int eq = __Pyx_PyUnicode_Equals(s, PyTuple_GET_ITEM(kwnames, i), Py_EQ);
jpayne@68 13061 if (unlikely(eq != 0)) {
jpayne@68 13062 if (unlikely(eq < 0)) return NULL;
jpayne@68 13063 return kwvalues[i];
jpayne@68 13064 }
jpayne@68 13065 }
jpayne@68 13066 return NULL;
jpayne@68 13067 }
jpayne@68 13068 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000
jpayne@68 13069 CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues) {
jpayne@68 13070 Py_ssize_t i, nkwargs = PyTuple_GET_SIZE(kwnames);
jpayne@68 13071 PyObject *dict;
jpayne@68 13072 dict = PyDict_New();
jpayne@68 13073 if (unlikely(!dict))
jpayne@68 13074 return NULL;
jpayne@68 13075 for (i=0; i<nkwargs; i++) {
jpayne@68 13076 PyObject *key = PyTuple_GET_ITEM(kwnames, i);
jpayne@68 13077 if (unlikely(PyDict_SetItem(dict, key, kwvalues[i]) < 0))
jpayne@68 13078 goto bad;
jpayne@68 13079 }
jpayne@68 13080 return dict;
jpayne@68 13081 bad:
jpayne@68 13082 Py_DECREF(dict);
jpayne@68 13083 return NULL;
jpayne@68 13084 }
jpayne@68 13085 #endif
jpayne@68 13086 #endif
jpayne@68 13087
jpayne@68 13088 /* PyObjectCall */
jpayne@68 13089 #if CYTHON_COMPILING_IN_CPYTHON
jpayne@68 13090 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
jpayne@68 13091 PyObject *result;
jpayne@68 13092 ternaryfunc call = Py_TYPE(func)->tp_call;
jpayne@68 13093 if (unlikely(!call))
jpayne@68 13094 return PyObject_Call(func, arg, kw);
jpayne@68 13095 #if PY_MAJOR_VERSION < 3
jpayne@68 13096 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
jpayne@68 13097 return NULL;
jpayne@68 13098 #else
jpayne@68 13099 if (unlikely(Py_EnterRecursiveCall(" while calling a Python object")))
jpayne@68 13100 return NULL;
jpayne@68 13101 #endif
jpayne@68 13102 result = (*call)(func, arg, kw);
jpayne@68 13103 Py_LeaveRecursiveCall();
jpayne@68 13104 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
jpayne@68 13105 PyErr_SetString(
jpayne@68 13106 PyExc_SystemError,
jpayne@68 13107 "NULL result without error in PyObject_Call");
jpayne@68 13108 }
jpayne@68 13109 return result;
jpayne@68 13110 }
jpayne@68 13111 #endif
jpayne@68 13112
jpayne@68 13113 /* RaiseDoubleKeywords */
jpayne@68 13114 static void __Pyx_RaiseDoubleKeywordsError(
jpayne@68 13115 const char* func_name,
jpayne@68 13116 PyObject* kw_name)
jpayne@68 13117 {
jpayne@68 13118 PyErr_Format(PyExc_TypeError,
jpayne@68 13119 #if PY_MAJOR_VERSION >= 3
jpayne@68 13120 "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
jpayne@68 13121 #else
jpayne@68 13122 "%s() got multiple values for keyword argument '%s'", func_name,
jpayne@68 13123 PyString_AsString(kw_name));
jpayne@68 13124 #endif
jpayne@68 13125 }
jpayne@68 13126
jpayne@68 13127 /* ParseKeywords */
jpayne@68 13128 static int __Pyx_ParseOptionalKeywords(
jpayne@68 13129 PyObject *kwds,
jpayne@68 13130 PyObject *const *kwvalues,
jpayne@68 13131 PyObject **argnames[],
jpayne@68 13132 PyObject *kwds2,
jpayne@68 13133 PyObject *values[],
jpayne@68 13134 Py_ssize_t num_pos_args,
jpayne@68 13135 const char* function_name)
jpayne@68 13136 {
jpayne@68 13137 PyObject *key = 0, *value = 0;
jpayne@68 13138 Py_ssize_t pos = 0;
jpayne@68 13139 PyObject*** name;
jpayne@68 13140 PyObject*** first_kw_arg = argnames + num_pos_args;
jpayne@68 13141 int kwds_is_tuple = CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds));
jpayne@68 13142 while (1) {
jpayne@68 13143 Py_XDECREF(key); key = NULL;
jpayne@68 13144 Py_XDECREF(value); value = NULL;
jpayne@68 13145 if (kwds_is_tuple) {
jpayne@68 13146 Py_ssize_t size;
jpayne@68 13147 #if CYTHON_ASSUME_SAFE_MACROS
jpayne@68 13148 size = PyTuple_GET_SIZE(kwds);
jpayne@68 13149 #else
jpayne@68 13150 size = PyTuple_Size(kwds);
jpayne@68 13151 if (size < 0) goto bad;
jpayne@68 13152 #endif
jpayne@68 13153 if (pos >= size) break;
jpayne@68 13154 #if CYTHON_AVOID_BORROWED_REFS
jpayne@68 13155 key = __Pyx_PySequence_ITEM(kwds, pos);
jpayne@68 13156 if (!key) goto bad;
jpayne@68 13157 #elif CYTHON_ASSUME_SAFE_MACROS
jpayne@68 13158 key = PyTuple_GET_ITEM(kwds, pos);
jpayne@68 13159 #else
jpayne@68 13160 key = PyTuple_GetItem(kwds, pos);
jpayne@68 13161 if (!key) goto bad;
jpayne@68 13162 #endif
jpayne@68 13163 value = kwvalues[pos];
jpayne@68 13164 pos++;
jpayne@68 13165 }
jpayne@68 13166 else
jpayne@68 13167 {
jpayne@68 13168 if (!PyDict_Next(kwds, &pos, &key, &value)) break;
jpayne@68 13169 #if CYTHON_AVOID_BORROWED_REFS
jpayne@68 13170 Py_INCREF(key);
jpayne@68 13171 #endif
jpayne@68 13172 }
jpayne@68 13173 name = first_kw_arg;
jpayne@68 13174 while (*name && (**name != key)) name++;
jpayne@68 13175 if (*name) {
jpayne@68 13176 values[name-argnames] = value;
jpayne@68 13177 #if CYTHON_AVOID_BORROWED_REFS
jpayne@68 13178 Py_INCREF(value);
jpayne@68 13179 Py_DECREF(key);
jpayne@68 13180 #endif
jpayne@68 13181 key = NULL;
jpayne@68 13182 value = NULL;
jpayne@68 13183 continue;
jpayne@68 13184 }
jpayne@68 13185 #if !CYTHON_AVOID_BORROWED_REFS
jpayne@68 13186 Py_INCREF(key);
jpayne@68 13187 #endif
jpayne@68 13188 Py_INCREF(value);
jpayne@68 13189 name = first_kw_arg;
jpayne@68 13190 #if PY_MAJOR_VERSION < 3
jpayne@68 13191 if (likely(PyString_Check(key))) {
jpayne@68 13192 while (*name) {
jpayne@68 13193 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
jpayne@68 13194 && _PyString_Eq(**name, key)) {
jpayne@68 13195 values[name-argnames] = value;
jpayne@68 13196 #if CYTHON_AVOID_BORROWED_REFS
jpayne@68 13197 value = NULL;
jpayne@68 13198 #endif
jpayne@68 13199 break;
jpayne@68 13200 }
jpayne@68 13201 name++;
jpayne@68 13202 }
jpayne@68 13203 if (*name) continue;
jpayne@68 13204 else {
jpayne@68 13205 PyObject*** argname = argnames;
jpayne@68 13206 while (argname != first_kw_arg) {
jpayne@68 13207 if ((**argname == key) || (
jpayne@68 13208 (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
jpayne@68 13209 && _PyString_Eq(**argname, key))) {
jpayne@68 13210 goto arg_passed_twice;
jpayne@68 13211 }
jpayne@68 13212 argname++;
jpayne@68 13213 }
jpayne@68 13214 }
jpayne@68 13215 } else
jpayne@68 13216 #endif
jpayne@68 13217 if (likely(PyUnicode_Check(key))) {
jpayne@68 13218 while (*name) {
jpayne@68 13219 int cmp = (
jpayne@68 13220 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
jpayne@68 13221 (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
jpayne@68 13222 #endif
jpayne@68 13223 PyUnicode_Compare(**name, key)
jpayne@68 13224 );
jpayne@68 13225 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
jpayne@68 13226 if (cmp == 0) {
jpayne@68 13227 values[name-argnames] = value;
jpayne@68 13228 #if CYTHON_AVOID_BORROWED_REFS
jpayne@68 13229 value = NULL;
jpayne@68 13230 #endif
jpayne@68 13231 break;
jpayne@68 13232 }
jpayne@68 13233 name++;
jpayne@68 13234 }
jpayne@68 13235 if (*name) continue;
jpayne@68 13236 else {
jpayne@68 13237 PyObject*** argname = argnames;
jpayne@68 13238 while (argname != first_kw_arg) {
jpayne@68 13239 int cmp = (**argname == key) ? 0 :
jpayne@68 13240 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
jpayne@68 13241 (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
jpayne@68 13242 #endif
jpayne@68 13243 PyUnicode_Compare(**argname, key);
jpayne@68 13244 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
jpayne@68 13245 if (cmp == 0) goto arg_passed_twice;
jpayne@68 13246 argname++;
jpayne@68 13247 }
jpayne@68 13248 }
jpayne@68 13249 } else
jpayne@68 13250 goto invalid_keyword_type;
jpayne@68 13251 if (kwds2) {
jpayne@68 13252 if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
jpayne@68 13253 } else {
jpayne@68 13254 goto invalid_keyword;
jpayne@68 13255 }
jpayne@68 13256 }
jpayne@68 13257 Py_XDECREF(key);
jpayne@68 13258 Py_XDECREF(value);
jpayne@68 13259 return 0;
jpayne@68 13260 arg_passed_twice:
jpayne@68 13261 __Pyx_RaiseDoubleKeywordsError(function_name, key);
jpayne@68 13262 goto bad;
jpayne@68 13263 invalid_keyword_type:
jpayne@68 13264 PyErr_Format(PyExc_TypeError,
jpayne@68 13265 "%.200s() keywords must be strings", function_name);
jpayne@68 13266 goto bad;
jpayne@68 13267 invalid_keyword:
jpayne@68 13268 #if PY_MAJOR_VERSION < 3
jpayne@68 13269 PyErr_Format(PyExc_TypeError,
jpayne@68 13270 "%.200s() got an unexpected keyword argument '%.200s'",
jpayne@68 13271 function_name, PyString_AsString(key));
jpayne@68 13272 #else
jpayne@68 13273 PyErr_Format(PyExc_TypeError,
jpayne@68 13274 "%s() got an unexpected keyword argument '%U'",
jpayne@68 13275 function_name, key);
jpayne@68 13276 #endif
jpayne@68 13277 bad:
jpayne@68 13278 Py_XDECREF(key);
jpayne@68 13279 Py_XDECREF(value);
jpayne@68 13280 return -1;
jpayne@68 13281 }
jpayne@68 13282
jpayne@68 13283 /* RaiseArgTupleInvalid */
jpayne@68 13284 static void __Pyx_RaiseArgtupleInvalid(
jpayne@68 13285 const char* func_name,
jpayne@68 13286 int exact,
jpayne@68 13287 Py_ssize_t num_min,
jpayne@68 13288 Py_ssize_t num_max,
jpayne@68 13289 Py_ssize_t num_found)
jpayne@68 13290 {
jpayne@68 13291 Py_ssize_t num_expected;
jpayne@68 13292 const char *more_or_less;
jpayne@68 13293 if (num_found < num_min) {
jpayne@68 13294 num_expected = num_min;
jpayne@68 13295 more_or_less = "at least";
jpayne@68 13296 } else {
jpayne@68 13297 num_expected = num_max;
jpayne@68 13298 more_or_less = "at most";
jpayne@68 13299 }
jpayne@68 13300 if (exact) {
jpayne@68 13301 more_or_less = "exactly";
jpayne@68 13302 }
jpayne@68 13303 PyErr_Format(PyExc_TypeError,
jpayne@68 13304 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
jpayne@68 13305 func_name, more_or_less, num_expected,
jpayne@68 13306 (num_expected == 1) ? "" : "s", num_found);
jpayne@68 13307 }
jpayne@68 13308
jpayne@68 13309 /* GetItemInt */
jpayne@68 13310 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
jpayne@68 13311 PyObject *r;
jpayne@68 13312 if (unlikely(!j)) return NULL;
jpayne@68 13313 r = PyObject_GetItem(o, j);
jpayne@68 13314 Py_DECREF(j);
jpayne@68 13315 return r;
jpayne@68 13316 }
jpayne@68 13317 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
jpayne@68 13318 CYTHON_NCP_UNUSED int wraparound,
jpayne@68 13319 CYTHON_NCP_UNUSED int boundscheck) {
jpayne@68 13320 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
jpayne@68 13321 Py_ssize_t wrapped_i = i;
jpayne@68 13322 if (wraparound & unlikely(i < 0)) {
jpayne@68 13323 wrapped_i += PyList_GET_SIZE(o);
jpayne@68 13324 }
jpayne@68 13325 if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
jpayne@68 13326 PyObject *r = PyList_GET_ITEM(o, wrapped_i);
jpayne@68 13327 Py_INCREF(r);
jpayne@68 13328 return r;
jpayne@68 13329 }
jpayne@68 13330 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
jpayne@68 13331 #else
jpayne@68 13332 return PySequence_GetItem(o, i);
jpayne@68 13333 #endif
jpayne@68 13334 }
jpayne@68 13335 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
jpayne@68 13336 CYTHON_NCP_UNUSED int wraparound,
jpayne@68 13337 CYTHON_NCP_UNUSED int boundscheck) {
jpayne@68 13338 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
jpayne@68 13339 Py_ssize_t wrapped_i = i;
jpayne@68 13340 if (wraparound & unlikely(i < 0)) {
jpayne@68 13341 wrapped_i += PyTuple_GET_SIZE(o);
jpayne@68 13342 }
jpayne@68 13343 if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
jpayne@68 13344 PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
jpayne@68 13345 Py_INCREF(r);
jpayne@68 13346 return r;
jpayne@68 13347 }
jpayne@68 13348 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
jpayne@68 13349 #else
jpayne@68 13350 return PySequence_GetItem(o, i);
jpayne@68 13351 #endif
jpayne@68 13352 }
jpayne@68 13353 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
jpayne@68 13354 CYTHON_NCP_UNUSED int wraparound,
jpayne@68 13355 CYTHON_NCP_UNUSED int boundscheck) {
jpayne@68 13356 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
jpayne@68 13357 if (is_list || PyList_CheckExact(o)) {
jpayne@68 13358 Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
jpayne@68 13359 if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
jpayne@68 13360 PyObject *r = PyList_GET_ITEM(o, n);
jpayne@68 13361 Py_INCREF(r);
jpayne@68 13362 return r;
jpayne@68 13363 }
jpayne@68 13364 }
jpayne@68 13365 else if (PyTuple_CheckExact(o)) {
jpayne@68 13366 Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
jpayne@68 13367 if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
jpayne@68 13368 PyObject *r = PyTuple_GET_ITEM(o, n);
jpayne@68 13369 Py_INCREF(r);
jpayne@68 13370 return r;
jpayne@68 13371 }
jpayne@68 13372 } else {
jpayne@68 13373 PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping;
jpayne@68 13374 PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence;
jpayne@68 13375 if (mm && mm->mp_subscript) {
jpayne@68 13376 PyObject *r, *key = PyInt_FromSsize_t(i);
jpayne@68 13377 if (unlikely(!key)) return NULL;
jpayne@68 13378 r = mm->mp_subscript(o, key);
jpayne@68 13379 Py_DECREF(key);
jpayne@68 13380 return r;
jpayne@68 13381 }
jpayne@68 13382 if (likely(sm && sm->sq_item)) {
jpayne@68 13383 if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) {
jpayne@68 13384 Py_ssize_t l = sm->sq_length(o);
jpayne@68 13385 if (likely(l >= 0)) {
jpayne@68 13386 i += l;
jpayne@68 13387 } else {
jpayne@68 13388 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
jpayne@68 13389 return NULL;
jpayne@68 13390 PyErr_Clear();
jpayne@68 13391 }
jpayne@68 13392 }
jpayne@68 13393 return sm->sq_item(o, i);
jpayne@68 13394 }
jpayne@68 13395 }
jpayne@68 13396 #else
jpayne@68 13397 if (is_list || !PyMapping_Check(o)) {
jpayne@68 13398 return PySequence_GetItem(o, i);
jpayne@68 13399 }
jpayne@68 13400 #endif
jpayne@68 13401 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
jpayne@68 13402 }
jpayne@68 13403
jpayne@68 13404 /* SetItemInt */
jpayne@68 13405 static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) {
jpayne@68 13406 int r;
jpayne@68 13407 if (unlikely(!j)) return -1;
jpayne@68 13408 r = PyObject_SetItem(o, j, v);
jpayne@68 13409 Py_DECREF(j);
jpayne@68 13410 return r;
jpayne@68 13411 }
jpayne@68 13412 static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list,
jpayne@68 13413 CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) {
jpayne@68 13414 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
jpayne@68 13415 if (is_list || PyList_CheckExact(o)) {
jpayne@68 13416 Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o));
jpayne@68 13417 if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o)))) {
jpayne@68 13418 PyObject* old = PyList_GET_ITEM(o, n);
jpayne@68 13419 Py_INCREF(v);
jpayne@68 13420 PyList_SET_ITEM(o, n, v);
jpayne@68 13421 Py_DECREF(old);
jpayne@68 13422 return 1;
jpayne@68 13423 }
jpayne@68 13424 } else {
jpayne@68 13425 PyMappingMethods *mm = Py_TYPE(o)->tp_as_mapping;
jpayne@68 13426 PySequenceMethods *sm = Py_TYPE(o)->tp_as_sequence;
jpayne@68 13427 if (mm && mm->mp_ass_subscript) {
jpayne@68 13428 int r;
jpayne@68 13429 PyObject *key = PyInt_FromSsize_t(i);
jpayne@68 13430 if (unlikely(!key)) return -1;
jpayne@68 13431 r = mm->mp_ass_subscript(o, key, v);
jpayne@68 13432 Py_DECREF(key);
jpayne@68 13433 return r;
jpayne@68 13434 }
jpayne@68 13435 if (likely(sm && sm->sq_ass_item)) {
jpayne@68 13436 if (wraparound && unlikely(i < 0) && likely(sm->sq_length)) {
jpayne@68 13437 Py_ssize_t l = sm->sq_length(o);
jpayne@68 13438 if (likely(l >= 0)) {
jpayne@68 13439 i += l;
jpayne@68 13440 } else {
jpayne@68 13441 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
jpayne@68 13442 return -1;
jpayne@68 13443 PyErr_Clear();
jpayne@68 13444 }
jpayne@68 13445 }
jpayne@68 13446 return sm->sq_ass_item(o, i, v);
jpayne@68 13447 }
jpayne@68 13448 }
jpayne@68 13449 #else
jpayne@68 13450 if (is_list || !PyMapping_Check(o))
jpayne@68 13451 {
jpayne@68 13452 return PySequence_SetItem(o, i, v);
jpayne@68 13453 }
jpayne@68 13454 #endif
jpayne@68 13455 return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v);
jpayne@68 13456 }
jpayne@68 13457
jpayne@68 13458 /* PyFunctionFastCall */
jpayne@68 13459 #if CYTHON_FAST_PYCALL && !CYTHON_VECTORCALL
jpayne@68 13460 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
jpayne@68 13461 PyObject *globals) {
jpayne@68 13462 PyFrameObject *f;
jpayne@68 13463 PyThreadState *tstate = __Pyx_PyThreadState_Current;
jpayne@68 13464 PyObject **fastlocals;
jpayne@68 13465 Py_ssize_t i;
jpayne@68 13466 PyObject *result;
jpayne@68 13467 assert(globals != NULL);
jpayne@68 13468 /* XXX Perhaps we should create a specialized
jpayne@68 13469 PyFrame_New() that doesn't take locals, but does
jpayne@68 13470 take builtins without sanity checking them.
jpayne@68 13471 */
jpayne@68 13472 assert(tstate != NULL);
jpayne@68 13473 f = PyFrame_New(tstate, co, globals, NULL);
jpayne@68 13474 if (f == NULL) {
jpayne@68 13475 return NULL;
jpayne@68 13476 }
jpayne@68 13477 fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
jpayne@68 13478 for (i = 0; i < na; i++) {
jpayne@68 13479 Py_INCREF(*args);
jpayne@68 13480 fastlocals[i] = *args++;
jpayne@68 13481 }
jpayne@68 13482 result = PyEval_EvalFrameEx(f,0);
jpayne@68 13483 ++tstate->recursion_depth;
jpayne@68 13484 Py_DECREF(f);
jpayne@68 13485 --tstate->recursion_depth;
jpayne@68 13486 return result;
jpayne@68 13487 }
jpayne@68 13488 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
jpayne@68 13489 PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
jpayne@68 13490 PyObject *globals = PyFunction_GET_GLOBALS(func);
jpayne@68 13491 PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
jpayne@68 13492 PyObject *closure;
jpayne@68 13493 #if PY_MAJOR_VERSION >= 3
jpayne@68 13494 PyObject *kwdefs;
jpayne@68 13495 #endif
jpayne@68 13496 PyObject *kwtuple, **k;
jpayne@68 13497 PyObject **d;
jpayne@68 13498 Py_ssize_t nd;
jpayne@68 13499 Py_ssize_t nk;
jpayne@68 13500 PyObject *result;
jpayne@68 13501 assert(kwargs == NULL || PyDict_Check(kwargs));
jpayne@68 13502 nk = kwargs ? PyDict_Size(kwargs) : 0;
jpayne@68 13503 #if PY_MAJOR_VERSION < 3
jpayne@68 13504 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) {
jpayne@68 13505 return NULL;
jpayne@68 13506 }
jpayne@68 13507 #else
jpayne@68 13508 if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) {
jpayne@68 13509 return NULL;
jpayne@68 13510 }
jpayne@68 13511 #endif
jpayne@68 13512 if (
jpayne@68 13513 #if PY_MAJOR_VERSION >= 3
jpayne@68 13514 co->co_kwonlyargcount == 0 &&
jpayne@68 13515 #endif
jpayne@68 13516 likely(kwargs == NULL || nk == 0) &&
jpayne@68 13517 co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
jpayne@68 13518 if (argdefs == NULL && co->co_argcount == nargs) {
jpayne@68 13519 result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
jpayne@68 13520 goto done;
jpayne@68 13521 }
jpayne@68 13522 else if (nargs == 0 && argdefs != NULL
jpayne@68 13523 && co->co_argcount == Py_SIZE(argdefs)) {
jpayne@68 13524 /* function called with no arguments, but all parameters have
jpayne@68 13525 a default value: use default values as arguments .*/
jpayne@68 13526 args = &PyTuple_GET_ITEM(argdefs, 0);
jpayne@68 13527 result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
jpayne@68 13528 goto done;
jpayne@68 13529 }
jpayne@68 13530 }
jpayne@68 13531 if (kwargs != NULL) {
jpayne@68 13532 Py_ssize_t pos, i;
jpayne@68 13533 kwtuple = PyTuple_New(2 * nk);
jpayne@68 13534 if (kwtuple == NULL) {
jpayne@68 13535 result = NULL;
jpayne@68 13536 goto done;
jpayne@68 13537 }
jpayne@68 13538 k = &PyTuple_GET_ITEM(kwtuple, 0);
jpayne@68 13539 pos = i = 0;
jpayne@68 13540 while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
jpayne@68 13541 Py_INCREF(k[i]);
jpayne@68 13542 Py_INCREF(k[i+1]);
jpayne@68 13543 i += 2;
jpayne@68 13544 }
jpayne@68 13545 nk = i / 2;
jpayne@68 13546 }
jpayne@68 13547 else {
jpayne@68 13548 kwtuple = NULL;
jpayne@68 13549 k = NULL;
jpayne@68 13550 }
jpayne@68 13551 closure = PyFunction_GET_CLOSURE(func);
jpayne@68 13552 #if PY_MAJOR_VERSION >= 3
jpayne@68 13553 kwdefs = PyFunction_GET_KW_DEFAULTS(func);
jpayne@68 13554 #endif
jpayne@68 13555 if (argdefs != NULL) {
jpayne@68 13556 d = &PyTuple_GET_ITEM(argdefs, 0);
jpayne@68 13557 nd = Py_SIZE(argdefs);
jpayne@68 13558 }
jpayne@68 13559 else {
jpayne@68 13560 d = NULL;
jpayne@68 13561 nd = 0;
jpayne@68 13562 }
jpayne@68 13563 #if PY_MAJOR_VERSION >= 3
jpayne@68 13564 result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
jpayne@68 13565 args, (int)nargs,
jpayne@68 13566 k, (int)nk,
jpayne@68 13567 d, (int)nd, kwdefs, closure);
jpayne@68 13568 #else
jpayne@68 13569 result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
jpayne@68 13570 args, (int)nargs,
jpayne@68 13571 k, (int)nk,
jpayne@68 13572 d, (int)nd, closure);
jpayne@68 13573 #endif
jpayne@68 13574 Py_XDECREF(kwtuple);
jpayne@68 13575 done:
jpayne@68 13576 Py_LeaveRecursiveCall();
jpayne@68 13577 return result;
jpayne@68 13578 }
jpayne@68 13579 #endif
jpayne@68 13580
jpayne@68 13581 /* PyObjectCallMethO */
jpayne@68 13582 #if CYTHON_COMPILING_IN_CPYTHON
jpayne@68 13583 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
jpayne@68 13584 PyObject *self, *result;
jpayne@68 13585 PyCFunction cfunc;
jpayne@68 13586 cfunc = __Pyx_CyOrPyCFunction_GET_FUNCTION(func);
jpayne@68 13587 self = __Pyx_CyOrPyCFunction_GET_SELF(func);
jpayne@68 13588 #if PY_MAJOR_VERSION < 3
jpayne@68 13589 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
jpayne@68 13590 return NULL;
jpayne@68 13591 #else
jpayne@68 13592 if (unlikely(Py_EnterRecursiveCall(" while calling a Python object")))
jpayne@68 13593 return NULL;
jpayne@68 13594 #endif
jpayne@68 13595 result = cfunc(self, arg);
jpayne@68 13596 Py_LeaveRecursiveCall();
jpayne@68 13597 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
jpayne@68 13598 PyErr_SetString(
jpayne@68 13599 PyExc_SystemError,
jpayne@68 13600 "NULL result without error in PyObject_Call");
jpayne@68 13601 }
jpayne@68 13602 return result;
jpayne@68 13603 }
jpayne@68 13604 #endif
jpayne@68 13605
jpayne@68 13606 /* PyObjectFastCall */
jpayne@68 13607 #if PY_VERSION_HEX < 0x03090000 || CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 13608 static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs) {
jpayne@68 13609 PyObject *argstuple;
jpayne@68 13610 PyObject *result = 0;
jpayne@68 13611 size_t i;
jpayne@68 13612 argstuple = PyTuple_New((Py_ssize_t)nargs);
jpayne@68 13613 if (unlikely(!argstuple)) return NULL;
jpayne@68 13614 for (i = 0; i < nargs; i++) {
jpayne@68 13615 Py_INCREF(args[i]);
jpayne@68 13616 if (__Pyx_PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]) < 0) goto bad;
jpayne@68 13617 }
jpayne@68 13618 result = __Pyx_PyObject_Call(func, argstuple, kwargs);
jpayne@68 13619 bad:
jpayne@68 13620 Py_DECREF(argstuple);
jpayne@68 13621 return result;
jpayne@68 13622 }
jpayne@68 13623 #endif
jpayne@68 13624 static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t _nargs, PyObject *kwargs) {
jpayne@68 13625 Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs);
jpayne@68 13626 #if CYTHON_COMPILING_IN_CPYTHON
jpayne@68 13627 if (nargs == 0 && kwargs == NULL) {
jpayne@68 13628 if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_NOARGS))
jpayne@68 13629 return __Pyx_PyObject_CallMethO(func, NULL);
jpayne@68 13630 }
jpayne@68 13631 else if (nargs == 1 && kwargs == NULL) {
jpayne@68 13632 if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_O))
jpayne@68 13633 return __Pyx_PyObject_CallMethO(func, args[0]);
jpayne@68 13634 }
jpayne@68 13635 #endif
jpayne@68 13636 #if PY_VERSION_HEX < 0x030800B1
jpayne@68 13637 #if CYTHON_FAST_PYCCALL
jpayne@68 13638 if (PyCFunction_Check(func)) {
jpayne@68 13639 if (kwargs) {
jpayne@68 13640 return _PyCFunction_FastCallDict(func, args, nargs, kwargs);
jpayne@68 13641 } else {
jpayne@68 13642 return _PyCFunction_FastCallKeywords(func, args, nargs, NULL);
jpayne@68 13643 }
jpayne@68 13644 }
jpayne@68 13645 #if PY_VERSION_HEX >= 0x030700A1
jpayne@68 13646 if (!kwargs && __Pyx_IS_TYPE(func, &PyMethodDescr_Type)) {
jpayne@68 13647 return _PyMethodDescr_FastCallKeywords(func, args, nargs, NULL);
jpayne@68 13648 }
jpayne@68 13649 #endif
jpayne@68 13650 #endif
jpayne@68 13651 #if CYTHON_FAST_PYCALL
jpayne@68 13652 if (PyFunction_Check(func)) {
jpayne@68 13653 return __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs);
jpayne@68 13654 }
jpayne@68 13655 #endif
jpayne@68 13656 #endif
jpayne@68 13657 if (kwargs == NULL) {
jpayne@68 13658 #if CYTHON_VECTORCALL
jpayne@68 13659 #if PY_VERSION_HEX < 0x03090000
jpayne@68 13660 vectorcallfunc f = _PyVectorcall_Function(func);
jpayne@68 13661 #else
jpayne@68 13662 vectorcallfunc f = PyVectorcall_Function(func);
jpayne@68 13663 #endif
jpayne@68 13664 if (f) {
jpayne@68 13665 return f(func, args, (size_t)nargs, NULL);
jpayne@68 13666 }
jpayne@68 13667 #elif defined(__Pyx_CyFunction_USED) && CYTHON_BACKPORT_VECTORCALL
jpayne@68 13668 if (__Pyx_CyFunction_CheckExact(func)) {
jpayne@68 13669 __pyx_vectorcallfunc f = __Pyx_CyFunction_func_vectorcall(func);
jpayne@68 13670 if (f) return f(func, args, (size_t)nargs, NULL);
jpayne@68 13671 }
jpayne@68 13672 #endif
jpayne@68 13673 }
jpayne@68 13674 if (nargs == 0) {
jpayne@68 13675 return __Pyx_PyObject_Call(func, __pyx_empty_tuple, kwargs);
jpayne@68 13676 }
jpayne@68 13677 #if PY_VERSION_HEX >= 0x03090000 && !CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 13678 return PyObject_VectorcallDict(func, args, (size_t)nargs, kwargs);
jpayne@68 13679 #else
jpayne@68 13680 return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs);
jpayne@68 13681 #endif
jpayne@68 13682 }
jpayne@68 13683
jpayne@68 13684 /* ArgTypeTest */
jpayne@68 13685 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
jpayne@68 13686 {
jpayne@68 13687 __Pyx_TypeName type_name;
jpayne@68 13688 __Pyx_TypeName obj_type_name;
jpayne@68 13689 if (unlikely(!type)) {
jpayne@68 13690 PyErr_SetString(PyExc_SystemError, "Missing type object");
jpayne@68 13691 return 0;
jpayne@68 13692 }
jpayne@68 13693 else if (exact) {
jpayne@68 13694 #if PY_MAJOR_VERSION == 2
jpayne@68 13695 if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
jpayne@68 13696 #endif
jpayne@68 13697 }
jpayne@68 13698 else {
jpayne@68 13699 if (likely(__Pyx_TypeCheck(obj, type))) return 1;
jpayne@68 13700 }
jpayne@68 13701 type_name = __Pyx_PyType_GetName(type);
jpayne@68 13702 obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj));
jpayne@68 13703 PyErr_Format(PyExc_TypeError,
jpayne@68 13704 "Argument '%.200s' has incorrect type (expected " __Pyx_FMT_TYPENAME
jpayne@68 13705 ", got " __Pyx_FMT_TYPENAME ")", name, type_name, obj_type_name);
jpayne@68 13706 __Pyx_DECREF_TypeName(type_name);
jpayne@68 13707 __Pyx_DECREF_TypeName(obj_type_name);
jpayne@68 13708 return 0;
jpayne@68 13709 }
jpayne@68 13710
jpayne@68 13711 /* ExtTypeTest */
jpayne@68 13712 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
jpayne@68 13713 __Pyx_TypeName obj_type_name;
jpayne@68 13714 __Pyx_TypeName type_name;
jpayne@68 13715 if (unlikely(!type)) {
jpayne@68 13716 PyErr_SetString(PyExc_SystemError, "Missing type object");
jpayne@68 13717 return 0;
jpayne@68 13718 }
jpayne@68 13719 if (likely(__Pyx_TypeCheck(obj, type)))
jpayne@68 13720 return 1;
jpayne@68 13721 obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj));
jpayne@68 13722 type_name = __Pyx_PyType_GetName(type);
jpayne@68 13723 PyErr_Format(PyExc_TypeError,
jpayne@68 13724 "Cannot convert " __Pyx_FMT_TYPENAME " to " __Pyx_FMT_TYPENAME,
jpayne@68 13725 obj_type_name, type_name);
jpayne@68 13726 __Pyx_DECREF_TypeName(obj_type_name);
jpayne@68 13727 __Pyx_DECREF_TypeName(type_name);
jpayne@68 13728 return 0;
jpayne@68 13729 }
jpayne@68 13730
jpayne@68 13731 /* PyObjectCallOneArg */
jpayne@68 13732 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
jpayne@68 13733 PyObject *args[2] = {NULL, arg};
jpayne@68 13734 return __Pyx_PyObject_FastCall(func, args+1, 1 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
jpayne@68 13735 }
jpayne@68 13736
jpayne@68 13737 /* ObjectGetItem */
jpayne@68 13738 #if CYTHON_USE_TYPE_SLOTS
jpayne@68 13739 static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject *index) {
jpayne@68 13740 PyObject *runerr = NULL;
jpayne@68 13741 Py_ssize_t key_value;
jpayne@68 13742 key_value = __Pyx_PyIndex_AsSsize_t(index);
jpayne@68 13743 if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
jpayne@68 13744 return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
jpayne@68 13745 }
jpayne@68 13746 if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
jpayne@68 13747 __Pyx_TypeName index_type_name = __Pyx_PyType_GetName(Py_TYPE(index));
jpayne@68 13748 PyErr_Clear();
jpayne@68 13749 PyErr_Format(PyExc_IndexError,
jpayne@68 13750 "cannot fit '" __Pyx_FMT_TYPENAME "' into an index-sized integer", index_type_name);
jpayne@68 13751 __Pyx_DECREF_TypeName(index_type_name);
jpayne@68 13752 }
jpayne@68 13753 return NULL;
jpayne@68 13754 }
jpayne@68 13755 static PyObject *__Pyx_PyObject_GetItem_Slow(PyObject *obj, PyObject *key) {
jpayne@68 13756 __Pyx_TypeName obj_type_name;
jpayne@68 13757 if (likely(PyType_Check(obj))) {
jpayne@68 13758 PyObject *meth = __Pyx_PyObject_GetAttrStrNoError(obj, __pyx_n_s_class_getitem);
jpayne@68 13759 if (!meth) {
jpayne@68 13760 PyErr_Clear();
jpayne@68 13761 } else {
jpayne@68 13762 PyObject *result = __Pyx_PyObject_CallOneArg(meth, key);
jpayne@68 13763 Py_DECREF(meth);
jpayne@68 13764 return result;
jpayne@68 13765 }
jpayne@68 13766 }
jpayne@68 13767 obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj));
jpayne@68 13768 PyErr_Format(PyExc_TypeError,
jpayne@68 13769 "'" __Pyx_FMT_TYPENAME "' object is not subscriptable", obj_type_name);
jpayne@68 13770 __Pyx_DECREF_TypeName(obj_type_name);
jpayne@68 13771 return NULL;
jpayne@68 13772 }
jpayne@68 13773 static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key) {
jpayne@68 13774 PyTypeObject *tp = Py_TYPE(obj);
jpayne@68 13775 PyMappingMethods *mm = tp->tp_as_mapping;
jpayne@68 13776 PySequenceMethods *sm = tp->tp_as_sequence;
jpayne@68 13777 if (likely(mm && mm->mp_subscript)) {
jpayne@68 13778 return mm->mp_subscript(obj, key);
jpayne@68 13779 }
jpayne@68 13780 if (likely(sm && sm->sq_item)) {
jpayne@68 13781 return __Pyx_PyObject_GetIndex(obj, key);
jpayne@68 13782 }
jpayne@68 13783 return __Pyx_PyObject_GetItem_Slow(obj, key);
jpayne@68 13784 }
jpayne@68 13785 #endif
jpayne@68 13786
jpayne@68 13787 /* RaiseUnexpectedTypeError */
jpayne@68 13788 static int
jpayne@68 13789 __Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj)
jpayne@68 13790 {
jpayne@68 13791 __Pyx_TypeName obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj));
jpayne@68 13792 PyErr_Format(PyExc_TypeError, "Expected %s, got " __Pyx_FMT_TYPENAME,
jpayne@68 13793 expected, obj_type_name);
jpayne@68 13794 __Pyx_DECREF_TypeName(obj_type_name);
jpayne@68 13795 return 0;
jpayne@68 13796 }
jpayne@68 13797
jpayne@68 13798 /* PyDictVersioning */
jpayne@68 13799 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
jpayne@68 13800 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
jpayne@68 13801 PyObject *dict = Py_TYPE(obj)->tp_dict;
jpayne@68 13802 return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
jpayne@68 13803 }
jpayne@68 13804 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
jpayne@68 13805 PyObject **dictptr = NULL;
jpayne@68 13806 Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
jpayne@68 13807 if (offset) {
jpayne@68 13808 #if CYTHON_COMPILING_IN_CPYTHON
jpayne@68 13809 dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
jpayne@68 13810 #else
jpayne@68 13811 dictptr = _PyObject_GetDictPtr(obj);
jpayne@68 13812 #endif
jpayne@68 13813 }
jpayne@68 13814 return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
jpayne@68 13815 }
jpayne@68 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@68 13817 PyObject *dict = Py_TYPE(obj)->tp_dict;
jpayne@68 13818 if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
jpayne@68 13819 return 0;
jpayne@68 13820 return obj_dict_version == __Pyx_get_object_dict_version(obj);
jpayne@68 13821 }
jpayne@68 13822 #endif
jpayne@68 13823
jpayne@68 13824 /* GetModuleGlobalName */
jpayne@68 13825 #if CYTHON_USE_DICT_VERSIONS
jpayne@68 13826 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
jpayne@68 13827 #else
jpayne@68 13828 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
jpayne@68 13829 #endif
jpayne@68 13830 {
jpayne@68 13831 PyObject *result;
jpayne@68 13832 #if !CYTHON_AVOID_BORROWED_REFS
jpayne@68 13833 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && PY_VERSION_HEX < 0x030d0000
jpayne@68 13834 result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
jpayne@68 13835 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
jpayne@68 13836 if (likely(result)) {
jpayne@68 13837 return __Pyx_NewRef(result);
jpayne@68 13838 } else if (unlikely(PyErr_Occurred())) {
jpayne@68 13839 return NULL;
jpayne@68 13840 }
jpayne@68 13841 #elif CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 13842 if (unlikely(!__pyx_m)) {
jpayne@68 13843 return NULL;
jpayne@68 13844 }
jpayne@68 13845 result = PyObject_GetAttr(__pyx_m, name);
jpayne@68 13846 if (likely(result)) {
jpayne@68 13847 return result;
jpayne@68 13848 }
jpayne@68 13849 #else
jpayne@68 13850 result = PyDict_GetItem(__pyx_d, name);
jpayne@68 13851 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
jpayne@68 13852 if (likely(result)) {
jpayne@68 13853 return __Pyx_NewRef(result);
jpayne@68 13854 }
jpayne@68 13855 #endif
jpayne@68 13856 #else
jpayne@68 13857 result = PyObject_GetItem(__pyx_d, name);
jpayne@68 13858 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
jpayne@68 13859 if (likely(result)) {
jpayne@68 13860 return __Pyx_NewRef(result);
jpayne@68 13861 }
jpayne@68 13862 PyErr_Clear();
jpayne@68 13863 #endif
jpayne@68 13864 return __Pyx_GetBuiltinName(name);
jpayne@68 13865 }
jpayne@68 13866
jpayne@68 13867 /* RaiseException */
jpayne@68 13868 #if PY_MAJOR_VERSION < 3
jpayne@68 13869 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
jpayne@68 13870 __Pyx_PyThreadState_declare
jpayne@68 13871 CYTHON_UNUSED_VAR(cause);
jpayne@68 13872 Py_XINCREF(type);
jpayne@68 13873 if (!value || value == Py_None)
jpayne@68 13874 value = NULL;
jpayne@68 13875 else
jpayne@68 13876 Py_INCREF(value);
jpayne@68 13877 if (!tb || tb == Py_None)
jpayne@68 13878 tb = NULL;
jpayne@68 13879 else {
jpayne@68 13880 Py_INCREF(tb);
jpayne@68 13881 if (!PyTraceBack_Check(tb)) {
jpayne@68 13882 PyErr_SetString(PyExc_TypeError,
jpayne@68 13883 "raise: arg 3 must be a traceback or None");
jpayne@68 13884 goto raise_error;
jpayne@68 13885 }
jpayne@68 13886 }
jpayne@68 13887 if (PyType_Check(type)) {
jpayne@68 13888 #if CYTHON_COMPILING_IN_PYPY
jpayne@68 13889 if (!value) {
jpayne@68 13890 Py_INCREF(Py_None);
jpayne@68 13891 value = Py_None;
jpayne@68 13892 }
jpayne@68 13893 #endif
jpayne@68 13894 PyErr_NormalizeException(&type, &value, &tb);
jpayne@68 13895 } else {
jpayne@68 13896 if (value) {
jpayne@68 13897 PyErr_SetString(PyExc_TypeError,
jpayne@68 13898 "instance exception may not have a separate value");
jpayne@68 13899 goto raise_error;
jpayne@68 13900 }
jpayne@68 13901 value = type;
jpayne@68 13902 type = (PyObject*) Py_TYPE(type);
jpayne@68 13903 Py_INCREF(type);
jpayne@68 13904 if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
jpayne@68 13905 PyErr_SetString(PyExc_TypeError,
jpayne@68 13906 "raise: exception class must be a subclass of BaseException");
jpayne@68 13907 goto raise_error;
jpayne@68 13908 }
jpayne@68 13909 }
jpayne@68 13910 __Pyx_PyThreadState_assign
jpayne@68 13911 __Pyx_ErrRestore(type, value, tb);
jpayne@68 13912 return;
jpayne@68 13913 raise_error:
jpayne@68 13914 Py_XDECREF(value);
jpayne@68 13915 Py_XDECREF(type);
jpayne@68 13916 Py_XDECREF(tb);
jpayne@68 13917 return;
jpayne@68 13918 }
jpayne@68 13919 #else
jpayne@68 13920 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
jpayne@68 13921 PyObject* owned_instance = NULL;
jpayne@68 13922 if (tb == Py_None) {
jpayne@68 13923 tb = 0;
jpayne@68 13924 } else if (tb && !PyTraceBack_Check(tb)) {
jpayne@68 13925 PyErr_SetString(PyExc_TypeError,
jpayne@68 13926 "raise: arg 3 must be a traceback or None");
jpayne@68 13927 goto bad;
jpayne@68 13928 }
jpayne@68 13929 if (value == Py_None)
jpayne@68 13930 value = 0;
jpayne@68 13931 if (PyExceptionInstance_Check(type)) {
jpayne@68 13932 if (value) {
jpayne@68 13933 PyErr_SetString(PyExc_TypeError,
jpayne@68 13934 "instance exception may not have a separate value");
jpayne@68 13935 goto bad;
jpayne@68 13936 }
jpayne@68 13937 value = type;
jpayne@68 13938 type = (PyObject*) Py_TYPE(value);
jpayne@68 13939 } else if (PyExceptionClass_Check(type)) {
jpayne@68 13940 PyObject *instance_class = NULL;
jpayne@68 13941 if (value && PyExceptionInstance_Check(value)) {
jpayne@68 13942 instance_class = (PyObject*) Py_TYPE(value);
jpayne@68 13943 if (instance_class != type) {
jpayne@68 13944 int is_subclass = PyObject_IsSubclass(instance_class, type);
jpayne@68 13945 if (!is_subclass) {
jpayne@68 13946 instance_class = NULL;
jpayne@68 13947 } else if (unlikely(is_subclass == -1)) {
jpayne@68 13948 goto bad;
jpayne@68 13949 } else {
jpayne@68 13950 type = instance_class;
jpayne@68 13951 }
jpayne@68 13952 }
jpayne@68 13953 }
jpayne@68 13954 if (!instance_class) {
jpayne@68 13955 PyObject *args;
jpayne@68 13956 if (!value)
jpayne@68 13957 args = PyTuple_New(0);
jpayne@68 13958 else if (PyTuple_Check(value)) {
jpayne@68 13959 Py_INCREF(value);
jpayne@68 13960 args = value;
jpayne@68 13961 } else
jpayne@68 13962 args = PyTuple_Pack(1, value);
jpayne@68 13963 if (!args)
jpayne@68 13964 goto bad;
jpayne@68 13965 owned_instance = PyObject_Call(type, args, NULL);
jpayne@68 13966 Py_DECREF(args);
jpayne@68 13967 if (!owned_instance)
jpayne@68 13968 goto bad;
jpayne@68 13969 value = owned_instance;
jpayne@68 13970 if (!PyExceptionInstance_Check(value)) {
jpayne@68 13971 PyErr_Format(PyExc_TypeError,
jpayne@68 13972 "calling %R should have returned an instance of "
jpayne@68 13973 "BaseException, not %R",
jpayne@68 13974 type, Py_TYPE(value));
jpayne@68 13975 goto bad;
jpayne@68 13976 }
jpayne@68 13977 }
jpayne@68 13978 } else {
jpayne@68 13979 PyErr_SetString(PyExc_TypeError,
jpayne@68 13980 "raise: exception class must be a subclass of BaseException");
jpayne@68 13981 goto bad;
jpayne@68 13982 }
jpayne@68 13983 if (cause) {
jpayne@68 13984 PyObject *fixed_cause;
jpayne@68 13985 if (cause == Py_None) {
jpayne@68 13986 fixed_cause = NULL;
jpayne@68 13987 } else if (PyExceptionClass_Check(cause)) {
jpayne@68 13988 fixed_cause = PyObject_CallObject(cause, NULL);
jpayne@68 13989 if (fixed_cause == NULL)
jpayne@68 13990 goto bad;
jpayne@68 13991 } else if (PyExceptionInstance_Check(cause)) {
jpayne@68 13992 fixed_cause = cause;
jpayne@68 13993 Py_INCREF(fixed_cause);
jpayne@68 13994 } else {
jpayne@68 13995 PyErr_SetString(PyExc_TypeError,
jpayne@68 13996 "exception causes must derive from "
jpayne@68 13997 "BaseException");
jpayne@68 13998 goto bad;
jpayne@68 13999 }
jpayne@68 14000 PyException_SetCause(value, fixed_cause);
jpayne@68 14001 }
jpayne@68 14002 PyErr_SetObject(type, value);
jpayne@68 14003 if (tb) {
jpayne@68 14004 #if PY_VERSION_HEX >= 0x030C00A6
jpayne@68 14005 PyException_SetTraceback(value, tb);
jpayne@68 14006 #elif CYTHON_FAST_THREAD_STATE
jpayne@68 14007 PyThreadState *tstate = __Pyx_PyThreadState_Current;
jpayne@68 14008 PyObject* tmp_tb = tstate->curexc_traceback;
jpayne@68 14009 if (tb != tmp_tb) {
jpayne@68 14010 Py_INCREF(tb);
jpayne@68 14011 tstate->curexc_traceback = tb;
jpayne@68 14012 Py_XDECREF(tmp_tb);
jpayne@68 14013 }
jpayne@68 14014 #else
jpayne@68 14015 PyObject *tmp_type, *tmp_value, *tmp_tb;
jpayne@68 14016 PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
jpayne@68 14017 Py_INCREF(tb);
jpayne@68 14018 PyErr_Restore(tmp_type, tmp_value, tb);
jpayne@68 14019 Py_XDECREF(tmp_tb);
jpayne@68 14020 #endif
jpayne@68 14021 }
jpayne@68 14022 bad:
jpayne@68 14023 Py_XDECREF(owned_instance);
jpayne@68 14024 return;
jpayne@68 14025 }
jpayne@68 14026 #endif
jpayne@68 14027
jpayne@68 14028 /* GetTopmostException */
jpayne@68 14029 #if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE
jpayne@68 14030 static _PyErr_StackItem *
jpayne@68 14031 __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
jpayne@68 14032 {
jpayne@68 14033 _PyErr_StackItem *exc_info = tstate->exc_info;
jpayne@68 14034 while ((exc_info->exc_value == NULL || exc_info->exc_value == Py_None) &&
jpayne@68 14035 exc_info->previous_item != NULL)
jpayne@68 14036 {
jpayne@68 14037 exc_info = exc_info->previous_item;
jpayne@68 14038 }
jpayne@68 14039 return exc_info;
jpayne@68 14040 }
jpayne@68 14041 #endif
jpayne@68 14042
jpayne@68 14043 /* SaveResetException */
jpayne@68 14044 #if CYTHON_FAST_THREAD_STATE
jpayne@68 14045 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
jpayne@68 14046 #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4
jpayne@68 14047 _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
jpayne@68 14048 PyObject *exc_value = exc_info->exc_value;
jpayne@68 14049 if (exc_value == NULL || exc_value == Py_None) {
jpayne@68 14050 *value = NULL;
jpayne@68 14051 *type = NULL;
jpayne@68 14052 *tb = NULL;
jpayne@68 14053 } else {
jpayne@68 14054 *value = exc_value;
jpayne@68 14055 Py_INCREF(*value);
jpayne@68 14056 *type = (PyObject*) Py_TYPE(exc_value);
jpayne@68 14057 Py_INCREF(*type);
jpayne@68 14058 *tb = PyException_GetTraceback(exc_value);
jpayne@68 14059 }
jpayne@68 14060 #elif CYTHON_USE_EXC_INFO_STACK
jpayne@68 14061 _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
jpayne@68 14062 *type = exc_info->exc_type;
jpayne@68 14063 *value = exc_info->exc_value;
jpayne@68 14064 *tb = exc_info->exc_traceback;
jpayne@68 14065 Py_XINCREF(*type);
jpayne@68 14066 Py_XINCREF(*value);
jpayne@68 14067 Py_XINCREF(*tb);
jpayne@68 14068 #else
jpayne@68 14069 *type = tstate->exc_type;
jpayne@68 14070 *value = tstate->exc_value;
jpayne@68 14071 *tb = tstate->exc_traceback;
jpayne@68 14072 Py_XINCREF(*type);
jpayne@68 14073 Py_XINCREF(*value);
jpayne@68 14074 Py_XINCREF(*tb);
jpayne@68 14075 #endif
jpayne@68 14076 }
jpayne@68 14077 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
jpayne@68 14078 #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4
jpayne@68 14079 _PyErr_StackItem *exc_info = tstate->exc_info;
jpayne@68 14080 PyObject *tmp_value = exc_info->exc_value;
jpayne@68 14081 exc_info->exc_value = value;
jpayne@68 14082 Py_XDECREF(tmp_value);
jpayne@68 14083 Py_XDECREF(type);
jpayne@68 14084 Py_XDECREF(tb);
jpayne@68 14085 #else
jpayne@68 14086 PyObject *tmp_type, *tmp_value, *tmp_tb;
jpayne@68 14087 #if CYTHON_USE_EXC_INFO_STACK
jpayne@68 14088 _PyErr_StackItem *exc_info = tstate->exc_info;
jpayne@68 14089 tmp_type = exc_info->exc_type;
jpayne@68 14090 tmp_value = exc_info->exc_value;
jpayne@68 14091 tmp_tb = exc_info->exc_traceback;
jpayne@68 14092 exc_info->exc_type = type;
jpayne@68 14093 exc_info->exc_value = value;
jpayne@68 14094 exc_info->exc_traceback = tb;
jpayne@68 14095 #else
jpayne@68 14096 tmp_type = tstate->exc_type;
jpayne@68 14097 tmp_value = tstate->exc_value;
jpayne@68 14098 tmp_tb = tstate->exc_traceback;
jpayne@68 14099 tstate->exc_type = type;
jpayne@68 14100 tstate->exc_value = value;
jpayne@68 14101 tstate->exc_traceback = tb;
jpayne@68 14102 #endif
jpayne@68 14103 Py_XDECREF(tmp_type);
jpayne@68 14104 Py_XDECREF(tmp_value);
jpayne@68 14105 Py_XDECREF(tmp_tb);
jpayne@68 14106 #endif
jpayne@68 14107 }
jpayne@68 14108 #endif
jpayne@68 14109
jpayne@68 14110 /* GetException */
jpayne@68 14111 #if CYTHON_FAST_THREAD_STATE
jpayne@68 14112 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
jpayne@68 14113 #else
jpayne@68 14114 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
jpayne@68 14115 #endif
jpayne@68 14116 {
jpayne@68 14117 PyObject *local_type = NULL, *local_value, *local_tb = NULL;
jpayne@68 14118 #if CYTHON_FAST_THREAD_STATE
jpayne@68 14119 PyObject *tmp_type, *tmp_value, *tmp_tb;
jpayne@68 14120 #if PY_VERSION_HEX >= 0x030C00A6
jpayne@68 14121 local_value = tstate->current_exception;
jpayne@68 14122 tstate->current_exception = 0;
jpayne@68 14123 if (likely(local_value)) {
jpayne@68 14124 local_type = (PyObject*) Py_TYPE(local_value);
jpayne@68 14125 Py_INCREF(local_type);
jpayne@68 14126 local_tb = PyException_GetTraceback(local_value);
jpayne@68 14127 }
jpayne@68 14128 #else
jpayne@68 14129 local_type = tstate->curexc_type;
jpayne@68 14130 local_value = tstate->curexc_value;
jpayne@68 14131 local_tb = tstate->curexc_traceback;
jpayne@68 14132 tstate->curexc_type = 0;
jpayne@68 14133 tstate->curexc_value = 0;
jpayne@68 14134 tstate->curexc_traceback = 0;
jpayne@68 14135 #endif
jpayne@68 14136 #else
jpayne@68 14137 PyErr_Fetch(&local_type, &local_value, &local_tb);
jpayne@68 14138 #endif
jpayne@68 14139 PyErr_NormalizeException(&local_type, &local_value, &local_tb);
jpayne@68 14140 #if CYTHON_FAST_THREAD_STATE && PY_VERSION_HEX >= 0x030C00A6
jpayne@68 14141 if (unlikely(tstate->current_exception))
jpayne@68 14142 #elif CYTHON_FAST_THREAD_STATE
jpayne@68 14143 if (unlikely(tstate->curexc_type))
jpayne@68 14144 #else
jpayne@68 14145 if (unlikely(PyErr_Occurred()))
jpayne@68 14146 #endif
jpayne@68 14147 goto bad;
jpayne@68 14148 #if PY_MAJOR_VERSION >= 3
jpayne@68 14149 if (local_tb) {
jpayne@68 14150 if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
jpayne@68 14151 goto bad;
jpayne@68 14152 }
jpayne@68 14153 #endif
jpayne@68 14154 Py_XINCREF(local_tb);
jpayne@68 14155 Py_XINCREF(local_type);
jpayne@68 14156 Py_XINCREF(local_value);
jpayne@68 14157 *type = local_type;
jpayne@68 14158 *value = local_value;
jpayne@68 14159 *tb = local_tb;
jpayne@68 14160 #if CYTHON_FAST_THREAD_STATE
jpayne@68 14161 #if CYTHON_USE_EXC_INFO_STACK
jpayne@68 14162 {
jpayne@68 14163 _PyErr_StackItem *exc_info = tstate->exc_info;
jpayne@68 14164 #if PY_VERSION_HEX >= 0x030B00a4
jpayne@68 14165 tmp_value = exc_info->exc_value;
jpayne@68 14166 exc_info->exc_value = local_value;
jpayne@68 14167 tmp_type = NULL;
jpayne@68 14168 tmp_tb = NULL;
jpayne@68 14169 Py_XDECREF(local_type);
jpayne@68 14170 Py_XDECREF(local_tb);
jpayne@68 14171 #else
jpayne@68 14172 tmp_type = exc_info->exc_type;
jpayne@68 14173 tmp_value = exc_info->exc_value;
jpayne@68 14174 tmp_tb = exc_info->exc_traceback;
jpayne@68 14175 exc_info->exc_type = local_type;
jpayne@68 14176 exc_info->exc_value = local_value;
jpayne@68 14177 exc_info->exc_traceback = local_tb;
jpayne@68 14178 #endif
jpayne@68 14179 }
jpayne@68 14180 #else
jpayne@68 14181 tmp_type = tstate->exc_type;
jpayne@68 14182 tmp_value = tstate->exc_value;
jpayne@68 14183 tmp_tb = tstate->exc_traceback;
jpayne@68 14184 tstate->exc_type = local_type;
jpayne@68 14185 tstate->exc_value = local_value;
jpayne@68 14186 tstate->exc_traceback = local_tb;
jpayne@68 14187 #endif
jpayne@68 14188 Py_XDECREF(tmp_type);
jpayne@68 14189 Py_XDECREF(tmp_value);
jpayne@68 14190 Py_XDECREF(tmp_tb);
jpayne@68 14191 #else
jpayne@68 14192 PyErr_SetExcInfo(local_type, local_value, local_tb);
jpayne@68 14193 #endif
jpayne@68 14194 return 0;
jpayne@68 14195 bad:
jpayne@68 14196 *type = 0;
jpayne@68 14197 *value = 0;
jpayne@68 14198 *tb = 0;
jpayne@68 14199 Py_XDECREF(local_type);
jpayne@68 14200 Py_XDECREF(local_value);
jpayne@68 14201 Py_XDECREF(local_tb);
jpayne@68 14202 return -1;
jpayne@68 14203 }
jpayne@68 14204
jpayne@68 14205 /* RaiseTooManyValuesToUnpack */
jpayne@68 14206 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
jpayne@68 14207 PyErr_Format(PyExc_ValueError,
jpayne@68 14208 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
jpayne@68 14209 }
jpayne@68 14210
jpayne@68 14211 /* RaiseNeedMoreValuesToUnpack */
jpayne@68 14212 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
jpayne@68 14213 PyErr_Format(PyExc_ValueError,
jpayne@68 14214 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
jpayne@68 14215 index, (index == 1) ? "" : "s");
jpayne@68 14216 }
jpayne@68 14217
jpayne@68 14218 /* IterFinish */
jpayne@68 14219 static CYTHON_INLINE int __Pyx_IterFinish(void) {
jpayne@68 14220 PyObject* exc_type;
jpayne@68 14221 __Pyx_PyThreadState_declare
jpayne@68 14222 __Pyx_PyThreadState_assign
jpayne@68 14223 exc_type = __Pyx_PyErr_CurrentExceptionType();
jpayne@68 14224 if (unlikely(exc_type)) {
jpayne@68 14225 if (unlikely(!__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)))
jpayne@68 14226 return -1;
jpayne@68 14227 __Pyx_PyErr_Clear();
jpayne@68 14228 return 0;
jpayne@68 14229 }
jpayne@68 14230 return 0;
jpayne@68 14231 }
jpayne@68 14232
jpayne@68 14233 /* UnpackItemEndCheck */
jpayne@68 14234 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
jpayne@68 14235 if (unlikely(retval)) {
jpayne@68 14236 Py_DECREF(retval);
jpayne@68 14237 __Pyx_RaiseTooManyValuesError(expected);
jpayne@68 14238 return -1;
jpayne@68 14239 }
jpayne@68 14240 return __Pyx_IterFinish();
jpayne@68 14241 }
jpayne@68 14242
jpayne@68 14243 /* PyIntBinop */
jpayne@68 14244 #if !CYTHON_COMPILING_IN_PYPY
jpayne@68 14245 static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check) {
jpayne@68 14246 CYTHON_MAYBE_UNUSED_VAR(intval);
jpayne@68 14247 CYTHON_MAYBE_UNUSED_VAR(inplace);
jpayne@68 14248 CYTHON_UNUSED_VAR(zerodivision_check);
jpayne@68 14249 #if PY_MAJOR_VERSION < 3
jpayne@68 14250 if (likely(PyInt_CheckExact(op1))) {
jpayne@68 14251 const long b = intval;
jpayne@68 14252 long x;
jpayne@68 14253 long a = PyInt_AS_LONG(op1);
jpayne@68 14254
jpayne@68 14255 x = (long)((unsigned long)a - (unsigned long)b);
jpayne@68 14256 if (likely((x^a) >= 0 || (x^~b) >= 0))
jpayne@68 14257 return PyInt_FromLong(x);
jpayne@68 14258 return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
jpayne@68 14259 }
jpayne@68 14260 #endif
jpayne@68 14261 #if CYTHON_USE_PYLONG_INTERNALS
jpayne@68 14262 if (likely(PyLong_CheckExact(op1))) {
jpayne@68 14263 const long b = intval;
jpayne@68 14264 long a, x;
jpayne@68 14265 #ifdef HAVE_LONG_LONG
jpayne@68 14266 const PY_LONG_LONG llb = intval;
jpayne@68 14267 PY_LONG_LONG lla, llx;
jpayne@68 14268 #endif
jpayne@68 14269 if (unlikely(__Pyx_PyLong_IsZero(op1))) {
jpayne@68 14270 return PyLong_FromLong(-intval);
jpayne@68 14271 }
jpayne@68 14272 if (likely(__Pyx_PyLong_IsCompact(op1))) {
jpayne@68 14273 a = __Pyx_PyLong_CompactValue(op1);
jpayne@68 14274 } else {
jpayne@68 14275 const digit* digits = __Pyx_PyLong_Digits(op1);
jpayne@68 14276 const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(op1);
jpayne@68 14277 switch (size) {
jpayne@68 14278 case -2:
jpayne@68 14279 if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
jpayne@68 14280 a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
jpayne@68 14281 break;
jpayne@68 14282 #ifdef HAVE_LONG_LONG
jpayne@68 14283 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
jpayne@68 14284 lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
jpayne@68 14285 goto long_long;
jpayne@68 14286 #endif
jpayne@68 14287 }
jpayne@68 14288 CYTHON_FALLTHROUGH;
jpayne@68 14289 case 2:
jpayne@68 14290 if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
jpayne@68 14291 a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
jpayne@68 14292 break;
jpayne@68 14293 #ifdef HAVE_LONG_LONG
jpayne@68 14294 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
jpayne@68 14295 lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
jpayne@68 14296 goto long_long;
jpayne@68 14297 #endif
jpayne@68 14298 }
jpayne@68 14299 CYTHON_FALLTHROUGH;
jpayne@68 14300 case -3:
jpayne@68 14301 if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
jpayne@68 14302 a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
jpayne@68 14303 break;
jpayne@68 14304 #ifdef HAVE_LONG_LONG
jpayne@68 14305 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
jpayne@68 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@68 14307 goto long_long;
jpayne@68 14308 #endif
jpayne@68 14309 }
jpayne@68 14310 CYTHON_FALLTHROUGH;
jpayne@68 14311 case 3:
jpayne@68 14312 if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
jpayne@68 14313 a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
jpayne@68 14314 break;
jpayne@68 14315 #ifdef HAVE_LONG_LONG
jpayne@68 14316 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
jpayne@68 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@68 14318 goto long_long;
jpayne@68 14319 #endif
jpayne@68 14320 }
jpayne@68 14321 CYTHON_FALLTHROUGH;
jpayne@68 14322 case -4:
jpayne@68 14323 if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
jpayne@68 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@68 14325 break;
jpayne@68 14326 #ifdef HAVE_LONG_LONG
jpayne@68 14327 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
jpayne@68 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@68 14329 goto long_long;
jpayne@68 14330 #endif
jpayne@68 14331 }
jpayne@68 14332 CYTHON_FALLTHROUGH;
jpayne@68 14333 case 4:
jpayne@68 14334 if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
jpayne@68 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@68 14336 break;
jpayne@68 14337 #ifdef HAVE_LONG_LONG
jpayne@68 14338 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
jpayne@68 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@68 14340 goto long_long;
jpayne@68 14341 #endif
jpayne@68 14342 }
jpayne@68 14343 CYTHON_FALLTHROUGH;
jpayne@68 14344 default: return PyLong_Type.tp_as_number->nb_subtract(op1, op2);
jpayne@68 14345 }
jpayne@68 14346 }
jpayne@68 14347 x = a - b;
jpayne@68 14348 return PyLong_FromLong(x);
jpayne@68 14349 #ifdef HAVE_LONG_LONG
jpayne@68 14350 long_long:
jpayne@68 14351 llx = lla - llb;
jpayne@68 14352 return PyLong_FromLongLong(llx);
jpayne@68 14353 #endif
jpayne@68 14354
jpayne@68 14355
jpayne@68 14356 }
jpayne@68 14357 #endif
jpayne@68 14358 if (PyFloat_CheckExact(op1)) {
jpayne@68 14359 const long b = intval;
jpayne@68 14360 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 14361 double a = __pyx_PyFloat_AsDouble(op1);
jpayne@68 14362 #else
jpayne@68 14363 double a = PyFloat_AS_DOUBLE(op1);
jpayne@68 14364 #endif
jpayne@68 14365 double result;
jpayne@68 14366
jpayne@68 14367 PyFPE_START_PROTECT("subtract", return NULL)
jpayne@68 14368 result = ((double)a) - (double)b;
jpayne@68 14369 PyFPE_END_PROTECT(result)
jpayne@68 14370 return PyFloat_FromDouble(result);
jpayne@68 14371 }
jpayne@68 14372 return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2);
jpayne@68 14373 }
jpayne@68 14374 #endif
jpayne@68 14375
jpayne@68 14376 /* PyObjectLookupSpecial */
jpayne@68 14377 #if CYTHON_USE_PYTYPE_LOOKUP && CYTHON_USE_TYPE_SLOTS
jpayne@68 14378 static CYTHON_INLINE PyObject* __Pyx__PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name, int with_error) {
jpayne@68 14379 PyObject *res;
jpayne@68 14380 PyTypeObject *tp = Py_TYPE(obj);
jpayne@68 14381 #if PY_MAJOR_VERSION < 3
jpayne@68 14382 if (unlikely(PyInstance_Check(obj)))
jpayne@68 14383 return with_error ? __Pyx_PyObject_GetAttrStr(obj, attr_name) : __Pyx_PyObject_GetAttrStrNoError(obj, attr_name);
jpayne@68 14384 #endif
jpayne@68 14385 res = _PyType_Lookup(tp, attr_name);
jpayne@68 14386 if (likely(res)) {
jpayne@68 14387 descrgetfunc f = Py_TYPE(res)->tp_descr_get;
jpayne@68 14388 if (!f) {
jpayne@68 14389 Py_INCREF(res);
jpayne@68 14390 } else {
jpayne@68 14391 res = f(res, obj, (PyObject *)tp);
jpayne@68 14392 }
jpayne@68 14393 } else if (with_error) {
jpayne@68 14394 PyErr_SetObject(PyExc_AttributeError, attr_name);
jpayne@68 14395 }
jpayne@68 14396 return res;
jpayne@68 14397 }
jpayne@68 14398 #endif
jpayne@68 14399
jpayne@68 14400 /* SwapException */
jpayne@68 14401 #if CYTHON_FAST_THREAD_STATE
jpayne@68 14402 static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
jpayne@68 14403 PyObject *tmp_type, *tmp_value, *tmp_tb;
jpayne@68 14404 #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4
jpayne@68 14405 _PyErr_StackItem *exc_info = tstate->exc_info;
jpayne@68 14406 tmp_value = exc_info->exc_value;
jpayne@68 14407 exc_info->exc_value = *value;
jpayne@68 14408 if (tmp_value == NULL || tmp_value == Py_None) {
jpayne@68 14409 Py_XDECREF(tmp_value);
jpayne@68 14410 tmp_value = NULL;
jpayne@68 14411 tmp_type = NULL;
jpayne@68 14412 tmp_tb = NULL;
jpayne@68 14413 } else {
jpayne@68 14414 tmp_type = (PyObject*) Py_TYPE(tmp_value);
jpayne@68 14415 Py_INCREF(tmp_type);
jpayne@68 14416 #if CYTHON_COMPILING_IN_CPYTHON
jpayne@68 14417 tmp_tb = ((PyBaseExceptionObject*) tmp_value)->traceback;
jpayne@68 14418 Py_XINCREF(tmp_tb);
jpayne@68 14419 #else
jpayne@68 14420 tmp_tb = PyException_GetTraceback(tmp_value);
jpayne@68 14421 #endif
jpayne@68 14422 }
jpayne@68 14423 #elif CYTHON_USE_EXC_INFO_STACK
jpayne@68 14424 _PyErr_StackItem *exc_info = tstate->exc_info;
jpayne@68 14425 tmp_type = exc_info->exc_type;
jpayne@68 14426 tmp_value = exc_info->exc_value;
jpayne@68 14427 tmp_tb = exc_info->exc_traceback;
jpayne@68 14428 exc_info->exc_type = *type;
jpayne@68 14429 exc_info->exc_value = *value;
jpayne@68 14430 exc_info->exc_traceback = *tb;
jpayne@68 14431 #else
jpayne@68 14432 tmp_type = tstate->exc_type;
jpayne@68 14433 tmp_value = tstate->exc_value;
jpayne@68 14434 tmp_tb = tstate->exc_traceback;
jpayne@68 14435 tstate->exc_type = *type;
jpayne@68 14436 tstate->exc_value = *value;
jpayne@68 14437 tstate->exc_traceback = *tb;
jpayne@68 14438 #endif
jpayne@68 14439 *type = tmp_type;
jpayne@68 14440 *value = tmp_value;
jpayne@68 14441 *tb = tmp_tb;
jpayne@68 14442 }
jpayne@68 14443 #else
jpayne@68 14444 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
jpayne@68 14445 PyObject *tmp_type, *tmp_value, *tmp_tb;
jpayne@68 14446 PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
jpayne@68 14447 PyErr_SetExcInfo(*type, *value, *tb);
jpayne@68 14448 *type = tmp_type;
jpayne@68 14449 *value = tmp_value;
jpayne@68 14450 *tb = tmp_tb;
jpayne@68 14451 }
jpayne@68 14452 #endif
jpayne@68 14453
jpayne@68 14454 /* PyIntCompare */
jpayne@68 14455 static CYTHON_INLINE int __Pyx_PyInt_BoolEqObjC(PyObject *op1, PyObject *op2, long intval, long inplace) {
jpayne@68 14456 CYTHON_MAYBE_UNUSED_VAR(intval);
jpayne@68 14457 CYTHON_UNUSED_VAR(inplace);
jpayne@68 14458 if (op1 == op2) {
jpayne@68 14459 return 1;
jpayne@68 14460 }
jpayne@68 14461 #if PY_MAJOR_VERSION < 3
jpayne@68 14462 if (likely(PyInt_CheckExact(op1))) {
jpayne@68 14463 const long b = intval;
jpayne@68 14464 long a = PyInt_AS_LONG(op1);
jpayne@68 14465 return (a == b);
jpayne@68 14466 }
jpayne@68 14467 #endif
jpayne@68 14468 #if CYTHON_USE_PYLONG_INTERNALS
jpayne@68 14469 if (likely(PyLong_CheckExact(op1))) {
jpayne@68 14470 int unequal;
jpayne@68 14471 unsigned long uintval;
jpayne@68 14472 Py_ssize_t size = __Pyx_PyLong_DigitCount(op1);
jpayne@68 14473 const digit* digits = __Pyx_PyLong_Digits(op1);
jpayne@68 14474 if (intval == 0) {
jpayne@68 14475 return (__Pyx_PyLong_IsZero(op1) == 1);
jpayne@68 14476 } else if (intval < 0) {
jpayne@68 14477 if (__Pyx_PyLong_IsNonNeg(op1))
jpayne@68 14478 return 0;
jpayne@68 14479 intval = -intval;
jpayne@68 14480 } else {
jpayne@68 14481 if (__Pyx_PyLong_IsNeg(op1))
jpayne@68 14482 return 0;
jpayne@68 14483 }
jpayne@68 14484 uintval = (unsigned long) intval;
jpayne@68 14485 #if PyLong_SHIFT * 4 < SIZEOF_LONG*8
jpayne@68 14486 if (uintval >> (PyLong_SHIFT * 4)) {
jpayne@68 14487 unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
jpayne@68 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@68 14489 } else
jpayne@68 14490 #endif
jpayne@68 14491 #if PyLong_SHIFT * 3 < SIZEOF_LONG*8
jpayne@68 14492 if (uintval >> (PyLong_SHIFT * 3)) {
jpayne@68 14493 unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
jpayne@68 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@68 14495 } else
jpayne@68 14496 #endif
jpayne@68 14497 #if PyLong_SHIFT * 2 < SIZEOF_LONG*8
jpayne@68 14498 if (uintval >> (PyLong_SHIFT * 2)) {
jpayne@68 14499 unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
jpayne@68 14500 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
jpayne@68 14501 } else
jpayne@68 14502 #endif
jpayne@68 14503 #if PyLong_SHIFT * 1 < SIZEOF_LONG*8
jpayne@68 14504 if (uintval >> (PyLong_SHIFT * 1)) {
jpayne@68 14505 unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
jpayne@68 14506 | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
jpayne@68 14507 } else
jpayne@68 14508 #endif
jpayne@68 14509 unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK));
jpayne@68 14510 return (unequal == 0);
jpayne@68 14511 }
jpayne@68 14512 #endif
jpayne@68 14513 if (PyFloat_CheckExact(op1)) {
jpayne@68 14514 const long b = intval;
jpayne@68 14515 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 14516 double a = __pyx_PyFloat_AsDouble(op1);
jpayne@68 14517 #else
jpayne@68 14518 double a = PyFloat_AS_DOUBLE(op1);
jpayne@68 14519 #endif
jpayne@68 14520 return ((double)a == (double)b);
jpayne@68 14521 }
jpayne@68 14522 return __Pyx_PyObject_IsTrueAndDecref(
jpayne@68 14523 PyObject_RichCompare(op1, op2, Py_EQ));
jpayne@68 14524 }
jpayne@68 14525
jpayne@68 14526 /* DictGetItem */
jpayne@68 14527 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
jpayne@68 14528 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
jpayne@68 14529 PyObject *value;
jpayne@68 14530 value = PyDict_GetItemWithError(d, key);
jpayne@68 14531 if (unlikely(!value)) {
jpayne@68 14532 if (!PyErr_Occurred()) {
jpayne@68 14533 if (unlikely(PyTuple_Check(key))) {
jpayne@68 14534 PyObject* args = PyTuple_Pack(1, key);
jpayne@68 14535 if (likely(args)) {
jpayne@68 14536 PyErr_SetObject(PyExc_KeyError, args);
jpayne@68 14537 Py_DECREF(args);
jpayne@68 14538 }
jpayne@68 14539 } else {
jpayne@68 14540 PyErr_SetObject(PyExc_KeyError, key);
jpayne@68 14541 }
jpayne@68 14542 }
jpayne@68 14543 return NULL;
jpayne@68 14544 }
jpayne@68 14545 Py_INCREF(value);
jpayne@68 14546 return value;
jpayne@68 14547 }
jpayne@68 14548 #endif
jpayne@68 14549
jpayne@68 14550 /* FixUpExtensionType */
jpayne@68 14551 #if CYTHON_USE_TYPE_SPECS
jpayne@68 14552 static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type) {
jpayne@68 14553 #if PY_VERSION_HEX > 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 14554 CYTHON_UNUSED_VAR(spec);
jpayne@68 14555 CYTHON_UNUSED_VAR(type);
jpayne@68 14556 #else
jpayne@68 14557 const PyType_Slot *slot = spec->slots;
jpayne@68 14558 while (slot && slot->slot && slot->slot != Py_tp_members)
jpayne@68 14559 slot++;
jpayne@68 14560 if (slot && slot->slot == Py_tp_members) {
jpayne@68 14561 int changed = 0;
jpayne@68 14562 #if !(PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON)
jpayne@68 14563 const
jpayne@68 14564 #endif
jpayne@68 14565 PyMemberDef *memb = (PyMemberDef*) slot->pfunc;
jpayne@68 14566 while (memb && memb->name) {
jpayne@68 14567 if (memb->name[0] == '_' && memb->name[1] == '_') {
jpayne@68 14568 #if PY_VERSION_HEX < 0x030900b1
jpayne@68 14569 if (strcmp(memb->name, "__weaklistoffset__") == 0) {
jpayne@68 14570 assert(memb->type == T_PYSSIZET);
jpayne@68 14571 assert(memb->flags == READONLY);
jpayne@68 14572 type->tp_weaklistoffset = memb->offset;
jpayne@68 14573 changed = 1;
jpayne@68 14574 }
jpayne@68 14575 else if (strcmp(memb->name, "__dictoffset__") == 0) {
jpayne@68 14576 assert(memb->type == T_PYSSIZET);
jpayne@68 14577 assert(memb->flags == READONLY);
jpayne@68 14578 type->tp_dictoffset = memb->offset;
jpayne@68 14579 changed = 1;
jpayne@68 14580 }
jpayne@68 14581 #if CYTHON_METH_FASTCALL
jpayne@68 14582 else if (strcmp(memb->name, "__vectorcalloffset__") == 0) {
jpayne@68 14583 assert(memb->type == T_PYSSIZET);
jpayne@68 14584 assert(memb->flags == READONLY);
jpayne@68 14585 #if PY_VERSION_HEX >= 0x030800b4
jpayne@68 14586 type->tp_vectorcall_offset = memb->offset;
jpayne@68 14587 #else
jpayne@68 14588 type->tp_print = (printfunc) memb->offset;
jpayne@68 14589 #endif
jpayne@68 14590 changed = 1;
jpayne@68 14591 }
jpayne@68 14592 #endif
jpayne@68 14593 #else
jpayne@68 14594 if ((0));
jpayne@68 14595 #endif
jpayne@68 14596 #if PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON
jpayne@68 14597 else if (strcmp(memb->name, "__module__") == 0) {
jpayne@68 14598 PyObject *descr;
jpayne@68 14599 assert(memb->type == T_OBJECT);
jpayne@68 14600 assert(memb->flags == 0 || memb->flags == READONLY);
jpayne@68 14601 descr = PyDescr_NewMember(type, memb);
jpayne@68 14602 if (unlikely(!descr))
jpayne@68 14603 return -1;
jpayne@68 14604 if (unlikely(PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr) < 0)) {
jpayne@68 14605 Py_DECREF(descr);
jpayne@68 14606 return -1;
jpayne@68 14607 }
jpayne@68 14608 Py_DECREF(descr);
jpayne@68 14609 changed = 1;
jpayne@68 14610 }
jpayne@68 14611 #endif
jpayne@68 14612 }
jpayne@68 14613 memb++;
jpayne@68 14614 }
jpayne@68 14615 if (changed)
jpayne@68 14616 PyType_Modified(type);
jpayne@68 14617 }
jpayne@68 14618 #endif
jpayne@68 14619 return 0;
jpayne@68 14620 }
jpayne@68 14621 #endif
jpayne@68 14622
jpayne@68 14623 /* FetchSharedCythonModule */
jpayne@68 14624 static PyObject *__Pyx_FetchSharedCythonABIModule(void) {
jpayne@68 14625 return __Pyx_PyImport_AddModuleRef((char*) __PYX_ABI_MODULE_NAME);
jpayne@68 14626 }
jpayne@68 14627
jpayne@68 14628 /* FetchCommonType */
jpayne@68 14629 static int __Pyx_VerifyCachedType(PyObject *cached_type,
jpayne@68 14630 const char *name,
jpayne@68 14631 Py_ssize_t basicsize,
jpayne@68 14632 Py_ssize_t expected_basicsize) {
jpayne@68 14633 if (!PyType_Check(cached_type)) {
jpayne@68 14634 PyErr_Format(PyExc_TypeError,
jpayne@68 14635 "Shared Cython type %.200s is not a type object", name);
jpayne@68 14636 return -1;
jpayne@68 14637 }
jpayne@68 14638 if (basicsize != expected_basicsize) {
jpayne@68 14639 PyErr_Format(PyExc_TypeError,
jpayne@68 14640 "Shared Cython type %.200s has the wrong size, try recompiling",
jpayne@68 14641 name);
jpayne@68 14642 return -1;
jpayne@68 14643 }
jpayne@68 14644 return 0;
jpayne@68 14645 }
jpayne@68 14646 #if !CYTHON_USE_TYPE_SPECS
jpayne@68 14647 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
jpayne@68 14648 PyObject* abi_module;
jpayne@68 14649 const char* object_name;
jpayne@68 14650 PyTypeObject *cached_type = NULL;
jpayne@68 14651 abi_module = __Pyx_FetchSharedCythonABIModule();
jpayne@68 14652 if (!abi_module) return NULL;
jpayne@68 14653 object_name = strrchr(type->tp_name, '.');
jpayne@68 14654 object_name = object_name ? object_name+1 : type->tp_name;
jpayne@68 14655 cached_type = (PyTypeObject*) PyObject_GetAttrString(abi_module, object_name);
jpayne@68 14656 if (cached_type) {
jpayne@68 14657 if (__Pyx_VerifyCachedType(
jpayne@68 14658 (PyObject *)cached_type,
jpayne@68 14659 object_name,
jpayne@68 14660 cached_type->tp_basicsize,
jpayne@68 14661 type->tp_basicsize) < 0) {
jpayne@68 14662 goto bad;
jpayne@68 14663 }
jpayne@68 14664 goto done;
jpayne@68 14665 }
jpayne@68 14666 if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
jpayne@68 14667 PyErr_Clear();
jpayne@68 14668 if (PyType_Ready(type) < 0) goto bad;
jpayne@68 14669 if (PyObject_SetAttrString(abi_module, object_name, (PyObject *)type) < 0)
jpayne@68 14670 goto bad;
jpayne@68 14671 Py_INCREF(type);
jpayne@68 14672 cached_type = type;
jpayne@68 14673 done:
jpayne@68 14674 Py_DECREF(abi_module);
jpayne@68 14675 return cached_type;
jpayne@68 14676 bad:
jpayne@68 14677 Py_XDECREF(cached_type);
jpayne@68 14678 cached_type = NULL;
jpayne@68 14679 goto done;
jpayne@68 14680 }
jpayne@68 14681 #else
jpayne@68 14682 static PyTypeObject *__Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases) {
jpayne@68 14683 PyObject *abi_module, *cached_type = NULL;
jpayne@68 14684 const char* object_name = strrchr(spec->name, '.');
jpayne@68 14685 object_name = object_name ? object_name+1 : spec->name;
jpayne@68 14686 abi_module = __Pyx_FetchSharedCythonABIModule();
jpayne@68 14687 if (!abi_module) return NULL;
jpayne@68 14688 cached_type = PyObject_GetAttrString(abi_module, object_name);
jpayne@68 14689 if (cached_type) {
jpayne@68 14690 Py_ssize_t basicsize;
jpayne@68 14691 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 14692 PyObject *py_basicsize;
jpayne@68 14693 py_basicsize = PyObject_GetAttrString(cached_type, "__basicsize__");
jpayne@68 14694 if (unlikely(!py_basicsize)) goto bad;
jpayne@68 14695 basicsize = PyLong_AsSsize_t(py_basicsize);
jpayne@68 14696 Py_DECREF(py_basicsize);
jpayne@68 14697 py_basicsize = 0;
jpayne@68 14698 if (unlikely(basicsize == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
jpayne@68 14699 #else
jpayne@68 14700 basicsize = likely(PyType_Check(cached_type)) ? ((PyTypeObject*) cached_type)->tp_basicsize : -1;
jpayne@68 14701 #endif
jpayne@68 14702 if (__Pyx_VerifyCachedType(
jpayne@68 14703 cached_type,
jpayne@68 14704 object_name,
jpayne@68 14705 basicsize,
jpayne@68 14706 spec->basicsize) < 0) {
jpayne@68 14707 goto bad;
jpayne@68 14708 }
jpayne@68 14709 goto done;
jpayne@68 14710 }
jpayne@68 14711 if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
jpayne@68 14712 PyErr_Clear();
jpayne@68 14713 CYTHON_UNUSED_VAR(module);
jpayne@68 14714 cached_type = __Pyx_PyType_FromModuleAndSpec(abi_module, spec, bases);
jpayne@68 14715 if (unlikely(!cached_type)) goto bad;
jpayne@68 14716 if (unlikely(__Pyx_fix_up_extension_type_from_spec(spec, (PyTypeObject *) cached_type) < 0)) goto bad;
jpayne@68 14717 if (PyObject_SetAttrString(abi_module, object_name, cached_type) < 0) goto bad;
jpayne@68 14718 done:
jpayne@68 14719 Py_DECREF(abi_module);
jpayne@68 14720 assert(cached_type == NULL || PyType_Check(cached_type));
jpayne@68 14721 return (PyTypeObject *) cached_type;
jpayne@68 14722 bad:
jpayne@68 14723 Py_XDECREF(cached_type);
jpayne@68 14724 cached_type = NULL;
jpayne@68 14725 goto done;
jpayne@68 14726 }
jpayne@68 14727 #endif
jpayne@68 14728
jpayne@68 14729 /* PyVectorcallFastCallDict */
jpayne@68 14730 #if CYTHON_METH_FASTCALL
jpayne@68 14731 static PyObject *__Pyx_PyVectorcall_FastCallDict_kw(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw)
jpayne@68 14732 {
jpayne@68 14733 PyObject *res = NULL;
jpayne@68 14734 PyObject *kwnames;
jpayne@68 14735 PyObject **newargs;
jpayne@68 14736 PyObject **kwvalues;
jpayne@68 14737 Py_ssize_t i, pos;
jpayne@68 14738 size_t j;
jpayne@68 14739 PyObject *key, *value;
jpayne@68 14740 unsigned long keys_are_strings;
jpayne@68 14741 Py_ssize_t nkw = PyDict_GET_SIZE(kw);
jpayne@68 14742 newargs = (PyObject **)PyMem_Malloc((nargs + (size_t)nkw) * sizeof(args[0]));
jpayne@68 14743 if (unlikely(newargs == NULL)) {
jpayne@68 14744 PyErr_NoMemory();
jpayne@68 14745 return NULL;
jpayne@68 14746 }
jpayne@68 14747 for (j = 0; j < nargs; j++) newargs[j] = args[j];
jpayne@68 14748 kwnames = PyTuple_New(nkw);
jpayne@68 14749 if (unlikely(kwnames == NULL)) {
jpayne@68 14750 PyMem_Free(newargs);
jpayne@68 14751 return NULL;
jpayne@68 14752 }
jpayne@68 14753 kwvalues = newargs + nargs;
jpayne@68 14754 pos = i = 0;
jpayne@68 14755 keys_are_strings = Py_TPFLAGS_UNICODE_SUBCLASS;
jpayne@68 14756 while (PyDict_Next(kw, &pos, &key, &value)) {
jpayne@68 14757 keys_are_strings &= Py_TYPE(key)->tp_flags;
jpayne@68 14758 Py_INCREF(key);
jpayne@68 14759 Py_INCREF(value);
jpayne@68 14760 PyTuple_SET_ITEM(kwnames, i, key);
jpayne@68 14761 kwvalues[i] = value;
jpayne@68 14762 i++;
jpayne@68 14763 }
jpayne@68 14764 if (unlikely(!keys_are_strings)) {
jpayne@68 14765 PyErr_SetString(PyExc_TypeError, "keywords must be strings");
jpayne@68 14766 goto cleanup;
jpayne@68 14767 }
jpayne@68 14768 res = vc(func, newargs, nargs, kwnames);
jpayne@68 14769 cleanup:
jpayne@68 14770 Py_DECREF(kwnames);
jpayne@68 14771 for (i = 0; i < nkw; i++)
jpayne@68 14772 Py_DECREF(kwvalues[i]);
jpayne@68 14773 PyMem_Free(newargs);
jpayne@68 14774 return res;
jpayne@68 14775 }
jpayne@68 14776 static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw)
jpayne@68 14777 {
jpayne@68 14778 if (likely(kw == NULL) || PyDict_GET_SIZE(kw) == 0) {
jpayne@68 14779 return vc(func, args, nargs, NULL);
jpayne@68 14780 }
jpayne@68 14781 return __Pyx_PyVectorcall_FastCallDict_kw(func, vc, args, nargs, kw);
jpayne@68 14782 }
jpayne@68 14783 #endif
jpayne@68 14784
jpayne@68 14785 /* CythonFunctionShared */
jpayne@68 14786 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 14787 static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void *cfunc) {
jpayne@68 14788 if (__Pyx_CyFunction_Check(func)) {
jpayne@68 14789 return PyCFunction_GetFunction(((__pyx_CyFunctionObject*)func)->func) == (PyCFunction) cfunc;
jpayne@68 14790 } else if (PyCFunction_Check(func)) {
jpayne@68 14791 return PyCFunction_GetFunction(func) == (PyCFunction) cfunc;
jpayne@68 14792 }
jpayne@68 14793 return 0;
jpayne@68 14794 }
jpayne@68 14795 #else
jpayne@68 14796 static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void *cfunc) {
jpayne@68 14797 return __Pyx_CyOrPyCFunction_Check(func) && __Pyx_CyOrPyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc;
jpayne@68 14798 }
jpayne@68 14799 #endif
jpayne@68 14800 static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj) {
jpayne@68 14801 #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 14802 __Pyx_Py_XDECREF_SET(
jpayne@68 14803 __Pyx_CyFunction_GetClassObj(f),
jpayne@68 14804 ((classobj) ? __Pyx_NewRef(classobj) : NULL));
jpayne@68 14805 #else
jpayne@68 14806 __Pyx_Py_XDECREF_SET(
jpayne@68 14807 ((PyCMethodObject *) (f))->mm_class,
jpayne@68 14808 (PyTypeObject*)((classobj) ? __Pyx_NewRef(classobj) : NULL));
jpayne@68 14809 #endif
jpayne@68 14810 }
jpayne@68 14811 static PyObject *
jpayne@68 14812 __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, void *closure)
jpayne@68 14813 {
jpayne@68 14814 CYTHON_UNUSED_VAR(closure);
jpayne@68 14815 if (unlikely(op->func_doc == NULL)) {
jpayne@68 14816 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 14817 op->func_doc = PyObject_GetAttrString(op->func, "__doc__");
jpayne@68 14818 if (unlikely(!op->func_doc)) return NULL;
jpayne@68 14819 #else
jpayne@68 14820 if (((PyCFunctionObject*)op)->m_ml->ml_doc) {
jpayne@68 14821 #if PY_MAJOR_VERSION >= 3
jpayne@68 14822 op->func_doc = PyUnicode_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc);
jpayne@68 14823 #else
jpayne@68 14824 op->func_doc = PyString_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc);
jpayne@68 14825 #endif
jpayne@68 14826 if (unlikely(op->func_doc == NULL))
jpayne@68 14827 return NULL;
jpayne@68 14828 } else {
jpayne@68 14829 Py_INCREF(Py_None);
jpayne@68 14830 return Py_None;
jpayne@68 14831 }
jpayne@68 14832 #endif
jpayne@68 14833 }
jpayne@68 14834 Py_INCREF(op->func_doc);
jpayne@68 14835 return op->func_doc;
jpayne@68 14836 }
jpayne@68 14837 static int
jpayne@68 14838 __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, void *context)
jpayne@68 14839 {
jpayne@68 14840 CYTHON_UNUSED_VAR(context);
jpayne@68 14841 if (value == NULL) {
jpayne@68 14842 value = Py_None;
jpayne@68 14843 }
jpayne@68 14844 Py_INCREF(value);
jpayne@68 14845 __Pyx_Py_XDECREF_SET(op->func_doc, value);
jpayne@68 14846 return 0;
jpayne@68 14847 }
jpayne@68 14848 static PyObject *
jpayne@68 14849 __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, void *context)
jpayne@68 14850 {
jpayne@68 14851 CYTHON_UNUSED_VAR(context);
jpayne@68 14852 if (unlikely(op->func_name == NULL)) {
jpayne@68 14853 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 14854 op->func_name = PyObject_GetAttrString(op->func, "__name__");
jpayne@68 14855 #elif PY_MAJOR_VERSION >= 3
jpayne@68 14856 op->func_name = PyUnicode_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name);
jpayne@68 14857 #else
jpayne@68 14858 op->func_name = PyString_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name);
jpayne@68 14859 #endif
jpayne@68 14860 if (unlikely(op->func_name == NULL))
jpayne@68 14861 return NULL;
jpayne@68 14862 }
jpayne@68 14863 Py_INCREF(op->func_name);
jpayne@68 14864 return op->func_name;
jpayne@68 14865 }
jpayne@68 14866 static int
jpayne@68 14867 __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, void *context)
jpayne@68 14868 {
jpayne@68 14869 CYTHON_UNUSED_VAR(context);
jpayne@68 14870 #if PY_MAJOR_VERSION >= 3
jpayne@68 14871 if (unlikely(value == NULL || !PyUnicode_Check(value)))
jpayne@68 14872 #else
jpayne@68 14873 if (unlikely(value == NULL || !PyString_Check(value)))
jpayne@68 14874 #endif
jpayne@68 14875 {
jpayne@68 14876 PyErr_SetString(PyExc_TypeError,
jpayne@68 14877 "__name__ must be set to a string object");
jpayne@68 14878 return -1;
jpayne@68 14879 }
jpayne@68 14880 Py_INCREF(value);
jpayne@68 14881 __Pyx_Py_XDECREF_SET(op->func_name, value);
jpayne@68 14882 return 0;
jpayne@68 14883 }
jpayne@68 14884 static PyObject *
jpayne@68 14885 __Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, void *context)
jpayne@68 14886 {
jpayne@68 14887 CYTHON_UNUSED_VAR(context);
jpayne@68 14888 Py_INCREF(op->func_qualname);
jpayne@68 14889 return op->func_qualname;
jpayne@68 14890 }
jpayne@68 14891 static int
jpayne@68 14892 __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, void *context)
jpayne@68 14893 {
jpayne@68 14894 CYTHON_UNUSED_VAR(context);
jpayne@68 14895 #if PY_MAJOR_VERSION >= 3
jpayne@68 14896 if (unlikely(value == NULL || !PyUnicode_Check(value)))
jpayne@68 14897 #else
jpayne@68 14898 if (unlikely(value == NULL || !PyString_Check(value)))
jpayne@68 14899 #endif
jpayne@68 14900 {
jpayne@68 14901 PyErr_SetString(PyExc_TypeError,
jpayne@68 14902 "__qualname__ must be set to a string object");
jpayne@68 14903 return -1;
jpayne@68 14904 }
jpayne@68 14905 Py_INCREF(value);
jpayne@68 14906 __Pyx_Py_XDECREF_SET(op->func_qualname, value);
jpayne@68 14907 return 0;
jpayne@68 14908 }
jpayne@68 14909 static PyObject *
jpayne@68 14910 __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, void *context)
jpayne@68 14911 {
jpayne@68 14912 CYTHON_UNUSED_VAR(context);
jpayne@68 14913 if (unlikely(op->func_dict == NULL)) {
jpayne@68 14914 op->func_dict = PyDict_New();
jpayne@68 14915 if (unlikely(op->func_dict == NULL))
jpayne@68 14916 return NULL;
jpayne@68 14917 }
jpayne@68 14918 Py_INCREF(op->func_dict);
jpayne@68 14919 return op->func_dict;
jpayne@68 14920 }
jpayne@68 14921 static int
jpayne@68 14922 __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, void *context)
jpayne@68 14923 {
jpayne@68 14924 CYTHON_UNUSED_VAR(context);
jpayne@68 14925 if (unlikely(value == NULL)) {
jpayne@68 14926 PyErr_SetString(PyExc_TypeError,
jpayne@68 14927 "function's dictionary may not be deleted");
jpayne@68 14928 return -1;
jpayne@68 14929 }
jpayne@68 14930 if (unlikely(!PyDict_Check(value))) {
jpayne@68 14931 PyErr_SetString(PyExc_TypeError,
jpayne@68 14932 "setting function's dictionary to a non-dict");
jpayne@68 14933 return -1;
jpayne@68 14934 }
jpayne@68 14935 Py_INCREF(value);
jpayne@68 14936 __Pyx_Py_XDECREF_SET(op->func_dict, value);
jpayne@68 14937 return 0;
jpayne@68 14938 }
jpayne@68 14939 static PyObject *
jpayne@68 14940 __Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, void *context)
jpayne@68 14941 {
jpayne@68 14942 CYTHON_UNUSED_VAR(context);
jpayne@68 14943 Py_INCREF(op->func_globals);
jpayne@68 14944 return op->func_globals;
jpayne@68 14945 }
jpayne@68 14946 static PyObject *
jpayne@68 14947 __Pyx_CyFunction_get_closure(__pyx_CyFunctionObject *op, void *context)
jpayne@68 14948 {
jpayne@68 14949 CYTHON_UNUSED_VAR(op);
jpayne@68 14950 CYTHON_UNUSED_VAR(context);
jpayne@68 14951 Py_INCREF(Py_None);
jpayne@68 14952 return Py_None;
jpayne@68 14953 }
jpayne@68 14954 static PyObject *
jpayne@68 14955 __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, void *context)
jpayne@68 14956 {
jpayne@68 14957 PyObject* result = (op->func_code) ? op->func_code : Py_None;
jpayne@68 14958 CYTHON_UNUSED_VAR(context);
jpayne@68 14959 Py_INCREF(result);
jpayne@68 14960 return result;
jpayne@68 14961 }
jpayne@68 14962 static int
jpayne@68 14963 __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
jpayne@68 14964 int result = 0;
jpayne@68 14965 PyObject *res = op->defaults_getter((PyObject *) op);
jpayne@68 14966 if (unlikely(!res))
jpayne@68 14967 return -1;
jpayne@68 14968 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
jpayne@68 14969 op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
jpayne@68 14970 Py_INCREF(op->defaults_tuple);
jpayne@68 14971 op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
jpayne@68 14972 Py_INCREF(op->defaults_kwdict);
jpayne@68 14973 #else
jpayne@68 14974 op->defaults_tuple = __Pyx_PySequence_ITEM(res, 0);
jpayne@68 14975 if (unlikely(!op->defaults_tuple)) result = -1;
jpayne@68 14976 else {
jpayne@68 14977 op->defaults_kwdict = __Pyx_PySequence_ITEM(res, 1);
jpayne@68 14978 if (unlikely(!op->defaults_kwdict)) result = -1;
jpayne@68 14979 }
jpayne@68 14980 #endif
jpayne@68 14981 Py_DECREF(res);
jpayne@68 14982 return result;
jpayne@68 14983 }
jpayne@68 14984 static int
jpayne@68 14985 __Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
jpayne@68 14986 CYTHON_UNUSED_VAR(context);
jpayne@68 14987 if (!value) {
jpayne@68 14988 value = Py_None;
jpayne@68 14989 } else if (unlikely(value != Py_None && !PyTuple_Check(value))) {
jpayne@68 14990 PyErr_SetString(PyExc_TypeError,
jpayne@68 14991 "__defaults__ must be set to a tuple object");
jpayne@68 14992 return -1;
jpayne@68 14993 }
jpayne@68 14994 PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__defaults__ will not "
jpayne@68 14995 "currently affect the values used in function calls", 1);
jpayne@68 14996 Py_INCREF(value);
jpayne@68 14997 __Pyx_Py_XDECREF_SET(op->defaults_tuple, value);
jpayne@68 14998 return 0;
jpayne@68 14999 }
jpayne@68 15000 static PyObject *
jpayne@68 15001 __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, void *context) {
jpayne@68 15002 PyObject* result = op->defaults_tuple;
jpayne@68 15003 CYTHON_UNUSED_VAR(context);
jpayne@68 15004 if (unlikely(!result)) {
jpayne@68 15005 if (op->defaults_getter) {
jpayne@68 15006 if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL;
jpayne@68 15007 result = op->defaults_tuple;
jpayne@68 15008 } else {
jpayne@68 15009 result = Py_None;
jpayne@68 15010 }
jpayne@68 15011 }
jpayne@68 15012 Py_INCREF(result);
jpayne@68 15013 return result;
jpayne@68 15014 }
jpayne@68 15015 static int
jpayne@68 15016 __Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
jpayne@68 15017 CYTHON_UNUSED_VAR(context);
jpayne@68 15018 if (!value) {
jpayne@68 15019 value = Py_None;
jpayne@68 15020 } else if (unlikely(value != Py_None && !PyDict_Check(value))) {
jpayne@68 15021 PyErr_SetString(PyExc_TypeError,
jpayne@68 15022 "__kwdefaults__ must be set to a dict object");
jpayne@68 15023 return -1;
jpayne@68 15024 }
jpayne@68 15025 PyErr_WarnEx(PyExc_RuntimeWarning, "changes to cyfunction.__kwdefaults__ will not "
jpayne@68 15026 "currently affect the values used in function calls", 1);
jpayne@68 15027 Py_INCREF(value);
jpayne@68 15028 __Pyx_Py_XDECREF_SET(op->defaults_kwdict, value);
jpayne@68 15029 return 0;
jpayne@68 15030 }
jpayne@68 15031 static PyObject *
jpayne@68 15032 __Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, void *context) {
jpayne@68 15033 PyObject* result = op->defaults_kwdict;
jpayne@68 15034 CYTHON_UNUSED_VAR(context);
jpayne@68 15035 if (unlikely(!result)) {
jpayne@68 15036 if (op->defaults_getter) {
jpayne@68 15037 if (unlikely(__Pyx_CyFunction_init_defaults(op) < 0)) return NULL;
jpayne@68 15038 result = op->defaults_kwdict;
jpayne@68 15039 } else {
jpayne@68 15040 result = Py_None;
jpayne@68 15041 }
jpayne@68 15042 }
jpayne@68 15043 Py_INCREF(result);
jpayne@68 15044 return result;
jpayne@68 15045 }
jpayne@68 15046 static int
jpayne@68 15047 __Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
jpayne@68 15048 CYTHON_UNUSED_VAR(context);
jpayne@68 15049 if (!value || value == Py_None) {
jpayne@68 15050 value = NULL;
jpayne@68 15051 } else if (unlikely(!PyDict_Check(value))) {
jpayne@68 15052 PyErr_SetString(PyExc_TypeError,
jpayne@68 15053 "__annotations__ must be set to a dict object");
jpayne@68 15054 return -1;
jpayne@68 15055 }
jpayne@68 15056 Py_XINCREF(value);
jpayne@68 15057 __Pyx_Py_XDECREF_SET(op->func_annotations, value);
jpayne@68 15058 return 0;
jpayne@68 15059 }
jpayne@68 15060 static PyObject *
jpayne@68 15061 __Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, void *context) {
jpayne@68 15062 PyObject* result = op->func_annotations;
jpayne@68 15063 CYTHON_UNUSED_VAR(context);
jpayne@68 15064 if (unlikely(!result)) {
jpayne@68 15065 result = PyDict_New();
jpayne@68 15066 if (unlikely(!result)) return NULL;
jpayne@68 15067 op->func_annotations = result;
jpayne@68 15068 }
jpayne@68 15069 Py_INCREF(result);
jpayne@68 15070 return result;
jpayne@68 15071 }
jpayne@68 15072 static PyObject *
jpayne@68 15073 __Pyx_CyFunction_get_is_coroutine(__pyx_CyFunctionObject *op, void *context) {
jpayne@68 15074 int is_coroutine;
jpayne@68 15075 CYTHON_UNUSED_VAR(context);
jpayne@68 15076 if (op->func_is_coroutine) {
jpayne@68 15077 return __Pyx_NewRef(op->func_is_coroutine);
jpayne@68 15078 }
jpayne@68 15079 is_coroutine = op->flags & __Pyx_CYFUNCTION_COROUTINE;
jpayne@68 15080 #if PY_VERSION_HEX >= 0x03050000
jpayne@68 15081 if (is_coroutine) {
jpayne@68 15082 PyObject *module, *fromlist, *marker = __pyx_n_s_is_coroutine;
jpayne@68 15083 fromlist = PyList_New(1);
jpayne@68 15084 if (unlikely(!fromlist)) return NULL;
jpayne@68 15085 Py_INCREF(marker);
jpayne@68 15086 #if CYTHON_ASSUME_SAFE_MACROS
jpayne@68 15087 PyList_SET_ITEM(fromlist, 0, marker);
jpayne@68 15088 #else
jpayne@68 15089 if (unlikely(PyList_SetItem(fromlist, 0, marker) < 0)) {
jpayne@68 15090 Py_DECREF(marker);
jpayne@68 15091 Py_DECREF(fromlist);
jpayne@68 15092 return NULL;
jpayne@68 15093 }
jpayne@68 15094 #endif
jpayne@68 15095 module = PyImport_ImportModuleLevelObject(__pyx_n_s_asyncio_coroutines, NULL, NULL, fromlist, 0);
jpayne@68 15096 Py_DECREF(fromlist);
jpayne@68 15097 if (unlikely(!module)) goto ignore;
jpayne@68 15098 op->func_is_coroutine = __Pyx_PyObject_GetAttrStr(module, marker);
jpayne@68 15099 Py_DECREF(module);
jpayne@68 15100 if (likely(op->func_is_coroutine)) {
jpayne@68 15101 return __Pyx_NewRef(op->func_is_coroutine);
jpayne@68 15102 }
jpayne@68 15103 ignore:
jpayne@68 15104 PyErr_Clear();
jpayne@68 15105 }
jpayne@68 15106 #endif
jpayne@68 15107 op->func_is_coroutine = __Pyx_PyBool_FromLong(is_coroutine);
jpayne@68 15108 return __Pyx_NewRef(op->func_is_coroutine);
jpayne@68 15109 }
jpayne@68 15110 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 15111 static PyObject *
jpayne@68 15112 __Pyx_CyFunction_get_module(__pyx_CyFunctionObject *op, void *context) {
jpayne@68 15113 CYTHON_UNUSED_VAR(context);
jpayne@68 15114 return PyObject_GetAttrString(op->func, "__module__");
jpayne@68 15115 }
jpayne@68 15116 static int
jpayne@68 15117 __Pyx_CyFunction_set_module(__pyx_CyFunctionObject *op, PyObject* value, void *context) {
jpayne@68 15118 CYTHON_UNUSED_VAR(context);
jpayne@68 15119 return PyObject_SetAttrString(op->func, "__module__", value);
jpayne@68 15120 }
jpayne@68 15121 #endif
jpayne@68 15122 static PyGetSetDef __pyx_CyFunction_getsets[] = {
jpayne@68 15123 {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
jpayne@68 15124 {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
jpayne@68 15125 {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
jpayne@68 15126 {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
jpayne@68 15127 {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
jpayne@68 15128 {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
jpayne@68 15129 {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
jpayne@68 15130 {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
jpayne@68 15131 {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
jpayne@68 15132 {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
jpayne@68 15133 {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
jpayne@68 15134 {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
jpayne@68 15135 {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
jpayne@68 15136 {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
jpayne@68 15137 {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
jpayne@68 15138 {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
jpayne@68 15139 {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
jpayne@68 15140 {(char *) "_is_coroutine", (getter)__Pyx_CyFunction_get_is_coroutine, 0, 0, 0},
jpayne@68 15141 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 15142 {"__module__", (getter)__Pyx_CyFunction_get_module, (setter)__Pyx_CyFunction_set_module, 0, 0},
jpayne@68 15143 #endif
jpayne@68 15144 {0, 0, 0, 0, 0}
jpayne@68 15145 };
jpayne@68 15146 static PyMemberDef __pyx_CyFunction_members[] = {
jpayne@68 15147 #if !CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 15148 {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), 0, 0},
jpayne@68 15149 #endif
jpayne@68 15150 #if CYTHON_USE_TYPE_SPECS
jpayne@68 15151 {(char *) "__dictoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_dict), READONLY, 0},
jpayne@68 15152 #if CYTHON_METH_FASTCALL
jpayne@68 15153 #if CYTHON_BACKPORT_VECTORCALL
jpayne@68 15154 {(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_vectorcall), READONLY, 0},
jpayne@68 15155 #else
jpayne@68 15156 #if !CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 15157 {(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(PyCFunctionObject, vectorcall), READONLY, 0},
jpayne@68 15158 #endif
jpayne@68 15159 #endif
jpayne@68 15160 #endif
jpayne@68 15161 #if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 15162 {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_weakreflist), READONLY, 0},
jpayne@68 15163 #else
jpayne@68 15164 {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(PyCFunctionObject, m_weakreflist), READONLY, 0},
jpayne@68 15165 #endif
jpayne@68 15166 #endif
jpayne@68 15167 {0, 0, 0, 0, 0}
jpayne@68 15168 };
jpayne@68 15169 static PyObject *
jpayne@68 15170 __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, PyObject *args)
jpayne@68 15171 {
jpayne@68 15172 CYTHON_UNUSED_VAR(args);
jpayne@68 15173 #if PY_MAJOR_VERSION >= 3
jpayne@68 15174 Py_INCREF(m->func_qualname);
jpayne@68 15175 return m->func_qualname;
jpayne@68 15176 #else
jpayne@68 15177 return PyString_FromString(((PyCFunctionObject*)m)->m_ml->ml_name);
jpayne@68 15178 #endif
jpayne@68 15179 }
jpayne@68 15180 static PyMethodDef __pyx_CyFunction_methods[] = {
jpayne@68 15181 {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
jpayne@68 15182 {0, 0, 0, 0}
jpayne@68 15183 };
jpayne@68 15184 #if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 15185 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
jpayne@68 15186 #else
jpayne@68 15187 #define __Pyx_CyFunction_weakreflist(cyfunc) (((PyCFunctionObject*)cyfunc)->m_weakreflist)
jpayne@68 15188 #endif
jpayne@68 15189 static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname,
jpayne@68 15190 PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
jpayne@68 15191 #if !CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 15192 PyCFunctionObject *cf = (PyCFunctionObject*) op;
jpayne@68 15193 #endif
jpayne@68 15194 if (unlikely(op == NULL))
jpayne@68 15195 return NULL;
jpayne@68 15196 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 15197 op->func = PyCFunction_NewEx(ml, (PyObject*)op, module);
jpayne@68 15198 if (unlikely(!op->func)) return NULL;
jpayne@68 15199 #endif
jpayne@68 15200 op->flags = flags;
jpayne@68 15201 __Pyx_CyFunction_weakreflist(op) = NULL;
jpayne@68 15202 #if !CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 15203 cf->m_ml = ml;
jpayne@68 15204 cf->m_self = (PyObject *) op;
jpayne@68 15205 #endif
jpayne@68 15206 Py_XINCREF(closure);
jpayne@68 15207 op->func_closure = closure;
jpayne@68 15208 #if !CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 15209 Py_XINCREF(module);
jpayne@68 15210 cf->m_module = module;
jpayne@68 15211 #endif
jpayne@68 15212 op->func_dict = NULL;
jpayne@68 15213 op->func_name = NULL;
jpayne@68 15214 Py_INCREF(qualname);
jpayne@68 15215 op->func_qualname = qualname;
jpayne@68 15216 op->func_doc = NULL;
jpayne@68 15217 #if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 15218 op->func_classobj = NULL;
jpayne@68 15219 #else
jpayne@68 15220 ((PyCMethodObject*)op)->mm_class = NULL;
jpayne@68 15221 #endif
jpayne@68 15222 op->func_globals = globals;
jpayne@68 15223 Py_INCREF(op->func_globals);
jpayne@68 15224 Py_XINCREF(code);
jpayne@68 15225 op->func_code = code;
jpayne@68 15226 op->defaults_pyobjects = 0;
jpayne@68 15227 op->defaults_size = 0;
jpayne@68 15228 op->defaults = NULL;
jpayne@68 15229 op->defaults_tuple = NULL;
jpayne@68 15230 op->defaults_kwdict = NULL;
jpayne@68 15231 op->defaults_getter = NULL;
jpayne@68 15232 op->func_annotations = NULL;
jpayne@68 15233 op->func_is_coroutine = NULL;
jpayne@68 15234 #if CYTHON_METH_FASTCALL
jpayne@68 15235 switch (ml->ml_flags & (METH_VARARGS | METH_FASTCALL | METH_NOARGS | METH_O | METH_KEYWORDS | METH_METHOD)) {
jpayne@68 15236 case METH_NOARGS:
jpayne@68 15237 __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_NOARGS;
jpayne@68 15238 break;
jpayne@68 15239 case METH_O:
jpayne@68 15240 __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_O;
jpayne@68 15241 break;
jpayne@68 15242 case METH_METHOD | METH_FASTCALL | METH_KEYWORDS:
jpayne@68 15243 __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD;
jpayne@68 15244 break;
jpayne@68 15245 case METH_FASTCALL | METH_KEYWORDS:
jpayne@68 15246 __Pyx_CyFunction_func_vectorcall(op) = __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS;
jpayne@68 15247 break;
jpayne@68 15248 case METH_VARARGS | METH_KEYWORDS:
jpayne@68 15249 __Pyx_CyFunction_func_vectorcall(op) = NULL;
jpayne@68 15250 break;
jpayne@68 15251 default:
jpayne@68 15252 PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction");
jpayne@68 15253 Py_DECREF(op);
jpayne@68 15254 return NULL;
jpayne@68 15255 }
jpayne@68 15256 #endif
jpayne@68 15257 return (PyObject *) op;
jpayne@68 15258 }
jpayne@68 15259 static int
jpayne@68 15260 __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
jpayne@68 15261 {
jpayne@68 15262 Py_CLEAR(m->func_closure);
jpayne@68 15263 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 15264 Py_CLEAR(m->func);
jpayne@68 15265 #else
jpayne@68 15266 Py_CLEAR(((PyCFunctionObject*)m)->m_module);
jpayne@68 15267 #endif
jpayne@68 15268 Py_CLEAR(m->func_dict);
jpayne@68 15269 Py_CLEAR(m->func_name);
jpayne@68 15270 Py_CLEAR(m->func_qualname);
jpayne@68 15271 Py_CLEAR(m->func_doc);
jpayne@68 15272 Py_CLEAR(m->func_globals);
jpayne@68 15273 Py_CLEAR(m->func_code);
jpayne@68 15274 #if !CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 15275 #if PY_VERSION_HEX < 0x030900B1
jpayne@68 15276 Py_CLEAR(__Pyx_CyFunction_GetClassObj(m));
jpayne@68 15277 #else
jpayne@68 15278 {
jpayne@68 15279 PyObject *cls = (PyObject*) ((PyCMethodObject *) (m))->mm_class;
jpayne@68 15280 ((PyCMethodObject *) (m))->mm_class = NULL;
jpayne@68 15281 Py_XDECREF(cls);
jpayne@68 15282 }
jpayne@68 15283 #endif
jpayne@68 15284 #endif
jpayne@68 15285 Py_CLEAR(m->defaults_tuple);
jpayne@68 15286 Py_CLEAR(m->defaults_kwdict);
jpayne@68 15287 Py_CLEAR(m->func_annotations);
jpayne@68 15288 Py_CLEAR(m->func_is_coroutine);
jpayne@68 15289 if (m->defaults) {
jpayne@68 15290 PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
jpayne@68 15291 int i;
jpayne@68 15292 for (i = 0; i < m->defaults_pyobjects; i++)
jpayne@68 15293 Py_XDECREF(pydefaults[i]);
jpayne@68 15294 PyObject_Free(m->defaults);
jpayne@68 15295 m->defaults = NULL;
jpayne@68 15296 }
jpayne@68 15297 return 0;
jpayne@68 15298 }
jpayne@68 15299 static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
jpayne@68 15300 {
jpayne@68 15301 if (__Pyx_CyFunction_weakreflist(m) != NULL)
jpayne@68 15302 PyObject_ClearWeakRefs((PyObject *) m);
jpayne@68 15303 __Pyx_CyFunction_clear(m);
jpayne@68 15304 __Pyx_PyHeapTypeObject_GC_Del(m);
jpayne@68 15305 }
jpayne@68 15306 static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
jpayne@68 15307 {
jpayne@68 15308 PyObject_GC_UnTrack(m);
jpayne@68 15309 __Pyx__CyFunction_dealloc(m);
jpayne@68 15310 }
jpayne@68 15311 static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
jpayne@68 15312 {
jpayne@68 15313 Py_VISIT(m->func_closure);
jpayne@68 15314 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 15315 Py_VISIT(m->func);
jpayne@68 15316 #else
jpayne@68 15317 Py_VISIT(((PyCFunctionObject*)m)->m_module);
jpayne@68 15318 #endif
jpayne@68 15319 Py_VISIT(m->func_dict);
jpayne@68 15320 Py_VISIT(m->func_name);
jpayne@68 15321 Py_VISIT(m->func_qualname);
jpayne@68 15322 Py_VISIT(m->func_doc);
jpayne@68 15323 Py_VISIT(m->func_globals);
jpayne@68 15324 Py_VISIT(m->func_code);
jpayne@68 15325 #if !CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 15326 Py_VISIT(__Pyx_CyFunction_GetClassObj(m));
jpayne@68 15327 #endif
jpayne@68 15328 Py_VISIT(m->defaults_tuple);
jpayne@68 15329 Py_VISIT(m->defaults_kwdict);
jpayne@68 15330 Py_VISIT(m->func_is_coroutine);
jpayne@68 15331 if (m->defaults) {
jpayne@68 15332 PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
jpayne@68 15333 int i;
jpayne@68 15334 for (i = 0; i < m->defaults_pyobjects; i++)
jpayne@68 15335 Py_VISIT(pydefaults[i]);
jpayne@68 15336 }
jpayne@68 15337 return 0;
jpayne@68 15338 }
jpayne@68 15339 static PyObject*
jpayne@68 15340 __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
jpayne@68 15341 {
jpayne@68 15342 #if PY_MAJOR_VERSION >= 3
jpayne@68 15343 return PyUnicode_FromFormat("<cyfunction %U at %p>",
jpayne@68 15344 op->func_qualname, (void *)op);
jpayne@68 15345 #else
jpayne@68 15346 return PyString_FromFormat("<cyfunction %s at %p>",
jpayne@68 15347 PyString_AsString(op->func_qualname), (void *)op);
jpayne@68 15348 #endif
jpayne@68 15349 }
jpayne@68 15350 static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) {
jpayne@68 15351 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 15352 PyObject *f = ((__pyx_CyFunctionObject*)func)->func;
jpayne@68 15353 PyObject *py_name = NULL;
jpayne@68 15354 PyCFunction meth;
jpayne@68 15355 int flags;
jpayne@68 15356 meth = PyCFunction_GetFunction(f);
jpayne@68 15357 if (unlikely(!meth)) return NULL;
jpayne@68 15358 flags = PyCFunction_GetFlags(f);
jpayne@68 15359 if (unlikely(flags < 0)) return NULL;
jpayne@68 15360 #else
jpayne@68 15361 PyCFunctionObject* f = (PyCFunctionObject*)func;
jpayne@68 15362 PyCFunction meth = f->m_ml->ml_meth;
jpayne@68 15363 int flags = f->m_ml->ml_flags;
jpayne@68 15364 #endif
jpayne@68 15365 Py_ssize_t size;
jpayne@68 15366 switch (flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
jpayne@68 15367 case METH_VARARGS:
jpayne@68 15368 if (likely(kw == NULL || PyDict_Size(kw) == 0))
jpayne@68 15369 return (*meth)(self, arg);
jpayne@68 15370 break;
jpayne@68 15371 case METH_VARARGS | METH_KEYWORDS:
jpayne@68 15372 return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw);
jpayne@68 15373 case METH_NOARGS:
jpayne@68 15374 if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
jpayne@68 15375 #if CYTHON_ASSUME_SAFE_MACROS
jpayne@68 15376 size = PyTuple_GET_SIZE(arg);
jpayne@68 15377 #else
jpayne@68 15378 size = PyTuple_Size(arg);
jpayne@68 15379 if (unlikely(size < 0)) return NULL;
jpayne@68 15380 #endif
jpayne@68 15381 if (likely(size == 0))
jpayne@68 15382 return (*meth)(self, NULL);
jpayne@68 15383 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 15384 py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL);
jpayne@68 15385 if (!py_name) return NULL;
jpayne@68 15386 PyErr_Format(PyExc_TypeError,
jpayne@68 15387 "%.200S() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
jpayne@68 15388 py_name, size);
jpayne@68 15389 Py_DECREF(py_name);
jpayne@68 15390 #else
jpayne@68 15391 PyErr_Format(PyExc_TypeError,
jpayne@68 15392 "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
jpayne@68 15393 f->m_ml->ml_name, size);
jpayne@68 15394 #endif
jpayne@68 15395 return NULL;
jpayne@68 15396 }
jpayne@68 15397 break;
jpayne@68 15398 case METH_O:
jpayne@68 15399 if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
jpayne@68 15400 #if CYTHON_ASSUME_SAFE_MACROS
jpayne@68 15401 size = PyTuple_GET_SIZE(arg);
jpayne@68 15402 #else
jpayne@68 15403 size = PyTuple_Size(arg);
jpayne@68 15404 if (unlikely(size < 0)) return NULL;
jpayne@68 15405 #endif
jpayne@68 15406 if (likely(size == 1)) {
jpayne@68 15407 PyObject *result, *arg0;
jpayne@68 15408 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
jpayne@68 15409 arg0 = PyTuple_GET_ITEM(arg, 0);
jpayne@68 15410 #else
jpayne@68 15411 arg0 = __Pyx_PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL;
jpayne@68 15412 #endif
jpayne@68 15413 result = (*meth)(self, arg0);
jpayne@68 15414 #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
jpayne@68 15415 Py_DECREF(arg0);
jpayne@68 15416 #endif
jpayne@68 15417 return result;
jpayne@68 15418 }
jpayne@68 15419 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 15420 py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL);
jpayne@68 15421 if (!py_name) return NULL;
jpayne@68 15422 PyErr_Format(PyExc_TypeError,
jpayne@68 15423 "%.200S() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
jpayne@68 15424 py_name, size);
jpayne@68 15425 Py_DECREF(py_name);
jpayne@68 15426 #else
jpayne@68 15427 PyErr_Format(PyExc_TypeError,
jpayne@68 15428 "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
jpayne@68 15429 f->m_ml->ml_name, size);
jpayne@68 15430 #endif
jpayne@68 15431 return NULL;
jpayne@68 15432 }
jpayne@68 15433 break;
jpayne@68 15434 default:
jpayne@68 15435 PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction");
jpayne@68 15436 return NULL;
jpayne@68 15437 }
jpayne@68 15438 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 15439 py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL);
jpayne@68 15440 if (!py_name) return NULL;
jpayne@68 15441 PyErr_Format(PyExc_TypeError, "%.200S() takes no keyword arguments",
jpayne@68 15442 py_name);
jpayne@68 15443 Py_DECREF(py_name);
jpayne@68 15444 #else
jpayne@68 15445 PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
jpayne@68 15446 f->m_ml->ml_name);
jpayne@68 15447 #endif
jpayne@68 15448 return NULL;
jpayne@68 15449 }
jpayne@68 15450 static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
jpayne@68 15451 PyObject *self, *result;
jpayne@68 15452 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 15453 self = PyCFunction_GetSelf(((__pyx_CyFunctionObject*)func)->func);
jpayne@68 15454 if (unlikely(!self) && PyErr_Occurred()) return NULL;
jpayne@68 15455 #else
jpayne@68 15456 self = ((PyCFunctionObject*)func)->m_self;
jpayne@68 15457 #endif
jpayne@68 15458 result = __Pyx_CyFunction_CallMethod(func, self, arg, kw);
jpayne@68 15459 return result;
jpayne@68 15460 }
jpayne@68 15461 static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
jpayne@68 15462 PyObject *result;
jpayne@68 15463 __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
jpayne@68 15464 #if CYTHON_METH_FASTCALL
jpayne@68 15465 __pyx_vectorcallfunc vc = __Pyx_CyFunction_func_vectorcall(cyfunc);
jpayne@68 15466 if (vc) {
jpayne@68 15467 #if CYTHON_ASSUME_SAFE_MACROS
jpayne@68 15468 return __Pyx_PyVectorcall_FastCallDict(func, vc, &PyTuple_GET_ITEM(args, 0), (size_t)PyTuple_GET_SIZE(args), kw);
jpayne@68 15469 #else
jpayne@68 15470 (void) &__Pyx_PyVectorcall_FastCallDict;
jpayne@68 15471 return PyVectorcall_Call(func, args, kw);
jpayne@68 15472 #endif
jpayne@68 15473 }
jpayne@68 15474 #endif
jpayne@68 15475 if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
jpayne@68 15476 Py_ssize_t argc;
jpayne@68 15477 PyObject *new_args;
jpayne@68 15478 PyObject *self;
jpayne@68 15479 #if CYTHON_ASSUME_SAFE_MACROS
jpayne@68 15480 argc = PyTuple_GET_SIZE(args);
jpayne@68 15481 #else
jpayne@68 15482 argc = PyTuple_Size(args);
jpayne@68 15483 if (unlikely(!argc) < 0) return NULL;
jpayne@68 15484 #endif
jpayne@68 15485 new_args = PyTuple_GetSlice(args, 1, argc);
jpayne@68 15486 if (unlikely(!new_args))
jpayne@68 15487 return NULL;
jpayne@68 15488 self = PyTuple_GetItem(args, 0);
jpayne@68 15489 if (unlikely(!self)) {
jpayne@68 15490 Py_DECREF(new_args);
jpayne@68 15491 #if PY_MAJOR_VERSION > 2
jpayne@68 15492 PyErr_Format(PyExc_TypeError,
jpayne@68 15493 "unbound method %.200S() needs an argument",
jpayne@68 15494 cyfunc->func_qualname);
jpayne@68 15495 #else
jpayne@68 15496 PyErr_SetString(PyExc_TypeError,
jpayne@68 15497 "unbound method needs an argument");
jpayne@68 15498 #endif
jpayne@68 15499 return NULL;
jpayne@68 15500 }
jpayne@68 15501 result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw);
jpayne@68 15502 Py_DECREF(new_args);
jpayne@68 15503 } else {
jpayne@68 15504 result = __Pyx_CyFunction_Call(func, args, kw);
jpayne@68 15505 }
jpayne@68 15506 return result;
jpayne@68 15507 }
jpayne@68 15508 #if CYTHON_METH_FASTCALL
jpayne@68 15509 static CYTHON_INLINE int __Pyx_CyFunction_Vectorcall_CheckArgs(__pyx_CyFunctionObject *cyfunc, Py_ssize_t nargs, PyObject *kwnames)
jpayne@68 15510 {
jpayne@68 15511 int ret = 0;
jpayne@68 15512 if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
jpayne@68 15513 if (unlikely(nargs < 1)) {
jpayne@68 15514 PyErr_Format(PyExc_TypeError, "%.200s() needs an argument",
jpayne@68 15515 ((PyCFunctionObject*)cyfunc)->m_ml->ml_name);
jpayne@68 15516 return -1;
jpayne@68 15517 }
jpayne@68 15518 ret = 1;
jpayne@68 15519 }
jpayne@68 15520 if (unlikely(kwnames) && unlikely(PyTuple_GET_SIZE(kwnames))) {
jpayne@68 15521 PyErr_Format(PyExc_TypeError,
jpayne@68 15522 "%.200s() takes no keyword arguments", ((PyCFunctionObject*)cyfunc)->m_ml->ml_name);
jpayne@68 15523 return -1;
jpayne@68 15524 }
jpayne@68 15525 return ret;
jpayne@68 15526 }
jpayne@68 15527 static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
jpayne@68 15528 {
jpayne@68 15529 __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
jpayne@68 15530 PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml;
jpayne@68 15531 #if CYTHON_BACKPORT_VECTORCALL
jpayne@68 15532 Py_ssize_t nargs = (Py_ssize_t)nargsf;
jpayne@68 15533 #else
jpayne@68 15534 Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
jpayne@68 15535 #endif
jpayne@68 15536 PyObject *self;
jpayne@68 15537 switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) {
jpayne@68 15538 case 1:
jpayne@68 15539 self = args[0];
jpayne@68 15540 args += 1;
jpayne@68 15541 nargs -= 1;
jpayne@68 15542 break;
jpayne@68 15543 case 0:
jpayne@68 15544 self = ((PyCFunctionObject*)cyfunc)->m_self;
jpayne@68 15545 break;
jpayne@68 15546 default:
jpayne@68 15547 return NULL;
jpayne@68 15548 }
jpayne@68 15549 if (unlikely(nargs != 0)) {
jpayne@68 15550 PyErr_Format(PyExc_TypeError,
jpayne@68 15551 "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
jpayne@68 15552 def->ml_name, nargs);
jpayne@68 15553 return NULL;
jpayne@68 15554 }
jpayne@68 15555 return def->ml_meth(self, NULL);
jpayne@68 15556 }
jpayne@68 15557 static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
jpayne@68 15558 {
jpayne@68 15559 __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
jpayne@68 15560 PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml;
jpayne@68 15561 #if CYTHON_BACKPORT_VECTORCALL
jpayne@68 15562 Py_ssize_t nargs = (Py_ssize_t)nargsf;
jpayne@68 15563 #else
jpayne@68 15564 Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
jpayne@68 15565 #endif
jpayne@68 15566 PyObject *self;
jpayne@68 15567 switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) {
jpayne@68 15568 case 1:
jpayne@68 15569 self = args[0];
jpayne@68 15570 args += 1;
jpayne@68 15571 nargs -= 1;
jpayne@68 15572 break;
jpayne@68 15573 case 0:
jpayne@68 15574 self = ((PyCFunctionObject*)cyfunc)->m_self;
jpayne@68 15575 break;
jpayne@68 15576 default:
jpayne@68 15577 return NULL;
jpayne@68 15578 }
jpayne@68 15579 if (unlikely(nargs != 1)) {
jpayne@68 15580 PyErr_Format(PyExc_TypeError,
jpayne@68 15581 "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
jpayne@68 15582 def->ml_name, nargs);
jpayne@68 15583 return NULL;
jpayne@68 15584 }
jpayne@68 15585 return def->ml_meth(self, args[0]);
jpayne@68 15586 }
jpayne@68 15587 static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
jpayne@68 15588 {
jpayne@68 15589 __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
jpayne@68 15590 PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml;
jpayne@68 15591 #if CYTHON_BACKPORT_VECTORCALL
jpayne@68 15592 Py_ssize_t nargs = (Py_ssize_t)nargsf;
jpayne@68 15593 #else
jpayne@68 15594 Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
jpayne@68 15595 #endif
jpayne@68 15596 PyObject *self;
jpayne@68 15597 switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) {
jpayne@68 15598 case 1:
jpayne@68 15599 self = args[0];
jpayne@68 15600 args += 1;
jpayne@68 15601 nargs -= 1;
jpayne@68 15602 break;
jpayne@68 15603 case 0:
jpayne@68 15604 self = ((PyCFunctionObject*)cyfunc)->m_self;
jpayne@68 15605 break;
jpayne@68 15606 default:
jpayne@68 15607 return NULL;
jpayne@68 15608 }
jpayne@68 15609 return ((__Pyx_PyCFunctionFastWithKeywords)(void(*)(void))def->ml_meth)(self, args, nargs, kwnames);
jpayne@68 15610 }
jpayne@68 15611 static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames)
jpayne@68 15612 {
jpayne@68 15613 __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *)func;
jpayne@68 15614 PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml;
jpayne@68 15615 PyTypeObject *cls = (PyTypeObject *) __Pyx_CyFunction_GetClassObj(cyfunc);
jpayne@68 15616 #if CYTHON_BACKPORT_VECTORCALL
jpayne@68 15617 Py_ssize_t nargs = (Py_ssize_t)nargsf;
jpayne@68 15618 #else
jpayne@68 15619 Py_ssize_t nargs = PyVectorcall_NARGS(nargsf);
jpayne@68 15620 #endif
jpayne@68 15621 PyObject *self;
jpayne@68 15622 switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) {
jpayne@68 15623 case 1:
jpayne@68 15624 self = args[0];
jpayne@68 15625 args += 1;
jpayne@68 15626 nargs -= 1;
jpayne@68 15627 break;
jpayne@68 15628 case 0:
jpayne@68 15629 self = ((PyCFunctionObject*)cyfunc)->m_self;
jpayne@68 15630 break;
jpayne@68 15631 default:
jpayne@68 15632 return NULL;
jpayne@68 15633 }
jpayne@68 15634 return ((__Pyx_PyCMethod)(void(*)(void))def->ml_meth)(self, cls, args, (size_t)nargs, kwnames);
jpayne@68 15635 }
jpayne@68 15636 #endif
jpayne@68 15637 #if CYTHON_USE_TYPE_SPECS
jpayne@68 15638 static PyType_Slot __pyx_CyFunctionType_slots[] = {
jpayne@68 15639 {Py_tp_dealloc, (void *)__Pyx_CyFunction_dealloc},
jpayne@68 15640 {Py_tp_repr, (void *)__Pyx_CyFunction_repr},
jpayne@68 15641 {Py_tp_call, (void *)__Pyx_CyFunction_CallAsMethod},
jpayne@68 15642 {Py_tp_traverse, (void *)__Pyx_CyFunction_traverse},
jpayne@68 15643 {Py_tp_clear, (void *)__Pyx_CyFunction_clear},
jpayne@68 15644 {Py_tp_methods, (void *)__pyx_CyFunction_methods},
jpayne@68 15645 {Py_tp_members, (void *)__pyx_CyFunction_members},
jpayne@68 15646 {Py_tp_getset, (void *)__pyx_CyFunction_getsets},
jpayne@68 15647 {Py_tp_descr_get, (void *)__Pyx_PyMethod_New},
jpayne@68 15648 {0, 0},
jpayne@68 15649 };
jpayne@68 15650 static PyType_Spec __pyx_CyFunctionType_spec = {
jpayne@68 15651 __PYX_TYPE_MODULE_PREFIX "cython_function_or_method",
jpayne@68 15652 sizeof(__pyx_CyFunctionObject),
jpayne@68 15653 0,
jpayne@68 15654 #ifdef Py_TPFLAGS_METHOD_DESCRIPTOR
jpayne@68 15655 Py_TPFLAGS_METHOD_DESCRIPTOR |
jpayne@68 15656 #endif
jpayne@68 15657 #if (defined(_Py_TPFLAGS_HAVE_VECTORCALL) && CYTHON_METH_FASTCALL)
jpayne@68 15658 _Py_TPFLAGS_HAVE_VECTORCALL |
jpayne@68 15659 #endif
jpayne@68 15660 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE,
jpayne@68 15661 __pyx_CyFunctionType_slots
jpayne@68 15662 };
jpayne@68 15663 #else
jpayne@68 15664 static PyTypeObject __pyx_CyFunctionType_type = {
jpayne@68 15665 PyVarObject_HEAD_INIT(0, 0)
jpayne@68 15666 __PYX_TYPE_MODULE_PREFIX "cython_function_or_method",
jpayne@68 15667 sizeof(__pyx_CyFunctionObject),
jpayne@68 15668 0,
jpayne@68 15669 (destructor) __Pyx_CyFunction_dealloc,
jpayne@68 15670 #if !CYTHON_METH_FASTCALL
jpayne@68 15671 0,
jpayne@68 15672 #elif CYTHON_BACKPORT_VECTORCALL
jpayne@68 15673 (printfunc)offsetof(__pyx_CyFunctionObject, func_vectorcall),
jpayne@68 15674 #else
jpayne@68 15675 offsetof(PyCFunctionObject, vectorcall),
jpayne@68 15676 #endif
jpayne@68 15677 0,
jpayne@68 15678 0,
jpayne@68 15679 #if PY_MAJOR_VERSION < 3
jpayne@68 15680 0,
jpayne@68 15681 #else
jpayne@68 15682 0,
jpayne@68 15683 #endif
jpayne@68 15684 (reprfunc) __Pyx_CyFunction_repr,
jpayne@68 15685 0,
jpayne@68 15686 0,
jpayne@68 15687 0,
jpayne@68 15688 0,
jpayne@68 15689 __Pyx_CyFunction_CallAsMethod,
jpayne@68 15690 0,
jpayne@68 15691 0,
jpayne@68 15692 0,
jpayne@68 15693 0,
jpayne@68 15694 #ifdef Py_TPFLAGS_METHOD_DESCRIPTOR
jpayne@68 15695 Py_TPFLAGS_METHOD_DESCRIPTOR |
jpayne@68 15696 #endif
jpayne@68 15697 #if defined(_Py_TPFLAGS_HAVE_VECTORCALL) && CYTHON_METH_FASTCALL
jpayne@68 15698 _Py_TPFLAGS_HAVE_VECTORCALL |
jpayne@68 15699 #endif
jpayne@68 15700 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE,
jpayne@68 15701 0,
jpayne@68 15702 (traverseproc) __Pyx_CyFunction_traverse,
jpayne@68 15703 (inquiry) __Pyx_CyFunction_clear,
jpayne@68 15704 0,
jpayne@68 15705 #if PY_VERSION_HEX < 0x030500A0
jpayne@68 15706 offsetof(__pyx_CyFunctionObject, func_weakreflist),
jpayne@68 15707 #else
jpayne@68 15708 offsetof(PyCFunctionObject, m_weakreflist),
jpayne@68 15709 #endif
jpayne@68 15710 0,
jpayne@68 15711 0,
jpayne@68 15712 __pyx_CyFunction_methods,
jpayne@68 15713 __pyx_CyFunction_members,
jpayne@68 15714 __pyx_CyFunction_getsets,
jpayne@68 15715 0,
jpayne@68 15716 0,
jpayne@68 15717 __Pyx_PyMethod_New,
jpayne@68 15718 0,
jpayne@68 15719 offsetof(__pyx_CyFunctionObject, func_dict),
jpayne@68 15720 0,
jpayne@68 15721 0,
jpayne@68 15722 0,
jpayne@68 15723 0,
jpayne@68 15724 0,
jpayne@68 15725 0,
jpayne@68 15726 0,
jpayne@68 15727 0,
jpayne@68 15728 0,
jpayne@68 15729 0,
jpayne@68 15730 0,
jpayne@68 15731 0,
jpayne@68 15732 #if PY_VERSION_HEX >= 0x030400a1
jpayne@68 15733 0,
jpayne@68 15734 #endif
jpayne@68 15735 #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
jpayne@68 15736 0,
jpayne@68 15737 #endif
jpayne@68 15738 #if __PYX_NEED_TP_PRINT_SLOT
jpayne@68 15739 0,
jpayne@68 15740 #endif
jpayne@68 15741 #if PY_VERSION_HEX >= 0x030C0000
jpayne@68 15742 0,
jpayne@68 15743 #endif
jpayne@68 15744 #if PY_VERSION_HEX >= 0x030d00A4
jpayne@68 15745 0,
jpayne@68 15746 #endif
jpayne@68 15747 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
jpayne@68 15748 0,
jpayne@68 15749 #endif
jpayne@68 15750 };
jpayne@68 15751 #endif
jpayne@68 15752 static int __pyx_CyFunction_init(PyObject *module) {
jpayne@68 15753 #if CYTHON_USE_TYPE_SPECS
jpayne@68 15754 __pyx_CyFunctionType = __Pyx_FetchCommonTypeFromSpec(module, &__pyx_CyFunctionType_spec, NULL);
jpayne@68 15755 #else
jpayne@68 15756 CYTHON_UNUSED_VAR(module);
jpayne@68 15757 __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
jpayne@68 15758 #endif
jpayne@68 15759 if (unlikely(__pyx_CyFunctionType == NULL)) {
jpayne@68 15760 return -1;
jpayne@68 15761 }
jpayne@68 15762 return 0;
jpayne@68 15763 }
jpayne@68 15764 static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
jpayne@68 15765 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
jpayne@68 15766 m->defaults = PyObject_Malloc(size);
jpayne@68 15767 if (unlikely(!m->defaults))
jpayne@68 15768 return PyErr_NoMemory();
jpayne@68 15769 memset(m->defaults, 0, size);
jpayne@68 15770 m->defaults_pyobjects = pyobjects;
jpayne@68 15771 m->defaults_size = size;
jpayne@68 15772 return m->defaults;
jpayne@68 15773 }
jpayne@68 15774 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
jpayne@68 15775 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
jpayne@68 15776 m->defaults_tuple = tuple;
jpayne@68 15777 Py_INCREF(tuple);
jpayne@68 15778 }
jpayne@68 15779 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
jpayne@68 15780 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
jpayne@68 15781 m->defaults_kwdict = dict;
jpayne@68 15782 Py_INCREF(dict);
jpayne@68 15783 }
jpayne@68 15784 static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
jpayne@68 15785 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
jpayne@68 15786 m->func_annotations = dict;
jpayne@68 15787 Py_INCREF(dict);
jpayne@68 15788 }
jpayne@68 15789
jpayne@68 15790 /* CythonFunction */
jpayne@68 15791 static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname,
jpayne@68 15792 PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
jpayne@68 15793 PyObject *op = __Pyx_CyFunction_Init(
jpayne@68 15794 PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType),
jpayne@68 15795 ml, flags, qualname, closure, module, globals, code
jpayne@68 15796 );
jpayne@68 15797 if (likely(op)) {
jpayne@68 15798 PyObject_GC_Track(op);
jpayne@68 15799 }
jpayne@68 15800 return op;
jpayne@68 15801 }
jpayne@68 15802
jpayne@68 15803 /* RaiseUnboundLocalError */
jpayne@68 15804 static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
jpayne@68 15805 PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
jpayne@68 15806 }
jpayne@68 15807
jpayne@68 15808 /* TypeImport */
jpayne@68 15809 #ifndef __PYX_HAVE_RT_ImportType_3_0_11
jpayne@68 15810 #define __PYX_HAVE_RT_ImportType_3_0_11
jpayne@68 15811 static PyTypeObject *__Pyx_ImportType_3_0_11(PyObject *module, const char *module_name, const char *class_name,
jpayne@68 15812 size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_11 check_size)
jpayne@68 15813 {
jpayne@68 15814 PyObject *result = 0;
jpayne@68 15815 char warning[200];
jpayne@68 15816 Py_ssize_t basicsize;
jpayne@68 15817 Py_ssize_t itemsize;
jpayne@68 15818 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 15819 PyObject *py_basicsize;
jpayne@68 15820 PyObject *py_itemsize;
jpayne@68 15821 #endif
jpayne@68 15822 result = PyObject_GetAttrString(module, class_name);
jpayne@68 15823 if (!result)
jpayne@68 15824 goto bad;
jpayne@68 15825 if (!PyType_Check(result)) {
jpayne@68 15826 PyErr_Format(PyExc_TypeError,
jpayne@68 15827 "%.200s.%.200s is not a type object",
jpayne@68 15828 module_name, class_name);
jpayne@68 15829 goto bad;
jpayne@68 15830 }
jpayne@68 15831 #if !CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 15832 basicsize = ((PyTypeObject *)result)->tp_basicsize;
jpayne@68 15833 itemsize = ((PyTypeObject *)result)->tp_itemsize;
jpayne@68 15834 #else
jpayne@68 15835 py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
jpayne@68 15836 if (!py_basicsize)
jpayne@68 15837 goto bad;
jpayne@68 15838 basicsize = PyLong_AsSsize_t(py_basicsize);
jpayne@68 15839 Py_DECREF(py_basicsize);
jpayne@68 15840 py_basicsize = 0;
jpayne@68 15841 if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
jpayne@68 15842 goto bad;
jpayne@68 15843 py_itemsize = PyObject_GetAttrString(result, "__itemsize__");
jpayne@68 15844 if (!py_itemsize)
jpayne@68 15845 goto bad;
jpayne@68 15846 itemsize = PyLong_AsSsize_t(py_itemsize);
jpayne@68 15847 Py_DECREF(py_itemsize);
jpayne@68 15848 py_itemsize = 0;
jpayne@68 15849 if (itemsize == (Py_ssize_t)-1 && PyErr_Occurred())
jpayne@68 15850 goto bad;
jpayne@68 15851 #endif
jpayne@68 15852 if (itemsize) {
jpayne@68 15853 if (size % alignment) {
jpayne@68 15854 alignment = size % alignment;
jpayne@68 15855 }
jpayne@68 15856 if (itemsize < (Py_ssize_t)alignment)
jpayne@68 15857 itemsize = (Py_ssize_t)alignment;
jpayne@68 15858 }
jpayne@68 15859 if ((size_t)(basicsize + itemsize) < size) {
jpayne@68 15860 PyErr_Format(PyExc_ValueError,
jpayne@68 15861 "%.200s.%.200s size changed, may indicate binary incompatibility. "
jpayne@68 15862 "Expected %zd from C header, got %zd from PyObject",
jpayne@68 15863 module_name, class_name, size, basicsize+itemsize);
jpayne@68 15864 goto bad;
jpayne@68 15865 }
jpayne@68 15866 if (check_size == __Pyx_ImportType_CheckSize_Error_3_0_11 &&
jpayne@68 15867 ((size_t)basicsize > size || (size_t)(basicsize + itemsize) < size)) {
jpayne@68 15868 PyErr_Format(PyExc_ValueError,
jpayne@68 15869 "%.200s.%.200s size changed, may indicate binary incompatibility. "
jpayne@68 15870 "Expected %zd from C header, got %zd-%zd from PyObject",
jpayne@68 15871 module_name, class_name, size, basicsize, basicsize+itemsize);
jpayne@68 15872 goto bad;
jpayne@68 15873 }
jpayne@68 15874 else if (check_size == __Pyx_ImportType_CheckSize_Warn_3_0_11 && (size_t)basicsize > size) {
jpayne@68 15875 PyOS_snprintf(warning, sizeof(warning),
jpayne@68 15876 "%s.%s size changed, may indicate binary incompatibility. "
jpayne@68 15877 "Expected %zd from C header, got %zd from PyObject",
jpayne@68 15878 module_name, class_name, size, basicsize);
jpayne@68 15879 if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
jpayne@68 15880 }
jpayne@68 15881 return (PyTypeObject *)result;
jpayne@68 15882 bad:
jpayne@68 15883 Py_XDECREF(result);
jpayne@68 15884 return NULL;
jpayne@68 15885 }
jpayne@68 15886 #endif
jpayne@68 15887
jpayne@68 15888 /* Import */
jpayne@68 15889 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
jpayne@68 15890 PyObject *module = 0;
jpayne@68 15891 PyObject *empty_dict = 0;
jpayne@68 15892 PyObject *empty_list = 0;
jpayne@68 15893 #if PY_MAJOR_VERSION < 3
jpayne@68 15894 PyObject *py_import;
jpayne@68 15895 py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
jpayne@68 15896 if (unlikely(!py_import))
jpayne@68 15897 goto bad;
jpayne@68 15898 if (!from_list) {
jpayne@68 15899 empty_list = PyList_New(0);
jpayne@68 15900 if (unlikely(!empty_list))
jpayne@68 15901 goto bad;
jpayne@68 15902 from_list = empty_list;
jpayne@68 15903 }
jpayne@68 15904 #endif
jpayne@68 15905 empty_dict = PyDict_New();
jpayne@68 15906 if (unlikely(!empty_dict))
jpayne@68 15907 goto bad;
jpayne@68 15908 {
jpayne@68 15909 #if PY_MAJOR_VERSION >= 3
jpayne@68 15910 if (level == -1) {
jpayne@68 15911 if (strchr(__Pyx_MODULE_NAME, '.') != NULL) {
jpayne@68 15912 module = PyImport_ImportModuleLevelObject(
jpayne@68 15913 name, __pyx_d, empty_dict, from_list, 1);
jpayne@68 15914 if (unlikely(!module)) {
jpayne@68 15915 if (unlikely(!PyErr_ExceptionMatches(PyExc_ImportError)))
jpayne@68 15916 goto bad;
jpayne@68 15917 PyErr_Clear();
jpayne@68 15918 }
jpayne@68 15919 }
jpayne@68 15920 level = 0;
jpayne@68 15921 }
jpayne@68 15922 #endif
jpayne@68 15923 if (!module) {
jpayne@68 15924 #if PY_MAJOR_VERSION < 3
jpayne@68 15925 PyObject *py_level = PyInt_FromLong(level);
jpayne@68 15926 if (unlikely(!py_level))
jpayne@68 15927 goto bad;
jpayne@68 15928 module = PyObject_CallFunctionObjArgs(py_import,
jpayne@68 15929 name, __pyx_d, empty_dict, from_list, py_level, (PyObject *)NULL);
jpayne@68 15930 Py_DECREF(py_level);
jpayne@68 15931 #else
jpayne@68 15932 module = PyImport_ImportModuleLevelObject(
jpayne@68 15933 name, __pyx_d, empty_dict, from_list, level);
jpayne@68 15934 #endif
jpayne@68 15935 }
jpayne@68 15936 }
jpayne@68 15937 bad:
jpayne@68 15938 Py_XDECREF(empty_dict);
jpayne@68 15939 Py_XDECREF(empty_list);
jpayne@68 15940 #if PY_MAJOR_VERSION < 3
jpayne@68 15941 Py_XDECREF(py_import);
jpayne@68 15942 #endif
jpayne@68 15943 return module;
jpayne@68 15944 }
jpayne@68 15945
jpayne@68 15946 /* ImportDottedModule */
jpayne@68 15947 #if PY_MAJOR_VERSION >= 3
jpayne@68 15948 static PyObject *__Pyx__ImportDottedModule_Error(PyObject *name, PyObject *parts_tuple, Py_ssize_t count) {
jpayne@68 15949 PyObject *partial_name = NULL, *slice = NULL, *sep = NULL;
jpayne@68 15950 if (unlikely(PyErr_Occurred())) {
jpayne@68 15951 PyErr_Clear();
jpayne@68 15952 }
jpayne@68 15953 if (likely(PyTuple_GET_SIZE(parts_tuple) == count)) {
jpayne@68 15954 partial_name = name;
jpayne@68 15955 } else {
jpayne@68 15956 slice = PySequence_GetSlice(parts_tuple, 0, count);
jpayne@68 15957 if (unlikely(!slice))
jpayne@68 15958 goto bad;
jpayne@68 15959 sep = PyUnicode_FromStringAndSize(".", 1);
jpayne@68 15960 if (unlikely(!sep))
jpayne@68 15961 goto bad;
jpayne@68 15962 partial_name = PyUnicode_Join(sep, slice);
jpayne@68 15963 }
jpayne@68 15964 PyErr_Format(
jpayne@68 15965 #if PY_MAJOR_VERSION < 3
jpayne@68 15966 PyExc_ImportError,
jpayne@68 15967 "No module named '%s'", PyString_AS_STRING(partial_name));
jpayne@68 15968 #else
jpayne@68 15969 #if PY_VERSION_HEX >= 0x030600B1
jpayne@68 15970 PyExc_ModuleNotFoundError,
jpayne@68 15971 #else
jpayne@68 15972 PyExc_ImportError,
jpayne@68 15973 #endif
jpayne@68 15974 "No module named '%U'", partial_name);
jpayne@68 15975 #endif
jpayne@68 15976 bad:
jpayne@68 15977 Py_XDECREF(sep);
jpayne@68 15978 Py_XDECREF(slice);
jpayne@68 15979 Py_XDECREF(partial_name);
jpayne@68 15980 return NULL;
jpayne@68 15981 }
jpayne@68 15982 #endif
jpayne@68 15983 #if PY_MAJOR_VERSION >= 3
jpayne@68 15984 static PyObject *__Pyx__ImportDottedModule_Lookup(PyObject *name) {
jpayne@68 15985 PyObject *imported_module;
jpayne@68 15986 #if PY_VERSION_HEX < 0x030700A1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400)
jpayne@68 15987 PyObject *modules = PyImport_GetModuleDict();
jpayne@68 15988 if (unlikely(!modules))
jpayne@68 15989 return NULL;
jpayne@68 15990 imported_module = __Pyx_PyDict_GetItemStr(modules, name);
jpayne@68 15991 Py_XINCREF(imported_module);
jpayne@68 15992 #else
jpayne@68 15993 imported_module = PyImport_GetModule(name);
jpayne@68 15994 #endif
jpayne@68 15995 return imported_module;
jpayne@68 15996 }
jpayne@68 15997 #endif
jpayne@68 15998 #if PY_MAJOR_VERSION >= 3
jpayne@68 15999 static PyObject *__Pyx_ImportDottedModule_WalkParts(PyObject *module, PyObject *name, PyObject *parts_tuple) {
jpayne@68 16000 Py_ssize_t i, nparts;
jpayne@68 16001 nparts = PyTuple_GET_SIZE(parts_tuple);
jpayne@68 16002 for (i=1; i < nparts && module; i++) {
jpayne@68 16003 PyObject *part, *submodule;
jpayne@68 16004 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
jpayne@68 16005 part = PyTuple_GET_ITEM(parts_tuple, i);
jpayne@68 16006 #else
jpayne@68 16007 part = PySequence_ITEM(parts_tuple, i);
jpayne@68 16008 #endif
jpayne@68 16009 submodule = __Pyx_PyObject_GetAttrStrNoError(module, part);
jpayne@68 16010 #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
jpayne@68 16011 Py_DECREF(part);
jpayne@68 16012 #endif
jpayne@68 16013 Py_DECREF(module);
jpayne@68 16014 module = submodule;
jpayne@68 16015 }
jpayne@68 16016 if (unlikely(!module)) {
jpayne@68 16017 return __Pyx__ImportDottedModule_Error(name, parts_tuple, i);
jpayne@68 16018 }
jpayne@68 16019 return module;
jpayne@68 16020 }
jpayne@68 16021 #endif
jpayne@68 16022 static PyObject *__Pyx__ImportDottedModule(PyObject *name, PyObject *parts_tuple) {
jpayne@68 16023 #if PY_MAJOR_VERSION < 3
jpayne@68 16024 PyObject *module, *from_list, *star = __pyx_n_s__14;
jpayne@68 16025 CYTHON_UNUSED_VAR(parts_tuple);
jpayne@68 16026 from_list = PyList_New(1);
jpayne@68 16027 if (unlikely(!from_list))
jpayne@68 16028 return NULL;
jpayne@68 16029 Py_INCREF(star);
jpayne@68 16030 PyList_SET_ITEM(from_list, 0, star);
jpayne@68 16031 module = __Pyx_Import(name, from_list, 0);
jpayne@68 16032 Py_DECREF(from_list);
jpayne@68 16033 return module;
jpayne@68 16034 #else
jpayne@68 16035 PyObject *imported_module;
jpayne@68 16036 PyObject *module = __Pyx_Import(name, NULL, 0);
jpayne@68 16037 if (!parts_tuple || unlikely(!module))
jpayne@68 16038 return module;
jpayne@68 16039 imported_module = __Pyx__ImportDottedModule_Lookup(name);
jpayne@68 16040 if (likely(imported_module)) {
jpayne@68 16041 Py_DECREF(module);
jpayne@68 16042 return imported_module;
jpayne@68 16043 }
jpayne@68 16044 PyErr_Clear();
jpayne@68 16045 return __Pyx_ImportDottedModule_WalkParts(module, name, parts_tuple);
jpayne@68 16046 #endif
jpayne@68 16047 }
jpayne@68 16048 static PyObject *__Pyx_ImportDottedModule(PyObject *name, PyObject *parts_tuple) {
jpayne@68 16049 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030400B1
jpayne@68 16050 PyObject *module = __Pyx__ImportDottedModule_Lookup(name);
jpayne@68 16051 if (likely(module)) {
jpayne@68 16052 PyObject *spec = __Pyx_PyObject_GetAttrStrNoError(module, __pyx_n_s_spec);
jpayne@68 16053 if (likely(spec)) {
jpayne@68 16054 PyObject *unsafe = __Pyx_PyObject_GetAttrStrNoError(spec, __pyx_n_s_initializing);
jpayne@68 16055 if (likely(!unsafe || !__Pyx_PyObject_IsTrue(unsafe))) {
jpayne@68 16056 Py_DECREF(spec);
jpayne@68 16057 spec = NULL;
jpayne@68 16058 }
jpayne@68 16059 Py_XDECREF(unsafe);
jpayne@68 16060 }
jpayne@68 16061 if (likely(!spec)) {
jpayne@68 16062 PyErr_Clear();
jpayne@68 16063 return module;
jpayne@68 16064 }
jpayne@68 16065 Py_DECREF(spec);
jpayne@68 16066 Py_DECREF(module);
jpayne@68 16067 } else if (PyErr_Occurred()) {
jpayne@68 16068 PyErr_Clear();
jpayne@68 16069 }
jpayne@68 16070 #endif
jpayne@68 16071 return __Pyx__ImportDottedModule(name, parts_tuple);
jpayne@68 16072 }
jpayne@68 16073
jpayne@68 16074 /* ImportFrom */
jpayne@68 16075 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
jpayne@68 16076 PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
jpayne@68 16077 if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
jpayne@68 16078 const char* module_name_str = 0;
jpayne@68 16079 PyObject* module_name = 0;
jpayne@68 16080 PyObject* module_dot = 0;
jpayne@68 16081 PyObject* full_name = 0;
jpayne@68 16082 PyErr_Clear();
jpayne@68 16083 module_name_str = PyModule_GetName(module);
jpayne@68 16084 if (unlikely(!module_name_str)) { goto modbad; }
jpayne@68 16085 module_name = PyUnicode_FromString(module_name_str);
jpayne@68 16086 if (unlikely(!module_name)) { goto modbad; }
jpayne@68 16087 module_dot = PyUnicode_Concat(module_name, __pyx_kp_u__15);
jpayne@68 16088 if (unlikely(!module_dot)) { goto modbad; }
jpayne@68 16089 full_name = PyUnicode_Concat(module_dot, name);
jpayne@68 16090 if (unlikely(!full_name)) { goto modbad; }
jpayne@68 16091 #if PY_VERSION_HEX < 0x030700A1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400)
jpayne@68 16092 {
jpayne@68 16093 PyObject *modules = PyImport_GetModuleDict();
jpayne@68 16094 if (unlikely(!modules))
jpayne@68 16095 goto modbad;
jpayne@68 16096 value = PyObject_GetItem(modules, full_name);
jpayne@68 16097 }
jpayne@68 16098 #else
jpayne@68 16099 value = PyImport_GetModule(full_name);
jpayne@68 16100 #endif
jpayne@68 16101 modbad:
jpayne@68 16102 Py_XDECREF(full_name);
jpayne@68 16103 Py_XDECREF(module_dot);
jpayne@68 16104 Py_XDECREF(module_name);
jpayne@68 16105 }
jpayne@68 16106 if (unlikely(!value)) {
jpayne@68 16107 PyErr_Format(PyExc_ImportError,
jpayne@68 16108 #if PY_MAJOR_VERSION < 3
jpayne@68 16109 "cannot import name %.230s", PyString_AS_STRING(name));
jpayne@68 16110 #else
jpayne@68 16111 "cannot import name %S", name);
jpayne@68 16112 #endif
jpayne@68 16113 }
jpayne@68 16114 return value;
jpayne@68 16115 }
jpayne@68 16116
jpayne@68 16117 /* PyObjectCallNoArg */
jpayne@68 16118 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
jpayne@68 16119 PyObject *arg[2] = {NULL, NULL};
jpayne@68 16120 return __Pyx_PyObject_FastCall(func, arg + 1, 0 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET);
jpayne@68 16121 }
jpayne@68 16122
jpayne@68 16123 /* CLineInTraceback */
jpayne@68 16124 #ifndef CYTHON_CLINE_IN_TRACEBACK
jpayne@68 16125 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) {
jpayne@68 16126 PyObject *use_cline;
jpayne@68 16127 PyObject *ptype, *pvalue, *ptraceback;
jpayne@68 16128 #if CYTHON_COMPILING_IN_CPYTHON
jpayne@68 16129 PyObject **cython_runtime_dict;
jpayne@68 16130 #endif
jpayne@68 16131 CYTHON_MAYBE_UNUSED_VAR(tstate);
jpayne@68 16132 if (unlikely(!__pyx_cython_runtime)) {
jpayne@68 16133 return c_line;
jpayne@68 16134 }
jpayne@68 16135 __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
jpayne@68 16136 #if CYTHON_COMPILING_IN_CPYTHON
jpayne@68 16137 cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
jpayne@68 16138 if (likely(cython_runtime_dict)) {
jpayne@68 16139 __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
jpayne@68 16140 use_cline, *cython_runtime_dict,
jpayne@68 16141 __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
jpayne@68 16142 } else
jpayne@68 16143 #endif
jpayne@68 16144 {
jpayne@68 16145 PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStrNoError(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
jpayne@68 16146 if (use_cline_obj) {
jpayne@68 16147 use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
jpayne@68 16148 Py_DECREF(use_cline_obj);
jpayne@68 16149 } else {
jpayne@68 16150 PyErr_Clear();
jpayne@68 16151 use_cline = NULL;
jpayne@68 16152 }
jpayne@68 16153 }
jpayne@68 16154 if (!use_cline) {
jpayne@68 16155 c_line = 0;
jpayne@68 16156 (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
jpayne@68 16157 }
jpayne@68 16158 else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
jpayne@68 16159 c_line = 0;
jpayne@68 16160 }
jpayne@68 16161 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
jpayne@68 16162 return c_line;
jpayne@68 16163 }
jpayne@68 16164 #endif
jpayne@68 16165
jpayne@68 16166 /* CodeObjectCache */
jpayne@68 16167 #if !CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 16168 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
jpayne@68 16169 int start = 0, mid = 0, end = count - 1;
jpayne@68 16170 if (end >= 0 && code_line > entries[end].code_line) {
jpayne@68 16171 return count;
jpayne@68 16172 }
jpayne@68 16173 while (start < end) {
jpayne@68 16174 mid = start + (end - start) / 2;
jpayne@68 16175 if (code_line < entries[mid].code_line) {
jpayne@68 16176 end = mid;
jpayne@68 16177 } else if (code_line > entries[mid].code_line) {
jpayne@68 16178 start = mid + 1;
jpayne@68 16179 } else {
jpayne@68 16180 return mid;
jpayne@68 16181 }
jpayne@68 16182 }
jpayne@68 16183 if (code_line <= entries[mid].code_line) {
jpayne@68 16184 return mid;
jpayne@68 16185 } else {
jpayne@68 16186 return mid + 1;
jpayne@68 16187 }
jpayne@68 16188 }
jpayne@68 16189 static PyCodeObject *__pyx_find_code_object(int code_line) {
jpayne@68 16190 PyCodeObject* code_object;
jpayne@68 16191 int pos;
jpayne@68 16192 if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
jpayne@68 16193 return NULL;
jpayne@68 16194 }
jpayne@68 16195 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
jpayne@68 16196 if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
jpayne@68 16197 return NULL;
jpayne@68 16198 }
jpayne@68 16199 code_object = __pyx_code_cache.entries[pos].code_object;
jpayne@68 16200 Py_INCREF(code_object);
jpayne@68 16201 return code_object;
jpayne@68 16202 }
jpayne@68 16203 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
jpayne@68 16204 int pos, i;
jpayne@68 16205 __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
jpayne@68 16206 if (unlikely(!code_line)) {
jpayne@68 16207 return;
jpayne@68 16208 }
jpayne@68 16209 if (unlikely(!entries)) {
jpayne@68 16210 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
jpayne@68 16211 if (likely(entries)) {
jpayne@68 16212 __pyx_code_cache.entries = entries;
jpayne@68 16213 __pyx_code_cache.max_count = 64;
jpayne@68 16214 __pyx_code_cache.count = 1;
jpayne@68 16215 entries[0].code_line = code_line;
jpayne@68 16216 entries[0].code_object = code_object;
jpayne@68 16217 Py_INCREF(code_object);
jpayne@68 16218 }
jpayne@68 16219 return;
jpayne@68 16220 }
jpayne@68 16221 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
jpayne@68 16222 if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
jpayne@68 16223 PyCodeObject* tmp = entries[pos].code_object;
jpayne@68 16224 entries[pos].code_object = code_object;
jpayne@68 16225 Py_DECREF(tmp);
jpayne@68 16226 return;
jpayne@68 16227 }
jpayne@68 16228 if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
jpayne@68 16229 int new_max = __pyx_code_cache.max_count + 64;
jpayne@68 16230 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
jpayne@68 16231 __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
jpayne@68 16232 if (unlikely(!entries)) {
jpayne@68 16233 return;
jpayne@68 16234 }
jpayne@68 16235 __pyx_code_cache.entries = entries;
jpayne@68 16236 __pyx_code_cache.max_count = new_max;
jpayne@68 16237 }
jpayne@68 16238 for (i=__pyx_code_cache.count; i>pos; i--) {
jpayne@68 16239 entries[i] = entries[i-1];
jpayne@68 16240 }
jpayne@68 16241 entries[pos].code_line = code_line;
jpayne@68 16242 entries[pos].code_object = code_object;
jpayne@68 16243 __pyx_code_cache.count++;
jpayne@68 16244 Py_INCREF(code_object);
jpayne@68 16245 }
jpayne@68 16246 #endif
jpayne@68 16247
jpayne@68 16248 /* AddTraceback */
jpayne@68 16249 #include "compile.h"
jpayne@68 16250 #include "frameobject.h"
jpayne@68 16251 #include "traceback.h"
jpayne@68 16252 #if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 16253 #ifndef Py_BUILD_CORE
jpayne@68 16254 #define Py_BUILD_CORE 1
jpayne@68 16255 #endif
jpayne@68 16256 #include "internal/pycore_frame.h"
jpayne@68 16257 #endif
jpayne@68 16258 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 16259 static PyObject *__Pyx_PyCode_Replace_For_AddTraceback(PyObject *code, PyObject *scratch_dict,
jpayne@68 16260 PyObject *firstlineno, PyObject *name) {
jpayne@68 16261 PyObject *replace = NULL;
jpayne@68 16262 if (unlikely(PyDict_SetItemString(scratch_dict, "co_firstlineno", firstlineno))) return NULL;
jpayne@68 16263 if (unlikely(PyDict_SetItemString(scratch_dict, "co_name", name))) return NULL;
jpayne@68 16264 replace = PyObject_GetAttrString(code, "replace");
jpayne@68 16265 if (likely(replace)) {
jpayne@68 16266 PyObject *result;
jpayne@68 16267 result = PyObject_Call(replace, __pyx_empty_tuple, scratch_dict);
jpayne@68 16268 Py_DECREF(replace);
jpayne@68 16269 return result;
jpayne@68 16270 }
jpayne@68 16271 PyErr_Clear();
jpayne@68 16272 #if __PYX_LIMITED_VERSION_HEX < 0x030780000
jpayne@68 16273 {
jpayne@68 16274 PyObject *compiled = NULL, *result = NULL;
jpayne@68 16275 if (unlikely(PyDict_SetItemString(scratch_dict, "code", code))) return NULL;
jpayne@68 16276 if (unlikely(PyDict_SetItemString(scratch_dict, "type", (PyObject*)(&PyType_Type)))) return NULL;
jpayne@68 16277 compiled = Py_CompileString(
jpayne@68 16278 "out = type(code)(\n"
jpayne@68 16279 " code.co_argcount, code.co_kwonlyargcount, code.co_nlocals, code.co_stacksize,\n"
jpayne@68 16280 " code.co_flags, code.co_code, code.co_consts, code.co_names,\n"
jpayne@68 16281 " code.co_varnames, code.co_filename, co_name, co_firstlineno,\n"
jpayne@68 16282 " code.co_lnotab)\n", "<dummy>", Py_file_input);
jpayne@68 16283 if (!compiled) return NULL;
jpayne@68 16284 result = PyEval_EvalCode(compiled, scratch_dict, scratch_dict);
jpayne@68 16285 Py_DECREF(compiled);
jpayne@68 16286 if (!result) PyErr_Print();
jpayne@68 16287 Py_DECREF(result);
jpayne@68 16288 result = PyDict_GetItemString(scratch_dict, "out");
jpayne@68 16289 if (result) Py_INCREF(result);
jpayne@68 16290 return result;
jpayne@68 16291 }
jpayne@68 16292 #else
jpayne@68 16293 return NULL;
jpayne@68 16294 #endif
jpayne@68 16295 }
jpayne@68 16296 static void __Pyx_AddTraceback(const char *funcname, int c_line,
jpayne@68 16297 int py_line, const char *filename) {
jpayne@68 16298 PyObject *code_object = NULL, *py_py_line = NULL, *py_funcname = NULL, *dict = NULL;
jpayne@68 16299 PyObject *replace = NULL, *getframe = NULL, *frame = NULL;
jpayne@68 16300 PyObject *exc_type, *exc_value, *exc_traceback;
jpayne@68 16301 int success = 0;
jpayne@68 16302 if (c_line) {
jpayne@68 16303 (void) __pyx_cfilenm;
jpayne@68 16304 (void) __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line);
jpayne@68 16305 }
jpayne@68 16306 PyErr_Fetch(&exc_type, &exc_value, &exc_traceback);
jpayne@68 16307 code_object = Py_CompileString("_getframe()", filename, Py_eval_input);
jpayne@68 16308 if (unlikely(!code_object)) goto bad;
jpayne@68 16309 py_py_line = PyLong_FromLong(py_line);
jpayne@68 16310 if (unlikely(!py_py_line)) goto bad;
jpayne@68 16311 py_funcname = PyUnicode_FromString(funcname);
jpayne@68 16312 if (unlikely(!py_funcname)) goto bad;
jpayne@68 16313 dict = PyDict_New();
jpayne@68 16314 if (unlikely(!dict)) goto bad;
jpayne@68 16315 {
jpayne@68 16316 PyObject *old_code_object = code_object;
jpayne@68 16317 code_object = __Pyx_PyCode_Replace_For_AddTraceback(code_object, dict, py_py_line, py_funcname);
jpayne@68 16318 Py_DECREF(old_code_object);
jpayne@68 16319 }
jpayne@68 16320 if (unlikely(!code_object)) goto bad;
jpayne@68 16321 getframe = PySys_GetObject("_getframe");
jpayne@68 16322 if (unlikely(!getframe)) goto bad;
jpayne@68 16323 if (unlikely(PyDict_SetItemString(dict, "_getframe", getframe))) goto bad;
jpayne@68 16324 frame = PyEval_EvalCode(code_object, dict, dict);
jpayne@68 16325 if (unlikely(!frame) || frame == Py_None) goto bad;
jpayne@68 16326 success = 1;
jpayne@68 16327 bad:
jpayne@68 16328 PyErr_Restore(exc_type, exc_value, exc_traceback);
jpayne@68 16329 Py_XDECREF(code_object);
jpayne@68 16330 Py_XDECREF(py_py_line);
jpayne@68 16331 Py_XDECREF(py_funcname);
jpayne@68 16332 Py_XDECREF(dict);
jpayne@68 16333 Py_XDECREF(replace);
jpayne@68 16334 if (success) {
jpayne@68 16335 PyTraceBack_Here(
jpayne@68 16336 (struct _frame*)frame);
jpayne@68 16337 }
jpayne@68 16338 Py_XDECREF(frame);
jpayne@68 16339 }
jpayne@68 16340 #else
jpayne@68 16341 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
jpayne@68 16342 const char *funcname, int c_line,
jpayne@68 16343 int py_line, const char *filename) {
jpayne@68 16344 PyCodeObject *py_code = NULL;
jpayne@68 16345 PyObject *py_funcname = NULL;
jpayne@68 16346 #if PY_MAJOR_VERSION < 3
jpayne@68 16347 PyObject *py_srcfile = NULL;
jpayne@68 16348 py_srcfile = PyString_FromString(filename);
jpayne@68 16349 if (!py_srcfile) goto bad;
jpayne@68 16350 #endif
jpayne@68 16351 if (c_line) {
jpayne@68 16352 #if PY_MAJOR_VERSION < 3
jpayne@68 16353 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
jpayne@68 16354 if (!py_funcname) goto bad;
jpayne@68 16355 #else
jpayne@68 16356 py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
jpayne@68 16357 if (!py_funcname) goto bad;
jpayne@68 16358 funcname = PyUnicode_AsUTF8(py_funcname);
jpayne@68 16359 if (!funcname) goto bad;
jpayne@68 16360 #endif
jpayne@68 16361 }
jpayne@68 16362 else {
jpayne@68 16363 #if PY_MAJOR_VERSION < 3
jpayne@68 16364 py_funcname = PyString_FromString(funcname);
jpayne@68 16365 if (!py_funcname) goto bad;
jpayne@68 16366 #endif
jpayne@68 16367 }
jpayne@68 16368 #if PY_MAJOR_VERSION < 3
jpayne@68 16369 py_code = __Pyx_PyCode_New(
jpayne@68 16370 0,
jpayne@68 16371 0,
jpayne@68 16372 0,
jpayne@68 16373 0,
jpayne@68 16374 0,
jpayne@68 16375 0,
jpayne@68 16376 __pyx_empty_bytes, /*PyObject *code,*/
jpayne@68 16377 __pyx_empty_tuple, /*PyObject *consts,*/
jpayne@68 16378 __pyx_empty_tuple, /*PyObject *names,*/
jpayne@68 16379 __pyx_empty_tuple, /*PyObject *varnames,*/
jpayne@68 16380 __pyx_empty_tuple, /*PyObject *freevars,*/
jpayne@68 16381 __pyx_empty_tuple, /*PyObject *cellvars,*/
jpayne@68 16382 py_srcfile, /*PyObject *filename,*/
jpayne@68 16383 py_funcname, /*PyObject *name,*/
jpayne@68 16384 py_line,
jpayne@68 16385 __pyx_empty_bytes /*PyObject *lnotab*/
jpayne@68 16386 );
jpayne@68 16387 Py_DECREF(py_srcfile);
jpayne@68 16388 #else
jpayne@68 16389 py_code = PyCode_NewEmpty(filename, funcname, py_line);
jpayne@68 16390 #endif
jpayne@68 16391 Py_XDECREF(py_funcname);
jpayne@68 16392 return py_code;
jpayne@68 16393 bad:
jpayne@68 16394 Py_XDECREF(py_funcname);
jpayne@68 16395 #if PY_MAJOR_VERSION < 3
jpayne@68 16396 Py_XDECREF(py_srcfile);
jpayne@68 16397 #endif
jpayne@68 16398 return NULL;
jpayne@68 16399 }
jpayne@68 16400 static void __Pyx_AddTraceback(const char *funcname, int c_line,
jpayne@68 16401 int py_line, const char *filename) {
jpayne@68 16402 PyCodeObject *py_code = 0;
jpayne@68 16403 PyFrameObject *py_frame = 0;
jpayne@68 16404 PyThreadState *tstate = __Pyx_PyThreadState_Current;
jpayne@68 16405 PyObject *ptype, *pvalue, *ptraceback;
jpayne@68 16406 if (c_line) {
jpayne@68 16407 c_line = __Pyx_CLineForTraceback(tstate, c_line);
jpayne@68 16408 }
jpayne@68 16409 py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
jpayne@68 16410 if (!py_code) {
jpayne@68 16411 __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
jpayne@68 16412 py_code = __Pyx_CreateCodeObjectForTraceback(
jpayne@68 16413 funcname, c_line, py_line, filename);
jpayne@68 16414 if (!py_code) {
jpayne@68 16415 /* If the code object creation fails, then we should clear the
jpayne@68 16416 fetched exception references and propagate the new exception */
jpayne@68 16417 Py_XDECREF(ptype);
jpayne@68 16418 Py_XDECREF(pvalue);
jpayne@68 16419 Py_XDECREF(ptraceback);
jpayne@68 16420 goto bad;
jpayne@68 16421 }
jpayne@68 16422 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
jpayne@68 16423 __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
jpayne@68 16424 }
jpayne@68 16425 py_frame = PyFrame_New(
jpayne@68 16426 tstate, /*PyThreadState *tstate,*/
jpayne@68 16427 py_code, /*PyCodeObject *code,*/
jpayne@68 16428 __pyx_d, /*PyObject *globals,*/
jpayne@68 16429 0 /*PyObject *locals*/
jpayne@68 16430 );
jpayne@68 16431 if (!py_frame) goto bad;
jpayne@68 16432 __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
jpayne@68 16433 PyTraceBack_Here(py_frame);
jpayne@68 16434 bad:
jpayne@68 16435 Py_XDECREF(py_code);
jpayne@68 16436 Py_XDECREF(py_frame);
jpayne@68 16437 }
jpayne@68 16438 #endif
jpayne@68 16439
jpayne@68 16440 /* CIntFromPyVerify */
jpayne@68 16441 #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
jpayne@68 16442 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
jpayne@68 16443 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
jpayne@68 16444 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
jpayne@68 16445 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
jpayne@68 16446 {\
jpayne@68 16447 func_type value = func_value;\
jpayne@68 16448 if (sizeof(target_type) < sizeof(func_type)) {\
jpayne@68 16449 if (unlikely(value != (func_type) (target_type) value)) {\
jpayne@68 16450 func_type zero = 0;\
jpayne@68 16451 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
jpayne@68 16452 return (target_type) -1;\
jpayne@68 16453 if (is_unsigned && unlikely(value < zero))\
jpayne@68 16454 goto raise_neg_overflow;\
jpayne@68 16455 else\
jpayne@68 16456 goto raise_overflow;\
jpayne@68 16457 }\
jpayne@68 16458 }\
jpayne@68 16459 return (target_type) value;\
jpayne@68 16460 }
jpayne@68 16461
jpayne@68 16462 /* CIntFromPy */
jpayne@68 16463 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
jpayne@68 16464 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
jpayne@68 16465 #pragma GCC diagnostic push
jpayne@68 16466 #pragma GCC diagnostic ignored "-Wconversion"
jpayne@68 16467 #endif
jpayne@68 16468 const int neg_one = (int) -1, const_zero = (int) 0;
jpayne@68 16469 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
jpayne@68 16470 #pragma GCC diagnostic pop
jpayne@68 16471 #endif
jpayne@68 16472 const int is_unsigned = neg_one > const_zero;
jpayne@68 16473 #if PY_MAJOR_VERSION < 3
jpayne@68 16474 if (likely(PyInt_Check(x))) {
jpayne@68 16475 if ((sizeof(int) < sizeof(long))) {
jpayne@68 16476 __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
jpayne@68 16477 } else {
jpayne@68 16478 long val = PyInt_AS_LONG(x);
jpayne@68 16479 if (is_unsigned && unlikely(val < 0)) {
jpayne@68 16480 goto raise_neg_overflow;
jpayne@68 16481 }
jpayne@68 16482 return (int) val;
jpayne@68 16483 }
jpayne@68 16484 }
jpayne@68 16485 #endif
jpayne@68 16486 if (unlikely(!PyLong_Check(x))) {
jpayne@68 16487 int val;
jpayne@68 16488 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
jpayne@68 16489 if (!tmp) return (int) -1;
jpayne@68 16490 val = __Pyx_PyInt_As_int(tmp);
jpayne@68 16491 Py_DECREF(tmp);
jpayne@68 16492 return val;
jpayne@68 16493 }
jpayne@68 16494 if (is_unsigned) {
jpayne@68 16495 #if CYTHON_USE_PYLONG_INTERNALS
jpayne@68 16496 if (unlikely(__Pyx_PyLong_IsNeg(x))) {
jpayne@68 16497 goto raise_neg_overflow;
jpayne@68 16498 } else if (__Pyx_PyLong_IsCompact(x)) {
jpayne@68 16499 __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
jpayne@68 16500 } else {
jpayne@68 16501 const digit* digits = __Pyx_PyLong_Digits(x);
jpayne@68 16502 assert(__Pyx_PyLong_DigitCount(x) > 1);
jpayne@68 16503 switch (__Pyx_PyLong_DigitCount(x)) {
jpayne@68 16504 case 2:
jpayne@68 16505 if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) {
jpayne@68 16506 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
jpayne@68 16507 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
jpayne@68 16508 } else if ((8 * sizeof(int) >= 2 * PyLong_SHIFT)) {
jpayne@68 16509 return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
jpayne@68 16510 }
jpayne@68 16511 }
jpayne@68 16512 break;
jpayne@68 16513 case 3:
jpayne@68 16514 if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) {
jpayne@68 16515 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
jpayne@68 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@68 16517 } else if ((8 * sizeof(int) >= 3 * PyLong_SHIFT)) {
jpayne@68 16518 return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
jpayne@68 16519 }
jpayne@68 16520 }
jpayne@68 16521 break;
jpayne@68 16522 case 4:
jpayne@68 16523 if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) {
jpayne@68 16524 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
jpayne@68 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@68 16526 } else if ((8 * sizeof(int) >= 4 * PyLong_SHIFT)) {
jpayne@68 16527 return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
jpayne@68 16528 }
jpayne@68 16529 }
jpayne@68 16530 break;
jpayne@68 16531 }
jpayne@68 16532 }
jpayne@68 16533 #endif
jpayne@68 16534 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
jpayne@68 16535 if (unlikely(Py_SIZE(x) < 0)) {
jpayne@68 16536 goto raise_neg_overflow;
jpayne@68 16537 }
jpayne@68 16538 #else
jpayne@68 16539 {
jpayne@68 16540 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
jpayne@68 16541 if (unlikely(result < 0))
jpayne@68 16542 return (int) -1;
jpayne@68 16543 if (unlikely(result == 1))
jpayne@68 16544 goto raise_neg_overflow;
jpayne@68 16545 }
jpayne@68 16546 #endif
jpayne@68 16547 if ((sizeof(int) <= sizeof(unsigned long))) {
jpayne@68 16548 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
jpayne@68 16549 #ifdef HAVE_LONG_LONG
jpayne@68 16550 } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) {
jpayne@68 16551 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
jpayne@68 16552 #endif
jpayne@68 16553 }
jpayne@68 16554 } else {
jpayne@68 16555 #if CYTHON_USE_PYLONG_INTERNALS
jpayne@68 16556 if (__Pyx_PyLong_IsCompact(x)) {
jpayne@68 16557 __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
jpayne@68 16558 } else {
jpayne@68 16559 const digit* digits = __Pyx_PyLong_Digits(x);
jpayne@68 16560 assert(__Pyx_PyLong_DigitCount(x) > 1);
jpayne@68 16561 switch (__Pyx_PyLong_SignedDigitCount(x)) {
jpayne@68 16562 case -2:
jpayne@68 16563 if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) {
jpayne@68 16564 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
jpayne@68 16565 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
jpayne@68 16566 } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
jpayne@68 16567 return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
jpayne@68 16568 }
jpayne@68 16569 }
jpayne@68 16570 break;
jpayne@68 16571 case 2:
jpayne@68 16572 if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) {
jpayne@68 16573 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
jpayne@68 16574 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
jpayne@68 16575 } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
jpayne@68 16576 return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
jpayne@68 16577 }
jpayne@68 16578 }
jpayne@68 16579 break;
jpayne@68 16580 case -3:
jpayne@68 16581 if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
jpayne@68 16582 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
jpayne@68 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@68 16584 } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
jpayne@68 16585 return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
jpayne@68 16586 }
jpayne@68 16587 }
jpayne@68 16588 break;
jpayne@68 16589 case 3:
jpayne@68 16590 if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) {
jpayne@68 16591 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
jpayne@68 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@68 16593 } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
jpayne@68 16594 return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
jpayne@68 16595 }
jpayne@68 16596 }
jpayne@68 16597 break;
jpayne@68 16598 case -4:
jpayne@68 16599 if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
jpayne@68 16600 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
jpayne@68 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@68 16602 } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) {
jpayne@68 16603 return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
jpayne@68 16604 }
jpayne@68 16605 }
jpayne@68 16606 break;
jpayne@68 16607 case 4:
jpayne@68 16608 if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) {
jpayne@68 16609 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
jpayne@68 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@68 16611 } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) {
jpayne@68 16612 return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
jpayne@68 16613 }
jpayne@68 16614 }
jpayne@68 16615 break;
jpayne@68 16616 }
jpayne@68 16617 }
jpayne@68 16618 #endif
jpayne@68 16619 if ((sizeof(int) <= sizeof(long))) {
jpayne@68 16620 __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
jpayne@68 16621 #ifdef HAVE_LONG_LONG
jpayne@68 16622 } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) {
jpayne@68 16623 __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
jpayne@68 16624 #endif
jpayne@68 16625 }
jpayne@68 16626 }
jpayne@68 16627 {
jpayne@68 16628 int val;
jpayne@68 16629 int ret = -1;
jpayne@68 16630 #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 16631 Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
jpayne@68 16632 x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
jpayne@68 16633 if (unlikely(bytes_copied == -1)) {
jpayne@68 16634 } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
jpayne@68 16635 goto raise_overflow;
jpayne@68 16636 } else {
jpayne@68 16637 ret = 0;
jpayne@68 16638 }
jpayne@68 16639 #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
jpayne@68 16640 int one = 1; int is_little = (int)*(unsigned char *)&one;
jpayne@68 16641 unsigned char *bytes = (unsigned char *)&val;
jpayne@68 16642 ret = _PyLong_AsByteArray((PyLongObject *)x,
jpayne@68 16643 bytes, sizeof(val),
jpayne@68 16644 is_little, !is_unsigned);
jpayne@68 16645 #else
jpayne@68 16646 PyObject *v;
jpayne@68 16647 PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
jpayne@68 16648 int bits, remaining_bits, is_negative = 0;
jpayne@68 16649 int chunk_size = (sizeof(long) < 8) ? 30 : 62;
jpayne@68 16650 if (likely(PyLong_CheckExact(x))) {
jpayne@68 16651 v = __Pyx_NewRef(x);
jpayne@68 16652 } else {
jpayne@68 16653 v = PyNumber_Long(x);
jpayne@68 16654 if (unlikely(!v)) return (int) -1;
jpayne@68 16655 assert(PyLong_CheckExact(v));
jpayne@68 16656 }
jpayne@68 16657 {
jpayne@68 16658 int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
jpayne@68 16659 if (unlikely(result < 0)) {
jpayne@68 16660 Py_DECREF(v);
jpayne@68 16661 return (int) -1;
jpayne@68 16662 }
jpayne@68 16663 is_negative = result == 1;
jpayne@68 16664 }
jpayne@68 16665 if (is_unsigned && unlikely(is_negative)) {
jpayne@68 16666 Py_DECREF(v);
jpayne@68 16667 goto raise_neg_overflow;
jpayne@68 16668 } else if (is_negative) {
jpayne@68 16669 stepval = PyNumber_Invert(v);
jpayne@68 16670 Py_DECREF(v);
jpayne@68 16671 if (unlikely(!stepval))
jpayne@68 16672 return (int) -1;
jpayne@68 16673 } else {
jpayne@68 16674 stepval = v;
jpayne@68 16675 }
jpayne@68 16676 v = NULL;
jpayne@68 16677 val = (int) 0;
jpayne@68 16678 mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
jpayne@68 16679 shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
jpayne@68 16680 for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) {
jpayne@68 16681 PyObject *tmp, *digit;
jpayne@68 16682 long idigit;
jpayne@68 16683 digit = PyNumber_And(stepval, mask);
jpayne@68 16684 if (unlikely(!digit)) goto done;
jpayne@68 16685 idigit = PyLong_AsLong(digit);
jpayne@68 16686 Py_DECREF(digit);
jpayne@68 16687 if (unlikely(idigit < 0)) goto done;
jpayne@68 16688 val |= ((int) idigit) << bits;
jpayne@68 16689 tmp = PyNumber_Rshift(stepval, shift);
jpayne@68 16690 if (unlikely(!tmp)) goto done;
jpayne@68 16691 Py_DECREF(stepval); stepval = tmp;
jpayne@68 16692 }
jpayne@68 16693 Py_DECREF(shift); shift = NULL;
jpayne@68 16694 Py_DECREF(mask); mask = NULL;
jpayne@68 16695 {
jpayne@68 16696 long idigit = PyLong_AsLong(stepval);
jpayne@68 16697 if (unlikely(idigit < 0)) goto done;
jpayne@68 16698 remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1);
jpayne@68 16699 if (unlikely(idigit >= (1L << remaining_bits)))
jpayne@68 16700 goto raise_overflow;
jpayne@68 16701 val |= ((int) idigit) << bits;
jpayne@68 16702 }
jpayne@68 16703 if (!is_unsigned) {
jpayne@68 16704 if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1))))
jpayne@68 16705 goto raise_overflow;
jpayne@68 16706 if (is_negative)
jpayne@68 16707 val = ~val;
jpayne@68 16708 }
jpayne@68 16709 ret = 0;
jpayne@68 16710 done:
jpayne@68 16711 Py_XDECREF(shift);
jpayne@68 16712 Py_XDECREF(mask);
jpayne@68 16713 Py_XDECREF(stepval);
jpayne@68 16714 #endif
jpayne@68 16715 if (unlikely(ret))
jpayne@68 16716 return (int) -1;
jpayne@68 16717 return val;
jpayne@68 16718 }
jpayne@68 16719 raise_overflow:
jpayne@68 16720 PyErr_SetString(PyExc_OverflowError,
jpayne@68 16721 "value too large to convert to int");
jpayne@68 16722 return (int) -1;
jpayne@68 16723 raise_neg_overflow:
jpayne@68 16724 PyErr_SetString(PyExc_OverflowError,
jpayne@68 16725 "can't convert negative value to int");
jpayne@68 16726 return (int) -1;
jpayne@68 16727 }
jpayne@68 16728
jpayne@68 16729 /* CIntFromPy */
jpayne@68 16730 static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *x) {
jpayne@68 16731 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
jpayne@68 16732 #pragma GCC diagnostic push
jpayne@68 16733 #pragma GCC diagnostic ignored "-Wconversion"
jpayne@68 16734 #endif
jpayne@68 16735 const char neg_one = (char) -1, const_zero = (char) 0;
jpayne@68 16736 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
jpayne@68 16737 #pragma GCC diagnostic pop
jpayne@68 16738 #endif
jpayne@68 16739 const int is_unsigned = neg_one > const_zero;
jpayne@68 16740 #if PY_MAJOR_VERSION < 3
jpayne@68 16741 if (likely(PyInt_Check(x))) {
jpayne@68 16742 if ((sizeof(char) < sizeof(long))) {
jpayne@68 16743 __PYX_VERIFY_RETURN_INT(char, long, PyInt_AS_LONG(x))
jpayne@68 16744 } else {
jpayne@68 16745 long val = PyInt_AS_LONG(x);
jpayne@68 16746 if (is_unsigned && unlikely(val < 0)) {
jpayne@68 16747 goto raise_neg_overflow;
jpayne@68 16748 }
jpayne@68 16749 return (char) val;
jpayne@68 16750 }
jpayne@68 16751 }
jpayne@68 16752 #endif
jpayne@68 16753 if (unlikely(!PyLong_Check(x))) {
jpayne@68 16754 char val;
jpayne@68 16755 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
jpayne@68 16756 if (!tmp) return (char) -1;
jpayne@68 16757 val = __Pyx_PyInt_As_char(tmp);
jpayne@68 16758 Py_DECREF(tmp);
jpayne@68 16759 return val;
jpayne@68 16760 }
jpayne@68 16761 if (is_unsigned) {
jpayne@68 16762 #if CYTHON_USE_PYLONG_INTERNALS
jpayne@68 16763 if (unlikely(__Pyx_PyLong_IsNeg(x))) {
jpayne@68 16764 goto raise_neg_overflow;
jpayne@68 16765 } else if (__Pyx_PyLong_IsCompact(x)) {
jpayne@68 16766 __PYX_VERIFY_RETURN_INT(char, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
jpayne@68 16767 } else {
jpayne@68 16768 const digit* digits = __Pyx_PyLong_Digits(x);
jpayne@68 16769 assert(__Pyx_PyLong_DigitCount(x) > 1);
jpayne@68 16770 switch (__Pyx_PyLong_DigitCount(x)) {
jpayne@68 16771 case 2:
jpayne@68 16772 if ((8 * sizeof(char) > 1 * PyLong_SHIFT)) {
jpayne@68 16773 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
jpayne@68 16774 __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
jpayne@68 16775 } else if ((8 * sizeof(char) >= 2 * PyLong_SHIFT)) {
jpayne@68 16776 return (char) (((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
jpayne@68 16777 }
jpayne@68 16778 }
jpayne@68 16779 break;
jpayne@68 16780 case 3:
jpayne@68 16781 if ((8 * sizeof(char) > 2 * PyLong_SHIFT)) {
jpayne@68 16782 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
jpayne@68 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@68 16784 } else if ((8 * sizeof(char) >= 3 * PyLong_SHIFT)) {
jpayne@68 16785 return (char) (((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
jpayne@68 16786 }
jpayne@68 16787 }
jpayne@68 16788 break;
jpayne@68 16789 case 4:
jpayne@68 16790 if ((8 * sizeof(char) > 3 * PyLong_SHIFT)) {
jpayne@68 16791 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
jpayne@68 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@68 16793 } else if ((8 * sizeof(char) >= 4 * PyLong_SHIFT)) {
jpayne@68 16794 return (char) (((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
jpayne@68 16795 }
jpayne@68 16796 }
jpayne@68 16797 break;
jpayne@68 16798 }
jpayne@68 16799 }
jpayne@68 16800 #endif
jpayne@68 16801 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
jpayne@68 16802 if (unlikely(Py_SIZE(x) < 0)) {
jpayne@68 16803 goto raise_neg_overflow;
jpayne@68 16804 }
jpayne@68 16805 #else
jpayne@68 16806 {
jpayne@68 16807 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
jpayne@68 16808 if (unlikely(result < 0))
jpayne@68 16809 return (char) -1;
jpayne@68 16810 if (unlikely(result == 1))
jpayne@68 16811 goto raise_neg_overflow;
jpayne@68 16812 }
jpayne@68 16813 #endif
jpayne@68 16814 if ((sizeof(char) <= sizeof(unsigned long))) {
jpayne@68 16815 __PYX_VERIFY_RETURN_INT_EXC(char, unsigned long, PyLong_AsUnsignedLong(x))
jpayne@68 16816 #ifdef HAVE_LONG_LONG
jpayne@68 16817 } else if ((sizeof(char) <= sizeof(unsigned PY_LONG_LONG))) {
jpayne@68 16818 __PYX_VERIFY_RETURN_INT_EXC(char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
jpayne@68 16819 #endif
jpayne@68 16820 }
jpayne@68 16821 } else {
jpayne@68 16822 #if CYTHON_USE_PYLONG_INTERNALS
jpayne@68 16823 if (__Pyx_PyLong_IsCompact(x)) {
jpayne@68 16824 __PYX_VERIFY_RETURN_INT(char, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
jpayne@68 16825 } else {
jpayne@68 16826 const digit* digits = __Pyx_PyLong_Digits(x);
jpayne@68 16827 assert(__Pyx_PyLong_DigitCount(x) > 1);
jpayne@68 16828 switch (__Pyx_PyLong_SignedDigitCount(x)) {
jpayne@68 16829 case -2:
jpayne@68 16830 if ((8 * sizeof(char) - 1 > 1 * PyLong_SHIFT)) {
jpayne@68 16831 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
jpayne@68 16832 __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
jpayne@68 16833 } else if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) {
jpayne@68 16834 return (char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
jpayne@68 16835 }
jpayne@68 16836 }
jpayne@68 16837 break;
jpayne@68 16838 case 2:
jpayne@68 16839 if ((8 * sizeof(char) > 1 * PyLong_SHIFT)) {
jpayne@68 16840 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
jpayne@68 16841 __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
jpayne@68 16842 } else if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) {
jpayne@68 16843 return (char) ((((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
jpayne@68 16844 }
jpayne@68 16845 }
jpayne@68 16846 break;
jpayne@68 16847 case -3:
jpayne@68 16848 if ((8 * sizeof(char) - 1 > 2 * PyLong_SHIFT)) {
jpayne@68 16849 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
jpayne@68 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@68 16851 } else if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) {
jpayne@68 16852 return (char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
jpayne@68 16853 }
jpayne@68 16854 }
jpayne@68 16855 break;
jpayne@68 16856 case 3:
jpayne@68 16857 if ((8 * sizeof(char) > 2 * PyLong_SHIFT)) {
jpayne@68 16858 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
jpayne@68 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@68 16860 } else if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) {
jpayne@68 16861 return (char) ((((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
jpayne@68 16862 }
jpayne@68 16863 }
jpayne@68 16864 break;
jpayne@68 16865 case -4:
jpayne@68 16866 if ((8 * sizeof(char) - 1 > 3 * PyLong_SHIFT)) {
jpayne@68 16867 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
jpayne@68 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@68 16869 } else if ((8 * sizeof(char) - 1 > 4 * PyLong_SHIFT)) {
jpayne@68 16870 return (char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
jpayne@68 16871 }
jpayne@68 16872 }
jpayne@68 16873 break;
jpayne@68 16874 case 4:
jpayne@68 16875 if ((8 * sizeof(char) > 3 * PyLong_SHIFT)) {
jpayne@68 16876 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
jpayne@68 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@68 16878 } else if ((8 * sizeof(char) - 1 > 4 * PyLong_SHIFT)) {
jpayne@68 16879 return (char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
jpayne@68 16880 }
jpayne@68 16881 }
jpayne@68 16882 break;
jpayne@68 16883 }
jpayne@68 16884 }
jpayne@68 16885 #endif
jpayne@68 16886 if ((sizeof(char) <= sizeof(long))) {
jpayne@68 16887 __PYX_VERIFY_RETURN_INT_EXC(char, long, PyLong_AsLong(x))
jpayne@68 16888 #ifdef HAVE_LONG_LONG
jpayne@68 16889 } else if ((sizeof(char) <= sizeof(PY_LONG_LONG))) {
jpayne@68 16890 __PYX_VERIFY_RETURN_INT_EXC(char, PY_LONG_LONG, PyLong_AsLongLong(x))
jpayne@68 16891 #endif
jpayne@68 16892 }
jpayne@68 16893 }
jpayne@68 16894 {
jpayne@68 16895 char val;
jpayne@68 16896 int ret = -1;
jpayne@68 16897 #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 16898 Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
jpayne@68 16899 x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
jpayne@68 16900 if (unlikely(bytes_copied == -1)) {
jpayne@68 16901 } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
jpayne@68 16902 goto raise_overflow;
jpayne@68 16903 } else {
jpayne@68 16904 ret = 0;
jpayne@68 16905 }
jpayne@68 16906 #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
jpayne@68 16907 int one = 1; int is_little = (int)*(unsigned char *)&one;
jpayne@68 16908 unsigned char *bytes = (unsigned char *)&val;
jpayne@68 16909 ret = _PyLong_AsByteArray((PyLongObject *)x,
jpayne@68 16910 bytes, sizeof(val),
jpayne@68 16911 is_little, !is_unsigned);
jpayne@68 16912 #else
jpayne@68 16913 PyObject *v;
jpayne@68 16914 PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
jpayne@68 16915 int bits, remaining_bits, is_negative = 0;
jpayne@68 16916 int chunk_size = (sizeof(long) < 8) ? 30 : 62;
jpayne@68 16917 if (likely(PyLong_CheckExact(x))) {
jpayne@68 16918 v = __Pyx_NewRef(x);
jpayne@68 16919 } else {
jpayne@68 16920 v = PyNumber_Long(x);
jpayne@68 16921 if (unlikely(!v)) return (char) -1;
jpayne@68 16922 assert(PyLong_CheckExact(v));
jpayne@68 16923 }
jpayne@68 16924 {
jpayne@68 16925 int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
jpayne@68 16926 if (unlikely(result < 0)) {
jpayne@68 16927 Py_DECREF(v);
jpayne@68 16928 return (char) -1;
jpayne@68 16929 }
jpayne@68 16930 is_negative = result == 1;
jpayne@68 16931 }
jpayne@68 16932 if (is_unsigned && unlikely(is_negative)) {
jpayne@68 16933 Py_DECREF(v);
jpayne@68 16934 goto raise_neg_overflow;
jpayne@68 16935 } else if (is_negative) {
jpayne@68 16936 stepval = PyNumber_Invert(v);
jpayne@68 16937 Py_DECREF(v);
jpayne@68 16938 if (unlikely(!stepval))
jpayne@68 16939 return (char) -1;
jpayne@68 16940 } else {
jpayne@68 16941 stepval = v;
jpayne@68 16942 }
jpayne@68 16943 v = NULL;
jpayne@68 16944 val = (char) 0;
jpayne@68 16945 mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
jpayne@68 16946 shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
jpayne@68 16947 for (bits = 0; bits < (int) sizeof(char) * 8 - chunk_size; bits += chunk_size) {
jpayne@68 16948 PyObject *tmp, *digit;
jpayne@68 16949 long idigit;
jpayne@68 16950 digit = PyNumber_And(stepval, mask);
jpayne@68 16951 if (unlikely(!digit)) goto done;
jpayne@68 16952 idigit = PyLong_AsLong(digit);
jpayne@68 16953 Py_DECREF(digit);
jpayne@68 16954 if (unlikely(idigit < 0)) goto done;
jpayne@68 16955 val |= ((char) idigit) << bits;
jpayne@68 16956 tmp = PyNumber_Rshift(stepval, shift);
jpayne@68 16957 if (unlikely(!tmp)) goto done;
jpayne@68 16958 Py_DECREF(stepval); stepval = tmp;
jpayne@68 16959 }
jpayne@68 16960 Py_DECREF(shift); shift = NULL;
jpayne@68 16961 Py_DECREF(mask); mask = NULL;
jpayne@68 16962 {
jpayne@68 16963 long idigit = PyLong_AsLong(stepval);
jpayne@68 16964 if (unlikely(idigit < 0)) goto done;
jpayne@68 16965 remaining_bits = ((int) sizeof(char) * 8) - bits - (is_unsigned ? 0 : 1);
jpayne@68 16966 if (unlikely(idigit >= (1L << remaining_bits)))
jpayne@68 16967 goto raise_overflow;
jpayne@68 16968 val |= ((char) idigit) << bits;
jpayne@68 16969 }
jpayne@68 16970 if (!is_unsigned) {
jpayne@68 16971 if (unlikely(val & (((char) 1) << (sizeof(char) * 8 - 1))))
jpayne@68 16972 goto raise_overflow;
jpayne@68 16973 if (is_negative)
jpayne@68 16974 val = ~val;
jpayne@68 16975 }
jpayne@68 16976 ret = 0;
jpayne@68 16977 done:
jpayne@68 16978 Py_XDECREF(shift);
jpayne@68 16979 Py_XDECREF(mask);
jpayne@68 16980 Py_XDECREF(stepval);
jpayne@68 16981 #endif
jpayne@68 16982 if (unlikely(ret))
jpayne@68 16983 return (char) -1;
jpayne@68 16984 return val;
jpayne@68 16985 }
jpayne@68 16986 raise_overflow:
jpayne@68 16987 PyErr_SetString(PyExc_OverflowError,
jpayne@68 16988 "value too large to convert to char");
jpayne@68 16989 return (char) -1;
jpayne@68 16990 raise_neg_overflow:
jpayne@68 16991 PyErr_SetString(PyExc_OverflowError,
jpayne@68 16992 "can't convert negative value to char");
jpayne@68 16993 return (char) -1;
jpayne@68 16994 }
jpayne@68 16995
jpayne@68 16996 /* CIntToPy */
jpayne@68 16997 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
jpayne@68 16998 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
jpayne@68 16999 #pragma GCC diagnostic push
jpayne@68 17000 #pragma GCC diagnostic ignored "-Wconversion"
jpayne@68 17001 #endif
jpayne@68 17002 const int neg_one = (int) -1, const_zero = (int) 0;
jpayne@68 17003 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
jpayne@68 17004 #pragma GCC diagnostic pop
jpayne@68 17005 #endif
jpayne@68 17006 const int is_unsigned = neg_one > const_zero;
jpayne@68 17007 if (is_unsigned) {
jpayne@68 17008 if (sizeof(int) < sizeof(long)) {
jpayne@68 17009 return PyInt_FromLong((long) value);
jpayne@68 17010 } else if (sizeof(int) <= sizeof(unsigned long)) {
jpayne@68 17011 return PyLong_FromUnsignedLong((unsigned long) value);
jpayne@68 17012 #ifdef HAVE_LONG_LONG
jpayne@68 17013 } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
jpayne@68 17014 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
jpayne@68 17015 #endif
jpayne@68 17016 }
jpayne@68 17017 } else {
jpayne@68 17018 if (sizeof(int) <= sizeof(long)) {
jpayne@68 17019 return PyInt_FromLong((long) value);
jpayne@68 17020 #ifdef HAVE_LONG_LONG
jpayne@68 17021 } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
jpayne@68 17022 return PyLong_FromLongLong((PY_LONG_LONG) value);
jpayne@68 17023 #endif
jpayne@68 17024 }
jpayne@68 17025 }
jpayne@68 17026 {
jpayne@68 17027 unsigned char *bytes = (unsigned char *)&value;
jpayne@68 17028 #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
jpayne@68 17029 if (is_unsigned) {
jpayne@68 17030 return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
jpayne@68 17031 } else {
jpayne@68 17032 return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
jpayne@68 17033 }
jpayne@68 17034 #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
jpayne@68 17035 int one = 1; int little = (int)*(unsigned char *)&one;
jpayne@68 17036 return _PyLong_FromByteArray(bytes, sizeof(int),
jpayne@68 17037 little, !is_unsigned);
jpayne@68 17038 #else
jpayne@68 17039 int one = 1; int little = (int)*(unsigned char *)&one;
jpayne@68 17040 PyObject *from_bytes, *result = NULL;
jpayne@68 17041 PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL;
jpayne@68 17042 from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
jpayne@68 17043 if (!from_bytes) return NULL;
jpayne@68 17044 py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(int));
jpayne@68 17045 if (!py_bytes) goto limited_bad;
jpayne@68 17046 order_str = PyUnicode_FromString(little ? "little" : "big");
jpayne@68 17047 if (!order_str) goto limited_bad;
jpayne@68 17048 arg_tuple = PyTuple_Pack(2, py_bytes, order_str);
jpayne@68 17049 if (!arg_tuple) goto limited_bad;
jpayne@68 17050 if (!is_unsigned) {
jpayne@68 17051 kwds = PyDict_New();
jpayne@68 17052 if (!kwds) goto limited_bad;
jpayne@68 17053 if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(Py_True))) goto limited_bad;
jpayne@68 17054 }
jpayne@68 17055 result = PyObject_Call(from_bytes, arg_tuple, kwds);
jpayne@68 17056 limited_bad:
jpayne@68 17057 Py_XDECREF(kwds);
jpayne@68 17058 Py_XDECREF(arg_tuple);
jpayne@68 17059 Py_XDECREF(order_str);
jpayne@68 17060 Py_XDECREF(py_bytes);
jpayne@68 17061 Py_XDECREF(from_bytes);
jpayne@68 17062 return result;
jpayne@68 17063 #endif
jpayne@68 17064 }
jpayne@68 17065 }
jpayne@68 17066
jpayne@68 17067 /* CIntFromPy */
jpayne@68 17068 static CYTHON_INLINE int32_t __Pyx_PyInt_As_int32_t(PyObject *x) {
jpayne@68 17069 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
jpayne@68 17070 #pragma GCC diagnostic push
jpayne@68 17071 #pragma GCC diagnostic ignored "-Wconversion"
jpayne@68 17072 #endif
jpayne@68 17073 const int32_t neg_one = (int32_t) -1, const_zero = (int32_t) 0;
jpayne@68 17074 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
jpayne@68 17075 #pragma GCC diagnostic pop
jpayne@68 17076 #endif
jpayne@68 17077 const int is_unsigned = neg_one > const_zero;
jpayne@68 17078 #if PY_MAJOR_VERSION < 3
jpayne@68 17079 if (likely(PyInt_Check(x))) {
jpayne@68 17080 if ((sizeof(int32_t) < sizeof(long))) {
jpayne@68 17081 __PYX_VERIFY_RETURN_INT(int32_t, long, PyInt_AS_LONG(x))
jpayne@68 17082 } else {
jpayne@68 17083 long val = PyInt_AS_LONG(x);
jpayne@68 17084 if (is_unsigned && unlikely(val < 0)) {
jpayne@68 17085 goto raise_neg_overflow;
jpayne@68 17086 }
jpayne@68 17087 return (int32_t) val;
jpayne@68 17088 }
jpayne@68 17089 }
jpayne@68 17090 #endif
jpayne@68 17091 if (unlikely(!PyLong_Check(x))) {
jpayne@68 17092 int32_t val;
jpayne@68 17093 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
jpayne@68 17094 if (!tmp) return (int32_t) -1;
jpayne@68 17095 val = __Pyx_PyInt_As_int32_t(tmp);
jpayne@68 17096 Py_DECREF(tmp);
jpayne@68 17097 return val;
jpayne@68 17098 }
jpayne@68 17099 if (is_unsigned) {
jpayne@68 17100 #if CYTHON_USE_PYLONG_INTERNALS
jpayne@68 17101 if (unlikely(__Pyx_PyLong_IsNeg(x))) {
jpayne@68 17102 goto raise_neg_overflow;
jpayne@68 17103 } else if (__Pyx_PyLong_IsCompact(x)) {
jpayne@68 17104 __PYX_VERIFY_RETURN_INT(int32_t, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
jpayne@68 17105 } else {
jpayne@68 17106 const digit* digits = __Pyx_PyLong_Digits(x);
jpayne@68 17107 assert(__Pyx_PyLong_DigitCount(x) > 1);
jpayne@68 17108 switch (__Pyx_PyLong_DigitCount(x)) {
jpayne@68 17109 case 2:
jpayne@68 17110 if ((8 * sizeof(int32_t) > 1 * PyLong_SHIFT)) {
jpayne@68 17111 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
jpayne@68 17112 __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
jpayne@68 17113 } else if ((8 * sizeof(int32_t) >= 2 * PyLong_SHIFT)) {
jpayne@68 17114 return (int32_t) (((((int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]));
jpayne@68 17115 }
jpayne@68 17116 }
jpayne@68 17117 break;
jpayne@68 17118 case 3:
jpayne@68 17119 if ((8 * sizeof(int32_t) > 2 * PyLong_SHIFT)) {
jpayne@68 17120 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
jpayne@68 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@68 17122 } else if ((8 * sizeof(int32_t) >= 3 * PyLong_SHIFT)) {
jpayne@68 17123 return (int32_t) (((((((int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0]));
jpayne@68 17124 }
jpayne@68 17125 }
jpayne@68 17126 break;
jpayne@68 17127 case 4:
jpayne@68 17128 if ((8 * sizeof(int32_t) > 3 * PyLong_SHIFT)) {
jpayne@68 17129 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
jpayne@68 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@68 17131 } else if ((8 * sizeof(int32_t) >= 4 * PyLong_SHIFT)) {
jpayne@68 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@68 17133 }
jpayne@68 17134 }
jpayne@68 17135 break;
jpayne@68 17136 }
jpayne@68 17137 }
jpayne@68 17138 #endif
jpayne@68 17139 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
jpayne@68 17140 if (unlikely(Py_SIZE(x) < 0)) {
jpayne@68 17141 goto raise_neg_overflow;
jpayne@68 17142 }
jpayne@68 17143 #else
jpayne@68 17144 {
jpayne@68 17145 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
jpayne@68 17146 if (unlikely(result < 0))
jpayne@68 17147 return (int32_t) -1;
jpayne@68 17148 if (unlikely(result == 1))
jpayne@68 17149 goto raise_neg_overflow;
jpayne@68 17150 }
jpayne@68 17151 #endif
jpayne@68 17152 if ((sizeof(int32_t) <= sizeof(unsigned long))) {
jpayne@68 17153 __PYX_VERIFY_RETURN_INT_EXC(int32_t, unsigned long, PyLong_AsUnsignedLong(x))
jpayne@68 17154 #ifdef HAVE_LONG_LONG
jpayne@68 17155 } else if ((sizeof(int32_t) <= sizeof(unsigned PY_LONG_LONG))) {
jpayne@68 17156 __PYX_VERIFY_RETURN_INT_EXC(int32_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
jpayne@68 17157 #endif
jpayne@68 17158 }
jpayne@68 17159 } else {
jpayne@68 17160 #if CYTHON_USE_PYLONG_INTERNALS
jpayne@68 17161 if (__Pyx_PyLong_IsCompact(x)) {
jpayne@68 17162 __PYX_VERIFY_RETURN_INT(int32_t, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
jpayne@68 17163 } else {
jpayne@68 17164 const digit* digits = __Pyx_PyLong_Digits(x);
jpayne@68 17165 assert(__Pyx_PyLong_DigitCount(x) > 1);
jpayne@68 17166 switch (__Pyx_PyLong_SignedDigitCount(x)) {
jpayne@68 17167 case -2:
jpayne@68 17168 if ((8 * sizeof(int32_t) - 1 > 1 * PyLong_SHIFT)) {
jpayne@68 17169 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
jpayne@68 17170 __PYX_VERIFY_RETURN_INT(int32_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
jpayne@68 17171 } else if ((8 * sizeof(int32_t) - 1 > 2 * PyLong_SHIFT)) {
jpayne@68 17172 return (int32_t) (((int32_t)-1)*(((((int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])));
jpayne@68 17173 }
jpayne@68 17174 }
jpayne@68 17175 break;
jpayne@68 17176 case 2:
jpayne@68 17177 if ((8 * sizeof(int32_t) > 1 * PyLong_SHIFT)) {
jpayne@68 17178 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
jpayne@68 17179 __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
jpayne@68 17180 } else if ((8 * sizeof(int32_t) - 1 > 2 * PyLong_SHIFT)) {
jpayne@68 17181 return (int32_t) ((((((int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])));
jpayne@68 17182 }
jpayne@68 17183 }
jpayne@68 17184 break;
jpayne@68 17185 case -3:
jpayne@68 17186 if ((8 * sizeof(int32_t) - 1 > 2 * PyLong_SHIFT)) {
jpayne@68 17187 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
jpayne@68 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@68 17189 } else if ((8 * sizeof(int32_t) - 1 > 3 * PyLong_SHIFT)) {
jpayne@68 17190 return (int32_t) (((int32_t)-1)*(((((((int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])));
jpayne@68 17191 }
jpayne@68 17192 }
jpayne@68 17193 break;
jpayne@68 17194 case 3:
jpayne@68 17195 if ((8 * sizeof(int32_t) > 2 * PyLong_SHIFT)) {
jpayne@68 17196 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
jpayne@68 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@68 17198 } else if ((8 * sizeof(int32_t) - 1 > 3 * PyLong_SHIFT)) {
jpayne@68 17199 return (int32_t) ((((((((int32_t)digits[2]) << PyLong_SHIFT) | (int32_t)digits[1]) << PyLong_SHIFT) | (int32_t)digits[0])));
jpayne@68 17200 }
jpayne@68 17201 }
jpayne@68 17202 break;
jpayne@68 17203 case -4:
jpayne@68 17204 if ((8 * sizeof(int32_t) - 1 > 3 * PyLong_SHIFT)) {
jpayne@68 17205 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
jpayne@68 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@68 17207 } else if ((8 * sizeof(int32_t) - 1 > 4 * PyLong_SHIFT)) {
jpayne@68 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@68 17209 }
jpayne@68 17210 }
jpayne@68 17211 break;
jpayne@68 17212 case 4:
jpayne@68 17213 if ((8 * sizeof(int32_t) > 3 * PyLong_SHIFT)) {
jpayne@68 17214 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
jpayne@68 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@68 17216 } else if ((8 * sizeof(int32_t) - 1 > 4 * PyLong_SHIFT)) {
jpayne@68 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@68 17218 }
jpayne@68 17219 }
jpayne@68 17220 break;
jpayne@68 17221 }
jpayne@68 17222 }
jpayne@68 17223 #endif
jpayne@68 17224 if ((sizeof(int32_t) <= sizeof(long))) {
jpayne@68 17225 __PYX_VERIFY_RETURN_INT_EXC(int32_t, long, PyLong_AsLong(x))
jpayne@68 17226 #ifdef HAVE_LONG_LONG
jpayne@68 17227 } else if ((sizeof(int32_t) <= sizeof(PY_LONG_LONG))) {
jpayne@68 17228 __PYX_VERIFY_RETURN_INT_EXC(int32_t, PY_LONG_LONG, PyLong_AsLongLong(x))
jpayne@68 17229 #endif
jpayne@68 17230 }
jpayne@68 17231 }
jpayne@68 17232 {
jpayne@68 17233 int32_t val;
jpayne@68 17234 int ret = -1;
jpayne@68 17235 #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 17236 Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
jpayne@68 17237 x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
jpayne@68 17238 if (unlikely(bytes_copied == -1)) {
jpayne@68 17239 } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
jpayne@68 17240 goto raise_overflow;
jpayne@68 17241 } else {
jpayne@68 17242 ret = 0;
jpayne@68 17243 }
jpayne@68 17244 #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
jpayne@68 17245 int one = 1; int is_little = (int)*(unsigned char *)&one;
jpayne@68 17246 unsigned char *bytes = (unsigned char *)&val;
jpayne@68 17247 ret = _PyLong_AsByteArray((PyLongObject *)x,
jpayne@68 17248 bytes, sizeof(val),
jpayne@68 17249 is_little, !is_unsigned);
jpayne@68 17250 #else
jpayne@68 17251 PyObject *v;
jpayne@68 17252 PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
jpayne@68 17253 int bits, remaining_bits, is_negative = 0;
jpayne@68 17254 int chunk_size = (sizeof(long) < 8) ? 30 : 62;
jpayne@68 17255 if (likely(PyLong_CheckExact(x))) {
jpayne@68 17256 v = __Pyx_NewRef(x);
jpayne@68 17257 } else {
jpayne@68 17258 v = PyNumber_Long(x);
jpayne@68 17259 if (unlikely(!v)) return (int32_t) -1;
jpayne@68 17260 assert(PyLong_CheckExact(v));
jpayne@68 17261 }
jpayne@68 17262 {
jpayne@68 17263 int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
jpayne@68 17264 if (unlikely(result < 0)) {
jpayne@68 17265 Py_DECREF(v);
jpayne@68 17266 return (int32_t) -1;
jpayne@68 17267 }
jpayne@68 17268 is_negative = result == 1;
jpayne@68 17269 }
jpayne@68 17270 if (is_unsigned && unlikely(is_negative)) {
jpayne@68 17271 Py_DECREF(v);
jpayne@68 17272 goto raise_neg_overflow;
jpayne@68 17273 } else if (is_negative) {
jpayne@68 17274 stepval = PyNumber_Invert(v);
jpayne@68 17275 Py_DECREF(v);
jpayne@68 17276 if (unlikely(!stepval))
jpayne@68 17277 return (int32_t) -1;
jpayne@68 17278 } else {
jpayne@68 17279 stepval = v;
jpayne@68 17280 }
jpayne@68 17281 v = NULL;
jpayne@68 17282 val = (int32_t) 0;
jpayne@68 17283 mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
jpayne@68 17284 shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
jpayne@68 17285 for (bits = 0; bits < (int) sizeof(int32_t) * 8 - chunk_size; bits += chunk_size) {
jpayne@68 17286 PyObject *tmp, *digit;
jpayne@68 17287 long idigit;
jpayne@68 17288 digit = PyNumber_And(stepval, mask);
jpayne@68 17289 if (unlikely(!digit)) goto done;
jpayne@68 17290 idigit = PyLong_AsLong(digit);
jpayne@68 17291 Py_DECREF(digit);
jpayne@68 17292 if (unlikely(idigit < 0)) goto done;
jpayne@68 17293 val |= ((int32_t) idigit) << bits;
jpayne@68 17294 tmp = PyNumber_Rshift(stepval, shift);
jpayne@68 17295 if (unlikely(!tmp)) goto done;
jpayne@68 17296 Py_DECREF(stepval); stepval = tmp;
jpayne@68 17297 }
jpayne@68 17298 Py_DECREF(shift); shift = NULL;
jpayne@68 17299 Py_DECREF(mask); mask = NULL;
jpayne@68 17300 {
jpayne@68 17301 long idigit = PyLong_AsLong(stepval);
jpayne@68 17302 if (unlikely(idigit < 0)) goto done;
jpayne@68 17303 remaining_bits = ((int) sizeof(int32_t) * 8) - bits - (is_unsigned ? 0 : 1);
jpayne@68 17304 if (unlikely(idigit >= (1L << remaining_bits)))
jpayne@68 17305 goto raise_overflow;
jpayne@68 17306 val |= ((int32_t) idigit) << bits;
jpayne@68 17307 }
jpayne@68 17308 if (!is_unsigned) {
jpayne@68 17309 if (unlikely(val & (((int32_t) 1) << (sizeof(int32_t) * 8 - 1))))
jpayne@68 17310 goto raise_overflow;
jpayne@68 17311 if (is_negative)
jpayne@68 17312 val = ~val;
jpayne@68 17313 }
jpayne@68 17314 ret = 0;
jpayne@68 17315 done:
jpayne@68 17316 Py_XDECREF(shift);
jpayne@68 17317 Py_XDECREF(mask);
jpayne@68 17318 Py_XDECREF(stepval);
jpayne@68 17319 #endif
jpayne@68 17320 if (unlikely(ret))
jpayne@68 17321 return (int32_t) -1;
jpayne@68 17322 return val;
jpayne@68 17323 }
jpayne@68 17324 raise_overflow:
jpayne@68 17325 PyErr_SetString(PyExc_OverflowError,
jpayne@68 17326 "value too large to convert to int32_t");
jpayne@68 17327 return (int32_t) -1;
jpayne@68 17328 raise_neg_overflow:
jpayne@68 17329 PyErr_SetString(PyExc_OverflowError,
jpayne@68 17330 "can't convert negative value to int32_t");
jpayne@68 17331 return (int32_t) -1;
jpayne@68 17332 }
jpayne@68 17333
jpayne@68 17334 /* CIntToPy */
jpayne@68 17335 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
jpayne@68 17336 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
jpayne@68 17337 #pragma GCC diagnostic push
jpayne@68 17338 #pragma GCC diagnostic ignored "-Wconversion"
jpayne@68 17339 #endif
jpayne@68 17340 const long neg_one = (long) -1, const_zero = (long) 0;
jpayne@68 17341 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
jpayne@68 17342 #pragma GCC diagnostic pop
jpayne@68 17343 #endif
jpayne@68 17344 const int is_unsigned = neg_one > const_zero;
jpayne@68 17345 if (is_unsigned) {
jpayne@68 17346 if (sizeof(long) < sizeof(long)) {
jpayne@68 17347 return PyInt_FromLong((long) value);
jpayne@68 17348 } else if (sizeof(long) <= sizeof(unsigned long)) {
jpayne@68 17349 return PyLong_FromUnsignedLong((unsigned long) value);
jpayne@68 17350 #ifdef HAVE_LONG_LONG
jpayne@68 17351 } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
jpayne@68 17352 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
jpayne@68 17353 #endif
jpayne@68 17354 }
jpayne@68 17355 } else {
jpayne@68 17356 if (sizeof(long) <= sizeof(long)) {
jpayne@68 17357 return PyInt_FromLong((long) value);
jpayne@68 17358 #ifdef HAVE_LONG_LONG
jpayne@68 17359 } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
jpayne@68 17360 return PyLong_FromLongLong((PY_LONG_LONG) value);
jpayne@68 17361 #endif
jpayne@68 17362 }
jpayne@68 17363 }
jpayne@68 17364 {
jpayne@68 17365 unsigned char *bytes = (unsigned char *)&value;
jpayne@68 17366 #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
jpayne@68 17367 if (is_unsigned) {
jpayne@68 17368 return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
jpayne@68 17369 } else {
jpayne@68 17370 return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
jpayne@68 17371 }
jpayne@68 17372 #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
jpayne@68 17373 int one = 1; int little = (int)*(unsigned char *)&one;
jpayne@68 17374 return _PyLong_FromByteArray(bytes, sizeof(long),
jpayne@68 17375 little, !is_unsigned);
jpayne@68 17376 #else
jpayne@68 17377 int one = 1; int little = (int)*(unsigned char *)&one;
jpayne@68 17378 PyObject *from_bytes, *result = NULL;
jpayne@68 17379 PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL;
jpayne@68 17380 from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
jpayne@68 17381 if (!from_bytes) return NULL;
jpayne@68 17382 py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(long));
jpayne@68 17383 if (!py_bytes) goto limited_bad;
jpayne@68 17384 order_str = PyUnicode_FromString(little ? "little" : "big");
jpayne@68 17385 if (!order_str) goto limited_bad;
jpayne@68 17386 arg_tuple = PyTuple_Pack(2, py_bytes, order_str);
jpayne@68 17387 if (!arg_tuple) goto limited_bad;
jpayne@68 17388 if (!is_unsigned) {
jpayne@68 17389 kwds = PyDict_New();
jpayne@68 17390 if (!kwds) goto limited_bad;
jpayne@68 17391 if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(Py_True))) goto limited_bad;
jpayne@68 17392 }
jpayne@68 17393 result = PyObject_Call(from_bytes, arg_tuple, kwds);
jpayne@68 17394 limited_bad:
jpayne@68 17395 Py_XDECREF(kwds);
jpayne@68 17396 Py_XDECREF(arg_tuple);
jpayne@68 17397 Py_XDECREF(order_str);
jpayne@68 17398 Py_XDECREF(py_bytes);
jpayne@68 17399 Py_XDECREF(from_bytes);
jpayne@68 17400 return result;
jpayne@68 17401 #endif
jpayne@68 17402 }
jpayne@68 17403 }
jpayne@68 17404
jpayne@68 17405 /* CIntToPy */
jpayne@68 17406 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int32_t(int32_t value) {
jpayne@68 17407 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
jpayne@68 17408 #pragma GCC diagnostic push
jpayne@68 17409 #pragma GCC diagnostic ignored "-Wconversion"
jpayne@68 17410 #endif
jpayne@68 17411 const int32_t neg_one = (int32_t) -1, const_zero = (int32_t) 0;
jpayne@68 17412 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
jpayne@68 17413 #pragma GCC diagnostic pop
jpayne@68 17414 #endif
jpayne@68 17415 const int is_unsigned = neg_one > const_zero;
jpayne@68 17416 if (is_unsigned) {
jpayne@68 17417 if (sizeof(int32_t) < sizeof(long)) {
jpayne@68 17418 return PyInt_FromLong((long) value);
jpayne@68 17419 } else if (sizeof(int32_t) <= sizeof(unsigned long)) {
jpayne@68 17420 return PyLong_FromUnsignedLong((unsigned long) value);
jpayne@68 17421 #ifdef HAVE_LONG_LONG
jpayne@68 17422 } else if (sizeof(int32_t) <= sizeof(unsigned PY_LONG_LONG)) {
jpayne@68 17423 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
jpayne@68 17424 #endif
jpayne@68 17425 }
jpayne@68 17426 } else {
jpayne@68 17427 if (sizeof(int32_t) <= sizeof(long)) {
jpayne@68 17428 return PyInt_FromLong((long) value);
jpayne@68 17429 #ifdef HAVE_LONG_LONG
jpayne@68 17430 } else if (sizeof(int32_t) <= sizeof(PY_LONG_LONG)) {
jpayne@68 17431 return PyLong_FromLongLong((PY_LONG_LONG) value);
jpayne@68 17432 #endif
jpayne@68 17433 }
jpayne@68 17434 }
jpayne@68 17435 {
jpayne@68 17436 unsigned char *bytes = (unsigned char *)&value;
jpayne@68 17437 #if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
jpayne@68 17438 if (is_unsigned) {
jpayne@68 17439 return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
jpayne@68 17440 } else {
jpayne@68 17441 return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
jpayne@68 17442 }
jpayne@68 17443 #elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
jpayne@68 17444 int one = 1; int little = (int)*(unsigned char *)&one;
jpayne@68 17445 return _PyLong_FromByteArray(bytes, sizeof(int32_t),
jpayne@68 17446 little, !is_unsigned);
jpayne@68 17447 #else
jpayne@68 17448 int one = 1; int little = (int)*(unsigned char *)&one;
jpayne@68 17449 PyObject *from_bytes, *result = NULL;
jpayne@68 17450 PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL;
jpayne@68 17451 from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
jpayne@68 17452 if (!from_bytes) return NULL;
jpayne@68 17453 py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(int32_t));
jpayne@68 17454 if (!py_bytes) goto limited_bad;
jpayne@68 17455 order_str = PyUnicode_FromString(little ? "little" : "big");
jpayne@68 17456 if (!order_str) goto limited_bad;
jpayne@68 17457 arg_tuple = PyTuple_Pack(2, py_bytes, order_str);
jpayne@68 17458 if (!arg_tuple) goto limited_bad;
jpayne@68 17459 if (!is_unsigned) {
jpayne@68 17460 kwds = PyDict_New();
jpayne@68 17461 if (!kwds) goto limited_bad;
jpayne@68 17462 if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(Py_True))) goto limited_bad;
jpayne@68 17463 }
jpayne@68 17464 result = PyObject_Call(from_bytes, arg_tuple, kwds);
jpayne@68 17465 limited_bad:
jpayne@68 17466 Py_XDECREF(kwds);
jpayne@68 17467 Py_XDECREF(arg_tuple);
jpayne@68 17468 Py_XDECREF(order_str);
jpayne@68 17469 Py_XDECREF(py_bytes);
jpayne@68 17470 Py_XDECREF(from_bytes);
jpayne@68 17471 return result;
jpayne@68 17472 #endif
jpayne@68 17473 }
jpayne@68 17474 }
jpayne@68 17475
jpayne@68 17476 /* FormatTypeName */
jpayne@68 17477 #if CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 17478 static __Pyx_TypeName
jpayne@68 17479 __Pyx_PyType_GetName(PyTypeObject* tp)
jpayne@68 17480 {
jpayne@68 17481 PyObject *name = __Pyx_PyObject_GetAttrStr((PyObject *)tp,
jpayne@68 17482 __pyx_n_s_name_2);
jpayne@68 17483 if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) {
jpayne@68 17484 PyErr_Clear();
jpayne@68 17485 Py_XDECREF(name);
jpayne@68 17486 name = __Pyx_NewRef(__pyx_n_s__33);
jpayne@68 17487 }
jpayne@68 17488 return name;
jpayne@68 17489 }
jpayne@68 17490 #endif
jpayne@68 17491
jpayne@68 17492 /* CIntFromPy */
jpayne@68 17493 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
jpayne@68 17494 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
jpayne@68 17495 #pragma GCC diagnostic push
jpayne@68 17496 #pragma GCC diagnostic ignored "-Wconversion"
jpayne@68 17497 #endif
jpayne@68 17498 const long neg_one = (long) -1, const_zero = (long) 0;
jpayne@68 17499 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
jpayne@68 17500 #pragma GCC diagnostic pop
jpayne@68 17501 #endif
jpayne@68 17502 const int is_unsigned = neg_one > const_zero;
jpayne@68 17503 #if PY_MAJOR_VERSION < 3
jpayne@68 17504 if (likely(PyInt_Check(x))) {
jpayne@68 17505 if ((sizeof(long) < sizeof(long))) {
jpayne@68 17506 __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
jpayne@68 17507 } else {
jpayne@68 17508 long val = PyInt_AS_LONG(x);
jpayne@68 17509 if (is_unsigned && unlikely(val < 0)) {
jpayne@68 17510 goto raise_neg_overflow;
jpayne@68 17511 }
jpayne@68 17512 return (long) val;
jpayne@68 17513 }
jpayne@68 17514 }
jpayne@68 17515 #endif
jpayne@68 17516 if (unlikely(!PyLong_Check(x))) {
jpayne@68 17517 long val;
jpayne@68 17518 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
jpayne@68 17519 if (!tmp) return (long) -1;
jpayne@68 17520 val = __Pyx_PyInt_As_long(tmp);
jpayne@68 17521 Py_DECREF(tmp);
jpayne@68 17522 return val;
jpayne@68 17523 }
jpayne@68 17524 if (is_unsigned) {
jpayne@68 17525 #if CYTHON_USE_PYLONG_INTERNALS
jpayne@68 17526 if (unlikely(__Pyx_PyLong_IsNeg(x))) {
jpayne@68 17527 goto raise_neg_overflow;
jpayne@68 17528 } else if (__Pyx_PyLong_IsCompact(x)) {
jpayne@68 17529 __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
jpayne@68 17530 } else {
jpayne@68 17531 const digit* digits = __Pyx_PyLong_Digits(x);
jpayne@68 17532 assert(__Pyx_PyLong_DigitCount(x) > 1);
jpayne@68 17533 switch (__Pyx_PyLong_DigitCount(x)) {
jpayne@68 17534 case 2:
jpayne@68 17535 if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) {
jpayne@68 17536 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
jpayne@68 17537 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
jpayne@68 17538 } else if ((8 * sizeof(long) >= 2 * PyLong_SHIFT)) {
jpayne@68 17539 return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
jpayne@68 17540 }
jpayne@68 17541 }
jpayne@68 17542 break;
jpayne@68 17543 case 3:
jpayne@68 17544 if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) {
jpayne@68 17545 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
jpayne@68 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@68 17547 } else if ((8 * sizeof(long) >= 3 * PyLong_SHIFT)) {
jpayne@68 17548 return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
jpayne@68 17549 }
jpayne@68 17550 }
jpayne@68 17551 break;
jpayne@68 17552 case 4:
jpayne@68 17553 if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) {
jpayne@68 17554 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
jpayne@68 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@68 17556 } else if ((8 * sizeof(long) >= 4 * PyLong_SHIFT)) {
jpayne@68 17557 return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
jpayne@68 17558 }
jpayne@68 17559 }
jpayne@68 17560 break;
jpayne@68 17561 }
jpayne@68 17562 }
jpayne@68 17563 #endif
jpayne@68 17564 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
jpayne@68 17565 if (unlikely(Py_SIZE(x) < 0)) {
jpayne@68 17566 goto raise_neg_overflow;
jpayne@68 17567 }
jpayne@68 17568 #else
jpayne@68 17569 {
jpayne@68 17570 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
jpayne@68 17571 if (unlikely(result < 0))
jpayne@68 17572 return (long) -1;
jpayne@68 17573 if (unlikely(result == 1))
jpayne@68 17574 goto raise_neg_overflow;
jpayne@68 17575 }
jpayne@68 17576 #endif
jpayne@68 17577 if ((sizeof(long) <= sizeof(unsigned long))) {
jpayne@68 17578 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
jpayne@68 17579 #ifdef HAVE_LONG_LONG
jpayne@68 17580 } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) {
jpayne@68 17581 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
jpayne@68 17582 #endif
jpayne@68 17583 }
jpayne@68 17584 } else {
jpayne@68 17585 #if CYTHON_USE_PYLONG_INTERNALS
jpayne@68 17586 if (__Pyx_PyLong_IsCompact(x)) {
jpayne@68 17587 __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
jpayne@68 17588 } else {
jpayne@68 17589 const digit* digits = __Pyx_PyLong_Digits(x);
jpayne@68 17590 assert(__Pyx_PyLong_DigitCount(x) > 1);
jpayne@68 17591 switch (__Pyx_PyLong_SignedDigitCount(x)) {
jpayne@68 17592 case -2:
jpayne@68 17593 if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) {
jpayne@68 17594 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
jpayne@68 17595 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
jpayne@68 17596 } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
jpayne@68 17597 return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
jpayne@68 17598 }
jpayne@68 17599 }
jpayne@68 17600 break;
jpayne@68 17601 case 2:
jpayne@68 17602 if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) {
jpayne@68 17603 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
jpayne@68 17604 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
jpayne@68 17605 } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
jpayne@68 17606 return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
jpayne@68 17607 }
jpayne@68 17608 }
jpayne@68 17609 break;
jpayne@68 17610 case -3:
jpayne@68 17611 if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
jpayne@68 17612 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
jpayne@68 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@68 17614 } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
jpayne@68 17615 return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
jpayne@68 17616 }
jpayne@68 17617 }
jpayne@68 17618 break;
jpayne@68 17619 case 3:
jpayne@68 17620 if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) {
jpayne@68 17621 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
jpayne@68 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@68 17623 } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
jpayne@68 17624 return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
jpayne@68 17625 }
jpayne@68 17626 }
jpayne@68 17627 break;
jpayne@68 17628 case -4:
jpayne@68 17629 if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
jpayne@68 17630 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
jpayne@68 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@68 17632 } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) {
jpayne@68 17633 return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
jpayne@68 17634 }
jpayne@68 17635 }
jpayne@68 17636 break;
jpayne@68 17637 case 4:
jpayne@68 17638 if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) {
jpayne@68 17639 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
jpayne@68 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@68 17641 } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) {
jpayne@68 17642 return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
jpayne@68 17643 }
jpayne@68 17644 }
jpayne@68 17645 break;
jpayne@68 17646 }
jpayne@68 17647 }
jpayne@68 17648 #endif
jpayne@68 17649 if ((sizeof(long) <= sizeof(long))) {
jpayne@68 17650 __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
jpayne@68 17651 #ifdef HAVE_LONG_LONG
jpayne@68 17652 } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) {
jpayne@68 17653 __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
jpayne@68 17654 #endif
jpayne@68 17655 }
jpayne@68 17656 }
jpayne@68 17657 {
jpayne@68 17658 long val;
jpayne@68 17659 int ret = -1;
jpayne@68 17660 #if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
jpayne@68 17661 Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
jpayne@68 17662 x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
jpayne@68 17663 if (unlikely(bytes_copied == -1)) {
jpayne@68 17664 } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
jpayne@68 17665 goto raise_overflow;
jpayne@68 17666 } else {
jpayne@68 17667 ret = 0;
jpayne@68 17668 }
jpayne@68 17669 #elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
jpayne@68 17670 int one = 1; int is_little = (int)*(unsigned char *)&one;
jpayne@68 17671 unsigned char *bytes = (unsigned char *)&val;
jpayne@68 17672 ret = _PyLong_AsByteArray((PyLongObject *)x,
jpayne@68 17673 bytes, sizeof(val),
jpayne@68 17674 is_little, !is_unsigned);
jpayne@68 17675 #else
jpayne@68 17676 PyObject *v;
jpayne@68 17677 PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
jpayne@68 17678 int bits, remaining_bits, is_negative = 0;
jpayne@68 17679 int chunk_size = (sizeof(long) < 8) ? 30 : 62;
jpayne@68 17680 if (likely(PyLong_CheckExact(x))) {
jpayne@68 17681 v = __Pyx_NewRef(x);
jpayne@68 17682 } else {
jpayne@68 17683 v = PyNumber_Long(x);
jpayne@68 17684 if (unlikely(!v)) return (long) -1;
jpayne@68 17685 assert(PyLong_CheckExact(v));
jpayne@68 17686 }
jpayne@68 17687 {
jpayne@68 17688 int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
jpayne@68 17689 if (unlikely(result < 0)) {
jpayne@68 17690 Py_DECREF(v);
jpayne@68 17691 return (long) -1;
jpayne@68 17692 }
jpayne@68 17693 is_negative = result == 1;
jpayne@68 17694 }
jpayne@68 17695 if (is_unsigned && unlikely(is_negative)) {
jpayne@68 17696 Py_DECREF(v);
jpayne@68 17697 goto raise_neg_overflow;
jpayne@68 17698 } else if (is_negative) {
jpayne@68 17699 stepval = PyNumber_Invert(v);
jpayne@68 17700 Py_DECREF(v);
jpayne@68 17701 if (unlikely(!stepval))
jpayne@68 17702 return (long) -1;
jpayne@68 17703 } else {
jpayne@68 17704 stepval = v;
jpayne@68 17705 }
jpayne@68 17706 v = NULL;
jpayne@68 17707 val = (long) 0;
jpayne@68 17708 mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
jpayne@68 17709 shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
jpayne@68 17710 for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) {
jpayne@68 17711 PyObject *tmp, *digit;
jpayne@68 17712 long idigit;
jpayne@68 17713 digit = PyNumber_And(stepval, mask);
jpayne@68 17714 if (unlikely(!digit)) goto done;
jpayne@68 17715 idigit = PyLong_AsLong(digit);
jpayne@68 17716 Py_DECREF(digit);
jpayne@68 17717 if (unlikely(idigit < 0)) goto done;
jpayne@68 17718 val |= ((long) idigit) << bits;
jpayne@68 17719 tmp = PyNumber_Rshift(stepval, shift);
jpayne@68 17720 if (unlikely(!tmp)) goto done;
jpayne@68 17721 Py_DECREF(stepval); stepval = tmp;
jpayne@68 17722 }
jpayne@68 17723 Py_DECREF(shift); shift = NULL;
jpayne@68 17724 Py_DECREF(mask); mask = NULL;
jpayne@68 17725 {
jpayne@68 17726 long idigit = PyLong_AsLong(stepval);
jpayne@68 17727 if (unlikely(idigit < 0)) goto done;
jpayne@68 17728 remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1);
jpayne@68 17729 if (unlikely(idigit >= (1L << remaining_bits)))
jpayne@68 17730 goto raise_overflow;
jpayne@68 17731 val |= ((long) idigit) << bits;
jpayne@68 17732 }
jpayne@68 17733 if (!is_unsigned) {
jpayne@68 17734 if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1))))
jpayne@68 17735 goto raise_overflow;
jpayne@68 17736 if (is_negative)
jpayne@68 17737 val = ~val;
jpayne@68 17738 }
jpayne@68 17739 ret = 0;
jpayne@68 17740 done:
jpayne@68 17741 Py_XDECREF(shift);
jpayne@68 17742 Py_XDECREF(mask);
jpayne@68 17743 Py_XDECREF(stepval);
jpayne@68 17744 #endif
jpayne@68 17745 if (unlikely(ret))
jpayne@68 17746 return (long) -1;
jpayne@68 17747 return val;
jpayne@68 17748 }
jpayne@68 17749 raise_overflow:
jpayne@68 17750 PyErr_SetString(PyExc_OverflowError,
jpayne@68 17751 "value too large to convert to long");
jpayne@68 17752 return (long) -1;
jpayne@68 17753 raise_neg_overflow:
jpayne@68 17754 PyErr_SetString(PyExc_OverflowError,
jpayne@68 17755 "can't convert negative value to long");
jpayne@68 17756 return (long) -1;
jpayne@68 17757 }
jpayne@68 17758
jpayne@68 17759 /* FastTypeChecks */
jpayne@68 17760 #if CYTHON_COMPILING_IN_CPYTHON
jpayne@68 17761 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
jpayne@68 17762 while (a) {
jpayne@68 17763 a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*);
jpayne@68 17764 if (a == b)
jpayne@68 17765 return 1;
jpayne@68 17766 }
jpayne@68 17767 return b == &PyBaseObject_Type;
jpayne@68 17768 }
jpayne@68 17769 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
jpayne@68 17770 PyObject *mro;
jpayne@68 17771 if (a == b) return 1;
jpayne@68 17772 mro = a->tp_mro;
jpayne@68 17773 if (likely(mro)) {
jpayne@68 17774 Py_ssize_t i, n;
jpayne@68 17775 n = PyTuple_GET_SIZE(mro);
jpayne@68 17776 for (i = 0; i < n; i++) {
jpayne@68 17777 if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
jpayne@68 17778 return 1;
jpayne@68 17779 }
jpayne@68 17780 return 0;
jpayne@68 17781 }
jpayne@68 17782 return __Pyx_InBases(a, b);
jpayne@68 17783 }
jpayne@68 17784 static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) {
jpayne@68 17785 PyObject *mro;
jpayne@68 17786 if (cls == a || cls == b) return 1;
jpayne@68 17787 mro = cls->tp_mro;
jpayne@68 17788 if (likely(mro)) {
jpayne@68 17789 Py_ssize_t i, n;
jpayne@68 17790 n = PyTuple_GET_SIZE(mro);
jpayne@68 17791 for (i = 0; i < n; i++) {
jpayne@68 17792 PyObject *base = PyTuple_GET_ITEM(mro, i);
jpayne@68 17793 if (base == (PyObject *)a || base == (PyObject *)b)
jpayne@68 17794 return 1;
jpayne@68 17795 }
jpayne@68 17796 return 0;
jpayne@68 17797 }
jpayne@68 17798 return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b);
jpayne@68 17799 }
jpayne@68 17800 #if PY_MAJOR_VERSION == 2
jpayne@68 17801 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
jpayne@68 17802 PyObject *exception, *value, *tb;
jpayne@68 17803 int res;
jpayne@68 17804 __Pyx_PyThreadState_declare
jpayne@68 17805 __Pyx_PyThreadState_assign
jpayne@68 17806 __Pyx_ErrFetch(&exception, &value, &tb);
jpayne@68 17807 res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
jpayne@68 17808 if (unlikely(res == -1)) {
jpayne@68 17809 PyErr_WriteUnraisable(err);
jpayne@68 17810 res = 0;
jpayne@68 17811 }
jpayne@68 17812 if (!res) {
jpayne@68 17813 res = PyObject_IsSubclass(err, exc_type2);
jpayne@68 17814 if (unlikely(res == -1)) {
jpayne@68 17815 PyErr_WriteUnraisable(err);
jpayne@68 17816 res = 0;
jpayne@68 17817 }
jpayne@68 17818 }
jpayne@68 17819 __Pyx_ErrRestore(exception, value, tb);
jpayne@68 17820 return res;
jpayne@68 17821 }
jpayne@68 17822 #else
jpayne@68 17823 static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
jpayne@68 17824 if (exc_type1) {
jpayne@68 17825 return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2);
jpayne@68 17826 } else {
jpayne@68 17827 return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
jpayne@68 17828 }
jpayne@68 17829 }
jpayne@68 17830 #endif
jpayne@68 17831 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
jpayne@68 17832 Py_ssize_t i, n;
jpayne@68 17833 assert(PyExceptionClass_Check(exc_type));
jpayne@68 17834 n = PyTuple_GET_SIZE(tuple);
jpayne@68 17835 #if PY_MAJOR_VERSION >= 3
jpayne@68 17836 for (i=0; i<n; i++) {
jpayne@68 17837 if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
jpayne@68 17838 }
jpayne@68 17839 #endif
jpayne@68 17840 for (i=0; i<n; i++) {
jpayne@68 17841 PyObject *t = PyTuple_GET_ITEM(tuple, i);
jpayne@68 17842 #if PY_MAJOR_VERSION < 3
jpayne@68 17843 if (likely(exc_type == t)) return 1;
jpayne@68 17844 #endif
jpayne@68 17845 if (likely(PyExceptionClass_Check(t))) {
jpayne@68 17846 if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
jpayne@68 17847 } else {
jpayne@68 17848 }
jpayne@68 17849 }
jpayne@68 17850 return 0;
jpayne@68 17851 }
jpayne@68 17852 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
jpayne@68 17853 if (likely(err == exc_type)) return 1;
jpayne@68 17854 if (likely(PyExceptionClass_Check(err))) {
jpayne@68 17855 if (likely(PyExceptionClass_Check(exc_type))) {
jpayne@68 17856 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
jpayne@68 17857 } else if (likely(PyTuple_Check(exc_type))) {
jpayne@68 17858 return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
jpayne@68 17859 } else {
jpayne@68 17860 }
jpayne@68 17861 }
jpayne@68 17862 return PyErr_GivenExceptionMatches(err, exc_type);
jpayne@68 17863 }
jpayne@68 17864 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
jpayne@68 17865 assert(PyExceptionClass_Check(exc_type1));
jpayne@68 17866 assert(PyExceptionClass_Check(exc_type2));
jpayne@68 17867 if (likely(err == exc_type1 || err == exc_type2)) return 1;
jpayne@68 17868 if (likely(PyExceptionClass_Check(err))) {
jpayne@68 17869 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
jpayne@68 17870 }
jpayne@68 17871 return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
jpayne@68 17872 }
jpayne@68 17873 #endif
jpayne@68 17874
jpayne@68 17875 /* CheckBinaryVersion */
jpayne@68 17876 static unsigned long __Pyx_get_runtime_version(void) {
jpayne@68 17877 #if __PYX_LIMITED_VERSION_HEX >= 0x030B00A4
jpayne@68 17878 return Py_Version & ~0xFFUL;
jpayne@68 17879 #else
jpayne@68 17880 const char* rt_version = Py_GetVersion();
jpayne@68 17881 unsigned long version = 0;
jpayne@68 17882 unsigned long factor = 0x01000000UL;
jpayne@68 17883 unsigned int digit = 0;
jpayne@68 17884 int i = 0;
jpayne@68 17885 while (factor) {
jpayne@68 17886 while ('0' <= rt_version[i] && rt_version[i] <= '9') {
jpayne@68 17887 digit = digit * 10 + (unsigned int) (rt_version[i] - '0');
jpayne@68 17888 ++i;
jpayne@68 17889 }
jpayne@68 17890 version += factor * digit;
jpayne@68 17891 if (rt_version[i] != '.')
jpayne@68 17892 break;
jpayne@68 17893 digit = 0;
jpayne@68 17894 factor >>= 8;
jpayne@68 17895 ++i;
jpayne@68 17896 }
jpayne@68 17897 return version;
jpayne@68 17898 #endif
jpayne@68 17899 }
jpayne@68 17900 static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer) {
jpayne@68 17901 const unsigned long MAJOR_MINOR = 0xFFFF0000UL;
jpayne@68 17902 if ((rt_version & MAJOR_MINOR) == (ct_version & MAJOR_MINOR))
jpayne@68 17903 return 0;
jpayne@68 17904 if (likely(allow_newer && (rt_version & MAJOR_MINOR) > (ct_version & MAJOR_MINOR)))
jpayne@68 17905 return 1;
jpayne@68 17906 {
jpayne@68 17907 char message[200];
jpayne@68 17908 PyOS_snprintf(message, sizeof(message),
jpayne@68 17909 "compile time Python version %d.%d "
jpayne@68 17910 "of module '%.100s' "
jpayne@68 17911 "%s "
jpayne@68 17912 "runtime version %d.%d",
jpayne@68 17913 (int) (ct_version >> 24), (int) ((ct_version >> 16) & 0xFF),
jpayne@68 17914 __Pyx_MODULE_NAME,
jpayne@68 17915 (allow_newer) ? "was newer than" : "does not match",
jpayne@68 17916 (int) (rt_version >> 24), (int) ((rt_version >> 16) & 0xFF)
jpayne@68 17917 );
jpayne@68 17918 return PyErr_WarnEx(NULL, message, 1);
jpayne@68 17919 }
jpayne@68 17920 }
jpayne@68 17921
jpayne@68 17922 /* FunctionExport */
jpayne@68 17923 static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig) {
jpayne@68 17924 PyObject *d = 0;
jpayne@68 17925 PyObject *cobj = 0;
jpayne@68 17926 union {
jpayne@68 17927 void (*fp)(void);
jpayne@68 17928 void *p;
jpayne@68 17929 } tmp;
jpayne@68 17930 d = PyObject_GetAttrString(__pyx_m, (char *)"__pyx_capi__");
jpayne@68 17931 if (!d) {
jpayne@68 17932 PyErr_Clear();
jpayne@68 17933 d = PyDict_New();
jpayne@68 17934 if (!d)
jpayne@68 17935 goto bad;
jpayne@68 17936 Py_INCREF(d);
jpayne@68 17937 if (PyModule_AddObject(__pyx_m, (char *)"__pyx_capi__", d) < 0)
jpayne@68 17938 goto bad;
jpayne@68 17939 }
jpayne@68 17940 tmp.fp = f;
jpayne@68 17941 cobj = PyCapsule_New(tmp.p, sig, 0);
jpayne@68 17942 if (!cobj)
jpayne@68 17943 goto bad;
jpayne@68 17944 if (PyDict_SetItemString(d, name, cobj) < 0)
jpayne@68 17945 goto bad;
jpayne@68 17946 Py_DECREF(cobj);
jpayne@68 17947 Py_DECREF(d);
jpayne@68 17948 return 0;
jpayne@68 17949 bad:
jpayne@68 17950 Py_XDECREF(cobj);
jpayne@68 17951 Py_XDECREF(d);
jpayne@68 17952 return -1;
jpayne@68 17953 }
jpayne@68 17954
jpayne@68 17955 /* InitStrings */
jpayne@68 17956 #if PY_MAJOR_VERSION >= 3
jpayne@68 17957 static int __Pyx_InitString(__Pyx_StringTabEntry t, PyObject **str) {
jpayne@68 17958 if (t.is_unicode | t.is_str) {
jpayne@68 17959 if (t.intern) {
jpayne@68 17960 *str = PyUnicode_InternFromString(t.s);
jpayne@68 17961 } else if (t.encoding) {
jpayne@68 17962 *str = PyUnicode_Decode(t.s, t.n - 1, t.encoding, NULL);
jpayne@68 17963 } else {
jpayne@68 17964 *str = PyUnicode_FromStringAndSize(t.s, t.n - 1);
jpayne@68 17965 }
jpayne@68 17966 } else {
jpayne@68 17967 *str = PyBytes_FromStringAndSize(t.s, t.n - 1);
jpayne@68 17968 }
jpayne@68 17969 if (!*str)
jpayne@68 17970 return -1;
jpayne@68 17971 if (PyObject_Hash(*str) == -1)
jpayne@68 17972 return -1;
jpayne@68 17973 return 0;
jpayne@68 17974 }
jpayne@68 17975 #endif
jpayne@68 17976 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
jpayne@68 17977 while (t->p) {
jpayne@68 17978 #if PY_MAJOR_VERSION >= 3
jpayne@68 17979 __Pyx_InitString(*t, t->p);
jpayne@68 17980 #else
jpayne@68 17981 if (t->is_unicode) {
jpayne@68 17982 *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
jpayne@68 17983 } else if (t->intern) {
jpayne@68 17984 *t->p = PyString_InternFromString(t->s);
jpayne@68 17985 } else {
jpayne@68 17986 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
jpayne@68 17987 }
jpayne@68 17988 if (!*t->p)
jpayne@68 17989 return -1;
jpayne@68 17990 if (PyObject_Hash(*t->p) == -1)
jpayne@68 17991 return -1;
jpayne@68 17992 #endif
jpayne@68 17993 ++t;
jpayne@68 17994 }
jpayne@68 17995 return 0;
jpayne@68 17996 }
jpayne@68 17997
jpayne@68 17998 #include <string.h>
jpayne@68 17999 static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s) {
jpayne@68 18000 size_t len = strlen(s);
jpayne@68 18001 if (unlikely(len > (size_t) PY_SSIZE_T_MAX)) {
jpayne@68 18002 PyErr_SetString(PyExc_OverflowError, "byte string is too long");
jpayne@68 18003 return -1;
jpayne@68 18004 }
jpayne@68 18005 return (Py_ssize_t) len;
jpayne@68 18006 }
jpayne@68 18007 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
jpayne@68 18008 Py_ssize_t len = __Pyx_ssize_strlen(c_str);
jpayne@68 18009 if (unlikely(len < 0)) return NULL;
jpayne@68 18010 return __Pyx_PyUnicode_FromStringAndSize(c_str, len);
jpayne@68 18011 }
jpayne@68 18012 static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char* c_str) {
jpayne@68 18013 Py_ssize_t len = __Pyx_ssize_strlen(c_str);
jpayne@68 18014 if (unlikely(len < 0)) return NULL;
jpayne@68 18015 return PyByteArray_FromStringAndSize(c_str, len);
jpayne@68 18016 }
jpayne@68 18017 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
jpayne@68 18018 Py_ssize_t ignore;
jpayne@68 18019 return __Pyx_PyObject_AsStringAndSize(o, &ignore);
jpayne@68 18020 }
jpayne@68 18021 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
jpayne@68 18022 #if !CYTHON_PEP393_ENABLED
jpayne@68 18023 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
jpayne@68 18024 char* defenc_c;
jpayne@68 18025 PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
jpayne@68 18026 if (!defenc) return NULL;
jpayne@68 18027 defenc_c = PyBytes_AS_STRING(defenc);
jpayne@68 18028 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
jpayne@68 18029 {
jpayne@68 18030 char* end = defenc_c + PyBytes_GET_SIZE(defenc);
jpayne@68 18031 char* c;
jpayne@68 18032 for (c = defenc_c; c < end; c++) {
jpayne@68 18033 if ((unsigned char) (*c) >= 128) {
jpayne@68 18034 PyUnicode_AsASCIIString(o);
jpayne@68 18035 return NULL;
jpayne@68 18036 }
jpayne@68 18037 }
jpayne@68 18038 }
jpayne@68 18039 #endif
jpayne@68 18040 *length = PyBytes_GET_SIZE(defenc);
jpayne@68 18041 return defenc_c;
jpayne@68 18042 }
jpayne@68 18043 #else
jpayne@68 18044 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
jpayne@68 18045 if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
jpayne@68 18046 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
jpayne@68 18047 if (likely(PyUnicode_IS_ASCII(o))) {
jpayne@68 18048 *length = PyUnicode_GET_LENGTH(o);
jpayne@68 18049 return PyUnicode_AsUTF8(o);
jpayne@68 18050 } else {
jpayne@68 18051 PyUnicode_AsASCIIString(o);
jpayne@68 18052 return NULL;
jpayne@68 18053 }
jpayne@68 18054 #else
jpayne@68 18055 return PyUnicode_AsUTF8AndSize(o, length);
jpayne@68 18056 #endif
jpayne@68 18057 }
jpayne@68 18058 #endif
jpayne@68 18059 #endif
jpayne@68 18060 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
jpayne@68 18061 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
jpayne@68 18062 if (
jpayne@68 18063 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
jpayne@68 18064 __Pyx_sys_getdefaultencoding_not_ascii &&
jpayne@68 18065 #endif
jpayne@68 18066 PyUnicode_Check(o)) {
jpayne@68 18067 return __Pyx_PyUnicode_AsStringAndSize(o, length);
jpayne@68 18068 } else
jpayne@68 18069 #endif
jpayne@68 18070 #if (!CYTHON_COMPILING_IN_PYPY && !CYTHON_COMPILING_IN_LIMITED_API) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
jpayne@68 18071 if (PyByteArray_Check(o)) {
jpayne@68 18072 *length = PyByteArray_GET_SIZE(o);
jpayne@68 18073 return PyByteArray_AS_STRING(o);
jpayne@68 18074 } else
jpayne@68 18075 #endif
jpayne@68 18076 {
jpayne@68 18077 char* result;
jpayne@68 18078 int r = PyBytes_AsStringAndSize(o, &result, length);
jpayne@68 18079 if (unlikely(r < 0)) {
jpayne@68 18080 return NULL;
jpayne@68 18081 } else {
jpayne@68 18082 return result;
jpayne@68 18083 }
jpayne@68 18084 }
jpayne@68 18085 }
jpayne@68 18086 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
jpayne@68 18087 int is_true = x == Py_True;
jpayne@68 18088 if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
jpayne@68 18089 else return PyObject_IsTrue(x);
jpayne@68 18090 }
jpayne@68 18091 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
jpayne@68 18092 int retval;
jpayne@68 18093 if (unlikely(!x)) return -1;
jpayne@68 18094 retval = __Pyx_PyObject_IsTrue(x);
jpayne@68 18095 Py_DECREF(x);
jpayne@68 18096 return retval;
jpayne@68 18097 }
jpayne@68 18098 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
jpayne@68 18099 __Pyx_TypeName result_type_name = __Pyx_PyType_GetName(Py_TYPE(result));
jpayne@68 18100 #if PY_MAJOR_VERSION >= 3
jpayne@68 18101 if (PyLong_Check(result)) {
jpayne@68 18102 if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
jpayne@68 18103 "__int__ returned non-int (type " __Pyx_FMT_TYPENAME "). "
jpayne@68 18104 "The ability to return an instance of a strict subclass of int is deprecated, "
jpayne@68 18105 "and may be removed in a future version of Python.",
jpayne@68 18106 result_type_name)) {
jpayne@68 18107 __Pyx_DECREF_TypeName(result_type_name);
jpayne@68 18108 Py_DECREF(result);
jpayne@68 18109 return NULL;
jpayne@68 18110 }
jpayne@68 18111 __Pyx_DECREF_TypeName(result_type_name);
jpayne@68 18112 return result;
jpayne@68 18113 }
jpayne@68 18114 #endif
jpayne@68 18115 PyErr_Format(PyExc_TypeError,
jpayne@68 18116 "__%.4s__ returned non-%.4s (type " __Pyx_FMT_TYPENAME ")",
jpayne@68 18117 type_name, type_name, result_type_name);
jpayne@68 18118 __Pyx_DECREF_TypeName(result_type_name);
jpayne@68 18119 Py_DECREF(result);
jpayne@68 18120 return NULL;
jpayne@68 18121 }
jpayne@68 18122 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
jpayne@68 18123 #if CYTHON_USE_TYPE_SLOTS
jpayne@68 18124 PyNumberMethods *m;
jpayne@68 18125 #endif
jpayne@68 18126 const char *name = NULL;
jpayne@68 18127 PyObject *res = NULL;
jpayne@68 18128 #if PY_MAJOR_VERSION < 3
jpayne@68 18129 if (likely(PyInt_Check(x) || PyLong_Check(x)))
jpayne@68 18130 #else
jpayne@68 18131 if (likely(PyLong_Check(x)))
jpayne@68 18132 #endif
jpayne@68 18133 return __Pyx_NewRef(x);
jpayne@68 18134 #if CYTHON_USE_TYPE_SLOTS
jpayne@68 18135 m = Py_TYPE(x)->tp_as_number;
jpayne@68 18136 #if PY_MAJOR_VERSION < 3
jpayne@68 18137 if (m && m->nb_int) {
jpayne@68 18138 name = "int";
jpayne@68 18139 res = m->nb_int(x);
jpayne@68 18140 }
jpayne@68 18141 else if (m && m->nb_long) {
jpayne@68 18142 name = "long";
jpayne@68 18143 res = m->nb_long(x);
jpayne@68 18144 }
jpayne@68 18145 #else
jpayne@68 18146 if (likely(m && m->nb_int)) {
jpayne@68 18147 name = "int";
jpayne@68 18148 res = m->nb_int(x);
jpayne@68 18149 }
jpayne@68 18150 #endif
jpayne@68 18151 #else
jpayne@68 18152 if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
jpayne@68 18153 res = PyNumber_Int(x);
jpayne@68 18154 }
jpayne@68 18155 #endif
jpayne@68 18156 if (likely(res)) {
jpayne@68 18157 #if PY_MAJOR_VERSION < 3
jpayne@68 18158 if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
jpayne@68 18159 #else
jpayne@68 18160 if (unlikely(!PyLong_CheckExact(res))) {
jpayne@68 18161 #endif
jpayne@68 18162 return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
jpayne@68 18163 }
jpayne@68 18164 }
jpayne@68 18165 else if (!PyErr_Occurred()) {
jpayne@68 18166 PyErr_SetString(PyExc_TypeError,
jpayne@68 18167 "an integer is required");
jpayne@68 18168 }
jpayne@68 18169 return res;
jpayne@68 18170 }
jpayne@68 18171 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
jpayne@68 18172 Py_ssize_t ival;
jpayne@68 18173 PyObject *x;
jpayne@68 18174 #if PY_MAJOR_VERSION < 3
jpayne@68 18175 if (likely(PyInt_CheckExact(b))) {
jpayne@68 18176 if (sizeof(Py_ssize_t) >= sizeof(long))
jpayne@68 18177 return PyInt_AS_LONG(b);
jpayne@68 18178 else
jpayne@68 18179 return PyInt_AsSsize_t(b);
jpayne@68 18180 }
jpayne@68 18181 #endif
jpayne@68 18182 if (likely(PyLong_CheckExact(b))) {
jpayne@68 18183 #if CYTHON_USE_PYLONG_INTERNALS
jpayne@68 18184 if (likely(__Pyx_PyLong_IsCompact(b))) {
jpayne@68 18185 return __Pyx_PyLong_CompactValue(b);
jpayne@68 18186 } else {
jpayne@68 18187 const digit* digits = __Pyx_PyLong_Digits(b);
jpayne@68 18188 const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(b);
jpayne@68 18189 switch (size) {
jpayne@68 18190 case 2:
jpayne@68 18191 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
jpayne@68 18192 return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
jpayne@68 18193 }
jpayne@68 18194 break;
jpayne@68 18195 case -2:
jpayne@68 18196 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
jpayne@68 18197 return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
jpayne@68 18198 }
jpayne@68 18199 break;
jpayne@68 18200 case 3:
jpayne@68 18201 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
jpayne@68 18202 return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
jpayne@68 18203 }
jpayne@68 18204 break;
jpayne@68 18205 case -3:
jpayne@68 18206 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
jpayne@68 18207 return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
jpayne@68 18208 }
jpayne@68 18209 break;
jpayne@68 18210 case 4:
jpayne@68 18211 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
jpayne@68 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@68 18213 }
jpayne@68 18214 break;
jpayne@68 18215 case -4:
jpayne@68 18216 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
jpayne@68 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@68 18218 }
jpayne@68 18219 break;
jpayne@68 18220 }
jpayne@68 18221 }
jpayne@68 18222 #endif
jpayne@68 18223 return PyLong_AsSsize_t(b);
jpayne@68 18224 }
jpayne@68 18225 x = PyNumber_Index(b);
jpayne@68 18226 if (!x) return -1;
jpayne@68 18227 ival = PyInt_AsSsize_t(x);
jpayne@68 18228 Py_DECREF(x);
jpayne@68 18229 return ival;
jpayne@68 18230 }
jpayne@68 18231 static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) {
jpayne@68 18232 if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) {
jpayne@68 18233 return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o);
jpayne@68 18234 #if PY_MAJOR_VERSION < 3
jpayne@68 18235 } else if (likely(PyInt_CheckExact(o))) {
jpayne@68 18236 return PyInt_AS_LONG(o);
jpayne@68 18237 #endif
jpayne@68 18238 } else {
jpayne@68 18239 Py_ssize_t ival;
jpayne@68 18240 PyObject *x;
jpayne@68 18241 x = PyNumber_Index(o);
jpayne@68 18242 if (!x) return -1;
jpayne@68 18243 ival = PyInt_AsLong(x);
jpayne@68 18244 Py_DECREF(x);
jpayne@68 18245 return ival;
jpayne@68 18246 }
jpayne@68 18247 }
jpayne@68 18248 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
jpayne@68 18249 return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
jpayne@68 18250 }
jpayne@68 18251 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
jpayne@68 18252 return PyInt_FromSize_t(ival);
jpayne@68 18253 }
jpayne@68 18254
jpayne@68 18255
jpayne@68 18256 /* #### Code section: utility_code_pragmas_end ### */
jpayne@68 18257 #ifdef _MSC_VER
jpayne@68 18258 #pragma warning( pop )
jpayne@68 18259 #endif
jpayne@68 18260
jpayne@68 18261
jpayne@68 18262
jpayne@68 18263 /* #### Code section: end ### */
jpayne@68 18264 #endif /* Py_PYTHON_H */