ManimPango 0.4.3__cp39-cp39-win32.whl → 1.0.0a2__cp39-cp39-win32.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. {ManimPango-0.4.3.dist-info → ManimPango-1.0.0a2.dist-info}/METADATA +2 -2
  2. ManimPango-1.0.0a2.dist-info/RECORD +85 -0
  3. {ManimPango-0.4.3.dist-info → ManimPango-1.0.0a2.dist-info}/WHEEL +1 -1
  4. manimpango/__init__.py +5 -7
  5. manimpango/_distributor_init.py +36 -0
  6. manimpango/_version.py +1 -1
  7. manimpango/attributes/__init__.py +324 -0
  8. manimpango/attributes/attributes.pxi +219 -0
  9. manimpango/buffer.pxi +15 -0
  10. manimpango/cmanimpango.c +10025 -0
  11. manimpango/cmanimpango.cp39-win32.pyd +0 -0
  12. manimpango/enums.c +3721 -0
  13. manimpango/enums.cp39-win32.pyd +0 -0
  14. manimpango/enums.pyx +1 -10
  15. manimpango/exceptions.py +5 -0
  16. manimpango/fonts/__init__.py +153 -0
  17. manimpango/fonts/_font_desc.c +7576 -0
  18. manimpango/fonts/_font_desc.cp39-win32.pyd +0 -0
  19. manimpango/fonts/_font_desc.pxd +5 -0
  20. manimpango/fonts/_font_desc.pyi +25 -0
  21. manimpango/fonts/_font_desc.pyx +114 -0
  22. manimpango/fonts/enums.c +3628 -0
  23. manimpango/fonts/enums.cp39-win32.pyd +0 -0
  24. manimpango/fonts/enums.pyi +23 -0
  25. manimpango/fonts/enums.pyx +84 -0
  26. manimpango/{cairo.pxd → include/cairo.pxd} +21 -0
  27. manimpango/include/glib.pxd +36 -0
  28. manimpango/{pango.pxd → include/pango.pxd} +61 -0
  29. manimpango/include/pango_attributes.pxd +184 -0
  30. manimpango/layout/__init__.py +266 -0
  31. manimpango/layout/_layout.c +8630 -0
  32. manimpango/layout/_layout.cp39-win32.pyd +0 -0
  33. manimpango/layout/_layout.pyx +60 -0
  34. manimpango/layout/layout.pxi +52 -0
  35. manimpango/register_font.c +5016 -0
  36. manimpango/register_font.cp39-win32.pyd +0 -0
  37. manimpango/renderer/__init__.py +5 -0
  38. manimpango/renderer/cairo_utils.pxi +72 -0
  39. manimpango/renderer/image_renderer.c +12319 -0
  40. manimpango/renderer/image_renderer.cp39-win32.pyd +0 -0
  41. manimpango/renderer/image_renderer.pxd +23 -0
  42. manimpango/renderer/image_renderer.pyi +21 -0
  43. manimpango/renderer/image_renderer.pyx +219 -0
  44. manimpango/renderer/svg_renderer.c +10671 -0
  45. manimpango/renderer/svg_renderer.cp39-win32.pyd +0 -0
  46. manimpango/renderer/svg_renderer.pxd +23 -0
  47. manimpango/renderer/svg_renderer.pyi +17 -0
  48. manimpango/renderer/svg_renderer.pyx +174 -0
  49. manimpango/utils/__init__.py +3 -0
  50. manimpango/utils/_utils.cp39-win32.pyd +0 -0
  51. manimpango/utils/_utils.pyi +2 -0
  52. manimpango/utils/utils.c +3533 -0
  53. manimpango/{utils.py → utils/utils.py} +3 -1
  54. manimpango/utils/utils.pyx +27 -0
  55. ManimPango-0.4.3.dist-info/RECORD +0 -44
  56. manimpango/glib.pxd +0 -13
  57. {ManimPango-0.4.3.dist-info → ManimPango-1.0.0a2.dist-info}/LICENSE +0 -0
  58. {ManimPango-0.4.3.dist-info → ManimPango-1.0.0a2.dist-info}/LICENSE.win32 +0 -0
  59. {ManimPango-0.4.3.dist-info → ManimPango-1.0.0a2.dist-info}/top_level.txt +0 -0
  60. /manimpango/{CORE_MANIM_cairo-2.dll → .libs/CORE_MANIM_cairo-2.dll} +0 -0
  61. /manimpango/{CORE_MANIM_cairo-gobject-2.dll → .libs/CORE_MANIM_cairo-gobject-2.dll} +0 -0
  62. /manimpango/{CORE_MANIM_cairo-script-interpreter-2.dll → .libs/CORE_MANIM_cairo-script-interpreter-2.dll} +0 -0
  63. /manimpango/{CORE_MANIM_expat.dll → .libs/CORE_MANIM_expat.dll} +0 -0
  64. /manimpango/{CORE_MANIM_ffi-7.dll → .libs/CORE_MANIM_ffi-7.dll} +0 -0
  65. /manimpango/{CORE_MANIM_fontconfig-1.dll → .libs/CORE_MANIM_fontconfig-1.dll} +0 -0
  66. /manimpango/{CORE_MANIM_freetype-6.dll → .libs/CORE_MANIM_freetype-6.dll} +0 -0
  67. /manimpango/{CORE_MANIM_fribidi-0.dll → .libs/CORE_MANIM_fribidi-0.dll} +0 -0
  68. /manimpango/{CORE_MANIM_gio-2.0-0.dll → .libs/CORE_MANIM_gio-2.0-0.dll} +0 -0
  69. /manimpango/{CORE_MANIM_glib-2.0-0.dll → .libs/CORE_MANIM_glib-2.0-0.dll} +0 -0
  70. /manimpango/{CORE_MANIM_gmodule-2.0-0.dll → .libs/CORE_MANIM_gmodule-2.0-0.dll} +0 -0
  71. /manimpango/{CORE_MANIM_gobject-2.0-0.dll → .libs/CORE_MANIM_gobject-2.0-0.dll} +0 -0
  72. /manimpango/{CORE_MANIM_gthread-2.0-0.dll → .libs/CORE_MANIM_gthread-2.0-0.dll} +0 -0
  73. /manimpango/{CORE_MANIM_harfbuzz-gobject.dll → .libs/CORE_MANIM_harfbuzz-gobject.dll} +0 -0
  74. /manimpango/{CORE_MANIM_harfbuzz-subset.dll → .libs/CORE_MANIM_harfbuzz-subset.dll} +0 -0
  75. /manimpango/{CORE_MANIM_harfbuzz.dll → .libs/CORE_MANIM_harfbuzz.dll} +0 -0
  76. /manimpango/{CORE_MANIM_intl-8.dll → .libs/CORE_MANIM_intl-8.dll} +0 -0
  77. /manimpango/{CORE_MANIM_pango-1.0-0.dll → .libs/CORE_MANIM_pango-1.0-0.dll} +0 -0
  78. /manimpango/{CORE_MANIM_pangocairo-1.0-0.dll → .libs/CORE_MANIM_pangocairo-1.0-0.dll} +0 -0
  79. /manimpango/{CORE_MANIM_pangoft2-1.0-0.dll → .libs/CORE_MANIM_pangoft2-1.0-0.dll} +0 -0
  80. /manimpango/{CORE_MANIM_pangowin32-1.0-0.dll → .libs/CORE_MANIM_pangowin32-1.0-0.dll} +0 -0
  81. /manimpango/{CORE_MANIM_pixman-1-0.dll → .libs/CORE_MANIM_pixman-1-0.dll} +0 -0
  82. /manimpango/{CORE_MANIM_png16-16.dll → .libs/CORE_MANIM_png16-16.dll} +0 -0
  83. /manimpango/{CORE_MANIM_z.dll → .libs/CORE_MANIM_z.dll} +0 -0
@@ -0,0 +1,3533 @@
1
+ /* Generated by Cython 0.29.34 */
2
+
3
+ /* BEGIN: Cython Metadata
4
+ {
5
+ "distutils": {
6
+ "define_macros": [
7
+ [
8
+ "UNICODE",
9
+ 1
10
+ ]
11
+ ],
12
+ "depends": [
13
+ "C:\\cibw\\vendor\\include\\cairo\\cairo-svg.h",
14
+ "C:\\cibw\\vendor\\include\\cairo\\cairo.h",
15
+ "C:\\cibw\\vendor\\include\\glib-2.0\\glib.h",
16
+ "C:\\cibw\\vendor\\include\\pango-1.0\\pango\\pango.h",
17
+ "C:\\cibw\\vendor\\include\\pango-1.0\\pango\\pangocairo.h"
18
+ ],
19
+ "include_dirs": [
20
+ "C:/cibw/vendor/include/cairo",
21
+ "C:/cibw/vendor/include/pixman-1",
22
+ "C:/cibw/vendor/include/glib-2.0",
23
+ "C:/cibw/vendor/include/harfbuzz",
24
+ "C:/cibw/vendor/include/pango-1.0",
25
+ "C:/cibw/vendor/include",
26
+ "C:/cibw/vendor/include/fribidi",
27
+ "C:/cibw/vendor/include/freetype2",
28
+ "C:/cibw/vendor/lib/glib-2.0/include"
29
+ ],
30
+ "libraries": [
31
+ "Gdi32",
32
+ "gobject-2.0",
33
+ "glib-2.0",
34
+ "fontconfig",
35
+ "harfbuzz",
36
+ "pangoft2-1.0",
37
+ "pangocairo-1.0",
38
+ "intl",
39
+ "freetype",
40
+ "pango-1.0",
41
+ "cairo"
42
+ ],
43
+ "library_dirs": [
44
+ "C:/cibw/vendor/lib"
45
+ ],
46
+ "name": "manimpango.utils._utils",
47
+ "sources": [
48
+ "manimpango\\utils\\utils.pyx"
49
+ ]
50
+ },
51
+ "module_name": "manimpango.utils._utils"
52
+ }
53
+ END: Cython Metadata */
54
+
55
+ #ifndef PY_SSIZE_T_CLEAN
56
+ #define PY_SSIZE_T_CLEAN
57
+ #endif /* PY_SSIZE_T_CLEAN */
58
+ #include "Python.h"
59
+ #ifndef Py_PYTHON_H
60
+ #error Python headers needed to compile C extensions, please install development version of Python.
61
+ #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
62
+ #error Cython requires Python 2.6+ or Python 3.3+.
63
+ #else
64
+ #define CYTHON_ABI "0_29_34"
65
+ #define CYTHON_HEX_VERSION 0x001D22F0
66
+ #define CYTHON_FUTURE_DIVISION 1
67
+ #include <stddef.h>
68
+ #ifndef offsetof
69
+ #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
70
+ #endif
71
+ #if !defined(WIN32) && !defined(MS_WINDOWS)
72
+ #ifndef __stdcall
73
+ #define __stdcall
74
+ #endif
75
+ #ifndef __cdecl
76
+ #define __cdecl
77
+ #endif
78
+ #ifndef __fastcall
79
+ #define __fastcall
80
+ #endif
81
+ #endif
82
+ #ifndef DL_IMPORT
83
+ #define DL_IMPORT(t) t
84
+ #endif
85
+ #ifndef DL_EXPORT
86
+ #define DL_EXPORT(t) t
87
+ #endif
88
+ #define __PYX_COMMA ,
89
+ #ifndef HAVE_LONG_LONG
90
+ #if PY_VERSION_HEX >= 0x02070000
91
+ #define HAVE_LONG_LONG
92
+ #endif
93
+ #endif
94
+ #ifndef PY_LONG_LONG
95
+ #define PY_LONG_LONG LONG_LONG
96
+ #endif
97
+ #ifndef Py_HUGE_VAL
98
+ #define Py_HUGE_VAL HUGE_VAL
99
+ #endif
100
+ #ifdef PYPY_VERSION
101
+ #define CYTHON_COMPILING_IN_PYPY 1
102
+ #define CYTHON_COMPILING_IN_PYSTON 0
103
+ #define CYTHON_COMPILING_IN_CPYTHON 0
104
+ #define CYTHON_COMPILING_IN_NOGIL 0
105
+ #undef CYTHON_USE_TYPE_SLOTS
106
+ #define CYTHON_USE_TYPE_SLOTS 0
107
+ #undef CYTHON_USE_PYTYPE_LOOKUP
108
+ #define CYTHON_USE_PYTYPE_LOOKUP 0
109
+ #if PY_VERSION_HEX < 0x03050000
110
+ #undef CYTHON_USE_ASYNC_SLOTS
111
+ #define CYTHON_USE_ASYNC_SLOTS 0
112
+ #elif !defined(CYTHON_USE_ASYNC_SLOTS)
113
+ #define CYTHON_USE_ASYNC_SLOTS 1
114
+ #endif
115
+ #undef CYTHON_USE_PYLIST_INTERNALS
116
+ #define CYTHON_USE_PYLIST_INTERNALS 0
117
+ #undef CYTHON_USE_UNICODE_INTERNALS
118
+ #define CYTHON_USE_UNICODE_INTERNALS 0
119
+ #undef CYTHON_USE_UNICODE_WRITER
120
+ #define CYTHON_USE_UNICODE_WRITER 0
121
+ #undef CYTHON_USE_PYLONG_INTERNALS
122
+ #define CYTHON_USE_PYLONG_INTERNALS 0
123
+ #undef CYTHON_AVOID_BORROWED_REFS
124
+ #define CYTHON_AVOID_BORROWED_REFS 1
125
+ #undef CYTHON_ASSUME_SAFE_MACROS
126
+ #define CYTHON_ASSUME_SAFE_MACROS 0
127
+ #undef CYTHON_UNPACK_METHODS
128
+ #define CYTHON_UNPACK_METHODS 0
129
+ #undef CYTHON_FAST_THREAD_STATE
130
+ #define CYTHON_FAST_THREAD_STATE 0
131
+ #undef CYTHON_FAST_PYCALL
132
+ #define CYTHON_FAST_PYCALL 0
133
+ #undef CYTHON_PEP489_MULTI_PHASE_INIT
134
+ #define CYTHON_PEP489_MULTI_PHASE_INIT 0
135
+ #undef CYTHON_USE_TP_FINALIZE
136
+ #define CYTHON_USE_TP_FINALIZE 0
137
+ #undef CYTHON_USE_DICT_VERSIONS
138
+ #define CYTHON_USE_DICT_VERSIONS 0
139
+ #undef CYTHON_USE_EXC_INFO_STACK
140
+ #define CYTHON_USE_EXC_INFO_STACK 0
141
+ #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
142
+ #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
143
+ #endif
144
+ #elif defined(PYSTON_VERSION)
145
+ #define CYTHON_COMPILING_IN_PYPY 0
146
+ #define CYTHON_COMPILING_IN_PYSTON 1
147
+ #define CYTHON_COMPILING_IN_CPYTHON 0
148
+ #define CYTHON_COMPILING_IN_NOGIL 0
149
+ #ifndef CYTHON_USE_TYPE_SLOTS
150
+ #define CYTHON_USE_TYPE_SLOTS 1
151
+ #endif
152
+ #undef CYTHON_USE_PYTYPE_LOOKUP
153
+ #define CYTHON_USE_PYTYPE_LOOKUP 0
154
+ #undef CYTHON_USE_ASYNC_SLOTS
155
+ #define CYTHON_USE_ASYNC_SLOTS 0
156
+ #undef CYTHON_USE_PYLIST_INTERNALS
157
+ #define CYTHON_USE_PYLIST_INTERNALS 0
158
+ #ifndef CYTHON_USE_UNICODE_INTERNALS
159
+ #define CYTHON_USE_UNICODE_INTERNALS 1
160
+ #endif
161
+ #undef CYTHON_USE_UNICODE_WRITER
162
+ #define CYTHON_USE_UNICODE_WRITER 0
163
+ #undef CYTHON_USE_PYLONG_INTERNALS
164
+ #define CYTHON_USE_PYLONG_INTERNALS 0
165
+ #ifndef CYTHON_AVOID_BORROWED_REFS
166
+ #define CYTHON_AVOID_BORROWED_REFS 0
167
+ #endif
168
+ #ifndef CYTHON_ASSUME_SAFE_MACROS
169
+ #define CYTHON_ASSUME_SAFE_MACROS 1
170
+ #endif
171
+ #ifndef CYTHON_UNPACK_METHODS
172
+ #define CYTHON_UNPACK_METHODS 1
173
+ #endif
174
+ #undef CYTHON_FAST_THREAD_STATE
175
+ #define CYTHON_FAST_THREAD_STATE 0
176
+ #undef CYTHON_FAST_PYCALL
177
+ #define CYTHON_FAST_PYCALL 0
178
+ #undef CYTHON_PEP489_MULTI_PHASE_INIT
179
+ #define CYTHON_PEP489_MULTI_PHASE_INIT 0
180
+ #undef CYTHON_USE_TP_FINALIZE
181
+ #define CYTHON_USE_TP_FINALIZE 0
182
+ #undef CYTHON_USE_DICT_VERSIONS
183
+ #define CYTHON_USE_DICT_VERSIONS 0
184
+ #undef CYTHON_USE_EXC_INFO_STACK
185
+ #define CYTHON_USE_EXC_INFO_STACK 0
186
+ #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
187
+ #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
188
+ #endif
189
+ #elif defined(PY_NOGIL)
190
+ #define CYTHON_COMPILING_IN_PYPY 0
191
+ #define CYTHON_COMPILING_IN_PYSTON 0
192
+ #define CYTHON_COMPILING_IN_CPYTHON 0
193
+ #define CYTHON_COMPILING_IN_NOGIL 1
194
+ #ifndef CYTHON_USE_TYPE_SLOTS
195
+ #define CYTHON_USE_TYPE_SLOTS 1
196
+ #endif
197
+ #undef CYTHON_USE_PYTYPE_LOOKUP
198
+ #define CYTHON_USE_PYTYPE_LOOKUP 0
199
+ #ifndef CYTHON_USE_ASYNC_SLOTS
200
+ #define CYTHON_USE_ASYNC_SLOTS 1
201
+ #endif
202
+ #undef CYTHON_USE_PYLIST_INTERNALS
203
+ #define CYTHON_USE_PYLIST_INTERNALS 0
204
+ #ifndef CYTHON_USE_UNICODE_INTERNALS
205
+ #define CYTHON_USE_UNICODE_INTERNALS 1
206
+ #endif
207
+ #undef CYTHON_USE_UNICODE_WRITER
208
+ #define CYTHON_USE_UNICODE_WRITER 0
209
+ #undef CYTHON_USE_PYLONG_INTERNALS
210
+ #define CYTHON_USE_PYLONG_INTERNALS 0
211
+ #ifndef CYTHON_AVOID_BORROWED_REFS
212
+ #define CYTHON_AVOID_BORROWED_REFS 0
213
+ #endif
214
+ #ifndef CYTHON_ASSUME_SAFE_MACROS
215
+ #define CYTHON_ASSUME_SAFE_MACROS 1
216
+ #endif
217
+ #ifndef CYTHON_UNPACK_METHODS
218
+ #define CYTHON_UNPACK_METHODS 1
219
+ #endif
220
+ #undef CYTHON_FAST_THREAD_STATE
221
+ #define CYTHON_FAST_THREAD_STATE 0
222
+ #undef CYTHON_FAST_PYCALL
223
+ #define CYTHON_FAST_PYCALL 0
224
+ #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
225
+ #define CYTHON_PEP489_MULTI_PHASE_INIT 1
226
+ #endif
227
+ #ifndef CYTHON_USE_TP_FINALIZE
228
+ #define CYTHON_USE_TP_FINALIZE 1
229
+ #endif
230
+ #undef CYTHON_USE_DICT_VERSIONS
231
+ #define CYTHON_USE_DICT_VERSIONS 0
232
+ #undef CYTHON_USE_EXC_INFO_STACK
233
+ #define CYTHON_USE_EXC_INFO_STACK 0
234
+ #else
235
+ #define CYTHON_COMPILING_IN_PYPY 0
236
+ #define CYTHON_COMPILING_IN_PYSTON 0
237
+ #define CYTHON_COMPILING_IN_CPYTHON 1
238
+ #define CYTHON_COMPILING_IN_NOGIL 0
239
+ #ifndef CYTHON_USE_TYPE_SLOTS
240
+ #define CYTHON_USE_TYPE_SLOTS 1
241
+ #endif
242
+ #if PY_VERSION_HEX < 0x02070000
243
+ #undef CYTHON_USE_PYTYPE_LOOKUP
244
+ #define CYTHON_USE_PYTYPE_LOOKUP 0
245
+ #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
246
+ #define CYTHON_USE_PYTYPE_LOOKUP 1
247
+ #endif
248
+ #if PY_MAJOR_VERSION < 3
249
+ #undef CYTHON_USE_ASYNC_SLOTS
250
+ #define CYTHON_USE_ASYNC_SLOTS 0
251
+ #elif !defined(CYTHON_USE_ASYNC_SLOTS)
252
+ #define CYTHON_USE_ASYNC_SLOTS 1
253
+ #endif
254
+ #if PY_VERSION_HEX < 0x02070000
255
+ #undef CYTHON_USE_PYLONG_INTERNALS
256
+ #define CYTHON_USE_PYLONG_INTERNALS 0
257
+ #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
258
+ #define CYTHON_USE_PYLONG_INTERNALS (PY_VERSION_HEX < 0x030C00A5)
259
+ #endif
260
+ #ifndef CYTHON_USE_PYLIST_INTERNALS
261
+ #define CYTHON_USE_PYLIST_INTERNALS 1
262
+ #endif
263
+ #ifndef CYTHON_USE_UNICODE_INTERNALS
264
+ #define CYTHON_USE_UNICODE_INTERNALS 1
265
+ #endif
266
+ #if PY_VERSION_HEX < 0x030300F0 || PY_VERSION_HEX >= 0x030B00A2
267
+ #undef CYTHON_USE_UNICODE_WRITER
268
+ #define CYTHON_USE_UNICODE_WRITER 0
269
+ #elif !defined(CYTHON_USE_UNICODE_WRITER)
270
+ #define CYTHON_USE_UNICODE_WRITER 1
271
+ #endif
272
+ #ifndef CYTHON_AVOID_BORROWED_REFS
273
+ #define CYTHON_AVOID_BORROWED_REFS 0
274
+ #endif
275
+ #ifndef CYTHON_ASSUME_SAFE_MACROS
276
+ #define CYTHON_ASSUME_SAFE_MACROS 1
277
+ #endif
278
+ #ifndef CYTHON_UNPACK_METHODS
279
+ #define CYTHON_UNPACK_METHODS 1
280
+ #endif
281
+ #if PY_VERSION_HEX >= 0x030B00A4
282
+ #undef CYTHON_FAST_THREAD_STATE
283
+ #define CYTHON_FAST_THREAD_STATE 0
284
+ #elif !defined(CYTHON_FAST_THREAD_STATE)
285
+ #define CYTHON_FAST_THREAD_STATE 1
286
+ #endif
287
+ #ifndef CYTHON_FAST_PYCALL
288
+ #define CYTHON_FAST_PYCALL (PY_VERSION_HEX < 0x030A0000)
289
+ #endif
290
+ #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
291
+ #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
292
+ #endif
293
+ #ifndef CYTHON_USE_TP_FINALIZE
294
+ #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
295
+ #endif
296
+ #ifndef CYTHON_USE_DICT_VERSIONS
297
+ #define CYTHON_USE_DICT_VERSIONS ((PY_VERSION_HEX >= 0x030600B1) && (PY_VERSION_HEX < 0x030C00A5))
298
+ #endif
299
+ #if PY_VERSION_HEX >= 0x030B00A4
300
+ #undef CYTHON_USE_EXC_INFO_STACK
301
+ #define CYTHON_USE_EXC_INFO_STACK 0
302
+ #elif !defined(CYTHON_USE_EXC_INFO_STACK)
303
+ #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
304
+ #endif
305
+ #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
306
+ #define CYTHON_UPDATE_DESCRIPTOR_DOC 1
307
+ #endif
308
+ #endif
309
+ #if !defined(CYTHON_FAST_PYCCALL)
310
+ #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
311
+ #endif
312
+ #if CYTHON_USE_PYLONG_INTERNALS
313
+ #if PY_MAJOR_VERSION < 3
314
+ #include "longintrepr.h"
315
+ #endif
316
+ #undef SHIFT
317
+ #undef BASE
318
+ #undef MASK
319
+ #ifdef SIZEOF_VOID_P
320
+ enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
321
+ #endif
322
+ #endif
323
+ #ifndef __has_attribute
324
+ #define __has_attribute(x) 0
325
+ #endif
326
+ #ifndef __has_cpp_attribute
327
+ #define __has_cpp_attribute(x) 0
328
+ #endif
329
+ #ifndef CYTHON_RESTRICT
330
+ #if defined(__GNUC__)
331
+ #define CYTHON_RESTRICT __restrict__
332
+ #elif defined(_MSC_VER) && _MSC_VER >= 1400
333
+ #define CYTHON_RESTRICT __restrict
334
+ #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
335
+ #define CYTHON_RESTRICT restrict
336
+ #else
337
+ #define CYTHON_RESTRICT
338
+ #endif
339
+ #endif
340
+ #ifndef CYTHON_UNUSED
341
+ # if defined(__GNUC__)
342
+ # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
343
+ # define CYTHON_UNUSED __attribute__ ((__unused__))
344
+ # else
345
+ # define CYTHON_UNUSED
346
+ # endif
347
+ # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
348
+ # define CYTHON_UNUSED __attribute__ ((__unused__))
349
+ # else
350
+ # define CYTHON_UNUSED
351
+ # endif
352
+ #endif
353
+ #ifndef CYTHON_MAYBE_UNUSED_VAR
354
+ # if defined(__cplusplus)
355
+ template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
356
+ # else
357
+ # define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
358
+ # endif
359
+ #endif
360
+ #ifndef CYTHON_NCP_UNUSED
361
+ # if CYTHON_COMPILING_IN_CPYTHON
362
+ # define CYTHON_NCP_UNUSED
363
+ # else
364
+ # define CYTHON_NCP_UNUSED CYTHON_UNUSED
365
+ # endif
366
+ #endif
367
+ #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
368
+ #ifdef _MSC_VER
369
+ #ifndef _MSC_STDINT_H_
370
+ #if _MSC_VER < 1300
371
+ typedef unsigned char uint8_t;
372
+ typedef unsigned int uint32_t;
373
+ #else
374
+ typedef unsigned __int8 uint8_t;
375
+ typedef unsigned __int32 uint32_t;
376
+ #endif
377
+ #endif
378
+ #else
379
+ #include <stdint.h>
380
+ #endif
381
+ #ifndef CYTHON_FALLTHROUGH
382
+ #if defined(__cplusplus) && __cplusplus >= 201103L
383
+ #if __has_cpp_attribute(fallthrough)
384
+ #define CYTHON_FALLTHROUGH [[fallthrough]]
385
+ #elif __has_cpp_attribute(clang::fallthrough)
386
+ #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
387
+ #elif __has_cpp_attribute(gnu::fallthrough)
388
+ #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
389
+ #endif
390
+ #endif
391
+ #ifndef CYTHON_FALLTHROUGH
392
+ #if __has_attribute(fallthrough)
393
+ #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
394
+ #else
395
+ #define CYTHON_FALLTHROUGH
396
+ #endif
397
+ #endif
398
+ #if defined(__clang__ ) && defined(__apple_build_version__)
399
+ #if __apple_build_version__ < 7000000
400
+ #undef CYTHON_FALLTHROUGH
401
+ #define CYTHON_FALLTHROUGH
402
+ #endif
403
+ #endif
404
+ #endif
405
+
406
+ #ifndef CYTHON_INLINE
407
+ #if defined(__clang__)
408
+ #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
409
+ #elif defined(__GNUC__)
410
+ #define CYTHON_INLINE __inline__
411
+ #elif defined(_MSC_VER)
412
+ #define CYTHON_INLINE __inline
413
+ #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
414
+ #define CYTHON_INLINE inline
415
+ #else
416
+ #define CYTHON_INLINE
417
+ #endif
418
+ #endif
419
+
420
+ #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
421
+ #define Py_OptimizeFlag 0
422
+ #endif
423
+ #define __PYX_BUILD_PY_SSIZE_T "n"
424
+ #define CYTHON_FORMAT_SSIZE_T "z"
425
+ #if PY_MAJOR_VERSION < 3
426
+ #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
427
+ #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
428
+ PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
429
+ #define __Pyx_DefaultClassType PyClass_Type
430
+ #else
431
+ #define __Pyx_BUILTIN_MODULE_NAME "builtins"
432
+ #define __Pyx_DefaultClassType PyType_Type
433
+ #if PY_VERSION_HEX >= 0x030B00A1
434
+ static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int k, int l, int s, int f,
435
+ PyObject *code, PyObject *c, PyObject* n, PyObject *v,
436
+ PyObject *fv, PyObject *cell, PyObject* fn,
437
+ PyObject *name, int fline, PyObject *lnos) {
438
+ PyObject *kwds=NULL, *argcount=NULL, *posonlyargcount=NULL, *kwonlyargcount=NULL;
439
+ PyObject *nlocals=NULL, *stacksize=NULL, *flags=NULL, *replace=NULL, *call_result=NULL, *empty=NULL;
440
+ const char *fn_cstr=NULL;
441
+ const char *name_cstr=NULL;
442
+ PyCodeObject* co=NULL;
443
+ PyObject *type, *value, *traceback;
444
+ PyErr_Fetch(&type, &value, &traceback);
445
+ if (!(kwds=PyDict_New())) goto end;
446
+ if (!(argcount=PyLong_FromLong(a))) goto end;
447
+ if (PyDict_SetItemString(kwds, "co_argcount", argcount) != 0) goto end;
448
+ if (!(posonlyargcount=PyLong_FromLong(0))) goto end;
449
+ if (PyDict_SetItemString(kwds, "co_posonlyargcount", posonlyargcount) != 0) goto end;
450
+ if (!(kwonlyargcount=PyLong_FromLong(k))) goto end;
451
+ if (PyDict_SetItemString(kwds, "co_kwonlyargcount", kwonlyargcount) != 0) goto end;
452
+ if (!(nlocals=PyLong_FromLong(l))) goto end;
453
+ if (PyDict_SetItemString(kwds, "co_nlocals", nlocals) != 0) goto end;
454
+ if (!(stacksize=PyLong_FromLong(s))) goto end;
455
+ if (PyDict_SetItemString(kwds, "co_stacksize", stacksize) != 0) goto end;
456
+ if (!(flags=PyLong_FromLong(f))) goto end;
457
+ if (PyDict_SetItemString(kwds, "co_flags", flags) != 0) goto end;
458
+ if (PyDict_SetItemString(kwds, "co_code", code) != 0) goto end;
459
+ if (PyDict_SetItemString(kwds, "co_consts", c) != 0) goto end;
460
+ if (PyDict_SetItemString(kwds, "co_names", n) != 0) goto end;
461
+ if (PyDict_SetItemString(kwds, "co_varnames", v) != 0) goto end;
462
+ if (PyDict_SetItemString(kwds, "co_freevars", fv) != 0) goto end;
463
+ if (PyDict_SetItemString(kwds, "co_cellvars", cell) != 0) goto end;
464
+ if (PyDict_SetItemString(kwds, "co_linetable", lnos) != 0) goto end;
465
+ if (!(fn_cstr=PyUnicode_AsUTF8AndSize(fn, NULL))) goto end;
466
+ if (!(name_cstr=PyUnicode_AsUTF8AndSize(name, NULL))) goto end;
467
+ if (!(co = PyCode_NewEmpty(fn_cstr, name_cstr, fline))) goto end;
468
+ if (!(replace = PyObject_GetAttrString((PyObject*)co, "replace"))) goto cleanup_code_too;
469
+ if (!(empty = PyTuple_New(0))) goto cleanup_code_too; // unfortunately __pyx_empty_tuple isn't available here
470
+ if (!(call_result = PyObject_Call(replace, empty, kwds))) goto cleanup_code_too;
471
+ Py_XDECREF((PyObject*)co);
472
+ co = (PyCodeObject*)call_result;
473
+ call_result = NULL;
474
+ if (0) {
475
+ cleanup_code_too:
476
+ Py_XDECREF((PyObject*)co);
477
+ co = NULL;
478
+ }
479
+ end:
480
+ Py_XDECREF(kwds);
481
+ Py_XDECREF(argcount);
482
+ Py_XDECREF(posonlyargcount);
483
+ Py_XDECREF(kwonlyargcount);
484
+ Py_XDECREF(nlocals);
485
+ Py_XDECREF(stacksize);
486
+ Py_XDECREF(replace);
487
+ Py_XDECREF(call_result);
488
+ Py_XDECREF(empty);
489
+ if (type) {
490
+ PyErr_Restore(type, value, traceback);
491
+ }
492
+ return co;
493
+ }
494
+ #else
495
+ #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
496
+ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
497
+ #endif
498
+ #define __Pyx_DefaultClassType PyType_Type
499
+ #endif
500
+ #ifndef Py_TPFLAGS_CHECKTYPES
501
+ #define Py_TPFLAGS_CHECKTYPES 0
502
+ #endif
503
+ #ifndef Py_TPFLAGS_HAVE_INDEX
504
+ #define Py_TPFLAGS_HAVE_INDEX 0
505
+ #endif
506
+ #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
507
+ #define Py_TPFLAGS_HAVE_NEWBUFFER 0
508
+ #endif
509
+ #ifndef Py_TPFLAGS_HAVE_FINALIZE
510
+ #define Py_TPFLAGS_HAVE_FINALIZE 0
511
+ #endif
512
+ #ifndef METH_STACKLESS
513
+ #define METH_STACKLESS 0
514
+ #endif
515
+ #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
516
+ #ifndef METH_FASTCALL
517
+ #define METH_FASTCALL 0x80
518
+ #endif
519
+ typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
520
+ typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
521
+ Py_ssize_t nargs, PyObject *kwnames);
522
+ #else
523
+ #define __Pyx_PyCFunctionFast _PyCFunctionFast
524
+ #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
525
+ #endif
526
+ #if CYTHON_FAST_PYCCALL
527
+ #define __Pyx_PyFastCFunction_Check(func)\
528
+ ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
529
+ #else
530
+ #define __Pyx_PyFastCFunction_Check(func) 0
531
+ #endif
532
+ #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
533
+ #define PyObject_Malloc(s) PyMem_Malloc(s)
534
+ #define PyObject_Free(p) PyMem_Free(p)
535
+ #define PyObject_Realloc(p) PyMem_Realloc(p)
536
+ #endif
537
+ #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
538
+ #define PyMem_RawMalloc(n) PyMem_Malloc(n)
539
+ #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n)
540
+ #define PyMem_RawFree(p) PyMem_Free(p)
541
+ #endif
542
+ #if CYTHON_COMPILING_IN_PYSTON
543
+ #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co)
544
+ #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
545
+ #else
546
+ #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
547
+ #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
548
+ #endif
549
+ #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
550
+ #define __Pyx_PyThreadState_Current PyThreadState_GET()
551
+ #elif PY_VERSION_HEX >= 0x03060000
552
+ #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
553
+ #elif PY_VERSION_HEX >= 0x03000000
554
+ #define __Pyx_PyThreadState_Current PyThreadState_GET()
555
+ #else
556
+ #define __Pyx_PyThreadState_Current _PyThreadState_Current
557
+ #endif
558
+ #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
559
+ #include "pythread.h"
560
+ #define Py_tss_NEEDS_INIT 0
561
+ typedef int Py_tss_t;
562
+ static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
563
+ *key = PyThread_create_key();
564
+ return 0;
565
+ }
566
+ static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
567
+ Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
568
+ *key = Py_tss_NEEDS_INIT;
569
+ return key;
570
+ }
571
+ static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
572
+ PyObject_Free(key);
573
+ }
574
+ static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
575
+ return *key != Py_tss_NEEDS_INIT;
576
+ }
577
+ static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
578
+ PyThread_delete_key(*key);
579
+ *key = Py_tss_NEEDS_INIT;
580
+ }
581
+ static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
582
+ return PyThread_set_key_value(*key, value);
583
+ }
584
+ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
585
+ return PyThread_get_key_value(*key);
586
+ }
587
+ #endif
588
+ #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
589
+ #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
590
+ #else
591
+ #define __Pyx_PyDict_NewPresized(n) PyDict_New()
592
+ #endif
593
+ #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
594
+ #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
595
+ #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
596
+ #else
597
+ #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
598
+ #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
599
+ #endif
600
+ #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
601
+ #define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
602
+ #else
603
+ #define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name)
604
+ #endif
605
+ #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
606
+ #define CYTHON_PEP393_ENABLED 1
607
+ #if PY_VERSION_HEX >= 0x030C0000
608
+ #define __Pyx_PyUnicode_READY(op) (0)
609
+ #else
610
+ #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
611
+ 0 : _PyUnicode_Ready((PyObject *)(op)))
612
+ #endif
613
+ #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
614
+ #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
615
+ #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
616
+ #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
617
+ #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
618
+ #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
619
+ #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch)
620
+ #if PY_VERSION_HEX >= 0x030C0000
621
+ #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u))
622
+ #else
623
+ #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000
624
+ #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length))
625
+ #else
626
+ #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
627
+ #endif
628
+ #endif
629
+ #else
630
+ #define CYTHON_PEP393_ENABLED 0
631
+ #define PyUnicode_1BYTE_KIND 1
632
+ #define PyUnicode_2BYTE_KIND 2
633
+ #define PyUnicode_4BYTE_KIND 4
634
+ #define __Pyx_PyUnicode_READY(op) (0)
635
+ #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
636
+ #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
637
+ #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
638
+ #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
639
+ #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
640
+ #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
641
+ #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
642
+ #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
643
+ #endif
644
+ #if CYTHON_COMPILING_IN_PYPY
645
+ #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
646
+ #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
647
+ #else
648
+ #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
649
+ #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
650
+ PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
651
+ #endif
652
+ #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
653
+ #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
654
+ #endif
655
+ #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
656
+ #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
657
+ #endif
658
+ #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
659
+ #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
660
+ #endif
661
+ #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))
662
+ #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
663
+ #if PY_MAJOR_VERSION >= 3
664
+ #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
665
+ #else
666
+ #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
667
+ #endif
668
+ #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
669
+ #define PyObject_ASCII(o) PyObject_Repr(o)
670
+ #endif
671
+ #if PY_MAJOR_VERSION >= 3
672
+ #define PyBaseString_Type PyUnicode_Type
673
+ #define PyStringObject PyUnicodeObject
674
+ #define PyString_Type PyUnicode_Type
675
+ #define PyString_Check PyUnicode_Check
676
+ #define PyString_CheckExact PyUnicode_CheckExact
677
+ #ifndef PyObject_Unicode
678
+ #define PyObject_Unicode PyObject_Str
679
+ #endif
680
+ #endif
681
+ #if PY_MAJOR_VERSION >= 3
682
+ #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
683
+ #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
684
+ #else
685
+ #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
686
+ #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
687
+ #endif
688
+ #ifndef PySet_CheckExact
689
+ #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
690
+ #endif
691
+ #if PY_VERSION_HEX >= 0x030900A4
692
+ #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
693
+ #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
694
+ #else
695
+ #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
696
+ #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
697
+ #endif
698
+ #if CYTHON_ASSUME_SAFE_MACROS
699
+ #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
700
+ #else
701
+ #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
702
+ #endif
703
+ #if PY_MAJOR_VERSION >= 3
704
+ #define PyIntObject PyLongObject
705
+ #define PyInt_Type PyLong_Type
706
+ #define PyInt_Check(op) PyLong_Check(op)
707
+ #define PyInt_CheckExact(op) PyLong_CheckExact(op)
708
+ #define PyInt_FromString PyLong_FromString
709
+ #define PyInt_FromUnicode PyLong_FromUnicode
710
+ #define PyInt_FromLong PyLong_FromLong
711
+ #define PyInt_FromSize_t PyLong_FromSize_t
712
+ #define PyInt_FromSsize_t PyLong_FromSsize_t
713
+ #define PyInt_AsLong PyLong_AsLong
714
+ #define PyInt_AS_LONG PyLong_AS_LONG
715
+ #define PyInt_AsSsize_t PyLong_AsSsize_t
716
+ #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
717
+ #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
718
+ #define PyNumber_Int PyNumber_Long
719
+ #endif
720
+ #if PY_MAJOR_VERSION >= 3
721
+ #define PyBoolObject PyLongObject
722
+ #endif
723
+ #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
724
+ #ifndef PyUnicode_InternFromString
725
+ #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
726
+ #endif
727
+ #endif
728
+ #if PY_VERSION_HEX < 0x030200A4
729
+ typedef long Py_hash_t;
730
+ #define __Pyx_PyInt_FromHash_t PyInt_FromLong
731
+ #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsHash_t
732
+ #else
733
+ #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
734
+ #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t
735
+ #endif
736
+ #if PY_MAJOR_VERSION >= 3
737
+ #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func))
738
+ #else
739
+ #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
740
+ #endif
741
+ #if CYTHON_USE_ASYNC_SLOTS
742
+ #if PY_VERSION_HEX >= 0x030500B1
743
+ #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
744
+ #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
745
+ #else
746
+ #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
747
+ #endif
748
+ #else
749
+ #define __Pyx_PyType_AsAsync(obj) NULL
750
+ #endif
751
+ #ifndef __Pyx_PyAsyncMethodsStruct
752
+ typedef struct {
753
+ unaryfunc am_await;
754
+ unaryfunc am_aiter;
755
+ unaryfunc am_anext;
756
+ } __Pyx_PyAsyncMethodsStruct;
757
+ #endif
758
+
759
+ #if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)
760
+ #if !defined(_USE_MATH_DEFINES)
761
+ #define _USE_MATH_DEFINES
762
+ #endif
763
+ #endif
764
+ #include <math.h>
765
+ #ifdef NAN
766
+ #define __PYX_NAN() ((float) NAN)
767
+ #else
768
+ static CYTHON_INLINE float __PYX_NAN() {
769
+ float value;
770
+ memset(&value, 0xFF, sizeof(value));
771
+ return value;
772
+ }
773
+ #endif
774
+ #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
775
+ #define __Pyx_truncl trunc
776
+ #else
777
+ #define __Pyx_truncl truncl
778
+ #endif
779
+
780
+ #define __PYX_MARK_ERR_POS(f_index, lineno) \
781
+ { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
782
+ #define __PYX_ERR(f_index, lineno, Ln_error) \
783
+ { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }
784
+
785
+ #ifndef __PYX_EXTERN_C
786
+ #ifdef __cplusplus
787
+ #define __PYX_EXTERN_C extern "C"
788
+ #else
789
+ #define __PYX_EXTERN_C extern
790
+ #endif
791
+ #endif
792
+
793
+ #define __PYX_HAVE__manimpango__utils___utils
794
+ #define __PYX_HAVE_API__manimpango__utils___utils
795
+ /* Early includes */
796
+ #include "cairo.h"
797
+ #include "cairo-svg.h"
798
+ #include "glib.h"
799
+ #include "pango/pango.h"
800
+ #include "pango/pangocairo.h"
801
+
802
+ #if PANGO_VERSION_CHECK(1,44,0)
803
+ int set_line_width(PangoLayout *layout,float spacing)
804
+ {
805
+ pango_layout_set_line_spacing(layout, spacing);
806
+ return 1;
807
+ }
808
+ #else
809
+ int set_line_width(PangoLayout *layout,float spacing){return 0;}
810
+ #endif
811
+
812
+ #ifdef _OPENMP
813
+ #include <omp.h>
814
+ #endif /* _OPENMP */
815
+
816
+ #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
817
+ #define CYTHON_WITHOUT_ASSERTIONS
818
+ #endif
819
+
820
+ typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
821
+ const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
822
+
823
+ #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
824
+ #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
825
+ #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
826
+ #define __PYX_DEFAULT_STRING_ENCODING ""
827
+ #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
828
+ #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
829
+ #define __Pyx_uchar_cast(c) ((unsigned char)c)
830
+ #define __Pyx_long_cast(x) ((long)x)
831
+ #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
832
+ (sizeof(type) < sizeof(Py_ssize_t)) ||\
833
+ (sizeof(type) > sizeof(Py_ssize_t) &&\
834
+ likely(v < (type)PY_SSIZE_T_MAX ||\
835
+ v == (type)PY_SSIZE_T_MAX) &&\
836
+ (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
837
+ v == (type)PY_SSIZE_T_MIN))) ||\
838
+ (sizeof(type) == sizeof(Py_ssize_t) &&\
839
+ (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
840
+ v == (type)PY_SSIZE_T_MAX))) )
841
+ static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
842
+ return (size_t) i < (size_t) limit;
843
+ }
844
+ #if defined (__cplusplus) && __cplusplus >= 201103L
845
+ #include <cstdlib>
846
+ #define __Pyx_sst_abs(value) std::abs(value)
847
+ #elif SIZEOF_INT >= SIZEOF_SIZE_T
848
+ #define __Pyx_sst_abs(value) abs(value)
849
+ #elif SIZEOF_LONG >= SIZEOF_SIZE_T
850
+ #define __Pyx_sst_abs(value) labs(value)
851
+ #elif defined (_MSC_VER)
852
+ #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
853
+ #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
854
+ #define __Pyx_sst_abs(value) llabs(value)
855
+ #elif defined (__GNUC__)
856
+ #define __Pyx_sst_abs(value) __builtin_llabs(value)
857
+ #else
858
+ #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
859
+ #endif
860
+ static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
861
+ static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
862
+ #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
863
+ #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
864
+ #define __Pyx_PyBytes_FromString PyBytes_FromString
865
+ #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
866
+ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
867
+ #if PY_MAJOR_VERSION < 3
868
+ #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
869
+ #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
870
+ #else
871
+ #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
872
+ #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
873
+ #endif
874
+ #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
875
+ #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
876
+ #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
877
+ #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
878
+ #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
879
+ #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
880
+ #define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s))
881
+ #define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
882
+ #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
883
+ #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
884
+ #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
885
+ #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
886
+ #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
887
+ #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
888
+ #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
889
+ #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
890
+ static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
891
+ const Py_UNICODE *u_end = u;
892
+ while (*u_end++) ;
893
+ return (size_t)(u_end - u - 1);
894
+ }
895
+ #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
896
+ #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
897
+ #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
898
+ #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
899
+ #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
900
+ static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
901
+ static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
902
+ static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
903
+ static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
904
+ #define __Pyx_PySequence_Tuple(obj)\
905
+ (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
906
+ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
907
+ static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
908
+ static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*);
909
+ #if CYTHON_ASSUME_SAFE_MACROS
910
+ #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
911
+ #else
912
+ #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
913
+ #endif
914
+ #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
915
+ #if PY_MAJOR_VERSION >= 3
916
+ #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
917
+ #else
918
+ #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
919
+ #endif
920
+ #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
921
+ #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
922
+ static int __Pyx_sys_getdefaultencoding_not_ascii;
923
+ static int __Pyx_init_sys_getdefaultencoding_params(void) {
924
+ PyObject* sys;
925
+ PyObject* default_encoding = NULL;
926
+ PyObject* ascii_chars_u = NULL;
927
+ PyObject* ascii_chars_b = NULL;
928
+ const char* default_encoding_c;
929
+ sys = PyImport_ImportModule("sys");
930
+ if (!sys) goto bad;
931
+ default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
932
+ Py_DECREF(sys);
933
+ if (!default_encoding) goto bad;
934
+ default_encoding_c = PyBytes_AsString(default_encoding);
935
+ if (!default_encoding_c) goto bad;
936
+ if (strcmp(default_encoding_c, "ascii") == 0) {
937
+ __Pyx_sys_getdefaultencoding_not_ascii = 0;
938
+ } else {
939
+ char ascii_chars[128];
940
+ int c;
941
+ for (c = 0; c < 128; c++) {
942
+ ascii_chars[c] = c;
943
+ }
944
+ __Pyx_sys_getdefaultencoding_not_ascii = 1;
945
+ ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
946
+ if (!ascii_chars_u) goto bad;
947
+ ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
948
+ if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
949
+ PyErr_Format(
950
+ PyExc_ValueError,
951
+ "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
952
+ default_encoding_c);
953
+ goto bad;
954
+ }
955
+ Py_DECREF(ascii_chars_u);
956
+ Py_DECREF(ascii_chars_b);
957
+ }
958
+ Py_DECREF(default_encoding);
959
+ return 0;
960
+ bad:
961
+ Py_XDECREF(default_encoding);
962
+ Py_XDECREF(ascii_chars_u);
963
+ Py_XDECREF(ascii_chars_b);
964
+ return -1;
965
+ }
966
+ #endif
967
+ #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
968
+ #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
969
+ #else
970
+ #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
971
+ #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
972
+ static char* __PYX_DEFAULT_STRING_ENCODING;
973
+ static int __Pyx_init_sys_getdefaultencoding_params(void) {
974
+ PyObject* sys;
975
+ PyObject* default_encoding = NULL;
976
+ char* default_encoding_c;
977
+ sys = PyImport_ImportModule("sys");
978
+ if (!sys) goto bad;
979
+ default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
980
+ Py_DECREF(sys);
981
+ if (!default_encoding) goto bad;
982
+ default_encoding_c = PyBytes_AsString(default_encoding);
983
+ if (!default_encoding_c) goto bad;
984
+ __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
985
+ if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
986
+ strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
987
+ Py_DECREF(default_encoding);
988
+ return 0;
989
+ bad:
990
+ Py_XDECREF(default_encoding);
991
+ return -1;
992
+ }
993
+ #endif
994
+ #endif
995
+
996
+
997
+ /* Test for GCC > 2.95 */
998
+ #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
999
+ #define likely(x) __builtin_expect(!!(x), 1)
1000
+ #define unlikely(x) __builtin_expect(!!(x), 0)
1001
+ #else /* !__GNUC__ or GCC < 2.95 */
1002
+ #define likely(x) (x)
1003
+ #define unlikely(x) (x)
1004
+ #endif /* __GNUC__ */
1005
+ static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
1006
+
1007
+ static PyObject *__pyx_m = NULL;
1008
+ static PyObject *__pyx_d;
1009
+ static PyObject *__pyx_b;
1010
+ static PyObject *__pyx_cython_runtime = NULL;
1011
+ static PyObject *__pyx_empty_tuple;
1012
+ static PyObject *__pyx_empty_bytes;
1013
+ static PyObject *__pyx_empty_unicode;
1014
+ static int __pyx_lineno;
1015
+ static int __pyx_clineno = 0;
1016
+ static const char * __pyx_cfilenm= __FILE__;
1017
+ static const char *__pyx_filename;
1018
+
1019
+
1020
+ static const char *__pyx_f[] = {
1021
+ "manimpango\\utils\\utils.pyx",
1022
+ };
1023
+
1024
+ /*--- Type declarations ---*/
1025
+
1026
+ /* --- Runtime support code (head) --- */
1027
+ /* Refnanny.proto */
1028
+ #ifndef CYTHON_REFNANNY
1029
+ #define CYTHON_REFNANNY 0
1030
+ #endif
1031
+ #if CYTHON_REFNANNY
1032
+ typedef struct {
1033
+ void (*INCREF)(void*, PyObject*, int);
1034
+ void (*DECREF)(void*, PyObject*, int);
1035
+ void (*GOTREF)(void*, PyObject*, int);
1036
+ void (*GIVEREF)(void*, PyObject*, int);
1037
+ void* (*SetupContext)(const char*, int, const char*);
1038
+ void (*FinishContext)(void**);
1039
+ } __Pyx_RefNannyAPIStruct;
1040
+ static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
1041
+ static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
1042
+ #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
1043
+ #ifdef WITH_THREAD
1044
+ #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1045
+ if (acquire_gil) {\
1046
+ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1047
+ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1048
+ PyGILState_Release(__pyx_gilstate_save);\
1049
+ } else {\
1050
+ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1051
+ }
1052
+ #else
1053
+ #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1054
+ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
1055
+ #endif
1056
+ #define __Pyx_RefNannyFinishContext()\
1057
+ __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
1058
+ #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1059
+ #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1060
+ #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1061
+ #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1062
+ #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
1063
+ #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
1064
+ #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
1065
+ #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
1066
+ #else
1067
+ #define __Pyx_RefNannyDeclarations
1068
+ #define __Pyx_RefNannySetupContext(name, acquire_gil)
1069
+ #define __Pyx_RefNannyFinishContext()
1070
+ #define __Pyx_INCREF(r) Py_INCREF(r)
1071
+ #define __Pyx_DECREF(r) Py_DECREF(r)
1072
+ #define __Pyx_GOTREF(r)
1073
+ #define __Pyx_GIVEREF(r)
1074
+ #define __Pyx_XINCREF(r) Py_XINCREF(r)
1075
+ #define __Pyx_XDECREF(r) Py_XDECREF(r)
1076
+ #define __Pyx_XGOTREF(r)
1077
+ #define __Pyx_XGIVEREF(r)
1078
+ #endif
1079
+ #define __Pyx_XDECREF_SET(r, v) do {\
1080
+ PyObject *tmp = (PyObject *) r;\
1081
+ r = v; __Pyx_XDECREF(tmp);\
1082
+ } while (0)
1083
+ #define __Pyx_DECREF_SET(r, v) do {\
1084
+ PyObject *tmp = (PyObject *) r;\
1085
+ r = v; __Pyx_DECREF(tmp);\
1086
+ } while (0)
1087
+ #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1088
+ #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1089
+
1090
+ /* PyObjectGetAttrStr.proto */
1091
+ #if CYTHON_USE_TYPE_SLOTS
1092
+ static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1093
+ #else
1094
+ #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1095
+ #endif
1096
+
1097
+ /* GetBuiltinName.proto */
1098
+ static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1099
+
1100
+ /* decode_c_string_utf16.proto */
1101
+ static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) {
1102
+ int byteorder = 0;
1103
+ return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
1104
+ }
1105
+ static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) {
1106
+ int byteorder = -1;
1107
+ return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
1108
+ }
1109
+ static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) {
1110
+ int byteorder = 1;
1111
+ return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
1112
+ }
1113
+
1114
+ /* decode_c_bytes.proto */
1115
+ static CYTHON_INLINE PyObject* __Pyx_decode_c_bytes(
1116
+ const char* cstring, Py_ssize_t length, Py_ssize_t start, Py_ssize_t stop,
1117
+ const char* encoding, const char* errors,
1118
+ PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors));
1119
+
1120
+ /* decode_bytes.proto */
1121
+ static CYTHON_INLINE PyObject* __Pyx_decode_bytes(
1122
+ PyObject* string, Py_ssize_t start, Py_ssize_t stop,
1123
+ const char* encoding, const char* errors,
1124
+ PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
1125
+ return __Pyx_decode_c_bytes(
1126
+ PyBytes_AS_STRING(string), PyBytes_GET_SIZE(string),
1127
+ start, stop, encoding, errors, decode_func);
1128
+ }
1129
+
1130
+ /* ArgTypeTest.proto */
1131
+ #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
1132
+ ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
1133
+ __Pyx__ArgTypeTest(obj, type, name, exact))
1134
+ static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);
1135
+
1136
+ /* PyObjectCall.proto */
1137
+ #if CYTHON_COMPILING_IN_CPYTHON
1138
+ static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1139
+ #else
1140
+ #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1141
+ #endif
1142
+
1143
+ /* PyThreadStateGet.proto */
1144
+ #if CYTHON_FAST_THREAD_STATE
1145
+ #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
1146
+ #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
1147
+ #define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type
1148
+ #else
1149
+ #define __Pyx_PyThreadState_declare
1150
+ #define __Pyx_PyThreadState_assign
1151
+ #define __Pyx_PyErr_Occurred() PyErr_Occurred()
1152
+ #endif
1153
+
1154
+ /* PyErrFetchRestore.proto */
1155
+ #if CYTHON_FAST_THREAD_STATE
1156
+ #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1157
+ #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1158
+ #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1159
+ #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1160
+ #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1161
+ static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1162
+ static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1163
+ #if CYTHON_COMPILING_IN_CPYTHON
1164
+ #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1165
+ #else
1166
+ #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1167
+ #endif
1168
+ #else
1169
+ #define __Pyx_PyErr_Clear() PyErr_Clear()
1170
+ #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1171
+ #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
1172
+ #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
1173
+ #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
1174
+ #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
1175
+ #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
1176
+ #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
1177
+ #endif
1178
+
1179
+ /* RaiseException.proto */
1180
+ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1181
+
1182
+ /* PyDictVersioning.proto */
1183
+ #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1184
+ #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
1185
+ #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
1186
+ #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1187
+ (version_var) = __PYX_GET_DICT_VERSION(dict);\
1188
+ (cache_var) = (value);
1189
+ #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1190
+ static PY_UINT64_T __pyx_dict_version = 0;\
1191
+ static PyObject *__pyx_dict_cached_value = NULL;\
1192
+ if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1193
+ (VAR) = __pyx_dict_cached_value;\
1194
+ } else {\
1195
+ (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1196
+ __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1197
+ }\
1198
+ }
1199
+ static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1200
+ static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1201
+ static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1202
+ #else
1203
+ #define __PYX_GET_DICT_VERSION(dict) (0)
1204
+ #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1205
+ #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
1206
+ #endif
1207
+
1208
+ /* CLineInTraceback.proto */
1209
+ #ifdef CYTHON_CLINE_IN_TRACEBACK
1210
+ #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1211
+ #else
1212
+ static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
1213
+ #endif
1214
+
1215
+ /* CodeObjectCache.proto */
1216
+ typedef struct {
1217
+ PyCodeObject* code_object;
1218
+ int code_line;
1219
+ } __Pyx_CodeObjectCacheEntry;
1220
+ struct __Pyx_CodeObjectCache {
1221
+ int count;
1222
+ int max_count;
1223
+ __Pyx_CodeObjectCacheEntry* entries;
1224
+ };
1225
+ static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
1226
+ static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
1227
+ static PyCodeObject *__pyx_find_code_object(int code_line);
1228
+ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
1229
+
1230
+ /* AddTraceback.proto */
1231
+ static void __Pyx_AddTraceback(const char *funcname, int c_line,
1232
+ int py_line, const char *filename);
1233
+
1234
+ /* GCCDiagnostics.proto */
1235
+ #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
1236
+ #define __Pyx_HAS_GCC_DIAGNOSTIC
1237
+ #endif
1238
+
1239
+ /* CIntToPy.proto */
1240
+ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_guint16(guint16 value);
1241
+
1242
+ /* CIntToPy.proto */
1243
+ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
1244
+
1245
+ /* CIntFromPy.proto */
1246
+ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
1247
+
1248
+ /* CIntFromPy.proto */
1249
+ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
1250
+
1251
+ /* FastTypeChecks.proto */
1252
+ #if CYTHON_COMPILING_IN_CPYTHON
1253
+ #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1254
+ static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1255
+ static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1256
+ static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1257
+ #else
1258
+ #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1259
+ #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1260
+ #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
1261
+ #endif
1262
+ #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1263
+
1264
+ /* CheckBinaryVersion.proto */
1265
+ static int __Pyx_check_binary_version(void);
1266
+
1267
+ /* InitStrings.proto */
1268
+ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
1269
+
1270
+
1271
+ /* Module declarations from 'cairo' */
1272
+
1273
+ /* Module declarations from 'glib' */
1274
+
1275
+ /* Module declarations from 'pango_attributes' */
1276
+
1277
+ /* Module declarations from 'pango' */
1278
+
1279
+ /* Module declarations from 'manimpango.utils._utils' */
1280
+ static PyObject *__pyx_f_10manimpango_5utils_6_utils_validate_markup(PyObject *, int __pyx_skip_dispatch); /*proto*/
1281
+ #define __Pyx_MODULE_NAME "manimpango.utils._utils"
1282
+ extern int __pyx_module_is_main_manimpango__utils___utils;
1283
+ int __pyx_module_is_main_manimpango__utils___utils = 0;
1284
+
1285
+ /* Implementation of 'manimpango.utils._utils' */
1286
+ static PyObject *__pyx_builtin_ValueError;
1287
+ static const char __pyx_k_[] = "";
1288
+ static const char __pyx_k_main[] = "__main__";
1289
+ static const char __pyx_k_name[] = "__name__";
1290
+ static const char __pyx_k_test[] = "__test__";
1291
+ static const char __pyx_k_color[] = "color";
1292
+ static const char __pyx_k_color_hex[] = "color_hex";
1293
+ static const char __pyx_k_ValueError[] = "ValueError";
1294
+ static const char __pyx_k_covert_hex_to_rbg[] = "covert_hex_to_rbg";
1295
+ static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
1296
+ static const char __pyx_k_Invalid_color_specfied[] = "Invalid color specfied.";
1297
+ static const char __pyx_k_manimpango_utils__utils[] = "manimpango.utils._utils";
1298
+ static const char __pyx_k_manimpango_utils_utils_pyx[] = "manimpango\\utils\\utils.pyx";
1299
+ static PyObject *__pyx_kp_u_;
1300
+ static PyObject *__pyx_kp_u_Invalid_color_specfied;
1301
+ static PyObject *__pyx_n_s_ValueError;
1302
+ static PyObject *__pyx_n_s_cline_in_traceback;
1303
+ static PyObject *__pyx_n_s_color;
1304
+ static PyObject *__pyx_n_s_color_hex;
1305
+ static PyObject *__pyx_n_s_covert_hex_to_rbg;
1306
+ static PyObject *__pyx_n_s_main;
1307
+ static PyObject *__pyx_n_s_manimpango_utils__utils;
1308
+ static PyObject *__pyx_kp_s_manimpango_utils_utils_pyx;
1309
+ static PyObject *__pyx_n_s_name;
1310
+ static PyObject *__pyx_n_s_test;
1311
+ static PyObject *__pyx_pf_10manimpango_5utils_6_utils_validate_markup(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_text); /* proto */
1312
+ static PyObject *__pyx_pf_10manimpango_5utils_6_utils_2covert_hex_to_rbg(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_color_hex); /* proto */
1313
+ static PyObject *__pyx_tuple__2;
1314
+ static PyObject *__pyx_tuple__3;
1315
+ static PyObject *__pyx_codeobj__4;
1316
+ /* Late includes */
1317
+
1318
+ /* "manimpango/utils/utils.pyx":4
1319
+ *
1320
+ *
1321
+ * cpdef str validate_markup(str text): # <<<<<<<<<<<<<<
1322
+ * cdef GError *err = NULL
1323
+ * text_bytes = text.encode("utf-8")
1324
+ */
1325
+
1326
+ static PyObject *__pyx_pw_10manimpango_5utils_6_utils_1validate_markup(PyObject *__pyx_self, PyObject *__pyx_v_text); /*proto*/
1327
+ static PyObject *__pyx_f_10manimpango_5utils_6_utils_validate_markup(PyObject *__pyx_v_text, CYTHON_UNUSED int __pyx_skip_dispatch) {
1328
+ GError *__pyx_v_err;
1329
+ PyObject *__pyx_v_text_bytes = NULL;
1330
+ gboolean __pyx_v_res;
1331
+ PyObject *__pyx_v_message = NULL;
1332
+ PyObject *__pyx_r = NULL;
1333
+ __Pyx_RefNannyDeclarations
1334
+ PyObject *__pyx_t_1 = NULL;
1335
+ char const *__pyx_t_2;
1336
+ int __pyx_t_3;
1337
+ PyObject *__pyx_t_4 = NULL;
1338
+ int __pyx_lineno = 0;
1339
+ const char *__pyx_filename = NULL;
1340
+ int __pyx_clineno = 0;
1341
+ __Pyx_RefNannySetupContext("validate_markup", 0);
1342
+
1343
+ /* "manimpango/utils/utils.pyx":5
1344
+ *
1345
+ * cpdef str validate_markup(str text):
1346
+ * cdef GError *err = NULL # <<<<<<<<<<<<<<
1347
+ * text_bytes = text.encode("utf-8")
1348
+ * res = pango_parse_markup(
1349
+ */
1350
+ __pyx_v_err = NULL;
1351
+
1352
+ /* "manimpango/utils/utils.pyx":6
1353
+ * cpdef str validate_markup(str text):
1354
+ * cdef GError *err = NULL
1355
+ * text_bytes = text.encode("utf-8") # <<<<<<<<<<<<<<
1356
+ * res = pango_parse_markup(
1357
+ * text_bytes,
1358
+ */
1359
+ if (unlikely(__pyx_v_text == Py_None)) {
1360
+ PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode");
1361
+ __PYX_ERR(0, 6, __pyx_L1_error)
1362
+ }
1363
+ __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_text); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error)
1364
+ __Pyx_GOTREF(__pyx_t_1);
1365
+ __pyx_v_text_bytes = __pyx_t_1;
1366
+ __pyx_t_1 = 0;
1367
+
1368
+ /* "manimpango/utils/utils.pyx":8
1369
+ * text_bytes = text.encode("utf-8")
1370
+ * res = pango_parse_markup(
1371
+ * text_bytes, # <<<<<<<<<<<<<<
1372
+ * -1,
1373
+ * 0,
1374
+ */
1375
+ __pyx_t_2 = __Pyx_PyObject_AsString(__pyx_v_text_bytes); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 8, __pyx_L1_error)
1376
+
1377
+ /* "manimpango/utils/utils.pyx":7
1378
+ * cdef GError *err = NULL
1379
+ * text_bytes = text.encode("utf-8")
1380
+ * res = pango_parse_markup( # <<<<<<<<<<<<<<
1381
+ * text_bytes,
1382
+ * -1,
1383
+ */
1384
+ __pyx_v_res = pango_parse_markup(__pyx_t_2, -1, 0, NULL, NULL, NULL, (&__pyx_v_err));
1385
+
1386
+ /* "manimpango/utils/utils.pyx":16
1387
+ * &err
1388
+ * )
1389
+ * if res: # <<<<<<<<<<<<<<
1390
+ * return ""
1391
+ * else:
1392
+ */
1393
+ __pyx_t_3 = (__pyx_v_res != 0);
1394
+ if (__pyx_t_3) {
1395
+
1396
+ /* "manimpango/utils/utils.pyx":17
1397
+ * )
1398
+ * if res:
1399
+ * return "" # <<<<<<<<<<<<<<
1400
+ * else:
1401
+ * message = <bytes>err.message
1402
+ */
1403
+ __Pyx_XDECREF(__pyx_r);
1404
+ __Pyx_INCREF(__pyx_kp_u_);
1405
+ __pyx_r = __pyx_kp_u_;
1406
+ goto __pyx_L0;
1407
+
1408
+ /* "manimpango/utils/utils.pyx":16
1409
+ * &err
1410
+ * )
1411
+ * if res: # <<<<<<<<<<<<<<
1412
+ * return ""
1413
+ * else:
1414
+ */
1415
+ }
1416
+
1417
+ /* "manimpango/utils/utils.pyx":19
1418
+ * return ""
1419
+ * else:
1420
+ * message = <bytes>err.message # <<<<<<<<<<<<<<
1421
+ * g_error_free(err)
1422
+ * return message.decode('utf-8')
1423
+ */
1424
+ /*else*/ {
1425
+ __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_err->message); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error)
1426
+ __Pyx_GOTREF(__pyx_t_1);
1427
+ __pyx_t_4 = __pyx_t_1;
1428
+ __Pyx_INCREF(__pyx_t_4);
1429
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1430
+ __pyx_v_message = ((PyObject*)__pyx_t_4);
1431
+ __pyx_t_4 = 0;
1432
+
1433
+ /* "manimpango/utils/utils.pyx":20
1434
+ * else:
1435
+ * message = <bytes>err.message
1436
+ * g_error_free(err) # <<<<<<<<<<<<<<
1437
+ * return message.decode('utf-8')
1438
+ *
1439
+ */
1440
+ g_error_free(__pyx_v_err);
1441
+
1442
+ /* "manimpango/utils/utils.pyx":21
1443
+ * message = <bytes>err.message
1444
+ * g_error_free(err)
1445
+ * return message.decode('utf-8') # <<<<<<<<<<<<<<
1446
+ *
1447
+ * def covert_hex_to_rbg(color_hex: str):
1448
+ */
1449
+ __Pyx_XDECREF(__pyx_r);
1450
+ if (unlikely(__pyx_v_message == Py_None)) {
1451
+ PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "decode");
1452
+ __PYX_ERR(0, 21, __pyx_L1_error)
1453
+ }
1454
+ __pyx_t_4 = __Pyx_decode_bytes(__pyx_v_message, 0, PY_SSIZE_T_MAX, NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 21, __pyx_L1_error)
1455
+ __Pyx_GOTREF(__pyx_t_4);
1456
+ __pyx_r = ((PyObject*)__pyx_t_4);
1457
+ __pyx_t_4 = 0;
1458
+ goto __pyx_L0;
1459
+ }
1460
+
1461
+ /* "manimpango/utils/utils.pyx":4
1462
+ *
1463
+ *
1464
+ * cpdef str validate_markup(str text): # <<<<<<<<<<<<<<
1465
+ * cdef GError *err = NULL
1466
+ * text_bytes = text.encode("utf-8")
1467
+ */
1468
+
1469
+ /* function exit code */
1470
+ __pyx_L1_error:;
1471
+ __Pyx_XDECREF(__pyx_t_1);
1472
+ __Pyx_XDECREF(__pyx_t_4);
1473
+ __Pyx_AddTraceback("manimpango.utils._utils.validate_markup", __pyx_clineno, __pyx_lineno, __pyx_filename);
1474
+ __pyx_r = 0;
1475
+ __pyx_L0:;
1476
+ __Pyx_XDECREF(__pyx_v_text_bytes);
1477
+ __Pyx_XDECREF(__pyx_v_message);
1478
+ __Pyx_XGIVEREF(__pyx_r);
1479
+ __Pyx_RefNannyFinishContext();
1480
+ return __pyx_r;
1481
+ }
1482
+
1483
+ /* Python wrapper */
1484
+ static PyObject *__pyx_pw_10manimpango_5utils_6_utils_1validate_markup(PyObject *__pyx_self, PyObject *__pyx_v_text); /*proto*/
1485
+ static PyObject *__pyx_pw_10manimpango_5utils_6_utils_1validate_markup(PyObject *__pyx_self, PyObject *__pyx_v_text) {
1486
+ int __pyx_lineno = 0;
1487
+ const char *__pyx_filename = NULL;
1488
+ int __pyx_clineno = 0;
1489
+ PyObject *__pyx_r = 0;
1490
+ __Pyx_RefNannyDeclarations
1491
+ __Pyx_RefNannySetupContext("validate_markup (wrapper)", 0);
1492
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_text), (&PyUnicode_Type), 1, "text", 1))) __PYX_ERR(0, 4, __pyx_L1_error)
1493
+ __pyx_r = __pyx_pf_10manimpango_5utils_6_utils_validate_markup(__pyx_self, ((PyObject*)__pyx_v_text));
1494
+
1495
+ /* function exit code */
1496
+ goto __pyx_L0;
1497
+ __pyx_L1_error:;
1498
+ __pyx_r = NULL;
1499
+ __pyx_L0:;
1500
+ __Pyx_RefNannyFinishContext();
1501
+ return __pyx_r;
1502
+ }
1503
+
1504
+ static PyObject *__pyx_pf_10manimpango_5utils_6_utils_validate_markup(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_text) {
1505
+ PyObject *__pyx_r = NULL;
1506
+ __Pyx_RefNannyDeclarations
1507
+ PyObject *__pyx_t_1 = NULL;
1508
+ int __pyx_lineno = 0;
1509
+ const char *__pyx_filename = NULL;
1510
+ int __pyx_clineno = 0;
1511
+ __Pyx_RefNannySetupContext("validate_markup", 0);
1512
+ __Pyx_XDECREF(__pyx_r);
1513
+ __pyx_t_1 = __pyx_f_10manimpango_5utils_6_utils_validate_markup(__pyx_v_text, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __pyx_L1_error)
1514
+ __Pyx_GOTREF(__pyx_t_1);
1515
+ __pyx_r = __pyx_t_1;
1516
+ __pyx_t_1 = 0;
1517
+ goto __pyx_L0;
1518
+
1519
+ /* function exit code */
1520
+ __pyx_L1_error:;
1521
+ __Pyx_XDECREF(__pyx_t_1);
1522
+ __Pyx_AddTraceback("manimpango.utils._utils.validate_markup", __pyx_clineno, __pyx_lineno, __pyx_filename);
1523
+ __pyx_r = NULL;
1524
+ __pyx_L0:;
1525
+ __Pyx_XGIVEREF(__pyx_r);
1526
+ __Pyx_RefNannyFinishContext();
1527
+ return __pyx_r;
1528
+ }
1529
+
1530
+ /* "manimpango/utils/utils.pyx":23
1531
+ * return message.decode('utf-8')
1532
+ *
1533
+ * def covert_hex_to_rbg(color_hex: str): # <<<<<<<<<<<<<<
1534
+ * cdef PangoColor color
1535
+ * if not pango_color_parse(&color, color_hex.encode('utf-8')):
1536
+ */
1537
+
1538
+ /* Python wrapper */
1539
+ static PyObject *__pyx_pw_10manimpango_5utils_6_utils_3covert_hex_to_rbg(PyObject *__pyx_self, PyObject *__pyx_v_color_hex); /*proto*/
1540
+ static PyMethodDef __pyx_mdef_10manimpango_5utils_6_utils_3covert_hex_to_rbg = {"covert_hex_to_rbg", (PyCFunction)__pyx_pw_10manimpango_5utils_6_utils_3covert_hex_to_rbg, METH_O, 0};
1541
+ static PyObject *__pyx_pw_10manimpango_5utils_6_utils_3covert_hex_to_rbg(PyObject *__pyx_self, PyObject *__pyx_v_color_hex) {
1542
+ int __pyx_lineno = 0;
1543
+ const char *__pyx_filename = NULL;
1544
+ int __pyx_clineno = 0;
1545
+ PyObject *__pyx_r = 0;
1546
+ __Pyx_RefNannyDeclarations
1547
+ __Pyx_RefNannySetupContext("covert_hex_to_rbg (wrapper)", 0);
1548
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_color_hex), (&PyUnicode_Type), 1, "color_hex", 1))) __PYX_ERR(0, 23, __pyx_L1_error)
1549
+ __pyx_r = __pyx_pf_10manimpango_5utils_6_utils_2covert_hex_to_rbg(__pyx_self, ((PyObject*)__pyx_v_color_hex));
1550
+
1551
+ /* function exit code */
1552
+ goto __pyx_L0;
1553
+ __pyx_L1_error:;
1554
+ __pyx_r = NULL;
1555
+ __pyx_L0:;
1556
+ __Pyx_RefNannyFinishContext();
1557
+ return __pyx_r;
1558
+ }
1559
+
1560
+ static PyObject *__pyx_pf_10manimpango_5utils_6_utils_2covert_hex_to_rbg(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_color_hex) {
1561
+ PangoColor __pyx_v_color;
1562
+ PyObject *__pyx_r = NULL;
1563
+ __Pyx_RefNannyDeclarations
1564
+ PyObject *__pyx_t_1 = NULL;
1565
+ char const *__pyx_t_2;
1566
+ int __pyx_t_3;
1567
+ PyObject *__pyx_t_4 = NULL;
1568
+ PyObject *__pyx_t_5 = NULL;
1569
+ PyObject *__pyx_t_6 = NULL;
1570
+ int __pyx_lineno = 0;
1571
+ const char *__pyx_filename = NULL;
1572
+ int __pyx_clineno = 0;
1573
+ __Pyx_RefNannySetupContext("covert_hex_to_rbg", 0);
1574
+
1575
+ /* "manimpango/utils/utils.pyx":25
1576
+ * def covert_hex_to_rbg(color_hex: str):
1577
+ * cdef PangoColor color
1578
+ * if not pango_color_parse(&color, color_hex.encode('utf-8')): # <<<<<<<<<<<<<<
1579
+ * raise ValueError('Invalid color specfied.')
1580
+ * return color.red, color.green, color.blue
1581
+ */
1582
+ if (unlikely(__pyx_v_color_hex == Py_None)) {
1583
+ PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "encode");
1584
+ __PYX_ERR(0, 25, __pyx_L1_error)
1585
+ }
1586
+ __pyx_t_1 = PyUnicode_AsUTF8String(__pyx_v_color_hex); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 25, __pyx_L1_error)
1587
+ __Pyx_GOTREF(__pyx_t_1);
1588
+ __pyx_t_2 = __Pyx_PyBytes_AsString(__pyx_t_1); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 25, __pyx_L1_error)
1589
+ __pyx_t_3 = ((!(pango_color_parse((&__pyx_v_color), __pyx_t_2) != 0)) != 0);
1590
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1591
+ if (unlikely(__pyx_t_3)) {
1592
+
1593
+ /* "manimpango/utils/utils.pyx":26
1594
+ * cdef PangoColor color
1595
+ * if not pango_color_parse(&color, color_hex.encode('utf-8')):
1596
+ * raise ValueError('Invalid color specfied.') # <<<<<<<<<<<<<<
1597
+ * return color.red, color.green, color.blue
1598
+ */
1599
+ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 26, __pyx_L1_error)
1600
+ __Pyx_GOTREF(__pyx_t_1);
1601
+ __Pyx_Raise(__pyx_t_1, 0, 0, 0);
1602
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
1603
+ __PYX_ERR(0, 26, __pyx_L1_error)
1604
+
1605
+ /* "manimpango/utils/utils.pyx":25
1606
+ * def covert_hex_to_rbg(color_hex: str):
1607
+ * cdef PangoColor color
1608
+ * if not pango_color_parse(&color, color_hex.encode('utf-8')): # <<<<<<<<<<<<<<
1609
+ * raise ValueError('Invalid color specfied.')
1610
+ * return color.red, color.green, color.blue
1611
+ */
1612
+ }
1613
+
1614
+ /* "manimpango/utils/utils.pyx":27
1615
+ * if not pango_color_parse(&color, color_hex.encode('utf-8')):
1616
+ * raise ValueError('Invalid color specfied.')
1617
+ * return color.red, color.green, color.blue # <<<<<<<<<<<<<<
1618
+ */
1619
+ __Pyx_XDECREF(__pyx_r);
1620
+ __pyx_t_1 = __Pyx_PyInt_From_guint16(__pyx_v_color.red); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 27, __pyx_L1_error)
1621
+ __Pyx_GOTREF(__pyx_t_1);
1622
+ __pyx_t_4 = __Pyx_PyInt_From_guint16(__pyx_v_color.green); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 27, __pyx_L1_error)
1623
+ __Pyx_GOTREF(__pyx_t_4);
1624
+ __pyx_t_5 = __Pyx_PyInt_From_guint16(__pyx_v_color.blue); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 27, __pyx_L1_error)
1625
+ __Pyx_GOTREF(__pyx_t_5);
1626
+ __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 27, __pyx_L1_error)
1627
+ __Pyx_GOTREF(__pyx_t_6);
1628
+ __Pyx_GIVEREF(__pyx_t_1);
1629
+ PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1);
1630
+ __Pyx_GIVEREF(__pyx_t_4);
1631
+ PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_4);
1632
+ __Pyx_GIVEREF(__pyx_t_5);
1633
+ PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_5);
1634
+ __pyx_t_1 = 0;
1635
+ __pyx_t_4 = 0;
1636
+ __pyx_t_5 = 0;
1637
+ __pyx_r = __pyx_t_6;
1638
+ __pyx_t_6 = 0;
1639
+ goto __pyx_L0;
1640
+
1641
+ /* "manimpango/utils/utils.pyx":23
1642
+ * return message.decode('utf-8')
1643
+ *
1644
+ * def covert_hex_to_rbg(color_hex: str): # <<<<<<<<<<<<<<
1645
+ * cdef PangoColor color
1646
+ * if not pango_color_parse(&color, color_hex.encode('utf-8')):
1647
+ */
1648
+
1649
+ /* function exit code */
1650
+ __pyx_L1_error:;
1651
+ __Pyx_XDECREF(__pyx_t_1);
1652
+ __Pyx_XDECREF(__pyx_t_4);
1653
+ __Pyx_XDECREF(__pyx_t_5);
1654
+ __Pyx_XDECREF(__pyx_t_6);
1655
+ __Pyx_AddTraceback("manimpango.utils._utils.covert_hex_to_rbg", __pyx_clineno, __pyx_lineno, __pyx_filename);
1656
+ __pyx_r = NULL;
1657
+ __pyx_L0:;
1658
+ __Pyx_XGIVEREF(__pyx_r);
1659
+ __Pyx_RefNannyFinishContext();
1660
+ return __pyx_r;
1661
+ }
1662
+
1663
+ static PyMethodDef __pyx_methods[] = {
1664
+ {"validate_markup", (PyCFunction)__pyx_pw_10manimpango_5utils_6_utils_1validate_markup, METH_O, 0},
1665
+ {0, 0, 0, 0}
1666
+ };
1667
+
1668
+ #if PY_MAJOR_VERSION >= 3
1669
+ #if CYTHON_PEP489_MULTI_PHASE_INIT
1670
+ static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
1671
+ static int __pyx_pymod_exec__utils(PyObject* module); /*proto*/
1672
+ static PyModuleDef_Slot __pyx_moduledef_slots[] = {
1673
+ {Py_mod_create, (void*)__pyx_pymod_create},
1674
+ {Py_mod_exec, (void*)__pyx_pymod_exec__utils},
1675
+ {0, NULL}
1676
+ };
1677
+ #endif
1678
+
1679
+ static struct PyModuleDef __pyx_moduledef = {
1680
+ PyModuleDef_HEAD_INIT,
1681
+ "_utils",
1682
+ 0, /* m_doc */
1683
+ #if CYTHON_PEP489_MULTI_PHASE_INIT
1684
+ 0, /* m_size */
1685
+ #else
1686
+ -1, /* m_size */
1687
+ #endif
1688
+ __pyx_methods /* m_methods */,
1689
+ #if CYTHON_PEP489_MULTI_PHASE_INIT
1690
+ __pyx_moduledef_slots, /* m_slots */
1691
+ #else
1692
+ NULL, /* m_reload */
1693
+ #endif
1694
+ NULL, /* m_traverse */
1695
+ NULL, /* m_clear */
1696
+ NULL /* m_free */
1697
+ };
1698
+ #endif
1699
+ #ifndef CYTHON_SMALL_CODE
1700
+ #if defined(__clang__)
1701
+ #define CYTHON_SMALL_CODE
1702
+ #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
1703
+ #define CYTHON_SMALL_CODE __attribute__((cold))
1704
+ #else
1705
+ #define CYTHON_SMALL_CODE
1706
+ #endif
1707
+ #endif
1708
+
1709
+ static __Pyx_StringTabEntry __pyx_string_tab[] = {
1710
+ {&__pyx_kp_u_, __pyx_k_, sizeof(__pyx_k_), 0, 1, 0, 0},
1711
+ {&__pyx_kp_u_Invalid_color_specfied, __pyx_k_Invalid_color_specfied, sizeof(__pyx_k_Invalid_color_specfied), 0, 1, 0, 0},
1712
+ {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
1713
+ {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
1714
+ {&__pyx_n_s_color, __pyx_k_color, sizeof(__pyx_k_color), 0, 0, 1, 1},
1715
+ {&__pyx_n_s_color_hex, __pyx_k_color_hex, sizeof(__pyx_k_color_hex), 0, 0, 1, 1},
1716
+ {&__pyx_n_s_covert_hex_to_rbg, __pyx_k_covert_hex_to_rbg, sizeof(__pyx_k_covert_hex_to_rbg), 0, 0, 1, 1},
1717
+ {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
1718
+ {&__pyx_n_s_manimpango_utils__utils, __pyx_k_manimpango_utils__utils, sizeof(__pyx_k_manimpango_utils__utils), 0, 0, 1, 1},
1719
+ {&__pyx_kp_s_manimpango_utils_utils_pyx, __pyx_k_manimpango_utils_utils_pyx, sizeof(__pyx_k_manimpango_utils_utils_pyx), 0, 0, 1, 0},
1720
+ {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
1721
+ {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
1722
+ {0, 0, 0, 0, 0, 0, 0}
1723
+ };
1724
+ static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
1725
+ __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 26, __pyx_L1_error)
1726
+ return 0;
1727
+ __pyx_L1_error:;
1728
+ return -1;
1729
+ }
1730
+
1731
+ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
1732
+ __Pyx_RefNannyDeclarations
1733
+ __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
1734
+
1735
+ /* "manimpango/utils/utils.pyx":26
1736
+ * cdef PangoColor color
1737
+ * if not pango_color_parse(&color, color_hex.encode('utf-8')):
1738
+ * raise ValueError('Invalid color specfied.') # <<<<<<<<<<<<<<
1739
+ * return color.red, color.green, color.blue
1740
+ */
1741
+ __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_Invalid_color_specfied); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 26, __pyx_L1_error)
1742
+ __Pyx_GOTREF(__pyx_tuple__2);
1743
+ __Pyx_GIVEREF(__pyx_tuple__2);
1744
+
1745
+ /* "manimpango/utils/utils.pyx":23
1746
+ * return message.decode('utf-8')
1747
+ *
1748
+ * def covert_hex_to_rbg(color_hex: str): # <<<<<<<<<<<<<<
1749
+ * cdef PangoColor color
1750
+ * if not pango_color_parse(&color, color_hex.encode('utf-8')):
1751
+ */
1752
+ __pyx_tuple__3 = PyTuple_Pack(2, __pyx_n_s_color_hex, __pyx_n_s_color); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 23, __pyx_L1_error)
1753
+ __Pyx_GOTREF(__pyx_tuple__3);
1754
+ __Pyx_GIVEREF(__pyx_tuple__3);
1755
+ __pyx_codeobj__4 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__3, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_manimpango_utils_utils_pyx, __pyx_n_s_covert_hex_to_rbg, 23, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__4)) __PYX_ERR(0, 23, __pyx_L1_error)
1756
+ __Pyx_RefNannyFinishContext();
1757
+ return 0;
1758
+ __pyx_L1_error:;
1759
+ __Pyx_RefNannyFinishContext();
1760
+ return -1;
1761
+ }
1762
+
1763
+ static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
1764
+ if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
1765
+ return 0;
1766
+ __pyx_L1_error:;
1767
+ return -1;
1768
+ }
1769
+
1770
+ static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
1771
+ static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
1772
+ static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
1773
+ static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
1774
+ static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
1775
+ static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
1776
+ static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
1777
+
1778
+ static int __Pyx_modinit_global_init_code(void) {
1779
+ __Pyx_RefNannyDeclarations
1780
+ __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
1781
+ /*--- Global init code ---*/
1782
+ __Pyx_RefNannyFinishContext();
1783
+ return 0;
1784
+ }
1785
+
1786
+ static int __Pyx_modinit_variable_export_code(void) {
1787
+ __Pyx_RefNannyDeclarations
1788
+ __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
1789
+ /*--- Variable export code ---*/
1790
+ __Pyx_RefNannyFinishContext();
1791
+ return 0;
1792
+ }
1793
+
1794
+ static int __Pyx_modinit_function_export_code(void) {
1795
+ __Pyx_RefNannyDeclarations
1796
+ __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
1797
+ /*--- Function export code ---*/
1798
+ __Pyx_RefNannyFinishContext();
1799
+ return 0;
1800
+ }
1801
+
1802
+ static int __Pyx_modinit_type_init_code(void) {
1803
+ __Pyx_RefNannyDeclarations
1804
+ __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
1805
+ /*--- Type init code ---*/
1806
+ __Pyx_RefNannyFinishContext();
1807
+ return 0;
1808
+ }
1809
+
1810
+ static int __Pyx_modinit_type_import_code(void) {
1811
+ __Pyx_RefNannyDeclarations
1812
+ __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
1813
+ /*--- Type import code ---*/
1814
+ __Pyx_RefNannyFinishContext();
1815
+ return 0;
1816
+ }
1817
+
1818
+ static int __Pyx_modinit_variable_import_code(void) {
1819
+ __Pyx_RefNannyDeclarations
1820
+ __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
1821
+ /*--- Variable import code ---*/
1822
+ __Pyx_RefNannyFinishContext();
1823
+ return 0;
1824
+ }
1825
+
1826
+ static int __Pyx_modinit_function_import_code(void) {
1827
+ __Pyx_RefNannyDeclarations
1828
+ __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
1829
+ /*--- Function import code ---*/
1830
+ __Pyx_RefNannyFinishContext();
1831
+ return 0;
1832
+ }
1833
+
1834
+
1835
+ #ifndef CYTHON_NO_PYINIT_EXPORT
1836
+ #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
1837
+ #elif PY_MAJOR_VERSION < 3
1838
+ #ifdef __cplusplus
1839
+ #define __Pyx_PyMODINIT_FUNC extern "C" void
1840
+ #else
1841
+ #define __Pyx_PyMODINIT_FUNC void
1842
+ #endif
1843
+ #else
1844
+ #ifdef __cplusplus
1845
+ #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
1846
+ #else
1847
+ #define __Pyx_PyMODINIT_FUNC PyObject *
1848
+ #endif
1849
+ #endif
1850
+
1851
+
1852
+ #if PY_MAJOR_VERSION < 3
1853
+ __Pyx_PyMODINIT_FUNC init_utils(void) CYTHON_SMALL_CODE; /*proto*/
1854
+ __Pyx_PyMODINIT_FUNC init_utils(void)
1855
+ #else
1856
+ __Pyx_PyMODINIT_FUNC PyInit__utils(void) CYTHON_SMALL_CODE; /*proto*/
1857
+ __Pyx_PyMODINIT_FUNC PyInit__utils(void)
1858
+ #if CYTHON_PEP489_MULTI_PHASE_INIT
1859
+ {
1860
+ return PyModuleDef_Init(&__pyx_moduledef);
1861
+ }
1862
+ static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
1863
+ #if PY_VERSION_HEX >= 0x030700A1
1864
+ static PY_INT64_T main_interpreter_id = -1;
1865
+ PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
1866
+ if (main_interpreter_id == -1) {
1867
+ main_interpreter_id = current_id;
1868
+ return (unlikely(current_id == -1)) ? -1 : 0;
1869
+ } else if (unlikely(main_interpreter_id != current_id))
1870
+ #else
1871
+ static PyInterpreterState *main_interpreter = NULL;
1872
+ PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
1873
+ if (!main_interpreter) {
1874
+ main_interpreter = current_interpreter;
1875
+ } else if (unlikely(main_interpreter != current_interpreter))
1876
+ #endif
1877
+ {
1878
+ PyErr_SetString(
1879
+ PyExc_ImportError,
1880
+ "Interpreter change detected - this module can only be loaded into one interpreter per process.");
1881
+ return -1;
1882
+ }
1883
+ return 0;
1884
+ }
1885
+ static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) {
1886
+ PyObject *value = PyObject_GetAttrString(spec, from_name);
1887
+ int result = 0;
1888
+ if (likely(value)) {
1889
+ if (allow_none || value != Py_None) {
1890
+ result = PyDict_SetItemString(moddict, to_name, value);
1891
+ }
1892
+ Py_DECREF(value);
1893
+ } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
1894
+ PyErr_Clear();
1895
+ } else {
1896
+ result = -1;
1897
+ }
1898
+ return result;
1899
+ }
1900
+ static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
1901
+ PyObject *module = NULL, *moddict, *modname;
1902
+ if (__Pyx_check_single_interpreter())
1903
+ return NULL;
1904
+ if (__pyx_m)
1905
+ return __Pyx_NewRef(__pyx_m);
1906
+ modname = PyObject_GetAttrString(spec, "name");
1907
+ if (unlikely(!modname)) goto bad;
1908
+ module = PyModule_NewObject(modname);
1909
+ Py_DECREF(modname);
1910
+ if (unlikely(!module)) goto bad;
1911
+ moddict = PyModule_GetDict(module);
1912
+ if (unlikely(!moddict)) goto bad;
1913
+ if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
1914
+ if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
1915
+ if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
1916
+ if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
1917
+ return module;
1918
+ bad:
1919
+ Py_XDECREF(module);
1920
+ return NULL;
1921
+ }
1922
+
1923
+
1924
+ static CYTHON_SMALL_CODE int __pyx_pymod_exec__utils(PyObject *__pyx_pyinit_module)
1925
+ #endif
1926
+ #endif
1927
+ {
1928
+ PyObject *__pyx_t_1 = NULL;
1929
+ int __pyx_lineno = 0;
1930
+ const char *__pyx_filename = NULL;
1931
+ int __pyx_clineno = 0;
1932
+ __Pyx_RefNannyDeclarations
1933
+ #if CYTHON_PEP489_MULTI_PHASE_INIT
1934
+ if (__pyx_m) {
1935
+ if (__pyx_m == __pyx_pyinit_module) return 0;
1936
+ PyErr_SetString(PyExc_RuntimeError, "Module '_utils' has already been imported. Re-initialisation is not supported.");
1937
+ return -1;
1938
+ }
1939
+ #elif PY_MAJOR_VERSION >= 3
1940
+ if (__pyx_m) return __Pyx_NewRef(__pyx_m);
1941
+ #endif
1942
+ #if CYTHON_REFNANNY
1943
+ __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
1944
+ if (!__Pyx_RefNanny) {
1945
+ PyErr_Clear();
1946
+ __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
1947
+ if (!__Pyx_RefNanny)
1948
+ Py_FatalError("failed to import 'refnanny' module");
1949
+ }
1950
+ #endif
1951
+ __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit__utils(void)", 0);
1952
+ if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
1953
+ #ifdef __Pxy_PyFrame_Initialize_Offsets
1954
+ __Pxy_PyFrame_Initialize_Offsets();
1955
+ #endif
1956
+ __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
1957
+ __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
1958
+ __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
1959
+ #ifdef __Pyx_CyFunction_USED
1960
+ if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
1961
+ #endif
1962
+ #ifdef __Pyx_FusedFunction_USED
1963
+ if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
1964
+ #endif
1965
+ #ifdef __Pyx_Coroutine_USED
1966
+ if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
1967
+ #endif
1968
+ #ifdef __Pyx_Generator_USED
1969
+ if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
1970
+ #endif
1971
+ #ifdef __Pyx_AsyncGen_USED
1972
+ if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
1973
+ #endif
1974
+ #ifdef __Pyx_StopAsyncIteration_USED
1975
+ if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
1976
+ #endif
1977
+ /*--- Library function declarations ---*/
1978
+ /*--- Threads initialization code ---*/
1979
+ #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
1980
+ PyEval_InitThreads();
1981
+ #endif
1982
+ /*--- Module creation code ---*/
1983
+ #if CYTHON_PEP489_MULTI_PHASE_INIT
1984
+ __pyx_m = __pyx_pyinit_module;
1985
+ Py_INCREF(__pyx_m);
1986
+ #else
1987
+ #if PY_MAJOR_VERSION < 3
1988
+ __pyx_m = Py_InitModule4("_utils", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
1989
+ #else
1990
+ __pyx_m = PyModule_Create(&__pyx_moduledef);
1991
+ #endif
1992
+ if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
1993
+ #endif
1994
+ __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
1995
+ Py_INCREF(__pyx_d);
1996
+ __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
1997
+ Py_INCREF(__pyx_b);
1998
+ __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
1999
+ Py_INCREF(__pyx_cython_runtime);
2000
+ if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2001
+ /*--- Initialize various global constants etc. ---*/
2002
+ if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2003
+ #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
2004
+ if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2005
+ #endif
2006
+ if (__pyx_module_is_main_manimpango__utils___utils) {
2007
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2008
+ }
2009
+ #if PY_MAJOR_VERSION >= 3
2010
+ {
2011
+ PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
2012
+ if (!PyDict_GetItemString(modules, "manimpango.utils._utils")) {
2013
+ if (unlikely(PyDict_SetItemString(modules, "manimpango.utils._utils", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
2014
+ }
2015
+ }
2016
+ #endif
2017
+ /*--- Builtin init code ---*/
2018
+ if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2019
+ /*--- Constants init code ---*/
2020
+ if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2021
+ /*--- Global type/function init code ---*/
2022
+ (void)__Pyx_modinit_global_init_code();
2023
+ (void)__Pyx_modinit_variable_export_code();
2024
+ (void)__Pyx_modinit_function_export_code();
2025
+ (void)__Pyx_modinit_type_init_code();
2026
+ (void)__Pyx_modinit_type_import_code();
2027
+ (void)__Pyx_modinit_variable_import_code();
2028
+ (void)__Pyx_modinit_function_import_code();
2029
+ /*--- Execution code ---*/
2030
+ #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
2031
+ if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2032
+ #endif
2033
+
2034
+ /* "manimpango/utils/utils.pyx":23
2035
+ * return message.decode('utf-8')
2036
+ *
2037
+ * def covert_hex_to_rbg(color_hex: str): # <<<<<<<<<<<<<<
2038
+ * cdef PangoColor color
2039
+ * if not pango_color_parse(&color, color_hex.encode('utf-8')):
2040
+ */
2041
+ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10manimpango_5utils_6_utils_3covert_hex_to_rbg, NULL, __pyx_n_s_manimpango_utils__utils); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error)
2042
+ __Pyx_GOTREF(__pyx_t_1);
2043
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_covert_hex_to_rbg, __pyx_t_1) < 0) __PYX_ERR(0, 23, __pyx_L1_error)
2044
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2045
+
2046
+ /* "manimpango/utils/utils.pyx":1
2047
+ * from pango cimport * # <<<<<<<<<<<<<<
2048
+ *
2049
+ *
2050
+ */
2051
+ __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
2052
+ __Pyx_GOTREF(__pyx_t_1);
2053
+ if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
2054
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2055
+
2056
+ /*--- Wrapped vars code ---*/
2057
+
2058
+ goto __pyx_L0;
2059
+ __pyx_L1_error:;
2060
+ __Pyx_XDECREF(__pyx_t_1);
2061
+ if (__pyx_m) {
2062
+ if (__pyx_d) {
2063
+ __Pyx_AddTraceback("init manimpango.utils._utils", __pyx_clineno, __pyx_lineno, __pyx_filename);
2064
+ }
2065
+ Py_CLEAR(__pyx_m);
2066
+ } else if (!PyErr_Occurred()) {
2067
+ PyErr_SetString(PyExc_ImportError, "init manimpango.utils._utils");
2068
+ }
2069
+ __pyx_L0:;
2070
+ __Pyx_RefNannyFinishContext();
2071
+ #if CYTHON_PEP489_MULTI_PHASE_INIT
2072
+ return (__pyx_m != NULL) ? 0 : -1;
2073
+ #elif PY_MAJOR_VERSION >= 3
2074
+ return __pyx_m;
2075
+ #else
2076
+ return;
2077
+ #endif
2078
+ }
2079
+
2080
+ /* --- Runtime support code --- */
2081
+ /* Refnanny */
2082
+ #if CYTHON_REFNANNY
2083
+ static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
2084
+ PyObject *m = NULL, *p = NULL;
2085
+ void *r = NULL;
2086
+ m = PyImport_ImportModule(modname);
2087
+ if (!m) goto end;
2088
+ p = PyObject_GetAttrString(m, "RefNannyAPI");
2089
+ if (!p) goto end;
2090
+ r = PyLong_AsVoidPtr(p);
2091
+ end:
2092
+ Py_XDECREF(p);
2093
+ Py_XDECREF(m);
2094
+ return (__Pyx_RefNannyAPIStruct *)r;
2095
+ }
2096
+ #endif
2097
+
2098
+ /* PyObjectGetAttrStr */
2099
+ #if CYTHON_USE_TYPE_SLOTS
2100
+ static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
2101
+ PyTypeObject* tp = Py_TYPE(obj);
2102
+ if (likely(tp->tp_getattro))
2103
+ return tp->tp_getattro(obj, attr_name);
2104
+ #if PY_MAJOR_VERSION < 3
2105
+ if (likely(tp->tp_getattr))
2106
+ return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
2107
+ #endif
2108
+ return PyObject_GetAttr(obj, attr_name);
2109
+ }
2110
+ #endif
2111
+
2112
+ /* GetBuiltinName */
2113
+ static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
2114
+ PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
2115
+ if (unlikely(!result)) {
2116
+ PyErr_Format(PyExc_NameError,
2117
+ #if PY_MAJOR_VERSION >= 3
2118
+ "name '%U' is not defined", name);
2119
+ #else
2120
+ "name '%.200s' is not defined", PyString_AS_STRING(name));
2121
+ #endif
2122
+ }
2123
+ return result;
2124
+ }
2125
+
2126
+ /* decode_c_bytes */
2127
+ static CYTHON_INLINE PyObject* __Pyx_decode_c_bytes(
2128
+ const char* cstring, Py_ssize_t length, Py_ssize_t start, Py_ssize_t stop,
2129
+ const char* encoding, const char* errors,
2130
+ PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
2131
+ if (unlikely((start < 0) | (stop < 0))) {
2132
+ if (start < 0) {
2133
+ start += length;
2134
+ if (start < 0)
2135
+ start = 0;
2136
+ }
2137
+ if (stop < 0)
2138
+ stop += length;
2139
+ }
2140
+ if (stop > length)
2141
+ stop = length;
2142
+ if (unlikely(stop <= start))
2143
+ return __Pyx_NewRef(__pyx_empty_unicode);
2144
+ length = stop - start;
2145
+ cstring += start;
2146
+ if (decode_func) {
2147
+ return decode_func(cstring, length, errors);
2148
+ } else {
2149
+ return PyUnicode_Decode(cstring, length, encoding, errors);
2150
+ }
2151
+ }
2152
+
2153
+ /* ArgTypeTest */
2154
+ static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
2155
+ {
2156
+ if (unlikely(!type)) {
2157
+ PyErr_SetString(PyExc_SystemError, "Missing type object");
2158
+ return 0;
2159
+ }
2160
+ else if (exact) {
2161
+ #if PY_MAJOR_VERSION == 2
2162
+ if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
2163
+ #endif
2164
+ }
2165
+ else {
2166
+ if (likely(__Pyx_TypeCheck(obj, type))) return 1;
2167
+ }
2168
+ PyErr_Format(PyExc_TypeError,
2169
+ "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
2170
+ name, type->tp_name, Py_TYPE(obj)->tp_name);
2171
+ return 0;
2172
+ }
2173
+
2174
+ /* PyObjectCall */
2175
+ #if CYTHON_COMPILING_IN_CPYTHON
2176
+ static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
2177
+ PyObject *result;
2178
+ ternaryfunc call = Py_TYPE(func)->tp_call;
2179
+ if (unlikely(!call))
2180
+ return PyObject_Call(func, arg, kw);
2181
+ if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
2182
+ return NULL;
2183
+ result = (*call)(func, arg, kw);
2184
+ Py_LeaveRecursiveCall();
2185
+ if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
2186
+ PyErr_SetString(
2187
+ PyExc_SystemError,
2188
+ "NULL result without error in PyObject_Call");
2189
+ }
2190
+ return result;
2191
+ }
2192
+ #endif
2193
+
2194
+ /* PyErrFetchRestore */
2195
+ #if CYTHON_FAST_THREAD_STATE
2196
+ static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
2197
+ PyObject *tmp_type, *tmp_value, *tmp_tb;
2198
+ tmp_type = tstate->curexc_type;
2199
+ tmp_value = tstate->curexc_value;
2200
+ tmp_tb = tstate->curexc_traceback;
2201
+ tstate->curexc_type = type;
2202
+ tstate->curexc_value = value;
2203
+ tstate->curexc_traceback = tb;
2204
+ Py_XDECREF(tmp_type);
2205
+ Py_XDECREF(tmp_value);
2206
+ Py_XDECREF(tmp_tb);
2207
+ }
2208
+ static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
2209
+ *type = tstate->curexc_type;
2210
+ *value = tstate->curexc_value;
2211
+ *tb = tstate->curexc_traceback;
2212
+ tstate->curexc_type = 0;
2213
+ tstate->curexc_value = 0;
2214
+ tstate->curexc_traceback = 0;
2215
+ }
2216
+ #endif
2217
+
2218
+ /* RaiseException */
2219
+ #if PY_MAJOR_VERSION < 3
2220
+ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
2221
+ CYTHON_UNUSED PyObject *cause) {
2222
+ __Pyx_PyThreadState_declare
2223
+ Py_XINCREF(type);
2224
+ if (!value || value == Py_None)
2225
+ value = NULL;
2226
+ else
2227
+ Py_INCREF(value);
2228
+ if (!tb || tb == Py_None)
2229
+ tb = NULL;
2230
+ else {
2231
+ Py_INCREF(tb);
2232
+ if (!PyTraceBack_Check(tb)) {
2233
+ PyErr_SetString(PyExc_TypeError,
2234
+ "raise: arg 3 must be a traceback or None");
2235
+ goto raise_error;
2236
+ }
2237
+ }
2238
+ if (PyType_Check(type)) {
2239
+ #if CYTHON_COMPILING_IN_PYPY
2240
+ if (!value) {
2241
+ Py_INCREF(Py_None);
2242
+ value = Py_None;
2243
+ }
2244
+ #endif
2245
+ PyErr_NormalizeException(&type, &value, &tb);
2246
+ } else {
2247
+ if (value) {
2248
+ PyErr_SetString(PyExc_TypeError,
2249
+ "instance exception may not have a separate value");
2250
+ goto raise_error;
2251
+ }
2252
+ value = type;
2253
+ type = (PyObject*) Py_TYPE(type);
2254
+ Py_INCREF(type);
2255
+ if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
2256
+ PyErr_SetString(PyExc_TypeError,
2257
+ "raise: exception class must be a subclass of BaseException");
2258
+ goto raise_error;
2259
+ }
2260
+ }
2261
+ __Pyx_PyThreadState_assign
2262
+ __Pyx_ErrRestore(type, value, tb);
2263
+ return;
2264
+ raise_error:
2265
+ Py_XDECREF(value);
2266
+ Py_XDECREF(type);
2267
+ Py_XDECREF(tb);
2268
+ return;
2269
+ }
2270
+ #else
2271
+ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
2272
+ PyObject* owned_instance = NULL;
2273
+ if (tb == Py_None) {
2274
+ tb = 0;
2275
+ } else if (tb && !PyTraceBack_Check(tb)) {
2276
+ PyErr_SetString(PyExc_TypeError,
2277
+ "raise: arg 3 must be a traceback or None");
2278
+ goto bad;
2279
+ }
2280
+ if (value == Py_None)
2281
+ value = 0;
2282
+ if (PyExceptionInstance_Check(type)) {
2283
+ if (value) {
2284
+ PyErr_SetString(PyExc_TypeError,
2285
+ "instance exception may not have a separate value");
2286
+ goto bad;
2287
+ }
2288
+ value = type;
2289
+ type = (PyObject*) Py_TYPE(value);
2290
+ } else if (PyExceptionClass_Check(type)) {
2291
+ PyObject *instance_class = NULL;
2292
+ if (value && PyExceptionInstance_Check(value)) {
2293
+ instance_class = (PyObject*) Py_TYPE(value);
2294
+ if (instance_class != type) {
2295
+ int is_subclass = PyObject_IsSubclass(instance_class, type);
2296
+ if (!is_subclass) {
2297
+ instance_class = NULL;
2298
+ } else if (unlikely(is_subclass == -1)) {
2299
+ goto bad;
2300
+ } else {
2301
+ type = instance_class;
2302
+ }
2303
+ }
2304
+ }
2305
+ if (!instance_class) {
2306
+ PyObject *args;
2307
+ if (!value)
2308
+ args = PyTuple_New(0);
2309
+ else if (PyTuple_Check(value)) {
2310
+ Py_INCREF(value);
2311
+ args = value;
2312
+ } else
2313
+ args = PyTuple_Pack(1, value);
2314
+ if (!args)
2315
+ goto bad;
2316
+ owned_instance = PyObject_Call(type, args, NULL);
2317
+ Py_DECREF(args);
2318
+ if (!owned_instance)
2319
+ goto bad;
2320
+ value = owned_instance;
2321
+ if (!PyExceptionInstance_Check(value)) {
2322
+ PyErr_Format(PyExc_TypeError,
2323
+ "calling %R should have returned an instance of "
2324
+ "BaseException, not %R",
2325
+ type, Py_TYPE(value));
2326
+ goto bad;
2327
+ }
2328
+ }
2329
+ } else {
2330
+ PyErr_SetString(PyExc_TypeError,
2331
+ "raise: exception class must be a subclass of BaseException");
2332
+ goto bad;
2333
+ }
2334
+ if (cause) {
2335
+ PyObject *fixed_cause;
2336
+ if (cause == Py_None) {
2337
+ fixed_cause = NULL;
2338
+ } else if (PyExceptionClass_Check(cause)) {
2339
+ fixed_cause = PyObject_CallObject(cause, NULL);
2340
+ if (fixed_cause == NULL)
2341
+ goto bad;
2342
+ } else if (PyExceptionInstance_Check(cause)) {
2343
+ fixed_cause = cause;
2344
+ Py_INCREF(fixed_cause);
2345
+ } else {
2346
+ PyErr_SetString(PyExc_TypeError,
2347
+ "exception causes must derive from "
2348
+ "BaseException");
2349
+ goto bad;
2350
+ }
2351
+ PyException_SetCause(value, fixed_cause);
2352
+ }
2353
+ PyErr_SetObject(type, value);
2354
+ if (tb) {
2355
+ #if CYTHON_FAST_THREAD_STATE
2356
+ PyThreadState *tstate = __Pyx_PyThreadState_Current;
2357
+ PyObject* tmp_tb = tstate->curexc_traceback;
2358
+ if (tb != tmp_tb) {
2359
+ Py_INCREF(tb);
2360
+ tstate->curexc_traceback = tb;
2361
+ Py_XDECREF(tmp_tb);
2362
+ }
2363
+ #else
2364
+ PyObject *tmp_type, *tmp_value, *tmp_tb;
2365
+ PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
2366
+ Py_INCREF(tb);
2367
+ PyErr_Restore(tmp_type, tmp_value, tb);
2368
+ Py_XDECREF(tmp_tb);
2369
+ #endif
2370
+ }
2371
+ bad:
2372
+ Py_XDECREF(owned_instance);
2373
+ return;
2374
+ }
2375
+ #endif
2376
+
2377
+ /* PyDictVersioning */
2378
+ #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
2379
+ static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
2380
+ PyObject *dict = Py_TYPE(obj)->tp_dict;
2381
+ return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
2382
+ }
2383
+ static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
2384
+ PyObject **dictptr = NULL;
2385
+ Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
2386
+ if (offset) {
2387
+ #if CYTHON_COMPILING_IN_CPYTHON
2388
+ dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
2389
+ #else
2390
+ dictptr = _PyObject_GetDictPtr(obj);
2391
+ #endif
2392
+ }
2393
+ return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
2394
+ }
2395
+ static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
2396
+ PyObject *dict = Py_TYPE(obj)->tp_dict;
2397
+ if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
2398
+ return 0;
2399
+ return obj_dict_version == __Pyx_get_object_dict_version(obj);
2400
+ }
2401
+ #endif
2402
+
2403
+ /* CLineInTraceback */
2404
+ #ifndef CYTHON_CLINE_IN_TRACEBACK
2405
+ static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate, int c_line) {
2406
+ PyObject *use_cline;
2407
+ PyObject *ptype, *pvalue, *ptraceback;
2408
+ #if CYTHON_COMPILING_IN_CPYTHON
2409
+ PyObject **cython_runtime_dict;
2410
+ #endif
2411
+ if (unlikely(!__pyx_cython_runtime)) {
2412
+ return c_line;
2413
+ }
2414
+ __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
2415
+ #if CYTHON_COMPILING_IN_CPYTHON
2416
+ cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
2417
+ if (likely(cython_runtime_dict)) {
2418
+ __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
2419
+ use_cline, *cython_runtime_dict,
2420
+ __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
2421
+ } else
2422
+ #endif
2423
+ {
2424
+ PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
2425
+ if (use_cline_obj) {
2426
+ use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
2427
+ Py_DECREF(use_cline_obj);
2428
+ } else {
2429
+ PyErr_Clear();
2430
+ use_cline = NULL;
2431
+ }
2432
+ }
2433
+ if (!use_cline) {
2434
+ c_line = 0;
2435
+ (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
2436
+ }
2437
+ else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
2438
+ c_line = 0;
2439
+ }
2440
+ __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
2441
+ return c_line;
2442
+ }
2443
+ #endif
2444
+
2445
+ /* CodeObjectCache */
2446
+ static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
2447
+ int start = 0, mid = 0, end = count - 1;
2448
+ if (end >= 0 && code_line > entries[end].code_line) {
2449
+ return count;
2450
+ }
2451
+ while (start < end) {
2452
+ mid = start + (end - start) / 2;
2453
+ if (code_line < entries[mid].code_line) {
2454
+ end = mid;
2455
+ } else if (code_line > entries[mid].code_line) {
2456
+ start = mid + 1;
2457
+ } else {
2458
+ return mid;
2459
+ }
2460
+ }
2461
+ if (code_line <= entries[mid].code_line) {
2462
+ return mid;
2463
+ } else {
2464
+ return mid + 1;
2465
+ }
2466
+ }
2467
+ static PyCodeObject *__pyx_find_code_object(int code_line) {
2468
+ PyCodeObject* code_object;
2469
+ int pos;
2470
+ if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
2471
+ return NULL;
2472
+ }
2473
+ pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
2474
+ if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
2475
+ return NULL;
2476
+ }
2477
+ code_object = __pyx_code_cache.entries[pos].code_object;
2478
+ Py_INCREF(code_object);
2479
+ return code_object;
2480
+ }
2481
+ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
2482
+ int pos, i;
2483
+ __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
2484
+ if (unlikely(!code_line)) {
2485
+ return;
2486
+ }
2487
+ if (unlikely(!entries)) {
2488
+ entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
2489
+ if (likely(entries)) {
2490
+ __pyx_code_cache.entries = entries;
2491
+ __pyx_code_cache.max_count = 64;
2492
+ __pyx_code_cache.count = 1;
2493
+ entries[0].code_line = code_line;
2494
+ entries[0].code_object = code_object;
2495
+ Py_INCREF(code_object);
2496
+ }
2497
+ return;
2498
+ }
2499
+ pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
2500
+ if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
2501
+ PyCodeObject* tmp = entries[pos].code_object;
2502
+ entries[pos].code_object = code_object;
2503
+ Py_DECREF(tmp);
2504
+ return;
2505
+ }
2506
+ if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
2507
+ int new_max = __pyx_code_cache.max_count + 64;
2508
+ entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
2509
+ __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
2510
+ if (unlikely(!entries)) {
2511
+ return;
2512
+ }
2513
+ __pyx_code_cache.entries = entries;
2514
+ __pyx_code_cache.max_count = new_max;
2515
+ }
2516
+ for (i=__pyx_code_cache.count; i>pos; i--) {
2517
+ entries[i] = entries[i-1];
2518
+ }
2519
+ entries[pos].code_line = code_line;
2520
+ entries[pos].code_object = code_object;
2521
+ __pyx_code_cache.count++;
2522
+ Py_INCREF(code_object);
2523
+ }
2524
+
2525
+ /* AddTraceback */
2526
+ #include "compile.h"
2527
+ #include "frameobject.h"
2528
+ #include "traceback.h"
2529
+ #if PY_VERSION_HEX >= 0x030b00a6
2530
+ #ifndef Py_BUILD_CORE
2531
+ #define Py_BUILD_CORE 1
2532
+ #endif
2533
+ #include "internal/pycore_frame.h"
2534
+ #endif
2535
+ static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
2536
+ const char *funcname, int c_line,
2537
+ int py_line, const char *filename) {
2538
+ PyCodeObject *py_code = NULL;
2539
+ PyObject *py_funcname = NULL;
2540
+ #if PY_MAJOR_VERSION < 3
2541
+ PyObject *py_srcfile = NULL;
2542
+ py_srcfile = PyString_FromString(filename);
2543
+ if (!py_srcfile) goto bad;
2544
+ #endif
2545
+ if (c_line) {
2546
+ #if PY_MAJOR_VERSION < 3
2547
+ py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
2548
+ if (!py_funcname) goto bad;
2549
+ #else
2550
+ py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
2551
+ if (!py_funcname) goto bad;
2552
+ funcname = PyUnicode_AsUTF8(py_funcname);
2553
+ if (!funcname) goto bad;
2554
+ #endif
2555
+ }
2556
+ else {
2557
+ #if PY_MAJOR_VERSION < 3
2558
+ py_funcname = PyString_FromString(funcname);
2559
+ if (!py_funcname) goto bad;
2560
+ #endif
2561
+ }
2562
+ #if PY_MAJOR_VERSION < 3
2563
+ py_code = __Pyx_PyCode_New(
2564
+ 0,
2565
+ 0,
2566
+ 0,
2567
+ 0,
2568
+ 0,
2569
+ __pyx_empty_bytes, /*PyObject *code,*/
2570
+ __pyx_empty_tuple, /*PyObject *consts,*/
2571
+ __pyx_empty_tuple, /*PyObject *names,*/
2572
+ __pyx_empty_tuple, /*PyObject *varnames,*/
2573
+ __pyx_empty_tuple, /*PyObject *freevars,*/
2574
+ __pyx_empty_tuple, /*PyObject *cellvars,*/
2575
+ py_srcfile, /*PyObject *filename,*/
2576
+ py_funcname, /*PyObject *name,*/
2577
+ py_line,
2578
+ __pyx_empty_bytes /*PyObject *lnotab*/
2579
+ );
2580
+ Py_DECREF(py_srcfile);
2581
+ #else
2582
+ py_code = PyCode_NewEmpty(filename, funcname, py_line);
2583
+ #endif
2584
+ Py_XDECREF(py_funcname); // XDECREF since it's only set on Py3 if cline
2585
+ return py_code;
2586
+ bad:
2587
+ Py_XDECREF(py_funcname);
2588
+ #if PY_MAJOR_VERSION < 3
2589
+ Py_XDECREF(py_srcfile);
2590
+ #endif
2591
+ return NULL;
2592
+ }
2593
+ static void __Pyx_AddTraceback(const char *funcname, int c_line,
2594
+ int py_line, const char *filename) {
2595
+ PyCodeObject *py_code = 0;
2596
+ PyFrameObject *py_frame = 0;
2597
+ PyThreadState *tstate = __Pyx_PyThreadState_Current;
2598
+ PyObject *ptype, *pvalue, *ptraceback;
2599
+ if (c_line) {
2600
+ c_line = __Pyx_CLineForTraceback(tstate, c_line);
2601
+ }
2602
+ py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
2603
+ if (!py_code) {
2604
+ __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
2605
+ py_code = __Pyx_CreateCodeObjectForTraceback(
2606
+ funcname, c_line, py_line, filename);
2607
+ if (!py_code) {
2608
+ /* If the code object creation fails, then we should clear the
2609
+ fetched exception references and propagate the new exception */
2610
+ Py_XDECREF(ptype);
2611
+ Py_XDECREF(pvalue);
2612
+ Py_XDECREF(ptraceback);
2613
+ goto bad;
2614
+ }
2615
+ __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
2616
+ __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
2617
+ }
2618
+ py_frame = PyFrame_New(
2619
+ tstate, /*PyThreadState *tstate,*/
2620
+ py_code, /*PyCodeObject *code,*/
2621
+ __pyx_d, /*PyObject *globals,*/
2622
+ 0 /*PyObject *locals*/
2623
+ );
2624
+ if (!py_frame) goto bad;
2625
+ __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
2626
+ PyTraceBack_Here(py_frame);
2627
+ bad:
2628
+ Py_XDECREF(py_code);
2629
+ Py_XDECREF(py_frame);
2630
+ }
2631
+
2632
+ /* CIntToPy */
2633
+ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_guint16(guint16 value) {
2634
+ #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
2635
+ #pragma GCC diagnostic push
2636
+ #pragma GCC diagnostic ignored "-Wconversion"
2637
+ #endif
2638
+ const guint16 neg_one = (guint16) -1, const_zero = (guint16) 0;
2639
+ #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
2640
+ #pragma GCC diagnostic pop
2641
+ #endif
2642
+ const int is_unsigned = neg_one > const_zero;
2643
+ if (is_unsigned) {
2644
+ if (sizeof(guint16) < sizeof(long)) {
2645
+ return PyInt_FromLong((long) value);
2646
+ } else if (sizeof(guint16) <= sizeof(unsigned long)) {
2647
+ return PyLong_FromUnsignedLong((unsigned long) value);
2648
+ #ifdef HAVE_LONG_LONG
2649
+ } else if (sizeof(guint16) <= sizeof(unsigned PY_LONG_LONG)) {
2650
+ return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
2651
+ #endif
2652
+ }
2653
+ } else {
2654
+ if (sizeof(guint16) <= sizeof(long)) {
2655
+ return PyInt_FromLong((long) value);
2656
+ #ifdef HAVE_LONG_LONG
2657
+ } else if (sizeof(guint16) <= sizeof(PY_LONG_LONG)) {
2658
+ return PyLong_FromLongLong((PY_LONG_LONG) value);
2659
+ #endif
2660
+ }
2661
+ }
2662
+ {
2663
+ int one = 1; int little = (int)*(unsigned char *)&one;
2664
+ unsigned char *bytes = (unsigned char *)&value;
2665
+ return _PyLong_FromByteArray(bytes, sizeof(guint16),
2666
+ little, !is_unsigned);
2667
+ }
2668
+ }
2669
+
2670
+ /* CIntToPy */
2671
+ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
2672
+ #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
2673
+ #pragma GCC diagnostic push
2674
+ #pragma GCC diagnostic ignored "-Wconversion"
2675
+ #endif
2676
+ const long neg_one = (long) -1, const_zero = (long) 0;
2677
+ #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
2678
+ #pragma GCC diagnostic pop
2679
+ #endif
2680
+ const int is_unsigned = neg_one > const_zero;
2681
+ if (is_unsigned) {
2682
+ if (sizeof(long) < sizeof(long)) {
2683
+ return PyInt_FromLong((long) value);
2684
+ } else if (sizeof(long) <= sizeof(unsigned long)) {
2685
+ return PyLong_FromUnsignedLong((unsigned long) value);
2686
+ #ifdef HAVE_LONG_LONG
2687
+ } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
2688
+ return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
2689
+ #endif
2690
+ }
2691
+ } else {
2692
+ if (sizeof(long) <= sizeof(long)) {
2693
+ return PyInt_FromLong((long) value);
2694
+ #ifdef HAVE_LONG_LONG
2695
+ } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
2696
+ return PyLong_FromLongLong((PY_LONG_LONG) value);
2697
+ #endif
2698
+ }
2699
+ }
2700
+ {
2701
+ int one = 1; int little = (int)*(unsigned char *)&one;
2702
+ unsigned char *bytes = (unsigned char *)&value;
2703
+ return _PyLong_FromByteArray(bytes, sizeof(long),
2704
+ little, !is_unsigned);
2705
+ }
2706
+ }
2707
+
2708
+ /* CIntFromPyVerify */
2709
+ #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
2710
+ __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
2711
+ #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
2712
+ __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
2713
+ #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
2714
+ {\
2715
+ func_type value = func_value;\
2716
+ if (sizeof(target_type) < sizeof(func_type)) {\
2717
+ if (unlikely(value != (func_type) (target_type) value)) {\
2718
+ func_type zero = 0;\
2719
+ if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
2720
+ return (target_type) -1;\
2721
+ if (is_unsigned && unlikely(value < zero))\
2722
+ goto raise_neg_overflow;\
2723
+ else\
2724
+ goto raise_overflow;\
2725
+ }\
2726
+ }\
2727
+ return (target_type) value;\
2728
+ }
2729
+
2730
+ /* CIntFromPy */
2731
+ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
2732
+ #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
2733
+ #pragma GCC diagnostic push
2734
+ #pragma GCC diagnostic ignored "-Wconversion"
2735
+ #endif
2736
+ const long neg_one = (long) -1, const_zero = (long) 0;
2737
+ #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
2738
+ #pragma GCC diagnostic pop
2739
+ #endif
2740
+ const int is_unsigned = neg_one > const_zero;
2741
+ #if PY_MAJOR_VERSION < 3
2742
+ if (likely(PyInt_Check(x))) {
2743
+ if (sizeof(long) < sizeof(long)) {
2744
+ __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
2745
+ } else {
2746
+ long val = PyInt_AS_LONG(x);
2747
+ if (is_unsigned && unlikely(val < 0)) {
2748
+ goto raise_neg_overflow;
2749
+ }
2750
+ return (long) val;
2751
+ }
2752
+ } else
2753
+ #endif
2754
+ if (likely(PyLong_Check(x))) {
2755
+ if (is_unsigned) {
2756
+ #if CYTHON_USE_PYLONG_INTERNALS
2757
+ const digit* digits = ((PyLongObject*)x)->ob_digit;
2758
+ switch (Py_SIZE(x)) {
2759
+ case 0: return (long) 0;
2760
+ case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
2761
+ case 2:
2762
+ if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
2763
+ if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
2764
+ __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
2765
+ } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
2766
+ return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
2767
+ }
2768
+ }
2769
+ break;
2770
+ case 3:
2771
+ if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
2772
+ if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
2773
+ __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
2774
+ } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
2775
+ return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
2776
+ }
2777
+ }
2778
+ break;
2779
+ case 4:
2780
+ if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
2781
+ if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
2782
+ __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])))
2783
+ } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
2784
+ return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
2785
+ }
2786
+ }
2787
+ break;
2788
+ }
2789
+ #endif
2790
+ #if CYTHON_COMPILING_IN_CPYTHON
2791
+ if (unlikely(Py_SIZE(x) < 0)) {
2792
+ goto raise_neg_overflow;
2793
+ }
2794
+ #else
2795
+ {
2796
+ int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
2797
+ if (unlikely(result < 0))
2798
+ return (long) -1;
2799
+ if (unlikely(result == 1))
2800
+ goto raise_neg_overflow;
2801
+ }
2802
+ #endif
2803
+ if (sizeof(long) <= sizeof(unsigned long)) {
2804
+ __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
2805
+ #ifdef HAVE_LONG_LONG
2806
+ } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
2807
+ __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
2808
+ #endif
2809
+ }
2810
+ } else {
2811
+ #if CYTHON_USE_PYLONG_INTERNALS
2812
+ const digit* digits = ((PyLongObject*)x)->ob_digit;
2813
+ switch (Py_SIZE(x)) {
2814
+ case 0: return (long) 0;
2815
+ case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
2816
+ case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0])
2817
+ case -2:
2818
+ if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
2819
+ if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
2820
+ __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
2821
+ } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
2822
+ return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
2823
+ }
2824
+ }
2825
+ break;
2826
+ case 2:
2827
+ if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
2828
+ if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
2829
+ __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
2830
+ } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
2831
+ return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
2832
+ }
2833
+ }
2834
+ break;
2835
+ case -3:
2836
+ if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
2837
+ if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
2838
+ __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
2839
+ } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
2840
+ return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
2841
+ }
2842
+ }
2843
+ break;
2844
+ case 3:
2845
+ if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
2846
+ if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
2847
+ __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
2848
+ } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
2849
+ return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
2850
+ }
2851
+ }
2852
+ break;
2853
+ case -4:
2854
+ if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
2855
+ if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
2856
+ __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])))
2857
+ } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
2858
+ return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
2859
+ }
2860
+ }
2861
+ break;
2862
+ case 4:
2863
+ if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
2864
+ if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
2865
+ __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])))
2866
+ } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
2867
+ return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
2868
+ }
2869
+ }
2870
+ break;
2871
+ }
2872
+ #endif
2873
+ if (sizeof(long) <= sizeof(long)) {
2874
+ __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
2875
+ #ifdef HAVE_LONG_LONG
2876
+ } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
2877
+ __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
2878
+ #endif
2879
+ }
2880
+ }
2881
+ {
2882
+ #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
2883
+ PyErr_SetString(PyExc_RuntimeError,
2884
+ "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
2885
+ #else
2886
+ long val;
2887
+ PyObject *v = __Pyx_PyNumber_IntOrLong(x);
2888
+ #if PY_MAJOR_VERSION < 3
2889
+ if (likely(v) && !PyLong_Check(v)) {
2890
+ PyObject *tmp = v;
2891
+ v = PyNumber_Long(tmp);
2892
+ Py_DECREF(tmp);
2893
+ }
2894
+ #endif
2895
+ if (likely(v)) {
2896
+ int one = 1; int is_little = (int)*(unsigned char *)&one;
2897
+ unsigned char *bytes = (unsigned char *)&val;
2898
+ int ret = _PyLong_AsByteArray((PyLongObject *)v,
2899
+ bytes, sizeof(val),
2900
+ is_little, !is_unsigned);
2901
+ Py_DECREF(v);
2902
+ if (likely(!ret))
2903
+ return val;
2904
+ }
2905
+ #endif
2906
+ return (long) -1;
2907
+ }
2908
+ } else {
2909
+ long val;
2910
+ PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
2911
+ if (!tmp) return (long) -1;
2912
+ val = __Pyx_PyInt_As_long(tmp);
2913
+ Py_DECREF(tmp);
2914
+ return val;
2915
+ }
2916
+ raise_overflow:
2917
+ PyErr_SetString(PyExc_OverflowError,
2918
+ "value too large to convert to long");
2919
+ return (long) -1;
2920
+ raise_neg_overflow:
2921
+ PyErr_SetString(PyExc_OverflowError,
2922
+ "can't convert negative value to long");
2923
+ return (long) -1;
2924
+ }
2925
+
2926
+ /* CIntFromPy */
2927
+ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
2928
+ #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
2929
+ #pragma GCC diagnostic push
2930
+ #pragma GCC diagnostic ignored "-Wconversion"
2931
+ #endif
2932
+ const int neg_one = (int) -1, const_zero = (int) 0;
2933
+ #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
2934
+ #pragma GCC diagnostic pop
2935
+ #endif
2936
+ const int is_unsigned = neg_one > const_zero;
2937
+ #if PY_MAJOR_VERSION < 3
2938
+ if (likely(PyInt_Check(x))) {
2939
+ if (sizeof(int) < sizeof(long)) {
2940
+ __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
2941
+ } else {
2942
+ long val = PyInt_AS_LONG(x);
2943
+ if (is_unsigned && unlikely(val < 0)) {
2944
+ goto raise_neg_overflow;
2945
+ }
2946
+ return (int) val;
2947
+ }
2948
+ } else
2949
+ #endif
2950
+ if (likely(PyLong_Check(x))) {
2951
+ if (is_unsigned) {
2952
+ #if CYTHON_USE_PYLONG_INTERNALS
2953
+ const digit* digits = ((PyLongObject*)x)->ob_digit;
2954
+ switch (Py_SIZE(x)) {
2955
+ case 0: return (int) 0;
2956
+ case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
2957
+ case 2:
2958
+ if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
2959
+ if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
2960
+ __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
2961
+ } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
2962
+ return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
2963
+ }
2964
+ }
2965
+ break;
2966
+ case 3:
2967
+ if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
2968
+ if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
2969
+ __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
2970
+ } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
2971
+ return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
2972
+ }
2973
+ }
2974
+ break;
2975
+ case 4:
2976
+ if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
2977
+ if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
2978
+ __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])))
2979
+ } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
2980
+ return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
2981
+ }
2982
+ }
2983
+ break;
2984
+ }
2985
+ #endif
2986
+ #if CYTHON_COMPILING_IN_CPYTHON
2987
+ if (unlikely(Py_SIZE(x) < 0)) {
2988
+ goto raise_neg_overflow;
2989
+ }
2990
+ #else
2991
+ {
2992
+ int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
2993
+ if (unlikely(result < 0))
2994
+ return (int) -1;
2995
+ if (unlikely(result == 1))
2996
+ goto raise_neg_overflow;
2997
+ }
2998
+ #endif
2999
+ if (sizeof(int) <= sizeof(unsigned long)) {
3000
+ __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
3001
+ #ifdef HAVE_LONG_LONG
3002
+ } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
3003
+ __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
3004
+ #endif
3005
+ }
3006
+ } else {
3007
+ #if CYTHON_USE_PYLONG_INTERNALS
3008
+ const digit* digits = ((PyLongObject*)x)->ob_digit;
3009
+ switch (Py_SIZE(x)) {
3010
+ case 0: return (int) 0;
3011
+ case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
3012
+ case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0])
3013
+ case -2:
3014
+ if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
3015
+ if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
3016
+ __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3017
+ } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
3018
+ return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
3019
+ }
3020
+ }
3021
+ break;
3022
+ case 2:
3023
+ if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
3024
+ if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
3025
+ __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3026
+ } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
3027
+ return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
3028
+ }
3029
+ }
3030
+ break;
3031
+ case -3:
3032
+ if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
3033
+ if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
3034
+ __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3035
+ } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
3036
+ return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
3037
+ }
3038
+ }
3039
+ break;
3040
+ case 3:
3041
+ if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
3042
+ if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
3043
+ __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
3044
+ } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
3045
+ return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
3046
+ }
3047
+ }
3048
+ break;
3049
+ case -4:
3050
+ if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
3051
+ if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
3052
+ __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])))
3053
+ } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
3054
+ return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
3055
+ }
3056
+ }
3057
+ break;
3058
+ case 4:
3059
+ if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
3060
+ if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
3061
+ __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])))
3062
+ } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
3063
+ return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
3064
+ }
3065
+ }
3066
+ break;
3067
+ }
3068
+ #endif
3069
+ if (sizeof(int) <= sizeof(long)) {
3070
+ __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
3071
+ #ifdef HAVE_LONG_LONG
3072
+ } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
3073
+ __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
3074
+ #endif
3075
+ }
3076
+ }
3077
+ {
3078
+ #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
3079
+ PyErr_SetString(PyExc_RuntimeError,
3080
+ "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
3081
+ #else
3082
+ int val;
3083
+ PyObject *v = __Pyx_PyNumber_IntOrLong(x);
3084
+ #if PY_MAJOR_VERSION < 3
3085
+ if (likely(v) && !PyLong_Check(v)) {
3086
+ PyObject *tmp = v;
3087
+ v = PyNumber_Long(tmp);
3088
+ Py_DECREF(tmp);
3089
+ }
3090
+ #endif
3091
+ if (likely(v)) {
3092
+ int one = 1; int is_little = (int)*(unsigned char *)&one;
3093
+ unsigned char *bytes = (unsigned char *)&val;
3094
+ int ret = _PyLong_AsByteArray((PyLongObject *)v,
3095
+ bytes, sizeof(val),
3096
+ is_little, !is_unsigned);
3097
+ Py_DECREF(v);
3098
+ if (likely(!ret))
3099
+ return val;
3100
+ }
3101
+ #endif
3102
+ return (int) -1;
3103
+ }
3104
+ } else {
3105
+ int val;
3106
+ PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
3107
+ if (!tmp) return (int) -1;
3108
+ val = __Pyx_PyInt_As_int(tmp);
3109
+ Py_DECREF(tmp);
3110
+ return val;
3111
+ }
3112
+ raise_overflow:
3113
+ PyErr_SetString(PyExc_OverflowError,
3114
+ "value too large to convert to int");
3115
+ return (int) -1;
3116
+ raise_neg_overflow:
3117
+ PyErr_SetString(PyExc_OverflowError,
3118
+ "can't convert negative value to int");
3119
+ return (int) -1;
3120
+ }
3121
+
3122
+ /* FastTypeChecks */
3123
+ #if CYTHON_COMPILING_IN_CPYTHON
3124
+ static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
3125
+ while (a) {
3126
+ a = a->tp_base;
3127
+ if (a == b)
3128
+ return 1;
3129
+ }
3130
+ return b == &PyBaseObject_Type;
3131
+ }
3132
+ static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
3133
+ PyObject *mro;
3134
+ if (a == b) return 1;
3135
+ mro = a->tp_mro;
3136
+ if (likely(mro)) {
3137
+ Py_ssize_t i, n;
3138
+ n = PyTuple_GET_SIZE(mro);
3139
+ for (i = 0; i < n; i++) {
3140
+ if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
3141
+ return 1;
3142
+ }
3143
+ return 0;
3144
+ }
3145
+ return __Pyx_InBases(a, b);
3146
+ }
3147
+ #if PY_MAJOR_VERSION == 2
3148
+ static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
3149
+ PyObject *exception, *value, *tb;
3150
+ int res;
3151
+ __Pyx_PyThreadState_declare
3152
+ __Pyx_PyThreadState_assign
3153
+ __Pyx_ErrFetch(&exception, &value, &tb);
3154
+ res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
3155
+ if (unlikely(res == -1)) {
3156
+ PyErr_WriteUnraisable(err);
3157
+ res = 0;
3158
+ }
3159
+ if (!res) {
3160
+ res = PyObject_IsSubclass(err, exc_type2);
3161
+ if (unlikely(res == -1)) {
3162
+ PyErr_WriteUnraisable(err);
3163
+ res = 0;
3164
+ }
3165
+ }
3166
+ __Pyx_ErrRestore(exception, value, tb);
3167
+ return res;
3168
+ }
3169
+ #else
3170
+ static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
3171
+ int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
3172
+ if (!res) {
3173
+ res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
3174
+ }
3175
+ return res;
3176
+ }
3177
+ #endif
3178
+ static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
3179
+ Py_ssize_t i, n;
3180
+ assert(PyExceptionClass_Check(exc_type));
3181
+ n = PyTuple_GET_SIZE(tuple);
3182
+ #if PY_MAJOR_VERSION >= 3
3183
+ for (i=0; i<n; i++) {
3184
+ if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
3185
+ }
3186
+ #endif
3187
+ for (i=0; i<n; i++) {
3188
+ PyObject *t = PyTuple_GET_ITEM(tuple, i);
3189
+ #if PY_MAJOR_VERSION < 3
3190
+ if (likely(exc_type == t)) return 1;
3191
+ #endif
3192
+ if (likely(PyExceptionClass_Check(t))) {
3193
+ if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
3194
+ } else {
3195
+ }
3196
+ }
3197
+ return 0;
3198
+ }
3199
+ static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
3200
+ if (likely(err == exc_type)) return 1;
3201
+ if (likely(PyExceptionClass_Check(err))) {
3202
+ if (likely(PyExceptionClass_Check(exc_type))) {
3203
+ return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
3204
+ } else if (likely(PyTuple_Check(exc_type))) {
3205
+ return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
3206
+ } else {
3207
+ }
3208
+ }
3209
+ return PyErr_GivenExceptionMatches(err, exc_type);
3210
+ }
3211
+ static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
3212
+ assert(PyExceptionClass_Check(exc_type1));
3213
+ assert(PyExceptionClass_Check(exc_type2));
3214
+ if (likely(err == exc_type1 || err == exc_type2)) return 1;
3215
+ if (likely(PyExceptionClass_Check(err))) {
3216
+ return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
3217
+ }
3218
+ return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
3219
+ }
3220
+ #endif
3221
+
3222
+ /* CheckBinaryVersion */
3223
+ static int __Pyx_check_binary_version(void) {
3224
+ char ctversion[5];
3225
+ int same=1, i, found_dot;
3226
+ const char* rt_from_call = Py_GetVersion();
3227
+ PyOS_snprintf(ctversion, 5, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
3228
+ found_dot = 0;
3229
+ for (i = 0; i < 4; i++) {
3230
+ if (!ctversion[i]) {
3231
+ same = (rt_from_call[i] < '0' || rt_from_call[i] > '9');
3232
+ break;
3233
+ }
3234
+ if (rt_from_call[i] != ctversion[i]) {
3235
+ same = 0;
3236
+ break;
3237
+ }
3238
+ }
3239
+ if (!same) {
3240
+ char rtversion[5] = {'\0'};
3241
+ char message[200];
3242
+ for (i=0; i<4; ++i) {
3243
+ if (rt_from_call[i] == '.') {
3244
+ if (found_dot) break;
3245
+ found_dot = 1;
3246
+ } else if (rt_from_call[i] < '0' || rt_from_call[i] > '9') {
3247
+ break;
3248
+ }
3249
+ rtversion[i] = rt_from_call[i];
3250
+ }
3251
+ PyOS_snprintf(message, sizeof(message),
3252
+ "compiletime version %s of module '%.100s' "
3253
+ "does not match runtime version %s",
3254
+ ctversion, __Pyx_MODULE_NAME, rtversion);
3255
+ return PyErr_WarnEx(NULL, message, 1);
3256
+ }
3257
+ return 0;
3258
+ }
3259
+
3260
+ /* InitStrings */
3261
+ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
3262
+ while (t->p) {
3263
+ #if PY_MAJOR_VERSION < 3
3264
+ if (t->is_unicode) {
3265
+ *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
3266
+ } else if (t->intern) {
3267
+ *t->p = PyString_InternFromString(t->s);
3268
+ } else {
3269
+ *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
3270
+ }
3271
+ #else
3272
+ if (t->is_unicode | t->is_str) {
3273
+ if (t->intern) {
3274
+ *t->p = PyUnicode_InternFromString(t->s);
3275
+ } else if (t->encoding) {
3276
+ *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
3277
+ } else {
3278
+ *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
3279
+ }
3280
+ } else {
3281
+ *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
3282
+ }
3283
+ #endif
3284
+ if (!*t->p)
3285
+ return -1;
3286
+ if (PyObject_Hash(*t->p) == -1)
3287
+ return -1;
3288
+ ++t;
3289
+ }
3290
+ return 0;
3291
+ }
3292
+
3293
+ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
3294
+ return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
3295
+ }
3296
+ static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
3297
+ Py_ssize_t ignore;
3298
+ return __Pyx_PyObject_AsStringAndSize(o, &ignore);
3299
+ }
3300
+ #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
3301
+ #if !CYTHON_PEP393_ENABLED
3302
+ static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
3303
+ char* defenc_c;
3304
+ PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
3305
+ if (!defenc) return NULL;
3306
+ defenc_c = PyBytes_AS_STRING(defenc);
3307
+ #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
3308
+ {
3309
+ char* end = defenc_c + PyBytes_GET_SIZE(defenc);
3310
+ char* c;
3311
+ for (c = defenc_c; c < end; c++) {
3312
+ if ((unsigned char) (*c) >= 128) {
3313
+ PyUnicode_AsASCIIString(o);
3314
+ return NULL;
3315
+ }
3316
+ }
3317
+ }
3318
+ #endif
3319
+ *length = PyBytes_GET_SIZE(defenc);
3320
+ return defenc_c;
3321
+ }
3322
+ #else
3323
+ static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
3324
+ if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
3325
+ #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
3326
+ if (likely(PyUnicode_IS_ASCII(o))) {
3327
+ *length = PyUnicode_GET_LENGTH(o);
3328
+ return PyUnicode_AsUTF8(o);
3329
+ } else {
3330
+ PyUnicode_AsASCIIString(o);
3331
+ return NULL;
3332
+ }
3333
+ #else
3334
+ return PyUnicode_AsUTF8AndSize(o, length);
3335
+ #endif
3336
+ }
3337
+ #endif
3338
+ #endif
3339
+ static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
3340
+ #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
3341
+ if (
3342
+ #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
3343
+ __Pyx_sys_getdefaultencoding_not_ascii &&
3344
+ #endif
3345
+ PyUnicode_Check(o)) {
3346
+ return __Pyx_PyUnicode_AsStringAndSize(o, length);
3347
+ } else
3348
+ #endif
3349
+ #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
3350
+ if (PyByteArray_Check(o)) {
3351
+ *length = PyByteArray_GET_SIZE(o);
3352
+ return PyByteArray_AS_STRING(o);
3353
+ } else
3354
+ #endif
3355
+ {
3356
+ char* result;
3357
+ int r = PyBytes_AsStringAndSize(o, &result, length);
3358
+ if (unlikely(r < 0)) {
3359
+ return NULL;
3360
+ } else {
3361
+ return result;
3362
+ }
3363
+ }
3364
+ }
3365
+ static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
3366
+ int is_true = x == Py_True;
3367
+ if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
3368
+ else return PyObject_IsTrue(x);
3369
+ }
3370
+ static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
3371
+ int retval;
3372
+ if (unlikely(!x)) return -1;
3373
+ retval = __Pyx_PyObject_IsTrue(x);
3374
+ Py_DECREF(x);
3375
+ return retval;
3376
+ }
3377
+ static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
3378
+ #if PY_MAJOR_VERSION >= 3
3379
+ if (PyLong_Check(result)) {
3380
+ if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
3381
+ "__int__ returned non-int (type %.200s). "
3382
+ "The ability to return an instance of a strict subclass of int "
3383
+ "is deprecated, and may be removed in a future version of Python.",
3384
+ Py_TYPE(result)->tp_name)) {
3385
+ Py_DECREF(result);
3386
+ return NULL;
3387
+ }
3388
+ return result;
3389
+ }
3390
+ #endif
3391
+ PyErr_Format(PyExc_TypeError,
3392
+ "__%.4s__ returned non-%.4s (type %.200s)",
3393
+ type_name, type_name, Py_TYPE(result)->tp_name);
3394
+ Py_DECREF(result);
3395
+ return NULL;
3396
+ }
3397
+ static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
3398
+ #if CYTHON_USE_TYPE_SLOTS
3399
+ PyNumberMethods *m;
3400
+ #endif
3401
+ const char *name = NULL;
3402
+ PyObject *res = NULL;
3403
+ #if PY_MAJOR_VERSION < 3
3404
+ if (likely(PyInt_Check(x) || PyLong_Check(x)))
3405
+ #else
3406
+ if (likely(PyLong_Check(x)))
3407
+ #endif
3408
+ return __Pyx_NewRef(x);
3409
+ #if CYTHON_USE_TYPE_SLOTS
3410
+ m = Py_TYPE(x)->tp_as_number;
3411
+ #if PY_MAJOR_VERSION < 3
3412
+ if (m && m->nb_int) {
3413
+ name = "int";
3414
+ res = m->nb_int(x);
3415
+ }
3416
+ else if (m && m->nb_long) {
3417
+ name = "long";
3418
+ res = m->nb_long(x);
3419
+ }
3420
+ #else
3421
+ if (likely(m && m->nb_int)) {
3422
+ name = "int";
3423
+ res = m->nb_int(x);
3424
+ }
3425
+ #endif
3426
+ #else
3427
+ if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
3428
+ res = PyNumber_Int(x);
3429
+ }
3430
+ #endif
3431
+ if (likely(res)) {
3432
+ #if PY_MAJOR_VERSION < 3
3433
+ if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
3434
+ #else
3435
+ if (unlikely(!PyLong_CheckExact(res))) {
3436
+ #endif
3437
+ return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
3438
+ }
3439
+ }
3440
+ else if (!PyErr_Occurred()) {
3441
+ PyErr_SetString(PyExc_TypeError,
3442
+ "an integer is required");
3443
+ }
3444
+ return res;
3445
+ }
3446
+ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
3447
+ Py_ssize_t ival;
3448
+ PyObject *x;
3449
+ #if PY_MAJOR_VERSION < 3
3450
+ if (likely(PyInt_CheckExact(b))) {
3451
+ if (sizeof(Py_ssize_t) >= sizeof(long))
3452
+ return PyInt_AS_LONG(b);
3453
+ else
3454
+ return PyInt_AsSsize_t(b);
3455
+ }
3456
+ #endif
3457
+ if (likely(PyLong_CheckExact(b))) {
3458
+ #if CYTHON_USE_PYLONG_INTERNALS
3459
+ const digit* digits = ((PyLongObject*)b)->ob_digit;
3460
+ const Py_ssize_t size = Py_SIZE(b);
3461
+ if (likely(__Pyx_sst_abs(size) <= 1)) {
3462
+ ival = likely(size) ? digits[0] : 0;
3463
+ if (size == -1) ival = -ival;
3464
+ return ival;
3465
+ } else {
3466
+ switch (size) {
3467
+ case 2:
3468
+ if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
3469
+ return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
3470
+ }
3471
+ break;
3472
+ case -2:
3473
+ if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
3474
+ return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
3475
+ }
3476
+ break;
3477
+ case 3:
3478
+ if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
3479
+ return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
3480
+ }
3481
+ break;
3482
+ case -3:
3483
+ if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
3484
+ return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
3485
+ }
3486
+ break;
3487
+ case 4:
3488
+ if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
3489
+ 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]));
3490
+ }
3491
+ break;
3492
+ case -4:
3493
+ if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
3494
+ 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]));
3495
+ }
3496
+ break;
3497
+ }
3498
+ }
3499
+ #endif
3500
+ return PyLong_AsSsize_t(b);
3501
+ }
3502
+ x = PyNumber_Index(b);
3503
+ if (!x) return -1;
3504
+ ival = PyInt_AsSsize_t(x);
3505
+ Py_DECREF(x);
3506
+ return ival;
3507
+ }
3508
+ static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) {
3509
+ if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) {
3510
+ return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o);
3511
+ #if PY_MAJOR_VERSION < 3
3512
+ } else if (likely(PyInt_CheckExact(o))) {
3513
+ return PyInt_AS_LONG(o);
3514
+ #endif
3515
+ } else {
3516
+ Py_ssize_t ival;
3517
+ PyObject *x;
3518
+ x = PyNumber_Index(o);
3519
+ if (!x) return -1;
3520
+ ival = PyInt_AsLong(x);
3521
+ Py_DECREF(x);
3522
+ return ival;
3523
+ }
3524
+ }
3525
+ static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
3526
+ return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
3527
+ }
3528
+ static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
3529
+ return PyInt_FromSize_t(ival);
3530
+ }
3531
+
3532
+
3533
+ #endif /* Py_PYTHON_H */