CYCLUS
Loading...
Searching...
No Matches
pyinfile.cc
Go to the documentation of this file.
1/* Generated by Cython 3.0.11 */
2
3#ifndef PY_SSIZE_T_CLEAN
4#define PY_SSIZE_T_CLEAN
5#endif /* PY_SSIZE_T_CLEAN */
6#if defined(CYTHON_LIMITED_API) && 0
7 #ifndef Py_LIMITED_API
8 #if CYTHON_LIMITED_API+0 > 0x03030000
9 #define Py_LIMITED_API CYTHON_LIMITED_API
10 #else
11 #define Py_LIMITED_API 0x03030000
12 #endif
13 #endif
14#endif
15
16#include "Python.h"
17#ifndef Py_PYTHON_H
18 #error Python headers needed to compile C extensions, please install development version of Python.
19#elif PY_VERSION_HEX < 0x02070000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
20 #error Cython requires Python 2.7+ or Python 3.3+.
21#else
22#if defined(CYTHON_LIMITED_API) && CYTHON_LIMITED_API
23#define __PYX_EXTRA_ABI_MODULE_NAME "limited"
24#else
25#define __PYX_EXTRA_ABI_MODULE_NAME ""
26#endif
27#define CYTHON_ABI "3_0_11" __PYX_EXTRA_ABI_MODULE_NAME
28#define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI
29#define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "."
30#define CYTHON_HEX_VERSION 0x03000BF0
31#define CYTHON_FUTURE_DIVISION 1
32#include <stddef.h>
33#ifndef offsetof
34 #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
35#endif
36#if !defined(_WIN32) && !defined(WIN32) && !defined(MS_WINDOWS)
37 #ifndef __stdcall
38 #define __stdcall
39 #endif
40 #ifndef __cdecl
41 #define __cdecl
42 #endif
43 #ifndef __fastcall
44 #define __fastcall
45 #endif
46#endif
47#ifndef DL_IMPORT
48 #define DL_IMPORT(t) t
49#endif
50#ifndef DL_EXPORT
51 #define DL_EXPORT(t) t
52#endif
53#define __PYX_COMMA ,
54#ifndef HAVE_LONG_LONG
55 #define HAVE_LONG_LONG
56#endif
57#ifndef PY_LONG_LONG
58 #define PY_LONG_LONG LONG_LONG
59#endif
60#ifndef Py_HUGE_VAL
61 #define Py_HUGE_VAL HUGE_VAL
62#endif
63#define __PYX_LIMITED_VERSION_HEX PY_VERSION_HEX
64#if defined(GRAALVM_PYTHON)
65 /* For very preliminary testing purposes. Most variables are set the same as PyPy.
66 The existence of this section does not imply that anything works or is even tested */
67 #define CYTHON_COMPILING_IN_PYPY 0
68 #define CYTHON_COMPILING_IN_CPYTHON 0
69 #define CYTHON_COMPILING_IN_LIMITED_API 0
70 #define CYTHON_COMPILING_IN_GRAAL 1
71 #define CYTHON_COMPILING_IN_NOGIL 0
72 #undef CYTHON_USE_TYPE_SLOTS
73 #define CYTHON_USE_TYPE_SLOTS 0
74 #undef CYTHON_USE_TYPE_SPECS
75 #define CYTHON_USE_TYPE_SPECS 0
76 #undef CYTHON_USE_PYTYPE_LOOKUP
77 #define CYTHON_USE_PYTYPE_LOOKUP 0
78 #if PY_VERSION_HEX < 0x03050000
79 #undef CYTHON_USE_ASYNC_SLOTS
80 #define CYTHON_USE_ASYNC_SLOTS 0
81 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
82 #define CYTHON_USE_ASYNC_SLOTS 1
83 #endif
84 #undef CYTHON_USE_PYLIST_INTERNALS
85 #define CYTHON_USE_PYLIST_INTERNALS 0
86 #undef CYTHON_USE_UNICODE_INTERNALS
87 #define CYTHON_USE_UNICODE_INTERNALS 0
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 #undef CYTHON_AVOID_BORROWED_REFS
93 #define CYTHON_AVOID_BORROWED_REFS 1
94 #undef CYTHON_ASSUME_SAFE_MACROS
95 #define CYTHON_ASSUME_SAFE_MACROS 0
96 #undef CYTHON_UNPACK_METHODS
97 #define CYTHON_UNPACK_METHODS 0
98 #undef CYTHON_FAST_THREAD_STATE
99 #define CYTHON_FAST_THREAD_STATE 0
100 #undef CYTHON_FAST_GIL
101 #define CYTHON_FAST_GIL 0
102 #undef CYTHON_METH_FASTCALL
103 #define CYTHON_METH_FASTCALL 0
104 #undef CYTHON_FAST_PYCALL
105 #define CYTHON_FAST_PYCALL 0
106 #ifndef CYTHON_PEP487_INIT_SUBCLASS
107 #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3)
108 #endif
109 #undef CYTHON_PEP489_MULTI_PHASE_INIT
110 #define CYTHON_PEP489_MULTI_PHASE_INIT 1
111 #undef CYTHON_USE_MODULE_STATE
112 #define CYTHON_USE_MODULE_STATE 0
113 #undef CYTHON_USE_TP_FINALIZE
114 #define CYTHON_USE_TP_FINALIZE 0
115 #undef CYTHON_USE_DICT_VERSIONS
116 #define CYTHON_USE_DICT_VERSIONS 0
117 #undef CYTHON_USE_EXC_INFO_STACK
118 #define CYTHON_USE_EXC_INFO_STACK 0
119 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
120 #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
121 #endif
122 #undef CYTHON_USE_FREELISTS
123 #define CYTHON_USE_FREELISTS 0
124#elif defined(PYPY_VERSION)
125 #define CYTHON_COMPILING_IN_PYPY 1
126 #define CYTHON_COMPILING_IN_CPYTHON 0
127 #define CYTHON_COMPILING_IN_LIMITED_API 0
128 #define CYTHON_COMPILING_IN_GRAAL 0
129 #define CYTHON_COMPILING_IN_NOGIL 0
130 #undef CYTHON_USE_TYPE_SLOTS
131 #define CYTHON_USE_TYPE_SLOTS 0
132 #ifndef CYTHON_USE_TYPE_SPECS
133 #define CYTHON_USE_TYPE_SPECS 0
134 #endif
135 #undef CYTHON_USE_PYTYPE_LOOKUP
136 #define CYTHON_USE_PYTYPE_LOOKUP 0
137 #if PY_VERSION_HEX < 0x03050000
138 #undef CYTHON_USE_ASYNC_SLOTS
139 #define CYTHON_USE_ASYNC_SLOTS 0
140 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
141 #define CYTHON_USE_ASYNC_SLOTS 1
142 #endif
143 #undef CYTHON_USE_PYLIST_INTERNALS
144 #define CYTHON_USE_PYLIST_INTERNALS 0
145 #undef CYTHON_USE_UNICODE_INTERNALS
146 #define CYTHON_USE_UNICODE_INTERNALS 0
147 #undef CYTHON_USE_UNICODE_WRITER
148 #define CYTHON_USE_UNICODE_WRITER 0
149 #undef CYTHON_USE_PYLONG_INTERNALS
150 #define CYTHON_USE_PYLONG_INTERNALS 0
151 #undef CYTHON_AVOID_BORROWED_REFS
152 #define CYTHON_AVOID_BORROWED_REFS 1
153 #undef CYTHON_ASSUME_SAFE_MACROS
154 #define CYTHON_ASSUME_SAFE_MACROS 0
155 #undef CYTHON_UNPACK_METHODS
156 #define CYTHON_UNPACK_METHODS 0
157 #undef CYTHON_FAST_THREAD_STATE
158 #define CYTHON_FAST_THREAD_STATE 0
159 #undef CYTHON_FAST_GIL
160 #define CYTHON_FAST_GIL 0
161 #undef CYTHON_METH_FASTCALL
162 #define CYTHON_METH_FASTCALL 0
163 #undef CYTHON_FAST_PYCALL
164 #define CYTHON_FAST_PYCALL 0
165 #ifndef CYTHON_PEP487_INIT_SUBCLASS
166 #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3)
167 #endif
168 #if PY_VERSION_HEX < 0x03090000
169 #undef CYTHON_PEP489_MULTI_PHASE_INIT
170 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
171 #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT)
172 #define CYTHON_PEP489_MULTI_PHASE_INIT 1
173 #endif
174 #undef CYTHON_USE_MODULE_STATE
175 #define CYTHON_USE_MODULE_STATE 0
176 #undef CYTHON_USE_TP_FINALIZE
177 #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1 && PYPY_VERSION_NUM >= 0x07030C00)
178 #undef CYTHON_USE_DICT_VERSIONS
179 #define CYTHON_USE_DICT_VERSIONS 0
180 #undef CYTHON_USE_EXC_INFO_STACK
181 #define CYTHON_USE_EXC_INFO_STACK 0
182 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
183 #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
184 #endif
185 #undef CYTHON_USE_FREELISTS
186 #define CYTHON_USE_FREELISTS 0
187#elif defined(CYTHON_LIMITED_API)
188 #ifdef Py_LIMITED_API
189 #undef __PYX_LIMITED_VERSION_HEX
190 #define __PYX_LIMITED_VERSION_HEX Py_LIMITED_API
191 #endif
192 #define CYTHON_COMPILING_IN_PYPY 0
193 #define CYTHON_COMPILING_IN_CPYTHON 0
194 #define CYTHON_COMPILING_IN_LIMITED_API 1
195 #define CYTHON_COMPILING_IN_GRAAL 0
196 #define CYTHON_COMPILING_IN_NOGIL 0
197 #undef CYTHON_CLINE_IN_TRACEBACK
198 #define CYTHON_CLINE_IN_TRACEBACK 0
199 #undef CYTHON_USE_TYPE_SLOTS
200 #define CYTHON_USE_TYPE_SLOTS 0
201 #undef CYTHON_USE_TYPE_SPECS
202 #define CYTHON_USE_TYPE_SPECS 1
203 #undef CYTHON_USE_PYTYPE_LOOKUP
204 #define CYTHON_USE_PYTYPE_LOOKUP 0
205 #undef CYTHON_USE_ASYNC_SLOTS
206 #define CYTHON_USE_ASYNC_SLOTS 0
207 #undef CYTHON_USE_PYLIST_INTERNALS
208 #define CYTHON_USE_PYLIST_INTERNALS 0
209 #undef CYTHON_USE_UNICODE_INTERNALS
210 #define CYTHON_USE_UNICODE_INTERNALS 0
211 #ifndef CYTHON_USE_UNICODE_WRITER
212 #define CYTHON_USE_UNICODE_WRITER 0
213 #endif
214 #undef CYTHON_USE_PYLONG_INTERNALS
215 #define CYTHON_USE_PYLONG_INTERNALS 0
216 #ifndef CYTHON_AVOID_BORROWED_REFS
217 #define CYTHON_AVOID_BORROWED_REFS 0
218 #endif
219 #undef CYTHON_ASSUME_SAFE_MACROS
220 #define CYTHON_ASSUME_SAFE_MACROS 0
221 #undef CYTHON_UNPACK_METHODS
222 #define CYTHON_UNPACK_METHODS 0
223 #undef CYTHON_FAST_THREAD_STATE
224 #define CYTHON_FAST_THREAD_STATE 0
225 #undef CYTHON_FAST_GIL
226 #define CYTHON_FAST_GIL 0
227 #undef CYTHON_METH_FASTCALL
228 #define CYTHON_METH_FASTCALL 0
229 #undef CYTHON_FAST_PYCALL
230 #define CYTHON_FAST_PYCALL 0
231 #ifndef CYTHON_PEP487_INIT_SUBCLASS
232 #define CYTHON_PEP487_INIT_SUBCLASS 1
233 #endif
234 #undef CYTHON_PEP489_MULTI_PHASE_INIT
235 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
236 #undef CYTHON_USE_MODULE_STATE
237 #define CYTHON_USE_MODULE_STATE 1
238 #ifndef CYTHON_USE_TP_FINALIZE
239 #define CYTHON_USE_TP_FINALIZE 0
240 #endif
241 #undef CYTHON_USE_DICT_VERSIONS
242 #define CYTHON_USE_DICT_VERSIONS 0
243 #undef CYTHON_USE_EXC_INFO_STACK
244 #define CYTHON_USE_EXC_INFO_STACK 0
245 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
246 #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
247 #endif
248 #undef CYTHON_USE_FREELISTS
249 #define CYTHON_USE_FREELISTS 0
250#elif defined(Py_GIL_DISABLED) || defined(Py_NOGIL)
251 #define CYTHON_COMPILING_IN_PYPY 0
252 #define CYTHON_COMPILING_IN_CPYTHON 0
253 #define CYTHON_COMPILING_IN_LIMITED_API 0
254 #define CYTHON_COMPILING_IN_GRAAL 0
255 #define CYTHON_COMPILING_IN_NOGIL 1
256 #ifndef CYTHON_USE_TYPE_SLOTS
257 #define CYTHON_USE_TYPE_SLOTS 1
258 #endif
259 #ifndef CYTHON_USE_TYPE_SPECS
260 #define CYTHON_USE_TYPE_SPECS 0
261 #endif
262 #undef CYTHON_USE_PYTYPE_LOOKUP
263 #define CYTHON_USE_PYTYPE_LOOKUP 0
264 #ifndef CYTHON_USE_ASYNC_SLOTS
265 #define CYTHON_USE_ASYNC_SLOTS 1
266 #endif
267 #ifndef CYTHON_USE_PYLONG_INTERNALS
268 #define CYTHON_USE_PYLONG_INTERNALS 0
269 #endif
270 #undef CYTHON_USE_PYLIST_INTERNALS
271 #define CYTHON_USE_PYLIST_INTERNALS 0
272 #ifndef CYTHON_USE_UNICODE_INTERNALS
273 #define CYTHON_USE_UNICODE_INTERNALS 1
274 #endif
275 #undef CYTHON_USE_UNICODE_WRITER
276 #define CYTHON_USE_UNICODE_WRITER 0
277 #ifndef CYTHON_AVOID_BORROWED_REFS
278 #define CYTHON_AVOID_BORROWED_REFS 0
279 #endif
280 #ifndef CYTHON_ASSUME_SAFE_MACROS
281 #define CYTHON_ASSUME_SAFE_MACROS 1
282 #endif
283 #ifndef CYTHON_UNPACK_METHODS
284 #define CYTHON_UNPACK_METHODS 1
285 #endif
286 #undef CYTHON_FAST_THREAD_STATE
287 #define CYTHON_FAST_THREAD_STATE 0
288 #undef CYTHON_FAST_GIL
289 #define CYTHON_FAST_GIL 0
290 #ifndef CYTHON_METH_FASTCALL
291 #define CYTHON_METH_FASTCALL 1
292 #endif
293 #undef CYTHON_FAST_PYCALL
294 #define CYTHON_FAST_PYCALL 0
295 #ifndef CYTHON_PEP487_INIT_SUBCLASS
296 #define CYTHON_PEP487_INIT_SUBCLASS 1
297 #endif
298 #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
299 #define CYTHON_PEP489_MULTI_PHASE_INIT 1
300 #endif
301 #ifndef CYTHON_USE_MODULE_STATE
302 #define CYTHON_USE_MODULE_STATE 0
303 #endif
304 #ifndef CYTHON_USE_TP_FINALIZE
305 #define CYTHON_USE_TP_FINALIZE 1
306 #endif
307 #undef CYTHON_USE_DICT_VERSIONS
308 #define CYTHON_USE_DICT_VERSIONS 0
309 #undef CYTHON_USE_EXC_INFO_STACK
310 #define CYTHON_USE_EXC_INFO_STACK 0
311 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
312 #define CYTHON_UPDATE_DESCRIPTOR_DOC 1
313 #endif
314 #ifndef CYTHON_USE_FREELISTS
315 #define CYTHON_USE_FREELISTS 0
316 #endif
317#else
318 #define CYTHON_COMPILING_IN_PYPY 0
319 #define CYTHON_COMPILING_IN_CPYTHON 1
320 #define CYTHON_COMPILING_IN_LIMITED_API 0
321 #define CYTHON_COMPILING_IN_GRAAL 0
322 #define CYTHON_COMPILING_IN_NOGIL 0
323 #ifndef CYTHON_USE_TYPE_SLOTS
324 #define CYTHON_USE_TYPE_SLOTS 1
325 #endif
326 #ifndef CYTHON_USE_TYPE_SPECS
327 #define CYTHON_USE_TYPE_SPECS 0
328 #endif
329 #ifndef CYTHON_USE_PYTYPE_LOOKUP
330 #define CYTHON_USE_PYTYPE_LOOKUP 1
331 #endif
332 #if PY_MAJOR_VERSION < 3
333 #undef CYTHON_USE_ASYNC_SLOTS
334 #define CYTHON_USE_ASYNC_SLOTS 0
335 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
336 #define CYTHON_USE_ASYNC_SLOTS 1
337 #endif
338 #ifndef CYTHON_USE_PYLONG_INTERNALS
339 #define CYTHON_USE_PYLONG_INTERNALS 1
340 #endif
341 #ifndef CYTHON_USE_PYLIST_INTERNALS
342 #define CYTHON_USE_PYLIST_INTERNALS 1
343 #endif
344 #ifndef CYTHON_USE_UNICODE_INTERNALS
345 #define CYTHON_USE_UNICODE_INTERNALS 1
346 #endif
347 #if PY_VERSION_HEX < 0x030300F0 || PY_VERSION_HEX >= 0x030B00A2
348 #undef CYTHON_USE_UNICODE_WRITER
349 #define CYTHON_USE_UNICODE_WRITER 0
350 #elif !defined(CYTHON_USE_UNICODE_WRITER)
351 #define CYTHON_USE_UNICODE_WRITER 1
352 #endif
353 #ifndef CYTHON_AVOID_BORROWED_REFS
354 #define CYTHON_AVOID_BORROWED_REFS 0
355 #endif
356 #ifndef CYTHON_ASSUME_SAFE_MACROS
357 #define CYTHON_ASSUME_SAFE_MACROS 1
358 #endif
359 #ifndef CYTHON_UNPACK_METHODS
360 #define CYTHON_UNPACK_METHODS 1
361 #endif
362 #ifndef CYTHON_FAST_THREAD_STATE
363 #define CYTHON_FAST_THREAD_STATE 1
364 #endif
365 #ifndef CYTHON_FAST_GIL
366 #define CYTHON_FAST_GIL (PY_MAJOR_VERSION < 3 || PY_VERSION_HEX >= 0x03060000 && PY_VERSION_HEX < 0x030C00A6)
367 #endif
368 #ifndef CYTHON_METH_FASTCALL
369 #define CYTHON_METH_FASTCALL (PY_VERSION_HEX >= 0x030700A1)
370 #endif
371 #ifndef CYTHON_FAST_PYCALL
372 #define CYTHON_FAST_PYCALL 1
373 #endif
374 #ifndef CYTHON_PEP487_INIT_SUBCLASS
375 #define CYTHON_PEP487_INIT_SUBCLASS 1
376 #endif
377 #if PY_VERSION_HEX < 0x03050000
378 #undef CYTHON_PEP489_MULTI_PHASE_INIT
379 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
380 #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT)
381 #define CYTHON_PEP489_MULTI_PHASE_INIT 1
382 #endif
383 #ifndef CYTHON_USE_MODULE_STATE
384 #define CYTHON_USE_MODULE_STATE 0
385 #endif
386 #if PY_VERSION_HEX < 0x030400a1
387 #undef CYTHON_USE_TP_FINALIZE
388 #define CYTHON_USE_TP_FINALIZE 0
389 #elif !defined(CYTHON_USE_TP_FINALIZE)
390 #define CYTHON_USE_TP_FINALIZE 1
391 #endif
392 #if PY_VERSION_HEX < 0x030600B1
393 #undef CYTHON_USE_DICT_VERSIONS
394 #define CYTHON_USE_DICT_VERSIONS 0
395 #elif !defined(CYTHON_USE_DICT_VERSIONS)
396 #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX < 0x030C00A5)
397 #endif
398 #if PY_VERSION_HEX < 0x030700A3
399 #undef CYTHON_USE_EXC_INFO_STACK
400 #define CYTHON_USE_EXC_INFO_STACK 0
401 #elif !defined(CYTHON_USE_EXC_INFO_STACK)
402 #define CYTHON_USE_EXC_INFO_STACK 1
403 #endif
404 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
405 #define CYTHON_UPDATE_DESCRIPTOR_DOC 1
406 #endif
407 #ifndef CYTHON_USE_FREELISTS
408 #define CYTHON_USE_FREELISTS 1
409 #endif
410#endif
411#if !defined(CYTHON_FAST_PYCCALL)
412#define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
413#endif
414#if !defined(CYTHON_VECTORCALL)
415#define CYTHON_VECTORCALL (CYTHON_FAST_PYCCALL && PY_VERSION_HEX >= 0x030800B1)
416#endif
417#define CYTHON_BACKPORT_VECTORCALL (CYTHON_METH_FASTCALL && PY_VERSION_HEX < 0x030800B1)
418#if CYTHON_USE_PYLONG_INTERNALS
419 #if PY_MAJOR_VERSION < 3
420 #include "longintrepr.h"
421 #endif
422 #undef SHIFT
423 #undef BASE
424 #undef MASK
425 #ifdef SIZEOF_VOID_P
426 enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
427 #endif
428#endif
429#ifndef __has_attribute
430 #define __has_attribute(x) 0
431#endif
432#ifndef __has_cpp_attribute
433 #define __has_cpp_attribute(x) 0
434#endif
435#ifndef CYTHON_RESTRICT
436 #if defined(__GNUC__)
437 #define CYTHON_RESTRICT __restrict__
438 #elif defined(_MSC_VER) && _MSC_VER >= 1400
439 #define CYTHON_RESTRICT __restrict
440 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
441 #define CYTHON_RESTRICT restrict
442 #else
443 #define CYTHON_RESTRICT
444 #endif
445#endif
446#ifndef CYTHON_UNUSED
447 #if defined(__cplusplus)
448 /* for clang __has_cpp_attribute(maybe_unused) is true even before C++17
449 * but leads to warnings with -pedantic, since it is a C++17 feature */
450 #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
451 #if __has_cpp_attribute(maybe_unused)
452 #define CYTHON_UNUSED [[maybe_unused]]
453 #endif
454 #endif
455 #endif
456#endif
457#ifndef CYTHON_UNUSED
458# if defined(__GNUC__)
459# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
460# define CYTHON_UNUSED __attribute__ ((__unused__))
461# else
462# define CYTHON_UNUSED
463# endif
464# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
465# define CYTHON_UNUSED __attribute__ ((__unused__))
466# else
467# define CYTHON_UNUSED
468# endif
469#endif
470#ifndef CYTHON_UNUSED_VAR
471# if defined(__cplusplus)
472 template<class T> void CYTHON_UNUSED_VAR( const T& ) { }
473# else
474# define CYTHON_UNUSED_VAR(x) (void)(x)
475# endif
476#endif
477#ifndef CYTHON_MAYBE_UNUSED_VAR
478 #define CYTHON_MAYBE_UNUSED_VAR(x) CYTHON_UNUSED_VAR(x)
479#endif
480#ifndef CYTHON_NCP_UNUSED
481# if CYTHON_COMPILING_IN_CPYTHON
482# define CYTHON_NCP_UNUSED
483# else
484# define CYTHON_NCP_UNUSED CYTHON_UNUSED
485# endif
486#endif
487#ifndef CYTHON_USE_CPP_STD_MOVE
488 #if defined(__cplusplus) && (\
489 __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600))
490 #define CYTHON_USE_CPP_STD_MOVE 1
491 #else
492 #define CYTHON_USE_CPP_STD_MOVE 0
493 #endif
494#endif
495#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
496#ifdef _MSC_VER
497 #ifndef _MSC_STDINT_H_
498 #if _MSC_VER < 1300
499 typedef unsigned char uint8_t;
500 typedef unsigned short uint16_t;
501 typedef unsigned int uint32_t;
502 #else
503 typedef unsigned __int8 uint8_t;
504 typedef unsigned __int16 uint16_t;
505 typedef unsigned __int32 uint32_t;
506 #endif
507 #endif
508 #if _MSC_VER < 1300
509 #ifdef _WIN64
510 typedef unsigned long long __pyx_uintptr_t;
511 #else
512 typedef unsigned int __pyx_uintptr_t;
513 #endif
514 #else
515 #ifdef _WIN64
516 typedef unsigned __int64 __pyx_uintptr_t;
517 #else
518 typedef unsigned __int32 __pyx_uintptr_t;
519 #endif
520 #endif
521#else
522 #include <stdint.h>
523 typedef uintptr_t __pyx_uintptr_t;
524#endif
525#ifndef CYTHON_FALLTHROUGH
526 #if defined(__cplusplus)
527 /* for clang __has_cpp_attribute(fallthrough) is true even before C++17
528 * but leads to warnings with -pedantic, since it is a C++17 feature */
529 #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
530 #if __has_cpp_attribute(fallthrough)
531 #define CYTHON_FALLTHROUGH [[fallthrough]]
532 #endif
533 #endif
534 #ifndef CYTHON_FALLTHROUGH
535 #if __has_cpp_attribute(clang::fallthrough)
536 #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
537 #elif __has_cpp_attribute(gnu::fallthrough)
538 #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
539 #endif
540 #endif
541 #endif
542 #ifndef CYTHON_FALLTHROUGH
543 #if __has_attribute(fallthrough)
544 #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
545 #else
546 #define CYTHON_FALLTHROUGH
547 #endif
548 #endif
549 #if defined(__clang__) && defined(__apple_build_version__)
550 #if __apple_build_version__ < 7000000
551 #undef CYTHON_FALLTHROUGH
552 #define CYTHON_FALLTHROUGH
553 #endif
554 #endif
555#endif
556#ifdef __cplusplus
557 template <typename T>
558 struct __PYX_IS_UNSIGNED_IMPL {static const bool value = T(0) < T(-1);};
559 #define __PYX_IS_UNSIGNED(type) (__PYX_IS_UNSIGNED_IMPL<type>::value)
560#else
561 #define __PYX_IS_UNSIGNED(type) (((type)-1) > 0)
562#endif
563#if CYTHON_COMPILING_IN_PYPY == 1
564 #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x030A0000)
565#else
566 #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000)
567#endif
568#define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer))
569
570#ifndef __cplusplus
571 #error "Cython files generated with the C++ option must be compiled with a C++ compiler."
572#endif
573#ifndef CYTHON_INLINE
574 #if defined(__clang__)
575 #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
576 #else
577 #define CYTHON_INLINE inline
578 #endif
579#endif
580template<typename T>
581void __Pyx_call_destructor(T& x) {
582 x.~T();
583}
584template<typename T>
585class __Pyx_FakeReference {
586 public:
587 __Pyx_FakeReference() : ptr(NULL) { }
588 __Pyx_FakeReference(const T& ref) : ptr(const_cast<T*>(&ref)) { }
589 T *operator->() { return ptr; }
590 T *operator&() { return ptr; }
591 operator T&() { return *ptr; }
592 template<typename U> bool operator ==(const U& other) const { return *ptr == other; }
593 template<typename U> bool operator !=(const U& other) const { return *ptr != other; }
594 template<typename U> bool operator==(const __Pyx_FakeReference<U>& other) const { return *ptr == *other.ptr; }
595 template<typename U> bool operator!=(const __Pyx_FakeReference<U>& other) const { return *ptr != *other.ptr; }
596 private:
597 T *ptr;
598};
599
600#define __PYX_BUILD_PY_SSIZE_T "n"
601#define CYTHON_FORMAT_SSIZE_T "z"
602#if PY_MAJOR_VERSION < 3
603 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
604 #define __Pyx_DefaultClassType PyClass_Type
605 #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
606 PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
607#else
608 #define __Pyx_BUILTIN_MODULE_NAME "builtins"
609 #define __Pyx_DefaultClassType PyType_Type
610#if CYTHON_COMPILING_IN_LIMITED_API
611 static CYTHON_INLINE PyObject* __Pyx_PyCode_New(int a, int p, int k, int l, int s, int f,
612 PyObject *code, PyObject *c, PyObject* n, PyObject *v,
613 PyObject *fv, PyObject *cell, PyObject* fn,
614 PyObject *name, int fline, PyObject *lnos) {
615 PyObject *exception_table = NULL;
616 PyObject *types_module=NULL, *code_type=NULL, *result=NULL;
617 #if __PYX_LIMITED_VERSION_HEX < 0x030B0000
618 PyObject *version_info;
619 PyObject *py_minor_version = NULL;
620 #endif
621 long minor_version = 0;
622 PyObject *type, *value, *traceback;
623 PyErr_Fetch(&type, &value, &traceback);
624 #if __PYX_LIMITED_VERSION_HEX >= 0x030B0000
625 minor_version = 11;
626 #else
627 if (!(version_info = PySys_GetObject("version_info"))) goto end;
628 if (!(py_minor_version = PySequence_GetItem(version_info, 1))) goto end;
629 minor_version = PyLong_AsLong(py_minor_version);
630 Py_DECREF(py_minor_version);
631 if (minor_version == -1 && PyErr_Occurred()) goto end;
632 #endif
633 if (!(types_module = PyImport_ImportModule("types"))) goto end;
634 if (!(code_type = PyObject_GetAttrString(types_module, "CodeType"))) goto end;
635 if (minor_version <= 7) {
636 (void)p;
637 result = PyObject_CallFunction(code_type, "iiiiiOOOOOOiOO", a, k, l, s, f, code,
638 c, n, v, fn, name, fline, lnos, fv, cell);
639 } else if (minor_version <= 10) {
640 result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOiOO", a,p, k, l, s, f, code,
641 c, n, v, fn, name, fline, lnos, fv, cell);
642 } else {
643 if (!(exception_table = PyBytes_FromStringAndSize(NULL, 0))) goto end;
644 result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOOiOO", a,p, k, l, s, f, code,
645 c, n, v, fn, name, name, fline, lnos, exception_table, fv, cell);
646 }
647 end:
648 Py_XDECREF(code_type);
649 Py_XDECREF(exception_table);
650 Py_XDECREF(types_module);
651 if (type) {
652 PyErr_Restore(type, value, traceback);
653 }
654 return result;
655 }
656 #ifndef CO_OPTIMIZED
657 #define CO_OPTIMIZED 0x0001
658 #endif
659 #ifndef CO_NEWLOCALS
660 #define CO_NEWLOCALS 0x0002
661 #endif
662 #ifndef CO_VARARGS
663 #define CO_VARARGS 0x0004
664 #endif
665 #ifndef CO_VARKEYWORDS
666 #define CO_VARKEYWORDS 0x0008
667 #endif
668 #ifndef CO_ASYNC_GENERATOR
669 #define CO_ASYNC_GENERATOR 0x0200
670 #endif
671 #ifndef CO_GENERATOR
672 #define CO_GENERATOR 0x0020
673 #endif
674 #ifndef CO_COROUTINE
675 #define CO_COROUTINE 0x0080
676 #endif
677#elif PY_VERSION_HEX >= 0x030B0000
678 static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int p, int k, int l, int s, int f,
679 PyObject *code, PyObject *c, PyObject* n, PyObject *v,
680 PyObject *fv, PyObject *cell, PyObject* fn,
681 PyObject *name, int fline, PyObject *lnos) {
682 PyCodeObject *result;
683 PyObject *empty_bytes = PyBytes_FromStringAndSize("", 0);
684 if (!empty_bytes) return NULL;
685 result =
686 #if PY_VERSION_HEX >= 0x030C0000
687 PyUnstable_Code_NewWithPosOnlyArgs
688 #else
689 PyCode_NewWithPosOnlyArgs
690 #endif
691 (a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, name, fline, lnos, empty_bytes);
692 Py_DECREF(empty_bytes);
693 return result;
694 }
695#elif PY_VERSION_HEX >= 0x030800B2 && !CYTHON_COMPILING_IN_PYPY
696 #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
697 PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
698#else
699 #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
700 PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
701#endif
702#endif
703#if PY_VERSION_HEX >= 0x030900A4 || defined(Py_IS_TYPE)
704 #define __Pyx_IS_TYPE(ob, type) Py_IS_TYPE(ob, type)
705#else
706 #define __Pyx_IS_TYPE(ob, type) (((const PyObject*)ob)->ob_type == (type))
707#endif
708#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_Is)
709 #define __Pyx_Py_Is(x, y) Py_Is(x, y)
710#else
711 #define __Pyx_Py_Is(x, y) ((x) == (y))
712#endif
713#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsNone)
714 #define __Pyx_Py_IsNone(ob) Py_IsNone(ob)
715#else
716 #define __Pyx_Py_IsNone(ob) __Pyx_Py_Is((ob), Py_None)
717#endif
718#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsTrue)
719 #define __Pyx_Py_IsTrue(ob) Py_IsTrue(ob)
720#else
721 #define __Pyx_Py_IsTrue(ob) __Pyx_Py_Is((ob), Py_True)
722#endif
723#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsFalse)
724 #define __Pyx_Py_IsFalse(ob) Py_IsFalse(ob)
725#else
726 #define __Pyx_Py_IsFalse(ob) __Pyx_Py_Is((ob), Py_False)
727#endif
728#define __Pyx_NoneAsNull(obj) (__Pyx_Py_IsNone(obj) ? NULL : (obj))
729#if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY
730 #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o)
731#else
732 #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o)
733#endif
734#ifndef CO_COROUTINE
735 #define CO_COROUTINE 0x80
736#endif
737#ifndef CO_ASYNC_GENERATOR
738 #define CO_ASYNC_GENERATOR 0x200
739#endif
740#ifndef Py_TPFLAGS_CHECKTYPES
741 #define Py_TPFLAGS_CHECKTYPES 0
742#endif
743#ifndef Py_TPFLAGS_HAVE_INDEX
744 #define Py_TPFLAGS_HAVE_INDEX 0
745#endif
746#ifndef Py_TPFLAGS_HAVE_NEWBUFFER
747 #define Py_TPFLAGS_HAVE_NEWBUFFER 0
748#endif
749#ifndef Py_TPFLAGS_HAVE_FINALIZE
750 #define Py_TPFLAGS_HAVE_FINALIZE 0
751#endif
752#ifndef Py_TPFLAGS_SEQUENCE
753 #define Py_TPFLAGS_SEQUENCE 0
754#endif
755#ifndef Py_TPFLAGS_MAPPING
756 #define Py_TPFLAGS_MAPPING 0
757#endif
758#ifndef METH_STACKLESS
759 #define METH_STACKLESS 0
760#endif
761#if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
762 #ifndef METH_FASTCALL
763 #define METH_FASTCALL 0x80
764 #endif
765 typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
766 typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
767 Py_ssize_t nargs, PyObject *kwnames);
768#else
769 #if PY_VERSION_HEX >= 0x030d00A4
770 # define __Pyx_PyCFunctionFast PyCFunctionFast
771 # define __Pyx_PyCFunctionFastWithKeywords PyCFunctionFastWithKeywords
772 #else
773 # define __Pyx_PyCFunctionFast _PyCFunctionFast
774 # define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
775 #endif
776#endif
777#if CYTHON_METH_FASTCALL
778 #define __Pyx_METH_FASTCALL METH_FASTCALL
779 #define __Pyx_PyCFunction_FastCall __Pyx_PyCFunctionFast
780 #define __Pyx_PyCFunction_FastCallWithKeywords __Pyx_PyCFunctionFastWithKeywords
781#else
782 #define __Pyx_METH_FASTCALL METH_VARARGS
783 #define __Pyx_PyCFunction_FastCall PyCFunction
784 #define __Pyx_PyCFunction_FastCallWithKeywords PyCFunctionWithKeywords
785#endif
786#if CYTHON_VECTORCALL
787 #define __pyx_vectorcallfunc vectorcallfunc
788 #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET PY_VECTORCALL_ARGUMENTS_OFFSET
789 #define __Pyx_PyVectorcall_NARGS(n) PyVectorcall_NARGS((size_t)(n))
790#elif CYTHON_BACKPORT_VECTORCALL
791 typedef PyObject *(*__pyx_vectorcallfunc)(PyObject *callable, PyObject *const *args,
792 size_t nargsf, PyObject *kwnames);
793 #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET ((size_t)1 << (8 * sizeof(size_t) - 1))
794 #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(((size_t)(n)) & ~__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET))
795#else
796 #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET 0
797 #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(n))
798#endif
799#if PY_MAJOR_VERSION >= 0x030900B1
800#define __Pyx_PyCFunction_CheckExact(func) PyCFunction_CheckExact(func)
801#else
802#define __Pyx_PyCFunction_CheckExact(func) PyCFunction_Check(func)
803#endif
804#define __Pyx_CyOrPyCFunction_Check(func) PyCFunction_Check(func)
805#if CYTHON_COMPILING_IN_CPYTHON
806#define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) (((PyCFunctionObject*)(func))->m_ml->ml_meth)
807#elif !CYTHON_COMPILING_IN_LIMITED_API
808#define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) PyCFunction_GET_FUNCTION(func)
809#endif
810#if CYTHON_COMPILING_IN_CPYTHON
811#define __Pyx_CyOrPyCFunction_GET_FLAGS(func) (((PyCFunctionObject*)(func))->m_ml->ml_flags)
812static CYTHON_INLINE PyObject* __Pyx_CyOrPyCFunction_GET_SELF(PyObject *func) {
813 return (__Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_STATIC) ? NULL : ((PyCFunctionObject*)func)->m_self;
814}
815#endif
816static CYTHON_INLINE int __Pyx__IsSameCFunction(PyObject *func, void *cfunc) {
817#if CYTHON_COMPILING_IN_LIMITED_API
818 return PyCFunction_Check(func) && PyCFunction_GetFunction(func) == (PyCFunction) cfunc;
819#else
820 return PyCFunction_Check(func) && PyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc;
821#endif
822}
823#define __Pyx_IsSameCFunction(func, cfunc) __Pyx__IsSameCFunction(func, cfunc)
824#if __PYX_LIMITED_VERSION_HEX < 0x030900B1
825 #define __Pyx_PyType_FromModuleAndSpec(m, s, b) ((void)m, PyType_FromSpecWithBases(s, b))
826 typedef PyObject *(*__Pyx_PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *, size_t, PyObject *);
827#else
828 #define __Pyx_PyType_FromModuleAndSpec(m, s, b) PyType_FromModuleAndSpec(m, s, b)
829 #define __Pyx_PyCMethod PyCMethod
830#endif
831#ifndef METH_METHOD
832 #define METH_METHOD 0x200
833#endif
834#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
835 #define PyObject_Malloc(s) PyMem_Malloc(s)
836 #define PyObject_Free(p) PyMem_Free(p)
837 #define PyObject_Realloc(p) PyMem_Realloc(p)
838#endif
839#if CYTHON_COMPILING_IN_LIMITED_API
840 #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
841 #define __Pyx_PyFrame_SetLineNumber(frame, lineno)
842#else
843 #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
844 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
845#endif
846#if CYTHON_COMPILING_IN_LIMITED_API
847 #define __Pyx_PyThreadState_Current PyThreadState_Get()
848#elif !CYTHON_FAST_THREAD_STATE
849 #define __Pyx_PyThreadState_Current PyThreadState_GET()
850#elif PY_VERSION_HEX >= 0x030d00A1
851 #define __Pyx_PyThreadState_Current PyThreadState_GetUnchecked()
852#elif PY_VERSION_HEX >= 0x03060000
853 #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
854#elif PY_VERSION_HEX >= 0x03000000
855 #define __Pyx_PyThreadState_Current PyThreadState_GET()
856#else
857 #define __Pyx_PyThreadState_Current _PyThreadState_Current
858#endif
859#if CYTHON_COMPILING_IN_LIMITED_API
860static CYTHON_INLINE void *__Pyx_PyModule_GetState(PyObject *op)
861{
862 void *result;
863 result = PyModule_GetState(op);
864 if (!result)
865 Py_FatalError("Couldn't find the module state");
866 return result;
867}
868#endif
869#define __Pyx_PyObject_GetSlot(obj, name, func_ctype) __Pyx_PyType_GetSlot(Py_TYPE(obj), name, func_ctype)
870#if CYTHON_COMPILING_IN_LIMITED_API
871 #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((func_ctype) PyType_GetSlot((type), Py_##name))
872#else
873 #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((type)->name)
874#endif
875#if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
876#include "pythread.h"
877#define Py_tss_NEEDS_INIT 0
878typedef int Py_tss_t;
879static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
880 *key = PyThread_create_key();
881 return 0;
882}
883static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
884 Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
885 *key = Py_tss_NEEDS_INIT;
886 return key;
887}
888static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
889 PyObject_Free(key);
890}
891static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
892 return *key != Py_tss_NEEDS_INIT;
893}
894static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
895 PyThread_delete_key(*key);
896 *key = Py_tss_NEEDS_INIT;
897}
898static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
899 return PyThread_set_key_value(*key, value);
900}
901static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
902 return PyThread_get_key_value(*key);
903}
904#endif
905#if PY_MAJOR_VERSION < 3
906 #if CYTHON_COMPILING_IN_PYPY
907 #if PYPY_VERSION_NUM < 0x07030600
908 #if defined(__cplusplus) && __cplusplus >= 201402L
909 [[deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")]]
910 #elif defined(__GNUC__) || defined(__clang__)
911 __attribute__ ((__deprecated__("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")))
912 #elif defined(_MSC_VER)
913 __declspec(deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6"))
914 #endif
915 static CYTHON_INLINE int PyGILState_Check(void) {
916 return 0;
917 }
918 #else // PYPY_VERSION_NUM < 0x07030600
919 #endif // PYPY_VERSION_NUM < 0x07030600
920 #else
921 static CYTHON_INLINE int PyGILState_Check(void) {
922 PyThreadState * tstate = _PyThreadState_Current;
923 return tstate && (tstate == PyGILState_GetThisThreadState());
924 }
925 #endif
926#endif
927#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000 || defined(_PyDict_NewPresized)
928#define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
929#else
930#define __Pyx_PyDict_NewPresized(n) PyDict_New()
931#endif
932#if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
933 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
934 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
935#else
936 #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
937 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
938#endif
939#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX > 0x030600B4 && PY_VERSION_HEX < 0x030d0000 && CYTHON_USE_UNICODE_INTERNALS
940#define __Pyx_PyDict_GetItemStrWithError(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
941static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStr(PyObject *dict, PyObject *name) {
942 PyObject *res = __Pyx_PyDict_GetItemStrWithError(dict, name);
943 if (res == NULL) PyErr_Clear();
944 return res;
945}
946#elif PY_MAJOR_VERSION >= 3 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000)
947#define __Pyx_PyDict_GetItemStrWithError PyDict_GetItemWithError
948#define __Pyx_PyDict_GetItemStr PyDict_GetItem
949#else
950static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, PyObject *name) {
951#if CYTHON_COMPILING_IN_PYPY
952 return PyDict_GetItem(dict, name);
953#else
954 PyDictEntry *ep;
955 PyDictObject *mp = (PyDictObject*) dict;
956 long hash = ((PyStringObject *) name)->ob_shash;
957 assert(hash != -1);
958 ep = (mp->ma_lookup)(mp, name, hash);
959 if (ep == NULL) {
960 return NULL;
961 }
962 return ep->me_value;
963#endif
964}
965#define __Pyx_PyDict_GetItemStr PyDict_GetItem
966#endif
967#if CYTHON_USE_TYPE_SLOTS
968 #define __Pyx_PyType_GetFlags(tp) (((PyTypeObject *)tp)->tp_flags)
969 #define __Pyx_PyType_HasFeature(type, feature) ((__Pyx_PyType_GetFlags(type) & (feature)) != 0)
970 #define __Pyx_PyObject_GetIterNextFunc(obj) (Py_TYPE(obj)->tp_iternext)
971#else
972 #define __Pyx_PyType_GetFlags(tp) (PyType_GetFlags((PyTypeObject *)tp))
973 #define __Pyx_PyType_HasFeature(type, feature) PyType_HasFeature(type, feature)
974 #define __Pyx_PyObject_GetIterNextFunc(obj) PyIter_Next
975#endif
976#if CYTHON_COMPILING_IN_LIMITED_API
977 #define __Pyx_SetItemOnTypeDict(tp, k, v) PyObject_GenericSetAttr((PyObject*)tp, k, v)
978#else
979 #define __Pyx_SetItemOnTypeDict(tp, k, v) PyDict_SetItem(tp->tp_dict, k, v)
980#endif
981#if CYTHON_USE_TYPE_SPECS && PY_VERSION_HEX >= 0x03080000
982#define __Pyx_PyHeapTypeObject_GC_Del(obj) {\
983 PyTypeObject *type = Py_TYPE((PyObject*)obj);\
984 assert(__Pyx_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE));\
985 PyObject_GC_Del(obj);\
986 Py_DECREF(type);\
987}
988#else
989#define __Pyx_PyHeapTypeObject_GC_Del(obj) PyObject_GC_Del(obj)
990#endif
991#if CYTHON_COMPILING_IN_LIMITED_API
992 #define CYTHON_PEP393_ENABLED 1
993 #define __Pyx_PyUnicode_READY(op) (0)
994 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GetLength(u)
995 #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_ReadChar(u, i)
996 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((void)u, 1114111U)
997 #define __Pyx_PyUnicode_KIND(u) ((void)u, (0))
998 #define __Pyx_PyUnicode_DATA(u) ((void*)u)
999 #define __Pyx_PyUnicode_READ(k, d, i) ((void)k, PyUnicode_ReadChar((PyObject*)(d), i))
1000 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GetLength(u))
1001#elif PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
1002 #define CYTHON_PEP393_ENABLED 1
1003 #if PY_VERSION_HEX >= 0x030C0000
1004 #define __Pyx_PyUnicode_READY(op) (0)
1005 #else
1006 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
1007 0 : _PyUnicode_Ready((PyObject *)(op)))
1008 #endif
1009 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
1010 #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
1011 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
1012 #define __Pyx_PyUnicode_KIND(u) ((int)PyUnicode_KIND(u))
1013 #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
1014 #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
1015 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, (Py_UCS4) ch)
1016 #if PY_VERSION_HEX >= 0x030C0000
1017 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u))
1018 #else
1019 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000
1020 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length))
1021 #else
1022 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
1023 #endif
1024 #endif
1025#else
1026 #define CYTHON_PEP393_ENABLED 0
1027 #define PyUnicode_1BYTE_KIND 1
1028 #define PyUnicode_2BYTE_KIND 2
1029 #define PyUnicode_4BYTE_KIND 4
1030 #define __Pyx_PyUnicode_READY(op) (0)
1031 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
1032 #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
1033 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535U : 1114111U)
1034 #define __Pyx_PyUnicode_KIND(u) ((int)sizeof(Py_UNICODE))
1035 #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
1036 #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
1037 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = (Py_UNICODE) ch)
1038 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
1039#endif
1040#if CYTHON_COMPILING_IN_PYPY
1041 #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
1042 #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
1043#else
1044 #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
1045 #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
1046 PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
1047#endif
1048#if CYTHON_COMPILING_IN_PYPY
1049 #if !defined(PyUnicode_DecodeUnicodeEscape)
1050 #define PyUnicode_DecodeUnicodeEscape(s, size, errors) PyUnicode_Decode(s, size, "unicode_escape", errors)
1051 #endif
1052 #if !defined(PyUnicode_Contains) || (PY_MAJOR_VERSION == 2 && PYPY_VERSION_NUM < 0x07030500)
1053 #undef PyUnicode_Contains
1054 #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
1055 #endif
1056 #if !defined(PyByteArray_Check)
1057 #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
1058 #endif
1059 #if !defined(PyObject_Format)
1060 #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
1061 #endif
1062#endif
1063#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
1064#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
1065#if PY_MAJOR_VERSION >= 3
1066 #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
1067#else
1068 #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
1069#endif
1070#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
1071 #define PyObject_ASCII(o) PyObject_Repr(o)
1072#endif
1073#if PY_MAJOR_VERSION >= 3
1074 #define PyBaseString_Type PyUnicode_Type
1075 #define PyStringObject PyUnicodeObject
1076 #define PyString_Type PyUnicode_Type
1077 #define PyString_Check PyUnicode_Check
1078 #define PyString_CheckExact PyUnicode_CheckExact
1079#ifndef PyObject_Unicode
1080 #define PyObject_Unicode PyObject_Str
1081#endif
1082#endif
1083#if PY_MAJOR_VERSION >= 3
1084 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
1085 #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
1086#else
1087 #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
1088 #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
1089#endif
1090#if CYTHON_COMPILING_IN_CPYTHON
1091 #define __Pyx_PySequence_ListKeepNew(obj)\
1092 (likely(PyList_CheckExact(obj) && Py_REFCNT(obj) == 1) ? __Pyx_NewRef(obj) : PySequence_List(obj))
1093#else
1094 #define __Pyx_PySequence_ListKeepNew(obj) PySequence_List(obj)
1095#endif
1096#ifndef PySet_CheckExact
1097 #define PySet_CheckExact(obj) __Pyx_IS_TYPE(obj, &PySet_Type)
1098#endif
1099#if PY_VERSION_HEX >= 0x030900A4
1100 #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
1101 #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
1102#else
1103 #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
1104 #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
1105#endif
1106#if CYTHON_ASSUME_SAFE_MACROS
1107 #define __Pyx_PySequence_ITEM(o, i) PySequence_ITEM(o, i)
1108 #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
1109 #define __Pyx_PyTuple_SET_ITEM(o, i, v) (PyTuple_SET_ITEM(o, i, v), (0))
1110 #define __Pyx_PyList_SET_ITEM(o, i, v) (PyList_SET_ITEM(o, i, v), (0))
1111 #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_GET_SIZE(o)
1112 #define __Pyx_PyList_GET_SIZE(o) PyList_GET_SIZE(o)
1113 #define __Pyx_PySet_GET_SIZE(o) PySet_GET_SIZE(o)
1114 #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_GET_SIZE(o)
1115 #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_GET_SIZE(o)
1116#else
1117 #define __Pyx_PySequence_ITEM(o, i) PySequence_GetItem(o, i)
1118 #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
1119 #define __Pyx_PyTuple_SET_ITEM(o, i, v) PyTuple_SetItem(o, i, v)
1120 #define __Pyx_PyList_SET_ITEM(o, i, v) PyList_SetItem(o, i, v)
1121 #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_Size(o)
1122 #define __Pyx_PyList_GET_SIZE(o) PyList_Size(o)
1123 #define __Pyx_PySet_GET_SIZE(o) PySet_Size(o)
1124 #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_Size(o)
1125 #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_Size(o)
1126#endif
1127#if __PYX_LIMITED_VERSION_HEX >= 0x030d00A1
1128 #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name)
1129#else
1130 static CYTHON_INLINE PyObject *__Pyx_PyImport_AddModuleRef(const char *name) {
1131 PyObject *module = PyImport_AddModule(name);
1132 Py_XINCREF(module);
1133 return module;
1134 }
1135#endif
1136#if PY_MAJOR_VERSION >= 3
1137 #define PyIntObject PyLongObject
1138 #define PyInt_Type PyLong_Type
1139 #define PyInt_Check(op) PyLong_Check(op)
1140 #define PyInt_CheckExact(op) PyLong_CheckExact(op)
1141 #define __Pyx_Py3Int_Check(op) PyLong_Check(op)
1142 #define __Pyx_Py3Int_CheckExact(op) PyLong_CheckExact(op)
1143 #define PyInt_FromString PyLong_FromString
1144 #define PyInt_FromUnicode PyLong_FromUnicode
1145 #define PyInt_FromLong PyLong_FromLong
1146 #define PyInt_FromSize_t PyLong_FromSize_t
1147 #define PyInt_FromSsize_t PyLong_FromSsize_t
1148 #define PyInt_AsLong PyLong_AsLong
1149 #define PyInt_AS_LONG PyLong_AS_LONG
1150 #define PyInt_AsSsize_t PyLong_AsSsize_t
1151 #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
1152 #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
1153 #define PyNumber_Int PyNumber_Long
1154#else
1155 #define __Pyx_Py3Int_Check(op) (PyLong_Check(op) || PyInt_Check(op))
1156 #define __Pyx_Py3Int_CheckExact(op) (PyLong_CheckExact(op) || PyInt_CheckExact(op))
1157#endif
1158#if PY_MAJOR_VERSION >= 3
1159 #define PyBoolObject PyLongObject
1160#endif
1161#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
1162 #ifndef PyUnicode_InternFromString
1163 #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
1164 #endif
1165#endif
1166#if PY_VERSION_HEX < 0x030200A4
1167 typedef long Py_hash_t;
1168 #define __Pyx_PyInt_FromHash_t PyInt_FromLong
1169 #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsHash_t
1170#else
1171 #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
1172 #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t
1173#endif
1174#if CYTHON_USE_ASYNC_SLOTS
1175 #if PY_VERSION_HEX >= 0x030500B1
1176 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
1177 #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
1178 #else
1179 #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
1180 #endif
1181#else
1182 #define __Pyx_PyType_AsAsync(obj) NULL
1183#endif
1184#ifndef __Pyx_PyAsyncMethodsStruct
1185 typedef struct {
1186 unaryfunc am_await;
1187 unaryfunc am_aiter;
1188 unaryfunc am_anext;
1189 } __Pyx_PyAsyncMethodsStruct;
1190#endif
1191
1192#if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)
1193 #if !defined(_USE_MATH_DEFINES)
1194 #define _USE_MATH_DEFINES
1195 #endif
1196#endif
1197#include <math.h>
1198#ifdef NAN
1199#define __PYX_NAN() ((float) NAN)
1200#else
1201static CYTHON_INLINE float __PYX_NAN() {
1202 float value;
1203 memset(&value, 0xFF, sizeof(value));
1204 return value;
1205}
1206#endif
1207#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
1208#define __Pyx_truncl trunc
1209#else
1210#define __Pyx_truncl truncl
1211#endif
1212
1213#define __PYX_MARK_ERR_POS(f_index, lineno) \
1214 { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
1215#define __PYX_ERR(f_index, lineno, Ln_error) \
1216 { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }
1217
1218#ifdef CYTHON_EXTERN_C
1219 #undef __PYX_EXTERN_C
1220 #define __PYX_EXTERN_C CYTHON_EXTERN_C
1221#elif defined(__PYX_EXTERN_C)
1222 #ifdef _MSC_VER
1223 #pragma message ("Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.")
1224 #else
1225 #warning Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.
1226 #endif
1227#else
1228 #define __PYX_EXTERN_C extern "C++"
1229#endif
1230
1231#define __PYX_HAVE__pyinfile
1232#define __PYX_HAVE_API__pyinfile
1233/* Early includes */
1234#include <string.h>
1235#include <string>
1236#include "ios"
1237#include "new"
1238#include "stdexcept"
1239#include "typeinfo"
1240#include <stdio.h>
1241#ifdef _OPENMP
1242#include <omp.h>
1243#endif /* _OPENMP */
1244
1245#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
1246#define CYTHON_WITHOUT_ASSERTIONS
1247#endif
1248
1249typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
1250 const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
1251
1252#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
1253#define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
1254#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
1255#define __PYX_DEFAULT_STRING_ENCODING ""
1256#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
1257#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
1258#define __Pyx_uchar_cast(c) ((unsigned char)c)
1259#define __Pyx_long_cast(x) ((long)x)
1260#define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
1261 (sizeof(type) < sizeof(Py_ssize_t)) ||\
1262 (sizeof(type) > sizeof(Py_ssize_t) &&\
1263 likely(v < (type)PY_SSIZE_T_MAX ||\
1264 v == (type)PY_SSIZE_T_MAX) &&\
1265 (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
1266 v == (type)PY_SSIZE_T_MIN))) ||\
1267 (sizeof(type) == sizeof(Py_ssize_t) &&\
1268 (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
1269 v == (type)PY_SSIZE_T_MAX))) )
1270static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
1271 return (size_t) i < (size_t) limit;
1272}
1273#if defined (__cplusplus) && __cplusplus >= 201103L
1274 #include <cstdlib>
1275 #define __Pyx_sst_abs(value) std::abs(value)
1276#elif SIZEOF_INT >= SIZEOF_SIZE_T
1277 #define __Pyx_sst_abs(value) abs(value)
1278#elif SIZEOF_LONG >= SIZEOF_SIZE_T
1279 #define __Pyx_sst_abs(value) labs(value)
1280#elif defined (_MSC_VER)
1281 #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
1282#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
1283 #define __Pyx_sst_abs(value) llabs(value)
1284#elif defined (__GNUC__)
1285 #define __Pyx_sst_abs(value) __builtin_llabs(value)
1286#else
1287 #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
1288#endif
1289static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s);
1290static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
1291static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
1292static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char*);
1293#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
1294#define __Pyx_PyBytes_FromString PyBytes_FromString
1295#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
1296static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
1297#if PY_MAJOR_VERSION < 3
1298 #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
1299 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
1300#else
1301 #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
1302 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
1303#endif
1304#define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
1305#define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
1306#define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
1307#define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
1308#define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
1309#define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
1310#define __Pyx_PyObject_AsWritableString(s) ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
1311#define __Pyx_PyObject_AsWritableSString(s) ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
1312#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
1313#define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
1314#define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
1315#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
1316#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
1317#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
1318#define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
1319#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
1320#define __Pyx_PyUnicode_FromOrdinal(o) PyUnicode_FromOrdinal((int)o)
1321#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
1322#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
1323#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
1324static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
1325static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
1326static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
1327static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
1328#define __Pyx_PySequence_Tuple(obj)\
1329 (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
1330static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
1331static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
1332static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*);
1333#if CYTHON_ASSUME_SAFE_MACROS
1334#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
1335#else
1336#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
1337#endif
1338#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
1339#if PY_MAJOR_VERSION >= 3
1340#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
1341#else
1342#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
1343#endif
1344#if CYTHON_USE_PYLONG_INTERNALS
1345 #if PY_VERSION_HEX >= 0x030C00A7
1346 #ifndef _PyLong_SIGN_MASK
1347 #define _PyLong_SIGN_MASK 3
1348 #endif
1349 #ifndef _PyLong_NON_SIZE_BITS
1350 #define _PyLong_NON_SIZE_BITS 3
1351 #endif
1352 #define __Pyx_PyLong_Sign(x) (((PyLongObject*)x)->long_value.lv_tag & _PyLong_SIGN_MASK)
1353 #define __Pyx_PyLong_IsNeg(x) ((__Pyx_PyLong_Sign(x) & 2) != 0)
1354 #define __Pyx_PyLong_IsNonNeg(x) (!__Pyx_PyLong_IsNeg(x))
1355 #define __Pyx_PyLong_IsZero(x) (__Pyx_PyLong_Sign(x) & 1)
1356 #define __Pyx_PyLong_IsPos(x) (__Pyx_PyLong_Sign(x) == 0)
1357 #define __Pyx_PyLong_CompactValueUnsigned(x) (__Pyx_PyLong_Digits(x)[0])
1358 #define __Pyx_PyLong_DigitCount(x) ((Py_ssize_t) (((PyLongObject*)x)->long_value.lv_tag >> _PyLong_NON_SIZE_BITS))
1359 #define __Pyx_PyLong_SignedDigitCount(x)\
1360 ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * __Pyx_PyLong_DigitCount(x))
1361 #if defined(PyUnstable_Long_IsCompact) && defined(PyUnstable_Long_CompactValue)
1362 #define __Pyx_PyLong_IsCompact(x) PyUnstable_Long_IsCompact((PyLongObject*) x)
1363 #define __Pyx_PyLong_CompactValue(x) PyUnstable_Long_CompactValue((PyLongObject*) x)
1364 #else
1365 #define __Pyx_PyLong_IsCompact(x) (((PyLongObject*)x)->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS))
1366 #define __Pyx_PyLong_CompactValue(x) ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0])
1367 #endif
1368 typedef Py_ssize_t __Pyx_compact_pylong;
1369 typedef size_t __Pyx_compact_upylong;
1370 #else
1371 #define __Pyx_PyLong_IsNeg(x) (Py_SIZE(x) < 0)
1372 #define __Pyx_PyLong_IsNonNeg(x) (Py_SIZE(x) >= 0)
1373 #define __Pyx_PyLong_IsZero(x) (Py_SIZE(x) == 0)
1374 #define __Pyx_PyLong_IsPos(x) (Py_SIZE(x) > 0)
1375 #define __Pyx_PyLong_CompactValueUnsigned(x) ((Py_SIZE(x) == 0) ? 0 : __Pyx_PyLong_Digits(x)[0])
1376 #define __Pyx_PyLong_DigitCount(x) __Pyx_sst_abs(Py_SIZE(x))
1377 #define __Pyx_PyLong_SignedDigitCount(x) Py_SIZE(x)
1378 #define __Pyx_PyLong_IsCompact(x) (Py_SIZE(x) == 0 || Py_SIZE(x) == 1 || Py_SIZE(x) == -1)
1379 #define __Pyx_PyLong_CompactValue(x)\
1380 ((Py_SIZE(x) == 0) ? (sdigit) 0 : ((Py_SIZE(x) < 0) ? -(sdigit)__Pyx_PyLong_Digits(x)[0] : (sdigit)__Pyx_PyLong_Digits(x)[0]))
1381 typedef sdigit __Pyx_compact_pylong;
1382 typedef digit __Pyx_compact_upylong;
1383 #endif
1384 #if PY_VERSION_HEX >= 0x030C00A5
1385 #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->long_value.ob_digit)
1386 #else
1387 #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->ob_digit)
1388 #endif
1389#endif
1390#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
1391#include <string.h>
1392static int __Pyx_sys_getdefaultencoding_not_ascii;
1393static int __Pyx_init_sys_getdefaultencoding_params(void) {
1394 PyObject* sys;
1395 PyObject* default_encoding = NULL;
1396 PyObject* ascii_chars_u = NULL;
1397 PyObject* ascii_chars_b = NULL;
1398 const char* default_encoding_c;
1399 sys = PyImport_ImportModule("sys");
1400 if (!sys) goto bad;
1401 default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
1402 Py_DECREF(sys);
1403 if (!default_encoding) goto bad;
1404 default_encoding_c = PyBytes_AsString(default_encoding);
1405 if (!default_encoding_c) goto bad;
1406 if (strcmp(default_encoding_c, "ascii") == 0) {
1407 __Pyx_sys_getdefaultencoding_not_ascii = 0;
1408 } else {
1409 char ascii_chars[128];
1410 int c;
1411 for (c = 0; c < 128; c++) {
1412 ascii_chars[c] = (char) c;
1413 }
1414 __Pyx_sys_getdefaultencoding_not_ascii = 1;
1415 ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
1416 if (!ascii_chars_u) goto bad;
1417 ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
1418 if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
1419 PyErr_Format(
1420 PyExc_ValueError,
1421 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
1422 default_encoding_c);
1423 goto bad;
1424 }
1425 Py_DECREF(ascii_chars_u);
1426 Py_DECREF(ascii_chars_b);
1427 }
1428 Py_DECREF(default_encoding);
1429 return 0;
1430bad:
1431 Py_XDECREF(default_encoding);
1432 Py_XDECREF(ascii_chars_u);
1433 Py_XDECREF(ascii_chars_b);
1434 return -1;
1435}
1436#endif
1437#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
1438#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
1439#else
1440#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
1441#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
1442#include <string.h>
1443static char* __PYX_DEFAULT_STRING_ENCODING;
1444static int __Pyx_init_sys_getdefaultencoding_params(void) {
1445 PyObject* sys;
1446 PyObject* default_encoding = NULL;
1447 char* default_encoding_c;
1448 sys = PyImport_ImportModule("sys");
1449 if (!sys) goto bad;
1450 default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
1451 Py_DECREF(sys);
1452 if (!default_encoding) goto bad;
1453 default_encoding_c = PyBytes_AsString(default_encoding);
1454 if (!default_encoding_c) goto bad;
1455 __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
1456 if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
1457 strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
1458 Py_DECREF(default_encoding);
1459 return 0;
1460bad:
1461 Py_XDECREF(default_encoding);
1462 return -1;
1463}
1464#endif
1465#endif
1466
1467
1468/* Test for GCC > 2.95 */
1469#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
1470 #define likely(x) __builtin_expect(!!(x), 1)
1471 #define unlikely(x) __builtin_expect(!!(x), 0)
1472#else /* !__GNUC__ or GCC < 2.95 */
1473 #define likely(x) (x)
1474 #define unlikely(x) (x)
1475#endif /* __GNUC__ */
1476static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
1477
1478#if !CYTHON_USE_MODULE_STATE
1479static PyObject *__pyx_m = NULL;
1480#endif
1481static int __pyx_lineno;
1482static int __pyx_clineno = 0;
1483static const char * __pyx_cfilenm = __FILE__;
1484static const char *__pyx_filename;
1485
1486/* #### Code section: filename_table ### */
1487
1488static const char *__pyx_f[] = {
1489 "pyinfile.pyx",
1490 "<stringsource>",
1491 "type.pxd",
1492};
1493/* #### Code section: utility_code_proto_before_types ### */
1494/* ForceInitThreads.proto */
1495#ifndef __PYX_FORCE_INIT_THREADS
1496 #define __PYX_FORCE_INIT_THREADS 0
1497#endif
1498
1499/* #### Code section: numeric_typedefs ### */
1500/* #### Code section: complex_type_declarations ### */
1501/* #### Code section: type_declarations ### */
1502
1503/*--- Type declarations ---*/
1504/* #### Code section: utility_code_proto ### */
1505
1506/* --- Runtime support code (head) --- */
1507/* Refnanny.proto */
1508#ifndef CYTHON_REFNANNY
1509 #define CYTHON_REFNANNY 0
1510#endif
1511#if CYTHON_REFNANNY
1512 typedef struct {
1513 void (*INCREF)(void*, PyObject*, Py_ssize_t);
1514 void (*DECREF)(void*, PyObject*, Py_ssize_t);
1515 void (*GOTREF)(void*, PyObject*, Py_ssize_t);
1516 void (*GIVEREF)(void*, PyObject*, Py_ssize_t);
1517 void* (*SetupContext)(const char*, Py_ssize_t, const char*);
1518 void (*FinishContext)(void**);
1519 } __Pyx_RefNannyAPIStruct;
1520 static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
1521 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
1522 #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
1523#ifdef WITH_THREAD
1524 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1525 if (acquire_gil) {\
1526 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1527 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\
1528 PyGILState_Release(__pyx_gilstate_save);\
1529 } else {\
1530 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\
1531 }
1532 #define __Pyx_RefNannyFinishContextNogil() {\
1533 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1534 __Pyx_RefNannyFinishContext();\
1535 PyGILState_Release(__pyx_gilstate_save);\
1536 }
1537#else
1538 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1539 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__))
1540 #define __Pyx_RefNannyFinishContextNogil() __Pyx_RefNannyFinishContext()
1541#endif
1542 #define __Pyx_RefNannyFinishContextNogil() {\
1543 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1544 __Pyx_RefNannyFinishContext();\
1545 PyGILState_Release(__pyx_gilstate_save);\
1546 }
1547 #define __Pyx_RefNannyFinishContext()\
1548 __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
1549 #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
1550 #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
1551 #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
1552 #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
1553 #define __Pyx_XINCREF(r) do { if((r) == NULL); else {__Pyx_INCREF(r); }} while(0)
1554 #define __Pyx_XDECREF(r) do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0)
1555 #define __Pyx_XGOTREF(r) do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0)
1556 #define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0)
1557#else
1558 #define __Pyx_RefNannyDeclarations
1559 #define __Pyx_RefNannySetupContext(name, acquire_gil)
1560 #define __Pyx_RefNannyFinishContextNogil()
1561 #define __Pyx_RefNannyFinishContext()
1562 #define __Pyx_INCREF(r) Py_INCREF(r)
1563 #define __Pyx_DECREF(r) Py_DECREF(r)
1564 #define __Pyx_GOTREF(r)
1565 #define __Pyx_GIVEREF(r)
1566 #define __Pyx_XINCREF(r) Py_XINCREF(r)
1567 #define __Pyx_XDECREF(r) Py_XDECREF(r)
1568 #define __Pyx_XGOTREF(r)
1569 #define __Pyx_XGIVEREF(r)
1570#endif
1571#define __Pyx_Py_XDECREF_SET(r, v) do {\
1572 PyObject *tmp = (PyObject *) r;\
1573 r = v; Py_XDECREF(tmp);\
1574 } while (0)
1575#define __Pyx_XDECREF_SET(r, v) do {\
1576 PyObject *tmp = (PyObject *) r;\
1577 r = v; __Pyx_XDECREF(tmp);\
1578 } while (0)
1579#define __Pyx_DECREF_SET(r, v) do {\
1580 PyObject *tmp = (PyObject *) r;\
1581 r = v; __Pyx_DECREF(tmp);\
1582 } while (0)
1583#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1584#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1585
1586/* PyErrExceptionMatches.proto */
1587#if CYTHON_FAST_THREAD_STATE
1588#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1589static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1590#else
1591#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
1592#endif
1593
1594/* PyThreadStateGet.proto */
1595#if CYTHON_FAST_THREAD_STATE
1596#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
1597#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
1598#if PY_VERSION_HEX >= 0x030C00A6
1599#define __Pyx_PyErr_Occurred() (__pyx_tstate->current_exception != NULL)
1600#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->current_exception ? (PyObject*) Py_TYPE(__pyx_tstate->current_exception) : (PyObject*) NULL)
1601#else
1602#define __Pyx_PyErr_Occurred() (__pyx_tstate->curexc_type != NULL)
1603#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->curexc_type)
1604#endif
1605#else
1606#define __Pyx_PyThreadState_declare
1607#define __Pyx_PyThreadState_assign
1608#define __Pyx_PyErr_Occurred() (PyErr_Occurred() != NULL)
1609#define __Pyx_PyErr_CurrentExceptionType() PyErr_Occurred()
1610#endif
1611
1612/* PyErrFetchRestore.proto */
1613#if CYTHON_FAST_THREAD_STATE
1614#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1615#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1616#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1617#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1618#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1619static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1620static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1621#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A6
1622#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1623#else
1624#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1625#endif
1626#else
1627#define __Pyx_PyErr_Clear() PyErr_Clear()
1628#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1629#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
1630#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
1631#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
1632#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
1633#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
1634#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
1635#endif
1636
1637/* PyObjectGetAttrStr.proto */
1638#if CYTHON_USE_TYPE_SLOTS
1639static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1640#else
1641#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1642#endif
1643
1644/* PyObjectGetAttrStrNoError.proto */
1645static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);
1646
1647/* GetBuiltinName.proto */
1648static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1649
1650/* PyFunctionFastCall.proto */
1651#if CYTHON_FAST_PYCALL
1652#if !CYTHON_VECTORCALL
1653#define __Pyx_PyFunction_FastCall(func, args, nargs)\
1654 __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1655static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
1656#endif
1657#define __Pyx_BUILD_ASSERT_EXPR(cond)\
1658 (sizeof(char [1 - 2*!(cond)]) - 1)
1659#ifndef Py_MEMBER_SIZE
1660#define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
1661#endif
1662#if !CYTHON_VECTORCALL
1663#if PY_VERSION_HEX >= 0x03080000
1664 #include "frameobject.h"
1665#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API
1666 #ifndef Py_BUILD_CORE
1667 #define Py_BUILD_CORE 1
1668 #endif
1669 #include "internal/pycore_frame.h"
1670#endif
1671 #define __Pxy_PyFrame_Initialize_Offsets()
1672 #define __Pyx_PyFrame_GetLocalsplus(frame) ((frame)->f_localsplus)
1673#else
1674 static size_t __pyx_pyframe_localsplus_offset = 0;
1675 #include "frameobject.h"
1676 #define __Pxy_PyFrame_Initialize_Offsets()\
1677 ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
1678 (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
1679 #define __Pyx_PyFrame_GetLocalsplus(frame)\
1680 (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
1681#endif
1682#endif
1683#endif
1684
1685/* PyObjectCall.proto */
1686#if CYTHON_COMPILING_IN_CPYTHON
1687static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1688#else
1689#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1690#endif
1691
1692/* PyObjectCallMethO.proto */
1693#if CYTHON_COMPILING_IN_CPYTHON
1694static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1695#endif
1696
1697/* PyObjectFastCall.proto */
1698#define __Pyx_PyObject_FastCall(func, args, nargs) __Pyx_PyObject_FastCallDict(func, args, (size_t)(nargs), NULL)
1699static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs);
1700
1701/* MoveIfSupported.proto */
1702#if CYTHON_USE_CPP_STD_MOVE
1703 #include <utility>
1704 #define __PYX_STD_MOVE_IF_SUPPORTED(x) std::move(x)
1705#else
1706 #define __PYX_STD_MOVE_IF_SUPPORTED(x) x
1707#endif
1708
1709/* PyExec.proto */
1710static PyObject* __Pyx_PyExec3(PyObject*, PyObject*, PyObject*);
1711static CYTHON_INLINE PyObject* __Pyx_PyExec2(PyObject*, PyObject*);
1712
1713/* PyDictContains.proto */
1714static CYTHON_INLINE int __Pyx_PyDict_ContainsTF(PyObject* item, PyObject* dict, int eq) {
1715 int result = PyDict_Contains(dict, item);
1716 return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
1717}
1718
1719/* DictGetItem.proto */
1720#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
1721static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
1722#define __Pyx_PyObject_Dict_GetItem(obj, name)\
1723 (likely(PyDict_CheckExact(obj)) ?\
1724 __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
1725#else
1726#define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
1727#define __Pyx_PyObject_Dict_GetItem(obj, name) PyObject_GetItem(obj, name)
1728#endif
1729
1730/* RaiseException.proto */
1731static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1732
1733/* CallableCheck.proto */
1734#if CYTHON_USE_TYPE_SLOTS && PY_MAJOR_VERSION >= 3
1735#define __Pyx_PyCallable_Check(obj) (Py_TYPE(obj)->tp_call != NULL)
1736#else
1737#define __Pyx_PyCallable_Check(obj) PyCallable_Check(obj)
1738#endif
1739
1740/* IncludeStringH.proto */
1741#include <string.h>
1742
1743/* Import.proto */
1744static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1745
1746/* ImportFrom.proto */
1747static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
1748
1749/* ImportDottedModule.proto */
1750static PyObject *__Pyx_ImportDottedModule(PyObject *name, PyObject *parts_tuple);
1751#if PY_MAJOR_VERSION >= 3
1752static PyObject *__Pyx_ImportDottedModule_WalkParts(PyObject *module, PyObject *name, PyObject *parts_tuple);
1753#endif
1754
1755/* PyDictVersioning.proto */
1756#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1757#define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
1758#define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
1759#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1760 (version_var) = __PYX_GET_DICT_VERSION(dict);\
1761 (cache_var) = (value);
1762#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1763 static PY_UINT64_T __pyx_dict_version = 0;\
1764 static PyObject *__pyx_dict_cached_value = NULL;\
1765 if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1766 (VAR) = __pyx_dict_cached_value;\
1767 } else {\
1768 (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1769 __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1770 }\
1771}
1772static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1773static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1774static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1775#else
1776#define __PYX_GET_DICT_VERSION(dict) (0)
1777#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1778#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
1779#endif
1780
1781/* GetModuleGlobalName.proto */
1782#if CYTHON_USE_DICT_VERSIONS
1783#define __Pyx_GetModuleGlobalName(var, name) do {\
1784 static PY_UINT64_T __pyx_dict_version = 0;\
1785 static PyObject *__pyx_dict_cached_value = NULL;\
1786 (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
1787 (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
1788 __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1789} while(0)
1790#define __Pyx_GetModuleGlobalNameUncached(var, name) do {\
1791 PY_UINT64_T __pyx_dict_version;\
1792 PyObject *__pyx_dict_cached_value;\
1793 (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1794} while(0)
1795static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1796#else
1797#define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1798#define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1799static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
1800#endif
1801
1802/* TypeImport.proto */
1803#ifndef __PYX_HAVE_RT_ImportType_proto_3_0_11
1804#define __PYX_HAVE_RT_ImportType_proto_3_0_11
1805#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
1806#include <stdalign.h>
1807#endif
1808#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || __cplusplus >= 201103L
1809#define __PYX_GET_STRUCT_ALIGNMENT_3_0_11(s) alignof(s)
1810#else
1811#define __PYX_GET_STRUCT_ALIGNMENT_3_0_11(s) sizeof(void*)
1812#endif
1813enum __Pyx_ImportType_CheckSize_3_0_11 {
1814 __Pyx_ImportType_CheckSize_Error_3_0_11 = 0,
1815 __Pyx_ImportType_CheckSize_Warn_3_0_11 = 1,
1816 __Pyx_ImportType_CheckSize_Ignore_3_0_11 = 2
1817};
1818static PyTypeObject *__Pyx_ImportType_3_0_11(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_11 check_size);
1819#endif
1820
1821/* GetTopmostException.proto */
1822#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE
1823static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
1824#endif
1825
1826/* SaveResetException.proto */
1827#if CYTHON_FAST_THREAD_STATE
1828#define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
1829static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1830#define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
1831static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1832#else
1833#define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
1834#define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
1835#endif
1836
1837/* GetException.proto */
1838#if CYTHON_FAST_THREAD_STATE
1839#define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
1840static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1841#else
1842static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1843#endif
1844
1845/* CLineInTraceback.proto */
1846#ifdef CYTHON_CLINE_IN_TRACEBACK
1847#define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1848#else
1849static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
1850#endif
1851
1852/* CodeObjectCache.proto */
1853#if !CYTHON_COMPILING_IN_LIMITED_API
1854typedef struct {
1855 PyCodeObject* code_object;
1856 int code_line;
1857} __Pyx_CodeObjectCacheEntry;
1858struct __Pyx_CodeObjectCache {
1859 int count;
1860 int max_count;
1861 __Pyx_CodeObjectCacheEntry* entries;
1862};
1863static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
1864static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
1865static PyCodeObject *__pyx_find_code_object(int code_line);
1866static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
1867#endif
1868
1869/* AddTraceback.proto */
1870static void __Pyx_AddTraceback(const char *funcname, int c_line,
1871 int py_line, const char *filename);
1872
1873/* CppExceptionConversion.proto */
1874#ifndef __Pyx_CppExn2PyErr
1875#include <new>
1876#include <typeinfo>
1877#include <stdexcept>
1878#include <ios>
1879static void __Pyx_CppExn2PyErr() {
1880 try {
1881 if (PyErr_Occurred())
1882 ; // let the latest Python exn pass through and ignore the current one
1883 else
1884 throw;
1885 } catch (const std::bad_alloc& exn) {
1886 PyErr_SetString(PyExc_MemoryError, exn.what());
1887 } catch (const std::bad_cast& exn) {
1888 PyErr_SetString(PyExc_TypeError, exn.what());
1889 } catch (const std::bad_typeid& exn) {
1890 PyErr_SetString(PyExc_TypeError, exn.what());
1891 } catch (const std::domain_error& exn) {
1892 PyErr_SetString(PyExc_ValueError, exn.what());
1893 } catch (const std::invalid_argument& exn) {
1894 PyErr_SetString(PyExc_ValueError, exn.what());
1895 } catch (const std::ios_base::failure& exn) {
1896 PyErr_SetString(PyExc_IOError, exn.what());
1897 } catch (const std::out_of_range& exn) {
1898 PyErr_SetString(PyExc_IndexError, exn.what());
1899 } catch (const std::overflow_error& exn) {
1900 PyErr_SetString(PyExc_OverflowError, exn.what());
1901 } catch (const std::range_error& exn) {
1902 PyErr_SetString(PyExc_ArithmeticError, exn.what());
1903 } catch (const std::underflow_error& exn) {
1904 PyErr_SetString(PyExc_ArithmeticError, exn.what());
1905 } catch (const std::exception& exn) {
1906 PyErr_SetString(PyExc_RuntimeError, exn.what());
1907 }
1908 catch (...)
1909 {
1910 PyErr_SetString(PyExc_RuntimeError, "Unknown exception");
1911 }
1912}
1913#endif
1914
1915/* FormatTypeName.proto */
1916#if CYTHON_COMPILING_IN_LIMITED_API
1917typedef PyObject *__Pyx_TypeName;
1918#define __Pyx_FMT_TYPENAME "%U"
1919static __Pyx_TypeName __Pyx_PyType_GetName(PyTypeObject* tp);
1920#define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj)
1921#else
1922typedef const char *__Pyx_TypeName;
1923#define __Pyx_FMT_TYPENAME "%.200s"
1924#define __Pyx_PyType_GetName(tp) ((tp)->tp_name)
1925#define __Pyx_DECREF_TypeName(obj)
1926#endif
1927
1928/* GCCDiagnostics.proto */
1929#if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
1930#define __Pyx_HAS_GCC_DIAGNOSTIC
1931#endif
1932
1933/* CIntToPy.proto */
1934static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
1935
1936/* CIntFromPy.proto */
1937static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
1938
1939/* CIntFromPy.proto */
1940static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
1941
1942/* FastTypeChecks.proto */
1943#if CYTHON_COMPILING_IN_CPYTHON
1944#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1945#define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2)
1946static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1947static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b);
1948static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1949static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1950#else
1951#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1952#define __Pyx_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2))
1953#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1954#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
1955#endif
1956#define __Pyx_PyErr_ExceptionMatches2(err1, err2) __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_CurrentExceptionType(), err1, err2)
1957#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1958
1959/* CheckBinaryVersion.proto */
1960static unsigned long __Pyx_get_runtime_version(void);
1961static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer);
1962
1963/* FunctionExport.proto */
1964static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig);
1965
1966/* InitStrings.proto */
1967static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
1968
1969/* #### Code section: module_declarations ### */
1970
1971/* Module declarations from "libc.string" */
1972
1973/* Module declarations from "libcpp.string" */
1974
1975/* Module declarations from "libc.stdio" */
1976
1977/* Module declarations from "__builtin__" */
1978
1979/* Module declarations from "cpython.type" */
1980
1981/* Module declarations from "cpython" */
1982
1983/* Module declarations from "cpython.object" */
1984
1985/* Module declarations from "cpython.exc" */
1986
1987/* Module declarations from "pyinfile" */
1988static std::string __pyx_f_8pyinfile_str_py_to_cpp(PyObject *); /*proto*/
1989static PyObject *__pyx_f_8pyinfile_std_string_to_py(std::string); /*proto*/
1990__PYX_EXTERN_C std::string CyclusPyToJson(std::string); /*proto*/
1991__PYX_EXTERN_C std::string CyclusJsonToPy(std::string); /*proto*/
1992static CYTHON_INLINE PyObject *__pyx_convert_PyObject_string_to_py_6libcpp_6string_std__in_string(std::string const &); /*proto*/
1993static CYTHON_INLINE PyObject *__pyx_convert_PyUnicode_string_to_py_6libcpp_6string_std__in_string(std::string const &); /*proto*/
1994static CYTHON_INLINE PyObject *__pyx_convert_PyStr_string_to_py_6libcpp_6string_std__in_string(std::string const &); /*proto*/
1995static CYTHON_INLINE PyObject *__pyx_convert_PyBytes_string_to_py_6libcpp_6string_std__in_string(std::string const &); /*proto*/
1996static CYTHON_INLINE PyObject *__pyx_convert_PyByteArray_string_to_py_6libcpp_6string_std__in_string(std::string const &); /*proto*/
1997/* #### Code section: typeinfo ### */
1998/* #### Code section: before_global_var ### */
1999#define __Pyx_MODULE_NAME "pyinfile"
2000extern int __pyx_module_is_main_pyinfile;
2001int __pyx_module_is_main_pyinfile = 0;
2002
2003/* Implementation of "pyinfile" */
2004/* #### Code section: global_var ### */
2005static PyObject *__pyx_builtin_ImportError;
2006static PyObject *__pyx_builtin_RuntimeError;
2007/* #### Code section: string_decls ### */
2008static const char __pyx_k_[] = "\n";
2009static const char __pyx_k__4[] = ".";
2010static const char __pyx_k__5[] = "*";
2011static const char __pyx_k__7[] = "?";
2012static const char __pyx_k_json[] = "json";
2013static const char __pyx_k_main[] = "__main__";
2014static const char __pyx_k_name[] = "__name__";
2015static const char __pyx_k_spec[] = "__spec__";
2016static const char __pyx_k_test[] = "__test__";
2017static const char __pyx_k_dumps[] = "dumps";
2018static const char __pyx_k_loads[] = "loads";
2019static const char __pyx_k_decode[] = "decode";
2020static const char __pyx_k_encode[] = "encode";
2021static const char __pyx_k_import[] = "__import__";
2022static const char __pyx_k_indent[] = "indent";
2023static const char __pyx_k_pprint[] = "pprint";
2024static const char __pyx_k_Mapping[] = "Mapping";
2025static const char __pyx_k_pformat[] = "pformat";
2026static const char __pyx_k_builtins[] = "__builtins__";
2027static const char __pyx_k_endswith[] = "endswith";
2028static const char __pyx_k_pprintpp[] = "pprintpp";
2029static const char __pyx_k_sort_keys[] = "sort_keys";
2030static const char __pyx_k_SIMULATION[] = "SIMULATION";
2031static const char __pyx_k_Simulation[] = "Simulation";
2032static const char __pyx_k_simulation[] = "simulation";
2033static const char __pyx_k_ImportError[] = "ImportError";
2034static const char __pyx_k_RuntimeError[] = "RuntimeError";
2035static const char __pyx_k_SIMULATION_2[] = "SIMULATION = ";
2036static const char __pyx_k_initializing[] = "_initializing";
2037static const char __pyx_k_collections_abc[] = "collections.abc";
2038static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
2039static const char __pyx_k_Cyclus_Python_input_file_tools[] = "Cyclus Python input file tools.";
2040static const char __pyx_k_simulation_not_found_in_python_f[] = "simulation not found in python file.";
2041static const char __pyx_k_top_level_simulation_object_does[] = "top-level simulation object does not have proper type.";
2042/* #### Code section: decls ### */
2043/* #### Code section: late_includes ### */
2044/* #### Code section: module_state ### */
2045typedef struct {
2046 PyObject *__pyx_d;
2047 PyObject *__pyx_b;
2048 PyObject *__pyx_cython_runtime;
2049 PyObject *__pyx_empty_tuple;
2050 PyObject *__pyx_empty_bytes;
2051 PyObject *__pyx_empty_unicode;
2052 #ifdef __Pyx_CyFunction_USED
2053 PyTypeObject *__pyx_CyFunctionType;
2054 #endif
2055 #ifdef __Pyx_FusedFunction_USED
2056 PyTypeObject *__pyx_FusedFunctionType;
2057 #endif
2058 #ifdef __Pyx_Generator_USED
2059 PyTypeObject *__pyx_GeneratorType;
2060 #endif
2061 #ifdef __Pyx_IterableCoroutine_USED
2062 PyTypeObject *__pyx_IterableCoroutineType;
2063 #endif
2064 #ifdef __Pyx_Coroutine_USED
2065 PyTypeObject *__pyx_CoroutineAwaitType;
2066 #endif
2067 #ifdef __Pyx_Coroutine_USED
2068 PyTypeObject *__pyx_CoroutineType;
2069 #endif
2070 #if CYTHON_USE_MODULE_STATE
2071 #endif
2072 #if CYTHON_USE_MODULE_STATE
2073 #endif
2074 #if CYTHON_USE_MODULE_STATE
2075 #endif
2076 #if CYTHON_USE_MODULE_STATE
2077 #endif
2078 #if CYTHON_USE_MODULE_STATE
2079 #endif
2080 PyTypeObject *__pyx_ptype_7cpython_4type_type;
2081 #if CYTHON_USE_MODULE_STATE
2082 #endif
2083 #if CYTHON_USE_MODULE_STATE
2084 #endif
2085 #if CYTHON_USE_MODULE_STATE
2086 #endif
2087 #if CYTHON_USE_MODULE_STATE
2088 #endif
2089 PyObject *__pyx_kp_u_;
2090 PyObject *__pyx_n_s_ImportError;
2091 PyObject *__pyx_n_s_Mapping;
2092 PyObject *__pyx_n_s_RuntimeError;
2093 PyObject *__pyx_n_u_SIMULATION;
2094 PyObject *__pyx_kp_u_SIMULATION_2;
2095 PyObject *__pyx_n_u_Simulation;
2096 PyObject *__pyx_kp_u__4;
2097 PyObject *__pyx_n_s__5;
2098 PyObject *__pyx_n_s__7;
2099 PyObject *__pyx_n_s_builtins;
2100 PyObject *__pyx_n_s_cline_in_traceback;
2101 PyObject *__pyx_n_s_collections_abc;
2102 PyObject *__pyx_n_s_decode;
2103 PyObject *__pyx_n_s_dumps;
2104 PyObject *__pyx_n_s_encode;
2105 PyObject *__pyx_n_s_endswith;
2106 PyObject *__pyx_n_s_import;
2107 PyObject *__pyx_n_s_indent;
2108 PyObject *__pyx_n_s_initializing;
2109 PyObject *__pyx_n_s_json;
2110 PyObject *__pyx_n_s_loads;
2111 PyObject *__pyx_n_s_main;
2112 PyObject *__pyx_n_s_name;
2113 PyObject *__pyx_n_s_pformat;
2114 PyObject *__pyx_n_s_pprint;
2115 PyObject *__pyx_n_s_pprintpp;
2116 PyObject *__pyx_n_u_simulation;
2117 PyObject *__pyx_kp_u_simulation_not_found_in_python_f;
2118 PyObject *__pyx_n_s_sort_keys;
2119 PyObject *__pyx_n_s_spec;
2120 PyObject *__pyx_n_s_test;
2121 PyObject *__pyx_kp_u_top_level_simulation_object_does;
2122 PyObject *__pyx_int_1;
2123 PyObject *__pyx_tuple__2;
2124 PyObject *__pyx_tuple__3;
2125 PyObject *__pyx_tuple__6;
2126} __pyx_mstate;
2127
2128#if CYTHON_USE_MODULE_STATE
2129#ifdef __cplusplus
2130namespace {
2131 extern struct PyModuleDef __pyx_moduledef;
2132} /* anonymous namespace */
2133#else
2134static struct PyModuleDef __pyx_moduledef;
2135#endif
2136
2137#define __pyx_mstate(o) ((__pyx_mstate *)__Pyx_PyModule_GetState(o))
2138
2139#define __pyx_mstate_global (__pyx_mstate(PyState_FindModule(&__pyx_moduledef)))
2140
2141#define __pyx_m (PyState_FindModule(&__pyx_moduledef))
2142#else
2143static __pyx_mstate __pyx_mstate_global_static =
2144#ifdef __cplusplus
2145 {};
2146#else
2147 {0};
2148#endif
2149static __pyx_mstate *__pyx_mstate_global = &__pyx_mstate_global_static;
2150#endif
2151/* #### Code section: module_state_clear ### */
2152#if CYTHON_USE_MODULE_STATE
2153static int __pyx_m_clear(PyObject *m) {
2154 __pyx_mstate *clear_module_state = __pyx_mstate(m);
2155 if (!clear_module_state) return 0;
2156 Py_CLEAR(clear_module_state->__pyx_d);
2157 Py_CLEAR(clear_module_state->__pyx_b);
2158 Py_CLEAR(clear_module_state->__pyx_cython_runtime);
2159 Py_CLEAR(clear_module_state->__pyx_empty_tuple);
2160 Py_CLEAR(clear_module_state->__pyx_empty_bytes);
2161 Py_CLEAR(clear_module_state->__pyx_empty_unicode);
2162 #ifdef __Pyx_CyFunction_USED
2163 Py_CLEAR(clear_module_state->__pyx_CyFunctionType);
2164 #endif
2165 #ifdef __Pyx_FusedFunction_USED
2166 Py_CLEAR(clear_module_state->__pyx_FusedFunctionType);
2167 #endif
2168 Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_4type_type);
2169 Py_CLEAR(clear_module_state->__pyx_kp_u_);
2170 Py_CLEAR(clear_module_state->__pyx_n_s_ImportError);
2171 Py_CLEAR(clear_module_state->__pyx_n_s_Mapping);
2172 Py_CLEAR(clear_module_state->__pyx_n_s_RuntimeError);
2173 Py_CLEAR(clear_module_state->__pyx_n_u_SIMULATION);
2174 Py_CLEAR(clear_module_state->__pyx_kp_u_SIMULATION_2);
2175 Py_CLEAR(clear_module_state->__pyx_n_u_Simulation);
2176 Py_CLEAR(clear_module_state->__pyx_kp_u__4);
2177 Py_CLEAR(clear_module_state->__pyx_n_s__5);
2178 Py_CLEAR(clear_module_state->__pyx_n_s__7);
2179 Py_CLEAR(clear_module_state->__pyx_n_s_builtins);
2180 Py_CLEAR(clear_module_state->__pyx_n_s_cline_in_traceback);
2181 Py_CLEAR(clear_module_state->__pyx_n_s_collections_abc);
2182 Py_CLEAR(clear_module_state->__pyx_n_s_decode);
2183 Py_CLEAR(clear_module_state->__pyx_n_s_dumps);
2184 Py_CLEAR(clear_module_state->__pyx_n_s_encode);
2185 Py_CLEAR(clear_module_state->__pyx_n_s_endswith);
2186 Py_CLEAR(clear_module_state->__pyx_n_s_import);
2187 Py_CLEAR(clear_module_state->__pyx_n_s_indent);
2188 Py_CLEAR(clear_module_state->__pyx_n_s_initializing);
2189 Py_CLEAR(clear_module_state->__pyx_n_s_json);
2190 Py_CLEAR(clear_module_state->__pyx_n_s_loads);
2191 Py_CLEAR(clear_module_state->__pyx_n_s_main);
2192 Py_CLEAR(clear_module_state->__pyx_n_s_name);
2193 Py_CLEAR(clear_module_state->__pyx_n_s_pformat);
2194 Py_CLEAR(clear_module_state->__pyx_n_s_pprint);
2195 Py_CLEAR(clear_module_state->__pyx_n_s_pprintpp);
2196 Py_CLEAR(clear_module_state->__pyx_n_u_simulation);
2197 Py_CLEAR(clear_module_state->__pyx_kp_u_simulation_not_found_in_python_f);
2198 Py_CLEAR(clear_module_state->__pyx_n_s_sort_keys);
2199 Py_CLEAR(clear_module_state->__pyx_n_s_spec);
2200 Py_CLEAR(clear_module_state->__pyx_n_s_test);
2201 Py_CLEAR(clear_module_state->__pyx_kp_u_top_level_simulation_object_does);
2202 Py_CLEAR(clear_module_state->__pyx_int_1);
2203 Py_CLEAR(clear_module_state->__pyx_tuple__2);
2204 Py_CLEAR(clear_module_state->__pyx_tuple__3);
2205 Py_CLEAR(clear_module_state->__pyx_tuple__6);
2206 return 0;
2207}
2208#endif
2209/* #### Code section: module_state_traverse ### */
2210#if CYTHON_USE_MODULE_STATE
2211static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) {
2212 __pyx_mstate *traverse_module_state = __pyx_mstate(m);
2213 if (!traverse_module_state) return 0;
2214 Py_VISIT(traverse_module_state->__pyx_d);
2215 Py_VISIT(traverse_module_state->__pyx_b);
2216 Py_VISIT(traverse_module_state->__pyx_cython_runtime);
2217 Py_VISIT(traverse_module_state->__pyx_empty_tuple);
2218 Py_VISIT(traverse_module_state->__pyx_empty_bytes);
2219 Py_VISIT(traverse_module_state->__pyx_empty_unicode);
2220 #ifdef __Pyx_CyFunction_USED
2221 Py_VISIT(traverse_module_state->__pyx_CyFunctionType);
2222 #endif
2223 #ifdef __Pyx_FusedFunction_USED
2224 Py_VISIT(traverse_module_state->__pyx_FusedFunctionType);
2225 #endif
2226 Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_4type_type);
2227 Py_VISIT(traverse_module_state->__pyx_kp_u_);
2228 Py_VISIT(traverse_module_state->__pyx_n_s_ImportError);
2229 Py_VISIT(traverse_module_state->__pyx_n_s_Mapping);
2230 Py_VISIT(traverse_module_state->__pyx_n_s_RuntimeError);
2231 Py_VISIT(traverse_module_state->__pyx_n_u_SIMULATION);
2232 Py_VISIT(traverse_module_state->__pyx_kp_u_SIMULATION_2);
2233 Py_VISIT(traverse_module_state->__pyx_n_u_Simulation);
2234 Py_VISIT(traverse_module_state->__pyx_kp_u__4);
2235 Py_VISIT(traverse_module_state->__pyx_n_s__5);
2236 Py_VISIT(traverse_module_state->__pyx_n_s__7);
2237 Py_VISIT(traverse_module_state->__pyx_n_s_builtins);
2238 Py_VISIT(traverse_module_state->__pyx_n_s_cline_in_traceback);
2239 Py_VISIT(traverse_module_state->__pyx_n_s_collections_abc);
2240 Py_VISIT(traverse_module_state->__pyx_n_s_decode);
2241 Py_VISIT(traverse_module_state->__pyx_n_s_dumps);
2242 Py_VISIT(traverse_module_state->__pyx_n_s_encode);
2243 Py_VISIT(traverse_module_state->__pyx_n_s_endswith);
2244 Py_VISIT(traverse_module_state->__pyx_n_s_import);
2245 Py_VISIT(traverse_module_state->__pyx_n_s_indent);
2246 Py_VISIT(traverse_module_state->__pyx_n_s_initializing);
2247 Py_VISIT(traverse_module_state->__pyx_n_s_json);
2248 Py_VISIT(traverse_module_state->__pyx_n_s_loads);
2249 Py_VISIT(traverse_module_state->__pyx_n_s_main);
2250 Py_VISIT(traverse_module_state->__pyx_n_s_name);
2251 Py_VISIT(traverse_module_state->__pyx_n_s_pformat);
2252 Py_VISIT(traverse_module_state->__pyx_n_s_pprint);
2253 Py_VISIT(traverse_module_state->__pyx_n_s_pprintpp);
2254 Py_VISIT(traverse_module_state->__pyx_n_u_simulation);
2255 Py_VISIT(traverse_module_state->__pyx_kp_u_simulation_not_found_in_python_f);
2256 Py_VISIT(traverse_module_state->__pyx_n_s_sort_keys);
2257 Py_VISIT(traverse_module_state->__pyx_n_s_spec);
2258 Py_VISIT(traverse_module_state->__pyx_n_s_test);
2259 Py_VISIT(traverse_module_state->__pyx_kp_u_top_level_simulation_object_does);
2260 Py_VISIT(traverse_module_state->__pyx_int_1);
2261 Py_VISIT(traverse_module_state->__pyx_tuple__2);
2262 Py_VISIT(traverse_module_state->__pyx_tuple__3);
2263 Py_VISIT(traverse_module_state->__pyx_tuple__6);
2264 return 0;
2265}
2266#endif
2267/* #### Code section: module_state_defines ### */
2268#define __pyx_d __pyx_mstate_global->__pyx_d
2269#define __pyx_b __pyx_mstate_global->__pyx_b
2270#define __pyx_cython_runtime __pyx_mstate_global->__pyx_cython_runtime
2271#define __pyx_empty_tuple __pyx_mstate_global->__pyx_empty_tuple
2272#define __pyx_empty_bytes __pyx_mstate_global->__pyx_empty_bytes
2273#define __pyx_empty_unicode __pyx_mstate_global->__pyx_empty_unicode
2274#ifdef __Pyx_CyFunction_USED
2275#define __pyx_CyFunctionType __pyx_mstate_global->__pyx_CyFunctionType
2276#endif
2277#ifdef __Pyx_FusedFunction_USED
2278#define __pyx_FusedFunctionType __pyx_mstate_global->__pyx_FusedFunctionType
2279#endif
2280#ifdef __Pyx_Generator_USED
2281#define __pyx_GeneratorType __pyx_mstate_global->__pyx_GeneratorType
2282#endif
2283#ifdef __Pyx_IterableCoroutine_USED
2284#define __pyx_IterableCoroutineType __pyx_mstate_global->__pyx_IterableCoroutineType
2285#endif
2286#ifdef __Pyx_Coroutine_USED
2287#define __pyx_CoroutineAwaitType __pyx_mstate_global->__pyx_CoroutineAwaitType
2288#endif
2289#ifdef __Pyx_Coroutine_USED
2290#define __pyx_CoroutineType __pyx_mstate_global->__pyx_CoroutineType
2291#endif
2292#if CYTHON_USE_MODULE_STATE
2293#endif
2294#if CYTHON_USE_MODULE_STATE
2295#endif
2296#if CYTHON_USE_MODULE_STATE
2297#endif
2298#if CYTHON_USE_MODULE_STATE
2299#endif
2300#if CYTHON_USE_MODULE_STATE
2301#endif
2302#define __pyx_ptype_7cpython_4type_type __pyx_mstate_global->__pyx_ptype_7cpython_4type_type
2303#if CYTHON_USE_MODULE_STATE
2304#endif
2305#if CYTHON_USE_MODULE_STATE
2306#endif
2307#if CYTHON_USE_MODULE_STATE
2308#endif
2309#if CYTHON_USE_MODULE_STATE
2310#endif
2311#define __pyx_kp_u_ __pyx_mstate_global->__pyx_kp_u_
2312#define __pyx_n_s_ImportError __pyx_mstate_global->__pyx_n_s_ImportError
2313#define __pyx_n_s_Mapping __pyx_mstate_global->__pyx_n_s_Mapping
2314#define __pyx_n_s_RuntimeError __pyx_mstate_global->__pyx_n_s_RuntimeError
2315#define __pyx_n_u_SIMULATION __pyx_mstate_global->__pyx_n_u_SIMULATION
2316#define __pyx_kp_u_SIMULATION_2 __pyx_mstate_global->__pyx_kp_u_SIMULATION_2
2317#define __pyx_n_u_Simulation __pyx_mstate_global->__pyx_n_u_Simulation
2318#define __pyx_kp_u__4 __pyx_mstate_global->__pyx_kp_u__4
2319#define __pyx_n_s__5 __pyx_mstate_global->__pyx_n_s__5
2320#define __pyx_n_s__7 __pyx_mstate_global->__pyx_n_s__7
2321#define __pyx_n_s_builtins __pyx_mstate_global->__pyx_n_s_builtins
2322#define __pyx_n_s_cline_in_traceback __pyx_mstate_global->__pyx_n_s_cline_in_traceback
2323#define __pyx_n_s_collections_abc __pyx_mstate_global->__pyx_n_s_collections_abc
2324#define __pyx_n_s_decode __pyx_mstate_global->__pyx_n_s_decode
2325#define __pyx_n_s_dumps __pyx_mstate_global->__pyx_n_s_dumps
2326#define __pyx_n_s_encode __pyx_mstate_global->__pyx_n_s_encode
2327#define __pyx_n_s_endswith __pyx_mstate_global->__pyx_n_s_endswith
2328#define __pyx_n_s_import __pyx_mstate_global->__pyx_n_s_import
2329#define __pyx_n_s_indent __pyx_mstate_global->__pyx_n_s_indent
2330#define __pyx_n_s_initializing __pyx_mstate_global->__pyx_n_s_initializing
2331#define __pyx_n_s_json __pyx_mstate_global->__pyx_n_s_json
2332#define __pyx_n_s_loads __pyx_mstate_global->__pyx_n_s_loads
2333#define __pyx_n_s_main __pyx_mstate_global->__pyx_n_s_main
2334#define __pyx_n_s_name __pyx_mstate_global->__pyx_n_s_name
2335#define __pyx_n_s_pformat __pyx_mstate_global->__pyx_n_s_pformat
2336#define __pyx_n_s_pprint __pyx_mstate_global->__pyx_n_s_pprint
2337#define __pyx_n_s_pprintpp __pyx_mstate_global->__pyx_n_s_pprintpp
2338#define __pyx_n_u_simulation __pyx_mstate_global->__pyx_n_u_simulation
2339#define __pyx_kp_u_simulation_not_found_in_python_f __pyx_mstate_global->__pyx_kp_u_simulation_not_found_in_python_f
2340#define __pyx_n_s_sort_keys __pyx_mstate_global->__pyx_n_s_sort_keys
2341#define __pyx_n_s_spec __pyx_mstate_global->__pyx_n_s_spec
2342#define __pyx_n_s_test __pyx_mstate_global->__pyx_n_s_test
2343#define __pyx_kp_u_top_level_simulation_object_does __pyx_mstate_global->__pyx_kp_u_top_level_simulation_object_does
2344#define __pyx_int_1 __pyx_mstate_global->__pyx_int_1
2345#define __pyx_tuple__2 __pyx_mstate_global->__pyx_tuple__2
2346#define __pyx_tuple__3 __pyx_mstate_global->__pyx_tuple__3
2347#define __pyx_tuple__6 __pyx_mstate_global->__pyx_tuple__6
2348/* #### Code section: module_code ### */
2349
2350/* "string.to_py":31
2351 *
2352 * @cname("__pyx_convert_PyObject_string_to_py_6libcpp_6string_std__in_string")
2353 * cdef inline object __pyx_convert_PyObject_string_to_py_6libcpp_6string_std__in_string(const string& s): # <<<<<<<<<<<<<<
2354 * return __Pyx_PyObject_FromStringAndSize(s.data(), s.size())
2355 * cdef extern from *:
2356 */
2357
2358static CYTHON_INLINE PyObject *__pyx_convert_PyObject_string_to_py_6libcpp_6string_std__in_string(std::string const &__pyx_v_s) {
2359 PyObject *__pyx_r = NULL;
2360 __Pyx_RefNannyDeclarations
2361 PyObject *__pyx_t_1 = NULL;
2362 int __pyx_lineno = 0;
2363 const char *__pyx_filename = NULL;
2364 int __pyx_clineno = 0;
2365 __Pyx_RefNannySetupContext("__pyx_convert_PyObject_string_to_py_6libcpp_6string_std__in_string", 1);
2366
2367 /* "string.to_py":32
2368 * @cname("__pyx_convert_PyObject_string_to_py_6libcpp_6string_std__in_string")
2369 * cdef inline object __pyx_convert_PyObject_string_to_py_6libcpp_6string_std__in_string(const string& s):
2370 * return __Pyx_PyObject_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<<
2371 * cdef extern from *:
2372 * cdef object __Pyx_PyUnicode_FromStringAndSize(const char*, size_t)
2373 */
2374 __Pyx_XDECREF(__pyx_r);
2375 __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)
2376 __Pyx_GOTREF(__pyx_t_1);
2377 __pyx_r = __pyx_t_1;
2378 __pyx_t_1 = 0;
2379 goto __pyx_L0;
2380
2381 /* "string.to_py":31
2382 *
2383 * @cname("__pyx_convert_PyObject_string_to_py_6libcpp_6string_std__in_string")
2384 * cdef inline object __pyx_convert_PyObject_string_to_py_6libcpp_6string_std__in_string(const string& s): # <<<<<<<<<<<<<<
2385 * return __Pyx_PyObject_FromStringAndSize(s.data(), s.size())
2386 * cdef extern from *:
2387 */
2388
2389 /* function exit code */
2390 __pyx_L1_error:;
2391 __Pyx_XDECREF(__pyx_t_1);
2392 __Pyx_AddTraceback("string.to_py.__pyx_convert_PyObject_string_to_py_6libcpp_6string_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
2393 __pyx_r = 0;
2394 __pyx_L0:;
2395 __Pyx_XGIVEREF(__pyx_r);
2396 __Pyx_RefNannyFinishContext();
2397 return __pyx_r;
2398}
2399
2400/* "string.to_py":37
2401 *
2402 * @cname("__pyx_convert_PyUnicode_string_to_py_6libcpp_6string_std__in_string")
2403 * cdef inline object __pyx_convert_PyUnicode_string_to_py_6libcpp_6string_std__in_string(const string& s): # <<<<<<<<<<<<<<
2404 * return __Pyx_PyUnicode_FromStringAndSize(s.data(), s.size())
2405 * cdef extern from *:
2406 */
2407
2408static CYTHON_INLINE PyObject *__pyx_convert_PyUnicode_string_to_py_6libcpp_6string_std__in_string(std::string const &__pyx_v_s) {
2409 PyObject *__pyx_r = NULL;
2410 __Pyx_RefNannyDeclarations
2411 PyObject *__pyx_t_1 = NULL;
2412 int __pyx_lineno = 0;
2413 const char *__pyx_filename = NULL;
2414 int __pyx_clineno = 0;
2415 __Pyx_RefNannySetupContext("__pyx_convert_PyUnicode_string_to_py_6libcpp_6string_std__in_string", 1);
2416
2417 /* "string.to_py":38
2418 * @cname("__pyx_convert_PyUnicode_string_to_py_6libcpp_6string_std__in_string")
2419 * cdef inline object __pyx_convert_PyUnicode_string_to_py_6libcpp_6string_std__in_string(const string& s):
2420 * return __Pyx_PyUnicode_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<<
2421 * cdef extern from *:
2422 * cdef object __Pyx_PyStr_FromStringAndSize(const char*, size_t)
2423 */
2424 __Pyx_XDECREF(__pyx_r);
2425 __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)
2426 __Pyx_GOTREF(__pyx_t_1);
2427 __pyx_r = __pyx_t_1;
2428 __pyx_t_1 = 0;
2429 goto __pyx_L0;
2430
2431 /* "string.to_py":37
2432 *
2433 * @cname("__pyx_convert_PyUnicode_string_to_py_6libcpp_6string_std__in_string")
2434 * cdef inline object __pyx_convert_PyUnicode_string_to_py_6libcpp_6string_std__in_string(const string& s): # <<<<<<<<<<<<<<
2435 * return __Pyx_PyUnicode_FromStringAndSize(s.data(), s.size())
2436 * cdef extern from *:
2437 */
2438
2439 /* function exit code */
2440 __pyx_L1_error:;
2441 __Pyx_XDECREF(__pyx_t_1);
2442 __Pyx_AddTraceback("string.to_py.__pyx_convert_PyUnicode_string_to_py_6libcpp_6string_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
2443 __pyx_r = 0;
2444 __pyx_L0:;
2445 __Pyx_XGIVEREF(__pyx_r);
2446 __Pyx_RefNannyFinishContext();
2447 return __pyx_r;
2448}
2449
2450/* "string.to_py":43
2451 *
2452 * @cname("__pyx_convert_PyStr_string_to_py_6libcpp_6string_std__in_string")
2453 * cdef inline object __pyx_convert_PyStr_string_to_py_6libcpp_6string_std__in_string(const string& s): # <<<<<<<<<<<<<<
2454 * return __Pyx_PyStr_FromStringAndSize(s.data(), s.size())
2455 * cdef extern from *:
2456 */
2457
2458static CYTHON_INLINE PyObject *__pyx_convert_PyStr_string_to_py_6libcpp_6string_std__in_string(std::string const &__pyx_v_s) {
2459 PyObject *__pyx_r = NULL;
2460 __Pyx_RefNannyDeclarations
2461 PyObject *__pyx_t_1 = NULL;
2462 int __pyx_lineno = 0;
2463 const char *__pyx_filename = NULL;
2464 int __pyx_clineno = 0;
2465 __Pyx_RefNannySetupContext("__pyx_convert_PyStr_string_to_py_6libcpp_6string_std__in_string", 1);
2466
2467 /* "string.to_py":44
2468 * @cname("__pyx_convert_PyStr_string_to_py_6libcpp_6string_std__in_string")
2469 * cdef inline object __pyx_convert_PyStr_string_to_py_6libcpp_6string_std__in_string(const string& s):
2470 * return __Pyx_PyStr_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<<
2471 * cdef extern from *:
2472 * cdef object __Pyx_PyBytes_FromStringAndSize(const char*, size_t)
2473 */
2474 __Pyx_XDECREF(__pyx_r);
2475 __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)
2476 __Pyx_GOTREF(__pyx_t_1);
2477 __pyx_r = __pyx_t_1;
2478 __pyx_t_1 = 0;
2479 goto __pyx_L0;
2480
2481 /* "string.to_py":43
2482 *
2483 * @cname("__pyx_convert_PyStr_string_to_py_6libcpp_6string_std__in_string")
2484 * cdef inline object __pyx_convert_PyStr_string_to_py_6libcpp_6string_std__in_string(const string& s): # <<<<<<<<<<<<<<
2485 * return __Pyx_PyStr_FromStringAndSize(s.data(), s.size())
2486 * cdef extern from *:
2487 */
2488
2489 /* function exit code */
2490 __pyx_L1_error:;
2491 __Pyx_XDECREF(__pyx_t_1);
2492 __Pyx_AddTraceback("string.to_py.__pyx_convert_PyStr_string_to_py_6libcpp_6string_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
2493 __pyx_r = 0;
2494 __pyx_L0:;
2495 __Pyx_XGIVEREF(__pyx_r);
2496 __Pyx_RefNannyFinishContext();
2497 return __pyx_r;
2498}
2499
2500/* "string.to_py":49
2501 *
2502 * @cname("__pyx_convert_PyBytes_string_to_py_6libcpp_6string_std__in_string")
2503 * cdef inline object __pyx_convert_PyBytes_string_to_py_6libcpp_6string_std__in_string(const string& s): # <<<<<<<<<<<<<<
2504 * return __Pyx_PyBytes_FromStringAndSize(s.data(), s.size())
2505 * cdef extern from *:
2506 */
2507
2508static CYTHON_INLINE PyObject *__pyx_convert_PyBytes_string_to_py_6libcpp_6string_std__in_string(std::string const &__pyx_v_s) {
2509 PyObject *__pyx_r = NULL;
2510 __Pyx_RefNannyDeclarations
2511 PyObject *__pyx_t_1 = NULL;
2512 int __pyx_lineno = 0;
2513 const char *__pyx_filename = NULL;
2514 int __pyx_clineno = 0;
2515 __Pyx_RefNannySetupContext("__pyx_convert_PyBytes_string_to_py_6libcpp_6string_std__in_string", 1);
2516
2517 /* "string.to_py":50
2518 * @cname("__pyx_convert_PyBytes_string_to_py_6libcpp_6string_std__in_string")
2519 * cdef inline object __pyx_convert_PyBytes_string_to_py_6libcpp_6string_std__in_string(const string& s):
2520 * return __Pyx_PyBytes_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<<
2521 * cdef extern from *:
2522 * cdef object __Pyx_PyByteArray_FromStringAndSize(const char*, size_t)
2523 */
2524 __Pyx_XDECREF(__pyx_r);
2525 __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)
2526 __Pyx_GOTREF(__pyx_t_1);
2527 __pyx_r = __pyx_t_1;
2528 __pyx_t_1 = 0;
2529 goto __pyx_L0;
2530
2531 /* "string.to_py":49
2532 *
2533 * @cname("__pyx_convert_PyBytes_string_to_py_6libcpp_6string_std__in_string")
2534 * cdef inline object __pyx_convert_PyBytes_string_to_py_6libcpp_6string_std__in_string(const string& s): # <<<<<<<<<<<<<<
2535 * return __Pyx_PyBytes_FromStringAndSize(s.data(), s.size())
2536 * cdef extern from *:
2537 */
2538
2539 /* function exit code */
2540 __pyx_L1_error:;
2541 __Pyx_XDECREF(__pyx_t_1);
2542 __Pyx_AddTraceback("string.to_py.__pyx_convert_PyBytes_string_to_py_6libcpp_6string_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
2543 __pyx_r = 0;
2544 __pyx_L0:;
2545 __Pyx_XGIVEREF(__pyx_r);
2546 __Pyx_RefNannyFinishContext();
2547 return __pyx_r;
2548}
2549
2550/* "string.to_py":55
2551 *
2552 * @cname("__pyx_convert_PyByteArray_string_to_py_6libcpp_6string_std__in_string")
2553 * cdef inline object __pyx_convert_PyByteArray_string_to_py_6libcpp_6string_std__in_string(const string& s): # <<<<<<<<<<<<<<
2554 * return __Pyx_PyByteArray_FromStringAndSize(s.data(), s.size())
2555 *
2556 */
2557
2558static CYTHON_INLINE PyObject *__pyx_convert_PyByteArray_string_to_py_6libcpp_6string_std__in_string(std::string const &__pyx_v_s) {
2559 PyObject *__pyx_r = NULL;
2560 __Pyx_RefNannyDeclarations
2561 PyObject *__pyx_t_1 = NULL;
2562 int __pyx_lineno = 0;
2563 const char *__pyx_filename = NULL;
2564 int __pyx_clineno = 0;
2565 __Pyx_RefNannySetupContext("__pyx_convert_PyByteArray_string_to_py_6libcpp_6string_std__in_string", 1);
2566
2567 /* "string.to_py":56
2568 * @cname("__pyx_convert_PyByteArray_string_to_py_6libcpp_6string_std__in_string")
2569 * cdef inline object __pyx_convert_PyByteArray_string_to_py_6libcpp_6string_std__in_string(const string& s):
2570 * return __Pyx_PyByteArray_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<<
2571 *
2572 */
2573 __Pyx_XDECREF(__pyx_r);
2574 __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)
2575 __Pyx_GOTREF(__pyx_t_1);
2576 __pyx_r = __pyx_t_1;
2577 __pyx_t_1 = 0;
2578 goto __pyx_L0;
2579
2580 /* "string.to_py":55
2581 *
2582 * @cname("__pyx_convert_PyByteArray_string_to_py_6libcpp_6string_std__in_string")
2583 * cdef inline object __pyx_convert_PyByteArray_string_to_py_6libcpp_6string_std__in_string(const string& s): # <<<<<<<<<<<<<<
2584 * return __Pyx_PyByteArray_FromStringAndSize(s.data(), s.size())
2585 *
2586 */
2587
2588 /* function exit code */
2589 __pyx_L1_error:;
2590 __Pyx_XDECREF(__pyx_t_1);
2591 __Pyx_AddTraceback("string.to_py.__pyx_convert_PyByteArray_string_to_py_6libcpp_6string_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename);
2592 __pyx_r = 0;
2593 __pyx_L0:;
2594 __Pyx_XGIVEREF(__pyx_r);
2595 __Pyx_RefNannyFinishContext();
2596 return __pyx_r;
2597}
2598
2599/* "pyinfile.pyx":12
2600 *
2601 *
2602 * cdef object std_string_to_py(std_string x): # <<<<<<<<<<<<<<
2603 * pyx = x
2604 * pyx = pyx.decode()
2605 */
2606
2607static PyObject *__pyx_f_8pyinfile_std_string_to_py(std::string __pyx_v_x) {
2608 PyObject *__pyx_v_pyx = NULL;
2609 PyObject *__pyx_r = NULL;
2610 __Pyx_RefNannyDeclarations
2611 PyObject *__pyx_t_1 = NULL;
2612 PyObject *__pyx_t_2 = NULL;
2613 PyObject *__pyx_t_3 = NULL;
2614 unsigned int __pyx_t_4;
2615 int __pyx_lineno = 0;
2616 const char *__pyx_filename = NULL;
2617 int __pyx_clineno = 0;
2618 __Pyx_RefNannySetupContext("std_string_to_py", 1);
2619
2620 /* "pyinfile.pyx":13
2621 *
2622 * cdef object std_string_to_py(std_string x):
2623 * pyx = x # <<<<<<<<<<<<<<
2624 * pyx = pyx.decode()
2625 * return pyx
2626 */
2627 __pyx_t_1 = __pyx_convert_PyBytes_string_to_py_6libcpp_6string_std__in_string(__pyx_v_x); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 13, __pyx_L1_error)
2628 __Pyx_GOTREF(__pyx_t_1);
2629 __pyx_v_pyx = __pyx_t_1;
2630 __pyx_t_1 = 0;
2631
2632 /* "pyinfile.pyx":14
2633 * cdef object std_string_to_py(std_string x):
2634 * pyx = x
2635 * pyx = pyx.decode() # <<<<<<<<<<<<<<
2636 * return pyx
2637 *
2638 */
2639 __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)
2640 __Pyx_GOTREF(__pyx_t_2);
2641 __pyx_t_3 = NULL;
2642 __pyx_t_4 = 0;
2643 #if CYTHON_UNPACK_METHODS
2644 if (likely(PyMethod_Check(__pyx_t_2))) {
2645 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
2646 if (likely(__pyx_t_3)) {
2647 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
2648 __Pyx_INCREF(__pyx_t_3);
2649 __Pyx_INCREF(function);
2650 __Pyx_DECREF_SET(__pyx_t_2, function);
2651 __pyx_t_4 = 1;
2652 }
2653 }
2654 #endif
2655 {
2656 PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
2657 __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
2658 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
2659 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 14, __pyx_L1_error)
2660 __Pyx_GOTREF(__pyx_t_1);
2661 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2662 }
2663 __Pyx_DECREF_SET(__pyx_v_pyx, __pyx_t_1);
2664 __pyx_t_1 = 0;
2665
2666 /* "pyinfile.pyx":15
2667 * pyx = x
2668 * pyx = pyx.decode()
2669 * return pyx # <<<<<<<<<<<<<<
2670 *
2671 *
2672 */
2673 __Pyx_XDECREF(__pyx_r);
2674 __Pyx_INCREF(__pyx_v_pyx);
2675 __pyx_r = __pyx_v_pyx;
2676 goto __pyx_L0;
2677
2678 /* "pyinfile.pyx":12
2679 *
2680 *
2681 * cdef object std_string_to_py(std_string x): # <<<<<<<<<<<<<<
2682 * pyx = x
2683 * pyx = pyx.decode()
2684 */
2685
2686 /* function exit code */
2687 __pyx_L1_error:;
2688 __Pyx_XDECREF(__pyx_t_1);
2689 __Pyx_XDECREF(__pyx_t_2);
2690 __Pyx_XDECREF(__pyx_t_3);
2691 __Pyx_AddTraceback("pyinfile.std_string_to_py", __pyx_clineno, __pyx_lineno, __pyx_filename);
2692 __pyx_r = 0;
2693 __pyx_L0:;
2694 __Pyx_XDECREF(__pyx_v_pyx);
2695 __Pyx_XGIVEREF(__pyx_r);
2696 __Pyx_RefNannyFinishContext();
2697 return __pyx_r;
2698}
2699
2700/* "pyinfile.pyx":18
2701 *
2702 *
2703 * cdef std_string str_py_to_cpp(object x): # <<<<<<<<<<<<<<
2704 * cdef std_string s
2705 * x = x.encode()
2706 */
2707
2708static std::string __pyx_f_8pyinfile_str_py_to_cpp(PyObject *__pyx_v_x) {
2709 std::string __pyx_v_s;
2710 std::string __pyx_r;
2711 __Pyx_RefNannyDeclarations
2712 PyObject *__pyx_t_1 = NULL;
2713 PyObject *__pyx_t_2 = NULL;
2714 PyObject *__pyx_t_3 = NULL;
2715 unsigned int __pyx_t_4;
2716 char const *__pyx_t_5;
2717 std::string __pyx_t_6;
2718 int __pyx_lineno = 0;
2719 const char *__pyx_filename = NULL;
2720 int __pyx_clineno = 0;
2721 __Pyx_RefNannySetupContext("str_py_to_cpp", 0);
2722 __Pyx_INCREF(__pyx_v_x);
2723
2724 /* "pyinfile.pyx":20
2725 * cdef std_string str_py_to_cpp(object x):
2726 * cdef std_string s
2727 * x = x.encode() # <<<<<<<<<<<<<<
2728 * s = std_string(<const char*> x)
2729 * return s
2730 */
2731 __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)
2732 __Pyx_GOTREF(__pyx_t_2);
2733 __pyx_t_3 = NULL;
2734 __pyx_t_4 = 0;
2735 #if CYTHON_UNPACK_METHODS
2736 if (likely(PyMethod_Check(__pyx_t_2))) {
2737 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
2738 if (likely(__pyx_t_3)) {
2739 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
2740 __Pyx_INCREF(__pyx_t_3);
2741 __Pyx_INCREF(function);
2742 __Pyx_DECREF_SET(__pyx_t_2, function);
2743 __pyx_t_4 = 1;
2744 }
2745 }
2746 #endif
2747 {
2748 PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
2749 __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
2750 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
2751 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error)
2752 __Pyx_GOTREF(__pyx_t_1);
2753 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2754 }
2755 __Pyx_DECREF_SET(__pyx_v_x, __pyx_t_1);
2756 __pyx_t_1 = 0;
2757
2758 /* "pyinfile.pyx":21
2759 * cdef std_string s
2760 * x = x.encode()
2761 * s = std_string(<const char*> x) # <<<<<<<<<<<<<<
2762 * return s
2763 *
2764 */
2765 __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_v_x); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 21, __pyx_L1_error)
2766 try {
2767 __pyx_t_6 = std::string(((char const *)__pyx_t_5));
2768 } catch(...) {
2769 __Pyx_CppExn2PyErr();
2770 __PYX_ERR(0, 21, __pyx_L1_error)
2771 }
2772 __pyx_v_s = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_6);
2773
2774 /* "pyinfile.pyx":22
2775 * x = x.encode()
2776 * s = std_string(<const char*> x)
2777 * return s # <<<<<<<<<<<<<<
2778 *
2779 *
2780 */
2781 __pyx_r = __pyx_v_s;
2782 goto __pyx_L0;
2783
2784 /* "pyinfile.pyx":18
2785 *
2786 *
2787 * cdef std_string str_py_to_cpp(object x): # <<<<<<<<<<<<<<
2788 * cdef std_string s
2789 * x = x.encode()
2790 */
2791
2792 /* function exit code */
2793 __pyx_L1_error:;
2794 __Pyx_XDECREF(__pyx_t_1);
2795 __Pyx_XDECREF(__pyx_t_2);
2796 __Pyx_XDECREF(__pyx_t_3);
2797 __Pyx_AddTraceback("pyinfile.str_py_to_cpp", __pyx_clineno, __pyx_lineno, __pyx_filename);
2798 __Pyx_pretend_to_initialize(&__pyx_r);
2799 __pyx_L0:;
2800 __Pyx_XDECREF(__pyx_v_x);
2801 __Pyx_RefNannyFinishContext();
2802 return __pyx_r;
2803}
2804
2805/* "pyinfile.pyx":25
2806 *
2807 *
2808 * cdef public api std_string py_to_json "CyclusPyToJson" (std_string cpp_infile) except *: # <<<<<<<<<<<<<<
2809 * """Converts a Python file to JSON"""
2810 * infile = std_string_to_py(cpp_infile)
2811 */
2812
2813std::string CyclusPyToJson(std::string __pyx_v_cpp_infile) {
2814 PyObject *__pyx_v_infile = NULL;
2815 PyObject *__pyx_v_ctx = 0;
2816 PyObject *__pyx_v_names = NULL;
2817 PyObject *__pyx_v_name = NULL;
2818 PyObject *__pyx_v_sim = NULL;
2819 PyObject *__pyx_v_Mapping = NULL;
2820 PyObject *__pyx_v_json = NULL;
2821 std::string __pyx_v_cpp_rtn;
2822 std::string __pyx_r;
2823 __Pyx_RefNannyDeclarations
2824 PyObject *__pyx_t_1 = NULL;
2825 PyObject *__pyx_t_2 = NULL;
2826 PyObject *__pyx_t_3 = NULL;
2827 unsigned int __pyx_t_4;
2828 int __pyx_t_5;
2829 int __pyx_t_6;
2830 Py_ssize_t __pyx_t_7;
2831 PyObject *__pyx_t_8 = NULL;
2832 int __pyx_t_9;
2833 std::string __pyx_t_10;
2834 int __pyx_lineno = 0;
2835 const char *__pyx_filename = NULL;
2836 int __pyx_clineno = 0;
2837 __Pyx_RefNannySetupContext("py_to_json", 1);
2838
2839 /* "pyinfile.pyx":27
2840 * cdef public api std_string py_to_json "CyclusPyToJson" (std_string cpp_infile) except *:
2841 * """Converts a Python file to JSON"""
2842 * infile = std_string_to_py(cpp_infile) # <<<<<<<<<<<<<<
2843 * if not infile.endswith('\n'):
2844 * infile += '\n'
2845 */
2846 __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)
2847 __Pyx_GOTREF(__pyx_t_1);
2848 __pyx_v_infile = __pyx_t_1;
2849 __pyx_t_1 = 0;
2850
2851 /* "pyinfile.pyx":28
2852 * """Converts a Python file to JSON"""
2853 * infile = std_string_to_py(cpp_infile)
2854 * if not infile.endswith('\n'): # <<<<<<<<<<<<<<
2855 * infile += '\n'
2856 * cdef dict ctx = {}
2857 */
2858 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_infile, __pyx_n_s_endswith); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 28, __pyx_L1_error)
2859 __Pyx_GOTREF(__pyx_t_2);
2860 __pyx_t_3 = NULL;
2861 __pyx_t_4 = 0;
2862 #if CYTHON_UNPACK_METHODS
2863 if (likely(PyMethod_Check(__pyx_t_2))) {
2864 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
2865 if (likely(__pyx_t_3)) {
2866 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
2867 __Pyx_INCREF(__pyx_t_3);
2868 __Pyx_INCREF(function);
2869 __Pyx_DECREF_SET(__pyx_t_2, function);
2870 __pyx_t_4 = 1;
2871 }
2872 }
2873 #endif
2874 {
2875 PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_kp_u_};
2876 __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
2877 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
2878 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 28, __pyx_L1_error)
2879 __Pyx_GOTREF(__pyx_t_1);
2880 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2881 }
2882 __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_5 < 0))) __PYX_ERR(0, 28, __pyx_L1_error)
2883 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2884 __pyx_t_6 = (!__pyx_t_5);
2885 if (__pyx_t_6) {
2886
2887 /* "pyinfile.pyx":29
2888 * infile = std_string_to_py(cpp_infile)
2889 * if not infile.endswith('\n'):
2890 * infile += '\n' # <<<<<<<<<<<<<<
2891 * cdef dict ctx = {}
2892 * exec(infile, ctx, ctx)
2893 */
2894 __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_infile, __pyx_kp_u_); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error)
2895 __Pyx_GOTREF(__pyx_t_1);
2896 __Pyx_DECREF_SET(__pyx_v_infile, __pyx_t_1);
2897 __pyx_t_1 = 0;
2898
2899 /* "pyinfile.pyx":28
2900 * """Converts a Python file to JSON"""
2901 * infile = std_string_to_py(cpp_infile)
2902 * if not infile.endswith('\n'): # <<<<<<<<<<<<<<
2903 * infile += '\n'
2904 * cdef dict ctx = {}
2905 */
2906 }
2907
2908 /* "pyinfile.pyx":30
2909 * if not infile.endswith('\n'):
2910 * infile += '\n'
2911 * cdef dict ctx = {} # <<<<<<<<<<<<<<
2912 * exec(infile, ctx, ctx)
2913 * names = ('simulation', 'SIMULATION', 'Simulation')
2914 */
2915 __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 30, __pyx_L1_error)
2916 __Pyx_GOTREF(__pyx_t_1);
2917 __pyx_v_ctx = ((PyObject*)__pyx_t_1);
2918 __pyx_t_1 = 0;
2919
2920 /* "pyinfile.pyx":31
2921 * infile += '\n'
2922 * cdef dict ctx = {}
2923 * exec(infile, ctx, ctx) # <<<<<<<<<<<<<<
2924 * names = ('simulation', 'SIMULATION', 'Simulation')
2925 * for name in names:
2926 */
2927 __pyx_t_1 = __Pyx_PyExec3(__pyx_v_infile, __pyx_v_ctx, __pyx_v_ctx); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 31, __pyx_L1_error)
2928 __Pyx_GOTREF(__pyx_t_1);
2929 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2930
2931 /* "pyinfile.pyx":32
2932 * cdef dict ctx = {}
2933 * exec(infile, ctx, ctx)
2934 * names = ('simulation', 'SIMULATION', 'Simulation') # <<<<<<<<<<<<<<
2935 * for name in names:
2936 * if name in ctx:
2937 */
2938 __Pyx_INCREF(__pyx_tuple__2);
2939 __pyx_v_names = __pyx_tuple__2;
2940
2941 /* "pyinfile.pyx":33
2942 * exec(infile, ctx, ctx)
2943 * names = ('simulation', 'SIMULATION', 'Simulation')
2944 * for name in names: # <<<<<<<<<<<<<<
2945 * if name in ctx:
2946 * sim = ctx[name]
2947 */
2948 __pyx_t_1 = __pyx_v_names; __Pyx_INCREF(__pyx_t_1);
2949 __pyx_t_7 = 0;
2950 for (;;) {
2951 {
2952 Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
2953 #if !CYTHON_ASSUME_SAFE_MACROS
2954 if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 33, __pyx_L1_error)
2955 #endif
2956 if (__pyx_t_7 >= __pyx_temp) break;
2957 }
2958 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
2959 __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_7); __Pyx_INCREF(__pyx_t_2); __pyx_t_7++; if (unlikely((0 < 0))) __PYX_ERR(0, 33, __pyx_L1_error)
2960 #else
2961 __pyx_t_2 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 33, __pyx_L1_error)
2962 __Pyx_GOTREF(__pyx_t_2);
2963 #endif
2964 __Pyx_XDECREF_SET(__pyx_v_name, ((PyObject*)__pyx_t_2));
2965 __pyx_t_2 = 0;
2966
2967 /* "pyinfile.pyx":34
2968 * names = ('simulation', 'SIMULATION', 'Simulation')
2969 * for name in names:
2970 * if name in ctx: # <<<<<<<<<<<<<<
2971 * sim = ctx[name]
2972 * break
2973 */
2974 __pyx_t_6 = (__Pyx_PyDict_ContainsTF(__pyx_v_name, __pyx_v_ctx, Py_EQ)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 34, __pyx_L1_error)
2975 if (__pyx_t_6) {
2976
2977 /* "pyinfile.pyx":35
2978 * for name in names:
2979 * if name in ctx:
2980 * sim = ctx[name] # <<<<<<<<<<<<<<
2981 * break
2982 * else:
2983 */
2984 __pyx_t_2 = __Pyx_PyDict_GetItem(__pyx_v_ctx, __pyx_v_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 35, __pyx_L1_error)
2985 __Pyx_GOTREF(__pyx_t_2);
2986 __pyx_v_sim = __pyx_t_2;
2987 __pyx_t_2 = 0;
2988
2989 /* "pyinfile.pyx":36
2990 * if name in ctx:
2991 * sim = ctx[name]
2992 * break # <<<<<<<<<<<<<<
2993 * else:
2994 * raise RuntimeError('simulation not found in python file.')
2995 */
2996 goto __pyx_L5_break;
2997
2998 /* "pyinfile.pyx":34
2999 * names = ('simulation', 'SIMULATION', 'Simulation')
3000 * for name in names:
3001 * if name in ctx: # <<<<<<<<<<<<<<
3002 * sim = ctx[name]
3003 * break
3004 */
3005 }
3006
3007 /* "pyinfile.pyx":33
3008 * exec(infile, ctx, ctx)
3009 * names = ('simulation', 'SIMULATION', 'Simulation')
3010 * for name in names: # <<<<<<<<<<<<<<
3011 * if name in ctx:
3012 * sim = ctx[name]
3013 */
3014 }
3015 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3016 goto __pyx_L7_for_else;
3017 __pyx_L5_break:;
3018 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3019 goto __pyx_L8_for_end;
3020 /*else*/ {
3021 __pyx_L7_for_else:;
3022
3023 /* "pyinfile.pyx":38
3024 * break
3025 * else:
3026 * raise RuntimeError('simulation not found in python file.') # <<<<<<<<<<<<<<
3027 * if callable(sim):
3028 * sim = sim()
3029 */
3030 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L1_error)
3031 __Pyx_GOTREF(__pyx_t_1);
3032 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
3033 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3034 __PYX_ERR(0, 38, __pyx_L1_error)
3035 }
3036 __pyx_L8_for_end:;
3037
3038 /* "pyinfile.pyx":39
3039 * else:
3040 * raise RuntimeError('simulation not found in python file.')
3041 * if callable(sim): # <<<<<<<<<<<<<<
3042 * sim = sim()
3043 * from collections.abc import Mapping
3044 */
3045 __pyx_t_6 = __Pyx_PyCallable_Check(__pyx_v_sim); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 39, __pyx_L1_error)
3046 if (__pyx_t_6) {
3047
3048 /* "pyinfile.pyx":40
3049 * raise RuntimeError('simulation not found in python file.')
3050 * if callable(sim):
3051 * sim = sim() # <<<<<<<<<<<<<<
3052 * from collections.abc import Mapping
3053 * if isinstance(sim, str):
3054 */
3055 __Pyx_INCREF(__pyx_v_sim);
3056 __pyx_t_2 = __pyx_v_sim; __pyx_t_3 = NULL;
3057 __pyx_t_4 = 0;
3058 #if CYTHON_UNPACK_METHODS
3059 if (unlikely(PyMethod_Check(__pyx_t_2))) {
3060 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
3061 if (likely(__pyx_t_3)) {
3062 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
3063 __Pyx_INCREF(__pyx_t_3);
3064 __Pyx_INCREF(function);
3065 __Pyx_DECREF_SET(__pyx_t_2, function);
3066 __pyx_t_4 = 1;
3067 }
3068 }
3069 #endif
3070 {
3071 PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
3072 __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
3073 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3074 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 40, __pyx_L1_error)
3075 __Pyx_GOTREF(__pyx_t_1);
3076 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3077 }
3078 __Pyx_DECREF_SET(__pyx_v_sim, __pyx_t_1);
3079 __pyx_t_1 = 0;
3080
3081 /* "pyinfile.pyx":39
3082 * else:
3083 * raise RuntimeError('simulation not found in python file.')
3084 * if callable(sim): # <<<<<<<<<<<<<<
3085 * sim = sim()
3086 * from collections.abc import Mapping
3087 */
3088 }
3089
3090 /* "pyinfile.pyx":41
3091 * if callable(sim):
3092 * sim = sim()
3093 * from collections.abc import Mapping # <<<<<<<<<<<<<<
3094 * if isinstance(sim, str):
3095 * pass # assume in JSON format
3096 */
3097 __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 41, __pyx_L1_error)
3098 __Pyx_GOTREF(__pyx_t_1);
3099 __Pyx_INCREF(__pyx_n_s_Mapping);
3100 __Pyx_GIVEREF(__pyx_n_s_Mapping);
3101 if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_Mapping)) __PYX_ERR(0, 41, __pyx_L1_error);
3102 __pyx_t_2 = __Pyx_Import(__pyx_n_s_collections_abc, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 41, __pyx_L1_error)
3103 __Pyx_GOTREF(__pyx_t_2);
3104 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3105 __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Mapping); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 41, __pyx_L1_error)
3106 __Pyx_GOTREF(__pyx_t_1);
3107 __Pyx_INCREF(__pyx_t_1);
3108 __pyx_v_Mapping = __pyx_t_1;
3109 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3110 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3111
3112 /* "pyinfile.pyx":42
3113 * sim = sim()
3114 * from collections.abc import Mapping
3115 * if isinstance(sim, str): # <<<<<<<<<<<<<<
3116 * pass # assume in JSON format
3117 * elif isinstance(sim, bytes):
3118 */
3119 __pyx_t_6 = PyUnicode_Check(__pyx_v_sim);
3120 if (__pyx_t_6) {
3121 goto __pyx_L10;
3122 }
3123
3124 /* "pyinfile.pyx":44
3125 * if isinstance(sim, str):
3126 * pass # assume in JSON format
3127 * elif isinstance(sim, bytes): # <<<<<<<<<<<<<<
3128 * sim = sim.decode() # assume in JSON format, get into str
3129 * elif isinstance(sim, Mapping):
3130 */
3131 __pyx_t_6 = PyBytes_Check(__pyx_v_sim);
3132 if (__pyx_t_6) {
3133
3134 /* "pyinfile.pyx":45
3135 * pass # assume in JSON format
3136 * elif isinstance(sim, bytes):
3137 * sim = sim.decode() # assume in JSON format, get into str # <<<<<<<<<<<<<<
3138 * elif isinstance(sim, Mapping):
3139 * import json
3140 */
3141 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sim, __pyx_n_s_decode); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error)
3142 __Pyx_GOTREF(__pyx_t_1);
3143 __pyx_t_3 = NULL;
3144 __pyx_t_4 = 0;
3145 #if CYTHON_UNPACK_METHODS
3146 if (likely(PyMethod_Check(__pyx_t_1))) {
3147 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
3148 if (likely(__pyx_t_3)) {
3149 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
3150 __Pyx_INCREF(__pyx_t_3);
3151 __Pyx_INCREF(function);
3152 __Pyx_DECREF_SET(__pyx_t_1, function);
3153 __pyx_t_4 = 1;
3154 }
3155 }
3156 #endif
3157 {
3158 PyObject *__pyx_callargs[2] = {__pyx_t_3, NULL};
3159 __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_4, 0+__pyx_t_4);
3160 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3161 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 45, __pyx_L1_error)
3162 __Pyx_GOTREF(__pyx_t_2);
3163 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3164 }
3165 __Pyx_DECREF_SET(__pyx_v_sim, __pyx_t_2);
3166 __pyx_t_2 = 0;
3167
3168 /* "pyinfile.pyx":44
3169 * if isinstance(sim, str):
3170 * pass # assume in JSON format
3171 * elif isinstance(sim, bytes): # <<<<<<<<<<<<<<
3172 * sim = sim.decode() # assume in JSON format, get into str
3173 * elif isinstance(sim, Mapping):
3174 */
3175 goto __pyx_L10;
3176 }
3177
3178 /* "pyinfile.pyx":46
3179 * elif isinstance(sim, bytes):
3180 * sim = sim.decode() # assume in JSON format, get into str
3181 * elif isinstance(sim, Mapping): # <<<<<<<<<<<<<<
3182 * import json
3183 * sim = json.dumps(sim, sort_keys=True, indent=1)
3184 */
3185 __pyx_t_6 = PyObject_IsInstance(__pyx_v_sim, __pyx_v_Mapping); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 46, __pyx_L1_error)
3186 if (likely(__pyx_t_6)) {
3187
3188 /* "pyinfile.pyx":47
3189 * sim = sim.decode() # assume in JSON format, get into str
3190 * elif isinstance(sim, Mapping):
3191 * import json # <<<<<<<<<<<<<<
3192 * sim = json.dumps(sim, sort_keys=True, indent=1)
3193 * else:
3194 */
3195 __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_n_s_json, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 47, __pyx_L1_error)
3196 __Pyx_GOTREF(__pyx_t_2);
3197 __pyx_v_json = __pyx_t_2;
3198 __pyx_t_2 = 0;
3199
3200 /* "pyinfile.pyx":48
3201 * elif isinstance(sim, Mapping):
3202 * import json
3203 * sim = json.dumps(sim, sort_keys=True, indent=1) # <<<<<<<<<<<<<<
3204 * else:
3205 * raise RuntimeError('top-level simulation object does not have proper type.')
3206 */
3207 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_json, __pyx_n_s_dumps); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 48, __pyx_L1_error)
3208 __Pyx_GOTREF(__pyx_t_2);
3209 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 48, __pyx_L1_error)
3210 __Pyx_GOTREF(__pyx_t_1);
3211 __Pyx_INCREF(__pyx_v_sim);
3212 __Pyx_GIVEREF(__pyx_v_sim);
3213 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_sim)) __PYX_ERR(0, 48, __pyx_L1_error);
3214 __pyx_t_3 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 48, __pyx_L1_error)
3215 __Pyx_GOTREF(__pyx_t_3);
3216 if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_sort_keys, Py_True) < 0) __PYX_ERR(0, 48, __pyx_L1_error)
3217 if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_indent, __pyx_int_1) < 0) __PYX_ERR(0, 48, __pyx_L1_error)
3218 __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 48, __pyx_L1_error)
3219 __Pyx_GOTREF(__pyx_t_8);
3220 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3221 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3222 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3223 __Pyx_DECREF_SET(__pyx_v_sim, __pyx_t_8);
3224 __pyx_t_8 = 0;
3225
3226 /* "pyinfile.pyx":46
3227 * elif isinstance(sim, bytes):
3228 * sim = sim.decode() # assume in JSON format, get into str
3229 * elif isinstance(sim, Mapping): # <<<<<<<<<<<<<<
3230 * import json
3231 * sim = json.dumps(sim, sort_keys=True, indent=1)
3232 */
3233 goto __pyx_L10;
3234 }
3235
3236 /* "pyinfile.pyx":50
3237 * sim = json.dumps(sim, sort_keys=True, indent=1)
3238 * else:
3239 * raise RuntimeError('top-level simulation object does not have proper type.') # <<<<<<<<<<<<<<
3240 * PyErr_CheckSignals()
3241 * cdef std_string cpp_rtn = str_py_to_cpp(sim)
3242 */
3243 /*else*/ {
3244 __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 50, __pyx_L1_error)
3245 __Pyx_GOTREF(__pyx_t_8);
3246 __Pyx_Raise(__pyx_t_8, 0, 0, 0);
3247 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3248 __PYX_ERR(0, 50, __pyx_L1_error)
3249 }
3250 __pyx_L10:;
3251
3252 /* "pyinfile.pyx":51
3253 * else:
3254 * raise RuntimeError('top-level simulation object does not have proper type.')
3255 * PyErr_CheckSignals() # <<<<<<<<<<<<<<
3256 * cdef std_string cpp_rtn = str_py_to_cpp(sim)
3257 * return cpp_rtn
3258 */
3259 __pyx_t_9 = PyErr_CheckSignals(); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 51, __pyx_L1_error)
3260
3261 /* "pyinfile.pyx":52
3262 * raise RuntimeError('top-level simulation object does not have proper type.')
3263 * PyErr_CheckSignals()
3264 * cdef std_string cpp_rtn = str_py_to_cpp(sim) # <<<<<<<<<<<<<<
3265 * return cpp_rtn
3266 *
3267 */
3268 __pyx_t_10 = __pyx_f_8pyinfile_str_py_to_cpp(__pyx_v_sim); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 52, __pyx_L1_error)
3269 __pyx_v_cpp_rtn = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_10);
3270
3271 /* "pyinfile.pyx":53
3272 * PyErr_CheckSignals()
3273 * cdef std_string cpp_rtn = str_py_to_cpp(sim)
3274 * return cpp_rtn # <<<<<<<<<<<<<<
3275 *
3276 *
3277 */
3278 __pyx_r = __pyx_v_cpp_rtn;
3279 goto __pyx_L0;
3280
3281 /* "pyinfile.pyx":25
3282 *
3283 *
3284 * cdef public api std_string py_to_json "CyclusPyToJson" (std_string cpp_infile) except *: # <<<<<<<<<<<<<<
3285 * """Converts a Python file to JSON"""
3286 * infile = std_string_to_py(cpp_infile)
3287 */
3288
3289 /* function exit code */
3290 __pyx_L1_error:;
3291 __Pyx_XDECREF(__pyx_t_1);
3292 __Pyx_XDECREF(__pyx_t_2);
3293 __Pyx_XDECREF(__pyx_t_3);
3294 __Pyx_XDECREF(__pyx_t_8);
3295 __Pyx_AddTraceback("pyinfile.py_to_json", __pyx_clineno, __pyx_lineno, __pyx_filename);
3296 __Pyx_pretend_to_initialize(&__pyx_r);
3297 __pyx_L0:;
3298 __Pyx_XDECREF(__pyx_v_infile);
3299 __Pyx_XDECREF(__pyx_v_ctx);
3300 __Pyx_XDECREF(__pyx_v_names);
3301 __Pyx_XDECREF(__pyx_v_name);
3302 __Pyx_XDECREF(__pyx_v_sim);
3303 __Pyx_XDECREF(__pyx_v_Mapping);
3304 __Pyx_XDECREF(__pyx_v_json);
3305 __Pyx_RefNannyFinishContext();
3306 return __pyx_r;
3307}
3308
3309/* "pyinfile.pyx":56
3310 *
3311 *
3312 * cdef public api std_string json_to_py "CyclusJsonToPy" (std_string cpp_infile) except *: # <<<<<<<<<<<<<<
3313 * """Converts a JSON file to Python"""
3314 * infile = std_string_to_py(cpp_infile)
3315 */
3316
3317std::string CyclusJsonToPy(std::string __pyx_v_cpp_infile) {
3318 PyObject *__pyx_v_infile = NULL;
3319 PyObject *__pyx_v_json = NULL;
3320 PyObject *__pyx_v_sim = NULL;
3321 PyObject *__pyx_v_s = NULL;
3322 std::string __pyx_v_cpp_rtn;
3323 std::string __pyx_r;
3324 __Pyx_RefNannyDeclarations
3325 PyObject *__pyx_t_1 = NULL;
3326 PyObject *__pyx_t_2 = NULL;
3327 PyObject *__pyx_t_3 = NULL;
3328 unsigned int __pyx_t_4;
3329 int __pyx_t_5;
3330 PyObject *__pyx_t_6 = NULL;
3331 std::string __pyx_t_7;
3332 int __pyx_lineno = 0;
3333 const char *__pyx_filename = NULL;
3334 int __pyx_clineno = 0;
3335 __Pyx_RefNannySetupContext("json_to_py", 1);
3336
3337 /* "pyinfile.pyx":58
3338 * cdef public api std_string json_to_py "CyclusJsonToPy" (std_string cpp_infile) except *:
3339 * """Converts a JSON file to Python"""
3340 * infile = std_string_to_py(cpp_infile) # <<<<<<<<<<<<<<
3341 * import json
3342 * sim = json.loads(infile)
3343 */
3344 __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)
3345 __Pyx_GOTREF(__pyx_t_1);
3346 __pyx_v_infile = __pyx_t_1;
3347 __pyx_t_1 = 0;
3348
3349 /* "pyinfile.pyx":59
3350 * """Converts a JSON file to Python"""
3351 * infile = std_string_to_py(cpp_infile)
3352 * import json # <<<<<<<<<<<<<<
3353 * sim = json.loads(infile)
3354 * PyErr_CheckSignals()
3355 */
3356 __pyx_t_1 = __Pyx_ImportDottedModule(__pyx_n_s_json, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 59, __pyx_L1_error)
3357 __Pyx_GOTREF(__pyx_t_1);
3358 __pyx_v_json = __pyx_t_1;
3359 __pyx_t_1 = 0;
3360
3361 /* "pyinfile.pyx":60
3362 * infile = std_string_to_py(cpp_infile)
3363 * import json
3364 * sim = json.loads(infile) # <<<<<<<<<<<<<<
3365 * PyErr_CheckSignals()
3366 * s = 'SIMULATION = ' + pformat(sim, indent=1) + '\n'
3367 */
3368 __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)
3369 __Pyx_GOTREF(__pyx_t_2);
3370 __pyx_t_3 = NULL;
3371 __pyx_t_4 = 0;
3372 #if CYTHON_UNPACK_METHODS
3373 if (likely(PyMethod_Check(__pyx_t_2))) {
3374 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
3375 if (likely(__pyx_t_3)) {
3376 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
3377 __Pyx_INCREF(__pyx_t_3);
3378 __Pyx_INCREF(function);
3379 __Pyx_DECREF_SET(__pyx_t_2, function);
3380 __pyx_t_4 = 1;
3381 }
3382 }
3383 #endif
3384 {
3385 PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_v_infile};
3386 __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
3387 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3388 if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 60, __pyx_L1_error)
3389 __Pyx_GOTREF(__pyx_t_1);
3390 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3391 }
3392 __pyx_v_sim = __pyx_t_1;
3393 __pyx_t_1 = 0;
3394
3395 /* "pyinfile.pyx":61
3396 * import json
3397 * sim = json.loads(infile)
3398 * PyErr_CheckSignals() # <<<<<<<<<<<<<<
3399 * s = 'SIMULATION = ' + pformat(sim, indent=1) + '\n'
3400 * cdef std_string cpp_rtn = str_py_to_cpp(s)
3401 */
3402 __pyx_t_5 = PyErr_CheckSignals(); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 61, __pyx_L1_error)
3403
3404 /* "pyinfile.pyx":62
3405 * sim = json.loads(infile)
3406 * PyErr_CheckSignals()
3407 * s = 'SIMULATION = ' + pformat(sim, indent=1) + '\n' # <<<<<<<<<<<<<<
3408 * cdef std_string cpp_rtn = str_py_to_cpp(s)
3409 * return cpp_rtn
3410 */
3411 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_pformat); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 62, __pyx_L1_error)
3412 __Pyx_GOTREF(__pyx_t_1);
3413 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 62, __pyx_L1_error)
3414 __Pyx_GOTREF(__pyx_t_2);
3415 __Pyx_INCREF(__pyx_v_sim);
3416 __Pyx_GIVEREF(__pyx_v_sim);
3417 if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_sim)) __PYX_ERR(0, 62, __pyx_L1_error);
3418 __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 62, __pyx_L1_error)
3419 __Pyx_GOTREF(__pyx_t_3);
3420 if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_indent, __pyx_int_1) < 0) __PYX_ERR(0, 62, __pyx_L1_error)
3421 __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 62, __pyx_L1_error)
3422 __Pyx_GOTREF(__pyx_t_6);
3423 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3424 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3425 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3426 __pyx_t_3 = PyNumber_Add(__pyx_kp_u_SIMULATION_2, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 62, __pyx_L1_error)
3427 __Pyx_GOTREF(__pyx_t_3);
3428 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3429 __pyx_t_6 = PyNumber_Add(__pyx_t_3, __pyx_kp_u_); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 62, __pyx_L1_error)
3430 __Pyx_GOTREF(__pyx_t_6);
3431 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3432 __pyx_v_s = __pyx_t_6;
3433 __pyx_t_6 = 0;
3434
3435 /* "pyinfile.pyx":63
3436 * PyErr_CheckSignals()
3437 * s = 'SIMULATION = ' + pformat(sim, indent=1) + '\n'
3438 * cdef std_string cpp_rtn = str_py_to_cpp(s) # <<<<<<<<<<<<<<
3439 * return cpp_rtn
3440 */
3441 __pyx_t_7 = __pyx_f_8pyinfile_str_py_to_cpp(__pyx_v_s); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 63, __pyx_L1_error)
3442 __pyx_v_cpp_rtn = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_7);
3443
3444 /* "pyinfile.pyx":64
3445 * s = 'SIMULATION = ' + pformat(sim, indent=1) + '\n'
3446 * cdef std_string cpp_rtn = str_py_to_cpp(s)
3447 * return cpp_rtn # <<<<<<<<<<<<<<
3448 */
3449 __pyx_r = __pyx_v_cpp_rtn;
3450 goto __pyx_L0;
3451
3452 /* "pyinfile.pyx":56
3453 *
3454 *
3455 * cdef public api std_string json_to_py "CyclusJsonToPy" (std_string cpp_infile) except *: # <<<<<<<<<<<<<<
3456 * """Converts a JSON file to Python"""
3457 * infile = std_string_to_py(cpp_infile)
3458 */
3459
3460 /* function exit code */
3461 __pyx_L1_error:;
3462 __Pyx_XDECREF(__pyx_t_1);
3463 __Pyx_XDECREF(__pyx_t_2);
3464 __Pyx_XDECREF(__pyx_t_3);
3465 __Pyx_XDECREF(__pyx_t_6);
3466 __Pyx_AddTraceback("pyinfile.json_to_py", __pyx_clineno, __pyx_lineno, __pyx_filename);
3467 __Pyx_pretend_to_initialize(&__pyx_r);
3468 __pyx_L0:;
3469 __Pyx_XDECREF(__pyx_v_infile);
3470 __Pyx_XDECREF(__pyx_v_json);
3471 __Pyx_XDECREF(__pyx_v_sim);
3472 __Pyx_XDECREF(__pyx_v_s);
3473 __Pyx_RefNannyFinishContext();
3474 return __pyx_r;
3475}
3476
3477static PyMethodDef __pyx_methods[] = {
3478 {0, 0, 0, 0}
3479};
3480#ifndef CYTHON_SMALL_CODE
3481#if defined(__clang__)
3482 #define CYTHON_SMALL_CODE
3483#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
3484 #define CYTHON_SMALL_CODE __attribute__((cold))
3485#else
3486 #define CYTHON_SMALL_CODE
3487#endif
3488#endif
3489/* #### Code section: pystring_table ### */
3490
3491static int __Pyx_CreateStringTabAndInitStrings(void) {
3492 __Pyx_StringTabEntry __pyx_string_tab[] = {
3493 {&__pyx_kp_u_, __pyx_k_, sizeof(__pyx_k_), 0, 1, 0, 0},
3494 {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
3495 {&__pyx_n_s_Mapping, __pyx_k_Mapping, sizeof(__pyx_k_Mapping), 0, 0, 1, 1},
3496 {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1},
3497 {&__pyx_n_u_SIMULATION, __pyx_k_SIMULATION, sizeof(__pyx_k_SIMULATION), 0, 1, 0, 1},
3498 {&__pyx_kp_u_SIMULATION_2, __pyx_k_SIMULATION_2, sizeof(__pyx_k_SIMULATION_2), 0, 1, 0, 0},
3499 {&__pyx_n_u_Simulation, __pyx_k_Simulation, sizeof(__pyx_k_Simulation), 0, 1, 0, 1},
3500 {&__pyx_kp_u__4, __pyx_k__4, sizeof(__pyx_k__4), 0, 1, 0, 0},
3501 {&__pyx_n_s__5, __pyx_k__5, sizeof(__pyx_k__5), 0, 0, 1, 1},
3502 {&__pyx_n_s__7, __pyx_k__7, sizeof(__pyx_k__7), 0, 0, 1, 1},
3503 {&__pyx_n_s_builtins, __pyx_k_builtins, sizeof(__pyx_k_builtins), 0, 0, 1, 1},
3504 {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
3505 {&__pyx_n_s_collections_abc, __pyx_k_collections_abc, sizeof(__pyx_k_collections_abc), 0, 0, 1, 1},
3506 {&__pyx_n_s_decode, __pyx_k_decode, sizeof(__pyx_k_decode), 0, 0, 1, 1},
3507 {&__pyx_n_s_dumps, __pyx_k_dumps, sizeof(__pyx_k_dumps), 0, 0, 1, 1},
3508 {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1},
3509 {&__pyx_n_s_endswith, __pyx_k_endswith, sizeof(__pyx_k_endswith), 0, 0, 1, 1},
3510 {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
3511 {&__pyx_n_s_indent, __pyx_k_indent, sizeof(__pyx_k_indent), 0, 0, 1, 1},
3512 {&__pyx_n_s_initializing, __pyx_k_initializing, sizeof(__pyx_k_initializing), 0, 0, 1, 1},
3513 {&__pyx_n_s_json, __pyx_k_json, sizeof(__pyx_k_json), 0, 0, 1, 1},
3514 {&__pyx_n_s_loads, __pyx_k_loads, sizeof(__pyx_k_loads), 0, 0, 1, 1},
3515 {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
3516 {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
3517 {&__pyx_n_s_pformat, __pyx_k_pformat, sizeof(__pyx_k_pformat), 0, 0, 1, 1},
3518 {&__pyx_n_s_pprint, __pyx_k_pprint, sizeof(__pyx_k_pprint), 0, 0, 1, 1},
3519 {&__pyx_n_s_pprintpp, __pyx_k_pprintpp, sizeof(__pyx_k_pprintpp), 0, 0, 1, 1},
3520 {&__pyx_n_u_simulation, __pyx_k_simulation, sizeof(__pyx_k_simulation), 0, 1, 0, 1},
3521 {&__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},
3522 {&__pyx_n_s_sort_keys, __pyx_k_sort_keys, sizeof(__pyx_k_sort_keys), 0, 0, 1, 1},
3523 {&__pyx_n_s_spec, __pyx_k_spec, sizeof(__pyx_k_spec), 0, 0, 1, 1},
3524 {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
3525 {&__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},
3526 {0, 0, 0, 0, 0, 0, 0}
3527 };
3528 return __Pyx_InitStrings(__pyx_string_tab);
3529}
3530/* #### Code section: cached_builtins ### */
3531static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
3532 __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(0, 8, __pyx_L1_error)
3533 __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(0, 38, __pyx_L1_error)
3534 return 0;
3535 __pyx_L1_error:;
3536 return -1;
3537}
3538/* #### Code section: cached_constants ### */
3539
3540static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
3541 __Pyx_RefNannyDeclarations
3542 __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
3543
3544 /* "pyinfile.pyx":32
3545 * cdef dict ctx = {}
3546 * exec(infile, ctx, ctx)
3547 * names = ('simulation', 'SIMULATION', 'Simulation') # <<<<<<<<<<<<<<
3548 * for name in names:
3549 * if name in ctx:
3550 */
3551 __pyx_tuple__2 = PyTuple_Pack(3, __pyx_n_u_simulation, __pyx_n_u_SIMULATION, __pyx_n_u_Simulation); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 32, __pyx_L1_error)
3552 __Pyx_GOTREF(__pyx_tuple__2);
3553 __Pyx_GIVEREF(__pyx_tuple__2);
3554
3555 /* "pyinfile.pyx":38
3556 * break
3557 * else:
3558 * raise RuntimeError('simulation not found in python file.') # <<<<<<<<<<<<<<
3559 * if callable(sim):
3560 * sim = sim()
3561 */
3562 __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_u_simulation_not_found_in_python_f); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 38, __pyx_L1_error)
3563 __Pyx_GOTREF(__pyx_tuple__3);
3564 __Pyx_GIVEREF(__pyx_tuple__3);
3565
3566 /* "pyinfile.pyx":50
3567 * sim = json.dumps(sim, sort_keys=True, indent=1)
3568 * else:
3569 * raise RuntimeError('top-level simulation object does not have proper type.') # <<<<<<<<<<<<<<
3570 * PyErr_CheckSignals()
3571 * cdef std_string cpp_rtn = str_py_to_cpp(sim)
3572 */
3573 __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_u_top_level_simulation_object_does); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 50, __pyx_L1_error)
3574 __Pyx_GOTREF(__pyx_tuple__6);
3575 __Pyx_GIVEREF(__pyx_tuple__6);
3576 __Pyx_RefNannyFinishContext();
3577 return 0;
3578 __pyx_L1_error:;
3579 __Pyx_RefNannyFinishContext();
3580 return -1;
3581}
3582/* #### Code section: init_constants ### */
3583
3584static CYTHON_SMALL_CODE int __Pyx_InitConstants(void) {
3585 if (__Pyx_CreateStringTabAndInitStrings() < 0) __PYX_ERR(0, 1, __pyx_L1_error);
3586 __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
3587 return 0;
3588 __pyx_L1_error:;
3589 return -1;
3590}
3591/* #### Code section: init_globals ### */
3592
3593static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
3594 return 0;
3595}
3596/* #### Code section: init_module ### */
3597
3598static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
3599static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
3600static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
3601static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
3602static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
3603static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
3604static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
3605
3606static int __Pyx_modinit_global_init_code(void) {
3607 __Pyx_RefNannyDeclarations
3608 __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
3609 /*--- Global init code ---*/
3610 __Pyx_RefNannyFinishContext();
3611 return 0;
3612}
3613
3614static int __Pyx_modinit_variable_export_code(void) {
3615 __Pyx_RefNannyDeclarations
3616 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
3617 /*--- Variable export code ---*/
3618 __Pyx_RefNannyFinishContext();
3619 return 0;
3620}
3621
3622static int __Pyx_modinit_function_export_code(void) {
3623 __Pyx_RefNannyDeclarations
3624 int __pyx_lineno = 0;
3625 const char *__pyx_filename = NULL;
3626 int __pyx_clineno = 0;
3627 __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
3628 /*--- Function export code ---*/
3629 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)
3630 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)
3631 if (__Pyx_ExportFunction("py_to_json", (void (*)(void))CyclusPyToJson, "std::string (std::string)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3632 if (__Pyx_ExportFunction("json_to_py", (void (*)(void))CyclusJsonToPy, "std::string (std::string)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3633 __Pyx_RefNannyFinishContext();
3634 return 0;
3635 __pyx_L1_error:;
3636 __Pyx_RefNannyFinishContext();
3637 return -1;
3638}
3639
3640static int __Pyx_modinit_type_init_code(void) {
3641 __Pyx_RefNannyDeclarations
3642 __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
3643 /*--- Type init code ---*/
3644 __Pyx_RefNannyFinishContext();
3645 return 0;
3646}
3647
3648static int __Pyx_modinit_type_import_code(void) {
3649 __Pyx_RefNannyDeclarations
3650 PyObject *__pyx_t_1 = NULL;
3651 int __pyx_lineno = 0;
3652 const char *__pyx_filename = NULL;
3653 int __pyx_clineno = 0;
3654 __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
3655 /*--- Type import code ---*/
3656 __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 9, __pyx_L1_error)
3657 __Pyx_GOTREF(__pyx_t_1);
3658 __pyx_ptype_7cpython_4type_type = __Pyx_ImportType_3_0_11(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type",
3659 #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
3660 sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(PyTypeObject),
3661 #elif CYTHON_COMPILING_IN_LIMITED_API
3662 sizeof(PyTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(PyTypeObject),
3663 #else
3664 sizeof(PyHeapTypeObject), __PYX_GET_STRUCT_ALIGNMENT_3_0_11(PyHeapTypeObject),
3665 #endif
3666 __Pyx_ImportType_CheckSize_Warn_3_0_11); if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(2, 9, __pyx_L1_error)
3667 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3668 __Pyx_RefNannyFinishContext();
3669 return 0;
3670 __pyx_L1_error:;
3671 __Pyx_XDECREF(__pyx_t_1);
3672 __Pyx_RefNannyFinishContext();
3673 return -1;
3674}
3675
3676static int __Pyx_modinit_variable_import_code(void) {
3677 __Pyx_RefNannyDeclarations
3678 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
3679 /*--- Variable import code ---*/
3680 __Pyx_RefNannyFinishContext();
3681 return 0;
3682}
3683
3684static int __Pyx_modinit_function_import_code(void) {
3685 __Pyx_RefNannyDeclarations
3686 __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
3687 /*--- Function import code ---*/
3688 __Pyx_RefNannyFinishContext();
3689 return 0;
3690}
3691
3692
3693#if PY_MAJOR_VERSION >= 3
3694#if CYTHON_PEP489_MULTI_PHASE_INIT
3695static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
3696static int __pyx_pymod_exec_pyinfile(PyObject* module); /*proto*/
3697static PyModuleDef_Slot __pyx_moduledef_slots[] = {
3698 {Py_mod_create, (void*)__pyx_pymod_create},
3699 {Py_mod_exec, (void*)__pyx_pymod_exec_pyinfile},
3700 {0, NULL}
3701};
3702#endif
3703
3704#ifdef __cplusplus
3705namespace {
3706 struct PyModuleDef __pyx_moduledef =
3707 #else
3708 static struct PyModuleDef __pyx_moduledef =
3709 #endif
3710 {
3711 PyModuleDef_HEAD_INIT,
3712 "pyinfile",
3713 __pyx_k_Cyclus_Python_input_file_tools, /* m_doc */
3714 #if CYTHON_PEP489_MULTI_PHASE_INIT
3715 0, /* m_size */
3716 #elif CYTHON_USE_MODULE_STATE
3717 sizeof(__pyx_mstate), /* m_size */
3718 #else
3719 -1, /* m_size */
3720 #endif
3721 __pyx_methods /* m_methods */,
3722 #if CYTHON_PEP489_MULTI_PHASE_INIT
3723 __pyx_moduledef_slots, /* m_slots */
3724 #else
3725 NULL, /* m_reload */
3726 #endif
3727 #if CYTHON_USE_MODULE_STATE
3728 __pyx_m_traverse, /* m_traverse */
3729 __pyx_m_clear, /* m_clear */
3730 NULL /* m_free */
3731 #else
3732 NULL, /* m_traverse */
3733 NULL, /* m_clear */
3734 NULL /* m_free */
3735 #endif
3736 };
3737 #ifdef __cplusplus
3738} /* anonymous namespace */
3739#endif
3740#endif
3741
3742#ifndef CYTHON_NO_PYINIT_EXPORT
3743#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
3744#elif PY_MAJOR_VERSION < 3
3745#ifdef __cplusplus
3746#define __Pyx_PyMODINIT_FUNC extern "C" void
3747#else
3748#define __Pyx_PyMODINIT_FUNC void
3749#endif
3750#else
3751#ifdef __cplusplus
3752#define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
3753#else
3754#define __Pyx_PyMODINIT_FUNC PyObject *
3755#endif
3756#endif
3757
3758
3759#if PY_MAJOR_VERSION < 3
3760__Pyx_PyMODINIT_FUNC initpyinfile(void) CYTHON_SMALL_CODE; /*proto*/
3761__Pyx_PyMODINIT_FUNC initpyinfile(void)
3762#else
3763__Pyx_PyMODINIT_FUNC PyInit_pyinfile(void) CYTHON_SMALL_CODE; /*proto*/
3764__Pyx_PyMODINIT_FUNC PyInit_pyinfile(void)
3765#if CYTHON_PEP489_MULTI_PHASE_INIT
3766{
3767 return PyModuleDef_Init(&__pyx_moduledef);
3768}
3769static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
3770 #if PY_VERSION_HEX >= 0x030700A1
3771 static PY_INT64_T main_interpreter_id = -1;
3772 PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
3773 if (main_interpreter_id == -1) {
3774 main_interpreter_id = current_id;
3775 return (unlikely(current_id == -1)) ? -1 : 0;
3776 } else if (unlikely(main_interpreter_id != current_id))
3777 #else
3778 static PyInterpreterState *main_interpreter = NULL;
3779 PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
3780 if (!main_interpreter) {
3781 main_interpreter = current_interpreter;
3782 } else if (unlikely(main_interpreter != current_interpreter))
3783 #endif
3784 {
3785 PyErr_SetString(
3786 PyExc_ImportError,
3787 "Interpreter change detected - this module can only be loaded into one interpreter per process.");
3788 return -1;
3789 }
3790 return 0;
3791}
3792#if CYTHON_COMPILING_IN_LIMITED_API
3793static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *module, const char* from_name, const char* to_name, int allow_none)
3794#else
3795static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none)
3796#endif
3797{
3798 PyObject *value = PyObject_GetAttrString(spec, from_name);
3799 int result = 0;
3800 if (likely(value)) {
3801 if (allow_none || value != Py_None) {
3802#if CYTHON_COMPILING_IN_LIMITED_API
3803 result = PyModule_AddObject(module, to_name, value);
3804#else
3805 result = PyDict_SetItemString(moddict, to_name, value);
3806#endif
3807 }
3808 Py_DECREF(value);
3809 } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
3810 PyErr_Clear();
3811 } else {
3812 result = -1;
3813 }
3814 return result;
3815}
3816static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def) {
3817 PyObject *module = NULL, *moddict, *modname;
3818 CYTHON_UNUSED_VAR(def);
3819 if (__Pyx_check_single_interpreter())
3820 return NULL;
3821 if (__pyx_m)
3822 return __Pyx_NewRef(__pyx_m);
3823 modname = PyObject_GetAttrString(spec, "name");
3824 if (unlikely(!modname)) goto bad;
3825 module = PyModule_NewObject(modname);
3826 Py_DECREF(modname);
3827 if (unlikely(!module)) goto bad;
3828#if CYTHON_COMPILING_IN_LIMITED_API
3829 moddict = module;
3830#else
3831 moddict = PyModule_GetDict(module);
3832 if (unlikely(!moddict)) goto bad;
3833#endif
3834 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
3835 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
3836 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
3837 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
3838 return module;
3839bad:
3840 Py_XDECREF(module);
3841 return NULL;
3842}
3843
3844
3845static CYTHON_SMALL_CODE int __pyx_pymod_exec_pyinfile(PyObject *__pyx_pyinit_module)
3846#endif
3847#endif
3848{
3849 int stringtab_initialized = 0;
3850 #if CYTHON_USE_MODULE_STATE
3851 int pystate_addmodule_run = 0;
3852 #endif
3853 PyObject *__pyx_t_1 = NULL;
3854 PyObject *__pyx_t_2 = NULL;
3855 PyObject *__pyx_t_3 = NULL;
3856 PyObject *__pyx_t_4 = NULL;
3857 PyObject *__pyx_t_5 = NULL;
3858 int __pyx_t_6;
3859 PyObject *__pyx_t_7 = NULL;
3860 PyObject *__pyx_t_8 = NULL;
3861 PyObject *__pyx_t_9 = NULL;
3862 int __pyx_lineno = 0;
3863 const char *__pyx_filename = NULL;
3864 int __pyx_clineno = 0;
3865 __Pyx_RefNannyDeclarations
3866 #if CYTHON_PEP489_MULTI_PHASE_INIT
3867 if (__pyx_m) {
3868 if (__pyx_m == __pyx_pyinit_module) return 0;
3869 PyErr_SetString(PyExc_RuntimeError, "Module 'pyinfile' has already been imported. Re-initialisation is not supported.");
3870 return -1;
3871 }
3872 #elif PY_MAJOR_VERSION >= 3
3873 if (__pyx_m) return __Pyx_NewRef(__pyx_m);
3874 #endif
3875 /*--- Module creation code ---*/
3876 #if CYTHON_PEP489_MULTI_PHASE_INIT
3877 __pyx_m = __pyx_pyinit_module;
3878 Py_INCREF(__pyx_m);
3879 #else
3880 #if PY_MAJOR_VERSION < 3
3881 __pyx_m = Py_InitModule4("pyinfile", __pyx_methods, __pyx_k_Cyclus_Python_input_file_tools, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
3882 if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
3883 #elif CYTHON_USE_MODULE_STATE
3884 __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
3885 {
3886 int add_module_result = PyState_AddModule(__pyx_t_1, &__pyx_moduledef);
3887 __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to "pyinfile" pseudovariable */
3888 if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
3889 pystate_addmodule_run = 1;
3890 }
3891 #else
3892 __pyx_m = PyModule_Create(&__pyx_moduledef);
3893 if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
3894 #endif
3895 #endif
3896 CYTHON_UNUSED_VAR(__pyx_t_1);
3897 __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
3898 Py_INCREF(__pyx_d);
3899 __pyx_b = __Pyx_PyImport_AddModuleRef(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
3900 __pyx_cython_runtime = __Pyx_PyImport_AddModuleRef((const char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
3901 if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3902 #if CYTHON_REFNANNY
3903__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
3904if (!__Pyx_RefNanny) {
3905 PyErr_Clear();
3906 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
3907 if (!__Pyx_RefNanny)
3908 Py_FatalError("failed to import 'refnanny' module");
3909}
3910#endif
3911 __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_pyinfile(void)", 0);
3912 if (__Pyx_check_binary_version(__PYX_LIMITED_VERSION_HEX, __Pyx_get_runtime_version(), CYTHON_COMPILING_IN_LIMITED_API) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3913 #ifdef __Pxy_PyFrame_Initialize_Offsets
3914 __Pxy_PyFrame_Initialize_Offsets();
3915 #endif
3916 __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
3917 __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
3918 __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
3919 #ifdef __Pyx_CyFunction_USED
3920 if (__pyx_CyFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3921 #endif
3922 #ifdef __Pyx_FusedFunction_USED
3923 if (__pyx_FusedFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3924 #endif
3925 #ifdef __Pyx_Coroutine_USED
3926 if (__pyx_Coroutine_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3927 #endif
3928 #ifdef __Pyx_Generator_USED
3929 if (__pyx_Generator_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3930 #endif
3931 #ifdef __Pyx_AsyncGen_USED
3932 if (__pyx_AsyncGen_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3933 #endif
3934 #ifdef __Pyx_StopAsyncIteration_USED
3935 if (__pyx_StopAsyncIteration_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3936 #endif
3937 /*--- Library function declarations ---*/
3938 /*--- Threads initialization code ---*/
3939 #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
3940 PyEval_InitThreads();
3941 #endif
3942 /*--- Initialize various global constants etc. ---*/
3943 if (__Pyx_InitConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3944 stringtab_initialized = 1;
3945 if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3946 #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
3947 if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3948 #endif
3949 if (__pyx_module_is_main_pyinfile) {
3950 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3951 }
3952 #if PY_MAJOR_VERSION >= 3
3953 {
3954 PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
3955 if (!PyDict_GetItemString(modules, "pyinfile")) {
3956 if (unlikely((PyDict_SetItemString(modules, "pyinfile", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
3957 }
3958 }
3959 #endif
3960 /*--- Builtin init code ---*/
3961 if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3962 /*--- Constants init code ---*/
3963 if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3964 /*--- Global type/function init code ---*/
3965 (void)__Pyx_modinit_global_init_code();
3966 (void)__Pyx_modinit_variable_export_code();
3967 if (unlikely((__Pyx_modinit_function_export_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
3968 (void)__Pyx_modinit_type_init_code();
3969 if (unlikely((__Pyx_modinit_type_import_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error)
3970 (void)__Pyx_modinit_variable_import_code();
3971 (void)__Pyx_modinit_function_import_code();
3972 /*--- Execution code ---*/
3973 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
3974 if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
3975 #endif
3976
3977 /* "pyinfile.pyx":6
3978 * from libcpp.string cimport string as std_string
3979 *
3980 * try: # <<<<<<<<<<<<<<
3981 * from pprintpp import pformat
3982 * except ImportError:
3983 */
3984 {
3985 __Pyx_PyThreadState_declare
3986 __Pyx_PyThreadState_assign
3987 __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
3988 __Pyx_XGOTREF(__pyx_t_1);
3989 __Pyx_XGOTREF(__pyx_t_2);
3990 __Pyx_XGOTREF(__pyx_t_3);
3991 /*try:*/ {
3992
3993 /* "pyinfile.pyx":7
3994 *
3995 * try:
3996 * from pprintpp import pformat # <<<<<<<<<<<<<<
3997 * except ImportError:
3998 * from pprint import pformat
3999 */
4000 __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 7, __pyx_L2_error)
4001 __Pyx_GOTREF(__pyx_t_4);
4002 __Pyx_INCREF(__pyx_n_s_pformat);
4003 __Pyx_GIVEREF(__pyx_n_s_pformat);
4004 if (__Pyx_PyList_SET_ITEM(__pyx_t_4, 0, __pyx_n_s_pformat)) __PYX_ERR(0, 7, __pyx_L2_error);
4005 __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)
4006 __Pyx_GOTREF(__pyx_t_5);
4007 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4008 __pyx_t_4 = __Pyx_ImportFrom(__pyx_t_5, __pyx_n_s_pformat); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 7, __pyx_L2_error)
4009 __Pyx_GOTREF(__pyx_t_4);
4010 if (PyDict_SetItem(__pyx_d, __pyx_n_s_pformat, __pyx_t_4) < 0) __PYX_ERR(0, 7, __pyx_L2_error)
4011 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4012 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4013
4014 /* "pyinfile.pyx":6
4015 * from libcpp.string cimport string as std_string
4016 *
4017 * try: # <<<<<<<<<<<<<<
4018 * from pprintpp import pformat
4019 * except ImportError:
4020 */
4021 }
4022 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
4023 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
4024 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4025 goto __pyx_L7_try_end;
4026 __pyx_L2_error:;
4027 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
4028 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
4029
4030 /* "pyinfile.pyx":8
4031 * try:
4032 * from pprintpp import pformat
4033 * except ImportError: # <<<<<<<<<<<<<<
4034 * from pprint import pformat
4035 *
4036 */
4037 __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_ImportError);
4038 if (__pyx_t_6) {
4039 __Pyx_AddTraceback("pyinfile", __pyx_clineno, __pyx_lineno, __pyx_filename);
4040 if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_7) < 0) __PYX_ERR(0, 8, __pyx_L4_except_error)
4041 __Pyx_XGOTREF(__pyx_t_5);
4042 __Pyx_XGOTREF(__pyx_t_4);
4043 __Pyx_XGOTREF(__pyx_t_7);
4044
4045 /* "pyinfile.pyx":9
4046 * from pprintpp import pformat
4047 * except ImportError:
4048 * from pprint import pformat # <<<<<<<<<<<<<<
4049 *
4050 *
4051 */
4052 __pyx_t_8 = PyList_New(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 9, __pyx_L4_except_error)
4053 __Pyx_GOTREF(__pyx_t_8);
4054 __Pyx_INCREF(__pyx_n_s_pformat);
4055 __Pyx_GIVEREF(__pyx_n_s_pformat);
4056 if (__Pyx_PyList_SET_ITEM(__pyx_t_8, 0, __pyx_n_s_pformat)) __PYX_ERR(0, 9, __pyx_L4_except_error);
4057 __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)
4058 __Pyx_GOTREF(__pyx_t_9);
4059 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
4060 __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)
4061 __Pyx_GOTREF(__pyx_t_8);
4062 if (PyDict_SetItem(__pyx_d, __pyx_n_s_pformat, __pyx_t_8) < 0) __PYX_ERR(0, 9, __pyx_L4_except_error)
4063 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
4064 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
4065 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
4066 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
4067 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
4068 goto __pyx_L3_exception_handled;
4069 }
4070 goto __pyx_L4_except_error;
4071
4072 /* "pyinfile.pyx":6
4073 * from libcpp.string cimport string as std_string
4074 *
4075 * try: # <<<<<<<<<<<<<<
4076 * from pprintpp import pformat
4077 * except ImportError:
4078 */
4079 __pyx_L4_except_error:;
4080 __Pyx_XGIVEREF(__pyx_t_1);
4081 __Pyx_XGIVEREF(__pyx_t_2);
4082 __Pyx_XGIVEREF(__pyx_t_3);
4083 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
4084 goto __pyx_L1_error;
4085 __pyx_L3_exception_handled:;
4086 __Pyx_XGIVEREF(__pyx_t_1);
4087 __Pyx_XGIVEREF(__pyx_t_2);
4088 __Pyx_XGIVEREF(__pyx_t_3);
4089 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
4090 __pyx_L7_try_end:;
4091 }
4092
4093 /* "pyinfile.pyx":1
4094 * """Cyclus Python input file tools.""" # <<<<<<<<<<<<<<
4095 * from __future__ import print_function, unicode_literals
4096 * from cpython.exc cimport PyErr_CheckSignals
4097 */
4098 __pyx_t_7 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 1, __pyx_L1_error)
4099 __Pyx_GOTREF(__pyx_t_7);
4100 if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_7) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
4101 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
4102
4103 /*--- Wrapped vars code ---*/
4104
4105 goto __pyx_L0;
4106 __pyx_L1_error:;
4107 __Pyx_XDECREF(__pyx_t_4);
4108 __Pyx_XDECREF(__pyx_t_5);
4109 __Pyx_XDECREF(__pyx_t_7);
4110 __Pyx_XDECREF(__pyx_t_8);
4111 __Pyx_XDECREF(__pyx_t_9);
4112 if (__pyx_m) {
4113 if (__pyx_d && stringtab_initialized) {
4114 __Pyx_AddTraceback("init pyinfile", __pyx_clineno, __pyx_lineno, __pyx_filename);
4115 }
4116 #if !CYTHON_USE_MODULE_STATE
4117 Py_CLEAR(__pyx_m);
4118 #else
4119 Py_DECREF(__pyx_m);
4120 if (pystate_addmodule_run) {
4121 PyObject *tp, *value, *tb;
4122 PyErr_Fetch(&tp, &value, &tb);
4123 PyState_RemoveModule(&__pyx_moduledef);
4124 PyErr_Restore(tp, value, tb);
4125 }
4126 #endif
4127 } else if (!PyErr_Occurred()) {
4128 PyErr_SetString(PyExc_ImportError, "init pyinfile");
4129 }
4130 __pyx_L0:;
4131 __Pyx_RefNannyFinishContext();
4132 #if CYTHON_PEP489_MULTI_PHASE_INIT
4133 return (__pyx_m != NULL) ? 0 : -1;
4134 #elif PY_MAJOR_VERSION >= 3
4135 return __pyx_m;
4136 #else
4137 return;
4138 #endif
4139}
4140/* #### Code section: cleanup_globals ### */
4141/* #### Code section: cleanup_module ### */
4142/* #### Code section: main_method ### */
4143/* #### Code section: utility_code_pragmas ### */
4144#ifdef _MSC_VER
4145#pragma warning( push )
4146/* Warning 4127: conditional expression is constant
4147 * Cython uses constant conditional expressions to allow in inline functions to be optimized at
4148 * compile-time, so this warning is not useful
4149 */
4150#pragma warning( disable : 4127 )
4151#endif
4152
4153
4154
4155/* #### Code section: utility_code_def ### */
4156
4157/* --- Runtime support code --- */
4158/* Refnanny */
4159#if CYTHON_REFNANNY
4160static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
4161 PyObject *m = NULL, *p = NULL;
4162 void *r = NULL;
4163 m = PyImport_ImportModule(modname);
4164 if (!m) goto end;
4165 p = PyObject_GetAttrString(m, "RefNannyAPI");
4166 if (!p) goto end;
4167 r = PyLong_AsVoidPtr(p);
4168end:
4169 Py_XDECREF(p);
4170 Py_XDECREF(m);
4171 return (__Pyx_RefNannyAPIStruct *)r;
4172}
4173#endif
4174
4175/* PyErrExceptionMatches */
4176#if CYTHON_FAST_THREAD_STATE
4177static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
4178 Py_ssize_t i, n;
4179 n = PyTuple_GET_SIZE(tuple);
4180#if PY_MAJOR_VERSION >= 3
4181 for (i=0; i<n; i++) {
4182 if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
4183 }
4184#endif
4185 for (i=0; i<n; i++) {
4186 if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
4187 }
4188 return 0;
4189}
4190static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
4191 int result;
4192 PyObject *exc_type;
4193#if PY_VERSION_HEX >= 0x030C00A6
4194 PyObject *current_exception = tstate->current_exception;
4195 if (unlikely(!current_exception)) return 0;
4196 exc_type = (PyObject*) Py_TYPE(current_exception);
4197 if (exc_type == err) return 1;
4198#else
4199 exc_type = tstate->curexc_type;
4200 if (exc_type == err) return 1;
4201 if (unlikely(!exc_type)) return 0;
4202#endif
4203 #if CYTHON_AVOID_BORROWED_REFS
4204 Py_INCREF(exc_type);
4205 #endif
4206 if (unlikely(PyTuple_Check(err))) {
4207 result = __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
4208 } else {
4209 result = __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
4210 }
4211 #if CYTHON_AVOID_BORROWED_REFS
4212 Py_DECREF(exc_type);
4213 #endif
4214 return result;
4215}
4216#endif
4217
4218/* PyErrFetchRestore */
4219#if CYTHON_FAST_THREAD_STATE
4220static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
4221#if PY_VERSION_HEX >= 0x030C00A6
4222 PyObject *tmp_value;
4223 assert(type == NULL || (value != NULL && type == (PyObject*) Py_TYPE(value)));
4224 if (value) {
4225 #if CYTHON_COMPILING_IN_CPYTHON
4226 if (unlikely(((PyBaseExceptionObject*) value)->traceback != tb))
4227 #endif
4228 PyException_SetTraceback(value, tb);
4229 }
4230 tmp_value = tstate->current_exception;
4231 tstate->current_exception = value;
4232 Py_XDECREF(tmp_value);
4233 Py_XDECREF(type);
4234 Py_XDECREF(tb);
4235#else
4236 PyObject *tmp_type, *tmp_value, *tmp_tb;
4237 tmp_type = tstate->curexc_type;
4238 tmp_value = tstate->curexc_value;
4239 tmp_tb = tstate->curexc_traceback;
4240 tstate->curexc_type = type;
4241 tstate->curexc_value = value;
4242 tstate->curexc_traceback = tb;
4243 Py_XDECREF(tmp_type);
4244 Py_XDECREF(tmp_value);
4245 Py_XDECREF(tmp_tb);
4246#endif
4247}
4248static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
4249#if PY_VERSION_HEX >= 0x030C00A6
4250 PyObject* exc_value;
4251 exc_value = tstate->current_exception;
4252 tstate->current_exception = 0;
4253 *value = exc_value;
4254 *type = NULL;
4255 *tb = NULL;
4256 if (exc_value) {
4257 *type = (PyObject*) Py_TYPE(exc_value);
4258 Py_INCREF(*type);
4259 #if CYTHON_COMPILING_IN_CPYTHON
4260 *tb = ((PyBaseExceptionObject*) exc_value)->traceback;
4261 Py_XINCREF(*tb);
4262 #else
4263 *tb = PyException_GetTraceback(exc_value);
4264 #endif
4265 }
4266#else
4267 *type = tstate->curexc_type;
4268 *value = tstate->curexc_value;
4269 *tb = tstate->curexc_traceback;
4270 tstate->curexc_type = 0;
4271 tstate->curexc_value = 0;
4272 tstate->curexc_traceback = 0;
4273#endif
4274}
4275#endif
4276
4277/* PyObjectGetAttrStr */
4278#if CYTHON_USE_TYPE_SLOTS
4279static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
4280 PyTypeObject* tp = Py_TYPE(obj);
4281 if (likely(tp->tp_getattro))
4282 return tp->tp_getattro(obj, attr_name);
4283#if PY_MAJOR_VERSION < 3
4284 if (likely(tp->tp_getattr))
4285 return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
4286#endif
4287 return PyObject_GetAttr(obj, attr_name);
4288}
4289#endif
4290
4291/* PyObjectGetAttrStrNoError */
4292#if __PYX_LIMITED_VERSION_HEX < 0x030d00A1
4293static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
4294 __Pyx_PyThreadState_declare
4295 __Pyx_PyThreadState_assign
4296 if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
4297 __Pyx_PyErr_Clear();
4298}
4299#endif
4300static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
4301 PyObject *result;
4302#if __PYX_LIMITED_VERSION_HEX >= 0x030d00A1
4303 (void) PyObject_GetOptionalAttr(obj, attr_name, &result);
4304 return result;
4305#else
4306#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1
4307 PyTypeObject* tp = Py_TYPE(obj);
4308 if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
4309 return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
4310 }
4311#endif
4312 result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
4313 if (unlikely(!result)) {
4314 __Pyx_PyObject_GetAttrStr_ClearAttributeError();
4315 }
4316 return result;
4317#endif
4318}
4319
4320/* GetBuiltinName */
4321static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
4322 PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_b, name);
4323 if (unlikely(!result) && !PyErr_Occurred()) {
4324 PyErr_Format(PyExc_NameError,
4325#if PY_MAJOR_VERSION >= 3
4326 "name '%U' is not defined", name);
4327#else
4328 "name '%.200s' is not defined", PyString_AS_STRING(name));
4329#endif
4330 }
4331 return result;
4332}
4333
4334/* PyFunctionFastCall */
4335#if CYTHON_FAST_PYCALL && !CYTHON_VECTORCALL
4336static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
4337 PyObject *globals) {
4338 PyFrameObject *f;
4339 PyThreadState *tstate = __Pyx_PyThreadState_Current;
4340 PyObject **fastlocals;
4341 Py_ssize_t i;
4342 PyObject *result;
4343 assert(globals != NULL);
4344 /* XXX Perhaps we should create a specialized
4345 PyFrame_New() that doesn't take locals, but does
4346 take builtins without sanity checking them.
4347 */
4348 assert(tstate != NULL);
4349 f = PyFrame_New(tstate, co, globals, NULL);
4350 if (f == NULL) {
4351 return NULL;
4352 }
4353 fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
4354 for (i = 0; i < na; i++) {
4355 Py_INCREF(*args);
4356 fastlocals[i] = *args++;
4357 }
4358 result = PyEval_EvalFrameEx(f,0);
4359 ++tstate->recursion_depth;
4360 Py_DECREF(f);
4361 --tstate->recursion_depth;
4362 return result;
4363}
4364static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
4365 PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
4366 PyObject *globals = PyFunction_GET_GLOBALS(func);
4367 PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
4368 PyObject *closure;
4369#if PY_MAJOR_VERSION >= 3
4370 PyObject *kwdefs;
4371#endif
4372 PyObject *kwtuple, **k;
4373 PyObject **d;
4374 Py_ssize_t nd;
4375 Py_ssize_t nk;
4376 PyObject *result;
4377 assert(kwargs == NULL || PyDict_Check(kwargs));
4378 nk = kwargs ? PyDict_Size(kwargs) : 0;
4379 #if PY_MAJOR_VERSION < 3
4380 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) {
4381 return NULL;
4382 }
4383 #else
4384 if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) {
4385 return NULL;
4386 }
4387 #endif
4388 if (
4389#if PY_MAJOR_VERSION >= 3
4390 co->co_kwonlyargcount == 0 &&
4391#endif
4392 likely(kwargs == NULL || nk == 0) &&
4393 co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
4394 if (argdefs == NULL && co->co_argcount == nargs) {
4395 result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
4396 goto done;
4397 }
4398 else if (nargs == 0 && argdefs != NULL
4399 && co->co_argcount == Py_SIZE(argdefs)) {
4400 /* function called with no arguments, but all parameters have
4401 a default value: use default values as arguments .*/
4402 args = &PyTuple_GET_ITEM(argdefs, 0);
4403 result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
4404 goto done;
4405 }
4406 }
4407 if (kwargs != NULL) {
4408 Py_ssize_t pos, i;
4409 kwtuple = PyTuple_New(2 * nk);
4410 if (kwtuple == NULL) {
4411 result = NULL;
4412 goto done;
4413 }
4414 k = &PyTuple_GET_ITEM(kwtuple, 0);
4415 pos = i = 0;
4416 while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
4417 Py_INCREF(k[i]);
4418 Py_INCREF(k[i+1]);
4419 i += 2;
4420 }
4421 nk = i / 2;
4422 }
4423 else {
4424 kwtuple = NULL;
4425 k = NULL;
4426 }
4427 closure = PyFunction_GET_CLOSURE(func);
4428#if PY_MAJOR_VERSION >= 3
4429 kwdefs = PyFunction_GET_KW_DEFAULTS(func);
4430#endif
4431 if (argdefs != NULL) {
4432 d = &PyTuple_GET_ITEM(argdefs, 0);
4433 nd = Py_SIZE(argdefs);
4434 }
4435 else {
4436 d = NULL;
4437 nd = 0;
4438 }
4439#if PY_MAJOR_VERSION >= 3
4440 result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
4441 args, (int)nargs,
4442 k, (int)nk,
4443 d, (int)nd, kwdefs, closure);
4444#else
4445 result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
4446 args, (int)nargs,
4447 k, (int)nk,
4448 d, (int)nd, closure);
4449#endif
4450 Py_XDECREF(kwtuple);
4451done:
4452 Py_LeaveRecursiveCall();
4453 return result;
4454}
4455#endif
4456
4457/* PyObjectCall */
4458#if CYTHON_COMPILING_IN_CPYTHON
4459static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
4460 PyObject *result;
4461 ternaryfunc call = Py_TYPE(func)->tp_call;
4462 if (unlikely(!call))
4463 return PyObject_Call(func, arg, kw);
4464 #if PY_MAJOR_VERSION < 3
4465 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
4466 return NULL;
4467 #else
4468 if (unlikely(Py_EnterRecursiveCall(" while calling a Python object")))
4469 return NULL;
4470 #endif
4471 result = (*call)(func, arg, kw);
4472 Py_LeaveRecursiveCall();
4473 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
4474 PyErr_SetString(
4475 PyExc_SystemError,
4476 "NULL result without error in PyObject_Call");
4477 }
4478 return result;
4479}
4480#endif
4481
4482/* PyObjectCallMethO */
4483#if CYTHON_COMPILING_IN_CPYTHON
4484static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
4485 PyObject *self, *result;
4486 PyCFunction cfunc;
4487 cfunc = __Pyx_CyOrPyCFunction_GET_FUNCTION(func);
4488 self = __Pyx_CyOrPyCFunction_GET_SELF(func);
4489 #if PY_MAJOR_VERSION < 3
4490 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
4491 return NULL;
4492 #else
4493 if (unlikely(Py_EnterRecursiveCall(" while calling a Python object")))
4494 return NULL;
4495 #endif
4496 result = cfunc(self, arg);
4497 Py_LeaveRecursiveCall();
4498 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
4499 PyErr_SetString(
4500 PyExc_SystemError,
4501 "NULL result without error in PyObject_Call");
4502 }
4503 return result;
4504}
4505#endif
4506
4507/* PyObjectFastCall */
4508#if PY_VERSION_HEX < 0x03090000 || CYTHON_COMPILING_IN_LIMITED_API
4509static PyObject* __Pyx_PyObject_FastCall_fallback(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs) {
4510 PyObject *argstuple;
4511 PyObject *result = 0;
4512 size_t i;
4513 argstuple = PyTuple_New((Py_ssize_t)nargs);
4514 if (unlikely(!argstuple)) return NULL;
4515 for (i = 0; i < nargs; i++) {
4516 Py_INCREF(args[i]);
4517 if (__Pyx_PyTuple_SET_ITEM(argstuple, (Py_ssize_t)i, args[i]) < 0) goto bad;
4518 }
4519 result = __Pyx_PyObject_Call(func, argstuple, kwargs);
4520 bad:
4521 Py_DECREF(argstuple);
4522 return result;
4523}
4524#endif
4525static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t _nargs, PyObject *kwargs) {
4526 Py_ssize_t nargs = __Pyx_PyVectorcall_NARGS(_nargs);
4527#if CYTHON_COMPILING_IN_CPYTHON
4528 if (nargs == 0 && kwargs == NULL) {
4529 if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_NOARGS))
4530 return __Pyx_PyObject_CallMethO(func, NULL);
4531 }
4532 else if (nargs == 1 && kwargs == NULL) {
4533 if (__Pyx_CyOrPyCFunction_Check(func) && likely( __Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_O))
4534 return __Pyx_PyObject_CallMethO(func, args[0]);
4535 }
4536#endif
4537 #if PY_VERSION_HEX < 0x030800B1
4538 #if CYTHON_FAST_PYCCALL
4539 if (PyCFunction_Check(func)) {
4540 if (kwargs) {
4541 return _PyCFunction_FastCallDict(func, args, nargs, kwargs);
4542 } else {
4543 return _PyCFunction_FastCallKeywords(func, args, nargs, NULL);
4544 }
4545 }
4546 #if PY_VERSION_HEX >= 0x030700A1
4547 if (!kwargs && __Pyx_IS_TYPE(func, &PyMethodDescr_Type)) {
4548 return _PyMethodDescr_FastCallKeywords(func, args, nargs, NULL);
4549 }
4550 #endif
4551 #endif
4552 #if CYTHON_FAST_PYCALL
4553 if (PyFunction_Check(func)) {
4554 return __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs);
4555 }
4556 #endif
4557 #endif
4558 if (kwargs == NULL) {
4559 #if CYTHON_VECTORCALL
4560 #if PY_VERSION_HEX < 0x03090000
4561 vectorcallfunc f = _PyVectorcall_Function(func);
4562 #else
4563 vectorcallfunc f = PyVectorcall_Function(func);
4564 #endif
4565 if (f) {
4566 return f(func, args, (size_t)nargs, NULL);
4567 }
4568 #elif defined(__Pyx_CyFunction_USED) && CYTHON_BACKPORT_VECTORCALL
4569 if (__Pyx_CyFunction_CheckExact(func)) {
4570 __pyx_vectorcallfunc f = __Pyx_CyFunction_func_vectorcall(func);
4571 if (f) return f(func, args, (size_t)nargs, NULL);
4572 }
4573 #endif
4574 }
4575 if (nargs == 0) {
4576 return __Pyx_PyObject_Call(func, __pyx_empty_tuple, kwargs);
4577 }
4578 #if PY_VERSION_HEX >= 0x03090000 && !CYTHON_COMPILING_IN_LIMITED_API
4579 return PyObject_VectorcallDict(func, args, (size_t)nargs, kwargs);
4580 #else
4581 return __Pyx_PyObject_FastCall_fallback(func, args, (size_t)nargs, kwargs);
4582 #endif
4583}
4584
4585/* PyExec */
4586static CYTHON_INLINE PyObject* __Pyx_PyExec2(PyObject* o, PyObject* globals) {
4587 return __Pyx_PyExec3(o, globals, NULL);
4588}
4589static PyObject* __Pyx_PyExec3(PyObject* o, PyObject* globals, PyObject* locals) {
4590 PyObject* result;
4591 PyObject* s = 0;
4592 char *code = 0;
4593 if (!globals || globals == Py_None) {
4594 globals = __pyx_d;
4595 } else if (unlikely(!PyDict_Check(globals))) {
4596 __Pyx_TypeName globals_type_name =
4597 __Pyx_PyType_GetName(Py_TYPE(globals));
4598 PyErr_Format(PyExc_TypeError,
4599 "exec() arg 2 must be a dict, not " __Pyx_FMT_TYPENAME,
4600 globals_type_name);
4601 __Pyx_DECREF_TypeName(globals_type_name);
4602 goto bad;
4603 }
4604 if (!locals || locals == Py_None) {
4605 locals = globals;
4606 }
4607 if (__Pyx_PyDict_GetItemStr(globals, __pyx_n_s_builtins) == NULL) {
4608 if (unlikely(PyDict_SetItem(globals, __pyx_n_s_builtins, PyEval_GetBuiltins()) < 0))
4609 goto bad;
4610 }
4611 if (PyCode_Check(o)) {
4612 if (unlikely(__Pyx_PyCode_HasFreeVars((PyCodeObject *)o))) {
4613 PyErr_SetString(PyExc_TypeError,
4614 "code object passed to exec() may not contain free variables");
4615 goto bad;
4616 }
4617 #if PY_VERSION_HEX < 0x030200B1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400)
4618 result = PyEval_EvalCode((PyCodeObject *)o, globals, locals);
4619 #else
4620 result = PyEval_EvalCode(o, globals, locals);
4621 #endif
4622 } else {
4623 PyCompilerFlags cf;
4624 cf.cf_flags = 0;
4625#if PY_VERSION_HEX >= 0x030800A3
4626 cf.cf_feature_version = PY_MINOR_VERSION;
4627#endif
4628 if (PyUnicode_Check(o)) {
4629 cf.cf_flags = PyCF_SOURCE_IS_UTF8;
4630 s = PyUnicode_AsUTF8String(o);
4631 if (unlikely(!s)) goto bad;
4632 o = s;
4633 #if PY_MAJOR_VERSION >= 3
4634 } else if (unlikely(!PyBytes_Check(o))) {
4635 #else
4636 } else if (unlikely(!PyString_Check(o))) {
4637 #endif
4638 __Pyx_TypeName o_type_name = __Pyx_PyType_GetName(Py_TYPE(o));
4639 PyErr_Format(PyExc_TypeError,
4640 "exec: arg 1 must be string, bytes or code object, got " __Pyx_FMT_TYPENAME,
4641 o_type_name);
4642 __Pyx_DECREF_TypeName(o_type_name);
4643 goto bad;
4644 }
4645 #if PY_MAJOR_VERSION >= 3
4646 code = PyBytes_AS_STRING(o);
4647 #else
4648 code = PyString_AS_STRING(o);
4649 #endif
4650 if (PyEval_MergeCompilerFlags(&cf)) {
4651 result = PyRun_StringFlags(code, Py_file_input, globals, locals, &cf);
4652 } else {
4653 result = PyRun_String(code, Py_file_input, globals, locals);
4654 }
4655 Py_XDECREF(s);
4656 }
4657 return result;
4658bad:
4659 Py_XDECREF(s);
4660 return 0;
4661}
4662
4663/* DictGetItem */
4664#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
4665static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
4666 PyObject *value;
4667 value = PyDict_GetItemWithError(d, key);
4668 if (unlikely(!value)) {
4669 if (!PyErr_Occurred()) {
4670 if (unlikely(PyTuple_Check(key))) {
4671 PyObject* args = PyTuple_Pack(1, key);
4672 if (likely(args)) {
4673 PyErr_SetObject(PyExc_KeyError, args);
4674 Py_DECREF(args);
4675 }
4676 } else {
4677 PyErr_SetObject(PyExc_KeyError, key);
4678 }
4679 }
4680 return NULL;
4681 }
4682 Py_INCREF(value);
4683 return value;
4684}
4685#endif
4686
4687/* RaiseException */
4688#if PY_MAJOR_VERSION < 3
4689static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
4690 __Pyx_PyThreadState_declare
4691 CYTHON_UNUSED_VAR(cause);
4692 Py_XINCREF(type);
4693 if (!value || value == Py_None)
4694 value = NULL;
4695 else
4696 Py_INCREF(value);
4697 if (!tb || tb == Py_None)
4698 tb = NULL;
4699 else {
4700 Py_INCREF(tb);
4701 if (!PyTraceBack_Check(tb)) {
4702 PyErr_SetString(PyExc_TypeError,
4703 "raise: arg 3 must be a traceback or None");
4704 goto raise_error;
4705 }
4706 }
4707 if (PyType_Check(type)) {
4708#if CYTHON_COMPILING_IN_PYPY
4709 if (!value) {
4710 Py_INCREF(Py_None);
4711 value = Py_None;
4712 }
4713#endif
4714 PyErr_NormalizeException(&type, &value, &tb);
4715 } else {
4716 if (value) {
4717 PyErr_SetString(PyExc_TypeError,
4718 "instance exception may not have a separate value");
4719 goto raise_error;
4720 }
4721 value = type;
4722 type = (PyObject*) Py_TYPE(type);
4723 Py_INCREF(type);
4724 if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
4725 PyErr_SetString(PyExc_TypeError,
4726 "raise: exception class must be a subclass of BaseException");
4727 goto raise_error;
4728 }
4729 }
4730 __Pyx_PyThreadState_assign
4731 __Pyx_ErrRestore(type, value, tb);
4732 return;
4733raise_error:
4734 Py_XDECREF(value);
4735 Py_XDECREF(type);
4736 Py_XDECREF(tb);
4737 return;
4738}
4739#else
4740static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
4741 PyObject* owned_instance = NULL;
4742 if (tb == Py_None) {
4743 tb = 0;
4744 } else if (tb && !PyTraceBack_Check(tb)) {
4745 PyErr_SetString(PyExc_TypeError,
4746 "raise: arg 3 must be a traceback or None");
4747 goto bad;
4748 }
4749 if (value == Py_None)
4750 value = 0;
4751 if (PyExceptionInstance_Check(type)) {
4752 if (value) {
4753 PyErr_SetString(PyExc_TypeError,
4754 "instance exception may not have a separate value");
4755 goto bad;
4756 }
4757 value = type;
4758 type = (PyObject*) Py_TYPE(value);
4759 } else if (PyExceptionClass_Check(type)) {
4760 PyObject *instance_class = NULL;
4761 if (value && PyExceptionInstance_Check(value)) {
4762 instance_class = (PyObject*) Py_TYPE(value);
4763 if (instance_class != type) {
4764 int is_subclass = PyObject_IsSubclass(instance_class, type);
4765 if (!is_subclass) {
4766 instance_class = NULL;
4767 } else if (unlikely(is_subclass == -1)) {
4768 goto bad;
4769 } else {
4770 type = instance_class;
4771 }
4772 }
4773 }
4774 if (!instance_class) {
4775 PyObject *args;
4776 if (!value)
4777 args = PyTuple_New(0);
4778 else if (PyTuple_Check(value)) {
4779 Py_INCREF(value);
4780 args = value;
4781 } else
4782 args = PyTuple_Pack(1, value);
4783 if (!args)
4784 goto bad;
4785 owned_instance = PyObject_Call(type, args, NULL);
4786 Py_DECREF(args);
4787 if (!owned_instance)
4788 goto bad;
4789 value = owned_instance;
4790 if (!PyExceptionInstance_Check(value)) {
4791 PyErr_Format(PyExc_TypeError,
4792 "calling %R should have returned an instance of "
4793 "BaseException, not %R",
4794 type, Py_TYPE(value));
4795 goto bad;
4796 }
4797 }
4798 } else {
4799 PyErr_SetString(PyExc_TypeError,
4800 "raise: exception class must be a subclass of BaseException");
4801 goto bad;
4802 }
4803 if (cause) {
4804 PyObject *fixed_cause;
4805 if (cause == Py_None) {
4806 fixed_cause = NULL;
4807 } else if (PyExceptionClass_Check(cause)) {
4808 fixed_cause = PyObject_CallObject(cause, NULL);
4809 if (fixed_cause == NULL)
4810 goto bad;
4811 } else if (PyExceptionInstance_Check(cause)) {
4812 fixed_cause = cause;
4813 Py_INCREF(fixed_cause);
4814 } else {
4815 PyErr_SetString(PyExc_TypeError,
4816 "exception causes must derive from "
4817 "BaseException");
4818 goto bad;
4819 }
4820 PyException_SetCause(value, fixed_cause);
4821 }
4822 PyErr_SetObject(type, value);
4823 if (tb) {
4824 #if PY_VERSION_HEX >= 0x030C00A6
4825 PyException_SetTraceback(value, tb);
4826 #elif CYTHON_FAST_THREAD_STATE
4827 PyThreadState *tstate = __Pyx_PyThreadState_Current;
4828 PyObject* tmp_tb = tstate->curexc_traceback;
4829 if (tb != tmp_tb) {
4830 Py_INCREF(tb);
4831 tstate->curexc_traceback = tb;
4832 Py_XDECREF(tmp_tb);
4833 }
4834#else
4835 PyObject *tmp_type, *tmp_value, *tmp_tb;
4836 PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
4837 Py_INCREF(tb);
4838 PyErr_Restore(tmp_type, tmp_value, tb);
4839 Py_XDECREF(tmp_tb);
4840#endif
4841 }
4842bad:
4843 Py_XDECREF(owned_instance);
4844 return;
4845}
4846#endif
4847
4848/* Import */
4849static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
4850 PyObject *module = 0;
4851 PyObject *empty_dict = 0;
4852 PyObject *empty_list = 0;
4853 #if PY_MAJOR_VERSION < 3
4854 PyObject *py_import;
4855 py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
4856 if (unlikely(!py_import))
4857 goto bad;
4858 if (!from_list) {
4859 empty_list = PyList_New(0);
4860 if (unlikely(!empty_list))
4861 goto bad;
4862 from_list = empty_list;
4863 }
4864 #endif
4865 empty_dict = PyDict_New();
4866 if (unlikely(!empty_dict))
4867 goto bad;
4868 {
4869 #if PY_MAJOR_VERSION >= 3
4870 if (level == -1) {
4871 if (strchr(__Pyx_MODULE_NAME, '.') != NULL) {
4872 module = PyImport_ImportModuleLevelObject(
4873 name, __pyx_d, empty_dict, from_list, 1);
4874 if (unlikely(!module)) {
4875 if (unlikely(!PyErr_ExceptionMatches(PyExc_ImportError)))
4876 goto bad;
4877 PyErr_Clear();
4878 }
4879 }
4880 level = 0;
4881 }
4882 #endif
4883 if (!module) {
4884 #if PY_MAJOR_VERSION < 3
4885 PyObject *py_level = PyInt_FromLong(level);
4886 if (unlikely(!py_level))
4887 goto bad;
4888 module = PyObject_CallFunctionObjArgs(py_import,
4889 name, __pyx_d, empty_dict, from_list, py_level, (PyObject *)NULL);
4890 Py_DECREF(py_level);
4891 #else
4892 module = PyImport_ImportModuleLevelObject(
4893 name, __pyx_d, empty_dict, from_list, level);
4894 #endif
4895 }
4896 }
4897bad:
4898 Py_XDECREF(empty_dict);
4899 Py_XDECREF(empty_list);
4900 #if PY_MAJOR_VERSION < 3
4901 Py_XDECREF(py_import);
4902 #endif
4903 return module;
4904}
4905
4906/* ImportFrom */
4907static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
4908 PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
4909 if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
4910 const char* module_name_str = 0;
4911 PyObject* module_name = 0;
4912 PyObject* module_dot = 0;
4913 PyObject* full_name = 0;
4914 PyErr_Clear();
4915 module_name_str = PyModule_GetName(module);
4916 if (unlikely(!module_name_str)) { goto modbad; }
4917 module_name = PyUnicode_FromString(module_name_str);
4918 if (unlikely(!module_name)) { goto modbad; }
4919 module_dot = PyUnicode_Concat(module_name, __pyx_kp_u__4);
4920 if (unlikely(!module_dot)) { goto modbad; }
4921 full_name = PyUnicode_Concat(module_dot, name);
4922 if (unlikely(!full_name)) { goto modbad; }
4923 #if PY_VERSION_HEX < 0x030700A1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400)
4924 {
4925 PyObject *modules = PyImport_GetModuleDict();
4926 if (unlikely(!modules))
4927 goto modbad;
4928 value = PyObject_GetItem(modules, full_name);
4929 }
4930 #else
4931 value = PyImport_GetModule(full_name);
4932 #endif
4933 modbad:
4934 Py_XDECREF(full_name);
4935 Py_XDECREF(module_dot);
4936 Py_XDECREF(module_name);
4937 }
4938 if (unlikely(!value)) {
4939 PyErr_Format(PyExc_ImportError,
4940 #if PY_MAJOR_VERSION < 3
4941 "cannot import name %.230s", PyString_AS_STRING(name));
4942 #else
4943 "cannot import name %S", name);
4944 #endif
4945 }
4946 return value;
4947}
4948
4949/* ImportDottedModule */
4950#if PY_MAJOR_VERSION >= 3
4951static PyObject *__Pyx__ImportDottedModule_Error(PyObject *name, PyObject *parts_tuple, Py_ssize_t count) {
4952 PyObject *partial_name = NULL, *slice = NULL, *sep = NULL;
4953 if (unlikely(PyErr_Occurred())) {
4954 PyErr_Clear();
4955 }
4956 if (likely(PyTuple_GET_SIZE(parts_tuple) == count)) {
4957 partial_name = name;
4958 } else {
4959 slice = PySequence_GetSlice(parts_tuple, 0, count);
4960 if (unlikely(!slice))
4961 goto bad;
4962 sep = PyUnicode_FromStringAndSize(".", 1);
4963 if (unlikely(!sep))
4964 goto bad;
4965 partial_name = PyUnicode_Join(sep, slice);
4966 }
4967 PyErr_Format(
4968#if PY_MAJOR_VERSION < 3
4969 PyExc_ImportError,
4970 "No module named '%s'", PyString_AS_STRING(partial_name));
4971#else
4972#if PY_VERSION_HEX >= 0x030600B1
4973 PyExc_ModuleNotFoundError,
4974#else
4975 PyExc_ImportError,
4976#endif
4977 "No module named '%U'", partial_name);
4978#endif
4979bad:
4980 Py_XDECREF(sep);
4981 Py_XDECREF(slice);
4982 Py_XDECREF(partial_name);
4983 return NULL;
4984}
4985#endif
4986#if PY_MAJOR_VERSION >= 3
4987static PyObject *__Pyx__ImportDottedModule_Lookup(PyObject *name) {
4988 PyObject *imported_module;
4989#if PY_VERSION_HEX < 0x030700A1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400)
4990 PyObject *modules = PyImport_GetModuleDict();
4991 if (unlikely(!modules))
4992 return NULL;
4993 imported_module = __Pyx_PyDict_GetItemStr(modules, name);
4994 Py_XINCREF(imported_module);
4995#else
4996 imported_module = PyImport_GetModule(name);
4997#endif
4998 return imported_module;
4999}
5000#endif
5001#if PY_MAJOR_VERSION >= 3
5002static PyObject *__Pyx_ImportDottedModule_WalkParts(PyObject *module, PyObject *name, PyObject *parts_tuple) {
5003 Py_ssize_t i, nparts;
5004 nparts = PyTuple_GET_SIZE(parts_tuple);
5005 for (i=1; i < nparts && module; i++) {
5006 PyObject *part, *submodule;
5007#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5008 part = PyTuple_GET_ITEM(parts_tuple, i);
5009#else
5010 part = PySequence_ITEM(parts_tuple, i);
5011#endif
5012 submodule = __Pyx_PyObject_GetAttrStrNoError(module, part);
5013#if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
5014 Py_DECREF(part);
5015#endif
5016 Py_DECREF(module);
5017 module = submodule;
5018 }
5019 if (unlikely(!module)) {
5020 return __Pyx__ImportDottedModule_Error(name, parts_tuple, i);
5021 }
5022 return module;
5023}
5024#endif
5025static PyObject *__Pyx__ImportDottedModule(PyObject *name, PyObject *parts_tuple) {
5026#if PY_MAJOR_VERSION < 3
5027 PyObject *module, *from_list, *star = __pyx_n_s__5;
5028 CYTHON_UNUSED_VAR(parts_tuple);
5029 from_list = PyList_New(1);
5030 if (unlikely(!from_list))
5031 return NULL;
5032 Py_INCREF(star);
5033 PyList_SET_ITEM(from_list, 0, star);
5034 module = __Pyx_Import(name, from_list, 0);
5035 Py_DECREF(from_list);
5036 return module;
5037#else
5038 PyObject *imported_module;
5039 PyObject *module = __Pyx_Import(name, NULL, 0);
5040 if (!parts_tuple || unlikely(!module))
5041 return module;
5042 imported_module = __Pyx__ImportDottedModule_Lookup(name);
5043 if (likely(imported_module)) {
5044 Py_DECREF(module);
5045 return imported_module;
5046 }
5047 PyErr_Clear();
5048 return __Pyx_ImportDottedModule_WalkParts(module, name, parts_tuple);
5049#endif
5050}
5051static PyObject *__Pyx_ImportDottedModule(PyObject *name, PyObject *parts_tuple) {
5052#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030400B1
5053 PyObject *module = __Pyx__ImportDottedModule_Lookup(name);
5054 if (likely(module)) {
5055 PyObject *spec = __Pyx_PyObject_GetAttrStrNoError(module, __pyx_n_s_spec);
5056 if (likely(spec)) {
5057 PyObject *unsafe = __Pyx_PyObject_GetAttrStrNoError(spec, __pyx_n_s_initializing);
5058 if (likely(!unsafe || !__Pyx_PyObject_IsTrue(unsafe))) {
5059 Py_DECREF(spec);
5060 spec = NULL;
5061 }
5062 Py_XDECREF(unsafe);
5063 }
5064 if (likely(!spec)) {
5065 PyErr_Clear();
5066 return module;
5067 }
5068 Py_DECREF(spec);
5069 Py_DECREF(module);
5070 } else if (PyErr_Occurred()) {
5071 PyErr_Clear();
5072 }
5073#endif
5074 return __Pyx__ImportDottedModule(name, parts_tuple);
5075}
5076
5077/* PyDictVersioning */
5078#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
5079static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
5080 PyObject *dict = Py_TYPE(obj)->tp_dict;
5081 return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
5082}
5083static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
5084 PyObject **dictptr = NULL;
5085 Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
5086 if (offset) {
5087#if CYTHON_COMPILING_IN_CPYTHON
5088 dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
5089#else
5090 dictptr = _PyObject_GetDictPtr(obj);
5091#endif
5092 }
5093 return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
5094}
5095static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
5096 PyObject *dict = Py_TYPE(obj)->tp_dict;
5097 if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
5098 return 0;
5099 return obj_dict_version == __Pyx_get_object_dict_version(obj);
5100}
5101#endif
5102
5103/* GetModuleGlobalName */
5104#if CYTHON_USE_DICT_VERSIONS
5105static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
5106#else
5107static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
5108#endif
5109{
5110 PyObject *result;
5111#if !CYTHON_AVOID_BORROWED_REFS
5112#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && PY_VERSION_HEX < 0x030d0000
5113 result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
5114 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
5115 if (likely(result)) {
5116 return __Pyx_NewRef(result);
5117 } else if (unlikely(PyErr_Occurred())) {
5118 return NULL;
5119 }
5120#elif CYTHON_COMPILING_IN_LIMITED_API
5121 if (unlikely(!__pyx_m)) {
5122 return NULL;
5123 }
5124 result = PyObject_GetAttr(__pyx_m, name);
5125 if (likely(result)) {
5126 return result;
5127 }
5128#else
5129 result = PyDict_GetItem(__pyx_d, name);
5130 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
5131 if (likely(result)) {
5132 return __Pyx_NewRef(result);
5133 }
5134#endif
5135#else
5136 result = PyObject_GetItem(__pyx_d, name);
5137 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
5138 if (likely(result)) {
5139 return __Pyx_NewRef(result);
5140 }
5141 PyErr_Clear();
5142#endif
5143 return __Pyx_GetBuiltinName(name);
5144}
5145
5146/* TypeImport */
5147#ifndef __PYX_HAVE_RT_ImportType_3_0_11
5148#define __PYX_HAVE_RT_ImportType_3_0_11
5149static PyTypeObject *__Pyx_ImportType_3_0_11(PyObject *module, const char *module_name, const char *class_name,
5150 size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_11 check_size)
5151{
5152 PyObject *result = 0;
5153 char warning[200];
5154 Py_ssize_t basicsize;
5155 Py_ssize_t itemsize;
5156#if CYTHON_COMPILING_IN_LIMITED_API
5157 PyObject *py_basicsize;
5158 PyObject *py_itemsize;
5159#endif
5160 result = PyObject_GetAttrString(module, class_name);
5161 if (!result)
5162 goto bad;
5163 if (!PyType_Check(result)) {
5164 PyErr_Format(PyExc_TypeError,
5165 "%.200s.%.200s is not a type object",
5166 module_name, class_name);
5167 goto bad;
5168 }
5169#if !CYTHON_COMPILING_IN_LIMITED_API
5170 basicsize = ((PyTypeObject *)result)->tp_basicsize;
5171 itemsize = ((PyTypeObject *)result)->tp_itemsize;
5172#else
5173 py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
5174 if (!py_basicsize)
5175 goto bad;
5176 basicsize = PyLong_AsSsize_t(py_basicsize);
5177 Py_DECREF(py_basicsize);
5178 py_basicsize = 0;
5179 if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
5180 goto bad;
5181 py_itemsize = PyObject_GetAttrString(result, "__itemsize__");
5182 if (!py_itemsize)
5183 goto bad;
5184 itemsize = PyLong_AsSsize_t(py_itemsize);
5185 Py_DECREF(py_itemsize);
5186 py_itemsize = 0;
5187 if (itemsize == (Py_ssize_t)-1 && PyErr_Occurred())
5188 goto bad;
5189#endif
5190 if (itemsize) {
5191 if (size % alignment) {
5192 alignment = size % alignment;
5193 }
5194 if (itemsize < (Py_ssize_t)alignment)
5195 itemsize = (Py_ssize_t)alignment;
5196 }
5197 if ((size_t)(basicsize + itemsize) < size) {
5198 PyErr_Format(PyExc_ValueError,
5199 "%.200s.%.200s size changed, may indicate binary incompatibility. "
5200 "Expected %zd from C header, got %zd from PyObject",
5201 module_name, class_name, size, basicsize+itemsize);
5202 goto bad;
5203 }
5204 if (check_size == __Pyx_ImportType_CheckSize_Error_3_0_11 &&
5205 ((size_t)basicsize > size || (size_t)(basicsize + itemsize) < size)) {
5206 PyErr_Format(PyExc_ValueError,
5207 "%.200s.%.200s size changed, may indicate binary incompatibility. "
5208 "Expected %zd from C header, got %zd-%zd from PyObject",
5209 module_name, class_name, size, basicsize, basicsize+itemsize);
5210 goto bad;
5211 }
5212 else if (check_size == __Pyx_ImportType_CheckSize_Warn_3_0_11 && (size_t)basicsize > size) {
5213 PyOS_snprintf(warning, sizeof(warning),
5214 "%s.%s size changed, may indicate binary incompatibility. "
5215 "Expected %zd from C header, got %zd from PyObject",
5216 module_name, class_name, size, basicsize);
5217 if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
5218 }
5219 return (PyTypeObject *)result;
5220bad:
5221 Py_XDECREF(result);
5222 return NULL;
5223}
5224#endif
5225
5226/* GetTopmostException */
5227#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE
5228static _PyErr_StackItem *
5229__Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
5230{
5231 _PyErr_StackItem *exc_info = tstate->exc_info;
5232 while ((exc_info->exc_value == NULL || exc_info->exc_value == Py_None) &&
5233 exc_info->previous_item != NULL)
5234 {
5235 exc_info = exc_info->previous_item;
5236 }
5237 return exc_info;
5238}
5239#endif
5240
5241/* SaveResetException */
5242#if CYTHON_FAST_THREAD_STATE
5243static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
5244 #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4
5245 _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
5246 PyObject *exc_value = exc_info->exc_value;
5247 if (exc_value == NULL || exc_value == Py_None) {
5248 *value = NULL;
5249 *type = NULL;
5250 *tb = NULL;
5251 } else {
5252 *value = exc_value;
5253 Py_INCREF(*value);
5254 *type = (PyObject*) Py_TYPE(exc_value);
5255 Py_INCREF(*type);
5256 *tb = PyException_GetTraceback(exc_value);
5257 }
5258 #elif CYTHON_USE_EXC_INFO_STACK
5259 _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
5260 *type = exc_info->exc_type;
5261 *value = exc_info->exc_value;
5262 *tb = exc_info->exc_traceback;
5263 Py_XINCREF(*type);
5264 Py_XINCREF(*value);
5265 Py_XINCREF(*tb);
5266 #else
5267 *type = tstate->exc_type;
5268 *value = tstate->exc_value;
5269 *tb = tstate->exc_traceback;
5270 Py_XINCREF(*type);
5271 Py_XINCREF(*value);
5272 Py_XINCREF(*tb);
5273 #endif
5274}
5275static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
5276 #if CYTHON_USE_EXC_INFO_STACK && PY_VERSION_HEX >= 0x030B00a4
5277 _PyErr_StackItem *exc_info = tstate->exc_info;
5278 PyObject *tmp_value = exc_info->exc_value;
5279 exc_info->exc_value = value;
5280 Py_XDECREF(tmp_value);
5281 Py_XDECREF(type);
5282 Py_XDECREF(tb);
5283 #else
5284 PyObject *tmp_type, *tmp_value, *tmp_tb;
5285 #if CYTHON_USE_EXC_INFO_STACK
5286 _PyErr_StackItem *exc_info = tstate->exc_info;
5287 tmp_type = exc_info->exc_type;
5288 tmp_value = exc_info->exc_value;
5289 tmp_tb = exc_info->exc_traceback;
5290 exc_info->exc_type = type;
5291 exc_info->exc_value = value;
5292 exc_info->exc_traceback = tb;
5293 #else
5294 tmp_type = tstate->exc_type;
5295 tmp_value = tstate->exc_value;
5296 tmp_tb = tstate->exc_traceback;
5297 tstate->exc_type = type;
5298 tstate->exc_value = value;
5299 tstate->exc_traceback = tb;
5300 #endif
5301 Py_XDECREF(tmp_type);
5302 Py_XDECREF(tmp_value);
5303 Py_XDECREF(tmp_tb);
5304 #endif
5305}
5306#endif
5307
5308/* GetException */
5309#if CYTHON_FAST_THREAD_STATE
5310static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
5311#else
5312static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
5313#endif
5314{
5315 PyObject *local_type = NULL, *local_value, *local_tb = NULL;
5316#if CYTHON_FAST_THREAD_STATE
5317 PyObject *tmp_type, *tmp_value, *tmp_tb;
5318 #if PY_VERSION_HEX >= 0x030C00A6
5319 local_value = tstate->current_exception;
5320 tstate->current_exception = 0;
5321 if (likely(local_value)) {
5322 local_type = (PyObject*) Py_TYPE(local_value);
5323 Py_INCREF(local_type);
5324 local_tb = PyException_GetTraceback(local_value);
5325 }
5326 #else
5327 local_type = tstate->curexc_type;
5328 local_value = tstate->curexc_value;
5329 local_tb = tstate->curexc_traceback;
5330 tstate->curexc_type = 0;
5331 tstate->curexc_value = 0;
5332 tstate->curexc_traceback = 0;
5333 #endif
5334#else
5335 PyErr_Fetch(&local_type, &local_value, &local_tb);
5336#endif
5337 PyErr_NormalizeException(&local_type, &local_value, &local_tb);
5338#if CYTHON_FAST_THREAD_STATE && PY_VERSION_HEX >= 0x030C00A6
5339 if (unlikely(tstate->current_exception))
5340#elif CYTHON_FAST_THREAD_STATE
5341 if (unlikely(tstate->curexc_type))
5342#else
5343 if (unlikely(PyErr_Occurred()))
5344#endif
5345 goto bad;
5346 #if PY_MAJOR_VERSION >= 3
5347 if (local_tb) {
5348 if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
5349 goto bad;
5350 }
5351 #endif
5352 Py_XINCREF(local_tb);
5353 Py_XINCREF(local_type);
5354 Py_XINCREF(local_value);
5355 *type = local_type;
5356 *value = local_value;
5357 *tb = local_tb;
5358#if CYTHON_FAST_THREAD_STATE
5359 #if CYTHON_USE_EXC_INFO_STACK
5360 {
5361 _PyErr_StackItem *exc_info = tstate->exc_info;
5362 #if PY_VERSION_HEX >= 0x030B00a4
5363 tmp_value = exc_info->exc_value;
5364 exc_info->exc_value = local_value;
5365 tmp_type = NULL;
5366 tmp_tb = NULL;
5367 Py_XDECREF(local_type);
5368 Py_XDECREF(local_tb);
5369 #else
5370 tmp_type = exc_info->exc_type;
5371 tmp_value = exc_info->exc_value;
5372 tmp_tb = exc_info->exc_traceback;
5373 exc_info->exc_type = local_type;
5374 exc_info->exc_value = local_value;
5375 exc_info->exc_traceback = local_tb;
5376 #endif
5377 }
5378 #else
5379 tmp_type = tstate->exc_type;
5380 tmp_value = tstate->exc_value;
5381 tmp_tb = tstate->exc_traceback;
5382 tstate->exc_type = local_type;
5383 tstate->exc_value = local_value;
5384 tstate->exc_traceback = local_tb;
5385 #endif
5386 Py_XDECREF(tmp_type);
5387 Py_XDECREF(tmp_value);
5388 Py_XDECREF(tmp_tb);
5389#else
5390 PyErr_SetExcInfo(local_type, local_value, local_tb);
5391#endif
5392 return 0;
5393bad:
5394 *type = 0;
5395 *value = 0;
5396 *tb = 0;
5397 Py_XDECREF(local_type);
5398 Py_XDECREF(local_value);
5399 Py_XDECREF(local_tb);
5400 return -1;
5401}
5402
5403/* CLineInTraceback */
5404#ifndef CYTHON_CLINE_IN_TRACEBACK
5405static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) {
5406 PyObject *use_cline;
5407 PyObject *ptype, *pvalue, *ptraceback;
5408#if CYTHON_COMPILING_IN_CPYTHON
5409 PyObject **cython_runtime_dict;
5410#endif
5411 CYTHON_MAYBE_UNUSED_VAR(tstate);
5412 if (unlikely(!__pyx_cython_runtime)) {
5413 return c_line;
5414 }
5415 __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
5416#if CYTHON_COMPILING_IN_CPYTHON
5417 cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
5418 if (likely(cython_runtime_dict)) {
5419 __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
5420 use_cline, *cython_runtime_dict,
5421 __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
5422 } else
5423#endif
5424 {
5425 PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStrNoError(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
5426 if (use_cline_obj) {
5427 use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
5428 Py_DECREF(use_cline_obj);
5429 } else {
5430 PyErr_Clear();
5431 use_cline = NULL;
5432 }
5433 }
5434 if (!use_cline) {
5435 c_line = 0;
5436 (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
5437 }
5438 else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
5439 c_line = 0;
5440 }
5441 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
5442 return c_line;
5443}
5444#endif
5445
5446/* CodeObjectCache */
5447#if !CYTHON_COMPILING_IN_LIMITED_API
5448static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
5449 int start = 0, mid = 0, end = count - 1;
5450 if (end >= 0 && code_line > entries[end].code_line) {
5451 return count;
5452 }
5453 while (start < end) {
5454 mid = start + (end - start) / 2;
5455 if (code_line < entries[mid].code_line) {
5456 end = mid;
5457 } else if (code_line > entries[mid].code_line) {
5458 start = mid + 1;
5459 } else {
5460 return mid;
5461 }
5462 }
5463 if (code_line <= entries[mid].code_line) {
5464 return mid;
5465 } else {
5466 return mid + 1;
5467 }
5468}
5469static PyCodeObject *__pyx_find_code_object(int code_line) {
5470 PyCodeObject* code_object;
5471 int pos;
5472 if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
5473 return NULL;
5474 }
5475 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
5476 if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
5477 return NULL;
5478 }
5479 code_object = __pyx_code_cache.entries[pos].code_object;
5480 Py_INCREF(code_object);
5481 return code_object;
5482}
5483static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
5484 int pos, i;
5485 __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
5486 if (unlikely(!code_line)) {
5487 return;
5488 }
5489 if (unlikely(!entries)) {
5490 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
5491 if (likely(entries)) {
5492 __pyx_code_cache.entries = entries;
5493 __pyx_code_cache.max_count = 64;
5494 __pyx_code_cache.count = 1;
5495 entries[0].code_line = code_line;
5496 entries[0].code_object = code_object;
5497 Py_INCREF(code_object);
5498 }
5499 return;
5500 }
5501 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
5502 if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
5503 PyCodeObject* tmp = entries[pos].code_object;
5504 entries[pos].code_object = code_object;
5505 Py_DECREF(tmp);
5506 return;
5507 }
5508 if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
5509 int new_max = __pyx_code_cache.max_count + 64;
5510 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
5511 __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
5512 if (unlikely(!entries)) {
5513 return;
5514 }
5515 __pyx_code_cache.entries = entries;
5516 __pyx_code_cache.max_count = new_max;
5517 }
5518 for (i=__pyx_code_cache.count; i>pos; i--) {
5519 entries[i] = entries[i-1];
5520 }
5521 entries[pos].code_line = code_line;
5522 entries[pos].code_object = code_object;
5523 __pyx_code_cache.count++;
5524 Py_INCREF(code_object);
5525}
5526#endif
5527
5528/* AddTraceback */
5529#include "compile.h"
5530#include "frameobject.h"
5531#include "traceback.h"
5532#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API
5533 #ifndef Py_BUILD_CORE
5534 #define Py_BUILD_CORE 1
5535 #endif
5536 #include "internal/pycore_frame.h"
5537#endif
5538#if CYTHON_COMPILING_IN_LIMITED_API
5539static PyObject *__Pyx_PyCode_Replace_For_AddTraceback(PyObject *code, PyObject *scratch_dict,
5540 PyObject *firstlineno, PyObject *name) {
5541 PyObject *replace = NULL;
5542 if (unlikely(PyDict_SetItemString(scratch_dict, "co_firstlineno", firstlineno))) return NULL;
5543 if (unlikely(PyDict_SetItemString(scratch_dict, "co_name", name))) return NULL;
5544 replace = PyObject_GetAttrString(code, "replace");
5545 if (likely(replace)) {
5546 PyObject *result;
5547 result = PyObject_Call(replace, __pyx_empty_tuple, scratch_dict);
5548 Py_DECREF(replace);
5549 return result;
5550 }
5551 PyErr_Clear();
5552 #if __PYX_LIMITED_VERSION_HEX < 0x030780000
5553 {
5554 PyObject *compiled = NULL, *result = NULL;
5555 if (unlikely(PyDict_SetItemString(scratch_dict, "code", code))) return NULL;
5556 if (unlikely(PyDict_SetItemString(scratch_dict, "type", (PyObject*)(&PyType_Type)))) return NULL;
5557 compiled = Py_CompileString(
5558 "out = type(code)(\n"
5559 " code.co_argcount, code.co_kwonlyargcount, code.co_nlocals, code.co_stacksize,\n"
5560 " code.co_flags, code.co_code, code.co_consts, code.co_names,\n"
5561 " code.co_varnames, code.co_filename, co_name, co_firstlineno,\n"
5562 " code.co_lnotab)\n", "<dummy>", Py_file_input);
5563 if (!compiled) return NULL;
5564 result = PyEval_EvalCode(compiled, scratch_dict, scratch_dict);
5565 Py_DECREF(compiled);
5566 if (!result) PyErr_Print();
5567 Py_DECREF(result);
5568 result = PyDict_GetItemString(scratch_dict, "out");
5569 if (result) Py_INCREF(result);
5570 return result;
5571 }
5572 #else
5573 return NULL;
5574 #endif
5575}
5576static void __Pyx_AddTraceback(const char *funcname, int c_line,
5577 int py_line, const char *filename) {
5578 PyObject *code_object = NULL, *py_py_line = NULL, *py_funcname = NULL, *dict = NULL;
5579 PyObject *replace = NULL, *getframe = NULL, *frame = NULL;
5580 PyObject *exc_type, *exc_value, *exc_traceback;
5581 int success = 0;
5582 if (c_line) {
5583 (void) __pyx_cfilenm;
5584 (void) __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line);
5585 }
5586 PyErr_Fetch(&exc_type, &exc_value, &exc_traceback);
5587 code_object = Py_CompileString("_getframe()", filename, Py_eval_input);
5588 if (unlikely(!code_object)) goto bad;
5589 py_py_line = PyLong_FromLong(py_line);
5590 if (unlikely(!py_py_line)) goto bad;
5591 py_funcname = PyUnicode_FromString(funcname);
5592 if (unlikely(!py_funcname)) goto bad;
5593 dict = PyDict_New();
5594 if (unlikely(!dict)) goto bad;
5595 {
5596 PyObject *old_code_object = code_object;
5597 code_object = __Pyx_PyCode_Replace_For_AddTraceback(code_object, dict, py_py_line, py_funcname);
5598 Py_DECREF(old_code_object);
5599 }
5600 if (unlikely(!code_object)) goto bad;
5601 getframe = PySys_GetObject("_getframe");
5602 if (unlikely(!getframe)) goto bad;
5603 if (unlikely(PyDict_SetItemString(dict, "_getframe", getframe))) goto bad;
5604 frame = PyEval_EvalCode(code_object, dict, dict);
5605 if (unlikely(!frame) || frame == Py_None) goto bad;
5606 success = 1;
5607 bad:
5608 PyErr_Restore(exc_type, exc_value, exc_traceback);
5609 Py_XDECREF(code_object);
5610 Py_XDECREF(py_py_line);
5611 Py_XDECREF(py_funcname);
5612 Py_XDECREF(dict);
5613 Py_XDECREF(replace);
5614 if (success) {
5615 PyTraceBack_Here(
5616 (struct _frame*)frame);
5617 }
5618 Py_XDECREF(frame);
5619}
5620#else
5621static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
5622 const char *funcname, int c_line,
5623 int py_line, const char *filename) {
5624 PyCodeObject *py_code = NULL;
5625 PyObject *py_funcname = NULL;
5626 #if PY_MAJOR_VERSION < 3
5627 PyObject *py_srcfile = NULL;
5628 py_srcfile = PyString_FromString(filename);
5629 if (!py_srcfile) goto bad;
5630 #endif
5631 if (c_line) {
5632 #if PY_MAJOR_VERSION < 3
5633 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
5634 if (!py_funcname) goto bad;
5635 #else
5636 py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
5637 if (!py_funcname) goto bad;
5638 funcname = PyUnicode_AsUTF8(py_funcname);
5639 if (!funcname) goto bad;
5640 #endif
5641 }
5642 else {
5643 #if PY_MAJOR_VERSION < 3
5644 py_funcname = PyString_FromString(funcname);
5645 if (!py_funcname) goto bad;
5646 #endif
5647 }
5648 #if PY_MAJOR_VERSION < 3
5649 py_code = __Pyx_PyCode_New(
5650 0,
5651 0,
5652 0,
5653 0,
5654 0,
5655 0,
5656 __pyx_empty_bytes, /*PyObject *code,*/
5657 __pyx_empty_tuple, /*PyObject *consts,*/
5658 __pyx_empty_tuple, /*PyObject *names,*/
5659 __pyx_empty_tuple, /*PyObject *varnames,*/
5660 __pyx_empty_tuple, /*PyObject *freevars,*/
5661 __pyx_empty_tuple, /*PyObject *cellvars,*/
5662 py_srcfile, /*PyObject *filename,*/
5663 py_funcname, /*PyObject *name,*/
5664 py_line,
5665 __pyx_empty_bytes /*PyObject *lnotab*/
5666 );
5667 Py_DECREF(py_srcfile);
5668 #else
5669 py_code = PyCode_NewEmpty(filename, funcname, py_line);
5670 #endif
5671 Py_XDECREF(py_funcname);
5672 return py_code;
5673bad:
5674 Py_XDECREF(py_funcname);
5675 #if PY_MAJOR_VERSION < 3
5676 Py_XDECREF(py_srcfile);
5677 #endif
5678 return NULL;
5679}
5680static void __Pyx_AddTraceback(const char *funcname, int c_line,
5681 int py_line, const char *filename) {
5682 PyCodeObject *py_code = 0;
5683 PyFrameObject *py_frame = 0;
5684 PyThreadState *tstate = __Pyx_PyThreadState_Current;
5685 PyObject *ptype, *pvalue, *ptraceback;
5686 if (c_line) {
5687 c_line = __Pyx_CLineForTraceback(tstate, c_line);
5688 }
5689 py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
5690 if (!py_code) {
5691 __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
5692 py_code = __Pyx_CreateCodeObjectForTraceback(
5693 funcname, c_line, py_line, filename);
5694 if (!py_code) {
5695 /* If the code object creation fails, then we should clear the
5696 fetched exception references and propagate the new exception */
5697 Py_XDECREF(ptype);
5698 Py_XDECREF(pvalue);
5699 Py_XDECREF(ptraceback);
5700 goto bad;
5701 }
5702 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
5703 __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
5704 }
5705 py_frame = PyFrame_New(
5706 tstate, /*PyThreadState *tstate,*/
5707 py_code, /*PyCodeObject *code,*/
5708 __pyx_d, /*PyObject *globals,*/
5709 0 /*PyObject *locals*/
5710 );
5711 if (!py_frame) goto bad;
5712 __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
5713 PyTraceBack_Here(py_frame);
5714bad:
5715 Py_XDECREF(py_code);
5716 Py_XDECREF(py_frame);
5717}
5718#endif
5719
5720/* FormatTypeName */
5721#if CYTHON_COMPILING_IN_LIMITED_API
5722static __Pyx_TypeName
5723__Pyx_PyType_GetName(PyTypeObject* tp)
5724{
5725 PyObject *name = __Pyx_PyObject_GetAttrStr((PyObject *)tp,
5726 __pyx_n_s_name);
5727 if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) {
5728 PyErr_Clear();
5729 Py_XDECREF(name);
5730 name = __Pyx_NewRef(__pyx_n_s__7);
5731 }
5732 return name;
5733}
5734#endif
5735
5736/* CIntToPy */
5737static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
5738#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
5739#pragma GCC diagnostic push
5740#pragma GCC diagnostic ignored "-Wconversion"
5741#endif
5742 const long neg_one = (long) -1, const_zero = (long) 0;
5743#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
5744#pragma GCC diagnostic pop
5745#endif
5746 const int is_unsigned = neg_one > const_zero;
5747 if (is_unsigned) {
5748 if (sizeof(long) < sizeof(long)) {
5749 return PyInt_FromLong((long) value);
5750 } else if (sizeof(long) <= sizeof(unsigned long)) {
5751 return PyLong_FromUnsignedLong((unsigned long) value);
5752#ifdef HAVE_LONG_LONG
5753 } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
5754 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
5755#endif
5756 }
5757 } else {
5758 if (sizeof(long) <= sizeof(long)) {
5759 return PyInt_FromLong((long) value);
5760#ifdef HAVE_LONG_LONG
5761 } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
5762 return PyLong_FromLongLong((PY_LONG_LONG) value);
5763#endif
5764 }
5765 }
5766 {
5767 unsigned char *bytes = (unsigned char *)&value;
5768#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x030d00A4
5769 if (is_unsigned) {
5770 return PyLong_FromUnsignedNativeBytes(bytes, sizeof(value), -1);
5771 } else {
5772 return PyLong_FromNativeBytes(bytes, sizeof(value), -1);
5773 }
5774#elif !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000
5775 int one = 1; int little = (int)*(unsigned char *)&one;
5776 return _PyLong_FromByteArray(bytes, sizeof(long),
5777 little, !is_unsigned);
5778#else
5779 int one = 1; int little = (int)*(unsigned char *)&one;
5780 PyObject *from_bytes, *result = NULL;
5781 PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = NULL, *order_str = NULL;
5782 from_bytes = PyObject_GetAttrString((PyObject*)&PyLong_Type, "from_bytes");
5783 if (!from_bytes) return NULL;
5784 py_bytes = PyBytes_FromStringAndSize((char*)bytes, sizeof(long));
5785 if (!py_bytes) goto limited_bad;
5786 order_str = PyUnicode_FromString(little ? "little" : "big");
5787 if (!order_str) goto limited_bad;
5788 arg_tuple = PyTuple_Pack(2, py_bytes, order_str);
5789 if (!arg_tuple) goto limited_bad;
5790 if (!is_unsigned) {
5791 kwds = PyDict_New();
5792 if (!kwds) goto limited_bad;
5793 if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(Py_True))) goto limited_bad;
5794 }
5795 result = PyObject_Call(from_bytes, arg_tuple, kwds);
5796 limited_bad:
5797 Py_XDECREF(kwds);
5798 Py_XDECREF(arg_tuple);
5799 Py_XDECREF(order_str);
5800 Py_XDECREF(py_bytes);
5801 Py_XDECREF(from_bytes);
5802 return result;
5803#endif
5804 }
5805}
5806
5807/* CIntFromPyVerify */
5808#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
5809 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
5810#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
5811 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
5812#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
5813 {\
5814 func_type value = func_value;\
5815 if (sizeof(target_type) < sizeof(func_type)) {\
5816 if (unlikely(value != (func_type) (target_type) value)) {\
5817 func_type zero = 0;\
5818 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
5819 return (target_type) -1;\
5820 if (is_unsigned && unlikely(value < zero))\
5821 goto raise_neg_overflow;\
5822 else\
5823 goto raise_overflow;\
5824 }\
5825 }\
5826 return (target_type) value;\
5827 }
5828
5829/* CIntFromPy */
5830static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
5831#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
5832#pragma GCC diagnostic push
5833#pragma GCC diagnostic ignored "-Wconversion"
5834#endif
5835 const long neg_one = (long) -1, const_zero = (long) 0;
5836#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
5837#pragma GCC diagnostic pop
5838#endif
5839 const int is_unsigned = neg_one > const_zero;
5840#if PY_MAJOR_VERSION < 3
5841 if (likely(PyInt_Check(x))) {
5842 if ((sizeof(long) < sizeof(long))) {
5843 __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
5844 } else {
5845 long val = PyInt_AS_LONG(x);
5846 if (is_unsigned && unlikely(val < 0)) {
5847 goto raise_neg_overflow;
5848 }
5849 return (long) val;
5850 }
5851 }
5852#endif
5853 if (unlikely(!PyLong_Check(x))) {
5854 long val;
5855 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
5856 if (!tmp) return (long) -1;
5857 val = __Pyx_PyInt_As_long(tmp);
5858 Py_DECREF(tmp);
5859 return val;
5860 }
5861 if (is_unsigned) {
5862#if CYTHON_USE_PYLONG_INTERNALS
5863 if (unlikely(__Pyx_PyLong_IsNeg(x))) {
5864 goto raise_neg_overflow;
5865 } else if (__Pyx_PyLong_IsCompact(x)) {
5866 __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
5867 } else {
5868 const digit* digits = __Pyx_PyLong_Digits(x);
5869 assert(__Pyx_PyLong_DigitCount(x) > 1);
5870 switch (__Pyx_PyLong_DigitCount(x)) {
5871 case 2:
5872 if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) {
5873 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
5874 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
5875 } else if ((8 * sizeof(long) >= 2 * PyLong_SHIFT)) {
5876 return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
5877 }
5878 }
5879 break;
5880 case 3:
5881 if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) {
5882 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
5883 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
5884 } else if ((8 * sizeof(long) >= 3 * PyLong_SHIFT)) {
5885 return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
5886 }
5887 }
5888 break;
5889 case 4:
5890 if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) {
5891 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
5892 __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])))
5893 } else if ((8 * sizeof(long) >= 4 * PyLong_SHIFT)) {
5894 return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
5895 }
5896 }
5897 break;
5898 }
5899 }
5900#endif
5901#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
5902 if (unlikely(Py_SIZE(x) < 0)) {
5903 goto raise_neg_overflow;
5904 }
5905#else
5906 {
5907 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
5908 if (unlikely(result < 0))
5909 return (long) -1;
5910 if (unlikely(result == 1))
5911 goto raise_neg_overflow;
5912 }
5913#endif
5914 if ((sizeof(long) <= sizeof(unsigned long))) {
5915 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
5916#ifdef HAVE_LONG_LONG
5917 } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) {
5918 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
5919#endif
5920 }
5921 } else {
5922#if CYTHON_USE_PYLONG_INTERNALS
5923 if (__Pyx_PyLong_IsCompact(x)) {
5924 __PYX_VERIFY_RETURN_INT(long, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
5925 } else {
5926 const digit* digits = __Pyx_PyLong_Digits(x);
5927 assert(__Pyx_PyLong_DigitCount(x) > 1);
5928 switch (__Pyx_PyLong_SignedDigitCount(x)) {
5929 case -2:
5930 if ((8 * sizeof(long) - 1 > 1 * PyLong_SHIFT)) {
5931 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
5932 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
5933 } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
5934 return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
5935 }
5936 }
5937 break;
5938 case 2:
5939 if ((8 * sizeof(long) > 1 * PyLong_SHIFT)) {
5940 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
5941 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
5942 } else if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
5943 return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
5944 }
5945 }
5946 break;
5947 case -3:
5948 if ((8 * sizeof(long) - 1 > 2 * PyLong_SHIFT)) {
5949 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
5950 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
5951 } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
5952 return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
5953 }
5954 }
5955 break;
5956 case 3:
5957 if ((8 * sizeof(long) > 2 * PyLong_SHIFT)) {
5958 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
5959 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
5960 } else if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
5961 return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
5962 }
5963 }
5964 break;
5965 case -4:
5966 if ((8 * sizeof(long) - 1 > 3 * PyLong_SHIFT)) {
5967 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
5968 __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])))
5969 } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) {
5970 return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
5971 }
5972 }
5973 break;
5974 case 4:
5975 if ((8 * sizeof(long) > 3 * PyLong_SHIFT)) {
5976 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
5977 __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])))
5978 } else if ((8 * sizeof(long) - 1 > 4 * PyLong_SHIFT)) {
5979 return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
5980 }
5981 }
5982 break;
5983 }
5984 }
5985#endif
5986 if ((sizeof(long) <= sizeof(long))) {
5987 __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
5988#ifdef HAVE_LONG_LONG
5989 } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) {
5990 __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
5991#endif
5992 }
5993 }
5994 {
5995 long val;
5996 int ret = -1;
5997#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
5998 Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
5999 x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
6000 if (unlikely(bytes_copied == -1)) {
6001 } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
6002 goto raise_overflow;
6003 } else {
6004 ret = 0;
6005 }
6006#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
6007 int one = 1; int is_little = (int)*(unsigned char *)&one;
6008 unsigned char *bytes = (unsigned char *)&val;
6009 ret = _PyLong_AsByteArray((PyLongObject *)x,
6010 bytes, sizeof(val),
6011 is_little, !is_unsigned);
6012#else
6013 PyObject *v;
6014 PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
6015 int bits, remaining_bits, is_negative = 0;
6016 int chunk_size = (sizeof(long) < 8) ? 30 : 62;
6017 if (likely(PyLong_CheckExact(x))) {
6018 v = __Pyx_NewRef(x);
6019 } else {
6020 v = PyNumber_Long(x);
6021 if (unlikely(!v)) return (long) -1;
6022 assert(PyLong_CheckExact(v));
6023 }
6024 {
6025 int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
6026 if (unlikely(result < 0)) {
6027 Py_DECREF(v);
6028 return (long) -1;
6029 }
6030 is_negative = result == 1;
6031 }
6032 if (is_unsigned && unlikely(is_negative)) {
6033 Py_DECREF(v);
6034 goto raise_neg_overflow;
6035 } else if (is_negative) {
6036 stepval = PyNumber_Invert(v);
6037 Py_DECREF(v);
6038 if (unlikely(!stepval))
6039 return (long) -1;
6040 } else {
6041 stepval = v;
6042 }
6043 v = NULL;
6044 val = (long) 0;
6045 mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
6046 shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
6047 for (bits = 0; bits < (int) sizeof(long) * 8 - chunk_size; bits += chunk_size) {
6048 PyObject *tmp, *digit;
6049 long idigit;
6050 digit = PyNumber_And(stepval, mask);
6051 if (unlikely(!digit)) goto done;
6052 idigit = PyLong_AsLong(digit);
6053 Py_DECREF(digit);
6054 if (unlikely(idigit < 0)) goto done;
6055 val |= ((long) idigit) << bits;
6056 tmp = PyNumber_Rshift(stepval, shift);
6057 if (unlikely(!tmp)) goto done;
6058 Py_DECREF(stepval); stepval = tmp;
6059 }
6060 Py_DECREF(shift); shift = NULL;
6061 Py_DECREF(mask); mask = NULL;
6062 {
6063 long idigit = PyLong_AsLong(stepval);
6064 if (unlikely(idigit < 0)) goto done;
6065 remaining_bits = ((int) sizeof(long) * 8) - bits - (is_unsigned ? 0 : 1);
6066 if (unlikely(idigit >= (1L << remaining_bits)))
6067 goto raise_overflow;
6068 val |= ((long) idigit) << bits;
6069 }
6070 if (!is_unsigned) {
6071 if (unlikely(val & (((long) 1) << (sizeof(long) * 8 - 1))))
6072 goto raise_overflow;
6073 if (is_negative)
6074 val = ~val;
6075 }
6076 ret = 0;
6077 done:
6078 Py_XDECREF(shift);
6079 Py_XDECREF(mask);
6080 Py_XDECREF(stepval);
6081#endif
6082 if (unlikely(ret))
6083 return (long) -1;
6084 return val;
6085 }
6086raise_overflow:
6087 PyErr_SetString(PyExc_OverflowError,
6088 "value too large to convert to long");
6089 return (long) -1;
6090raise_neg_overflow:
6091 PyErr_SetString(PyExc_OverflowError,
6092 "can't convert negative value to long");
6093 return (long) -1;
6094}
6095
6096/* CIntFromPy */
6097static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
6098#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
6099#pragma GCC diagnostic push
6100#pragma GCC diagnostic ignored "-Wconversion"
6101#endif
6102 const int neg_one = (int) -1, const_zero = (int) 0;
6103#ifdef __Pyx_HAS_GCC_DIAGNOSTIC
6104#pragma GCC diagnostic pop
6105#endif
6106 const int is_unsigned = neg_one > const_zero;
6107#if PY_MAJOR_VERSION < 3
6108 if (likely(PyInt_Check(x))) {
6109 if ((sizeof(int) < sizeof(long))) {
6110 __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
6111 } else {
6112 long val = PyInt_AS_LONG(x);
6113 if (is_unsigned && unlikely(val < 0)) {
6114 goto raise_neg_overflow;
6115 }
6116 return (int) val;
6117 }
6118 }
6119#endif
6120 if (unlikely(!PyLong_Check(x))) {
6121 int val;
6122 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
6123 if (!tmp) return (int) -1;
6124 val = __Pyx_PyInt_As_int(tmp);
6125 Py_DECREF(tmp);
6126 return val;
6127 }
6128 if (is_unsigned) {
6129#if CYTHON_USE_PYLONG_INTERNALS
6130 if (unlikely(__Pyx_PyLong_IsNeg(x))) {
6131 goto raise_neg_overflow;
6132 } else if (__Pyx_PyLong_IsCompact(x)) {
6133 __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_upylong, __Pyx_PyLong_CompactValueUnsigned(x))
6134 } else {
6135 const digit* digits = __Pyx_PyLong_Digits(x);
6136 assert(__Pyx_PyLong_DigitCount(x) > 1);
6137 switch (__Pyx_PyLong_DigitCount(x)) {
6138 case 2:
6139 if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) {
6140 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
6141 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6142 } else if ((8 * sizeof(int) >= 2 * PyLong_SHIFT)) {
6143 return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
6144 }
6145 }
6146 break;
6147 case 3:
6148 if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) {
6149 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
6150 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6151 } else if ((8 * sizeof(int) >= 3 * PyLong_SHIFT)) {
6152 return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
6153 }
6154 }
6155 break;
6156 case 4:
6157 if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) {
6158 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
6159 __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])))
6160 } else if ((8 * sizeof(int) >= 4 * PyLong_SHIFT)) {
6161 return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
6162 }
6163 }
6164 break;
6165 }
6166 }
6167#endif
6168#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
6169 if (unlikely(Py_SIZE(x) < 0)) {
6170 goto raise_neg_overflow;
6171 }
6172#else
6173 {
6174 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
6175 if (unlikely(result < 0))
6176 return (int) -1;
6177 if (unlikely(result == 1))
6178 goto raise_neg_overflow;
6179 }
6180#endif
6181 if ((sizeof(int) <= sizeof(unsigned long))) {
6182 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
6183#ifdef HAVE_LONG_LONG
6184 } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) {
6185 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
6186#endif
6187 }
6188 } else {
6189#if CYTHON_USE_PYLONG_INTERNALS
6190 if (__Pyx_PyLong_IsCompact(x)) {
6191 __PYX_VERIFY_RETURN_INT(int, __Pyx_compact_pylong, __Pyx_PyLong_CompactValue(x))
6192 } else {
6193 const digit* digits = __Pyx_PyLong_Digits(x);
6194 assert(__Pyx_PyLong_DigitCount(x) > 1);
6195 switch (__Pyx_PyLong_SignedDigitCount(x)) {
6196 case -2:
6197 if ((8 * sizeof(int) - 1 > 1 * PyLong_SHIFT)) {
6198 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
6199 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6200 } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
6201 return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
6202 }
6203 }
6204 break;
6205 case 2:
6206 if ((8 * sizeof(int) > 1 * PyLong_SHIFT)) {
6207 if ((8 * sizeof(unsigned long) > 2 * PyLong_SHIFT)) {
6208 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6209 } else if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
6210 return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
6211 }
6212 }
6213 break;
6214 case -3:
6215 if ((8 * sizeof(int) - 1 > 2 * PyLong_SHIFT)) {
6216 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
6217 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6218 } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
6219 return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
6220 }
6221 }
6222 break;
6223 case 3:
6224 if ((8 * sizeof(int) > 2 * PyLong_SHIFT)) {
6225 if ((8 * sizeof(unsigned long) > 3 * PyLong_SHIFT)) {
6226 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6227 } else if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
6228 return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
6229 }
6230 }
6231 break;
6232 case -4:
6233 if ((8 * sizeof(int) - 1 > 3 * PyLong_SHIFT)) {
6234 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
6235 __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])))
6236 } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) {
6237 return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
6238 }
6239 }
6240 break;
6241 case 4:
6242 if ((8 * sizeof(int) > 3 * PyLong_SHIFT)) {
6243 if ((8 * sizeof(unsigned long) > 4 * PyLong_SHIFT)) {
6244 __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])))
6245 } else if ((8 * sizeof(int) - 1 > 4 * PyLong_SHIFT)) {
6246 return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
6247 }
6248 }
6249 break;
6250 }
6251 }
6252#endif
6253 if ((sizeof(int) <= sizeof(long))) {
6254 __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
6255#ifdef HAVE_LONG_LONG
6256 } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) {
6257 __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
6258#endif
6259 }
6260 }
6261 {
6262 int val;
6263 int ret = -1;
6264#if PY_VERSION_HEX >= 0x030d00A6 && !CYTHON_COMPILING_IN_LIMITED_API
6265 Py_ssize_t bytes_copied = PyLong_AsNativeBytes(
6266 x, &val, sizeof(val), Py_ASNATIVEBYTES_NATIVE_ENDIAN | (is_unsigned ? Py_ASNATIVEBYTES_UNSIGNED_BUFFER | Py_ASNATIVEBYTES_REJECT_NEGATIVE : 0));
6267 if (unlikely(bytes_copied == -1)) {
6268 } else if (unlikely(bytes_copied > (Py_ssize_t) sizeof(val))) {
6269 goto raise_overflow;
6270 } else {
6271 ret = 0;
6272 }
6273#elif PY_VERSION_HEX < 0x030d0000 && !(CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API) || defined(_PyLong_AsByteArray)
6274 int one = 1; int is_little = (int)*(unsigned char *)&one;
6275 unsigned char *bytes = (unsigned char *)&val;
6276 ret = _PyLong_AsByteArray((PyLongObject *)x,
6277 bytes, sizeof(val),
6278 is_little, !is_unsigned);
6279#else
6280 PyObject *v;
6281 PyObject *stepval = NULL, *mask = NULL, *shift = NULL;
6282 int bits, remaining_bits, is_negative = 0;
6283 int chunk_size = (sizeof(long) < 8) ? 30 : 62;
6284 if (likely(PyLong_CheckExact(x))) {
6285 v = __Pyx_NewRef(x);
6286 } else {
6287 v = PyNumber_Long(x);
6288 if (unlikely(!v)) return (int) -1;
6289 assert(PyLong_CheckExact(v));
6290 }
6291 {
6292 int result = PyObject_RichCompareBool(v, Py_False, Py_LT);
6293 if (unlikely(result < 0)) {
6294 Py_DECREF(v);
6295 return (int) -1;
6296 }
6297 is_negative = result == 1;
6298 }
6299 if (is_unsigned && unlikely(is_negative)) {
6300 Py_DECREF(v);
6301 goto raise_neg_overflow;
6302 } else if (is_negative) {
6303 stepval = PyNumber_Invert(v);
6304 Py_DECREF(v);
6305 if (unlikely(!stepval))
6306 return (int) -1;
6307 } else {
6308 stepval = v;
6309 }
6310 v = NULL;
6311 val = (int) 0;
6312 mask = PyLong_FromLong((1L << chunk_size) - 1); if (unlikely(!mask)) goto done;
6313 shift = PyLong_FromLong(chunk_size); if (unlikely(!shift)) goto done;
6314 for (bits = 0; bits < (int) sizeof(int) * 8 - chunk_size; bits += chunk_size) {
6315 PyObject *tmp, *digit;
6316 long idigit;
6317 digit = PyNumber_And(stepval, mask);
6318 if (unlikely(!digit)) goto done;
6319 idigit = PyLong_AsLong(digit);
6320 Py_DECREF(digit);
6321 if (unlikely(idigit < 0)) goto done;
6322 val |= ((int) idigit) << bits;
6323 tmp = PyNumber_Rshift(stepval, shift);
6324 if (unlikely(!tmp)) goto done;
6325 Py_DECREF(stepval); stepval = tmp;
6326 }
6327 Py_DECREF(shift); shift = NULL;
6328 Py_DECREF(mask); mask = NULL;
6329 {
6330 long idigit = PyLong_AsLong(stepval);
6331 if (unlikely(idigit < 0)) goto done;
6332 remaining_bits = ((int) sizeof(int) * 8) - bits - (is_unsigned ? 0 : 1);
6333 if (unlikely(idigit >= (1L << remaining_bits)))
6334 goto raise_overflow;
6335 val |= ((int) idigit) << bits;
6336 }
6337 if (!is_unsigned) {
6338 if (unlikely(val & (((int) 1) << (sizeof(int) * 8 - 1))))
6339 goto raise_overflow;
6340 if (is_negative)
6341 val = ~val;
6342 }
6343 ret = 0;
6344 done:
6345 Py_XDECREF(shift);
6346 Py_XDECREF(mask);
6347 Py_XDECREF(stepval);
6348#endif
6349 if (unlikely(ret))
6350 return (int) -1;
6351 return val;
6352 }
6353raise_overflow:
6354 PyErr_SetString(PyExc_OverflowError,
6355 "value too large to convert to int");
6356 return (int) -1;
6357raise_neg_overflow:
6358 PyErr_SetString(PyExc_OverflowError,
6359 "can't convert negative value to int");
6360 return (int) -1;
6361}
6362
6363/* FastTypeChecks */
6364#if CYTHON_COMPILING_IN_CPYTHON
6365static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
6366 while (a) {
6367 a = __Pyx_PyType_GetSlot(a, tp_base, PyTypeObject*);
6368 if (a == b)
6369 return 1;
6370 }
6371 return b == &PyBaseObject_Type;
6372}
6373static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
6374 PyObject *mro;
6375 if (a == b) return 1;
6376 mro = a->tp_mro;
6377 if (likely(mro)) {
6378 Py_ssize_t i, n;
6379 n = PyTuple_GET_SIZE(mro);
6380 for (i = 0; i < n; i++) {
6381 if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
6382 return 1;
6383 }
6384 return 0;
6385 }
6386 return __Pyx_InBases(a, b);
6387}
6388static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b) {
6389 PyObject *mro;
6390 if (cls == a || cls == b) return 1;
6391 mro = cls->tp_mro;
6392 if (likely(mro)) {
6393 Py_ssize_t i, n;
6394 n = PyTuple_GET_SIZE(mro);
6395 for (i = 0; i < n; i++) {
6396 PyObject *base = PyTuple_GET_ITEM(mro, i);
6397 if (base == (PyObject *)a || base == (PyObject *)b)
6398 return 1;
6399 }
6400 return 0;
6401 }
6402 return __Pyx_InBases(cls, a) || __Pyx_InBases(cls, b);
6403}
6404#if PY_MAJOR_VERSION == 2
6405static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
6406 PyObject *exception, *value, *tb;
6407 int res;
6408 __Pyx_PyThreadState_declare
6409 __Pyx_PyThreadState_assign
6410 __Pyx_ErrFetch(&exception, &value, &tb);
6411 res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
6412 if (unlikely(res == -1)) {
6413 PyErr_WriteUnraisable(err);
6414 res = 0;
6415 }
6416 if (!res) {
6417 res = PyObject_IsSubclass(err, exc_type2);
6418 if (unlikely(res == -1)) {
6419 PyErr_WriteUnraisable(err);
6420 res = 0;
6421 }
6422 }
6423 __Pyx_ErrRestore(exception, value, tb);
6424 return res;
6425}
6426#else
6427static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
6428 if (exc_type1) {
6429 return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2);
6430 } else {
6431 return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
6432 }
6433}
6434#endif
6435static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
6436 Py_ssize_t i, n;
6437 assert(PyExceptionClass_Check(exc_type));
6438 n = PyTuple_GET_SIZE(tuple);
6439#if PY_MAJOR_VERSION >= 3
6440 for (i=0; i<n; i++) {
6441 if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
6442 }
6443#endif
6444 for (i=0; i<n; i++) {
6445 PyObject *t = PyTuple_GET_ITEM(tuple, i);
6446 #if PY_MAJOR_VERSION < 3
6447 if (likely(exc_type == t)) return 1;
6448 #endif
6449 if (likely(PyExceptionClass_Check(t))) {
6450 if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
6451 } else {
6452 }
6453 }
6454 return 0;
6455}
6456static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
6457 if (likely(err == exc_type)) return 1;
6458 if (likely(PyExceptionClass_Check(err))) {
6459 if (likely(PyExceptionClass_Check(exc_type))) {
6460 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
6461 } else if (likely(PyTuple_Check(exc_type))) {
6462 return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
6463 } else {
6464 }
6465 }
6466 return PyErr_GivenExceptionMatches(err, exc_type);
6467}
6468static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
6469 assert(PyExceptionClass_Check(exc_type1));
6470 assert(PyExceptionClass_Check(exc_type2));
6471 if (likely(err == exc_type1 || err == exc_type2)) return 1;
6472 if (likely(PyExceptionClass_Check(err))) {
6473 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
6474 }
6475 return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
6476}
6477#endif
6478
6479/* CheckBinaryVersion */
6480static unsigned long __Pyx_get_runtime_version(void) {
6481#if __PYX_LIMITED_VERSION_HEX >= 0x030B00A4
6482 return Py_Version & ~0xFFUL;
6483#else
6484 const char* rt_version = Py_GetVersion();
6485 unsigned long version = 0;
6486 unsigned long factor = 0x01000000UL;
6487 unsigned int digit = 0;
6488 int i = 0;
6489 while (factor) {
6490 while ('0' <= rt_version[i] && rt_version[i] <= '9') {
6491 digit = digit * 10 + (unsigned int) (rt_version[i] - '0');
6492 ++i;
6493 }
6494 version += factor * digit;
6495 if (rt_version[i] != '.')
6496 break;
6497 digit = 0;
6498 factor >>= 8;
6499 ++i;
6500 }
6501 return version;
6502#endif
6503}
6504static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer) {
6505 const unsigned long MAJOR_MINOR = 0xFFFF0000UL;
6506 if ((rt_version & MAJOR_MINOR) == (ct_version & MAJOR_MINOR))
6507 return 0;
6508 if (likely(allow_newer && (rt_version & MAJOR_MINOR) > (ct_version & MAJOR_MINOR)))
6509 return 1;
6510 {
6511 char message[200];
6512 PyOS_snprintf(message, sizeof(message),
6513 "compile time Python version %d.%d "
6514 "of module '%.100s' "
6515 "%s "
6516 "runtime version %d.%d",
6517 (int) (ct_version >> 24), (int) ((ct_version >> 16) & 0xFF),
6518 __Pyx_MODULE_NAME,
6519 (allow_newer) ? "was newer than" : "does not match",
6520 (int) (rt_version >> 24), (int) ((rt_version >> 16) & 0xFF)
6521 );
6522 return PyErr_WarnEx(NULL, message, 1);
6523 }
6524}
6525
6526/* FunctionExport */
6527static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig) {
6528 PyObject *d = 0;
6529 PyObject *cobj = 0;
6530 union {
6531 void (*fp)(void);
6532 void *p;
6533 } tmp;
6534 d = PyObject_GetAttrString(__pyx_m, (char *)"__pyx_capi__");
6535 if (!d) {
6536 PyErr_Clear();
6537 d = PyDict_New();
6538 if (!d)
6539 goto bad;
6540 Py_INCREF(d);
6541 if (PyModule_AddObject(__pyx_m, (char *)"__pyx_capi__", d) < 0)
6542 goto bad;
6543 }
6544 tmp.fp = f;
6545 cobj = PyCapsule_New(tmp.p, sig, 0);
6546 if (!cobj)
6547 goto bad;
6548 if (PyDict_SetItemString(d, name, cobj) < 0)
6549 goto bad;
6550 Py_DECREF(cobj);
6551 Py_DECREF(d);
6552 return 0;
6553bad:
6554 Py_XDECREF(cobj);
6555 Py_XDECREF(d);
6556 return -1;
6557}
6558
6559/* InitStrings */
6560#if PY_MAJOR_VERSION >= 3
6561static int __Pyx_InitString(__Pyx_StringTabEntry t, PyObject **str) {
6562 if (t.is_unicode | t.is_str) {
6563 if (t.intern) {
6564 *str = PyUnicode_InternFromString(t.s);
6565 } else if (t.encoding) {
6566 *str = PyUnicode_Decode(t.s, t.n - 1, t.encoding, NULL);
6567 } else {
6568 *str = PyUnicode_FromStringAndSize(t.s, t.n - 1);
6569 }
6570 } else {
6571 *str = PyBytes_FromStringAndSize(t.s, t.n - 1);
6572 }
6573 if (!*str)
6574 return -1;
6575 if (PyObject_Hash(*str) == -1)
6576 return -1;
6577 return 0;
6578}
6579#endif
6580static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
6581 while (t->p) {
6582 #if PY_MAJOR_VERSION >= 3
6583 __Pyx_InitString(*t, t->p);
6584 #else
6585 if (t->is_unicode) {
6586 *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
6587 } else if (t->intern) {
6588 *t->p = PyString_InternFromString(t->s);
6589 } else {
6590 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
6591 }
6592 if (!*t->p)
6593 return -1;
6594 if (PyObject_Hash(*t->p) == -1)
6595 return -1;
6596 #endif
6597 ++t;
6598 }
6599 return 0;
6600}
6601
6602#include <string.h>
6603static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s) {
6604 size_t len = strlen(s);
6605 if (unlikely(len > (size_t) PY_SSIZE_T_MAX)) {
6606 PyErr_SetString(PyExc_OverflowError, "byte string is too long");
6607 return -1;
6608 }
6609 return (Py_ssize_t) len;
6610}
6611static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
6612 Py_ssize_t len = __Pyx_ssize_strlen(c_str);
6613 if (unlikely(len < 0)) return NULL;
6614 return __Pyx_PyUnicode_FromStringAndSize(c_str, len);
6615}
6616static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char* c_str) {
6617 Py_ssize_t len = __Pyx_ssize_strlen(c_str);
6618 if (unlikely(len < 0)) return NULL;
6619 return PyByteArray_FromStringAndSize(c_str, len);
6620}
6621static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
6622 Py_ssize_t ignore;
6623 return __Pyx_PyObject_AsStringAndSize(o, &ignore);
6624}
6625#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
6626#if !CYTHON_PEP393_ENABLED
6627static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
6628 char* defenc_c;
6629 PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
6630 if (!defenc) return NULL;
6631 defenc_c = PyBytes_AS_STRING(defenc);
6632#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
6633 {
6634 char* end = defenc_c + PyBytes_GET_SIZE(defenc);
6635 char* c;
6636 for (c = defenc_c; c < end; c++) {
6637 if ((unsigned char) (*c) >= 128) {
6638 PyUnicode_AsASCIIString(o);
6639 return NULL;
6640 }
6641 }
6642 }
6643#endif
6644 *length = PyBytes_GET_SIZE(defenc);
6645 return defenc_c;
6646}
6647#else
6648static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
6649 if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
6650#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
6651 if (likely(PyUnicode_IS_ASCII(o))) {
6652 *length = PyUnicode_GET_LENGTH(o);
6653 return PyUnicode_AsUTF8(o);
6654 } else {
6655 PyUnicode_AsASCIIString(o);
6656 return NULL;
6657 }
6658#else
6659 return PyUnicode_AsUTF8AndSize(o, length);
6660#endif
6661}
6662#endif
6663#endif
6664static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
6665#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
6666 if (
6667#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
6668 __Pyx_sys_getdefaultencoding_not_ascii &&
6669#endif
6670 PyUnicode_Check(o)) {
6671 return __Pyx_PyUnicode_AsStringAndSize(o, length);
6672 } else
6673#endif
6674#if (!CYTHON_COMPILING_IN_PYPY && !CYTHON_COMPILING_IN_LIMITED_API) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
6675 if (PyByteArray_Check(o)) {
6676 *length = PyByteArray_GET_SIZE(o);
6677 return PyByteArray_AS_STRING(o);
6678 } else
6679#endif
6680 {
6681 char* result;
6682 int r = PyBytes_AsStringAndSize(o, &result, length);
6683 if (unlikely(r < 0)) {
6684 return NULL;
6685 } else {
6686 return result;
6687 }
6688 }
6689}
6690static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
6691 int is_true = x == Py_True;
6692 if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
6693 else return PyObject_IsTrue(x);
6694}
6695static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
6696 int retval;
6697 if (unlikely(!x)) return -1;
6698 retval = __Pyx_PyObject_IsTrue(x);
6699 Py_DECREF(x);
6700 return retval;
6701}
6702static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
6703 __Pyx_TypeName result_type_name = __Pyx_PyType_GetName(Py_TYPE(result));
6704#if PY_MAJOR_VERSION >= 3
6705 if (PyLong_Check(result)) {
6706 if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
6707 "__int__ returned non-int (type " __Pyx_FMT_TYPENAME "). "
6708 "The ability to return an instance of a strict subclass of int is deprecated, "
6709 "and may be removed in a future version of Python.",
6710 result_type_name)) {
6711 __Pyx_DECREF_TypeName(result_type_name);
6712 Py_DECREF(result);
6713 return NULL;
6714 }
6715 __Pyx_DECREF_TypeName(result_type_name);
6716 return result;
6717 }
6718#endif
6719 PyErr_Format(PyExc_TypeError,
6720 "__%.4s__ returned non-%.4s (type " __Pyx_FMT_TYPENAME ")",
6721 type_name, type_name, result_type_name);
6722 __Pyx_DECREF_TypeName(result_type_name);
6723 Py_DECREF(result);
6724 return NULL;
6725}
6726static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
6727#if CYTHON_USE_TYPE_SLOTS
6728 PyNumberMethods *m;
6729#endif
6730 const char *name = NULL;
6731 PyObject *res = NULL;
6732#if PY_MAJOR_VERSION < 3
6733 if (likely(PyInt_Check(x) || PyLong_Check(x)))
6734#else
6735 if (likely(PyLong_Check(x)))
6736#endif
6737 return __Pyx_NewRef(x);
6738#if CYTHON_USE_TYPE_SLOTS
6739 m = Py_TYPE(x)->tp_as_number;
6740 #if PY_MAJOR_VERSION < 3
6741 if (m && m->nb_int) {
6742 name = "int";
6743 res = m->nb_int(x);
6744 }
6745 else if (m && m->nb_long) {
6746 name = "long";
6747 res = m->nb_long(x);
6748 }
6749 #else
6750 if (likely(m && m->nb_int)) {
6751 name = "int";
6752 res = m->nb_int(x);
6753 }
6754 #endif
6755#else
6756 if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
6757 res = PyNumber_Int(x);
6758 }
6759#endif
6760 if (likely(res)) {
6761#if PY_MAJOR_VERSION < 3
6762 if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
6763#else
6764 if (unlikely(!PyLong_CheckExact(res))) {
6765#endif
6766 return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
6767 }
6768 }
6769 else if (!PyErr_Occurred()) {
6770 PyErr_SetString(PyExc_TypeError,
6771 "an integer is required");
6772 }
6773 return res;
6774}
6775static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
6776 Py_ssize_t ival;
6777 PyObject *x;
6778#if PY_MAJOR_VERSION < 3
6779 if (likely(PyInt_CheckExact(b))) {
6780 if (sizeof(Py_ssize_t) >= sizeof(long))
6781 return PyInt_AS_LONG(b);
6782 else
6783 return PyInt_AsSsize_t(b);
6784 }
6785#endif
6786 if (likely(PyLong_CheckExact(b))) {
6787 #if CYTHON_USE_PYLONG_INTERNALS
6788 if (likely(__Pyx_PyLong_IsCompact(b))) {
6789 return __Pyx_PyLong_CompactValue(b);
6790 } else {
6791 const digit* digits = __Pyx_PyLong_Digits(b);
6792 const Py_ssize_t size = __Pyx_PyLong_SignedDigitCount(b);
6793 switch (size) {
6794 case 2:
6795 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
6796 return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
6797 }
6798 break;
6799 case -2:
6800 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
6801 return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
6802 }
6803 break;
6804 case 3:
6805 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
6806 return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
6807 }
6808 break;
6809 case -3:
6810 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
6811 return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
6812 }
6813 break;
6814 case 4:
6815 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
6816 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]));
6817 }
6818 break;
6819 case -4:
6820 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
6821 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]));
6822 }
6823 break;
6824 }
6825 }
6826 #endif
6827 return PyLong_AsSsize_t(b);
6828 }
6829 x = PyNumber_Index(b);
6830 if (!x) return -1;
6831 ival = PyInt_AsSsize_t(x);
6832 Py_DECREF(x);
6833 return ival;
6834}
6835static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) {
6836 if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) {
6837 return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o);
6838#if PY_MAJOR_VERSION < 3
6839 } else if (likely(PyInt_CheckExact(o))) {
6840 return PyInt_AS_LONG(o);
6841#endif
6842 } else {
6843 Py_ssize_t ival;
6844 PyObject *x;
6845 x = PyNumber_Index(o);
6846 if (!x) return -1;
6847 ival = PyInt_AsLong(x);
6848 Py_DECREF(x);
6849 return ival;
6850 }
6851}
6852static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
6853 return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
6854}
6855static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
6856 return PyInt_FromSize_t(ival);
6857}
6858
6859
6860/* #### Code section: utility_code_pragmas_end ### */
6861#ifdef _MSC_VER
6862#pragma warning( pop )
6863#endif
6864
6865
6866
6867/* #### Code section: end ### */
6868#endif /* Py_PYTHON_H */
#define __PYX_EXTERN_C
bool operator==(const CapacityConstraint< T > &lhs, const CapacityConstraint< T > &rhs)
CapacityConstraint-CapacityConstraint equality operator.
memset(dest, src, size)
enable_if< has_const_iterator< T >::value, typenameT::const_iterator >::type end(const T &c)
std::string name(int nuc)
Definition pyne.cc:2940
int offset(int dz, int da, int ds=0)
A helper function to compute nuclide id offsets from z-, a-, and s- deltas.
Definition pyne.h:1455
unsigned int hash(std::string s)
Definition pyne.cc:6323
double b(int nuc)
Computes the scattering length [cm] from the coherent and incoherent components.
Definition pyne.cc:11180
void warning(std::string s)
Prints a warning message.
Definition pyne.cc:413
__PYX_EXTERN_C std::string CyclusPyToJson(std::string)
__PYX_EXTERN_C std::string CyclusJsonToPy(std::string)
PyMODINIT_FUNC initpyinfile(void)