3 #define PY_SSIZE_T_CLEAN 6 #error Python headers needed to compile C extensions, please install development version of Python. 7 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000) 8 #error Cython requires Python 2.6+ or Python 3.2+. 10 #define CYTHON_ABI "0_26_1" 13 #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) 15 #if !defined(WIN32) && !defined(MS_WINDOWS) 27 #define DL_IMPORT(t) t 30 #define DL_EXPORT(t) t 33 #ifndef HAVE_LONG_LONG 34 #if PY_VERSION_HEX >= 0x03030000 || (PY_MAJOR_VERSION == 2 && PY_VERSION_HEX >= 0x02070000) 35 #define HAVE_LONG_LONG 39 #define PY_LONG_LONG LONG_LONG 42 #define Py_HUGE_VAL HUGE_VAL 45 #define CYTHON_COMPILING_IN_PYPY 1 46 #define CYTHON_COMPILING_IN_PYSTON 0 47 #define CYTHON_COMPILING_IN_CPYTHON 0 48 #undef CYTHON_USE_TYPE_SLOTS 49 #define CYTHON_USE_TYPE_SLOTS 0 50 #undef CYTHON_USE_PYTYPE_LOOKUP 51 #define CYTHON_USE_PYTYPE_LOOKUP 0 52 #undef CYTHON_USE_ASYNC_SLOTS 53 #define CYTHON_USE_ASYNC_SLOTS 0 54 #undef CYTHON_USE_PYLIST_INTERNALS 55 #define CYTHON_USE_PYLIST_INTERNALS 0 56 #undef CYTHON_USE_UNICODE_INTERNALS 57 #define CYTHON_USE_UNICODE_INTERNALS 0 58 #undef CYTHON_USE_UNICODE_WRITER 59 #define CYTHON_USE_UNICODE_WRITER 0 60 #undef CYTHON_USE_PYLONG_INTERNALS 61 #define CYTHON_USE_PYLONG_INTERNALS 0 62 #undef CYTHON_AVOID_BORROWED_REFS 63 #define CYTHON_AVOID_BORROWED_REFS 1 64 #undef CYTHON_ASSUME_SAFE_MACROS 65 #define CYTHON_ASSUME_SAFE_MACROS 0 66 #undef CYTHON_UNPACK_METHODS 67 #define CYTHON_UNPACK_METHODS 0 68 #undef CYTHON_FAST_THREAD_STATE 69 #define CYTHON_FAST_THREAD_STATE 0 70 #undef CYTHON_FAST_PYCALL 71 #define CYTHON_FAST_PYCALL 0 72 #elif defined(PYSTON_VERSION) 73 #define CYTHON_COMPILING_IN_PYPY 0 74 #define CYTHON_COMPILING_IN_PYSTON 1 75 #define CYTHON_COMPILING_IN_CPYTHON 0 76 #ifndef CYTHON_USE_TYPE_SLOTS 77 #define CYTHON_USE_TYPE_SLOTS 1 79 #undef CYTHON_USE_PYTYPE_LOOKUP 80 #define CYTHON_USE_PYTYPE_LOOKUP 0 81 #undef CYTHON_USE_ASYNC_SLOTS 82 #define CYTHON_USE_ASYNC_SLOTS 0 83 #undef CYTHON_USE_PYLIST_INTERNALS 84 #define CYTHON_USE_PYLIST_INTERNALS 0 85 #ifndef CYTHON_USE_UNICODE_INTERNALS 86 #define CYTHON_USE_UNICODE_INTERNALS 1 88 #undef CYTHON_USE_UNICODE_WRITER 89 #define CYTHON_USE_UNICODE_WRITER 0 90 #undef CYTHON_USE_PYLONG_INTERNALS 91 #define CYTHON_USE_PYLONG_INTERNALS 0 92 #ifndef CYTHON_AVOID_BORROWED_REFS 93 #define CYTHON_AVOID_BORROWED_REFS 0 95 #ifndef CYTHON_ASSUME_SAFE_MACROS 96 #define CYTHON_ASSUME_SAFE_MACROS 1 98 #ifndef CYTHON_UNPACK_METHODS 99 #define CYTHON_UNPACK_METHODS 1 101 #undef CYTHON_FAST_THREAD_STATE 102 #define CYTHON_FAST_THREAD_STATE 0 103 #undef CYTHON_FAST_PYCALL 104 #define CYTHON_FAST_PYCALL 0 106 #define CYTHON_COMPILING_IN_PYPY 0 107 #define CYTHON_COMPILING_IN_PYSTON 0 108 #define CYTHON_COMPILING_IN_CPYTHON 1 109 #ifndef CYTHON_USE_TYPE_SLOTS 110 #define CYTHON_USE_TYPE_SLOTS 1 112 #if PY_VERSION_HEX < 0x02070000 113 #undef CYTHON_USE_PYTYPE_LOOKUP 114 #define CYTHON_USE_PYTYPE_LOOKUP 0 115 #elif !defined(CYTHON_USE_PYTYPE_LOOKUP) 116 #define CYTHON_USE_PYTYPE_LOOKUP 1 118 #if PY_MAJOR_VERSION < 3 119 #undef CYTHON_USE_ASYNC_SLOTS 120 #define CYTHON_USE_ASYNC_SLOTS 0 121 #elif !defined(CYTHON_USE_ASYNC_SLOTS) 122 #define CYTHON_USE_ASYNC_SLOTS 1 124 #if PY_VERSION_HEX < 0x02070000 125 #undef CYTHON_USE_PYLONG_INTERNALS 126 #define CYTHON_USE_PYLONG_INTERNALS 0 127 #elif !defined(CYTHON_USE_PYLONG_INTERNALS) 128 #define CYTHON_USE_PYLONG_INTERNALS 1 130 #ifndef CYTHON_USE_PYLIST_INTERNALS 131 #define CYTHON_USE_PYLIST_INTERNALS 1 133 #ifndef CYTHON_USE_UNICODE_INTERNALS 134 #define CYTHON_USE_UNICODE_INTERNALS 1 136 #if PY_VERSION_HEX < 0x030300F0 137 #undef CYTHON_USE_UNICODE_WRITER 138 #define CYTHON_USE_UNICODE_WRITER 0 139 #elif !defined(CYTHON_USE_UNICODE_WRITER) 140 #define CYTHON_USE_UNICODE_WRITER 1 142 #ifndef CYTHON_AVOID_BORROWED_REFS 143 #define CYTHON_AVOID_BORROWED_REFS 0 145 #ifndef CYTHON_ASSUME_SAFE_MACROS 146 #define CYTHON_ASSUME_SAFE_MACROS 1 148 #ifndef CYTHON_UNPACK_METHODS 149 #define CYTHON_UNPACK_METHODS 1 151 #ifndef CYTHON_FAST_THREAD_STATE 152 #define CYTHON_FAST_THREAD_STATE 1 154 #ifndef CYTHON_FAST_PYCALL 155 #define CYTHON_FAST_PYCALL 1 158 #if !defined(CYTHON_FAST_PYCCALL) 159 #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) 161 #if CYTHON_USE_PYLONG_INTERNALS 162 #include "longintrepr.h" 167 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) 168 #define Py_OptimizeFlag 0 170 #define __PYX_BUILD_PY_SSIZE_T "n" 171 #define CYTHON_FORMAT_SSIZE_T "z" 172 #if PY_MAJOR_VERSION < 3 173 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" 174 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ 175 PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) 176 #define __Pyx_DefaultClassType PyClass_Type 178 #define __Pyx_BUILTIN_MODULE_NAME "builtins" 179 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ 180 PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) 181 #define __Pyx_DefaultClassType PyType_Type 183 #ifndef Py_TPFLAGS_CHECKTYPES 184 #define Py_TPFLAGS_CHECKTYPES 0 186 #ifndef Py_TPFLAGS_HAVE_INDEX 187 #define Py_TPFLAGS_HAVE_INDEX 0 189 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER 190 #define Py_TPFLAGS_HAVE_NEWBUFFER 0 192 #ifndef Py_TPFLAGS_HAVE_FINALIZE 193 #define Py_TPFLAGS_HAVE_FINALIZE 0 195 #if PY_VERSION_HEX < 0x030700A0 || !defined(METH_FASTCALL) 196 #ifndef METH_FASTCALL 197 #define METH_FASTCALL 0x80 199 typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *
self, PyObject **args, Py_ssize_t nargs);
200 typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *
self, PyObject **args,
201 Py_ssize_t nargs, PyObject *kwnames);
203 #define __Pyx_PyCFunctionFast _PyCFunctionFast 204 #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords 206 #if CYTHON_FAST_PYCCALL 207 #define __Pyx_PyFastCFunction_Check(func)\ 208 ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS))))) 210 #define __Pyx_PyFastCFunction_Check(func) 0 212 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) 213 #define CYTHON_PEP393_ENABLED 1 214 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ 215 0 : _PyUnicode_Ready((PyObject *)(op))) 216 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) 217 #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) 218 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) 219 #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u) 220 #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) 221 #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) 222 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch) 223 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) 225 #define CYTHON_PEP393_ENABLED 0 226 #define PyUnicode_1BYTE_KIND 1 227 #define PyUnicode_2BYTE_KIND 2 228 #define PyUnicode_4BYTE_KIND 4 229 #define __Pyx_PyUnicode_READY(op) (0) 230 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) 231 #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) 232 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111) 233 #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE)) 234 #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) 235 #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) 236 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch) 237 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) 239 #if CYTHON_COMPILING_IN_PYPY 240 #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b) 241 #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b) 243 #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b) 244 #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ 245 PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) 247 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains) 248 #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) 250 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check) 251 #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) 253 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format) 254 #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) 256 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) 257 #define PyObject_Malloc(s) PyMem_Malloc(s) 258 #define PyObject_Free(p) PyMem_Free(p) 259 #define PyObject_Realloc(p) PyMem_Realloc(p) 261 #if CYTHON_COMPILING_IN_PYSTON 262 #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co) 263 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno) 265 #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) 266 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) 268 #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) 269 #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) 270 #if PY_MAJOR_VERSION >= 3 271 #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b) 273 #define __Pyx_PyString_Format(a, b) PyString_Format(a, b) 275 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII) 276 #define PyObject_ASCII(o) PyObject_Repr(o) 278 #if PY_MAJOR_VERSION >= 3 279 #define PyBaseString_Type PyUnicode_Type 280 #define PyStringObject PyUnicodeObject 281 #define PyString_Type PyUnicode_Type 282 #define PyString_Check PyUnicode_Check 283 #define PyString_CheckExact PyUnicode_CheckExact 285 #if PY_MAJOR_VERSION >= 3 286 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) 287 #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) 289 #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) 290 #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) 292 #ifndef PySet_CheckExact 293 #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) 295 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) 296 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) 297 #if PY_MAJOR_VERSION >= 3 298 #define PyIntObject PyLongObject 299 #define PyInt_Type PyLong_Type 300 #define PyInt_Check(op) PyLong_Check(op) 301 #define PyInt_CheckExact(op) PyLong_CheckExact(op) 302 #define PyInt_FromString PyLong_FromString 303 #define PyInt_FromUnicode PyLong_FromUnicode 304 #define PyInt_FromLong PyLong_FromLong 305 #define PyInt_FromSize_t PyLong_FromSize_t 306 #define PyInt_FromSsize_t PyLong_FromSsize_t 307 #define PyInt_AsLong PyLong_AsLong 308 #define PyInt_AS_LONG PyLong_AS_LONG 309 #define PyInt_AsSsize_t PyLong_AsSsize_t 310 #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask 311 #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask 312 #define PyNumber_Int PyNumber_Long 314 #if PY_MAJOR_VERSION >= 3 315 #define PyBoolObject PyLongObject 317 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY 318 #ifndef PyUnicode_InternFromString 319 #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) 322 #if PY_VERSION_HEX < 0x030200A4 323 typedef long Py_hash_t;
324 #define __Pyx_PyInt_FromHash_t PyInt_FromLong 325 #define __Pyx_PyInt_AsHash_t PyInt_AsLong 327 #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t 328 #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t 330 #if PY_MAJOR_VERSION >= 3 331 #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) 333 #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) 335 #ifndef __has_attribute 336 #define __has_attribute(x) 0 338 #ifndef __has_cpp_attribute 339 #define __has_cpp_attribute(x) 0 341 #if CYTHON_USE_ASYNC_SLOTS 342 #if PY_VERSION_HEX >= 0x030500B1 343 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods 344 #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async) 350 } __Pyx_PyAsyncMethodsStruct;
351 #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved)) 354 #define __Pyx_PyType_AsAsync(obj) NULL 356 #ifndef CYTHON_RESTRICT 357 #if defined(__GNUC__) 358 #define CYTHON_RESTRICT __restrict__ 359 #elif defined(_MSC_VER) && _MSC_VER >= 1400 360 #define CYTHON_RESTRICT __restrict 361 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L 362 #define CYTHON_RESTRICT restrict 364 #define CYTHON_RESTRICT 367 #ifndef CYTHON_UNUSED 368 # if defined(__GNUC__) 369 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) 370 # define CYTHON_UNUSED __attribute__ ((__unused__)) 372 # define CYTHON_UNUSED 374 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) 375 # define CYTHON_UNUSED __attribute__ ((__unused__)) 377 # define CYTHON_UNUSED 380 #ifndef CYTHON_MAYBE_UNUSED_VAR 381 # if defined(__cplusplus) 382 template<
class T>
void CYTHON_MAYBE_UNUSED_VAR(
const T& ) { }
384 # define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x) 387 #ifndef CYTHON_NCP_UNUSED 388 # if CYTHON_COMPILING_IN_CPYTHON 389 # define CYTHON_NCP_UNUSED 391 # define CYTHON_NCP_UNUSED CYTHON_UNUSED 394 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) 396 #ifndef _MSC_STDINT_H_ 398 typedef unsigned char uint8_t;
399 typedef unsigned int uint32_t;
401 typedef unsigned __int8 uint8_t;
402 typedef unsigned __int32 uint32_t;
408 #ifndef CYTHON_FALLTHROUGH 410 #if __has_cpp_attribute(fallthrough) 411 #define CYTHON_FALLTHROUGH [[fallthrough]] 412 #elif __has_cpp_attribute(clang::fallthrough) 413 #define CYTHON_FALLTHROUGH [[clang::fallthrough]] 416 #ifndef CYTHON_FALLTHROUGH 417 #if __has_attribute(fallthrough) || (defined(__GNUC__) && defined(__attribute__)) 418 #define CYTHON_FALLTHROUGH __attribute__((fallthrough)) 420 #define CYTHON_FALLTHROUGH 426 #error "Cython files generated with the C++ option must be compiled with a C++ compiler." 428 #ifndef CYTHON_INLINE 429 #if defined(__clang__) 430 #define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) 432 #define CYTHON_INLINE inline 436 void __Pyx_call_destructor(T& x) {
440 class __Pyx_FakeReference {
442 __Pyx_FakeReference() : ptr(NULL) { }
443 __Pyx_FakeReference(
const T& ref) : ptr(const_cast<T*>(&ref)) { }
444 T *operator->() {
return ptr; }
445 T *operator&() {
return ptr; }
446 operator T&() {
return *ptr; }
447 template<
typename U>
bool operator ==(U other) {
return *ptr == other; }
448 template<
typename U>
bool operator !=(U other) {
return *ptr != other; }
453 #if defined(WIN32) || defined(MS_WINDOWS) 454 #define _USE_MATH_DEFINES 458 #define __PYX_NAN() ((float) NAN) 460 static CYTHON_INLINE
float __PYX_NAN() {
462 memset(&value, 0xFF,
sizeof(value));
466 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL) 467 #define __Pyx_truncl trunc 469 #define __Pyx_truncl truncl 473 #define __PYX_ERR(f_index, lineno, Ln_error) \ 475 __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \ 478 #if PY_MAJOR_VERSION >= 3 479 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) 480 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) 482 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) 483 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) 486 #ifndef __PYX_EXTERN_C 488 #define __PYX_EXTERN_C extern "C" 490 #define __PYX_EXTERN_C extern 494 #define __PYX_HAVE__pyinfile 495 #define __PYX_HAVE_API__pyinfile 507 #ifdef PYREX_WITHOUT_ASSERTIONS 508 #define CYTHON_WITHOUT_ASSERTIONS 511 typedef struct {PyObject **p;
const char *s;
const Py_ssize_t n;
const char* encoding;
512 const char is_unicode;
const char is_str;
const char intern; } __Pyx_StringTabEntry;
514 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 515 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0 516 #define __PYX_DEFAULT_STRING_ENCODING "" 517 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString 518 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize 519 #define __Pyx_uchar_cast(c) ((unsigned char)c) 520 #define __Pyx_long_cast(x) ((long)x) 521 #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\ 522 (sizeof(type) < sizeof(Py_ssize_t)) ||\ 523 (sizeof(type) > sizeof(Py_ssize_t) &&\ 524 likely(v < (type)PY_SSIZE_T_MAX ||\ 525 v == (type)PY_SSIZE_T_MAX) &&\ 526 (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\ 527 v == (type)PY_SSIZE_T_MIN))) ||\ 528 (sizeof(type) == sizeof(Py_ssize_t) &&\ 529 (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\ 530 v == (type)PY_SSIZE_T_MAX))) ) 531 #if defined (__cplusplus) && __cplusplus >= 201103L 533 #define __Pyx_sst_abs(value) std::abs(value) 534 #elif SIZEOF_INT >= SIZEOF_SIZE_T 535 #define __Pyx_sst_abs(value) abs(value) 536 #elif SIZEOF_LONG >= SIZEOF_SIZE_T 537 #define __Pyx_sst_abs(value) labs(value) 538 #elif defined (_MSC_VER) && defined (_M_X64) 539 #define __Pyx_sst_abs(value) _abs64(value) 540 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L 541 #define __Pyx_sst_abs(value) llabs(value) 542 #elif defined (__GNUC__) 543 #define __Pyx_sst_abs(value) __builtin_llabs(value) 545 #define __Pyx_sst_abs(value) ((value<0) ? -value : value) 547 static CYTHON_INLINE
const char* __Pyx_PyObject_AsString(PyObject*);
548 static CYTHON_INLINE
const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
549 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s)) 550 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l) 551 #define __Pyx_PyBytes_FromString PyBytes_FromString 552 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize 553 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(
const char*);
554 #if PY_MAJOR_VERSION < 3 555 #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString 556 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize 558 #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString 559 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize 561 #define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s)) 562 #define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) 563 #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) 564 #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s)) 565 #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s)) 566 #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) 567 #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s) 568 #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) 569 #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) 570 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) 571 #if PY_MAJOR_VERSION < 3 572 static CYTHON_INLINE
size_t __Pyx_Py_UNICODE_strlen(
const Py_UNICODE *u)
574 const Py_UNICODE *u_end = u;
576 return (
size_t)(u_end - u - 1);
579 #define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen 581 #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) 582 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode 583 #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode 584 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj) 585 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None) 586 #define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False)) 587 static CYTHON_INLINE
int __Pyx_PyObject_IsTrue(PyObject*);
588 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
589 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
590 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(
size_t);
591 #if CYTHON_ASSUME_SAFE_MACROS 592 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) 594 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) 596 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) 597 #if PY_MAJOR_VERSION >= 3 598 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x)) 600 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) 602 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x)) 603 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 604 static int __Pyx_sys_getdefaultencoding_not_ascii;
605 static int __Pyx_init_sys_getdefaultencoding_params(
void) {
607 PyObject* default_encoding = NULL;
608 PyObject* ascii_chars_u = NULL;
609 PyObject* ascii_chars_b = NULL;
610 const char* default_encoding_c;
611 sys = PyImport_ImportModule(
"sys");
613 default_encoding = PyObject_CallMethod(sys, (
char*)
"getdefaultencoding", NULL);
615 if (!default_encoding)
goto bad;
616 default_encoding_c = PyBytes_AsString(default_encoding);
617 if (!default_encoding_c)
goto bad;
618 if (strcmp(default_encoding_c,
"ascii") == 0) {
619 __Pyx_sys_getdefaultencoding_not_ascii = 0;
621 char ascii_chars[128];
623 for (c = 0; c < 128; c++) {
626 __Pyx_sys_getdefaultencoding_not_ascii = 1;
627 ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
628 if (!ascii_chars_u)
goto bad;
629 ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
630 if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
633 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
637 Py_DECREF(ascii_chars_u);
638 Py_DECREF(ascii_chars_b);
640 Py_DECREF(default_encoding);
643 Py_XDECREF(default_encoding);
644 Py_XDECREF(ascii_chars_u);
645 Py_XDECREF(ascii_chars_b);
649 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3 650 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) 652 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) 653 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 654 static char* __PYX_DEFAULT_STRING_ENCODING;
655 static int __Pyx_init_sys_getdefaultencoding_params(
void) {
657 PyObject* default_encoding = NULL;
658 char* default_encoding_c;
659 sys = PyImport_ImportModule(
"sys");
661 default_encoding = PyObject_CallMethod(sys, (
char*) (
const char*)
"getdefaultencoding", NULL);
663 if (!default_encoding)
goto bad;
664 default_encoding_c = PyBytes_AsString(default_encoding);
665 if (!default_encoding_c)
goto bad;
666 __PYX_DEFAULT_STRING_ENCODING = (
char*) malloc(strlen(default_encoding_c));
667 if (!__PYX_DEFAULT_STRING_ENCODING)
goto bad;
668 strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
669 Py_DECREF(default_encoding);
672 Py_XDECREF(default_encoding);
680 #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))) 681 #define likely(x) __builtin_expect(!!(x), 1) 682 #define unlikely(x) __builtin_expect(!!(x), 0) 684 #define likely(x) (x) 685 #define unlikely(x) (x) 687 static CYTHON_INLINE
void __Pyx_pretend_to_initialize(
void* ptr) { (void)ptr; }
689 static PyObject *__pyx_m;
690 static PyObject *__pyx_d;
691 static PyObject *__pyx_b;
692 static PyObject *__pyx_cython_runtime;
693 static PyObject *__pyx_empty_tuple;
694 static PyObject *__pyx_empty_bytes;
695 static PyObject *__pyx_empty_unicode;
696 static int __pyx_lineno;
697 static int __pyx_clineno = 0;
698 static const char * __pyx_cfilenm= __FILE__;
699 static const char *__pyx_filename;
702 static const char *__pyx_f[] = {
712 #ifndef CYTHON_REFNANNY 713 #define CYTHON_REFNANNY 0 717 void (*INCREF)(
void*, PyObject*, int);
718 void (*DECREF)(
void*, PyObject*, int);
719 void (*GOTREF)(
void*, PyObject*, int);
720 void (*GIVEREF)(
void*, PyObject*, int);
721 void* (*SetupContext)(
const char*, int,
const char*);
722 void (*FinishContext)(
void**);
723 } __Pyx_RefNannyAPIStruct;
724 static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
725 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(
const char *modname);
726 #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; 728 #define __Pyx_RefNannySetupContext(name, acquire_gil)\ 730 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ 731 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ 732 PyGILState_Release(__pyx_gilstate_save);\ 734 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ 737 #define __Pyx_RefNannySetupContext(name, acquire_gil)\ 738 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) 740 #define __Pyx_RefNannyFinishContext()\ 741 __Pyx_RefNanny->FinishContext(&__pyx_refnanny) 742 #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) 743 #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) 744 #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) 745 #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) 746 #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) 747 #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) 748 #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) 749 #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) 751 #define __Pyx_RefNannyDeclarations 752 #define __Pyx_RefNannySetupContext(name, acquire_gil) 753 #define __Pyx_RefNannyFinishContext() 754 #define __Pyx_INCREF(r) Py_INCREF(r) 755 #define __Pyx_DECREF(r) Py_DECREF(r) 756 #define __Pyx_GOTREF(r) 757 #define __Pyx_GIVEREF(r) 758 #define __Pyx_XINCREF(r) Py_XINCREF(r) 759 #define __Pyx_XDECREF(r) Py_XDECREF(r) 760 #define __Pyx_XGOTREF(r) 761 #define __Pyx_XGIVEREF(r) 763 #define __Pyx_XDECREF_SET(r, v) do {\ 764 PyObject *tmp = (PyObject *) r;\ 765 r = v; __Pyx_XDECREF(tmp);\ 767 #define __Pyx_DECREF_SET(r, v) do {\ 768 PyObject *tmp = (PyObject *) r;\ 769 r = v; __Pyx_DECREF(tmp);\ 771 #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) 772 #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) 775 #if CYTHON_USE_TYPE_SLOTS 776 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
777 PyTypeObject* tp = Py_TYPE(obj);
778 if (likely(tp->tp_getattro))
779 return tp->tp_getattro(obj, attr_name);
780 #if PY_MAJOR_VERSION < 3 781 if (likely(tp->tp_getattr))
782 return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
784 return PyObject_GetAttr(obj, attr_name);
787 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) 791 static PyObject *__Pyx_GetBuiltinName(PyObject *
name);
794 #if CYTHON_FAST_PYCCALL 795 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
797 #define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL) 801 #if CYTHON_FAST_PYCALL 802 #define __Pyx_PyFunction_FastCall(func, args, nargs)\ 803 __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) 804 #if 1 || PY_VERSION_HEX < 0x030600B1 805 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args,
int nargs, PyObject *kwargs);
807 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs) 812 #if CYTHON_COMPILING_IN_CPYTHON 813 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
815 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) 819 #if CYTHON_COMPILING_IN_CPYTHON 820 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
824 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
827 #if CYTHON_COMPILING_IN_CPYTHON 828 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
830 #define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL) 834 #if CYTHON_FAST_THREAD_STATE 835 #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; 836 #define __Pyx_PyThreadState_assign __pyx_tstate = PyThreadState_GET(); 838 #define __Pyx_PyThreadState_declare 839 #define __Pyx_PyThreadState_assign 843 #if CYTHON_FAST_THREAD_STATE 844 #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) 845 #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) 846 #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) 847 #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) 848 static CYTHON_INLINE
void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
849 static CYTHON_INLINE
void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
851 #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) 852 #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) 853 #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) 854 #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) 858 static void __Pyx_WriteUnraisable(
const char *
name,
int clineno,
859 int lineno,
const char *filename,
860 int full_traceback,
int nogil);
863 static PyObject* __Pyx_PyExec3(PyObject*, PyObject*, PyObject*);
864 static CYTHON_INLINE PyObject* __Pyx_PyExec2(PyObject*, PyObject*);
867 static CYTHON_INLINE
int __Pyx_PyDict_ContainsTF(PyObject* item, PyObject* dict,
int eq) {
868 int result = PyDict_Contains(dict, item);
869 return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
873 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY 874 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
876 value = PyDict_GetItemWithError(d, key);
877 if (unlikely(!value)) {
878 if (!PyErr_Occurred()) {
879 PyObject* args = PyTuple_Pack(1, key);
881 PyErr_SetObject(PyExc_KeyError, args);
890 #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key) 894 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
897 #if CYTHON_USE_TYPE_SLOTS && PY_MAJOR_VERSION >= 3 898 #define __Pyx_PyCallable_Check(obj) ((obj)->ob_type->tp_call != NULL) 900 #define __Pyx_PyCallable_Check(obj) PyCallable_Check(obj) 904 static PyObject *__Pyx_Import(PyObject *
name, PyObject *from_list,
int level);
907 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject*
name);
910 static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *
name);
913 #if CYTHON_FAST_THREAD_STATE 914 #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb) 915 static CYTHON_INLINE
void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
916 #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb) 917 static CYTHON_INLINE
void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
919 #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb) 920 #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb) 924 #if CYTHON_FAST_THREAD_STATE 925 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) 926 static CYTHON_INLINE
int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
928 #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) 932 #if CYTHON_FAST_THREAD_STATE 933 #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb) 934 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
936 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
940 static int __Pyx_CLineForTraceback(
int c_line);
944 PyCodeObject* code_object;
946 } __Pyx_CodeObjectCacheEntry;
947 struct __Pyx_CodeObjectCache {
950 __Pyx_CodeObjectCacheEntry* entries;
952 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
953 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries,
int count,
int code_line);
954 static PyCodeObject *__pyx_find_code_object(
int code_line);
955 static void __pyx_insert_code_object(
int code_line, PyCodeObject* code_object);
958 static void __Pyx_AddTraceback(
const char *funcname,
int c_line,
959 int py_line,
const char *filename);
962 #ifndef __Pyx_CppExn2PyErr 967 static void __Pyx_CppExn2PyErr() {
969 if (PyErr_Occurred())
973 }
catch (
const std::bad_alloc& exn) {
974 PyErr_SetString(PyExc_MemoryError, exn.what());
975 }
catch (
const std::bad_cast& exn) {
976 PyErr_SetString(PyExc_TypeError, exn.what());
977 }
catch (
const std::bad_typeid& exn) {
978 PyErr_SetString(PyExc_TypeError, exn.what());
979 }
catch (
const std::domain_error& exn) {
980 PyErr_SetString(PyExc_ValueError, exn.what());
981 }
catch (
const std::invalid_argument& exn) {
982 PyErr_SetString(PyExc_ValueError, exn.what());
983 }
catch (
const std::ios_base::failure& exn) {
984 PyErr_SetString(PyExc_IOError, exn.what());
985 }
catch (
const std::out_of_range& exn) {
986 PyErr_SetString(PyExc_IndexError, exn.what());
987 }
catch (
const std::overflow_error& exn) {
988 PyErr_SetString(PyExc_OverflowError, exn.what());
989 }
catch (
const std::range_error& exn) {
990 PyErr_SetString(PyExc_ArithmeticError, exn.what());
991 }
catch (
const std::underflow_error& exn) {
992 PyErr_SetString(PyExc_ArithmeticError, exn.what());
993 }
catch (
const std::exception& exn) {
994 PyErr_SetString(PyExc_RuntimeError, exn.what());
998 PyErr_SetString(PyExc_RuntimeError,
"Unknown exception");
1004 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(
long value);
1007 static CYTHON_INLINE
long __Pyx_PyInt_As_long(PyObject *);
1010 static CYTHON_INLINE
int __Pyx_PyInt_As_int(PyObject *);
1013 static int __Pyx_check_binary_version(
void);
1016 static int __Pyx_ExportFunction(
const char *
name,
void (*f)(
void),
const char *sig);
1019 #if !defined(__Pyx_PyIdentifier_FromString) 1020 #if PY_MAJOR_VERSION < 3 1021 #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) 1023 #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) 1028 static PyObject *__Pyx_ImportModule(
const char *
name);
1031 static PyTypeObject *__Pyx_ImportType(
const char *module_name,
const char *class_name,
size_t size,
int strict);
1034 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
1046 static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
1055 static std::string __pyx_f_8pyinfile_str_py_to_cpp(PyObject *);
1056 static PyObject *__pyx_f_8pyinfile_std_string_to_py(
std::string);
1059 static CYTHON_INLINE PyObject *__pyx_convert_PyObject_string_to_py_std__in_string(
std::string const &);
1060 static CYTHON_INLINE PyObject *__pyx_convert_PyUnicode_string_to_py_std__in_string(
std::string const &);
1061 static CYTHON_INLINE PyObject *__pyx_convert_PyStr_string_to_py_std__in_string(
std::string const &);
1062 static CYTHON_INLINE PyObject *__pyx_convert_PyBytes_string_to_py_std__in_string(
std::string const &);
1063 static CYTHON_INLINE PyObject *__pyx_convert_PyByteArray_string_to_py_std__in_string(
std::string const &);
1064 #define __Pyx_MODULE_NAME "pyinfile" 1065 int __pyx_module_is_main_pyinfile = 0;
1068 static PyObject *__pyx_builtin_ImportError;
1069 static PyObject *__pyx_builtin_RuntimeError;
1070 static const char __pyx_k_[] =
"\n";
1071 static const char __pyx_k_json[] =
"json";
1072 static const char __pyx_k_main[] =
"__main__";
1073 static const char __pyx_k_test[] =
"__test__";
1074 static const char __pyx_k_dumps[] =
"dumps";
1075 static const char __pyx_k_loads[] =
"loads";
1076 static const char __pyx_k_decode[] =
"decode";
1077 static const char __pyx_k_encode[] =
"encode";
1078 static const char __pyx_k_import[] =
"__import__";
1079 static const char __pyx_k_indent[] =
"indent";
1080 static const char __pyx_k_pprint[] =
"pprint";
1081 static const char __pyx_k_Mapping[] =
"Mapping";
1082 static const char __pyx_k_pformat[] =
"pformat";
1083 static const char __pyx_k_builtins[] =
"__builtins__";
1084 static const char __pyx_k_endswith[] =
"endswith";
1085 static const char __pyx_k_pprintpp[] =
"pprintpp";
1086 static const char __pyx_k_sort_keys[] =
"sort_keys";
1087 static const char __pyx_k_SIMULATION[] =
"SIMULATION";
1088 static const char __pyx_k_Simulation[] =
"Simulation";
1089 static const char __pyx_k_simulation[] =
"simulation";
1090 static const char __pyx_k_ImportError[] =
"ImportError";
1091 static const char __pyx_k_collections[] =
"collections";
1092 static const char __pyx_k_RuntimeError[] =
"RuntimeError";
1093 static const char __pyx_k_SIMULATION_2[] =
"SIMULATION = ";
1094 static const char __pyx_k_cline_in_traceback[] =
"cline_in_traceback";
1095 static const char __pyx_k_Cyclus_Python_input_file_tools[] =
"Cyclus Python input file tools.";
1096 static const char __pyx_k_simulation_not_found_in_python_f[] =
"simulation not found in python file.";
1097 static const char __pyx_k_top_level_simulation_object_does[] =
"top-level simulation object does not have proper type.";
1098 static PyObject *__pyx_kp_u_;
1099 static PyObject *__pyx_n_s_ImportError;
1100 static PyObject *__pyx_n_s_Mapping;
1101 static PyObject *__pyx_n_s_RuntimeError;
1102 static PyObject *__pyx_n_u_SIMULATION;
1103 static PyObject *__pyx_kp_u_SIMULATION_2;
1104 static PyObject *__pyx_n_u_Simulation;
1105 static PyObject *__pyx_n_s_builtins;
1106 static PyObject *__pyx_n_s_cline_in_traceback;
1107 static PyObject *__pyx_n_s_collections;
1108 static PyObject *__pyx_n_s_decode;
1109 static PyObject *__pyx_n_s_dumps;
1110 static PyObject *__pyx_n_s_encode;
1111 static PyObject *__pyx_n_s_endswith;
1112 static PyObject *__pyx_n_s_import;
1113 static PyObject *__pyx_n_s_indent;
1114 static PyObject *__pyx_n_s_json;
1115 static PyObject *__pyx_n_s_loads;
1116 static PyObject *__pyx_n_s_main;
1117 static PyObject *__pyx_n_s_pformat;
1118 static PyObject *__pyx_n_s_pprint;
1119 static PyObject *__pyx_n_s_pprintpp;
1120 static PyObject *__pyx_n_u_simulation;
1121 static PyObject *__pyx_kp_u_simulation_not_found_in_python_f;
1122 static PyObject *__pyx_n_s_sort_keys;
1123 static PyObject *__pyx_n_s_test;
1124 static PyObject *__pyx_kp_u_top_level_simulation_object_does;
1125 static PyObject *__pyx_int_1;
1126 static PyObject *__pyx_tuple__2;
1127 static PyObject *__pyx_tuple__3;
1128 static PyObject *__pyx_tuple__4;
1129 static PyObject *__pyx_tuple__5;
1139 static PyObject *__pyx_f_8pyinfile_std_string_to_py(
std::string __pyx_v_x) {
1140 PyObject *__pyx_v_pyx = NULL;
1141 PyObject *__pyx_r = NULL;
1142 __Pyx_RefNannyDeclarations
1143 PyObject *__pyx_t_1 = NULL;
1144 PyObject *__pyx_t_2 = NULL;
1145 PyObject *__pyx_t_3 = NULL;
1146 __Pyx_RefNannySetupContext(
"std_string_to_py", 0);
1155 __pyx_t_1 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_x);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 13, __pyx_L1_error)
1156 __Pyx_GOTREF(__pyx_t_1);
1157 __pyx_v_pyx = __pyx_t_1;
1167 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_pyx, __pyx_n_s_decode);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 14, __pyx_L1_error)
1168 __Pyx_GOTREF(__pyx_t_2);
1170 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
1171 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
1172 if (likely(__pyx_t_3)) {
1173 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_2);
1174 __Pyx_INCREF(__pyx_t_3);
1175 __Pyx_INCREF(
function);
1176 __Pyx_DECREF_SET(__pyx_t_2,
function);
1180 __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 14, __pyx_L1_error)
1181 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
1183 __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 14, __pyx_L1_error)
1185 __Pyx_GOTREF(__pyx_t_1);
1186 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1187 __Pyx_DECREF_SET(__pyx_v_pyx, __pyx_t_1);
1197 __Pyx_XDECREF(__pyx_r);
1198 __Pyx_INCREF(__pyx_v_pyx);
1199 __pyx_r = __pyx_v_pyx;
1212 __Pyx_XDECREF(__pyx_t_1);
1213 __Pyx_XDECREF(__pyx_t_2);
1214 __Pyx_XDECREF(__pyx_t_3);
1215 __Pyx_AddTraceback(
"pyinfile.std_string_to_py", __pyx_clineno, __pyx_lineno, __pyx_filename);
1218 __Pyx_XDECREF(__pyx_v_pyx);
1219 __Pyx_XGIVEREF(__pyx_r);
1220 __Pyx_RefNannyFinishContext();
1232 static std::string __pyx_f_8pyinfile_str_py_to_cpp(PyObject *__pyx_v_x) {
1235 __Pyx_RefNannyDeclarations
1236 PyObject *__pyx_t_1 = NULL;
1237 PyObject *__pyx_t_2 = NULL;
1238 PyObject *__pyx_t_3 = NULL;
1239 char const *__pyx_t_4;
1241 __Pyx_RefNannySetupContext(
"str_py_to_cpp", 0);
1242 __Pyx_INCREF(__pyx_v_x);
1251 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_x, __pyx_n_s_encode);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error)
1252 __Pyx_GOTREF(__pyx_t_2);
1254 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
1255 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
1256 if (likely(__pyx_t_3)) {
1257 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_2);
1258 __Pyx_INCREF(__pyx_t_3);
1259 __Pyx_INCREF(
function);
1260 __Pyx_DECREF_SET(__pyx_t_2,
function);
1264 __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error)
1265 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
1267 __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error)
1269 __Pyx_GOTREF(__pyx_t_1);
1270 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1271 __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
1281 __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_v_x);
if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 21, __pyx_L1_error)
1283 __pyx_t_5 =
std::string(((
char const *)__pyx_t_4));
1285 __Pyx_CppExn2PyErr();
1286 __PYX_ERR(0, 21, __pyx_L1_error)
1288 __pyx_v_s = __pyx_t_5;
1297 __pyx_r = __pyx_v_s;
1310 __Pyx_XDECREF(__pyx_t_1);
1311 __Pyx_XDECREF(__pyx_t_2);
1312 __Pyx_XDECREF(__pyx_t_3);
1313 __Pyx_WriteUnraisable(
"pyinfile.str_py_to_cpp", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
1314 __Pyx_pretend_to_initialize(&__pyx_r);
1316 __Pyx_XDECREF(__pyx_v_x);
1317 __Pyx_RefNannyFinishContext();
1330 PyObject *__pyx_v_infile = NULL;
1331 PyObject *__pyx_v_ctx = 0;
1332 PyObject *__pyx_v_names = NULL;
1333 PyObject *__pyx_v_name = NULL;
1334 PyObject *__pyx_v_sim = NULL;
1335 PyObject *__pyx_v_Mapping = NULL;
1336 PyObject *__pyx_v_json = NULL;
1339 __Pyx_RefNannyDeclarations
1340 PyObject *__pyx_t_1 = NULL;
1341 PyObject *__pyx_t_2 = NULL;
1344 Py_ssize_t __pyx_t_5;
1345 PyObject *__pyx_t_6 = NULL;
1346 PyObject *__pyx_t_7 = NULL;
1348 __Pyx_RefNannySetupContext(
"py_to_json", 0);
1357 __pyx_t_1 = __pyx_f_8pyinfile_std_string_to_py(__pyx_v_cpp_infile);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 27, __pyx_L1_error)
1358 __Pyx_GOTREF(__pyx_t_1);
1359 __pyx_v_infile = __pyx_t_1;
1369 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_infile, __pyx_n_s_endswith);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 28, __pyx_L1_error)
1370 __Pyx_GOTREF(__pyx_t_1);
1371 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__2, NULL);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 28, __pyx_L1_error)
1372 __Pyx_GOTREF(__pyx_t_2);
1373 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1374 __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2);
if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 28, __pyx_L1_error)
1375 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1376 __pyx_t_4 = ((!__pyx_t_3) != 0);
1386 __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_infile, __pyx_kp_u_);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 29, __pyx_L1_error)
1387 __Pyx_GOTREF(__pyx_t_2);
1388 __Pyx_DECREF_SET(__pyx_v_infile, __pyx_t_2);
1407 __pyx_t_2 = PyDict_New();
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 30, __pyx_L1_error)
1408 __Pyx_GOTREF(__pyx_t_2);
1409 __pyx_v_ctx = ((PyObject*)__pyx_t_2);
1419 __pyx_t_2 = __Pyx_PyExec3(__pyx_v_infile, __pyx_v_ctx, __pyx_v_ctx);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 31, __pyx_L1_error)
1420 __Pyx_GOTREF(__pyx_t_2);
1421 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1430 __Pyx_INCREF(__pyx_tuple__3);
1431 __pyx_v_names = __pyx_tuple__3;
1440 __pyx_t_2 = __pyx_v_names; __Pyx_INCREF(__pyx_t_2); __pyx_t_5 = 0;
1442 if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_2))
break;
1443 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS 1444 __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++;
if (unlikely(0 < 0)) __PYX_ERR(0, 33, __pyx_L1_error)
1446 __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_5); __pyx_t_5++;
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 33, __pyx_L1_error)
1447 __Pyx_GOTREF(__pyx_t_1);
1449 __Pyx_XDECREF_SET(__pyx_v_name, ((PyObject*)__pyx_t_1));
1459 __pyx_t_4 = (__Pyx_PyDict_ContainsTF(__pyx_v_name, __pyx_v_ctx, Py_EQ));
if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 34, __pyx_L1_error)
1460 __pyx_t_3 = (__pyx_t_4 != 0);
1470 __pyx_t_1 = __Pyx_PyDict_GetItem(__pyx_v_ctx, __pyx_v_name);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 35, __pyx_L1_error)
1471 __Pyx_GOTREF(__pyx_t_1);
1472 __pyx_v_sim = __pyx_t_1;
1482 goto __pyx_L5_break;
1510 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__4, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L1_error)
1511 __Pyx_GOTREF(__pyx_t_1);
1512 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
1513 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1514 __PYX_ERR(0, 38, __pyx_L1_error)
1525 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1534 __pyx_t_3 = __Pyx_PyCallable_Check(__pyx_v_sim);
if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(0, 39, __pyx_L1_error)
1535 __pyx_t_4 = (__pyx_t_3 != 0);
1545 __Pyx_INCREF(__pyx_v_sim);
1546 __pyx_t_1 = __pyx_v_sim; __pyx_t_6 = NULL;
1547 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
1548 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
1549 if (likely(__pyx_t_6)) {
1550 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_1);
1551 __Pyx_INCREF(__pyx_t_6);
1552 __Pyx_INCREF(
function);
1553 __Pyx_DECREF_SET(__pyx_t_1,
function);
1557 __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_6);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 40, __pyx_L1_error)
1558 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
1560 __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 40, __pyx_L1_error)
1562 __Pyx_GOTREF(__pyx_t_2);
1563 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1564 __Pyx_DECREF_SET(__pyx_v_sim, __pyx_t_2);
1583 __pyx_t_2 = PyList_New(1);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 41, __pyx_L1_error)
1584 __Pyx_GOTREF(__pyx_t_2);
1585 __Pyx_INCREF(__pyx_n_s_Mapping);
1586 __Pyx_GIVEREF(__pyx_n_s_Mapping);
1587 PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_Mapping);
1588 __pyx_t_1 = __Pyx_Import(__pyx_n_s_collections, __pyx_t_2, 0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 41, __pyx_L1_error)
1589 __Pyx_GOTREF(__pyx_t_1);
1590 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1591 __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_Mapping);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 41, __pyx_L1_error)
1592 __Pyx_GOTREF(__pyx_t_2);
1593 __Pyx_INCREF(__pyx_t_2);
1594 __pyx_v_Mapping = __pyx_t_2;
1595 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1596 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1605 __pyx_t_4 = PyUnicode_Check(__pyx_v_sim);
1606 __pyx_t_3 = (__pyx_t_4 != 0);
1618 __pyx_t_3 = PyBytes_Check(__pyx_v_sim);
1619 __pyx_t_4 = (__pyx_t_3 != 0);
1629 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_sim, __pyx_n_s_decode);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 45, __pyx_L1_error)
1630 __Pyx_GOTREF(__pyx_t_2);
1632 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
1633 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
1634 if (likely(__pyx_t_6)) {
1635 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_2);
1636 __Pyx_INCREF(__pyx_t_6);
1637 __Pyx_INCREF(
function);
1638 __Pyx_DECREF_SET(__pyx_t_2,
function);
1642 __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_6);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error)
1643 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
1645 __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error)
1647 __Pyx_GOTREF(__pyx_t_1);
1648 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1649 __Pyx_DECREF_SET(__pyx_v_sim, __pyx_t_1);
1669 __pyx_t_4 = PyObject_IsInstance(__pyx_v_sim, __pyx_v_Mapping);
if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(0, 46, __pyx_L1_error)
1670 __pyx_t_3 = (__pyx_t_4 != 0);
1680 __pyx_t_1 = __Pyx_Import(__pyx_n_s_json, 0, 0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 47, __pyx_L1_error)
1681 __Pyx_GOTREF(__pyx_t_1);
1682 __pyx_v_json = __pyx_t_1;
1692 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_json, __pyx_n_s_dumps);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 48, __pyx_L1_error)
1693 __Pyx_GOTREF(__pyx_t_1);
1694 __pyx_t_2 = PyTuple_New(1);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 48, __pyx_L1_error)
1695 __Pyx_GOTREF(__pyx_t_2);
1696 __Pyx_INCREF(__pyx_v_sim);
1697 __Pyx_GIVEREF(__pyx_v_sim);
1698 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_sim);
1699 __pyx_t_6 = PyDict_New();
if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 48, __pyx_L1_error)
1700 __Pyx_GOTREF(__pyx_t_6);
1701 if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_sort_keys, Py_True) < 0) __PYX_ERR(0, 48, __pyx_L1_error)
1702 if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_indent, __pyx_int_1) < 0) __PYX_ERR(0, 48, __pyx_L1_error)
1703 __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_6);
if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 48, __pyx_L1_error)
1704 __Pyx_GOTREF(__pyx_t_7);
1705 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1706 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1707 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
1708 __Pyx_DECREF_SET(__pyx_v_sim, __pyx_t_7);
1729 __pyx_t_7 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__5, NULL);
if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 50, __pyx_L1_error)
1730 __Pyx_GOTREF(__pyx_t_7);
1731 __Pyx_Raise(__pyx_t_7, 0, 0, 0);
1732 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
1733 __PYX_ERR(0, 50, __pyx_L1_error)
1744 __pyx_t_8 = PyErr_CheckSignals();
if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(0, 51, __pyx_L1_error)
1753 __pyx_v_cpp_rtn = __pyx_f_8pyinfile_str_py_to_cpp(__pyx_v_sim);
1762 __pyx_r = __pyx_v_cpp_rtn;
1775 __Pyx_XDECREF(__pyx_t_1);
1776 __Pyx_XDECREF(__pyx_t_2);
1777 __Pyx_XDECREF(__pyx_t_6);
1778 __Pyx_XDECREF(__pyx_t_7);
1779 __Pyx_AddTraceback(
"pyinfile.py_to_json", __pyx_clineno, __pyx_lineno, __pyx_filename);
1780 __Pyx_pretend_to_initialize(&__pyx_r);
1782 __Pyx_XDECREF(__pyx_v_infile);
1783 __Pyx_XDECREF(__pyx_v_ctx);
1784 __Pyx_XDECREF(__pyx_v_names);
1785 __Pyx_XDECREF(__pyx_v_name);
1786 __Pyx_XDECREF(__pyx_v_sim);
1787 __Pyx_XDECREF(__pyx_v_Mapping);
1788 __Pyx_XDECREF(__pyx_v_json);
1789 __Pyx_RefNannyFinishContext();
1802 PyObject *__pyx_v_infile = NULL;
1803 PyObject *__pyx_v_json = NULL;
1804 PyObject *__pyx_v_sim = NULL;
1805 PyObject *__pyx_v_s = NULL;
1808 __Pyx_RefNannyDeclarations
1809 PyObject *__pyx_t_1 = NULL;
1810 PyObject *__pyx_t_2 = NULL;
1811 PyObject *__pyx_t_3 = NULL;
1812 PyObject *__pyx_t_4 = NULL;
1814 __Pyx_RefNannySetupContext(
"json_to_py", 0);
1823 __pyx_t_1 = __pyx_f_8pyinfile_std_string_to_py(__pyx_v_cpp_infile);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 58, __pyx_L1_error)
1824 __Pyx_GOTREF(__pyx_t_1);
1825 __pyx_v_infile = __pyx_t_1;
1835 __pyx_t_1 = __Pyx_Import(__pyx_n_s_json, 0, 0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 59, __pyx_L1_error)
1836 __Pyx_GOTREF(__pyx_t_1);
1837 __pyx_v_json = __pyx_t_1;
1847 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_json, __pyx_n_s_loads);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 60, __pyx_L1_error)
1848 __Pyx_GOTREF(__pyx_t_2);
1850 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
1851 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
1852 if (likely(__pyx_t_3)) {
1853 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_2);
1854 __Pyx_INCREF(__pyx_t_3);
1855 __Pyx_INCREF(
function);
1856 __Pyx_DECREF_SET(__pyx_t_2,
function);
1860 __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_infile);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 60, __pyx_L1_error)
1861 __Pyx_GOTREF(__pyx_t_1);
1863 #if CYTHON_FAST_PYCALL 1864 if (PyFunction_Check(__pyx_t_2)) {
1865 PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_infile};
1866 __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 60, __pyx_L1_error)
1867 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
1868 __Pyx_GOTREF(__pyx_t_1);
1871 #if CYTHON_FAST_PYCCALL 1872 if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
1873 PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_infile};
1874 __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 60, __pyx_L1_error)
1875 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
1876 __Pyx_GOTREF(__pyx_t_1);
1880 __pyx_t_4 = PyTuple_New(1+1);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 60, __pyx_L1_error)
1881 __Pyx_GOTREF(__pyx_t_4);
1882 __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
1883 __Pyx_INCREF(__pyx_v_infile);
1884 __Pyx_GIVEREF(__pyx_v_infile);
1885 PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_infile);
1886 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 60, __pyx_L1_error)
1887 __Pyx_GOTREF(__pyx_t_1);
1888 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
1891 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1892 __pyx_v_sim = __pyx_t_1;
1902 __pyx_t_5 = PyErr_CheckSignals();
if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(0, 61, __pyx_L1_error)
1911 __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_pformat);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 62, __pyx_L1_error)
1912 __Pyx_GOTREF(__pyx_t_1);
1913 __pyx_t_2 = PyTuple_New(1);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 62, __pyx_L1_error)
1914 __Pyx_GOTREF(__pyx_t_2);
1915 __Pyx_INCREF(__pyx_v_sim);
1916 __Pyx_GIVEREF(__pyx_v_sim);
1917 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_sim);
1918 __pyx_t_4 = PyDict_New();
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 62, __pyx_L1_error)
1919 __Pyx_GOTREF(__pyx_t_4);
1920 if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_indent, __pyx_int_1) < 0) __PYX_ERR(0, 62, __pyx_L1_error)
1921 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_4);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 62, __pyx_L1_error)
1922 __Pyx_GOTREF(__pyx_t_3);
1923 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1924 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
1925 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
1926 __pyx_t_4 = PyNumber_Add(__pyx_kp_u_SIMULATION_2, __pyx_t_3);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 62, __pyx_L1_error)
1927 __Pyx_GOTREF(__pyx_t_4);
1928 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
1929 __pyx_t_3 = PyNumber_Add(__pyx_t_4, __pyx_kp_u_);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 62, __pyx_L1_error)
1930 __Pyx_GOTREF(__pyx_t_3);
1931 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
1932 __pyx_v_s = __pyx_t_3;
1941 __pyx_v_cpp_rtn = __pyx_f_8pyinfile_str_py_to_cpp(__pyx_v_s);
1948 __pyx_r = __pyx_v_cpp_rtn;
1961 __Pyx_XDECREF(__pyx_t_1);
1962 __Pyx_XDECREF(__pyx_t_2);
1963 __Pyx_XDECREF(__pyx_t_3);
1964 __Pyx_XDECREF(__pyx_t_4);
1965 __Pyx_AddTraceback(
"pyinfile.json_to_py", __pyx_clineno, __pyx_lineno, __pyx_filename);
1966 __Pyx_pretend_to_initialize(&__pyx_r);
1968 __Pyx_XDECREF(__pyx_v_infile);
1969 __Pyx_XDECREF(__pyx_v_json);
1970 __Pyx_XDECREF(__pyx_v_sim);
1971 __Pyx_XDECREF(__pyx_v_s);
1972 __Pyx_RefNannyFinishContext();
1984 static CYTHON_INLINE PyObject *__pyx_convert_PyObject_string_to_py_std__in_string(
std::string const &__pyx_v_s) {
1985 PyObject *__pyx_r = NULL;
1986 __Pyx_RefNannyDeclarations
1987 PyObject *__pyx_t_1 = NULL;
1988 __Pyx_RefNannySetupContext(
"__pyx_convert_PyObject_string_to_py_std__in_string", 0);
1997 __Pyx_XDECREF(__pyx_r);
1998 __pyx_t_1 = __Pyx_PyObject_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size());
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 32, __pyx_L1_error)
1999 __Pyx_GOTREF(__pyx_t_1);
2000 __pyx_r = __pyx_t_1;
2014 __Pyx_XDECREF(__pyx_t_1);
2015 __Pyx_AddTraceback(
"string.to_py.__pyx_convert_PyObject_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
2018 __Pyx_XGIVEREF(__pyx_r);
2019 __Pyx_RefNannyFinishContext();
2031 static CYTHON_INLINE PyObject *__pyx_convert_PyUnicode_string_to_py_std__in_string(
std::string const &__pyx_v_s) {
2032 PyObject *__pyx_r = NULL;
2033 __Pyx_RefNannyDeclarations
2034 PyObject *__pyx_t_1 = NULL;
2035 __Pyx_RefNannySetupContext(
"__pyx_convert_PyUnicode_string_to_py_std__in_string", 0);
2044 __Pyx_XDECREF(__pyx_r);
2045 __pyx_t_1 = __Pyx_PyUnicode_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size());
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 38, __pyx_L1_error)
2046 __Pyx_GOTREF(__pyx_t_1);
2047 __pyx_r = __pyx_t_1;
2061 __Pyx_XDECREF(__pyx_t_1);
2062 __Pyx_AddTraceback(
"string.to_py.__pyx_convert_PyUnicode_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
2065 __Pyx_XGIVEREF(__pyx_r);
2066 __Pyx_RefNannyFinishContext();
2078 static CYTHON_INLINE PyObject *__pyx_convert_PyStr_string_to_py_std__in_string(
std::string const &__pyx_v_s) {
2079 PyObject *__pyx_r = NULL;
2080 __Pyx_RefNannyDeclarations
2081 PyObject *__pyx_t_1 = NULL;
2082 __Pyx_RefNannySetupContext(
"__pyx_convert_PyStr_string_to_py_std__in_string", 0);
2091 __Pyx_XDECREF(__pyx_r);
2092 __pyx_t_1 = __Pyx_PyStr_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size());
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 44, __pyx_L1_error)
2093 __Pyx_GOTREF(__pyx_t_1);
2094 __pyx_r = __pyx_t_1;
2108 __Pyx_XDECREF(__pyx_t_1);
2109 __Pyx_AddTraceback(
"string.to_py.__pyx_convert_PyStr_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
2112 __Pyx_XGIVEREF(__pyx_r);
2113 __Pyx_RefNannyFinishContext();
2125 static CYTHON_INLINE PyObject *__pyx_convert_PyBytes_string_to_py_std__in_string(
std::string const &__pyx_v_s) {
2126 PyObject *__pyx_r = NULL;
2127 __Pyx_RefNannyDeclarations
2128 PyObject *__pyx_t_1 = NULL;
2129 __Pyx_RefNannySetupContext(
"__pyx_convert_PyBytes_string_to_py_std__in_string", 0);
2138 __Pyx_XDECREF(__pyx_r);
2139 __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size());
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 50, __pyx_L1_error)
2140 __Pyx_GOTREF(__pyx_t_1);
2141 __pyx_r = __pyx_t_1;
2155 __Pyx_XDECREF(__pyx_t_1);
2156 __Pyx_AddTraceback(
"string.to_py.__pyx_convert_PyBytes_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
2159 __Pyx_XGIVEREF(__pyx_r);
2160 __Pyx_RefNannyFinishContext();
2172 static CYTHON_INLINE PyObject *__pyx_convert_PyByteArray_string_to_py_std__in_string(
std::string const &__pyx_v_s) {
2173 PyObject *__pyx_r = NULL;
2174 __Pyx_RefNannyDeclarations
2175 PyObject *__pyx_t_1 = NULL;
2176 __Pyx_RefNannySetupContext(
"__pyx_convert_PyByteArray_string_to_py_std__in_string", 0);
2184 __Pyx_XDECREF(__pyx_r);
2185 __pyx_t_1 = __Pyx_PyByteArray_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size());
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 56, __pyx_L1_error)
2186 __Pyx_GOTREF(__pyx_t_1);
2187 __pyx_r = __pyx_t_1;
2201 __Pyx_XDECREF(__pyx_t_1);
2202 __Pyx_AddTraceback(
"string.to_py.__pyx_convert_PyByteArray_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
2205 __Pyx_XGIVEREF(__pyx_r);
2206 __Pyx_RefNannyFinishContext();
2210 static PyMethodDef __pyx_methods[] = {
2214 #if PY_MAJOR_VERSION >= 3 2215 static struct PyModuleDef __pyx_moduledef = {
2216 #if PY_VERSION_HEX < 0x03020000 2217 { PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
2219 PyModuleDef_HEAD_INIT,
2222 __pyx_k_Cyclus_Python_input_file_tools,
2232 static __Pyx_StringTabEntry __pyx_string_tab[] = {
2233 {&__pyx_kp_u_, __pyx_k_,
sizeof(__pyx_k_), 0, 1, 0, 0},
2234 {&__pyx_n_s_ImportError, __pyx_k_ImportError,
sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
2235 {&__pyx_n_s_Mapping, __pyx_k_Mapping,
sizeof(__pyx_k_Mapping), 0, 0, 1, 1},
2236 {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError,
sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1},
2237 {&__pyx_n_u_SIMULATION, __pyx_k_SIMULATION,
sizeof(__pyx_k_SIMULATION), 0, 1, 0, 1},
2238 {&__pyx_kp_u_SIMULATION_2, __pyx_k_SIMULATION_2,
sizeof(__pyx_k_SIMULATION_2), 0, 1, 0, 0},
2239 {&__pyx_n_u_Simulation, __pyx_k_Simulation,
sizeof(__pyx_k_Simulation), 0, 1, 0, 1},
2240 {&__pyx_n_s_builtins, __pyx_k_builtins,
sizeof(__pyx_k_builtins), 0, 0, 1, 1},
2241 {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback,
sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
2242 {&__pyx_n_s_collections, __pyx_k_collections,
sizeof(__pyx_k_collections), 0, 0, 1, 1},
2243 {&__pyx_n_s_decode, __pyx_k_decode,
sizeof(__pyx_k_decode), 0, 0, 1, 1},
2244 {&__pyx_n_s_dumps, __pyx_k_dumps,
sizeof(__pyx_k_dumps), 0, 0, 1, 1},
2245 {&__pyx_n_s_encode, __pyx_k_encode,
sizeof(__pyx_k_encode), 0, 0, 1, 1},
2246 {&__pyx_n_s_endswith, __pyx_k_endswith,
sizeof(__pyx_k_endswith), 0, 0, 1, 1},
2247 {&__pyx_n_s_import, __pyx_k_import,
sizeof(__pyx_k_import), 0, 0, 1, 1},
2248 {&__pyx_n_s_indent, __pyx_k_indent,
sizeof(__pyx_k_indent), 0, 0, 1, 1},
2249 {&__pyx_n_s_json, __pyx_k_json,
sizeof(__pyx_k_json), 0, 0, 1, 1},
2250 {&__pyx_n_s_loads, __pyx_k_loads,
sizeof(__pyx_k_loads), 0, 0, 1, 1},
2251 {&__pyx_n_s_main, __pyx_k_main,
sizeof(__pyx_k_main), 0, 0, 1, 1},
2252 {&__pyx_n_s_pformat, __pyx_k_pformat,
sizeof(__pyx_k_pformat), 0, 0, 1, 1},
2253 {&__pyx_n_s_pprint, __pyx_k_pprint,
sizeof(__pyx_k_pprint), 0, 0, 1, 1},
2254 {&__pyx_n_s_pprintpp, __pyx_k_pprintpp,
sizeof(__pyx_k_pprintpp), 0, 0, 1, 1},
2255 {&__pyx_n_u_simulation, __pyx_k_simulation,
sizeof(__pyx_k_simulation), 0, 1, 0, 1},
2256 {&__pyx_kp_u_simulation_not_found_in_python_f, __pyx_k_simulation_not_found_in_python_f,
sizeof(__pyx_k_simulation_not_found_in_python_f), 0, 1, 0, 0},
2257 {&__pyx_n_s_sort_keys, __pyx_k_sort_keys,
sizeof(__pyx_k_sort_keys), 0, 0, 1, 1},
2258 {&__pyx_n_s_test, __pyx_k_test,
sizeof(__pyx_k_test), 0, 0, 1, 1},
2259 {&__pyx_kp_u_top_level_simulation_object_does, __pyx_k_top_level_simulation_object_does,
sizeof(__pyx_k_top_level_simulation_object_does), 0, 1, 0, 0},
2260 {0, 0, 0, 0, 0, 0, 0}
2262 static int __Pyx_InitCachedBuiltins(
void) {
2263 __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError);
if (!__pyx_builtin_ImportError) __PYX_ERR(0, 8, __pyx_L1_error)
2264 __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError);
if (!__pyx_builtin_RuntimeError) __PYX_ERR(0, 38, __pyx_L1_error)
2270 static int __Pyx_InitCachedConstants(
void) {
2271 __Pyx_RefNannyDeclarations
2272 __Pyx_RefNannySetupContext(
"__Pyx_InitCachedConstants", 0);
2281 __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_);
if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 28, __pyx_L1_error)
2282 __Pyx_GOTREF(__pyx_tuple__2);
2283 __Pyx_GIVEREF(__pyx_tuple__2);
2292 __pyx_tuple__3 = PyTuple_Pack(3, __pyx_n_u_simulation, __pyx_n_u_SIMULATION, __pyx_n_u_Simulation);
if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 32, __pyx_L1_error)
2293 __Pyx_GOTREF(__pyx_tuple__3);
2294 __Pyx_GIVEREF(__pyx_tuple__3);
2303 __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_u_simulation_not_found_in_python_f);
if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 38, __pyx_L1_error)
2304 __Pyx_GOTREF(__pyx_tuple__4);
2305 __Pyx_GIVEREF(__pyx_tuple__4);
2314 __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_u_top_level_simulation_object_does);
if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 50, __pyx_L1_error)
2315 __Pyx_GOTREF(__pyx_tuple__5);
2316 __Pyx_GIVEREF(__pyx_tuple__5);
2317 __Pyx_RefNannyFinishContext();
2320 __Pyx_RefNannyFinishContext();
2324 static int __Pyx_InitGlobals(
void) {
2325 if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
2326 __pyx_int_1 = PyInt_FromLong(1);
if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
2332 #if PY_MAJOR_VERSION < 3 2336 PyMODINIT_FUNC PyInit_pyinfile(
void);
2337 PyMODINIT_FUNC PyInit_pyinfile(
void)
2340 PyObject *__pyx_t_1 = NULL;
2341 PyObject *__pyx_t_2 = NULL;
2342 PyObject *__pyx_t_3 = NULL;
2343 PyObject *__pyx_t_4 = NULL;
2344 PyObject *__pyx_t_5 = NULL;
2346 PyObject *__pyx_t_7 = NULL;
2347 PyObject *__pyx_t_8 = NULL;
2348 PyObject *__pyx_t_9 = NULL;
2349 __Pyx_RefNannyDeclarations
2351 __Pyx_RefNanny = __Pyx_RefNannyImportAPI(
"refnanny");
2352 if (!__Pyx_RefNanny) {
2354 __Pyx_RefNanny = __Pyx_RefNannyImportAPI(
"Cython.Runtime.refnanny");
2355 if (!__Pyx_RefNanny)
2356 Py_FatalError(
"failed to import 'refnanny' module");
2359 __Pyx_RefNannySetupContext(
"PyMODINIT_FUNC PyInit_pyinfile(void)", 0);
2360 if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2361 __pyx_empty_tuple = PyTuple_New(0);
if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
2362 __pyx_empty_bytes = PyBytes_FromStringAndSize(
"", 0);
if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
2363 __pyx_empty_unicode = PyUnicode_FromStringAndSize(
"", 0);
if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
2364 #ifdef __Pyx_CyFunction_USED 2365 if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2367 #ifdef __Pyx_FusedFunction_USED 2368 if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2370 #ifdef __Pyx_Coroutine_USED 2371 if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2373 #ifdef __Pyx_Generator_USED 2374 if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2376 #ifdef __Pyx_StopAsyncIteration_USED 2377 if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2381 #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS 2383 PyEval_InitThreads();
2387 #if PY_MAJOR_VERSION < 3 2388 __pyx_m = Py_InitModule4(
"pyinfile", __pyx_methods, __pyx_k_Cyclus_Python_input_file_tools, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
2390 __pyx_m = PyModule_Create(&__pyx_moduledef);
2392 if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
2393 __pyx_d = PyModule_GetDict(__pyx_m);
if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
2395 __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME);
if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
2396 __pyx_cython_runtime = PyImport_AddModule((
char *)
"cython_runtime");
if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
2397 #if CYTHON_COMPILING_IN_PYPY 2400 if (PyObject_SetAttrString(__pyx_m,
"__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
2402 if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2403 #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) 2404 if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2406 if (__pyx_module_is_main_pyinfile) {
2407 if (PyObject_SetAttrString(__pyx_m,
"__name__", __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2409 #if PY_MAJOR_VERSION >= 3 2411 PyObject *modules = PyImport_GetModuleDict();
if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
2412 if (!PyDict_GetItemString(modules,
"pyinfile")) {
2413 if (unlikely(PyDict_SetItemString(modules,
"pyinfile", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
2418 if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2420 if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2424 if (__Pyx_ExportFunction(
"str_py_to_cpp", (
void (*)(
void))__pyx_f_8pyinfile_str_py_to_cpp,
"std::string (PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2425 if (__Pyx_ExportFunction(
"std_string_to_py", (
void (*)(
void))__pyx_f_8pyinfile_std_string_to_py,
"PyObject *(std::string)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2426 if (__Pyx_ExportFunction(
"py_to_json", (
void (*)(
void))
CyclusPyToJson,
"std::string (std::string)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2427 if (__Pyx_ExportFunction(
"json_to_py", (
void (*)(
void))
CyclusJsonToPy,
"std::string (std::string)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2430 __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME,
"type",
2431 #
if CYTHON_COMPILING_IN_PYPY
2432 sizeof(PyTypeObject),
2434 sizeof(PyHeapTypeObject),
2436 0);
if (unlikely(!__pyx_ptype_7cpython_4type_type)) __PYX_ERR(2, 9, __pyx_L1_error)
2440 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) 2441 if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2452 __Pyx_PyThreadState_declare
2453 __Pyx_PyThreadState_assign
2454 __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
2455 __Pyx_XGOTREF(__pyx_t_1);
2456 __Pyx_XGOTREF(__pyx_t_2);
2457 __Pyx_XGOTREF(__pyx_t_3);
2467 __pyx_t_4 = PyList_New(1);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 7, __pyx_L2_error)
2468 __Pyx_GOTREF(__pyx_t_4);
2469 __Pyx_INCREF(__pyx_n_s_pformat);
2470 __Pyx_GIVEREF(__pyx_n_s_pformat);
2471 PyList_SET_ITEM(__pyx_t_4, 0, __pyx_n_s_pformat);
2472 __pyx_t_5 = __Pyx_Import(__pyx_n_s_pprintpp, __pyx_t_4, 0);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 7, __pyx_L2_error)
2473 __Pyx_GOTREF(__pyx_t_5);
2474 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2475 __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_5, __pyx_n_s_pformat);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 7, __pyx_L2_error)
2476 __Pyx_GOTREF(__pyx_t_4);
2477 if (PyDict_SetItem(__pyx_d, __pyx_n_s_pformat, __pyx_t_4) < 0) __PYX_ERR(0, 7, __pyx_L2_error)
2478 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2479 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2489 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
2490 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
2491 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
2492 goto __pyx_L7_try_end;
2494 __Pyx_PyThreadState_assign
2495 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
2496 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
2505 __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ImportError);
2507 __Pyx_AddTraceback(
"pyinfile", __pyx_clineno, __pyx_lineno, __pyx_filename);
2508 if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_7) < 0) __PYX_ERR(0, 8, __pyx_L4_except_error)
2509 __Pyx_GOTREF(__pyx_t_5);
2510 __Pyx_GOTREF(__pyx_t_4);
2511 __Pyx_GOTREF(__pyx_t_7);
2520 __pyx_t_8 = PyList_New(1);
if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 9, __pyx_L4_except_error)
2521 __Pyx_GOTREF(__pyx_t_8);
2522 __Pyx_INCREF(__pyx_n_s_pformat);
2523 __Pyx_GIVEREF(__pyx_n_s_pformat);
2524 PyList_SET_ITEM(__pyx_t_8, 0, __pyx_n_s_pformat);
2525 __pyx_t_9 = __Pyx_Import(__pyx_n_s_pprint, __pyx_t_8, 0);
if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 9, __pyx_L4_except_error)
2526 __Pyx_GOTREF(__pyx_t_9);
2527 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
2528 __pyx_t_8 = __Pyx_ImportFrom(__pyx_t_9, __pyx_n_s_pformat);
if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 9, __pyx_L4_except_error)
2529 __Pyx_GOTREF(__pyx_t_8);
2530 if (PyDict_SetItem(__pyx_d, __pyx_n_s_pformat, __pyx_t_8) < 0) __PYX_ERR(0, 9, __pyx_L4_except_error)
2531 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
2532 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
2533 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2534 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2535 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
2536 goto __pyx_L3_exception_handled;
2538 goto __pyx_L4_except_error;
2539 __pyx_L4_except_error:;
2548 __Pyx_PyThreadState_assign
2549 __Pyx_XGIVEREF(__pyx_t_1);
2550 __Pyx_XGIVEREF(__pyx_t_2);
2551 __Pyx_XGIVEREF(__pyx_t_3);
2552 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
2553 goto __pyx_L1_error;
2554 __pyx_L3_exception_handled:;
2555 __Pyx_PyThreadState_assign
2556 __Pyx_XGIVEREF(__pyx_t_1);
2557 __Pyx_XGIVEREF(__pyx_t_2);
2558 __Pyx_XGIVEREF(__pyx_t_3);
2559 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
2568 __pyx_t_7 = PyDict_New();
if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1, __pyx_L1_error)
2569 __Pyx_GOTREF(__pyx_t_7);
2570 if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_7) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2571 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
2585 __Pyx_XDECREF(__pyx_t_4);
2586 __Pyx_XDECREF(__pyx_t_5);
2587 __Pyx_XDECREF(__pyx_t_7);
2588 __Pyx_XDECREF(__pyx_t_8);
2589 __Pyx_XDECREF(__pyx_t_9);
2592 __Pyx_AddTraceback(
"init pyinfile", 0, __pyx_lineno, __pyx_filename);
2594 Py_DECREF(__pyx_m); __pyx_m = 0;
2595 }
else if (!PyErr_Occurred()) {
2596 PyErr_SetString(PyExc_ImportError,
"init pyinfile");
2599 __Pyx_RefNannyFinishContext();
2600 #if PY_MAJOR_VERSION < 3 2610 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(
const char *modname) {
2611 PyObject *m = NULL, *p = NULL;
2613 m = PyImport_ImportModule((
char *)modname);
2615 p = PyObject_GetAttrString(m, (
char *)
"RefNannyAPI");
2617 r = PyLong_AsVoidPtr(p);
2621 return (__Pyx_RefNannyAPIStruct *)r;
2626 static PyObject *__Pyx_GetBuiltinName(PyObject *
name) {
2627 PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
2628 if (unlikely(!result)) {
2629 PyErr_Format(PyExc_NameError,
2630 #
if PY_MAJOR_VERSION >= 3
2631 "name '%U' is not defined", name);
2633 "name '%.200s' is not defined", PyString_AS_STRING(name));
2640 #if CYTHON_FAST_PYCCALL 2641 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
2642 PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
2643 PyCFunction meth = PyCFunction_GET_FUNCTION(func);
2644 PyObject *
self = PyCFunction_GET_SELF(func);
2645 int flags = PyCFunction_GET_FLAGS(func);
2646 assert(PyCFunction_Check(func));
2647 assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS)));
2649 assert(nargs == 0 || args != NULL);
2653 assert(!PyErr_Occurred());
2654 if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
2655 return (*((__Pyx_PyCFunctionFastWithKeywords)meth)) (
self, args, nargs, NULL);
2657 return (*((__Pyx_PyCFunctionFast)meth)) (
self, args, nargs);
2663 #if CYTHON_FAST_PYCALL 2664 #include "frameobject.h" 2665 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
2666 PyObject *globals) {
2668 PyThreadState *tstate = PyThreadState_GET();
2669 PyObject **fastlocals;
2672 assert(globals != NULL);
2677 assert(tstate != NULL);
2678 f = PyFrame_New(tstate, co, globals, NULL);
2682 fastlocals = f->f_localsplus;
2683 for (i = 0; i < na; i++) {
2685 fastlocals[i] = *args++;
2687 result = PyEval_EvalFrameEx(f,0);
2688 ++tstate->recursion_depth;
2690 --tstate->recursion_depth;
2693 #if 1 || PY_VERSION_HEX < 0x030600B1 2694 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args,
int nargs, PyObject *kwargs) {
2695 PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
2696 PyObject *globals = PyFunction_GET_GLOBALS(func);
2697 PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
2699 #if PY_MAJOR_VERSION >= 3 2702 PyObject *kwtuple, **k;
2707 assert(kwargs == NULL || PyDict_Check(kwargs));
2708 nk = kwargs ? PyDict_Size(kwargs) : 0;
2709 if (Py_EnterRecursiveCall((
char*)
" while calling a Python object")) {
2713 #
if PY_MAJOR_VERSION >= 3
2714 co->co_kwonlyargcount == 0 &&
2716 likely(kwargs == NULL || nk == 0) &&
2717 co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
2718 if (argdefs == NULL && co->co_argcount == nargs) {
2719 result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
2722 else if (nargs == 0 && argdefs != NULL
2723 && co->co_argcount == Py_SIZE(argdefs)) {
2726 args = &PyTuple_GET_ITEM(argdefs, 0);
2727 result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
2731 if (kwargs != NULL) {
2733 kwtuple = PyTuple_New(2 * nk);
2734 if (kwtuple == NULL) {
2738 k = &PyTuple_GET_ITEM(kwtuple, 0);
2740 while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
2751 closure = PyFunction_GET_CLOSURE(func);
2752 #if PY_MAJOR_VERSION >= 3 2753 kwdefs = PyFunction_GET_KW_DEFAULTS(func);
2755 if (argdefs != NULL) {
2756 d = &PyTuple_GET_ITEM(argdefs, 0);
2757 nd = Py_SIZE(argdefs);
2763 #if PY_MAJOR_VERSION >= 3 2764 result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
2767 d, (
int)nd, kwdefs, closure);
2769 result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
2772 d, (
int)nd, closure);
2774 Py_XDECREF(kwtuple);
2776 Py_LeaveRecursiveCall();
2783 #if CYTHON_COMPILING_IN_CPYTHON 2784 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
2786 ternaryfunc call = func->ob_type->tp_call;
2787 if (unlikely(!call))
2788 return PyObject_Call(func, arg, kw);
2789 if (unlikely(Py_EnterRecursiveCall((
char*)
" while calling a Python object")))
2791 result = (*call)(func, arg, kw);
2792 Py_LeaveRecursiveCall();
2793 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
2796 "NULL result without error in PyObject_Call");
2803 #if CYTHON_COMPILING_IN_CPYTHON 2804 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
2805 PyObject *
self, *result;
2807 cfunc = PyCFunction_GET_FUNCTION(func);
2808 self = PyCFunction_GET_SELF(func);
2809 if (unlikely(Py_EnterRecursiveCall((
char*)
" while calling a Python object")))
2811 result = cfunc(
self, arg);
2812 Py_LeaveRecursiveCall();
2813 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
2816 "NULL result without error in PyObject_Call");
2823 #if CYTHON_COMPILING_IN_CPYTHON 2824 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
2826 PyObject *args = PyTuple_New(1);
2827 if (unlikely(!args))
return NULL;
2829 PyTuple_SET_ITEM(args, 0, arg);
2830 result = __Pyx_PyObject_Call(func, args, NULL);
2834 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
2835 #if CYTHON_FAST_PYCALL 2836 if (PyFunction_Check(func)) {
2837 return __Pyx_PyFunction_FastCall(func, &arg, 1);
2840 if (likely(PyCFunction_Check(func))) {
2841 if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
2842 return __Pyx_PyObject_CallMethO(func, arg);
2843 #if CYTHON_FAST_PYCCALL 2844 }
else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
2845 return __Pyx_PyCFunction_FastCall(func, &arg, 1);
2849 return __Pyx__PyObject_CallOneArg(func, arg);
2852 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
2854 PyObject *args = PyTuple_Pack(1, arg);
2855 if (unlikely(!args))
return NULL;
2856 result = __Pyx_PyObject_Call(func, args, NULL);
2863 #if CYTHON_COMPILING_IN_CPYTHON 2864 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
2865 #if CYTHON_FAST_PYCALL 2866 if (PyFunction_Check(func)) {
2867 return __Pyx_PyFunction_FastCall(func, NULL, 0);
2870 #ifdef __Pyx_CyFunction_USED 2871 if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
2873 if (likely(PyCFunction_Check(func))) {
2875 if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
2876 return __Pyx_PyObject_CallMethO(func, NULL);
2879 return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
2884 #if CYTHON_FAST_THREAD_STATE 2885 static CYTHON_INLINE
void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
2886 PyObject *tmp_type, *tmp_value, *tmp_tb;
2887 tmp_type = tstate->curexc_type;
2888 tmp_value = tstate->curexc_value;
2889 tmp_tb = tstate->curexc_traceback;
2890 tstate->curexc_type = type;
2891 tstate->curexc_value = value;
2892 tstate->curexc_traceback = tb;
2893 Py_XDECREF(tmp_type);
2894 Py_XDECREF(tmp_value);
2897 static CYTHON_INLINE
void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
2898 *type = tstate->curexc_type;
2899 *value = tstate->curexc_value;
2900 *tb = tstate->curexc_traceback;
2901 tstate->curexc_type = 0;
2902 tstate->curexc_value = 0;
2903 tstate->curexc_traceback = 0;
2908 static void __Pyx_WriteUnraisable(
const char *
name, CYTHON_UNUSED
int clineno,
2909 CYTHON_UNUSED
int lineno, CYTHON_UNUSED
const char *filename,
2910 int full_traceback, CYTHON_UNUSED
int nogil) {
2911 PyObject *old_exc, *old_val, *old_tb;
2913 __Pyx_PyThreadState_declare
2915 PyGILState_STATE state;
2917 state = PyGILState_Ensure();
2919 else state = (PyGILState_STATE)-1;
2922 __Pyx_PyThreadState_assign
2923 __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
2924 if (full_traceback) {
2925 Py_XINCREF(old_exc);
2926 Py_XINCREF(old_val);
2928 __Pyx_ErrRestore(old_exc, old_val, old_tb);
2931 #if PY_MAJOR_VERSION < 3 2932 ctx = PyString_FromString(name);
2934 ctx = PyUnicode_FromString(name);
2936 __Pyx_ErrRestore(old_exc, old_val, old_tb);
2938 PyErr_WriteUnraisable(Py_None);
2940 PyErr_WriteUnraisable(ctx);
2945 PyGILState_Release(state);
2950 static CYTHON_INLINE PyObject* __Pyx_PyExec2(PyObject* o, PyObject* globals) {
2951 return __Pyx_PyExec3(o, globals, NULL);
2953 static PyObject* __Pyx_PyExec3(PyObject* o, PyObject* globals, PyObject* locals) {
2957 if (!globals || globals == Py_None) {
2959 }
else if (!PyDict_Check(globals)) {
2960 PyErr_Format(PyExc_TypeError,
"exec() arg 2 must be a dict, not %.200s",
2961 Py_TYPE(globals)->tp_name);
2964 if (!locals || locals == Py_None) {
2967 if (PyDict_GetItem(globals, __pyx_n_s_builtins) == NULL) {
2968 if (PyDict_SetItem(globals, __pyx_n_s_builtins, PyEval_GetBuiltins()) < 0)
2971 if (PyCode_Check(o)) {
2972 if (__Pyx_PyCode_HasFreeVars((PyCodeObject *)o)) {
2973 PyErr_SetString(PyExc_TypeError,
2974 "code object passed to exec() may not contain free variables");
2977 #if CYTHON_COMPILING_IN_PYPY || PY_VERSION_HEX < 0x030200B1 2978 result = PyEval_EvalCode((PyCodeObject *)o, globals, locals);
2980 result = PyEval_EvalCode(o, globals, locals);
2985 if (PyUnicode_Check(o)) {
2986 cf.cf_flags = PyCF_SOURCE_IS_UTF8;
2987 s = PyUnicode_AsUTF8String(o);
2990 #if PY_MAJOR_VERSION >= 3 2991 }
else if (!PyBytes_Check(o)) {
2993 }
else if (!PyString_Check(o)) {
2995 PyErr_Format(PyExc_TypeError,
2996 "exec: arg 1 must be string, bytes or code object, got %.200s",
2997 Py_TYPE(o)->tp_name);
3000 #if PY_MAJOR_VERSION >= 3 3001 code = PyBytes_AS_STRING(o);
3003 code = PyString_AS_STRING(o);
3005 if (PyEval_MergeCompilerFlags(&cf)) {
3006 result = PyRun_StringFlags(code, Py_file_input, globals, locals, &cf);
3008 result = PyRun_String(code, Py_file_input, globals, locals);
3019 #if PY_MAJOR_VERSION < 3 3020 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
3021 CYTHON_UNUSED PyObject *cause) {
3022 __Pyx_PyThreadState_declare
3024 if (!value || value == Py_None)
3028 if (!tb || tb == Py_None)
3032 if (!PyTraceBack_Check(tb)) {
3033 PyErr_SetString(PyExc_TypeError,
3034 "raise: arg 3 must be a traceback or None");
3038 if (PyType_Check(type)) {
3039 #if CYTHON_COMPILING_IN_PYPY 3045 PyErr_NormalizeException(&type, &value, &tb);
3048 PyErr_SetString(PyExc_TypeError,
3049 "instance exception may not have a separate value");
3053 type = (PyObject*) Py_TYPE(type);
3055 if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
3056 PyErr_SetString(PyExc_TypeError,
3057 "raise: exception class must be a subclass of BaseException");
3061 __Pyx_PyThreadState_assign
3062 __Pyx_ErrRestore(type, value, tb);
3071 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
3072 PyObject* owned_instance = NULL;
3073 if (tb == Py_None) {
3075 }
else if (tb && !PyTraceBack_Check(tb)) {
3076 PyErr_SetString(PyExc_TypeError,
3077 "raise: arg 3 must be a traceback or None");
3080 if (value == Py_None)
3082 if (PyExceptionInstance_Check(type)) {
3084 PyErr_SetString(PyExc_TypeError,
3085 "instance exception may not have a separate value");
3089 type = (PyObject*) Py_TYPE(value);
3090 }
else if (PyExceptionClass_Check(type)) {
3091 PyObject *instance_class = NULL;
3092 if (value && PyExceptionInstance_Check(value)) {
3093 instance_class = (PyObject*) Py_TYPE(value);
3094 if (instance_class != type) {
3095 int is_subclass = PyObject_IsSubclass(instance_class, type);
3097 instance_class = NULL;
3098 }
else if (unlikely(is_subclass == -1)) {
3101 type = instance_class;
3105 if (!instance_class) {
3108 args = PyTuple_New(0);
3109 else if (PyTuple_Check(value)) {
3113 args = PyTuple_Pack(1, value);
3116 owned_instance = PyObject_Call(type, args, NULL);
3118 if (!owned_instance)
3120 value = owned_instance;
3121 if (!PyExceptionInstance_Check(value)) {
3122 PyErr_Format(PyExc_TypeError,
3123 "calling %R should have returned an instance of " 3124 "BaseException, not %R",
3125 type, Py_TYPE(value));
3130 PyErr_SetString(PyExc_TypeError,
3131 "raise: exception class must be a subclass of BaseException");
3134 #if PY_VERSION_HEX >= 0x03030000 3137 if (cause && cause != Py_None) {
3139 PyObject *fixed_cause;
3140 if (cause == Py_None) {
3142 }
else if (PyExceptionClass_Check(cause)) {
3143 fixed_cause = PyObject_CallObject(cause, NULL);
3144 if (fixed_cause == NULL)
3146 }
else if (PyExceptionInstance_Check(cause)) {
3147 fixed_cause = cause;
3148 Py_INCREF(fixed_cause);
3150 PyErr_SetString(PyExc_TypeError,
3151 "exception causes must derive from " 3155 PyException_SetCause(value, fixed_cause);
3157 PyErr_SetObject(type, value);
3159 #if CYTHON_COMPILING_IN_PYPY 3160 PyObject *tmp_type, *tmp_value, *tmp_tb;
3161 PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
3163 PyErr_Restore(tmp_type, tmp_value, tb);
3166 PyThreadState *tstate = PyThreadState_GET();
3167 PyObject* tmp_tb = tstate->curexc_traceback;
3170 tstate->curexc_traceback = tb;
3176 Py_XDECREF(owned_instance);
3182 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list,
int level) {
3183 PyObject *empty_list = 0;
3184 PyObject *module = 0;
3185 PyObject *global_dict = 0;
3186 PyObject *empty_dict = 0;
3188 #if PY_VERSION_HEX < 0x03030000 3189 PyObject *py_import;
3190 py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
3197 empty_list = PyList_New(0);
3202 global_dict = PyModule_GetDict(__pyx_m);
3205 empty_dict = PyDict_New();
3209 #if PY_MAJOR_VERSION >= 3 3211 if (strchr(__Pyx_MODULE_NAME,
'.')) {
3212 #if PY_VERSION_HEX < 0x03030000 3213 PyObject *py_level = PyInt_FromLong(1);
3216 module = PyObject_CallFunctionObjArgs(py_import,
3217 name, global_dict, empty_dict, list, py_level, NULL);
3218 Py_DECREF(py_level);
3220 module = PyImport_ImportModuleLevelObject(
3221 name, global_dict, empty_dict, list, 1);
3224 if (!PyErr_ExceptionMatches(PyExc_ImportError))
3233 #if PY_VERSION_HEX < 0x03030000 3234 PyObject *py_level = PyInt_FromLong(level);
3237 module = PyObject_CallFunctionObjArgs(py_import,
3238 name, global_dict, empty_dict, list, py_level, NULL);
3239 Py_DECREF(py_level);
3241 module = PyImport_ImportModuleLevelObject(
3242 name, global_dict, empty_dict, list, level);
3247 #if PY_VERSION_HEX < 0x03030000 3248 Py_XDECREF(py_import);
3250 Py_XDECREF(empty_list);
3251 Py_XDECREF(empty_dict);
3256 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
3257 PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
3258 if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
3259 PyErr_Format(PyExc_ImportError,
3260 #
if PY_MAJOR_VERSION < 3
3261 "cannot import name %.230s", PyString_AS_STRING(name));
3263 "cannot import name %S",
name);
3270 static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
3272 #if !CYTHON_AVOID_BORROWED_REFS 3273 result = PyDict_GetItem(__pyx_d, name);
3274 if (likely(result)) {
3278 result = PyObject_GetItem(__pyx_d, name);
3282 result = __Pyx_GetBuiltinName(name);
3288 #if CYTHON_FAST_THREAD_STATE 3289 static CYTHON_INLINE
void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
3290 *type = tstate->exc_type;
3291 *value = tstate->exc_value;
3292 *tb = tstate->exc_traceback;
3297 static CYTHON_INLINE
void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
3298 PyObject *tmp_type, *tmp_value, *tmp_tb;
3299 tmp_type = tstate->exc_type;
3300 tmp_value = tstate->exc_value;
3301 tmp_tb = tstate->exc_traceback;
3302 tstate->exc_type = type;
3303 tstate->exc_value = value;
3304 tstate->exc_traceback = tb;
3305 Py_XDECREF(tmp_type);
3306 Py_XDECREF(tmp_value);
3312 #if CYTHON_FAST_THREAD_STATE 3313 static CYTHON_INLINE
int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
3314 PyObject *exc_type = tstate->curexc_type;
3315 if (exc_type == err)
return 1;
3316 if (unlikely(!exc_type))
return 0;
3317 return PyErr_GivenExceptionMatches(exc_type, err);
3322 #if CYTHON_FAST_THREAD_STATE 3323 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
3325 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
3327 PyObject *local_type, *local_value, *local_tb;
3328 #if CYTHON_FAST_THREAD_STATE 3329 PyObject *tmp_type, *tmp_value, *tmp_tb;
3330 local_type = tstate->curexc_type;
3331 local_value = tstate->curexc_value;
3332 local_tb = tstate->curexc_traceback;
3333 tstate->curexc_type = 0;
3334 tstate->curexc_value = 0;
3335 tstate->curexc_traceback = 0;
3337 PyErr_Fetch(&local_type, &local_value, &local_tb);
3339 PyErr_NormalizeException(&local_type, &local_value, &local_tb);
3340 #if CYTHON_FAST_THREAD_STATE 3341 if (unlikely(tstate->curexc_type))
3343 if (unlikely(PyErr_Occurred()))
3346 #if PY_MAJOR_VERSION >= 3 3348 if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
3352 Py_XINCREF(local_tb);
3353 Py_XINCREF(local_type);
3354 Py_XINCREF(local_value);
3356 *value = local_value;
3358 #if CYTHON_FAST_THREAD_STATE 3359 tmp_type = tstate->exc_type;
3360 tmp_value = tstate->exc_value;
3361 tmp_tb = tstate->exc_traceback;
3362 tstate->exc_type = local_type;
3363 tstate->exc_value = local_value;
3364 tstate->exc_traceback = local_tb;
3365 Py_XDECREF(tmp_type);
3366 Py_XDECREF(tmp_value);
3369 PyErr_SetExcInfo(local_type, local_value, local_tb);
3376 Py_XDECREF(local_type);
3377 Py_XDECREF(local_value);
3378 Py_XDECREF(local_tb);
3383 static int __Pyx_CLineForTraceback(
int c_line) {
3384 #ifdef CYTHON_CLINE_IN_TRACEBACK 3385 return ((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0;
3387 PyObject *use_cline;
3388 #if CYTHON_COMPILING_IN_CPYTHON 3389 PyObject **cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
3390 if (likely(cython_runtime_dict)) {
3391 use_cline = PyDict_GetItem(*cython_runtime_dict, __pyx_n_s_cline_in_traceback);
3395 PyObject *ptype, *pvalue, *ptraceback;
3396 PyObject *use_cline_obj;
3397 PyErr_Fetch(&ptype, &pvalue, &ptraceback);
3398 use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
3399 if (use_cline_obj) {
3400 use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
3401 Py_DECREF(use_cline_obj);
3405 PyErr_Restore(ptype, pvalue, ptraceback);
3409 PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
3411 else if (PyObject_Not(use_cline) != 0) {
3419 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries,
int count,
int code_line) {
3420 int start = 0, mid = 0,
end = count - 1;
3421 if (
end >= 0 && code_line > entries[
end].code_line) {
3424 while (start <
end) {
3425 mid = start + (
end - start) / 2;
3426 if (code_line < entries[mid].code_line) {
3428 }
else if (code_line > entries[mid].code_line) {
3434 if (code_line <= entries[mid].code_line) {
3440 static PyCodeObject *__pyx_find_code_object(
int code_line) {
3441 PyCodeObject* code_object;
3443 if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
3446 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
3447 if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
3450 code_object = __pyx_code_cache.entries[pos].code_object;
3451 Py_INCREF(code_object);
3454 static void __pyx_insert_code_object(
int code_line, PyCodeObject* code_object) {
3456 __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
3457 if (unlikely(!code_line)) {
3460 if (unlikely(!entries)) {
3461 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*
sizeof(__Pyx_CodeObjectCacheEntry));
3462 if (likely(entries)) {
3463 __pyx_code_cache.entries = entries;
3464 __pyx_code_cache.max_count = 64;
3465 __pyx_code_cache.count = 1;
3466 entries[0].code_line = code_line;
3467 entries[0].code_object = code_object;
3468 Py_INCREF(code_object);
3472 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
3473 if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
3474 PyCodeObject* tmp = entries[pos].code_object;
3475 entries[pos].code_object = code_object;
3479 if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
3480 int new_max = __pyx_code_cache.max_count + 64;
3481 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
3482 __pyx_code_cache.entries, (
size_t)new_max*
sizeof(__Pyx_CodeObjectCacheEntry));
3483 if (unlikely(!entries)) {
3486 __pyx_code_cache.entries = entries;
3487 __pyx_code_cache.max_count = new_max;
3489 for (i=__pyx_code_cache.count; i>pos; i--) {
3490 entries[i] = entries[i-1];
3492 entries[pos].code_line = code_line;
3493 entries[pos].code_object = code_object;
3494 __pyx_code_cache.count++;
3495 Py_INCREF(code_object);
3499 #include "compile.h" 3500 #include "frameobject.h" 3501 #include "traceback.h" 3502 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
3503 const char *funcname,
int c_line,
3504 int py_line,
const char *filename) {
3505 PyCodeObject *py_code = 0;
3506 PyObject *py_srcfile = 0;
3507 PyObject *py_funcname = 0;
3508 #if PY_MAJOR_VERSION < 3 3509 py_srcfile = PyString_FromString(filename);
3511 py_srcfile = PyUnicode_FromString(filename);
3513 if (!py_srcfile)
goto bad;
3515 #if PY_MAJOR_VERSION < 3 3516 py_funcname = PyString_FromFormat(
"%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
3518 py_funcname = PyUnicode_FromFormat(
"%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
3522 #if PY_MAJOR_VERSION < 3 3523 py_funcname = PyString_FromString(funcname);
3525 py_funcname = PyUnicode_FromString(funcname);
3528 if (!py_funcname)
goto bad;
3529 py_code = __Pyx_PyCode_New(
3546 Py_DECREF(py_srcfile);
3547 Py_DECREF(py_funcname);
3550 Py_XDECREF(py_srcfile);
3551 Py_XDECREF(py_funcname);
3554 static void __Pyx_AddTraceback(
const char *funcname,
int c_line,
3555 int py_line,
const char *filename) {
3556 PyCodeObject *py_code = 0;
3557 PyFrameObject *py_frame = 0;
3559 c_line = __Pyx_CLineForTraceback(c_line);
3561 py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
3563 py_code = __Pyx_CreateCodeObjectForTraceback(
3564 funcname, c_line, py_line, filename);
3565 if (!py_code)
goto bad;
3566 __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
3568 py_frame = PyFrame_New(
3569 PyThreadState_GET(),
3574 if (!py_frame)
goto bad;
3575 __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
3576 PyTraceBack_Here(py_frame);
3578 Py_XDECREF(py_code);
3579 Py_XDECREF(py_frame);
3583 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(
long value) {
3584 const long neg_one = (long) -1, const_zero = (
long) 0;
3585 const int is_unsigned = neg_one > const_zero;
3587 if (
sizeof(
long) <
sizeof(long)) {
3588 return PyInt_FromLong((
long) value);
3589 }
else if (
sizeof(
long) <=
sizeof(
unsigned long)) {
3590 return PyLong_FromUnsignedLong((
unsigned long) value);
3591 #ifdef HAVE_LONG_LONG 3592 }
else if (
sizeof(
long) <=
sizeof(
unsigned PY_LONG_LONG)) {
3593 return PyLong_FromUnsignedLongLong((
unsigned PY_LONG_LONG) value);
3597 if (
sizeof(
long) <=
sizeof(
long)) {
3598 return PyInt_FromLong((
long) value);
3599 #ifdef HAVE_LONG_LONG 3600 }
else if (
sizeof(
long) <=
sizeof(PY_LONG_LONG)) {
3601 return PyLong_FromLongLong((PY_LONG_LONG) value);
3606 int one = 1;
int little = (int)*(
unsigned char *)&one;
3607 unsigned char *bytes = (
unsigned char *)&value;
3608 return _PyLong_FromByteArray(bytes,
sizeof(
long),
3609 little, !is_unsigned);
3614 #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ 3615 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) 3616 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ 3617 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) 3618 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ 3620 func_type value = func_value;\ 3621 if (sizeof(target_type) < sizeof(func_type)) {\ 3622 if (unlikely(value != (func_type) (target_type) value)) {\ 3623 func_type zero = 0;\ 3624 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ 3625 return (target_type) -1;\ 3626 if (is_unsigned && unlikely(value < zero))\ 3627 goto raise_neg_overflow;\ 3629 goto raise_overflow;\ 3632 return (target_type) value;\ 3636 static CYTHON_INLINE
long __Pyx_PyInt_As_long(PyObject *x) {
3637 const long neg_one = (long) -1, const_zero = (
long) 0;
3638 const int is_unsigned = neg_one > const_zero;
3639 #if PY_MAJOR_VERSION < 3 3640 if (likely(PyInt_Check(x))) {
3641 if (
sizeof(
long) <
sizeof(long)) {
3642 __PYX_VERIFY_RETURN_INT(
long,
long, PyInt_AS_LONG(x))
3644 long val = PyInt_AS_LONG(x);
3645 if (is_unsigned && unlikely(val < 0)) {
3646 goto raise_neg_overflow;
3652 if (likely(PyLong_Check(x))) {
3654 #if CYTHON_USE_PYLONG_INTERNALS 3655 const digit*
digits = ((PyLongObject*)x)->ob_digit;
3656 switch (Py_SIZE(x)) {
3657 case 0:
return (
long) 0;
3658 case 1: __PYX_VERIFY_RETURN_INT(
long, digit, digits[0])
3660 if (8 *
sizeof(
long) > 1 * PyLong_SHIFT) {
3661 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
3662 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
3663 }
else if (8 *
sizeof(
long) >= 2 * PyLong_SHIFT) {
3664 return (
long) (((((long)digits[1]) << PyLong_SHIFT) | (
long)digits[0]));
3669 if (8 *
sizeof(
long) > 2 * PyLong_SHIFT) {
3670 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
3671 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
3672 }
else if (8 *
sizeof(
long) >= 3 * PyLong_SHIFT) {
3673 return (
long) (((((((long)digits[2]) << PyLong_SHIFT) | (
long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
3678 if (8 *
sizeof(
long) > 3 * PyLong_SHIFT) {
3679 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
3680 __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])))
3681 }
else if (8 *
sizeof(
long) >= 4 * PyLong_SHIFT) {
3682 return (
long) (((((((((long)digits[3]) << PyLong_SHIFT) | (
long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (
long)digits[0]));
3688 #if CYTHON_COMPILING_IN_CPYTHON 3689 if (unlikely(Py_SIZE(x) < 0)) {
3690 goto raise_neg_overflow;
3694 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
3695 if (unlikely(result < 0))
3697 if (unlikely(result == 1))
3698 goto raise_neg_overflow;
3701 if (
sizeof(
long) <=
sizeof(
unsigned long)) {
3702 __PYX_VERIFY_RETURN_INT_EXC(
long,
unsigned long, PyLong_AsUnsignedLong(x))
3703 #ifdef HAVE_LONG_LONG 3704 }
else if (
sizeof(
long) <=
sizeof(
unsigned PY_LONG_LONG)) {
3705 __PYX_VERIFY_RETURN_INT_EXC(
long,
unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
3709 #if CYTHON_USE_PYLONG_INTERNALS 3710 const digit*
digits = ((PyLongObject*)x)->ob_digit;
3711 switch (Py_SIZE(x)) {
3712 case 0:
return (
long) 0;
3713 case -1: __PYX_VERIFY_RETURN_INT(
long, sdigit, (sdigit) (-(sdigit)digits[0]))
3714 case 1: __PYX_VERIFY_RETURN_INT(
long, digit, +digits[0])
3716 if (8 *
sizeof(
long) - 1 > 1 * PyLong_SHIFT) {
3717 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
3718 __PYX_VERIFY_RETURN_INT(
long,
long, -(
long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
3719 }
else if (8 *
sizeof(
long) - 1 > 2 * PyLong_SHIFT) {
3720 return (
long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (
long)digits[0])));
3725 if (8 *
sizeof(
long) > 1 * PyLong_SHIFT) {
3726 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
3727 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
3728 }
else if (8 *
sizeof(
long) - 1 > 2 * PyLong_SHIFT) {
3729 return (
long) ((((((long)digits[1]) << PyLong_SHIFT) | (
long)digits[0])));
3734 if (8 *
sizeof(
long) - 1 > 2 * PyLong_SHIFT) {
3735 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
3736 __PYX_VERIFY_RETURN_INT(
long,
long, -(
long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
3737 }
else if (8 *
sizeof(
long) - 1 > 3 * PyLong_SHIFT) {
3738 return (
long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (
long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
3743 if (8 *
sizeof(
long) > 2 * PyLong_SHIFT) {
3744 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
3745 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
3746 }
else if (8 *
sizeof(
long) - 1 > 3 * PyLong_SHIFT) {
3747 return (
long) ((((((((long)digits[2]) << PyLong_SHIFT) | (
long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
3752 if (8 *
sizeof(
long) - 1 > 3 * PyLong_SHIFT) {
3753 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
3754 __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])))
3755 }
else if (8 *
sizeof(
long) - 1 > 4 * PyLong_SHIFT) {
3756 return (
long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (
long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (
long)digits[0])));
3761 if (8 *
sizeof(
long) > 3 * PyLong_SHIFT) {
3762 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
3763 __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])))
3764 }
else if (8 *
sizeof(
long) - 1 > 4 * PyLong_SHIFT) {
3765 return (
long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (
long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (
long)digits[0])));
3771 if (
sizeof(
long) <=
sizeof(long)) {
3772 __PYX_VERIFY_RETURN_INT_EXC(
long,
long, PyLong_AsLong(x))
3773 #ifdef HAVE_LONG_LONG 3774 }
else if (
sizeof(
long) <=
sizeof(PY_LONG_LONG)) {
3775 __PYX_VERIFY_RETURN_INT_EXC(
long, PY_LONG_LONG, PyLong_AsLongLong(x))
3780 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) 3781 PyErr_SetString(PyExc_RuntimeError,
3782 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
3785 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
3786 #if PY_MAJOR_VERSION < 3 3787 if (likely(v) && !PyLong_Check(v)) {
3789 v = PyNumber_Long(tmp);
3794 int one = 1;
int is_little = (int)*(
unsigned char *)&one;
3795 unsigned char *bytes = (
unsigned char *)&val;
3796 int ret = _PyLong_AsByteArray((PyLongObject *)v,
3798 is_little, !is_unsigned);
3808 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
3809 if (!tmp)
return (
long) -1;
3810 val = __Pyx_PyInt_As_long(tmp);
3815 PyErr_SetString(PyExc_OverflowError,
3816 "value too large to convert to long");
3819 PyErr_SetString(PyExc_OverflowError,
3820 "can't convert negative value to long");
3825 static CYTHON_INLINE
int __Pyx_PyInt_As_int(PyObject *x) {
3826 const int neg_one = (int) -1, const_zero = (
int) 0;
3827 const int is_unsigned = neg_one > const_zero;
3828 #if PY_MAJOR_VERSION < 3 3829 if (likely(PyInt_Check(x))) {
3830 if (
sizeof(
int) <
sizeof(long)) {
3831 __PYX_VERIFY_RETURN_INT(
int,
long, PyInt_AS_LONG(x))
3833 long val = PyInt_AS_LONG(x);
3834 if (is_unsigned && unlikely(val < 0)) {
3835 goto raise_neg_overflow;
3841 if (likely(PyLong_Check(x))) {
3843 #if CYTHON_USE_PYLONG_INTERNALS 3844 const digit*
digits = ((PyLongObject*)x)->ob_digit;
3845 switch (Py_SIZE(x)) {
3846 case 0:
return (
int) 0;
3847 case 1: __PYX_VERIFY_RETURN_INT(
int, digit, digits[0])
3849 if (8 *
sizeof(
int) > 1 * PyLong_SHIFT) {
3850 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
3851 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
3852 }
else if (8 *
sizeof(
int) >= 2 * PyLong_SHIFT) {
3853 return (
int) (((((int)digits[1]) << PyLong_SHIFT) | (
int)digits[0]));
3858 if (8 *
sizeof(
int) > 2 * PyLong_SHIFT) {
3859 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
3860 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
3861 }
else if (8 *
sizeof(
int) >= 3 * PyLong_SHIFT) {
3862 return (
int) (((((((int)digits[2]) << PyLong_SHIFT) | (
int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
3867 if (8 *
sizeof(
int) > 3 * PyLong_SHIFT) {
3868 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
3869 __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])))
3870 }
else if (8 *
sizeof(
int) >= 4 * PyLong_SHIFT) {
3871 return (
int) (((((((((int)digits[3]) << PyLong_SHIFT) | (
int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (
int)digits[0]));
3877 #if CYTHON_COMPILING_IN_CPYTHON 3878 if (unlikely(Py_SIZE(x) < 0)) {
3879 goto raise_neg_overflow;
3883 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
3884 if (unlikely(result < 0))
3886 if (unlikely(result == 1))
3887 goto raise_neg_overflow;
3890 if (
sizeof(
int) <=
sizeof(
unsigned long)) {
3891 __PYX_VERIFY_RETURN_INT_EXC(
int,
unsigned long, PyLong_AsUnsignedLong(x))
3892 #ifdef HAVE_LONG_LONG 3893 }
else if (
sizeof(
int) <=
sizeof(
unsigned PY_LONG_LONG)) {
3894 __PYX_VERIFY_RETURN_INT_EXC(
int,
unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
3898 #if CYTHON_USE_PYLONG_INTERNALS 3899 const digit*
digits = ((PyLongObject*)x)->ob_digit;
3900 switch (Py_SIZE(x)) {
3901 case 0:
return (
int) 0;
3902 case -1: __PYX_VERIFY_RETURN_INT(
int, sdigit, (sdigit) (-(sdigit)digits[0]))
3903 case 1: __PYX_VERIFY_RETURN_INT(
int, digit, +digits[0])
3905 if (8 *
sizeof(
int) - 1 > 1 * PyLong_SHIFT) {
3906 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
3907 __PYX_VERIFY_RETURN_INT(
int,
long, -(
long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
3908 }
else if (8 *
sizeof(
int) - 1 > 2 * PyLong_SHIFT) {
3909 return (
int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (
int)digits[0])));
3914 if (8 *
sizeof(
int) > 1 * PyLong_SHIFT) {
3915 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
3916 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
3917 }
else if (8 *
sizeof(
int) - 1 > 2 * PyLong_SHIFT) {
3918 return (
int) ((((((int)digits[1]) << PyLong_SHIFT) | (
int)digits[0])));
3923 if (8 *
sizeof(
int) - 1 > 2 * PyLong_SHIFT) {
3924 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
3925 __PYX_VERIFY_RETURN_INT(
int,
long, -(
long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
3926 }
else if (8 *
sizeof(
int) - 1 > 3 * PyLong_SHIFT) {
3927 return (
int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (
int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
3932 if (8 *
sizeof(
int) > 2 * PyLong_SHIFT) {
3933 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
3934 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
3935 }
else if (8 *
sizeof(
int) - 1 > 3 * PyLong_SHIFT) {
3936 return (
int) ((((((((int)digits[2]) << PyLong_SHIFT) | (
int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
3941 if (8 *
sizeof(
int) - 1 > 3 * PyLong_SHIFT) {
3942 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
3943 __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])))
3944 }
else if (8 *
sizeof(
int) - 1 > 4 * PyLong_SHIFT) {
3945 return (
int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (
int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (
int)digits[0])));
3950 if (8 *
sizeof(
int) > 3 * PyLong_SHIFT) {
3951 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
3952 __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])))
3953 }
else if (8 *
sizeof(
int) - 1 > 4 * PyLong_SHIFT) {
3954 return (
int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (
int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (
int)digits[0])));
3960 if (
sizeof(
int) <=
sizeof(long)) {
3961 __PYX_VERIFY_RETURN_INT_EXC(
int,
long, PyLong_AsLong(x))
3962 #ifdef HAVE_LONG_LONG 3963 }
else if (
sizeof(
int) <=
sizeof(PY_LONG_LONG)) {
3964 __PYX_VERIFY_RETURN_INT_EXC(
int, PY_LONG_LONG, PyLong_AsLongLong(x))
3969 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) 3970 PyErr_SetString(PyExc_RuntimeError,
3971 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
3974 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
3975 #if PY_MAJOR_VERSION < 3 3976 if (likely(v) && !PyLong_Check(v)) {
3978 v = PyNumber_Long(tmp);
3983 int one = 1;
int is_little = (int)*(
unsigned char *)&one;
3984 unsigned char *bytes = (
unsigned char *)&val;
3985 int ret = _PyLong_AsByteArray((PyLongObject *)v,
3987 is_little, !is_unsigned);
3997 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
3998 if (!tmp)
return (
int) -1;
3999 val = __Pyx_PyInt_As_int(tmp);
4004 PyErr_SetString(PyExc_OverflowError,
4005 "value too large to convert to int");
4008 PyErr_SetString(PyExc_OverflowError,
4009 "can't convert negative value to int");
4014 static int __Pyx_check_binary_version(
void) {
4015 char ctversion[4], rtversion[4];
4016 PyOS_snprintf(ctversion, 4,
"%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
4017 PyOS_snprintf(rtversion, 4,
"%s", Py_GetVersion());
4018 if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
4020 PyOS_snprintf(message,
sizeof(message),
4021 "compiletime version %s of module '%.100s' " 4022 "does not match runtime version %s",
4023 ctversion, __Pyx_MODULE_NAME, rtversion);
4024 return PyErr_WarnEx(NULL, message, 1);
4030 static int __Pyx_ExportFunction(
const char *name,
void (*f)(
void),
const char *sig) {
4037 d = PyObject_GetAttrString(__pyx_m, (
char *)
"__pyx_capi__");
4044 if (PyModule_AddObject(__pyx_m, (
char *)
"__pyx_capi__", d) < 0)
4048 #if PY_VERSION_HEX >= 0x02070000 4049 cobj = PyCapsule_New(tmp.p, sig, 0);
4051 cobj = PyCObject_FromVoidPtrAndDesc(tmp.p, (
void *)sig, 0);
4055 if (PyDict_SetItemString(d, name, cobj) < 0)
4067 #ifndef __PYX_HAVE_RT_ImportModule 4068 #define __PYX_HAVE_RT_ImportModule 4069 static PyObject *__Pyx_ImportModule(
const char *name) {
4070 PyObject *py_name = 0;
4071 PyObject *py_module = 0;
4072 py_name = __Pyx_PyIdentifier_FromString(name);
4075 py_module = PyImport_Import(py_name);
4079 Py_XDECREF(py_name);
4085 #ifndef __PYX_HAVE_RT_ImportType 4086 #define __PYX_HAVE_RT_ImportType 4087 static PyTypeObject *__Pyx_ImportType(
const char *module_name,
const char *class_name,
4088 size_t size,
int strict)
4090 PyObject *py_module = 0;
4091 PyObject *result = 0;
4092 PyObject *py_name = 0;
4094 Py_ssize_t basicsize;
4095 #ifdef Py_LIMITED_API 4096 PyObject *py_basicsize;
4098 py_module = __Pyx_ImportModule(module_name);
4101 py_name = __Pyx_PyIdentifier_FromString(class_name);
4104 result = PyObject_GetAttr(py_module, py_name);
4107 Py_DECREF(py_module);
4111 if (!PyType_Check(result)) {
4112 PyErr_Format(PyExc_TypeError,
4113 "%.200s.%.200s is not a type object",
4114 module_name, class_name);
4117 #ifndef Py_LIMITED_API 4118 basicsize = ((PyTypeObject *)result)->tp_basicsize;
4120 py_basicsize = PyObject_GetAttrString(result,
"__basicsize__");
4123 basicsize = PyLong_AsSsize_t(py_basicsize);
4124 Py_DECREF(py_basicsize);
4126 if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
4129 if (!strict && (
size_t)basicsize > size) {
4130 PyOS_snprintf(warning,
sizeof(warning),
4131 "%s.%s size changed, may indicate binary incompatibility. Expected %zd, got %zd",
4132 module_name, class_name, basicsize, size);
4133 if (PyErr_WarnEx(NULL, warning, 0) < 0)
goto bad;
4135 else if ((
size_t)basicsize != size) {
4136 PyErr_Format(PyExc_ValueError,
4137 "%.200s.%.200s has the wrong size, try recompiling. Expected %zd, got %zd",
4138 module_name, class_name, basicsize, size);
4141 return (PyTypeObject *)result;
4143 Py_XDECREF(py_module);
4150 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
4152 #if PY_MAJOR_VERSION < 3 4153 if (t->is_unicode) {
4154 *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
4155 }
else if (t->intern) {
4156 *t->p = PyString_InternFromString(t->s);
4158 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
4161 if (t->is_unicode | t->is_str) {
4163 *t->p = PyUnicode_InternFromString(t->s);
4164 }
else if (t->encoding) {
4165 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
4167 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
4170 *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
4175 if (PyObject_Hash(*t->p) == -1)
4182 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(
const char* c_str) {
4183 return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
4185 static CYTHON_INLINE
const char* __Pyx_PyObject_AsString(PyObject* o) {
4187 return __Pyx_PyObject_AsStringAndSize(o, &ignore);
4189 static CYTHON_INLINE
const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
4190 #if CYTHON_COMPILING_IN_CPYTHON && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) 4192 #
if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
4193 __Pyx_sys_getdefaultencoding_not_ascii &&
4195 PyUnicode_Check(o)) {
4196 #if PY_VERSION_HEX < 0x03030000 4198 PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
4199 if (!defenc)
return NULL;
4200 defenc_c = PyBytes_AS_STRING(defenc);
4201 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 4203 char*
end = defenc_c + PyBytes_GET_SIZE(defenc);
4205 for (c = defenc_c; c <
end; c++) {
4206 if ((
unsigned char) (*c) >= 128) {
4207 PyUnicode_AsASCIIString(o);
4213 *length = PyBytes_GET_SIZE(defenc);
4216 if (__Pyx_PyUnicode_READY(o) == -1)
return NULL;
4217 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 4218 if (PyUnicode_IS_ASCII(o)) {
4219 *length = PyUnicode_GET_LENGTH(o);
4220 return PyUnicode_AsUTF8(o);
4222 PyUnicode_AsASCIIString(o);
4226 return PyUnicode_AsUTF8AndSize(o, length);
4231 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) 4232 if (PyByteArray_Check(o)) {
4233 *length = PyByteArray_GET_SIZE(o);
4234 return PyByteArray_AS_STRING(o);
4239 int r = PyBytes_AsStringAndSize(o, &result, length);
4240 if (unlikely(r < 0)) {
4247 static CYTHON_INLINE
int __Pyx_PyObject_IsTrue(PyObject* x) {
4248 int is_true = x == Py_True;
4249 if (is_true | (x == Py_False) | (x == Py_None))
return is_true;
4250 else return PyObject_IsTrue(x);
4252 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
4253 #if CYTHON_USE_TYPE_SLOTS 4256 const char *name = NULL;
4257 PyObject *res = NULL;
4258 #if PY_MAJOR_VERSION < 3 4259 if (PyInt_Check(x) || PyLong_Check(x))
4261 if (PyLong_Check(x))
4263 return __Pyx_NewRef(x);
4264 #if CYTHON_USE_TYPE_SLOTS 4265 m = Py_TYPE(x)->tp_as_number;
4266 #if PY_MAJOR_VERSION < 3 4267 if (m && m->nb_int) {
4269 res = PyNumber_Int(x);
4271 else if (m && m->nb_long) {
4273 res = PyNumber_Long(x);
4276 if (m && m->nb_int) {
4278 res = PyNumber_Long(x);
4282 res = PyNumber_Int(x);
4285 #if PY_MAJOR_VERSION < 3 4286 if (!PyInt_Check(res) && !PyLong_Check(res)) {
4288 if (!PyLong_Check(res)) {
4290 PyErr_Format(PyExc_TypeError,
4291 "__%.4s__ returned non-%.4s (type %.200s)",
4292 name, name, Py_TYPE(res)->tp_name);
4297 else if (!PyErr_Occurred()) {
4298 PyErr_SetString(PyExc_TypeError,
4299 "an integer is required");
4303 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*
b) {
4306 #if PY_MAJOR_VERSION < 3 4307 if (likely(PyInt_CheckExact(b))) {
4308 if (
sizeof(Py_ssize_t) >=
sizeof(
long))
4309 return PyInt_AS_LONG(b);
4311 return PyInt_AsSsize_t(x);
4314 if (likely(PyLong_CheckExact(b))) {
4315 #if CYTHON_USE_PYLONG_INTERNALS 4316 const digit*
digits = ((PyLongObject*)b)->ob_digit;
4317 const Py_ssize_t size = Py_SIZE(b);
4318 if (likely(__Pyx_sst_abs(size) <= 1)) {
4319 ival = likely(size) ? digits[0] : 0;
4320 if (size == -1) ival = -ival;
4325 if (8 *
sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
4326 return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (
size_t)digits[0]));
4330 if (8 *
sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
4331 return -(Py_ssize_t) (((((
size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
4335 if (8 *
sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
4336 return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (
size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
4340 if (8 *
sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
4341 return -(Py_ssize_t) (((((((
size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (
size_t)digits[0]));
4345 if (8 *
sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
4346 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]));
4350 if (8 *
sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
4351 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]));
4357 return PyLong_AsSsize_t(b);
4359 x = PyNumber_Index(b);
4361 ival = PyInt_AsSsize_t(x);
4365 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(
size_t ival) {
4366 return PyInt_FromSize_t(ival);
__PYX_EXTERN_C std::string CyclusPyToJson(std::string)
double b(int nuc)
Computes the scattering length [cm] from the coherent and incoherent components.
std::string name(int nuc)
def memset(dest, src, size)
zz_group fp
fission product Z number group
PyMODINIT_FUNC initpyinfile(void)
static std::string digits
string of digit characters
bool operator==(const CapacityConstraint< T > &lhs, const CapacityConstraint< T > &rhs)
CapacityConstraint-CapacityConstraint equality operator.
__PYX_EXTERN_C std::string CyclusJsonToPy(std::string)
void warning(std::string s)
Prints a warning message.
enable_if< has_const_iterator< T >::value, typename T::const_iterator >::type end(const T &c)