python-datamodel 0.10.1__cp313-cp313-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.
- datamodel/__init__.py +13 -0
- datamodel/abstract.py +383 -0
- datamodel/adaptive/__init__.py +0 -0
- datamodel/adaptive/models.py +598 -0
- datamodel/aliases/__init__.py +26 -0
- datamodel/base.py +180 -0
- datamodel/converters.c +43471 -0
- datamodel/converters.cp313-win32.pyd +0 -0
- datamodel/converters.html +17387 -0
- datamodel/converters.pyx +1489 -0
- datamodel/exceptions.c +13455 -0
- datamodel/exceptions.cp313-win32.pyd +0 -0
- datamodel/exceptions.html +1261 -0
- datamodel/exceptions.pxd +13 -0
- datamodel/exceptions.pyx +50 -0
- datamodel/fields.cp313-win32.pyd +0 -0
- datamodel/fields.cpp +17401 -0
- datamodel/fields.html +3912 -0
- datamodel/fields.pyx +309 -0
- datamodel/functions.cp313-win32.pyd +0 -0
- datamodel/functions.cpp +9068 -0
- datamodel/functions.html +1766 -0
- datamodel/functions.pxd +9 -0
- datamodel/functions.pyx +82 -0
- datamodel/jsonld/__init__.py +45 -0
- datamodel/jsonld/models.py +500 -0
- datamodel/libs/__init__.py +1 -0
- datamodel/libs/mapping.c +15067 -0
- datamodel/libs/mapping.cp313-win32.pyd +0 -0
- datamodel/libs/mapping.html +2618 -0
- datamodel/libs/mapping.pxd +11 -0
- datamodel/libs/mapping.pyx +135 -0
- datamodel/libs/mutables.py +127 -0
- datamodel/models.py +814 -0
- datamodel/parsers/__init__.py +0 -0
- datamodel/parsers/encoders.py +15 -0
- datamodel/parsers/json.cp313-win32.pyd +0 -0
- datamodel/parsers/json.cpp +17004 -0
- datamodel/parsers/json.html +3365 -0
- datamodel/parsers/json.pyx +250 -0
- datamodel/profiler.py +21 -0
- datamodel/py.typed +0 -0
- datamodel/rs_core/Cargo.toml +17 -0
- datamodel/rs_core/src/lib.rs +294 -0
- datamodel/rs_parsers/Cargo.toml +22 -0
- datamodel/rs_parsers/src/lib.rs +571 -0
- datamodel/rs_parsers.cp313-win32.pyd +0 -0
- datamodel/rs_validators/Cargo.toml +17 -0
- datamodel/rs_validators/src/lib.rs +0 -0
- datamodel/typedefs/__init__.py +9 -0
- datamodel/typedefs/singleton.c +9169 -0
- datamodel/typedefs/singleton.cp313-win32.pyd +0 -0
- datamodel/typedefs/singleton.html +629 -0
- datamodel/typedefs/singleton.pxd +9 -0
- datamodel/typedefs/singleton.pyx +24 -0
- datamodel/typedefs/types.c +11716 -0
- datamodel/typedefs/types.cp313-win32.pyd +0 -0
- datamodel/typedefs/types.html +732 -0
- datamodel/typedefs/types.pxd +11 -0
- datamodel/typedefs/types.pyx +39 -0
- datamodel/types.c +7165 -0
- datamodel/types.cp313-win32.pyd +0 -0
- datamodel/types.html +716 -0
- datamodel/types.pyx +100 -0
- datamodel/validation.cp313-win32.pyd +0 -0
- datamodel/validation.cpp +17085 -0
- datamodel/validation.html +4769 -0
- datamodel/validation.pyx +315 -0
- datamodel/version.py +13 -0
- examples/nn/examples.py +311 -0
- examples/nn/stores.py +151 -0
- examples/tests/sp_types.py +294 -0
- examples/tests/speed_dates.py +26 -0
- python_datamodel-0.10.1.dist-info/LICENSE +29 -0
- python_datamodel-0.10.1.dist-info/METADATA +320 -0
- python_datamodel-0.10.1.dist-info/RECORD +78 -0
- python_datamodel-0.10.1.dist-info/WHEEL +5 -0
- python_datamodel-0.10.1.dist-info/top_level.txt +7 -0
|
@@ -0,0 +1,3365 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<!-- Generated by Cython 3.0.11 -->
|
|
3
|
+
<html>
|
|
4
|
+
<head>
|
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
6
|
+
<title>Cython: json.pyx</title>
|
|
7
|
+
<style type="text/css">
|
|
8
|
+
|
|
9
|
+
body.cython { font-family: courier; font-size: 12; }
|
|
10
|
+
|
|
11
|
+
.cython.tag { }
|
|
12
|
+
.cython.line { color: #000000; margin: 0em }
|
|
13
|
+
.cython.code { font-size: 9; color: #444444; display: none; margin: 0px 0px 0px 8px; border-left: 8px none; }
|
|
14
|
+
|
|
15
|
+
.cython.line .run { background-color: #B0FFB0; }
|
|
16
|
+
.cython.line .mis { background-color: #FFB0B0; }
|
|
17
|
+
.cython.code.run { border-left: 8px solid #B0FFB0; }
|
|
18
|
+
.cython.code.mis { border-left: 8px solid #FFB0B0; }
|
|
19
|
+
|
|
20
|
+
.cython.code .py_c_api { color: red; }
|
|
21
|
+
.cython.code .py_macro_api { color: #FF7000; }
|
|
22
|
+
.cython.code .pyx_c_api { color: #FF3000; }
|
|
23
|
+
.cython.code .pyx_macro_api { color: #FF7000; }
|
|
24
|
+
.cython.code .refnanny { color: #FFA000; }
|
|
25
|
+
.cython.code .trace { color: #FFA000; }
|
|
26
|
+
.cython.code .error_goto { color: #FFA000; }
|
|
27
|
+
|
|
28
|
+
.cython.code .coerce { color: #008000; border: 1px dotted #008000 }
|
|
29
|
+
.cython.code .py_attr { color: #FF0000; font-weight: bold; }
|
|
30
|
+
.cython.code .c_attr { color: #0000FF; }
|
|
31
|
+
.cython.code .py_call { color: #FF0000; font-weight: bold; }
|
|
32
|
+
.cython.code .c_call { color: #0000FF; }
|
|
33
|
+
|
|
34
|
+
.cython.score-0 {background-color: #FFFFff;}
|
|
35
|
+
.cython.score-1 {background-color: #FFFFe7;}
|
|
36
|
+
.cython.score-2 {background-color: #FFFFd4;}
|
|
37
|
+
.cython.score-3 {background-color: #FFFFc4;}
|
|
38
|
+
.cython.score-4 {background-color: #FFFFb6;}
|
|
39
|
+
.cython.score-5 {background-color: #FFFFaa;}
|
|
40
|
+
.cython.score-6 {background-color: #FFFF9f;}
|
|
41
|
+
.cython.score-7 {background-color: #FFFF96;}
|
|
42
|
+
.cython.score-8 {background-color: #FFFF8d;}
|
|
43
|
+
.cython.score-9 {background-color: #FFFF86;}
|
|
44
|
+
.cython.score-10 {background-color: #FFFF7f;}
|
|
45
|
+
.cython.score-11 {background-color: #FFFF79;}
|
|
46
|
+
.cython.score-12 {background-color: #FFFF73;}
|
|
47
|
+
.cython.score-13 {background-color: #FFFF6e;}
|
|
48
|
+
.cython.score-14 {background-color: #FFFF6a;}
|
|
49
|
+
.cython.score-15 {background-color: #FFFF66;}
|
|
50
|
+
.cython.score-16 {background-color: #FFFF62;}
|
|
51
|
+
.cython.score-17 {background-color: #FFFF5e;}
|
|
52
|
+
.cython.score-18 {background-color: #FFFF5b;}
|
|
53
|
+
.cython.score-19 {background-color: #FFFF57;}
|
|
54
|
+
.cython.score-20 {background-color: #FFFF55;}
|
|
55
|
+
.cython.score-21 {background-color: #FFFF52;}
|
|
56
|
+
.cython.score-22 {background-color: #FFFF4f;}
|
|
57
|
+
.cython.score-23 {background-color: #FFFF4d;}
|
|
58
|
+
.cython.score-24 {background-color: #FFFF4b;}
|
|
59
|
+
.cython.score-25 {background-color: #FFFF48;}
|
|
60
|
+
.cython.score-26 {background-color: #FFFF46;}
|
|
61
|
+
.cython.score-27 {background-color: #FFFF44;}
|
|
62
|
+
.cython.score-28 {background-color: #FFFF43;}
|
|
63
|
+
.cython.score-29 {background-color: #FFFF41;}
|
|
64
|
+
.cython.score-30 {background-color: #FFFF3f;}
|
|
65
|
+
.cython.score-31 {background-color: #FFFF3e;}
|
|
66
|
+
.cython.score-32 {background-color: #FFFF3c;}
|
|
67
|
+
.cython.score-33 {background-color: #FFFF3b;}
|
|
68
|
+
.cython.score-34 {background-color: #FFFF39;}
|
|
69
|
+
.cython.score-35 {background-color: #FFFF38;}
|
|
70
|
+
.cython.score-36 {background-color: #FFFF37;}
|
|
71
|
+
.cython.score-37 {background-color: #FFFF36;}
|
|
72
|
+
.cython.score-38 {background-color: #FFFF35;}
|
|
73
|
+
.cython.score-39 {background-color: #FFFF34;}
|
|
74
|
+
.cython.score-40 {background-color: #FFFF33;}
|
|
75
|
+
.cython.score-41 {background-color: #FFFF32;}
|
|
76
|
+
.cython.score-42 {background-color: #FFFF31;}
|
|
77
|
+
.cython.score-43 {background-color: #FFFF30;}
|
|
78
|
+
.cython.score-44 {background-color: #FFFF2f;}
|
|
79
|
+
.cython.score-45 {background-color: #FFFF2e;}
|
|
80
|
+
.cython.score-46 {background-color: #FFFF2d;}
|
|
81
|
+
.cython.score-47 {background-color: #FFFF2c;}
|
|
82
|
+
.cython.score-48 {background-color: #FFFF2b;}
|
|
83
|
+
.cython.score-49 {background-color: #FFFF2b;}
|
|
84
|
+
.cython.score-50 {background-color: #FFFF2a;}
|
|
85
|
+
.cython.score-51 {background-color: #FFFF29;}
|
|
86
|
+
.cython.score-52 {background-color: #FFFF29;}
|
|
87
|
+
.cython.score-53 {background-color: #FFFF28;}
|
|
88
|
+
.cython.score-54 {background-color: #FFFF27;}
|
|
89
|
+
.cython.score-55 {background-color: #FFFF27;}
|
|
90
|
+
.cython.score-56 {background-color: #FFFF26;}
|
|
91
|
+
.cython.score-57 {background-color: #FFFF26;}
|
|
92
|
+
.cython.score-58 {background-color: #FFFF25;}
|
|
93
|
+
.cython.score-59 {background-color: #FFFF24;}
|
|
94
|
+
.cython.score-60 {background-color: #FFFF24;}
|
|
95
|
+
.cython.score-61 {background-color: #FFFF23;}
|
|
96
|
+
.cython.score-62 {background-color: #FFFF23;}
|
|
97
|
+
.cython.score-63 {background-color: #FFFF22;}
|
|
98
|
+
.cython.score-64 {background-color: #FFFF22;}
|
|
99
|
+
.cython.score-65 {background-color: #FFFF22;}
|
|
100
|
+
.cython.score-66 {background-color: #FFFF21;}
|
|
101
|
+
.cython.score-67 {background-color: #FFFF21;}
|
|
102
|
+
.cython.score-68 {background-color: #FFFF20;}
|
|
103
|
+
.cython.score-69 {background-color: #FFFF20;}
|
|
104
|
+
.cython.score-70 {background-color: #FFFF1f;}
|
|
105
|
+
.cython.score-71 {background-color: #FFFF1f;}
|
|
106
|
+
.cython.score-72 {background-color: #FFFF1f;}
|
|
107
|
+
.cython.score-73 {background-color: #FFFF1e;}
|
|
108
|
+
.cython.score-74 {background-color: #FFFF1e;}
|
|
109
|
+
.cython.score-75 {background-color: #FFFF1e;}
|
|
110
|
+
.cython.score-76 {background-color: #FFFF1d;}
|
|
111
|
+
.cython.score-77 {background-color: #FFFF1d;}
|
|
112
|
+
.cython.score-78 {background-color: #FFFF1c;}
|
|
113
|
+
.cython.score-79 {background-color: #FFFF1c;}
|
|
114
|
+
.cython.score-80 {background-color: #FFFF1c;}
|
|
115
|
+
.cython.score-81 {background-color: #FFFF1c;}
|
|
116
|
+
.cython.score-82 {background-color: #FFFF1b;}
|
|
117
|
+
.cython.score-83 {background-color: #FFFF1b;}
|
|
118
|
+
.cython.score-84 {background-color: #FFFF1b;}
|
|
119
|
+
.cython.score-85 {background-color: #FFFF1a;}
|
|
120
|
+
.cython.score-86 {background-color: #FFFF1a;}
|
|
121
|
+
.cython.score-87 {background-color: #FFFF1a;}
|
|
122
|
+
.cython.score-88 {background-color: #FFFF1a;}
|
|
123
|
+
.cython.score-89 {background-color: #FFFF19;}
|
|
124
|
+
.cython.score-90 {background-color: #FFFF19;}
|
|
125
|
+
.cython.score-91 {background-color: #FFFF19;}
|
|
126
|
+
.cython.score-92 {background-color: #FFFF19;}
|
|
127
|
+
.cython.score-93 {background-color: #FFFF18;}
|
|
128
|
+
.cython.score-94 {background-color: #FFFF18;}
|
|
129
|
+
.cython.score-95 {background-color: #FFFF18;}
|
|
130
|
+
.cython.score-96 {background-color: #FFFF18;}
|
|
131
|
+
.cython.score-97 {background-color: #FFFF17;}
|
|
132
|
+
.cython.score-98 {background-color: #FFFF17;}
|
|
133
|
+
.cython.score-99 {background-color: #FFFF17;}
|
|
134
|
+
.cython.score-100 {background-color: #FFFF17;}
|
|
135
|
+
.cython.score-101 {background-color: #FFFF16;}
|
|
136
|
+
.cython.score-102 {background-color: #FFFF16;}
|
|
137
|
+
.cython.score-103 {background-color: #FFFF16;}
|
|
138
|
+
.cython.score-104 {background-color: #FFFF16;}
|
|
139
|
+
.cython.score-105 {background-color: #FFFF16;}
|
|
140
|
+
.cython.score-106 {background-color: #FFFF15;}
|
|
141
|
+
.cython.score-107 {background-color: #FFFF15;}
|
|
142
|
+
.cython.score-108 {background-color: #FFFF15;}
|
|
143
|
+
.cython.score-109 {background-color: #FFFF15;}
|
|
144
|
+
.cython.score-110 {background-color: #FFFF15;}
|
|
145
|
+
.cython.score-111 {background-color: #FFFF15;}
|
|
146
|
+
.cython.score-112 {background-color: #FFFF14;}
|
|
147
|
+
.cython.score-113 {background-color: #FFFF14;}
|
|
148
|
+
.cython.score-114 {background-color: #FFFF14;}
|
|
149
|
+
.cython.score-115 {background-color: #FFFF14;}
|
|
150
|
+
.cython.score-116 {background-color: #FFFF14;}
|
|
151
|
+
.cython.score-117 {background-color: #FFFF14;}
|
|
152
|
+
.cython.score-118 {background-color: #FFFF13;}
|
|
153
|
+
.cython.score-119 {background-color: #FFFF13;}
|
|
154
|
+
.cython.score-120 {background-color: #FFFF13;}
|
|
155
|
+
.cython.score-121 {background-color: #FFFF13;}
|
|
156
|
+
.cython.score-122 {background-color: #FFFF13;}
|
|
157
|
+
.cython.score-123 {background-color: #FFFF13;}
|
|
158
|
+
.cython.score-124 {background-color: #FFFF13;}
|
|
159
|
+
.cython.score-125 {background-color: #FFFF12;}
|
|
160
|
+
.cython.score-126 {background-color: #FFFF12;}
|
|
161
|
+
.cython.score-127 {background-color: #FFFF12;}
|
|
162
|
+
.cython.score-128 {background-color: #FFFF12;}
|
|
163
|
+
.cython.score-129 {background-color: #FFFF12;}
|
|
164
|
+
.cython.score-130 {background-color: #FFFF12;}
|
|
165
|
+
.cython.score-131 {background-color: #FFFF12;}
|
|
166
|
+
.cython.score-132 {background-color: #FFFF11;}
|
|
167
|
+
.cython.score-133 {background-color: #FFFF11;}
|
|
168
|
+
.cython.score-134 {background-color: #FFFF11;}
|
|
169
|
+
.cython.score-135 {background-color: #FFFF11;}
|
|
170
|
+
.cython.score-136 {background-color: #FFFF11;}
|
|
171
|
+
.cython.score-137 {background-color: #FFFF11;}
|
|
172
|
+
.cython.score-138 {background-color: #FFFF11;}
|
|
173
|
+
.cython.score-139 {background-color: #FFFF11;}
|
|
174
|
+
.cython.score-140 {background-color: #FFFF11;}
|
|
175
|
+
.cython.score-141 {background-color: #FFFF10;}
|
|
176
|
+
.cython.score-142 {background-color: #FFFF10;}
|
|
177
|
+
.cython.score-143 {background-color: #FFFF10;}
|
|
178
|
+
.cython.score-144 {background-color: #FFFF10;}
|
|
179
|
+
.cython.score-145 {background-color: #FFFF10;}
|
|
180
|
+
.cython.score-146 {background-color: #FFFF10;}
|
|
181
|
+
.cython.score-147 {background-color: #FFFF10;}
|
|
182
|
+
.cython.score-148 {background-color: #FFFF10;}
|
|
183
|
+
.cython.score-149 {background-color: #FFFF10;}
|
|
184
|
+
.cython.score-150 {background-color: #FFFF0f;}
|
|
185
|
+
.cython.score-151 {background-color: #FFFF0f;}
|
|
186
|
+
.cython.score-152 {background-color: #FFFF0f;}
|
|
187
|
+
.cython.score-153 {background-color: #FFFF0f;}
|
|
188
|
+
.cython.score-154 {background-color: #FFFF0f;}
|
|
189
|
+
.cython.score-155 {background-color: #FFFF0f;}
|
|
190
|
+
.cython.score-156 {background-color: #FFFF0f;}
|
|
191
|
+
.cython.score-157 {background-color: #FFFF0f;}
|
|
192
|
+
.cython.score-158 {background-color: #FFFF0f;}
|
|
193
|
+
.cython.score-159 {background-color: #FFFF0f;}
|
|
194
|
+
.cython.score-160 {background-color: #FFFF0f;}
|
|
195
|
+
.cython.score-161 {background-color: #FFFF0e;}
|
|
196
|
+
.cython.score-162 {background-color: #FFFF0e;}
|
|
197
|
+
.cython.score-163 {background-color: #FFFF0e;}
|
|
198
|
+
.cython.score-164 {background-color: #FFFF0e;}
|
|
199
|
+
.cython.score-165 {background-color: #FFFF0e;}
|
|
200
|
+
.cython.score-166 {background-color: #FFFF0e;}
|
|
201
|
+
.cython.score-167 {background-color: #FFFF0e;}
|
|
202
|
+
.cython.score-168 {background-color: #FFFF0e;}
|
|
203
|
+
.cython.score-169 {background-color: #FFFF0e;}
|
|
204
|
+
.cython.score-170 {background-color: #FFFF0e;}
|
|
205
|
+
.cython.score-171 {background-color: #FFFF0e;}
|
|
206
|
+
.cython.score-172 {background-color: #FFFF0e;}
|
|
207
|
+
.cython.score-173 {background-color: #FFFF0d;}
|
|
208
|
+
.cython.score-174 {background-color: #FFFF0d;}
|
|
209
|
+
.cython.score-175 {background-color: #FFFF0d;}
|
|
210
|
+
.cython.score-176 {background-color: #FFFF0d;}
|
|
211
|
+
.cython.score-177 {background-color: #FFFF0d;}
|
|
212
|
+
.cython.score-178 {background-color: #FFFF0d;}
|
|
213
|
+
.cython.score-179 {background-color: #FFFF0d;}
|
|
214
|
+
.cython.score-180 {background-color: #FFFF0d;}
|
|
215
|
+
.cython.score-181 {background-color: #FFFF0d;}
|
|
216
|
+
.cython.score-182 {background-color: #FFFF0d;}
|
|
217
|
+
.cython.score-183 {background-color: #FFFF0d;}
|
|
218
|
+
.cython.score-184 {background-color: #FFFF0d;}
|
|
219
|
+
.cython.score-185 {background-color: #FFFF0d;}
|
|
220
|
+
.cython.score-186 {background-color: #FFFF0d;}
|
|
221
|
+
.cython.score-187 {background-color: #FFFF0c;}
|
|
222
|
+
.cython.score-188 {background-color: #FFFF0c;}
|
|
223
|
+
.cython.score-189 {background-color: #FFFF0c;}
|
|
224
|
+
.cython.score-190 {background-color: #FFFF0c;}
|
|
225
|
+
.cython.score-191 {background-color: #FFFF0c;}
|
|
226
|
+
.cython.score-192 {background-color: #FFFF0c;}
|
|
227
|
+
.cython.score-193 {background-color: #FFFF0c;}
|
|
228
|
+
.cython.score-194 {background-color: #FFFF0c;}
|
|
229
|
+
.cython.score-195 {background-color: #FFFF0c;}
|
|
230
|
+
.cython.score-196 {background-color: #FFFF0c;}
|
|
231
|
+
.cython.score-197 {background-color: #FFFF0c;}
|
|
232
|
+
.cython.score-198 {background-color: #FFFF0c;}
|
|
233
|
+
.cython.score-199 {background-color: #FFFF0c;}
|
|
234
|
+
.cython.score-200 {background-color: #FFFF0c;}
|
|
235
|
+
.cython.score-201 {background-color: #FFFF0c;}
|
|
236
|
+
.cython.score-202 {background-color: #FFFF0c;}
|
|
237
|
+
.cython.score-203 {background-color: #FFFF0b;}
|
|
238
|
+
.cython.score-204 {background-color: #FFFF0b;}
|
|
239
|
+
.cython.score-205 {background-color: #FFFF0b;}
|
|
240
|
+
.cython.score-206 {background-color: #FFFF0b;}
|
|
241
|
+
.cython.score-207 {background-color: #FFFF0b;}
|
|
242
|
+
.cython.score-208 {background-color: #FFFF0b;}
|
|
243
|
+
.cython.score-209 {background-color: #FFFF0b;}
|
|
244
|
+
.cython.score-210 {background-color: #FFFF0b;}
|
|
245
|
+
.cython.score-211 {background-color: #FFFF0b;}
|
|
246
|
+
.cython.score-212 {background-color: #FFFF0b;}
|
|
247
|
+
.cython.score-213 {background-color: #FFFF0b;}
|
|
248
|
+
.cython.score-214 {background-color: #FFFF0b;}
|
|
249
|
+
.cython.score-215 {background-color: #FFFF0b;}
|
|
250
|
+
.cython.score-216 {background-color: #FFFF0b;}
|
|
251
|
+
.cython.score-217 {background-color: #FFFF0b;}
|
|
252
|
+
.cython.score-218 {background-color: #FFFF0b;}
|
|
253
|
+
.cython.score-219 {background-color: #FFFF0b;}
|
|
254
|
+
.cython.score-220 {background-color: #FFFF0b;}
|
|
255
|
+
.cython.score-221 {background-color: #FFFF0b;}
|
|
256
|
+
.cython.score-222 {background-color: #FFFF0a;}
|
|
257
|
+
.cython.score-223 {background-color: #FFFF0a;}
|
|
258
|
+
.cython.score-224 {background-color: #FFFF0a;}
|
|
259
|
+
.cython.score-225 {background-color: #FFFF0a;}
|
|
260
|
+
.cython.score-226 {background-color: #FFFF0a;}
|
|
261
|
+
.cython.score-227 {background-color: #FFFF0a;}
|
|
262
|
+
.cython.score-228 {background-color: #FFFF0a;}
|
|
263
|
+
.cython.score-229 {background-color: #FFFF0a;}
|
|
264
|
+
.cython.score-230 {background-color: #FFFF0a;}
|
|
265
|
+
.cython.score-231 {background-color: #FFFF0a;}
|
|
266
|
+
.cython.score-232 {background-color: #FFFF0a;}
|
|
267
|
+
.cython.score-233 {background-color: #FFFF0a;}
|
|
268
|
+
.cython.score-234 {background-color: #FFFF0a;}
|
|
269
|
+
.cython.score-235 {background-color: #FFFF0a;}
|
|
270
|
+
.cython.score-236 {background-color: #FFFF0a;}
|
|
271
|
+
.cython.score-237 {background-color: #FFFF0a;}
|
|
272
|
+
.cython.score-238 {background-color: #FFFF0a;}
|
|
273
|
+
.cython.score-239 {background-color: #FFFF0a;}
|
|
274
|
+
.cython.score-240 {background-color: #FFFF0a;}
|
|
275
|
+
.cython.score-241 {background-color: #FFFF0a;}
|
|
276
|
+
.cython.score-242 {background-color: #FFFF0a;}
|
|
277
|
+
.cython.score-243 {background-color: #FFFF0a;}
|
|
278
|
+
.cython.score-244 {background-color: #FFFF0a;}
|
|
279
|
+
.cython.score-245 {background-color: #FFFF0a;}
|
|
280
|
+
.cython.score-246 {background-color: #FFFF09;}
|
|
281
|
+
.cython.score-247 {background-color: #FFFF09;}
|
|
282
|
+
.cython.score-248 {background-color: #FFFF09;}
|
|
283
|
+
.cython.score-249 {background-color: #FFFF09;}
|
|
284
|
+
.cython.score-250 {background-color: #FFFF09;}
|
|
285
|
+
.cython.score-251 {background-color: #FFFF09;}
|
|
286
|
+
.cython.score-252 {background-color: #FFFF09;}
|
|
287
|
+
.cython.score-253 {background-color: #FFFF09;}
|
|
288
|
+
.cython.score-254 {background-color: #FFFF09;}
|
|
289
|
+
</style>
|
|
290
|
+
</head>
|
|
291
|
+
<body class="cython">
|
|
292
|
+
<p><span style="border-bottom: solid 1px grey;">Generated by Cython 3.0.11</span></p>
|
|
293
|
+
<p>
|
|
294
|
+
<span style="background-color: #FFFF00">Yellow lines</span> hint at Python interaction.<br />
|
|
295
|
+
Click on a line that starts with a "<code>+</code>" to see the C code that Cython generated for it.
|
|
296
|
+
</p>
|
|
297
|
+
<p>Raw output: <a href="json.cpp">json.cpp</a></p>
|
|
298
|
+
<div class="cython"><pre class="cython line score-8" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">001</span>: # cython: language_level=3, embedsignature=True, boundscheck=False, wraparound=True, initializedcheck=False</pre>
|
|
299
|
+
<pre class='cython code score-8 '> __pyx_t_4 = <span class='pyx_c_api'>__Pyx_PyDict_NewPresized</span>(0);<span class='error_goto'> if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1, __pyx_L1_error)</span>
|
|
300
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4);
|
|
301
|
+
if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_d, __pyx_n_s_test, __pyx_t_4) < 0) <span class='error_goto'>__PYX_ERR(0, 1, __pyx_L1_error)</span>
|
|
302
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_4); __pyx_t_4 = 0;
|
|
303
|
+
</pre><pre class="cython line score-0"> <span class="">002</span>: # Copyright (C) 2018-present Jesus Lara</pre>
|
|
304
|
+
<pre class="cython line score-0"> <span class="">003</span>: #</pre>
|
|
305
|
+
<pre class="cython line score-0"> <span class="">004</span>: """</pre>
|
|
306
|
+
<pre class="cython line score-0"> <span class="">005</span>: Module for JSON encoding and decoding using orjson with custom type handling.</pre>
|
|
307
|
+
<pre class="cython line score-0"> <span class="">006</span>: </pre>
|
|
308
|
+
<pre class="cython line score-0"> <span class="">007</span>: This module provides the JSONContent class, which extends orjson's functionality to</pre>
|
|
309
|
+
<pre class="cython line score-0"> <span class="">008</span>: support additional types (e.g., Decimal, datetime, custom Enum types, etc.), and a BaseEncoder</pre>
|
|
310
|
+
<pre class="cython line score-0"> <span class="">009</span>: class as a drop-in replacement for json.dumps.</pre>
|
|
311
|
+
<pre class="cython line score-0"> <span class="">010</span>: """</pre>
|
|
312
|
+
<pre class="cython line score-8" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">011</span>: import uuid</pre>
|
|
313
|
+
<pre class='cython code score-8 '> __pyx_t_2 = <span class='pyx_c_api'>__Pyx_ImportDottedModule</span>(__pyx_n_s_uuid, NULL);<span class='error_goto'> if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 11, __pyx_L1_error)</span>
|
|
314
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_2);
|
|
315
|
+
if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_d, __pyx_n_s_uuid, __pyx_t_2) < 0) <span class='error_goto'>__PYX_ERR(0, 11, __pyx_L1_error)</span>
|
|
316
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;
|
|
317
|
+
</pre><pre class="cython line score-42" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">012</span>: from pathlib import PosixPath, PurePath, Path</pre>
|
|
318
|
+
<pre class='cython code score-42 '> __pyx_t_2 = <span class='py_c_api'>PyList_New</span>(3);<span class='error_goto'> if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 12, __pyx_L1_error)</span>
|
|
319
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_2);
|
|
320
|
+
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_n_s_PosixPath);
|
|
321
|
+
<span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_n_s_PosixPath);
|
|
322
|
+
if (<span class='pyx_c_api'>__Pyx_PyList_SET_ITEM</span>(__pyx_t_2, 0, __pyx_n_s_PosixPath)) <span class='error_goto'>__PYX_ERR(0, 12, __pyx_L1_error)</span>;
|
|
323
|
+
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_n_s_PurePath);
|
|
324
|
+
<span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_n_s_PurePath);
|
|
325
|
+
if (<span class='pyx_c_api'>__Pyx_PyList_SET_ITEM</span>(__pyx_t_2, 1, __pyx_n_s_PurePath)) <span class='error_goto'>__PYX_ERR(0, 12, __pyx_L1_error)</span>;
|
|
326
|
+
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_n_s_Path);
|
|
327
|
+
<span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_n_s_Path);
|
|
328
|
+
if (<span class='pyx_c_api'>__Pyx_PyList_SET_ITEM</span>(__pyx_t_2, 2, __pyx_n_s_Path)) <span class='error_goto'>__PYX_ERR(0, 12, __pyx_L1_error)</span>;
|
|
329
|
+
__pyx_t_3 = <span class='pyx_c_api'>__Pyx_Import</span>(__pyx_n_s_pathlib, __pyx_t_2, 0);<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 12, __pyx_L1_error)</span>
|
|
330
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
331
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;
|
|
332
|
+
__pyx_t_2 = <span class='pyx_c_api'>__Pyx_ImportFrom</span>(__pyx_t_3, __pyx_n_s_PosixPath);<span class='error_goto'> if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 12, __pyx_L1_error)</span>
|
|
333
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_2);
|
|
334
|
+
if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_d, __pyx_n_s_PosixPath, __pyx_t_2) < 0) <span class='error_goto'>__PYX_ERR(0, 12, __pyx_L1_error)</span>
|
|
335
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;
|
|
336
|
+
__pyx_t_2 = <span class='pyx_c_api'>__Pyx_ImportFrom</span>(__pyx_t_3, __pyx_n_s_PurePath);<span class='error_goto'> if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 12, __pyx_L1_error)</span>
|
|
337
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_2);
|
|
338
|
+
if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_d, __pyx_n_s_PurePath, __pyx_t_2) < 0) <span class='error_goto'>__PYX_ERR(0, 12, __pyx_L1_error)</span>
|
|
339
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;
|
|
340
|
+
__pyx_t_2 = <span class='pyx_c_api'>__Pyx_ImportFrom</span>(__pyx_t_3, __pyx_n_s_Path);<span class='error_goto'> if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 12, __pyx_L1_error)</span>
|
|
341
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_2);
|
|
342
|
+
if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_d, __pyx_n_s_Path, __pyx_t_2) < 0) <span class='error_goto'>__PYX_ERR(0, 12, __pyx_L1_error)</span>
|
|
343
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;
|
|
344
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
|
|
345
|
+
</pre><pre class="cython line score-20" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">013</span>: from datetime import datetime</pre>
|
|
346
|
+
<pre class='cython code score-20 '> __pyx_t_3 = <span class='py_c_api'>PyList_New</span>(1);<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 13, __pyx_L1_error)</span>
|
|
347
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
348
|
+
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_n_s_datetime);
|
|
349
|
+
<span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_n_s_datetime);
|
|
350
|
+
if (<span class='pyx_c_api'>__Pyx_PyList_SET_ITEM</span>(__pyx_t_3, 0, __pyx_n_s_datetime)) <span class='error_goto'>__PYX_ERR(0, 13, __pyx_L1_error)</span>;
|
|
351
|
+
__pyx_t_2 = <span class='pyx_c_api'>__Pyx_Import</span>(__pyx_n_s_datetime, __pyx_t_3, 0);<span class='error_goto'> if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 13, __pyx_L1_error)</span>
|
|
352
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_2);
|
|
353
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
|
|
354
|
+
__pyx_t_3 = <span class='pyx_c_api'>__Pyx_ImportFrom</span>(__pyx_t_2, __pyx_n_s_datetime);<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 13, __pyx_L1_error)</span>
|
|
355
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
356
|
+
if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_d, __pyx_n_s_datetime, __pyx_t_3) < 0) <span class='error_goto'>__PYX_ERR(0, 13, __pyx_L1_error)</span>
|
|
357
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
|
|
358
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;
|
|
359
|
+
</pre><pre class="cython line score-20" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">014</span>: from asyncpg.pgproto import pgproto</pre>
|
|
360
|
+
<pre class='cython code score-20 '> __pyx_t_2 = <span class='py_c_api'>PyList_New</span>(1);<span class='error_goto'> if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 14, __pyx_L1_error)</span>
|
|
361
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_2);
|
|
362
|
+
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_n_s_pgproto);
|
|
363
|
+
<span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_n_s_pgproto);
|
|
364
|
+
if (<span class='pyx_c_api'>__Pyx_PyList_SET_ITEM</span>(__pyx_t_2, 0, __pyx_n_s_pgproto)) <span class='error_goto'>__PYX_ERR(0, 14, __pyx_L1_error)</span>;
|
|
365
|
+
__pyx_t_3 = <span class='pyx_c_api'>__Pyx_Import</span>(__pyx_n_s_asyncpg_pgproto, __pyx_t_2, 0);<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 14, __pyx_L1_error)</span>
|
|
366
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
367
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;
|
|
368
|
+
__pyx_t_2 = <span class='pyx_c_api'>__Pyx_ImportFrom</span>(__pyx_t_3, __pyx_n_s_pgproto);<span class='error_goto'> if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 14, __pyx_L1_error)</span>
|
|
369
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_2);
|
|
370
|
+
if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_d, __pyx_n_s_pgproto, __pyx_t_2) < 0) <span class='error_goto'>__PYX_ERR(0, 14, __pyx_L1_error)</span>
|
|
371
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;
|
|
372
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
|
|
373
|
+
</pre><pre class="cython line score-20" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">015</span>: from psycopg2 import Binary</pre>
|
|
374
|
+
<pre class='cython code score-20 '> __pyx_t_3 = <span class='py_c_api'>PyList_New</span>(1);<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 15, __pyx_L1_error)</span>
|
|
375
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
376
|
+
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_n_s_Binary);
|
|
377
|
+
<span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_n_s_Binary);
|
|
378
|
+
if (<span class='pyx_c_api'>__Pyx_PyList_SET_ITEM</span>(__pyx_t_3, 0, __pyx_n_s_Binary)) <span class='error_goto'>__PYX_ERR(0, 15, __pyx_L1_error)</span>;
|
|
379
|
+
__pyx_t_2 = <span class='pyx_c_api'>__Pyx_Import</span>(__pyx_n_s_psycopg2, __pyx_t_3, 0);<span class='error_goto'> if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 15, __pyx_L1_error)</span>
|
|
380
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_2);
|
|
381
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
|
|
382
|
+
__pyx_t_3 = <span class='pyx_c_api'>__Pyx_ImportFrom</span>(__pyx_t_2, __pyx_n_s_Binary);<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 15, __pyx_L1_error)</span>
|
|
383
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
384
|
+
if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_d, __pyx_n_s_Binary, __pyx_t_3) < 0) <span class='error_goto'>__PYX_ERR(0, 15, __pyx_L1_error)</span>
|
|
385
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
|
|
386
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;
|
|
387
|
+
</pre><pre class="cython line score-0"> <span class="">016</span>: from cpython cimport PyErr_Clear</pre>
|
|
388
|
+
<pre class="cython line score-0"> <span class="">017</span>: from cpython.object cimport (</pre>
|
|
389
|
+
<pre class="cython line score-0"> <span class="">018</span>: PyObject_IsInstance,</pre>
|
|
390
|
+
<pre class="cython line score-0"> <span class="">019</span>: PyObject_IsSubclass,</pre>
|
|
391
|
+
<pre class="cython line score-0"> <span class="">020</span>: PyObject_TypeCheck,</pre>
|
|
392
|
+
<pre class="cython line score-0"> <span class="">021</span>: PyObject_HasAttr,</pre>
|
|
393
|
+
<pre class="cython line score-0"> <span class="">022</span>: PyObject_GetAttr,</pre>
|
|
394
|
+
<pre class="cython line score-0"> <span class="">023</span>: PyCallable_Check</pre>
|
|
395
|
+
<pre class="cython line score-0"> <span class="">024</span>: )</pre>
|
|
396
|
+
<pre class="cython line score-42" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">025</span>: from dataclasses import _MISSING_TYPE, MISSING, InitVar</pre>
|
|
397
|
+
<pre class='cython code score-42 '> __pyx_t_2 = <span class='py_c_api'>PyList_New</span>(3);<span class='error_goto'> if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 25, __pyx_L1_error)</span>
|
|
398
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_2);
|
|
399
|
+
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_n_s_MISSING_TYPE);
|
|
400
|
+
<span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_n_s_MISSING_TYPE);
|
|
401
|
+
if (<span class='pyx_c_api'>__Pyx_PyList_SET_ITEM</span>(__pyx_t_2, 0, __pyx_n_s_MISSING_TYPE)) <span class='error_goto'>__PYX_ERR(0, 25, __pyx_L1_error)</span>;
|
|
402
|
+
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_n_s_MISSING);
|
|
403
|
+
<span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_n_s_MISSING);
|
|
404
|
+
if (<span class='pyx_c_api'>__Pyx_PyList_SET_ITEM</span>(__pyx_t_2, 1, __pyx_n_s_MISSING)) <span class='error_goto'>__PYX_ERR(0, 25, __pyx_L1_error)</span>;
|
|
405
|
+
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_n_s_InitVar);
|
|
406
|
+
<span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_n_s_InitVar);
|
|
407
|
+
if (<span class='pyx_c_api'>__Pyx_PyList_SET_ITEM</span>(__pyx_t_2, 2, __pyx_n_s_InitVar)) <span class='error_goto'>__PYX_ERR(0, 25, __pyx_L1_error)</span>;
|
|
408
|
+
__pyx_t_3 = <span class='pyx_c_api'>__Pyx_Import</span>(__pyx_n_s_dataclasses, __pyx_t_2, 0);<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 25, __pyx_L1_error)</span>
|
|
409
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
410
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;
|
|
411
|
+
__pyx_t_2 = <span class='pyx_c_api'>__Pyx_ImportFrom</span>(__pyx_t_3, __pyx_n_s_MISSING_TYPE);<span class='error_goto'> if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 25, __pyx_L1_error)</span>
|
|
412
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_2);
|
|
413
|
+
if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_d, __pyx_n_s_MISSING_TYPE, __pyx_t_2) < 0) <span class='error_goto'>__PYX_ERR(0, 25, __pyx_L1_error)</span>
|
|
414
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;
|
|
415
|
+
__pyx_t_2 = <span class='pyx_c_api'>__Pyx_ImportFrom</span>(__pyx_t_3, __pyx_n_s_MISSING);<span class='error_goto'> if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 25, __pyx_L1_error)</span>
|
|
416
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_2);
|
|
417
|
+
if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_d, __pyx_n_s_MISSING, __pyx_t_2) < 0) <span class='error_goto'>__PYX_ERR(0, 25, __pyx_L1_error)</span>
|
|
418
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;
|
|
419
|
+
__pyx_t_2 = <span class='pyx_c_api'>__Pyx_ImportFrom</span>(__pyx_t_3, __pyx_n_s_InitVar);<span class='error_goto'> if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 25, __pyx_L1_error)</span>
|
|
420
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_2);
|
|
421
|
+
if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_d, __pyx_n_s_InitVar, __pyx_t_2) < 0) <span class='error_goto'>__PYX_ERR(0, 25, __pyx_L1_error)</span>
|
|
422
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;
|
|
423
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
|
|
424
|
+
</pre><pre class="cython line score-31" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">026</span>: from typing import Any, Union</pre>
|
|
425
|
+
<pre class='cython code score-31 '> __pyx_t_3 = <span class='py_c_api'>PyList_New</span>(2);<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 26, __pyx_L1_error)</span>
|
|
426
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
427
|
+
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_n_s_Any);
|
|
428
|
+
<span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_n_s_Any);
|
|
429
|
+
if (<span class='pyx_c_api'>__Pyx_PyList_SET_ITEM</span>(__pyx_t_3, 0, __pyx_n_s_Any)) <span class='error_goto'>__PYX_ERR(0, 26, __pyx_L1_error)</span>;
|
|
430
|
+
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_n_s_Union);
|
|
431
|
+
<span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_n_s_Union);
|
|
432
|
+
if (<span class='pyx_c_api'>__Pyx_PyList_SET_ITEM</span>(__pyx_t_3, 1, __pyx_n_s_Union)) <span class='error_goto'>__PYX_ERR(0, 26, __pyx_L1_error)</span>;
|
|
433
|
+
__pyx_t_2 = <span class='pyx_c_api'>__Pyx_Import</span>(__pyx_n_s_typing, __pyx_t_3, 0);<span class='error_goto'> if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 26, __pyx_L1_error)</span>
|
|
434
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_2);
|
|
435
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
|
|
436
|
+
__pyx_t_3 = <span class='pyx_c_api'>__Pyx_ImportFrom</span>(__pyx_t_2, __pyx_n_s_Any);<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 26, __pyx_L1_error)</span>
|
|
437
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
438
|
+
if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_d, __pyx_n_s_Any, __pyx_t_3) < 0) <span class='error_goto'>__PYX_ERR(0, 26, __pyx_L1_error)</span>
|
|
439
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
|
|
440
|
+
__pyx_t_3 = <span class='pyx_c_api'>__Pyx_ImportFrom</span>(__pyx_t_2, __pyx_n_s_Union);<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 26, __pyx_L1_error)</span>
|
|
441
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
442
|
+
if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_d, __pyx_n_s_Union, __pyx_t_3) < 0) <span class='error_goto'>__PYX_ERR(0, 26, __pyx_L1_error)</span>
|
|
443
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
|
|
444
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;
|
|
445
|
+
</pre><pre class="cython line score-20" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">027</span>: from decimal import Decimal</pre>
|
|
446
|
+
<pre class='cython code score-20 '> __pyx_t_2 = <span class='py_c_api'>PyList_New</span>(1);<span class='error_goto'> if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 27, __pyx_L1_error)</span>
|
|
447
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_2);
|
|
448
|
+
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_n_s_Decimal);
|
|
449
|
+
<span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_n_s_Decimal);
|
|
450
|
+
if (<span class='pyx_c_api'>__Pyx_PyList_SET_ITEM</span>(__pyx_t_2, 0, __pyx_n_s_Decimal)) <span class='error_goto'>__PYX_ERR(0, 27, __pyx_L1_error)</span>;
|
|
451
|
+
__pyx_t_3 = <span class='pyx_c_api'>__Pyx_Import</span>(__pyx_n_s_decimal, __pyx_t_2, 0);<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 27, __pyx_L1_error)</span>
|
|
452
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
453
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;
|
|
454
|
+
__pyx_t_2 = <span class='pyx_c_api'>__Pyx_ImportFrom</span>(__pyx_t_3, __pyx_n_s_Decimal);<span class='error_goto'> if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 27, __pyx_L1_error)</span>
|
|
455
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_2);
|
|
456
|
+
if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_d, __pyx_n_s_Decimal, __pyx_t_2) < 0) <span class='error_goto'>__PYX_ERR(0, 27, __pyx_L1_error)</span>
|
|
457
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;
|
|
458
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
|
|
459
|
+
</pre><pre class="cython line score-31" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">028</span>: from enum import Enum, EnumType</pre>
|
|
460
|
+
<pre class='cython code score-31 '> __pyx_t_3 = <span class='py_c_api'>PyList_New</span>(2);<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 28, __pyx_L1_error)</span>
|
|
461
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
462
|
+
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_n_s_Enum);
|
|
463
|
+
<span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_n_s_Enum);
|
|
464
|
+
if (<span class='pyx_c_api'>__Pyx_PyList_SET_ITEM</span>(__pyx_t_3, 0, __pyx_n_s_Enum)) <span class='error_goto'>__PYX_ERR(0, 28, __pyx_L1_error)</span>;
|
|
465
|
+
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_n_s_EnumType);
|
|
466
|
+
<span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_n_s_EnumType);
|
|
467
|
+
if (<span class='pyx_c_api'>__Pyx_PyList_SET_ITEM</span>(__pyx_t_3, 1, __pyx_n_s_EnumType)) <span class='error_goto'>__PYX_ERR(0, 28, __pyx_L1_error)</span>;
|
|
468
|
+
__pyx_t_2 = <span class='pyx_c_api'>__Pyx_Import</span>(__pyx_n_s_enum, __pyx_t_3, 0);<span class='error_goto'> if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 28, __pyx_L1_error)</span>
|
|
469
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_2);
|
|
470
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
|
|
471
|
+
__pyx_t_3 = <span class='pyx_c_api'>__Pyx_ImportFrom</span>(__pyx_t_2, __pyx_n_s_Enum);<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 28, __pyx_L1_error)</span>
|
|
472
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
473
|
+
if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_d, __pyx_n_s_Enum, __pyx_t_3) < 0) <span class='error_goto'>__PYX_ERR(0, 28, __pyx_L1_error)</span>
|
|
474
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
|
|
475
|
+
__pyx_t_3 = <span class='pyx_c_api'>__Pyx_ImportFrom</span>(__pyx_t_2, __pyx_n_s_EnumType);<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 28, __pyx_L1_error)</span>
|
|
476
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
477
|
+
if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_d, __pyx_n_s_EnumType, __pyx_t_3) < 0) <span class='error_goto'>__PYX_ERR(0, 28, __pyx_L1_error)</span>
|
|
478
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
|
|
479
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;
|
|
480
|
+
</pre><pre class="cython line score-8" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">029</span>: import orjson</pre>
|
|
481
|
+
<pre class='cython code score-8 '> __pyx_t_2 = <span class='pyx_c_api'>__Pyx_ImportDottedModule</span>(__pyx_n_s_orjson, NULL);<span class='error_goto'> if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 29, __pyx_L1_error)</span>
|
|
482
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_2);
|
|
483
|
+
if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_d, __pyx_n_s_orjson, __pyx_t_2) < 0) <span class='error_goto'>__PYX_ERR(0, 29, __pyx_L1_error)</span>
|
|
484
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;
|
|
485
|
+
</pre><pre class="cython line score-0"> <span class="">030</span>: from ..exceptions cimport ParserError</pre>
|
|
486
|
+
<pre class="cython line score-20" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">031</span>: from ..fields import Field</pre>
|
|
487
|
+
<pre class='cython code score-20 '> __pyx_t_2 = <span class='py_c_api'>PyList_New</span>(1);<span class='error_goto'> if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 31, __pyx_L1_error)</span>
|
|
488
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_2);
|
|
489
|
+
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_n_s_Field);
|
|
490
|
+
<span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_n_s_Field);
|
|
491
|
+
if (<span class='pyx_c_api'>__Pyx_PyList_SET_ITEM</span>(__pyx_t_2, 0, __pyx_n_s_Field)) <span class='error_goto'>__PYX_ERR(0, 31, __pyx_L1_error)</span>;
|
|
492
|
+
__pyx_t_3 = <span class='pyx_c_api'>__Pyx_Import</span>(__pyx_n_s_fields, __pyx_t_2, 2);<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 31, __pyx_L1_error)</span>
|
|
493
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
494
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;
|
|
495
|
+
__pyx_t_2 = <span class='pyx_c_api'>__Pyx_ImportFrom</span>(__pyx_t_3, __pyx_n_s_Field);<span class='error_goto'> if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 31, __pyx_L1_error)</span>
|
|
496
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_2);
|
|
497
|
+
if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_d, __pyx_n_s_Field, __pyx_t_2) < 0) <span class='error_goto'>__PYX_ERR(0, 31, __pyx_L1_error)</span>
|
|
498
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;
|
|
499
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
|
|
500
|
+
</pre><pre class="cython line score-0"> <span class="">032</span>: </pre>
|
|
501
|
+
<pre class="cython line score-0"> <span class="">033</span>: </pre>
|
|
502
|
+
<pre class="cython line score-0" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">034</span>: cdef inline bint is_callable(object obj):</pre>
|
|
503
|
+
<pre class='cython code score-0 '>static CYTHON_INLINE int __pyx_f_9datamodel_7parsers_4json_is_callable(PyObject *__pyx_v_obj) {
|
|
504
|
+
int __pyx_v_res;
|
|
505
|
+
int __pyx_r;
|
|
506
|
+
/* … */
|
|
507
|
+
/* function exit code */
|
|
508
|
+
__pyx_L0:;
|
|
509
|
+
return __pyx_r;
|
|
510
|
+
}
|
|
511
|
+
</pre><pre class="cython line score-5" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">035</span>: cdef int res = PyCallable_Check(obj)</pre>
|
|
512
|
+
<pre class='cython code score-5 '> __pyx_v_res = <span class='py_c_api'>PyCallable_Check</span>(__pyx_v_obj);
|
|
513
|
+
</pre><pre class="cython line score-0"> <span class="">036</span>: # PyCallable_Check normally returns 1 or 0, but if an error occurs,</pre>
|
|
514
|
+
<pre class="cython line score-0"> <span class="">037</span>: # assume it's not callable.</pre>
|
|
515
|
+
<pre class="cython line score-0" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">038</span>: return res != 0</pre>
|
|
516
|
+
<pre class='cython code score-0 '> __pyx_r = (__pyx_v_res != 0);
|
|
517
|
+
goto __pyx_L0;
|
|
518
|
+
</pre><pre class="cython line score-0"> <span class="">039</span>: </pre>
|
|
519
|
+
<pre class="cython line score-0"> <span class="">040</span>: </pre>
|
|
520
|
+
<pre class="cython line score-0" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">041</span>: cdef inline bint has_attribute(object obj, str name):</pre>
|
|
521
|
+
<pre class='cython code score-0 '>static CYTHON_INLINE int __pyx_f_9datamodel_7parsers_4json_has_attribute(PyObject *__pyx_v_obj, PyObject *__pyx_v_name) {
|
|
522
|
+
int __pyx_v_result;
|
|
523
|
+
int __pyx_r;
|
|
524
|
+
/* … */
|
|
525
|
+
/* function exit code */
|
|
526
|
+
__pyx_L0:;
|
|
527
|
+
return __pyx_r;
|
|
528
|
+
}
|
|
529
|
+
</pre><pre class="cython line score-5" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">042</span>: cdef int result = PyObject_HasAttr(obj, name)</pre>
|
|
530
|
+
<pre class='cython code score-5 '> __pyx_v_result = <span class='py_c_api'>PyObject_HasAttr</span>(__pyx_v_obj, __pyx_v_name);
|
|
531
|
+
</pre><pre class="cython line score-0" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">043</span>: if result < 0:</pre>
|
|
532
|
+
<pre class='cython code score-0 '> __pyx_t_1 = (__pyx_v_result < 0);
|
|
533
|
+
if (__pyx_t_1) {
|
|
534
|
+
/* … */
|
|
535
|
+
}
|
|
536
|
+
</pre><pre class="cython line score-5" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">044</span>: PyErr_Clear() # Clear any error that occurred</pre>
|
|
537
|
+
<pre class='cython code score-5 '> <span class='py_c_api'>PyErr_Clear</span>();
|
|
538
|
+
</pre><pre class="cython line score-0" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">045</span>: return False</pre>
|
|
539
|
+
<pre class='cython code score-0 '> __pyx_r = 0;
|
|
540
|
+
goto __pyx_L0;
|
|
541
|
+
</pre><pre class="cython line score-0" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">046</span>: return result != 0</pre>
|
|
542
|
+
<pre class='cython code score-0 '> __pyx_r = (__pyx_v_result != 0);
|
|
543
|
+
goto __pyx_L0;
|
|
544
|
+
</pre><pre class="cython line score-0"> <span class="">047</span>: </pre>
|
|
545
|
+
<pre class="cython line score-0"> <span class="">048</span>: </pre>
|
|
546
|
+
<pre class="cython line score-4" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">049</span>: cdef inline object get_attribute(object obj, str name):</pre>
|
|
547
|
+
<pre class='cython code score-4 '>static CYTHON_INLINE PyObject *__pyx_f_9datamodel_7parsers_4json_get_attribute(PyObject *__pyx_v_obj, PyObject *__pyx_v_name) {
|
|
548
|
+
PyObject *__pyx_v_attr = 0;
|
|
549
|
+
PyObject *__pyx_r = NULL;
|
|
550
|
+
/* … */
|
|
551
|
+
/* function exit code */
|
|
552
|
+
__pyx_L1_error:;
|
|
553
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_1);
|
|
554
|
+
<span class='pyx_c_api'>__Pyx_AddTraceback</span>("datamodel.parsers.json.get_attribute", __pyx_clineno, __pyx_lineno, __pyx_filename);
|
|
555
|
+
__pyx_r = 0;
|
|
556
|
+
__pyx_L0:;
|
|
557
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_v_attr);
|
|
558
|
+
<span class='refnanny'>__Pyx_XGIVEREF</span>(__pyx_r);
|
|
559
|
+
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>();
|
|
560
|
+
return __pyx_r;
|
|
561
|
+
}
|
|
562
|
+
</pre><pre class="cython line score-5" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">050</span>: cdef object attr = PyObject_GetAttr(obj, name)</pre>
|
|
563
|
+
<pre class='cython code score-5 '> __pyx_t_1 = <span class='py_c_api'>PyObject_GetAttr</span>(__pyx_v_obj, __pyx_v_name);<span class='error_goto'> if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 50, __pyx_L1_error)</span>
|
|
564
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1);
|
|
565
|
+
__pyx_v_attr = __pyx_t_1;
|
|
566
|
+
__pyx_t_1 = 0;
|
|
567
|
+
</pre><pre class="cython line score-0" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">051</span>: if attr is None:</pre>
|
|
568
|
+
<pre class='cython code score-0 '> __pyx_t_2 = (__pyx_v_attr == Py_None);
|
|
569
|
+
if (__pyx_t_2) {
|
|
570
|
+
/* … */
|
|
571
|
+
}
|
|
572
|
+
</pre><pre class="cython line score-5" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">052</span>: PyErr_Clear() # Clear any error that occurred</pre>
|
|
573
|
+
<pre class='cython code score-5 '> <span class='py_c_api'>PyErr_Clear</span>();
|
|
574
|
+
</pre><pre class="cython line score-2" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">053</span>: return attr</pre>
|
|
575
|
+
<pre class='cython code score-2 '> <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_r);
|
|
576
|
+
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_v_attr);
|
|
577
|
+
__pyx_r = __pyx_v_attr;
|
|
578
|
+
goto __pyx_L0;
|
|
579
|
+
</pre><pre class="cython line score-0"> <span class="">054</span>: </pre>
|
|
580
|
+
<pre class="cython line score-0"> <span class="">055</span>: </pre>
|
|
581
|
+
<pre class="cython line score-2" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">056</span>: cdef inline bint is_subclassof(object obj, object cls):</pre>
|
|
582
|
+
<pre class='cython code score-2 '>static CYTHON_INLINE int __pyx_f_9datamodel_7parsers_4json_is_subclassof(PyObject *__pyx_v_obj, PyObject *__pyx_v_cls) {
|
|
583
|
+
int __pyx_v_res;
|
|
584
|
+
int __pyx_r;
|
|
585
|
+
/* … */
|
|
586
|
+
/* function exit code */
|
|
587
|
+
__pyx_L1_error:;
|
|
588
|
+
<span class='pyx_c_api'>__Pyx_AddTraceback</span>("datamodel.parsers.json.is_subclassof", __pyx_clineno, __pyx_lineno, __pyx_filename);
|
|
589
|
+
__pyx_r = -1;
|
|
590
|
+
__pyx_L0:;
|
|
591
|
+
return __pyx_r;
|
|
592
|
+
}
|
|
593
|
+
</pre><pre class="cython line score-5" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">057</span>: cdef int res = PyObject_IsSubclass(obj, cls)</pre>
|
|
594
|
+
<pre class='cython code score-5 '> __pyx_t_1 = <span class='py_c_api'>PyObject_IsSubclass</span>(__pyx_v_obj, __pyx_v_cls);<span class='error_goto'> if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 57, __pyx_L1_error)</span>
|
|
595
|
+
__pyx_v_res = __pyx_t_1;
|
|
596
|
+
</pre><pre class="cython line score-0" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">058</span>: if res < 0:</pre>
|
|
597
|
+
<pre class='cython code score-0 '> __pyx_t_1 = (__pyx_v_res < 0);
|
|
598
|
+
if (__pyx_t_1) {
|
|
599
|
+
/* … */
|
|
600
|
+
}
|
|
601
|
+
</pre><pre class="cython line score-5" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">059</span>: PyErr_Clear() # Clear error if subclass check fails</pre>
|
|
602
|
+
<pre class='cython code score-5 '> <span class='py_c_api'>PyErr_Clear</span>();
|
|
603
|
+
</pre><pre class="cython line score-0" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">060</span>: return False</pre>
|
|
604
|
+
<pre class='cython code score-0 '> __pyx_r = 0;
|
|
605
|
+
goto __pyx_L0;
|
|
606
|
+
</pre><pre class="cython line score-0" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">061</span>: return res != 0</pre>
|
|
607
|
+
<pre class='cython code score-0 '> __pyx_r = (__pyx_v_res != 0);
|
|
608
|
+
goto __pyx_L0;
|
|
609
|
+
</pre><pre class="cython line score-0"> <span class="">062</span>: </pre>
|
|
610
|
+
<pre class="cython line score-0"> <span class="">063</span>: </pre>
|
|
611
|
+
<pre class="cython line score-0"> <span class="">064</span>: ORJSON_DEFAULT_OPTIONS = (</pre>
|
|
612
|
+
<pre class="cython line score-18" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">065</span>: orjson.OPT_SERIALIZE_NUMPY |</pre>
|
|
613
|
+
<pre class='cython code score-18 '> <span class='pyx_c_api'>__Pyx_GetModuleGlobalName</span>(__pyx_t_3, __pyx_n_s_orjson);<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 65, __pyx_L1_error)</span>
|
|
614
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
615
|
+
__pyx_t_2 = <span class='pyx_c_api'>__Pyx_PyObject_GetAttrStr</span>(__pyx_t_3, __pyx_n_s_OPT_SERIALIZE_NUMPY);<span class='error_goto'> if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 65, __pyx_L1_error)</span>
|
|
616
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_2);
|
|
617
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
|
|
618
|
+
/* … */
|
|
619
|
+
__pyx_t_3 = <span class='py_c_api'>PyNumber_Or</span>(__pyx_t_2, __pyx_t_4);<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 65, __pyx_L1_error)</span>
|
|
620
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
621
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;
|
|
622
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_4); __pyx_t_4 = 0;
|
|
623
|
+
if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_d, __pyx_n_s_ORJSON_DEFAULT_OPTIONS, __pyx_t_3) < 0) <span class='error_goto'>__PYX_ERR(0, 64, __pyx_L1_error)</span>
|
|
624
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
|
|
625
|
+
</pre><pre class="cython line score-5" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">066</span>: orjson.OPT_UTC_Z</pre>
|
|
626
|
+
<pre class='cython code score-5 '> <span class='pyx_c_api'>__Pyx_GetModuleGlobalName</span>(__pyx_t_3, __pyx_n_s_orjson);<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 66, __pyx_L1_error)</span>
|
|
627
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
628
|
+
__pyx_t_4 = <span class='pyx_c_api'>__Pyx_PyObject_GetAttrStr</span>(__pyx_t_3, __pyx_n_s_OPT_UTC_Z);<span class='error_goto'> if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 66, __pyx_L1_error)</span>
|
|
629
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4);
|
|
630
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
|
|
631
|
+
</pre><pre class="cython line score-0"> <span class="">067</span>: # orjson.OPT_NON_STR_KEYS</pre>
|
|
632
|
+
<pre class="cython line score-0"> <span class="">068</span>: )</pre>
|
|
633
|
+
<pre class="cython line score-0"> <span class="">069</span>: </pre>
|
|
634
|
+
<pre class="cython line score-0"> <span class="">070</span>: </pre>
|
|
635
|
+
<pre class="cython line score-0" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">071</span>: cdef class JSONContent:</pre>
|
|
636
|
+
<pre class='cython code score-0 '>struct __pyx_obj_9datamodel_7parsers_4json_JSONContent {
|
|
637
|
+
PyObject_HEAD
|
|
638
|
+
};
|
|
639
|
+
|
|
640
|
+
</pre><pre class="cython line score-0"> <span class="">072</span>: """</pre>
|
|
641
|
+
<pre class="cython line score-0"> <span class="">073</span>: A basic JSON encoder/decoder using orjson.</pre>
|
|
642
|
+
<pre class="cython line score-0"> <span class="">074</span>: </pre>
|
|
643
|
+
<pre class="cython line score-0"> <span class="">075</span>: This class provides methods to serialize Python objects to JSON strings and deserialize</pre>
|
|
644
|
+
<pre class="cython line score-0"> <span class="">076</span>: JSON strings back into Python objects, with custom handling for additional data types.</pre>
|
|
645
|
+
<pre class="cython line score-0"> <span class="">077</span>: """</pre>
|
|
646
|
+
<pre class="cython line score-46" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">078</span>: def __call__(self, object obj, **kwargs):</pre>
|
|
647
|
+
<pre class='cython code score-46 '>/* Python wrapper */
|
|
648
|
+
static PyObject *__pyx_pw_9datamodel_7parsers_4json_11JSONContent_1__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
|
|
649
|
+
static PyObject *__pyx_pw_9datamodel_7parsers_4json_11JSONContent_1__call__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
|
|
650
|
+
PyObject *__pyx_v_obj = 0;
|
|
651
|
+
PyObject *__pyx_v_kwargs = 0;
|
|
652
|
+
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
|
|
653
|
+
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
|
|
654
|
+
PyObject *__pyx_r = 0;
|
|
655
|
+
<span class='refnanny'>__Pyx_RefNannyDeclarations</span>
|
|
656
|
+
<span class='refnanny'>__Pyx_RefNannySetupContext</span>("__call__ (wrapper)", 0);
|
|
657
|
+
#if CYTHON_ASSUME_SAFE_MACROS
|
|
658
|
+
__pyx_nargs = <span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args);
|
|
659
|
+
#else
|
|
660
|
+
__pyx_nargs = <span class='py_c_api'>PyTuple_Size</span>(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
|
|
661
|
+
#endif
|
|
662
|
+
__pyx_kwvalues = <span class='pyx_c_api'>__Pyx_KwValues_VARARGS</span>(__pyx_args, __pyx_nargs);
|
|
663
|
+
__pyx_v_kwargs = <span class='py_c_api'>PyDict_New</span>(); if (unlikely(!__pyx_v_kwargs)) return NULL;
|
|
664
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_v_kwargs);
|
|
665
|
+
{
|
|
666
|
+
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,0};
|
|
667
|
+
PyObject* values[1] = {0};
|
|
668
|
+
if (__pyx_kwds) {
|
|
669
|
+
Py_ssize_t kw_args;
|
|
670
|
+
switch (__pyx_nargs) {
|
|
671
|
+
case 1: values[0] = <span class='pyx_c_api'>__Pyx_Arg_VARARGS</span>(__pyx_args, 0);
|
|
672
|
+
CYTHON_FALLTHROUGH;
|
|
673
|
+
case 0: break;
|
|
674
|
+
default: goto __pyx_L5_argtuple_error;
|
|
675
|
+
}
|
|
676
|
+
kw_args = <span class='pyx_c_api'>__Pyx_NumKwargs_VARARGS</span>(__pyx_kwds);
|
|
677
|
+
switch (__pyx_nargs) {
|
|
678
|
+
case 0:
|
|
679
|
+
if (likely((values[0] = <span class='pyx_c_api'>__Pyx_GetKwValue_VARARGS</span>(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_obj)) != 0)) {
|
|
680
|
+
(void)<span class='pyx_c_api'>__Pyx_Arg_NewRef_VARARGS</span>(values[0]);
|
|
681
|
+
kw_args--;
|
|
682
|
+
}
|
|
683
|
+
else if (unlikely(<span class='py_c_api'>PyErr_Occurred</span>())) <span class='error_goto'>__PYX_ERR(0, 78, __pyx_L3_error)</span>
|
|
684
|
+
else goto __pyx_L5_argtuple_error;
|
|
685
|
+
}
|
|
686
|
+
if (unlikely(kw_args > 0)) {
|
|
687
|
+
const Py_ssize_t kwd_pos_args = __pyx_nargs;
|
|
688
|
+
if (unlikely(<span class='pyx_c_api'>__Pyx_ParseOptionalKeywords</span>(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v_kwargs, values + 0, kwd_pos_args, "__call__") < 0)) <span class='error_goto'>__PYX_ERR(0, 78, __pyx_L3_error)</span>
|
|
689
|
+
}
|
|
690
|
+
} else if (unlikely(__pyx_nargs != 1)) {
|
|
691
|
+
goto __pyx_L5_argtuple_error;
|
|
692
|
+
} else {
|
|
693
|
+
values[0] = <span class='pyx_c_api'>__Pyx_Arg_VARARGS</span>(__pyx_args, 0);
|
|
694
|
+
}
|
|
695
|
+
__pyx_v_obj = values[0];
|
|
696
|
+
}
|
|
697
|
+
goto __pyx_L6_skip;
|
|
698
|
+
__pyx_L5_argtuple_error:;
|
|
699
|
+
<span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>("__call__", 1, 1, 1, __pyx_nargs); <span class='error_goto'>__PYX_ERR(0, 78, __pyx_L3_error)</span>
|
|
700
|
+
__pyx_L6_skip:;
|
|
701
|
+
goto __pyx_L4_argument_unpacking_done;
|
|
702
|
+
__pyx_L3_error:;
|
|
703
|
+
{
|
|
704
|
+
Py_ssize_t __pyx_temp;
|
|
705
|
+
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
|
|
706
|
+
<span class='pyx_c_api'>__Pyx_Arg_XDECREF_VARARGS</span>(values[__pyx_temp]);
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_v_kwargs); __pyx_v_kwargs = 0;
|
|
710
|
+
<span class='pyx_c_api'>__Pyx_AddTraceback</span>("datamodel.parsers.json.JSONContent.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
|
|
711
|
+
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>();
|
|
712
|
+
return NULL;
|
|
713
|
+
__pyx_L4_argument_unpacking_done:;
|
|
714
|
+
__pyx_r = __pyx_pf_9datamodel_7parsers_4json_11JSONContent___call__(((struct __pyx_obj_9datamodel_7parsers_4json_JSONContent *)__pyx_v_self), __pyx_v_obj, __pyx_v_kwargs);
|
|
715
|
+
int __pyx_lineno = 0;
|
|
716
|
+
const char *__pyx_filename = NULL;
|
|
717
|
+
int __pyx_clineno = 0;
|
|
718
|
+
|
|
719
|
+
/* function exit code */
|
|
720
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_v_kwargs);
|
|
721
|
+
{
|
|
722
|
+
Py_ssize_t __pyx_temp;
|
|
723
|
+
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
|
|
724
|
+
<span class='pyx_c_api'>__Pyx_Arg_XDECREF_VARARGS</span>(values[__pyx_temp]);
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>();
|
|
728
|
+
return __pyx_r;
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
static PyObject *__pyx_pf_9datamodel_7parsers_4json_11JSONContent___call__(struct __pyx_obj_9datamodel_7parsers_4json_JSONContent *__pyx_v_self, PyObject *__pyx_v_obj, PyObject *__pyx_v_kwargs) {
|
|
732
|
+
PyObject *__pyx_r = NULL;
|
|
733
|
+
/* … */
|
|
734
|
+
/* function exit code */
|
|
735
|
+
__pyx_L1_error:;
|
|
736
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_1);
|
|
737
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_2);
|
|
738
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_3);
|
|
739
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_4);
|
|
740
|
+
<span class='pyx_c_api'>__Pyx_AddTraceback</span>("datamodel.parsers.json.JSONContent.__call__", __pyx_clineno, __pyx_lineno, __pyx_filename);
|
|
741
|
+
__pyx_r = NULL;
|
|
742
|
+
__pyx_L0:;
|
|
743
|
+
<span class='refnanny'>__Pyx_XGIVEREF</span>(__pyx_r);
|
|
744
|
+
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>();
|
|
745
|
+
return __pyx_r;
|
|
746
|
+
}
|
|
747
|
+
</pre><pre class="cython line score-21" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">079</span>: return self.encode(obj, **kwargs)</pre>
|
|
748
|
+
<pre class='cython code score-21 '> <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_r);
|
|
749
|
+
__pyx_t_1 = <span class='pyx_c_api'>__Pyx_PyObject_GetAttrStr</span>(((PyObject *)__pyx_v_self), __pyx_n_s_encode);<span class='error_goto'> if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 79, __pyx_L1_error)</span>
|
|
750
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1);
|
|
751
|
+
__pyx_t_2 = <span class='py_c_api'>PyTuple_New</span>(1);<span class='error_goto'> if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 79, __pyx_L1_error)</span>
|
|
752
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_2);
|
|
753
|
+
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_v_obj);
|
|
754
|
+
<span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_v_obj);
|
|
755
|
+
if (<span class='pyx_c_api'>__Pyx_PyTuple_SET_ITEM</span>(__pyx_t_2, 0, __pyx_v_obj)) <span class='error_goto'>__PYX_ERR(0, 79, __pyx_L1_error)</span>;
|
|
756
|
+
__pyx_t_3 = <span class='py_c_api'>PyDict_Copy</span>(__pyx_v_kwargs);<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 79, __pyx_L1_error)</span>
|
|
757
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
758
|
+
__pyx_t_4 = <span class='pyx_c_api'>__Pyx_PyObject_Call</span>(__pyx_t_1, __pyx_t_2, __pyx_t_3);<span class='error_goto'> if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 79, __pyx_L1_error)</span>
|
|
759
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4);
|
|
760
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0;
|
|
761
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;
|
|
762
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
|
|
763
|
+
__pyx_r = __pyx_t_4;
|
|
764
|
+
__pyx_t_4 = 0;
|
|
765
|
+
goto __pyx_L0;
|
|
766
|
+
</pre><pre class="cython line score-0"> <span class="">080</span>: </pre>
|
|
767
|
+
<pre class="cython line score-62" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">081</span>: def default(self, object obj):</pre>
|
|
768
|
+
<pre class='cython code score-62 '>/* Python wrapper */
|
|
769
|
+
static PyObject *__pyx_pw_9datamodel_7parsers_4json_11JSONContent_3default(PyObject *__pyx_v_self,
|
|
770
|
+
#if CYTHON_METH_FASTCALL
|
|
771
|
+
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
|
|
772
|
+
#else
|
|
773
|
+
PyObject *__pyx_args, PyObject *__pyx_kwds
|
|
774
|
+
#endif
|
|
775
|
+
); /*proto*/
|
|
776
|
+
<span class='py_macro_api'>PyDoc_STRVAR</span>(__pyx_doc_9datamodel_7parsers_4json_11JSONContent_2default, "JSONContent.default(self, obj)");
|
|
777
|
+
static PyMethodDef __pyx_mdef_9datamodel_7parsers_4json_11JSONContent_3default = {"default", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9datamodel_7parsers_4json_11JSONContent_3default, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9datamodel_7parsers_4json_11JSONContent_2default};
|
|
778
|
+
static PyObject *__pyx_pw_9datamodel_7parsers_4json_11JSONContent_3default(PyObject *__pyx_v_self,
|
|
779
|
+
#if CYTHON_METH_FASTCALL
|
|
780
|
+
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
|
|
781
|
+
#else
|
|
782
|
+
PyObject *__pyx_args, PyObject *__pyx_kwds
|
|
783
|
+
#endif
|
|
784
|
+
) {
|
|
785
|
+
PyObject *__pyx_v_obj = 0;
|
|
786
|
+
#if !CYTHON_METH_FASTCALL
|
|
787
|
+
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
|
|
788
|
+
#endif
|
|
789
|
+
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
|
|
790
|
+
PyObject *__pyx_r = 0;
|
|
791
|
+
<span class='refnanny'>__Pyx_RefNannyDeclarations</span>
|
|
792
|
+
<span class='refnanny'>__Pyx_RefNannySetupContext</span>("default (wrapper)", 0);
|
|
793
|
+
#if !CYTHON_METH_FASTCALL
|
|
794
|
+
#if CYTHON_ASSUME_SAFE_MACROS
|
|
795
|
+
__pyx_nargs = <span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args);
|
|
796
|
+
#else
|
|
797
|
+
__pyx_nargs = <span class='py_c_api'>PyTuple_Size</span>(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
|
|
798
|
+
#endif
|
|
799
|
+
#endif
|
|
800
|
+
__pyx_kwvalues = <span class='pyx_c_api'>__Pyx_KwValues_FASTCALL</span>(__pyx_args, __pyx_nargs);
|
|
801
|
+
{
|
|
802
|
+
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,0};
|
|
803
|
+
PyObject* values[1] = {0};
|
|
804
|
+
if (__pyx_kwds) {
|
|
805
|
+
Py_ssize_t kw_args;
|
|
806
|
+
switch (__pyx_nargs) {
|
|
807
|
+
case 1: values[0] = <span class='pyx_c_api'>__Pyx_Arg_FASTCALL</span>(__pyx_args, 0);
|
|
808
|
+
CYTHON_FALLTHROUGH;
|
|
809
|
+
case 0: break;
|
|
810
|
+
default: goto __pyx_L5_argtuple_error;
|
|
811
|
+
}
|
|
812
|
+
kw_args = <span class='pyx_c_api'>__Pyx_NumKwargs_FASTCALL</span>(__pyx_kwds);
|
|
813
|
+
switch (__pyx_nargs) {
|
|
814
|
+
case 0:
|
|
815
|
+
if (likely((values[0] = <span class='pyx_c_api'>__Pyx_GetKwValue_FASTCALL</span>(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_obj)) != 0)) {
|
|
816
|
+
(void)<span class='pyx_c_api'>__Pyx_Arg_NewRef_FASTCALL</span>(values[0]);
|
|
817
|
+
kw_args--;
|
|
818
|
+
}
|
|
819
|
+
else if (unlikely(<span class='py_c_api'>PyErr_Occurred</span>())) <span class='error_goto'>__PYX_ERR(0, 81, __pyx_L3_error)</span>
|
|
820
|
+
else goto __pyx_L5_argtuple_error;
|
|
821
|
+
}
|
|
822
|
+
if (unlikely(kw_args > 0)) {
|
|
823
|
+
const Py_ssize_t kwd_pos_args = __pyx_nargs;
|
|
824
|
+
if (unlikely(<span class='pyx_c_api'>__Pyx_ParseOptionalKeywords</span>(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "default") < 0)) <span class='error_goto'>__PYX_ERR(0, 81, __pyx_L3_error)</span>
|
|
825
|
+
}
|
|
826
|
+
} else if (unlikely(__pyx_nargs != 1)) {
|
|
827
|
+
goto __pyx_L5_argtuple_error;
|
|
828
|
+
} else {
|
|
829
|
+
values[0] = <span class='pyx_c_api'>__Pyx_Arg_FASTCALL</span>(__pyx_args, 0);
|
|
830
|
+
}
|
|
831
|
+
__pyx_v_obj = values[0];
|
|
832
|
+
}
|
|
833
|
+
goto __pyx_L6_skip;
|
|
834
|
+
__pyx_L5_argtuple_error:;
|
|
835
|
+
<span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>("default", 1, 1, 1, __pyx_nargs); <span class='error_goto'>__PYX_ERR(0, 81, __pyx_L3_error)</span>
|
|
836
|
+
__pyx_L6_skip:;
|
|
837
|
+
goto __pyx_L4_argument_unpacking_done;
|
|
838
|
+
__pyx_L3_error:;
|
|
839
|
+
{
|
|
840
|
+
Py_ssize_t __pyx_temp;
|
|
841
|
+
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
|
|
842
|
+
<span class='pyx_c_api'>__Pyx_Arg_XDECREF_FASTCALL</span>(values[__pyx_temp]);
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
<span class='pyx_c_api'>__Pyx_AddTraceback</span>("datamodel.parsers.json.JSONContent.default", __pyx_clineno, __pyx_lineno, __pyx_filename);
|
|
846
|
+
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>();
|
|
847
|
+
return NULL;
|
|
848
|
+
__pyx_L4_argument_unpacking_done:;
|
|
849
|
+
__pyx_r = __pyx_pf_9datamodel_7parsers_4json_11JSONContent_2default(((struct __pyx_obj_9datamodel_7parsers_4json_JSONContent *)__pyx_v_self), __pyx_v_obj);
|
|
850
|
+
int __pyx_lineno = 0;
|
|
851
|
+
const char *__pyx_filename = NULL;
|
|
852
|
+
int __pyx_clineno = 0;
|
|
853
|
+
|
|
854
|
+
/* function exit code */
|
|
855
|
+
{
|
|
856
|
+
Py_ssize_t __pyx_temp;
|
|
857
|
+
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
|
|
858
|
+
<span class='pyx_c_api'>__Pyx_Arg_XDECREF_FASTCALL</span>(values[__pyx_temp]);
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>();
|
|
862
|
+
return __pyx_r;
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
static PyObject *__pyx_pf_9datamodel_7parsers_4json_11JSONContent_2default(CYTHON_UNUSED struct __pyx_obj_9datamodel_7parsers_4json_JSONContent *__pyx_v_self, PyObject *__pyx_v_obj) {
|
|
866
|
+
PyObject *__pyx_v_hex_method = NULL;
|
|
867
|
+
PyObject *__pyx_v_up = NULL;
|
|
868
|
+
PyObject *__pyx_7genexpr__pyx_v_e = NULL;
|
|
869
|
+
PyObject *__pyx_r = NULL;
|
|
870
|
+
/* … */
|
|
871
|
+
/* function exit code */
|
|
872
|
+
__pyx_L1_error:;
|
|
873
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_1);
|
|
874
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_3);
|
|
875
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_4);
|
|
876
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_11);
|
|
877
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_14);
|
|
878
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_15);
|
|
879
|
+
<span class='pyx_c_api'>__Pyx_AddTraceback</span>("datamodel.parsers.json.JSONContent.default", __pyx_clineno, __pyx_lineno, __pyx_filename);
|
|
880
|
+
__pyx_r = NULL;
|
|
881
|
+
__pyx_L0:;
|
|
882
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_v_hex_method);
|
|
883
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_v_up);
|
|
884
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_7genexpr__pyx_v_e);
|
|
885
|
+
<span class='refnanny'>__Pyx_XGIVEREF</span>(__pyx_r);
|
|
886
|
+
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>();
|
|
887
|
+
return __pyx_r;
|
|
888
|
+
}
|
|
889
|
+
/* … */
|
|
890
|
+
__pyx_tuple__4 = <span class='py_c_api'>PyTuple_Pack</span>(5, __pyx_n_s_self, __pyx_n_s_obj, __pyx_n_s_hex_method, __pyx_n_s_up, __pyx_n_s_e);<span class='error_goto'> if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 81, __pyx_L1_error)</span>
|
|
891
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_tuple__4);
|
|
892
|
+
<span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_tuple__4);
|
|
893
|
+
/* … */
|
|
894
|
+
__pyx_t_3 = <span class='pyx_c_api'>__Pyx_CyFunction_New</span>(&__pyx_mdef_9datamodel_7parsers_4json_11JSONContent_3default, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_JSONContent_default, NULL, __pyx_n_s_datamodel_parsers_json, __pyx_d, ((PyObject *)__pyx_codeobj__5));<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 81, __pyx_L1_error)</span>
|
|
895
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
896
|
+
if (<span class='pyx_c_api'>__Pyx_SetItemOnTypeDict</span>((PyObject *)__pyx_ptype_9datamodel_7parsers_4json_JSONContent, __pyx_n_s_default, __pyx_t_3) < 0) <span class='error_goto'>__PYX_ERR(0, 81, __pyx_L1_error)</span>
|
|
897
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
|
|
898
|
+
<span class='py_c_api'>PyType_Modified</span>(__pyx_ptype_9datamodel_7parsers_4json_JSONContent);
|
|
899
|
+
__pyx_codeobj__5 = (PyObject*)<span class='pyx_c_api'>__Pyx_PyCode_New</span>(2, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__4, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_datamodel_parsers_json_pyx, __pyx_n_s_default, 81, __pyx_empty_bytes);<span class='error_goto'> if (unlikely(!__pyx_codeobj__5)) __PYX_ERR(0, 81, __pyx_L1_error)</span>
|
|
900
|
+
</pre><pre class="cython line score-8" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">082</span>: if isinstance(obj, Decimal):</pre>
|
|
901
|
+
<pre class='cython code score-8 '> <span class='pyx_c_api'>__Pyx_GetModuleGlobalName</span>(__pyx_t_1, __pyx_n_s_Decimal);<span class='error_goto'> if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 82, __pyx_L1_error)</span>
|
|
902
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1);
|
|
903
|
+
__pyx_t_2 = <span class='py_c_api'>PyObject_IsInstance</span>(__pyx_v_obj, __pyx_t_1);<span class='error_goto'> if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 82, __pyx_L1_error)</span>
|
|
904
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0;
|
|
905
|
+
if (__pyx_t_2) {
|
|
906
|
+
/* … */
|
|
907
|
+
}
|
|
908
|
+
</pre><pre class="cython line score-3" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">083</span>: return float(obj)</pre>
|
|
909
|
+
<pre class='cython code score-3 '> <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_r);
|
|
910
|
+
__pyx_t_1 = <span class='pyx_c_api'>__Pyx_PyNumber_Float</span>(__pyx_v_obj);<span class='error_goto'> if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 83, __pyx_L1_error)</span>
|
|
911
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1);
|
|
912
|
+
__pyx_r = __pyx_t_1;
|
|
913
|
+
__pyx_t_1 = 0;
|
|
914
|
+
goto __pyx_L0;
|
|
915
|
+
</pre><pre class="cython line score-8" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">084</span>: elif isinstance(obj, datetime):</pre>
|
|
916
|
+
<pre class='cython code score-8 '> <span class='pyx_c_api'>__Pyx_GetModuleGlobalName</span>(__pyx_t_1, __pyx_n_s_datetime);<span class='error_goto'> if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 84, __pyx_L1_error)</span>
|
|
917
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1);
|
|
918
|
+
__pyx_t_2 = <span class='py_c_api'>PyObject_IsInstance</span>(__pyx_v_obj, __pyx_t_1);<span class='error_goto'> if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 84, __pyx_L1_error)</span>
|
|
919
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0;
|
|
920
|
+
if (__pyx_t_2) {
|
|
921
|
+
/* … */
|
|
922
|
+
}
|
|
923
|
+
</pre><pre class="cython line score-3" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">085</span>: return str(obj)</pre>
|
|
924
|
+
<pre class='cython code score-3 '> <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_r);
|
|
925
|
+
__pyx_t_1 = <span class='pyx_c_api'>__Pyx_PyObject_Unicode</span>(__pyx_v_obj);<span class='error_goto'> if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 85, __pyx_L1_error)</span>
|
|
926
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1);
|
|
927
|
+
__pyx_r = __pyx_t_1;
|
|
928
|
+
__pyx_t_1 = 0;
|
|
929
|
+
goto __pyx_L0;
|
|
930
|
+
</pre><pre class="cython line score-5" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">086</span>: elif has_attribute(obj, "isoformat"):</pre>
|
|
931
|
+
<pre class='cython code score-5 '> __pyx_t_2 = __pyx_f_9datamodel_7parsers_4json_has_attribute(__pyx_v_obj, __pyx_n_u_isoformat); if (unlikely(__pyx_t_2 == ((int)-1) && <span class='py_c_api'>PyErr_Occurred</span>())) <span class='error_goto'>__PYX_ERR(0, 86, __pyx_L1_error)</span>
|
|
932
|
+
if (__pyx_t_2) {
|
|
933
|
+
/* … */
|
|
934
|
+
}
|
|
935
|
+
</pre><pre class="cython line score-17" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">087</span>: return obj.isoformat()</pre>
|
|
936
|
+
<pre class='cython code score-17 '> <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_r);
|
|
937
|
+
__pyx_t_3 = <span class='pyx_c_api'>__Pyx_PyObject_GetAttrStr</span>(__pyx_v_obj, __pyx_n_s_isoformat);<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 87, __pyx_L1_error)</span>
|
|
938
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
939
|
+
__pyx_t_4 = NULL;
|
|
940
|
+
__pyx_t_5 = 0;
|
|
941
|
+
#if CYTHON_UNPACK_METHODS
|
|
942
|
+
if (likely(<span class='py_c_api'>PyMethod_Check</span>(__pyx_t_3))) {
|
|
943
|
+
__pyx_t_4 = <span class='py_macro_api'>PyMethod_GET_SELF</span>(__pyx_t_3);
|
|
944
|
+
if (likely(__pyx_t_4)) {
|
|
945
|
+
PyObject* function = <span class='py_macro_api'>PyMethod_GET_FUNCTION</span>(__pyx_t_3);
|
|
946
|
+
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_t_4);
|
|
947
|
+
<span class='pyx_macro_api'>__Pyx_INCREF</span>(function);
|
|
948
|
+
<span class='pyx_macro_api'>__Pyx_DECREF_SET</span>(__pyx_t_3, function);
|
|
949
|
+
__pyx_t_5 = 1;
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
#endif
|
|
953
|
+
{
|
|
954
|
+
PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
|
|
955
|
+
__pyx_t_1 = <span class='pyx_c_api'>__Pyx_PyObject_FastCall</span>(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5);
|
|
956
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_4); __pyx_t_4 = 0;
|
|
957
|
+
if (unlikely(!__pyx_t_1)) <span class='error_goto'>__PYX_ERR(0, 87, __pyx_L1_error)</span>
|
|
958
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1);
|
|
959
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
|
|
960
|
+
}
|
|
961
|
+
__pyx_r = __pyx_t_1;
|
|
962
|
+
__pyx_t_1 = 0;
|
|
963
|
+
goto __pyx_L0;
|
|
964
|
+
</pre><pre class="cython line score-24" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">088</span>: elif isinstance(obj, (PosixPath, PurePath, Path)):</pre>
|
|
965
|
+
<pre class='cython code score-24 '> <span class='pyx_c_api'>__Pyx_GetModuleGlobalName</span>(__pyx_t_1, __pyx_n_s_PosixPath);<span class='error_goto'> if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 88, __pyx_L1_error)</span>
|
|
966
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1);
|
|
967
|
+
<span class='pyx_c_api'>__Pyx_GetModuleGlobalName</span>(__pyx_t_3, __pyx_n_s_PurePath);<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 88, __pyx_L1_error)</span>
|
|
968
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
969
|
+
<span class='pyx_c_api'>__Pyx_GetModuleGlobalName</span>(__pyx_t_4, __pyx_n_s_Path);<span class='error_goto'> if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 88, __pyx_L1_error)</span>
|
|
970
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4);
|
|
971
|
+
__pyx_t_6 = <span class='py_c_api'>PyObject_IsInstance</span>(__pyx_v_obj, __pyx_t_1);
|
|
972
|
+
if (!__pyx_t_6) {
|
|
973
|
+
} else {
|
|
974
|
+
__pyx_t_2 = __pyx_t_6;
|
|
975
|
+
goto __pyx_L4_bool_binop_done;
|
|
976
|
+
}
|
|
977
|
+
__pyx_t_6 = <span class='py_c_api'>PyObject_IsInstance</span>(__pyx_v_obj, __pyx_t_3);
|
|
978
|
+
if (!__pyx_t_6) {
|
|
979
|
+
} else {
|
|
980
|
+
__pyx_t_2 = __pyx_t_6;
|
|
981
|
+
goto __pyx_L4_bool_binop_done;
|
|
982
|
+
}
|
|
983
|
+
__pyx_t_6 = <span class='py_c_api'>PyObject_IsInstance</span>(__pyx_v_obj, __pyx_t_4);
|
|
984
|
+
__pyx_t_2 = __pyx_t_6;
|
|
985
|
+
__pyx_L4_bool_binop_done:;
|
|
986
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_4); __pyx_t_4 = 0;
|
|
987
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
|
|
988
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0;
|
|
989
|
+
if (__pyx_t_2) {
|
|
990
|
+
/* … */
|
|
991
|
+
}
|
|
992
|
+
</pre><pre class="cython line score-3" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">089</span>: return str(obj)</pre>
|
|
993
|
+
<pre class='cython code score-3 '> <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_r);
|
|
994
|
+
__pyx_t_1 = <span class='pyx_c_api'>__Pyx_PyObject_Unicode</span>(__pyx_v_obj);<span class='error_goto'> if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 89, __pyx_L1_error)</span>
|
|
995
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1);
|
|
996
|
+
__pyx_r = __pyx_t_1;
|
|
997
|
+
__pyx_t_1 = 0;
|
|
998
|
+
goto __pyx_L0;
|
|
999
|
+
</pre><pre class="cython line score-11" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">090</span>: elif isinstance(obj, pgproto.UUID):</pre>
|
|
1000
|
+
<pre class='cython code score-11 '> <span class='pyx_c_api'>__Pyx_GetModuleGlobalName</span>(__pyx_t_1, __pyx_n_s_pgproto);<span class='error_goto'> if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 90, __pyx_L1_error)</span>
|
|
1001
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1);
|
|
1002
|
+
__pyx_t_3 = <span class='pyx_c_api'>__Pyx_PyObject_GetAttrStr</span>(__pyx_t_1, __pyx_n_s_UUID);<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 90, __pyx_L1_error)</span>
|
|
1003
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
1004
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0;
|
|
1005
|
+
__pyx_t_2 = <span class='py_c_api'>PyObject_IsInstance</span>(__pyx_v_obj, __pyx_t_3);<span class='error_goto'> if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 90, __pyx_L1_error)</span>
|
|
1006
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
|
|
1007
|
+
if (__pyx_t_2) {
|
|
1008
|
+
/* … */
|
|
1009
|
+
}
|
|
1010
|
+
</pre><pre class="cython line score-3" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">091</span>: return str(obj)</pre>
|
|
1011
|
+
<pre class='cython code score-3 '> <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_r);
|
|
1012
|
+
__pyx_t_3 = <span class='pyx_c_api'>__Pyx_PyObject_Unicode</span>(__pyx_v_obj);<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 91, __pyx_L1_error)</span>
|
|
1013
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
1014
|
+
__pyx_r = __pyx_t_3;
|
|
1015
|
+
__pyx_t_3 = 0;
|
|
1016
|
+
goto __pyx_L0;
|
|
1017
|
+
</pre><pre class="cython line score-11" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">092</span>: elif isinstance(obj, uuid.UUID):</pre>
|
|
1018
|
+
<pre class='cython code score-11 '> <span class='pyx_c_api'>__Pyx_GetModuleGlobalName</span>(__pyx_t_3, __pyx_n_s_uuid);<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 92, __pyx_L1_error)</span>
|
|
1019
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
1020
|
+
__pyx_t_1 = <span class='pyx_c_api'>__Pyx_PyObject_GetAttrStr</span>(__pyx_t_3, __pyx_n_s_UUID);<span class='error_goto'> if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 92, __pyx_L1_error)</span>
|
|
1021
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1);
|
|
1022
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
|
|
1023
|
+
__pyx_t_2 = <span class='py_c_api'>PyObject_IsInstance</span>(__pyx_v_obj, __pyx_t_1);<span class='error_goto'> if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 92, __pyx_L1_error)</span>
|
|
1024
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0;
|
|
1025
|
+
if (__pyx_t_2) {
|
|
1026
|
+
/* … */
|
|
1027
|
+
}
|
|
1028
|
+
</pre><pre class="cython line score-2" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">093</span>: return obj</pre>
|
|
1029
|
+
<pre class='cython code score-2 '> <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_r);
|
|
1030
|
+
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_v_obj);
|
|
1031
|
+
__pyx_r = __pyx_v_obj;
|
|
1032
|
+
goto __pyx_L0;
|
|
1033
|
+
</pre><pre class="cython line score-5" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">094</span>: elif has_attribute(obj, "hex"):</pre>
|
|
1034
|
+
<pre class='cython code score-5 '> __pyx_t_2 = __pyx_f_9datamodel_7parsers_4json_has_attribute(__pyx_v_obj, __pyx_n_u_hex); if (unlikely(__pyx_t_2 == ((int)-1) && <span class='py_c_api'>PyErr_Occurred</span>())) <span class='error_goto'>__PYX_ERR(0, 94, __pyx_L1_error)</span>
|
|
1035
|
+
if (__pyx_t_2) {
|
|
1036
|
+
/* … */
|
|
1037
|
+
}
|
|
1038
|
+
</pre><pre class="cython line score-12" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">095</span>: try:</pre>
|
|
1039
|
+
<pre class='cython code score-12 '> {
|
|
1040
|
+
/*try:*/ {
|
|
1041
|
+
/* … */
|
|
1042
|
+
}
|
|
1043
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_7); __pyx_t_7 = 0;
|
|
1044
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_8); __pyx_t_8 = 0;
|
|
1045
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_9); __pyx_t_9 = 0;
|
|
1046
|
+
goto __pyx_L12_try_end;
|
|
1047
|
+
__pyx_L7_error:;
|
|
1048
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_1); __pyx_t_1 = 0;
|
|
1049
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
|
|
1050
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_4); __pyx_t_4 = 0;
|
|
1051
|
+
/* … */
|
|
1052
|
+
__pyx_L9_except_error:;
|
|
1053
|
+
<span class='refnanny'>__Pyx_XGIVEREF</span>(__pyx_t_7);
|
|
1054
|
+
<span class='refnanny'>__Pyx_XGIVEREF</span>(__pyx_t_8);
|
|
1055
|
+
<span class='refnanny'>__Pyx_XGIVEREF</span>(__pyx_t_9);
|
|
1056
|
+
<span class='pyx_c_api'>__Pyx_ExceptionReset</span>(__pyx_t_7, __pyx_t_8, __pyx_t_9);
|
|
1057
|
+
goto __pyx_L1_error;
|
|
1058
|
+
__pyx_L11_try_return:;
|
|
1059
|
+
<span class='refnanny'>__Pyx_XGIVEREF</span>(__pyx_t_7);
|
|
1060
|
+
<span class='refnanny'>__Pyx_XGIVEREF</span>(__pyx_t_8);
|
|
1061
|
+
<span class='refnanny'>__Pyx_XGIVEREF</span>(__pyx_t_9);
|
|
1062
|
+
<span class='pyx_c_api'>__Pyx_ExceptionReset</span>(__pyx_t_7, __pyx_t_8, __pyx_t_9);
|
|
1063
|
+
goto __pyx_L0;
|
|
1064
|
+
__pyx_L10_except_return:;
|
|
1065
|
+
<span class='refnanny'>__Pyx_XGIVEREF</span>(__pyx_t_7);
|
|
1066
|
+
<span class='refnanny'>__Pyx_XGIVEREF</span>(__pyx_t_8);
|
|
1067
|
+
<span class='refnanny'>__Pyx_XGIVEREF</span>(__pyx_t_9);
|
|
1068
|
+
<span class='pyx_c_api'>__Pyx_ExceptionReset</span>(__pyx_t_7, __pyx_t_8, __pyx_t_9);
|
|
1069
|
+
goto __pyx_L0;
|
|
1070
|
+
__pyx_L12_try_end:;
|
|
1071
|
+
}
|
|
1072
|
+
</pre><pre class="cython line score-0" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">096</span>: hex_method = get_attribute(obj, "hex")</pre>
|
|
1073
|
+
<pre class='cython code score-0 '> __pyx_t_1 = __pyx_f_9datamodel_7parsers_4json_get_attribute(__pyx_v_obj, __pyx_n_u_hex);<span class='error_goto'> if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 96, __pyx_L7_error)</span>
|
|
1074
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1);
|
|
1075
|
+
__pyx_v_hex_method = __pyx_t_1;
|
|
1076
|
+
__pyx_t_1 = 0;
|
|
1077
|
+
</pre><pre class="cython line score-5" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">097</span>: if is_callable(hex_method):</pre>
|
|
1078
|
+
<pre class='cython code score-5 '> __pyx_t_2 = __pyx_f_9datamodel_7parsers_4json_is_callable(__pyx_v_hex_method); if (unlikely(__pyx_t_2 == ((int)-1) && <span class='py_c_api'>PyErr_Occurred</span>())) <span class='error_goto'>__PYX_ERR(0, 97, __pyx_L7_error)</span>
|
|
1079
|
+
if (__pyx_t_2) {
|
|
1080
|
+
/* … */
|
|
1081
|
+
}
|
|
1082
|
+
</pre><pre class="cython line score-16" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">098</span>: return hex_method()</pre>
|
|
1083
|
+
<pre class='cython code score-16 '> <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_r);
|
|
1084
|
+
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_v_hex_method);
|
|
1085
|
+
__pyx_t_3 = __pyx_v_hex_method; __pyx_t_4 = NULL;
|
|
1086
|
+
__pyx_t_5 = 0;
|
|
1087
|
+
#if CYTHON_UNPACK_METHODS
|
|
1088
|
+
if (unlikely(<span class='py_c_api'>PyMethod_Check</span>(__pyx_t_3))) {
|
|
1089
|
+
__pyx_t_4 = <span class='py_macro_api'>PyMethod_GET_SELF</span>(__pyx_t_3);
|
|
1090
|
+
if (likely(__pyx_t_4)) {
|
|
1091
|
+
PyObject* function = <span class='py_macro_api'>PyMethod_GET_FUNCTION</span>(__pyx_t_3);
|
|
1092
|
+
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_t_4);
|
|
1093
|
+
<span class='pyx_macro_api'>__Pyx_INCREF</span>(function);
|
|
1094
|
+
<span class='pyx_macro_api'>__Pyx_DECREF_SET</span>(__pyx_t_3, function);
|
|
1095
|
+
__pyx_t_5 = 1;
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
#endif
|
|
1099
|
+
{
|
|
1100
|
+
PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
|
|
1101
|
+
__pyx_t_1 = <span class='pyx_c_api'>__Pyx_PyObject_FastCall</span>(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5);
|
|
1102
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_4); __pyx_t_4 = 0;
|
|
1103
|
+
if (unlikely(!__pyx_t_1)) <span class='error_goto'>__PYX_ERR(0, 98, __pyx_L7_error)</span>
|
|
1104
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1);
|
|
1105
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
|
|
1106
|
+
}
|
|
1107
|
+
__pyx_r = __pyx_t_1;
|
|
1108
|
+
__pyx_t_1 = 0;
|
|
1109
|
+
goto __pyx_L11_try_return;
|
|
1110
|
+
</pre><pre class="cython line score-6" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">099</span>: except AttributeError:</pre>
|
|
1111
|
+
<pre class='cython code score-6 '> __pyx_t_10 = <span class='pyx_c_api'>__Pyx_PyErr_ExceptionMatches</span>(__pyx_builtin_AttributeError);
|
|
1112
|
+
if (__pyx_t_10) {
|
|
1113
|
+
<span class='pyx_c_api'>__Pyx_AddTraceback</span>("datamodel.parsers.json.JSONContent.default", __pyx_clineno, __pyx_lineno, __pyx_filename);
|
|
1114
|
+
if (<span class='pyx_c_api'>__Pyx_GetException</span>(&__pyx_t_1, &__pyx_t_3, &__pyx_t_4) < 0) <span class='error_goto'>__PYX_ERR(0, 99, __pyx_L9_except_error)</span>
|
|
1115
|
+
<span class='refnanny'>__Pyx_XGOTREF</span>(__pyx_t_1);
|
|
1116
|
+
<span class='refnanny'>__Pyx_XGOTREF</span>(__pyx_t_3);
|
|
1117
|
+
<span class='refnanny'>__Pyx_XGOTREF</span>(__pyx_t_4);
|
|
1118
|
+
</pre><pre class="cython line score-6" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">100</span>: return obj.hex</pre>
|
|
1119
|
+
<pre class='cython code score-6 '> <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_r);
|
|
1120
|
+
__pyx_t_11 = <span class='pyx_c_api'>__Pyx_PyObject_GetAttrStr</span>(__pyx_v_obj, __pyx_n_s_hex);<span class='error_goto'> if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 100, __pyx_L9_except_error)</span>
|
|
1121
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_11);
|
|
1122
|
+
__pyx_r = __pyx_t_11;
|
|
1123
|
+
__pyx_t_11 = 0;
|
|
1124
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0;
|
|
1125
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
|
|
1126
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_4); __pyx_t_4 = 0;
|
|
1127
|
+
goto __pyx_L10_except_return;
|
|
1128
|
+
}
|
|
1129
|
+
goto __pyx_L9_except_error;
|
|
1130
|
+
</pre><pre class="cython line score-5" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">101</span>: if isinstance(obj, bytes):</pre>
|
|
1131
|
+
<pre class='cython code score-5 '> __pyx_t_2 = <span class='py_c_api'>PyBytes_Check</span>(__pyx_v_obj);
|
|
1132
|
+
if (__pyx_t_2) {
|
|
1133
|
+
/* … */
|
|
1134
|
+
}
|
|
1135
|
+
</pre><pre class="cython line score-17" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">102</span>: return obj.hex()</pre>
|
|
1136
|
+
<pre class='cython code score-17 '> <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_r);
|
|
1137
|
+
__pyx_t_3 = <span class='pyx_c_api'>__Pyx_PyObject_GetAttrStr</span>(__pyx_v_obj, __pyx_n_s_hex);<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 102, __pyx_L1_error)</span>
|
|
1138
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
1139
|
+
__pyx_t_1 = NULL;
|
|
1140
|
+
__pyx_t_5 = 0;
|
|
1141
|
+
#if CYTHON_UNPACK_METHODS
|
|
1142
|
+
if (likely(<span class='py_c_api'>PyMethod_Check</span>(__pyx_t_3))) {
|
|
1143
|
+
__pyx_t_1 = <span class='py_macro_api'>PyMethod_GET_SELF</span>(__pyx_t_3);
|
|
1144
|
+
if (likely(__pyx_t_1)) {
|
|
1145
|
+
PyObject* function = <span class='py_macro_api'>PyMethod_GET_FUNCTION</span>(__pyx_t_3);
|
|
1146
|
+
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_t_1);
|
|
1147
|
+
<span class='pyx_macro_api'>__Pyx_INCREF</span>(function);
|
|
1148
|
+
<span class='pyx_macro_api'>__Pyx_DECREF_SET</span>(__pyx_t_3, function);
|
|
1149
|
+
__pyx_t_5 = 1;
|
|
1150
|
+
}
|
|
1151
|
+
}
|
|
1152
|
+
#endif
|
|
1153
|
+
{
|
|
1154
|
+
PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL};
|
|
1155
|
+
__pyx_t_4 = <span class='pyx_c_api'>__Pyx_PyObject_FastCall</span>(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5);
|
|
1156
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_1); __pyx_t_1 = 0;
|
|
1157
|
+
if (unlikely(!__pyx_t_4)) <span class='error_goto'>__PYX_ERR(0, 102, __pyx_L1_error)</span>
|
|
1158
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4);
|
|
1159
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
|
|
1160
|
+
}
|
|
1161
|
+
__pyx_r = __pyx_t_4;
|
|
1162
|
+
__pyx_t_4 = 0;
|
|
1163
|
+
goto __pyx_L0;
|
|
1164
|
+
</pre><pre class="cython line score-0"> <span class="">103</span>: else:</pre>
|
|
1165
|
+
<pre class="cython line score-3" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">104</span>: return obj.hex</pre>
|
|
1166
|
+
<pre class='cython code score-3 '> /*else*/ {
|
|
1167
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_r);
|
|
1168
|
+
__pyx_t_4 = <span class='pyx_c_api'>__Pyx_PyObject_GetAttrStr</span>(__pyx_v_obj, __pyx_n_s_hex);<span class='error_goto'> if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 104, __pyx_L1_error)</span>
|
|
1169
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4);
|
|
1170
|
+
__pyx_r = __pyx_t_4;
|
|
1171
|
+
__pyx_t_4 = 0;
|
|
1172
|
+
goto __pyx_L0;
|
|
1173
|
+
}
|
|
1174
|
+
</pre><pre class="cython line score-5" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">105</span>: elif has_attribute(obj, 'lower'): # asyncPg Range:</pre>
|
|
1175
|
+
<pre class='cython code score-5 '> __pyx_t_2 = __pyx_f_9datamodel_7parsers_4json_has_attribute(__pyx_v_obj, __pyx_n_u_lower); if (unlikely(__pyx_t_2 == ((int)-1) && <span class='py_c_api'>PyErr_Occurred</span>())) <span class='error_goto'>__PYX_ERR(0, 105, __pyx_L1_error)</span>
|
|
1176
|
+
if (__pyx_t_2) {
|
|
1177
|
+
/* … */
|
|
1178
|
+
}
|
|
1179
|
+
</pre><pre class="cython line score-2" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">106</span>: up = obj.upper</pre>
|
|
1180
|
+
<pre class='cython code score-2 '> __pyx_t_4 = <span class='pyx_c_api'>__Pyx_PyObject_GetAttrStr</span>(__pyx_v_obj, __pyx_n_s_upper);<span class='error_goto'> if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 106, __pyx_L1_error)</span>
|
|
1181
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4);
|
|
1182
|
+
__pyx_v_up = __pyx_t_4;
|
|
1183
|
+
__pyx_t_4 = 0;
|
|
1184
|
+
</pre><pre class="cython line score-5" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">107</span>: if isinstance(up, int):</pre>
|
|
1185
|
+
<pre class='cython code score-5 '> __pyx_t_2 = <span class='py_c_api'>PyInt_Check</span>(__pyx_v_up);
|
|
1186
|
+
if (__pyx_t_2) {
|
|
1187
|
+
/* … */
|
|
1188
|
+
}
|
|
1189
|
+
</pre><pre class="cython line score-3" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">108</span>: up = up - 1 # discrete representation</pre>
|
|
1190
|
+
<pre class='cython code score-3 '> __pyx_t_4 = <span class='pyx_c_api'>__Pyx_PyInt_SubtractObjC</span>(__pyx_v_up, __pyx_int_1, 1, 0, 0);<span class='error_goto'> if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 108, __pyx_L1_error)</span>
|
|
1191
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4);
|
|
1192
|
+
<span class='pyx_macro_api'>__Pyx_DECREF_SET</span>(__pyx_v_up, __pyx_t_4);
|
|
1193
|
+
__pyx_t_4 = 0;
|
|
1194
|
+
</pre><pre class="cython line score-13" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">109</span>: return [obj.lower, up]</pre>
|
|
1195
|
+
<pre class='cython code score-13 '> <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_r);
|
|
1196
|
+
__pyx_t_4 = <span class='pyx_c_api'>__Pyx_PyObject_GetAttrStr</span>(__pyx_v_obj, __pyx_n_s_lower);<span class='error_goto'> if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 109, __pyx_L1_error)</span>
|
|
1197
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4);
|
|
1198
|
+
__pyx_t_3 = <span class='py_c_api'>PyList_New</span>(2);<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 109, __pyx_L1_error)</span>
|
|
1199
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
1200
|
+
<span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_t_4);
|
|
1201
|
+
if (<span class='pyx_c_api'>__Pyx_PyList_SET_ITEM</span>(__pyx_t_3, 0, __pyx_t_4)) <span class='error_goto'>__PYX_ERR(0, 109, __pyx_L1_error)</span>;
|
|
1202
|
+
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_v_up);
|
|
1203
|
+
<span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_v_up);
|
|
1204
|
+
if (<span class='pyx_c_api'>__Pyx_PyList_SET_ITEM</span>(__pyx_t_3, 1, __pyx_v_up)) <span class='error_goto'>__PYX_ERR(0, 109, __pyx_L1_error)</span>;
|
|
1205
|
+
__pyx_t_4 = 0;
|
|
1206
|
+
__pyx_r = __pyx_t_3;
|
|
1207
|
+
__pyx_t_3 = 0;
|
|
1208
|
+
goto __pyx_L0;
|
|
1209
|
+
</pre><pre class="cython line score-5" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">110</span>: elif has_attribute(obj, 'tolist'): # numpy array</pre>
|
|
1210
|
+
<pre class='cython code score-5 '> __pyx_t_2 = __pyx_f_9datamodel_7parsers_4json_has_attribute(__pyx_v_obj, __pyx_n_u_tolist); if (unlikely(__pyx_t_2 == ((int)-1) && <span class='py_c_api'>PyErr_Occurred</span>())) <span class='error_goto'>__PYX_ERR(0, 110, __pyx_L1_error)</span>
|
|
1211
|
+
if (__pyx_t_2) {
|
|
1212
|
+
/* … */
|
|
1213
|
+
}
|
|
1214
|
+
</pre><pre class="cython line score-17" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">111</span>: return obj.tolist()</pre>
|
|
1215
|
+
<pre class='cython code score-17 '> <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_r);
|
|
1216
|
+
__pyx_t_4 = <span class='pyx_c_api'>__Pyx_PyObject_GetAttrStr</span>(__pyx_v_obj, __pyx_n_s_tolist);<span class='error_goto'> if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 111, __pyx_L1_error)</span>
|
|
1217
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4);
|
|
1218
|
+
__pyx_t_1 = NULL;
|
|
1219
|
+
__pyx_t_5 = 0;
|
|
1220
|
+
#if CYTHON_UNPACK_METHODS
|
|
1221
|
+
if (likely(<span class='py_c_api'>PyMethod_Check</span>(__pyx_t_4))) {
|
|
1222
|
+
__pyx_t_1 = <span class='py_macro_api'>PyMethod_GET_SELF</span>(__pyx_t_4);
|
|
1223
|
+
if (likely(__pyx_t_1)) {
|
|
1224
|
+
PyObject* function = <span class='py_macro_api'>PyMethod_GET_FUNCTION</span>(__pyx_t_4);
|
|
1225
|
+
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_t_1);
|
|
1226
|
+
<span class='pyx_macro_api'>__Pyx_INCREF</span>(function);
|
|
1227
|
+
<span class='pyx_macro_api'>__Pyx_DECREF_SET</span>(__pyx_t_4, function);
|
|
1228
|
+
__pyx_t_5 = 1;
|
|
1229
|
+
}
|
|
1230
|
+
}
|
|
1231
|
+
#endif
|
|
1232
|
+
{
|
|
1233
|
+
PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL};
|
|
1234
|
+
__pyx_t_3 = <span class='pyx_c_api'>__Pyx_PyObject_FastCall</span>(__pyx_t_4, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5);
|
|
1235
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_1); __pyx_t_1 = 0;
|
|
1236
|
+
if (unlikely(!__pyx_t_3)) <span class='error_goto'>__PYX_ERR(0, 111, __pyx_L1_error)</span>
|
|
1237
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
1238
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_4); __pyx_t_4 = 0;
|
|
1239
|
+
}
|
|
1240
|
+
__pyx_r = __pyx_t_3;
|
|
1241
|
+
__pyx_t_3 = 0;
|
|
1242
|
+
goto __pyx_L0;
|
|
1243
|
+
</pre><pre class="cython line score-8" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">112</span>: elif isinstance(obj, _MISSING_TYPE):</pre>
|
|
1244
|
+
<pre class='cython code score-8 '> <span class='pyx_c_api'>__Pyx_GetModuleGlobalName</span>(__pyx_t_3, __pyx_n_s_MISSING_TYPE);<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 112, __pyx_L1_error)</span>
|
|
1245
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
1246
|
+
__pyx_t_2 = <span class='py_c_api'>PyObject_IsInstance</span>(__pyx_v_obj, __pyx_t_3);<span class='error_goto'> if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 112, __pyx_L1_error)</span>
|
|
1247
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
|
|
1248
|
+
if (__pyx_t_2) {
|
|
1249
|
+
/* … */
|
|
1250
|
+
}
|
|
1251
|
+
</pre><pre class="cython line score-2" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">113</span>: return None</pre>
|
|
1252
|
+
<pre class='cython code score-2 '> <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_r);
|
|
1253
|
+
__pyx_r = Py_None; <span class='pyx_macro_api'>__Pyx_INCREF</span>(Py_None);
|
|
1254
|
+
goto __pyx_L0;
|
|
1255
|
+
</pre><pre class="cython line score-3" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">114</span>: elif obj is MISSING:</pre>
|
|
1256
|
+
<pre class='cython code score-3 '> <span class='pyx_c_api'>__Pyx_GetModuleGlobalName</span>(__pyx_t_3, __pyx_n_s_MISSING);<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 114, __pyx_L1_error)</span>
|
|
1257
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
1258
|
+
__pyx_t_2 = (__pyx_v_obj == __pyx_t_3);
|
|
1259
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
|
|
1260
|
+
if (__pyx_t_2) {
|
|
1261
|
+
/* … */
|
|
1262
|
+
}
|
|
1263
|
+
</pre><pre class="cython line score-2" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">115</span>: return None</pre>
|
|
1264
|
+
<pre class='cython code score-2 '> <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_r);
|
|
1265
|
+
__pyx_r = Py_None; <span class='pyx_macro_api'>__Pyx_INCREF</span>(Py_None);
|
|
1266
|
+
goto __pyx_L0;
|
|
1267
|
+
</pre><pre class="cython line score-13" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">116</span>: elif PyObject_IsInstance(obj, type) and is_subclassof(obj, Enum):</pre>
|
|
1268
|
+
<pre class='cython code score-13 '> __pyx_t_6 = <span class='py_c_api'>PyObject_IsInstance</span>(__pyx_v_obj, ((PyObject *)(&PyType_Type)));<span class='error_goto'> if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 116, __pyx_L1_error)</span>
|
|
1269
|
+
if (__pyx_t_6) {
|
|
1270
|
+
} else {
|
|
1271
|
+
__pyx_t_2 = __pyx_t_6;
|
|
1272
|
+
goto __pyx_L18_bool_binop_done;
|
|
1273
|
+
}
|
|
1274
|
+
<span class='pyx_c_api'>__Pyx_GetModuleGlobalName</span>(__pyx_t_3, __pyx_n_s_Enum);<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 116, __pyx_L1_error)</span>
|
|
1275
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
1276
|
+
__pyx_t_6 = __pyx_f_9datamodel_7parsers_4json_is_subclassof(__pyx_v_obj, __pyx_t_3); if (unlikely(__pyx_t_6 == ((int)-1) && <span class='py_c_api'>PyErr_Occurred</span>())) <span class='error_goto'>__PYX_ERR(0, 116, __pyx_L1_error)</span>
|
|
1277
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
|
|
1278
|
+
__pyx_t_2 = __pyx_t_6;
|
|
1279
|
+
__pyx_L18_bool_binop_done:;
|
|
1280
|
+
if (__pyx_t_2) {
|
|
1281
|
+
/* … */
|
|
1282
|
+
}
|
|
1283
|
+
</pre><pre class="cython line score-78" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">117</span>: return [{'value': e.value, 'name': e.name} for e in obj]</pre>
|
|
1284
|
+
<pre class='cython code score-78 '> <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_r);
|
|
1285
|
+
{ /* enter inner scope */
|
|
1286
|
+
__pyx_t_3 = <span class='py_c_api'>PyList_New</span>(0);<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 117, __pyx_L22_error)</span>
|
|
1287
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
1288
|
+
if (likely(<span class='py_c_api'>PyList_CheckExact</span>(__pyx_v_obj)) || <span class='py_c_api'>PyTuple_CheckExact</span>(__pyx_v_obj)) {
|
|
1289
|
+
__pyx_t_4 = __pyx_v_obj; <span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_t_4);
|
|
1290
|
+
__pyx_t_12 = 0;
|
|
1291
|
+
__pyx_t_13 = NULL;
|
|
1292
|
+
} else {
|
|
1293
|
+
__pyx_t_12 = -1; __pyx_t_4 = <span class='py_c_api'>PyObject_GetIter</span>(__pyx_v_obj);<span class='error_goto'> if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 117, __pyx_L22_error)</span>
|
|
1294
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4);
|
|
1295
|
+
__pyx_t_13 = <span class='pyx_c_api'>__Pyx_PyObject_GetIterNextFunc</span>(__pyx_t_4);<span class='error_goto'> if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 117, __pyx_L22_error)</span>
|
|
1296
|
+
}
|
|
1297
|
+
for (;;) {
|
|
1298
|
+
if (likely(!__pyx_t_13)) {
|
|
1299
|
+
if (likely(<span class='py_c_api'>PyList_CheckExact</span>(__pyx_t_4))) {
|
|
1300
|
+
{
|
|
1301
|
+
Py_ssize_t __pyx_temp = <span class='pyx_c_api'>__Pyx_PyList_GET_SIZE</span>(__pyx_t_4);
|
|
1302
|
+
#if !CYTHON_ASSUME_SAFE_MACROS
|
|
1303
|
+
if (unlikely((__pyx_temp < 0))) <span class='error_goto'>__PYX_ERR(0, 117, __pyx_L22_error)</span>
|
|
1304
|
+
#endif
|
|
1305
|
+
if (__pyx_t_12 >= __pyx_temp) break;
|
|
1306
|
+
}
|
|
1307
|
+
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
|
|
1308
|
+
__pyx_t_1 = <span class='py_macro_api'>PyList_GET_ITEM</span>(__pyx_t_4, __pyx_t_12); <span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_t_1); __pyx_t_12++; if (unlikely((0 < 0))) <span class='error_goto'>__PYX_ERR(0, 117, __pyx_L22_error)</span>
|
|
1309
|
+
#else
|
|
1310
|
+
__pyx_t_1 = <span class='pyx_c_api'>__Pyx_PySequence_ITEM</span>(__pyx_t_4, __pyx_t_12); __pyx_t_12++;<span class='error_goto'> if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 117, __pyx_L22_error)</span>
|
|
1311
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1);
|
|
1312
|
+
#endif
|
|
1313
|
+
} else {
|
|
1314
|
+
{
|
|
1315
|
+
Py_ssize_t __pyx_temp = <span class='pyx_c_api'>__Pyx_PyTuple_GET_SIZE</span>(__pyx_t_4);
|
|
1316
|
+
#if !CYTHON_ASSUME_SAFE_MACROS
|
|
1317
|
+
if (unlikely((__pyx_temp < 0))) <span class='error_goto'>__PYX_ERR(0, 117, __pyx_L22_error)</span>
|
|
1318
|
+
#endif
|
|
1319
|
+
if (__pyx_t_12 >= __pyx_temp) break;
|
|
1320
|
+
}
|
|
1321
|
+
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
|
|
1322
|
+
__pyx_t_1 = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_t_4, __pyx_t_12); <span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_t_1); __pyx_t_12++; if (unlikely((0 < 0))) <span class='error_goto'>__PYX_ERR(0, 117, __pyx_L22_error)</span>
|
|
1323
|
+
#else
|
|
1324
|
+
__pyx_t_1 = <span class='pyx_c_api'>__Pyx_PySequence_ITEM</span>(__pyx_t_4, __pyx_t_12); __pyx_t_12++;<span class='error_goto'> if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 117, __pyx_L22_error)</span>
|
|
1325
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1);
|
|
1326
|
+
#endif
|
|
1327
|
+
}
|
|
1328
|
+
} else {
|
|
1329
|
+
__pyx_t_1 = __pyx_t_13(__pyx_t_4);
|
|
1330
|
+
if (unlikely(!__pyx_t_1)) {
|
|
1331
|
+
PyObject* exc_type = <span class='py_c_api'>PyErr_Occurred</span>();
|
|
1332
|
+
if (exc_type) {
|
|
1333
|
+
if (likely(<span class='pyx_c_api'>__Pyx_PyErr_GivenExceptionMatches</span>(exc_type, PyExc_StopIteration))) <span class='py_c_api'>PyErr_Clear</span>();
|
|
1334
|
+
else <span class='error_goto'>__PYX_ERR(0, 117, __pyx_L22_error)</span>
|
|
1335
|
+
}
|
|
1336
|
+
break;
|
|
1337
|
+
}
|
|
1338
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1);
|
|
1339
|
+
}
|
|
1340
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF_SET</span>(__pyx_7genexpr__pyx_v_e, __pyx_t_1);
|
|
1341
|
+
__pyx_t_1 = 0;
|
|
1342
|
+
__pyx_t_1 = <span class='pyx_c_api'>__Pyx_PyDict_NewPresized</span>(2);<span class='error_goto'> if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 117, __pyx_L22_error)</span>
|
|
1343
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1);
|
|
1344
|
+
__pyx_t_11 = <span class='pyx_c_api'>__Pyx_PyObject_GetAttrStr</span>(__pyx_7genexpr__pyx_v_e, __pyx_n_s_value);<span class='error_goto'> if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 117, __pyx_L22_error)</span>
|
|
1345
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_11);
|
|
1346
|
+
if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_t_1, __pyx_n_u_value, __pyx_t_11) < 0) <span class='error_goto'>__PYX_ERR(0, 117, __pyx_L22_error)</span>
|
|
1347
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_11); __pyx_t_11 = 0;
|
|
1348
|
+
__pyx_t_11 = <span class='pyx_c_api'>__Pyx_PyObject_GetAttrStr</span>(__pyx_7genexpr__pyx_v_e, __pyx_n_s_name);<span class='error_goto'> if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 117, __pyx_L22_error)</span>
|
|
1349
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_11);
|
|
1350
|
+
if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_t_1, __pyx_n_u_name, __pyx_t_11) < 0) <span class='error_goto'>__PYX_ERR(0, 117, __pyx_L22_error)</span>
|
|
1351
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_11); __pyx_t_11 = 0;
|
|
1352
|
+
if (unlikely(<span class='pyx_c_api'>__Pyx_ListComp_Append</span>(__pyx_t_3, (PyObject*)__pyx_t_1))) <span class='error_goto'>__PYX_ERR(0, 117, __pyx_L22_error)</span>
|
|
1353
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0;
|
|
1354
|
+
}
|
|
1355
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_4); __pyx_t_4 = 0;
|
|
1356
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_7genexpr__pyx_v_e); __pyx_7genexpr__pyx_v_e = 0;
|
|
1357
|
+
goto __pyx_L26_exit_scope;
|
|
1358
|
+
__pyx_L22_error:;
|
|
1359
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_7genexpr__pyx_v_e); __pyx_7genexpr__pyx_v_e = 0;
|
|
1360
|
+
goto __pyx_L1_error;
|
|
1361
|
+
__pyx_L26_exit_scope:;
|
|
1362
|
+
} /* exit inner scope */
|
|
1363
|
+
__pyx_r = __pyx_t_3;
|
|
1364
|
+
__pyx_t_3 = 0;
|
|
1365
|
+
goto __pyx_L0;
|
|
1366
|
+
</pre><pre class="cython line score-8" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">118</span>: elif isinstance(obj, Enum):</pre>
|
|
1367
|
+
<pre class='cython code score-8 '> <span class='pyx_c_api'>__Pyx_GetModuleGlobalName</span>(__pyx_t_3, __pyx_n_s_Enum);<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 118, __pyx_L1_error)</span>
|
|
1368
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
1369
|
+
__pyx_t_2 = <span class='py_c_api'>PyObject_IsInstance</span>(__pyx_v_obj, __pyx_t_3);<span class='error_goto'> if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 118, __pyx_L1_error)</span>
|
|
1370
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
|
|
1371
|
+
if (__pyx_t_2) {
|
|
1372
|
+
/* … */
|
|
1373
|
+
}
|
|
1374
|
+
</pre><pre class="cython line score-5" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">119</span>: if has_attribute(obj, 'value'):</pre>
|
|
1375
|
+
<pre class='cython code score-5 '> __pyx_t_2 = __pyx_f_9datamodel_7parsers_4json_has_attribute(__pyx_v_obj, __pyx_n_u_value); if (unlikely(__pyx_t_2 == ((int)-1) && <span class='py_c_api'>PyErr_Occurred</span>())) <span class='error_goto'>__PYX_ERR(0, 119, __pyx_L1_error)</span>
|
|
1376
|
+
if (__pyx_t_2) {
|
|
1377
|
+
/* … */
|
|
1378
|
+
}
|
|
1379
|
+
</pre><pre class="cython line score-3" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">120</span>: return obj.value</pre>
|
|
1380
|
+
<pre class='cython code score-3 '> <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_r);
|
|
1381
|
+
__pyx_t_3 = <span class='pyx_c_api'>__Pyx_PyObject_GetAttrStr</span>(__pyx_v_obj, __pyx_n_s_value);<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 120, __pyx_L1_error)</span>
|
|
1382
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
1383
|
+
__pyx_r = __pyx_t_3;
|
|
1384
|
+
__pyx_t_3 = 0;
|
|
1385
|
+
goto __pyx_L0;
|
|
1386
|
+
</pre><pre class="cython line score-0"> <span class="">121</span>: else:</pre>
|
|
1387
|
+
<pre class="cython line score-3" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">122</span>: return obj.name</pre>
|
|
1388
|
+
<pre class='cython code score-3 '> /*else*/ {
|
|
1389
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_r);
|
|
1390
|
+
__pyx_t_3 = <span class='pyx_c_api'>__Pyx_PyObject_GetAttrStr</span>(__pyx_v_obj, __pyx_n_s_name);<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 122, __pyx_L1_error)</span>
|
|
1391
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
1392
|
+
__pyx_r = __pyx_t_3;
|
|
1393
|
+
__pyx_t_3 = 0;
|
|
1394
|
+
goto __pyx_L0;
|
|
1395
|
+
}
|
|
1396
|
+
</pre><pre class="cython line score-8" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">123</span>: elif isinstance(obj, Binary): # Handle bytea column from PostgreSQL</pre>
|
|
1397
|
+
<pre class='cython code score-8 '> <span class='pyx_c_api'>__Pyx_GetModuleGlobalName</span>(__pyx_t_3, __pyx_n_s_Binary);<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 123, __pyx_L1_error)</span>
|
|
1398
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
1399
|
+
__pyx_t_2 = <span class='py_c_api'>PyObject_IsInstance</span>(__pyx_v_obj, __pyx_t_3);<span class='error_goto'> if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 123, __pyx_L1_error)</span>
|
|
1400
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
|
|
1401
|
+
if (__pyx_t_2) {
|
|
1402
|
+
/* … */
|
|
1403
|
+
}
|
|
1404
|
+
</pre><pre class="cython line score-3" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">124</span>: return str(obj) # Convert Binary object to string</pre>
|
|
1405
|
+
<pre class='cython code score-3 '> <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_r);
|
|
1406
|
+
__pyx_t_3 = <span class='pyx_c_api'>__Pyx_PyObject_Unicode</span>(__pyx_v_obj);<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 124, __pyx_L1_error)</span>
|
|
1407
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
1408
|
+
__pyx_r = __pyx_t_3;
|
|
1409
|
+
__pyx_t_3 = 0;
|
|
1410
|
+
goto __pyx_L0;
|
|
1411
|
+
</pre><pre class="cython line score-8" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">125</span>: elif isinstance(obj, Field):</pre>
|
|
1412
|
+
<pre class='cython code score-8 '> <span class='pyx_c_api'>__Pyx_GetModuleGlobalName</span>(__pyx_t_3, __pyx_n_s_Field);<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 125, __pyx_L1_error)</span>
|
|
1413
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
1414
|
+
__pyx_t_2 = <span class='py_c_api'>PyObject_IsInstance</span>(__pyx_v_obj, __pyx_t_3);<span class='error_goto'> if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 125, __pyx_L1_error)</span>
|
|
1415
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
|
|
1416
|
+
if (__pyx_t_2) {
|
|
1417
|
+
/* … */
|
|
1418
|
+
}
|
|
1419
|
+
</pre><pre class="cython line score-5" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">126</span>: if has_attribute(obj, 'to_dict'):</pre>
|
|
1420
|
+
<pre class='cython code score-5 '> __pyx_t_2 = __pyx_f_9datamodel_7parsers_4json_has_attribute(__pyx_v_obj, __pyx_n_u_to_dict); if (unlikely(__pyx_t_2 == ((int)-1) && <span class='py_c_api'>PyErr_Occurred</span>())) <span class='error_goto'>__PYX_ERR(0, 126, __pyx_L1_error)</span>
|
|
1421
|
+
if (__pyx_t_2) {
|
|
1422
|
+
/* … */
|
|
1423
|
+
}
|
|
1424
|
+
</pre><pre class="cython line score-17" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">127</span>: return obj.to_dict()</pre>
|
|
1425
|
+
<pre class='cython code score-17 '> <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_r);
|
|
1426
|
+
__pyx_t_4 = <span class='pyx_c_api'>__Pyx_PyObject_GetAttrStr</span>(__pyx_v_obj, __pyx_n_s_to_dict);<span class='error_goto'> if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 127, __pyx_L1_error)</span>
|
|
1427
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4);
|
|
1428
|
+
__pyx_t_1 = NULL;
|
|
1429
|
+
__pyx_t_5 = 0;
|
|
1430
|
+
#if CYTHON_UNPACK_METHODS
|
|
1431
|
+
if (likely(<span class='py_c_api'>PyMethod_Check</span>(__pyx_t_4))) {
|
|
1432
|
+
__pyx_t_1 = <span class='py_macro_api'>PyMethod_GET_SELF</span>(__pyx_t_4);
|
|
1433
|
+
if (likely(__pyx_t_1)) {
|
|
1434
|
+
PyObject* function = <span class='py_macro_api'>PyMethod_GET_FUNCTION</span>(__pyx_t_4);
|
|
1435
|
+
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_t_1);
|
|
1436
|
+
<span class='pyx_macro_api'>__Pyx_INCREF</span>(function);
|
|
1437
|
+
<span class='pyx_macro_api'>__Pyx_DECREF_SET</span>(__pyx_t_4, function);
|
|
1438
|
+
__pyx_t_5 = 1;
|
|
1439
|
+
}
|
|
1440
|
+
}
|
|
1441
|
+
#endif
|
|
1442
|
+
{
|
|
1443
|
+
PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL};
|
|
1444
|
+
__pyx_t_3 = <span class='pyx_c_api'>__Pyx_PyObject_FastCall</span>(__pyx_t_4, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5);
|
|
1445
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_1); __pyx_t_1 = 0;
|
|
1446
|
+
if (unlikely(!__pyx_t_3)) <span class='error_goto'>__PYX_ERR(0, 127, __pyx_L1_error)</span>
|
|
1447
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
1448
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_4); __pyx_t_4 = 0;
|
|
1449
|
+
}
|
|
1450
|
+
__pyx_r = __pyx_t_3;
|
|
1451
|
+
__pyx_t_3 = 0;
|
|
1452
|
+
goto __pyx_L0;
|
|
1453
|
+
</pre><pre class="cython line score-3" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">128</span>: return str(obj)</pre>
|
|
1454
|
+
<pre class='cython code score-3 '> <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_r);
|
|
1455
|
+
__pyx_t_3 = <span class='pyx_c_api'>__Pyx_PyObject_Unicode</span>(__pyx_v_obj);<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 128, __pyx_L1_error)</span>
|
|
1456
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
1457
|
+
__pyx_r = __pyx_t_3;
|
|
1458
|
+
__pyx_t_3 = 0;
|
|
1459
|
+
goto __pyx_L0;
|
|
1460
|
+
</pre><pre class="cython line score-5" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">129</span>: elif has_attribute(obj, 'to_dict'):</pre>
|
|
1461
|
+
<pre class='cython code score-5 '> __pyx_t_2 = __pyx_f_9datamodel_7parsers_4json_has_attribute(__pyx_v_obj, __pyx_n_u_to_dict); if (unlikely(__pyx_t_2 == ((int)-1) && <span class='py_c_api'>PyErr_Occurred</span>())) <span class='error_goto'>__PYX_ERR(0, 129, __pyx_L1_error)</span>
|
|
1462
|
+
if (__pyx_t_2) {
|
|
1463
|
+
/* … */
|
|
1464
|
+
}
|
|
1465
|
+
</pre><pre class="cython line score-17" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">130</span>: return obj.to_dict()</pre>
|
|
1466
|
+
<pre class='cython code score-17 '> <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_r);
|
|
1467
|
+
__pyx_t_4 = <span class='pyx_c_api'>__Pyx_PyObject_GetAttrStr</span>(__pyx_v_obj, __pyx_n_s_to_dict);<span class='error_goto'> if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 130, __pyx_L1_error)</span>
|
|
1468
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4);
|
|
1469
|
+
__pyx_t_1 = NULL;
|
|
1470
|
+
__pyx_t_5 = 0;
|
|
1471
|
+
#if CYTHON_UNPACK_METHODS
|
|
1472
|
+
if (likely(<span class='py_c_api'>PyMethod_Check</span>(__pyx_t_4))) {
|
|
1473
|
+
__pyx_t_1 = <span class='py_macro_api'>PyMethod_GET_SELF</span>(__pyx_t_4);
|
|
1474
|
+
if (likely(__pyx_t_1)) {
|
|
1475
|
+
PyObject* function = <span class='py_macro_api'>PyMethod_GET_FUNCTION</span>(__pyx_t_4);
|
|
1476
|
+
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_t_1);
|
|
1477
|
+
<span class='pyx_macro_api'>__Pyx_INCREF</span>(function);
|
|
1478
|
+
<span class='pyx_macro_api'>__Pyx_DECREF_SET</span>(__pyx_t_4, function);
|
|
1479
|
+
__pyx_t_5 = 1;
|
|
1480
|
+
}
|
|
1481
|
+
}
|
|
1482
|
+
#endif
|
|
1483
|
+
{
|
|
1484
|
+
PyObject *__pyx_callargs[2] = {__pyx_t_1, NULL};
|
|
1485
|
+
__pyx_t_3 = <span class='pyx_c_api'>__Pyx_PyObject_FastCall</span>(__pyx_t_4, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5);
|
|
1486
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_1); __pyx_t_1 = 0;
|
|
1487
|
+
if (unlikely(!__pyx_t_3)) <span class='error_goto'>__PYX_ERR(0, 130, __pyx_L1_error)</span>
|
|
1488
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
1489
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_4); __pyx_t_4 = 0;
|
|
1490
|
+
}
|
|
1491
|
+
__pyx_r = __pyx_t_3;
|
|
1492
|
+
__pyx_t_3 = 0;
|
|
1493
|
+
goto __pyx_L0;
|
|
1494
|
+
</pre><pre class="cython line score-5" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">131</span>: elif has_attribute(obj, 'to_json'):</pre>
|
|
1495
|
+
<pre class='cython code score-5 '> __pyx_t_2 = __pyx_f_9datamodel_7parsers_4json_has_attribute(__pyx_v_obj, __pyx_n_u_to_json); if (unlikely(__pyx_t_2 == ((int)-1) && <span class='py_c_api'>PyErr_Occurred</span>())) <span class='error_goto'>__PYX_ERR(0, 131, __pyx_L1_error)</span>
|
|
1496
|
+
if (__pyx_t_2) {
|
|
1497
|
+
/* … */
|
|
1498
|
+
}
|
|
1499
|
+
</pre><pre class="cython line score-0"> <span class="">132</span>: # Return a JSON representation of the object.</pre>
|
|
1500
|
+
<pre class="cython line score-53" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">133</span>: return orjson.Fragment(obj().encode())</pre>
|
|
1501
|
+
<pre class='cython code score-53 '> <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_r);
|
|
1502
|
+
<span class='pyx_c_api'>__Pyx_GetModuleGlobalName</span>(__pyx_t_4, __pyx_n_s_orjson);<span class='error_goto'> if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 133, __pyx_L1_error)</span>
|
|
1503
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4);
|
|
1504
|
+
__pyx_t_1 = <span class='pyx_c_api'>__Pyx_PyObject_GetAttrStr</span>(__pyx_t_4, __pyx_n_s_Fragment);<span class='error_goto'> if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 133, __pyx_L1_error)</span>
|
|
1505
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1);
|
|
1506
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_4); __pyx_t_4 = 0;
|
|
1507
|
+
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_v_obj);
|
|
1508
|
+
__pyx_t_14 = __pyx_v_obj; __pyx_t_15 = NULL;
|
|
1509
|
+
__pyx_t_5 = 0;
|
|
1510
|
+
#if CYTHON_UNPACK_METHODS
|
|
1511
|
+
if (unlikely(<span class='py_c_api'>PyMethod_Check</span>(__pyx_t_14))) {
|
|
1512
|
+
__pyx_t_15 = <span class='py_macro_api'>PyMethod_GET_SELF</span>(__pyx_t_14);
|
|
1513
|
+
if (likely(__pyx_t_15)) {
|
|
1514
|
+
PyObject* function = <span class='py_macro_api'>PyMethod_GET_FUNCTION</span>(__pyx_t_14);
|
|
1515
|
+
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_t_15);
|
|
1516
|
+
<span class='pyx_macro_api'>__Pyx_INCREF</span>(function);
|
|
1517
|
+
<span class='pyx_macro_api'>__Pyx_DECREF_SET</span>(__pyx_t_14, function);
|
|
1518
|
+
__pyx_t_5 = 1;
|
|
1519
|
+
}
|
|
1520
|
+
}
|
|
1521
|
+
#endif
|
|
1522
|
+
{
|
|
1523
|
+
PyObject *__pyx_callargs[2] = {__pyx_t_15, NULL};
|
|
1524
|
+
__pyx_t_11 = <span class='pyx_c_api'>__Pyx_PyObject_FastCall</span>(__pyx_t_14, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5);
|
|
1525
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_15); __pyx_t_15 = 0;
|
|
1526
|
+
if (unlikely(!__pyx_t_11)) <span class='error_goto'>__PYX_ERR(0, 133, __pyx_L1_error)</span>
|
|
1527
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_11);
|
|
1528
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_14); __pyx_t_14 = 0;
|
|
1529
|
+
}
|
|
1530
|
+
__pyx_t_14 = <span class='pyx_c_api'>__Pyx_PyObject_GetAttrStr</span>(__pyx_t_11, __pyx_n_s_encode);<span class='error_goto'> if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 133, __pyx_L1_error)</span>
|
|
1531
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_14);
|
|
1532
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_11); __pyx_t_11 = 0;
|
|
1533
|
+
__pyx_t_11 = NULL;
|
|
1534
|
+
__pyx_t_5 = 0;
|
|
1535
|
+
#if CYTHON_UNPACK_METHODS
|
|
1536
|
+
if (likely(<span class='py_c_api'>PyMethod_Check</span>(__pyx_t_14))) {
|
|
1537
|
+
__pyx_t_11 = <span class='py_macro_api'>PyMethod_GET_SELF</span>(__pyx_t_14);
|
|
1538
|
+
if (likely(__pyx_t_11)) {
|
|
1539
|
+
PyObject* function = <span class='py_macro_api'>PyMethod_GET_FUNCTION</span>(__pyx_t_14);
|
|
1540
|
+
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_t_11);
|
|
1541
|
+
<span class='pyx_macro_api'>__Pyx_INCREF</span>(function);
|
|
1542
|
+
<span class='pyx_macro_api'>__Pyx_DECREF_SET</span>(__pyx_t_14, function);
|
|
1543
|
+
__pyx_t_5 = 1;
|
|
1544
|
+
}
|
|
1545
|
+
}
|
|
1546
|
+
#endif
|
|
1547
|
+
{
|
|
1548
|
+
PyObject *__pyx_callargs[2] = {__pyx_t_11, NULL};
|
|
1549
|
+
__pyx_t_4 = <span class='pyx_c_api'>__Pyx_PyObject_FastCall</span>(__pyx_t_14, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5);
|
|
1550
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_11); __pyx_t_11 = 0;
|
|
1551
|
+
if (unlikely(!__pyx_t_4)) <span class='error_goto'>__PYX_ERR(0, 133, __pyx_L1_error)</span>
|
|
1552
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4);
|
|
1553
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_14); __pyx_t_14 = 0;
|
|
1554
|
+
}
|
|
1555
|
+
__pyx_t_14 = NULL;
|
|
1556
|
+
__pyx_t_5 = 0;
|
|
1557
|
+
#if CYTHON_UNPACK_METHODS
|
|
1558
|
+
if (unlikely(<span class='py_c_api'>PyMethod_Check</span>(__pyx_t_1))) {
|
|
1559
|
+
__pyx_t_14 = <span class='py_macro_api'>PyMethod_GET_SELF</span>(__pyx_t_1);
|
|
1560
|
+
if (likely(__pyx_t_14)) {
|
|
1561
|
+
PyObject* function = <span class='py_macro_api'>PyMethod_GET_FUNCTION</span>(__pyx_t_1);
|
|
1562
|
+
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_t_14);
|
|
1563
|
+
<span class='pyx_macro_api'>__Pyx_INCREF</span>(function);
|
|
1564
|
+
<span class='pyx_macro_api'>__Pyx_DECREF_SET</span>(__pyx_t_1, function);
|
|
1565
|
+
__pyx_t_5 = 1;
|
|
1566
|
+
}
|
|
1567
|
+
}
|
|
1568
|
+
#endif
|
|
1569
|
+
{
|
|
1570
|
+
PyObject *__pyx_callargs[2] = {__pyx_t_14, __pyx_t_4};
|
|
1571
|
+
__pyx_t_3 = <span class='pyx_c_api'>__Pyx_PyObject_FastCall</span>(__pyx_t_1, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
|
|
1572
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_14); __pyx_t_14 = 0;
|
|
1573
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_4); __pyx_t_4 = 0;
|
|
1574
|
+
if (unlikely(!__pyx_t_3)) <span class='error_goto'>__PYX_ERR(0, 133, __pyx_L1_error)</span>
|
|
1575
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
1576
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0;
|
|
1577
|
+
}
|
|
1578
|
+
__pyx_r = __pyx_t_3;
|
|
1579
|
+
__pyx_t_3 = 0;
|
|
1580
|
+
goto __pyx_L0;
|
|
1581
|
+
</pre><pre class="cython line score-13" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">134</span>: elif isinstance(obj, InitVar) or type(obj).__name__ == 'InitVar':</pre>
|
|
1582
|
+
<pre class='cython code score-13 '> <span class='pyx_c_api'>__Pyx_GetModuleGlobalName</span>(__pyx_t_3, __pyx_n_s_InitVar);<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 134, __pyx_L1_error)</span>
|
|
1583
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
1584
|
+
__pyx_t_6 = <span class='py_c_api'>PyObject_IsInstance</span>(__pyx_v_obj, __pyx_t_3);<span class='error_goto'> if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 134, __pyx_L1_error)</span>
|
|
1585
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
|
|
1586
|
+
if (!__pyx_t_6) {
|
|
1587
|
+
} else {
|
|
1588
|
+
__pyx_t_2 = __pyx_t_6;
|
|
1589
|
+
goto __pyx_L29_bool_binop_done;
|
|
1590
|
+
}
|
|
1591
|
+
__pyx_t_3 = <span class='pyx_c_api'>__Pyx_PyObject_GetAttrStr</span>(((PyObject *)Py_TYPE(__pyx_v_obj)), __pyx_n_s_name_2);<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 134, __pyx_L1_error)</span>
|
|
1592
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
1593
|
+
__pyx_t_6 = (<span class='pyx_c_api'>__Pyx_PyUnicode_Equals</span>(__pyx_t_3, __pyx_n_u_InitVar, Py_EQ)); if (unlikely((__pyx_t_6 < 0))) <span class='error_goto'>__PYX_ERR(0, 134, __pyx_L1_error)</span>
|
|
1594
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
|
|
1595
|
+
__pyx_t_2 = __pyx_t_6;
|
|
1596
|
+
__pyx_L29_bool_binop_done:;
|
|
1597
|
+
if (__pyx_t_2) {
|
|
1598
|
+
/* … */
|
|
1599
|
+
}
|
|
1600
|
+
</pre><pre class="cython line score-0"> <span class="">135</span>: # Handle InitVar explicitly</pre>
|
|
1601
|
+
<pre class="cython line score-2" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">136</span>: return None</pre>
|
|
1602
|
+
<pre class='cython code score-2 '> <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_r);
|
|
1603
|
+
__pyx_r = Py_None; <span class='pyx_macro_api'>__Pyx_INCREF</span>(Py_None);
|
|
1604
|
+
goto __pyx_L0;
|
|
1605
|
+
</pre><pre class="cython line score-6" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">137</span>: raise TypeError(</pre>
|
|
1606
|
+
<pre class='cython code score-6 '> __pyx_t_3 = <span class='pyx_c_api'>__Pyx_PyObject_CallOneArg</span>(__pyx_builtin_TypeError, __pyx_t_1);<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 137, __pyx_L1_error)</span>
|
|
1607
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
1608
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0;
|
|
1609
|
+
<span class='pyx_c_api'>__Pyx_Raise</span>(__pyx_t_3, 0, 0, 0);
|
|
1610
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
|
|
1611
|
+
<span class='error_goto'>__PYX_ERR(0, 137, __pyx_L1_error)</span>
|
|
1612
|
+
</pre><pre class="cython line score-35" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">138</span>: f'{obj!r} of Type {type(obj)} is not JSON serializable'</pre>
|
|
1613
|
+
<pre class='cython code score-35 '> __pyx_t_3 = <span class='py_c_api'>PyTuple_New</span>(4);<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 138, __pyx_L1_error)</span>
|
|
1614
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
1615
|
+
__pyx_t_12 = 0;
|
|
1616
|
+
__pyx_t_16 = 127;
|
|
1617
|
+
__pyx_t_1 = <span class='pyx_c_api'>__Pyx_PyObject_FormatSimpleAndDecref</span>(<span class='py_c_api'>PyObject_Repr</span>(__pyx_v_obj), __pyx_empty_unicode);<span class='error_goto'> if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 138, __pyx_L1_error)</span>
|
|
1618
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1);
|
|
1619
|
+
__pyx_t_16 = (<span class='pyx_c_api'>__Pyx_PyUnicode_MAX_CHAR_VALUE</span>(__pyx_t_1) > __pyx_t_16) ? <span class='pyx_c_api'>__Pyx_PyUnicode_MAX_CHAR_VALUE</span>(__pyx_t_1) : __pyx_t_16;
|
|
1620
|
+
__pyx_t_12 += <span class='pyx_c_api'>__Pyx_PyUnicode_GET_LENGTH</span>(__pyx_t_1);
|
|
1621
|
+
<span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_t_1);
|
|
1622
|
+
<span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_3, 0, __pyx_t_1);
|
|
1623
|
+
__pyx_t_1 = 0;
|
|
1624
|
+
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_kp_u_of_Type);
|
|
1625
|
+
__pyx_t_12 += 9;
|
|
1626
|
+
<span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_kp_u_of_Type);
|
|
1627
|
+
<span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_3, 1, __pyx_kp_u_of_Type);
|
|
1628
|
+
__pyx_t_1 = <span class='pyx_c_api'>__Pyx_PyObject_FormatSimple</span>(((PyObject *)Py_TYPE(__pyx_v_obj)), __pyx_empty_unicode);<span class='error_goto'> if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 138, __pyx_L1_error)</span>
|
|
1629
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1);
|
|
1630
|
+
__pyx_t_16 = (<span class='pyx_c_api'>__Pyx_PyUnicode_MAX_CHAR_VALUE</span>(__pyx_t_1) > __pyx_t_16) ? <span class='pyx_c_api'>__Pyx_PyUnicode_MAX_CHAR_VALUE</span>(__pyx_t_1) : __pyx_t_16;
|
|
1631
|
+
__pyx_t_12 += <span class='pyx_c_api'>__Pyx_PyUnicode_GET_LENGTH</span>(__pyx_t_1);
|
|
1632
|
+
<span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_t_1);
|
|
1633
|
+
<span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_3, 2, __pyx_t_1);
|
|
1634
|
+
__pyx_t_1 = 0;
|
|
1635
|
+
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_kp_u_is_not_JSON_serializable);
|
|
1636
|
+
__pyx_t_12 += 25;
|
|
1637
|
+
<span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_kp_u_is_not_JSON_serializable);
|
|
1638
|
+
<span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_3, 3, __pyx_kp_u_is_not_JSON_serializable);
|
|
1639
|
+
__pyx_t_1 = <span class='pyx_c_api'>__Pyx_PyUnicode_Join</span>(__pyx_t_3, 4, __pyx_t_12, __pyx_t_16);<span class='error_goto'> if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 138, __pyx_L1_error)</span>
|
|
1640
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1);
|
|
1641
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
|
|
1642
|
+
</pre><pre class="cython line score-0"> <span class="">139</span>: )</pre>
|
|
1643
|
+
<pre class="cython line score-0"> <span class="">140</span>: </pre>
|
|
1644
|
+
<pre class="cython line score-124" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">141</span>: def encode(self, object obj, bint naive_utc = True, bint non_str_keys = False, **kwargs) -> str:</pre>
|
|
1645
|
+
<pre class='cython code score-124 '>/* Python wrapper */
|
|
1646
|
+
static PyObject *__pyx_pw_9datamodel_7parsers_4json_11JSONContent_5encode(PyObject *__pyx_v_self,
|
|
1647
|
+
#if CYTHON_METH_FASTCALL
|
|
1648
|
+
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
|
|
1649
|
+
#else
|
|
1650
|
+
PyObject *__pyx_args, PyObject *__pyx_kwds
|
|
1651
|
+
#endif
|
|
1652
|
+
); /*proto*/
|
|
1653
|
+
<span class='py_macro_api'>PyDoc_STRVAR</span>(__pyx_doc_9datamodel_7parsers_4json_11JSONContent_4encode, "JSONContent.encode(self, obj, bool naive_utc=True, bool non_str_keys=False, **kwargs) -> str\n\n Custom default method for handling non-standard JSON serializable types.\n\n Supported types include Decimal, datetime, UUID, pathlib Paths, numpy arrays,\n custom Enums, asyncpg Ranges, and more.\n\n Parameters:\n obj: The object to convert to a JSON-compatible format.\n naive_utc (bool, optional): If True, convert datetime objects to naive UTC.\n non_str_keys (bool, optional): If True, use non-string keys for dictionaries.\n\n Returns:\n A JSON-serializable representation of `obj`.\n\n Raises:\n TypeError: If `obj` is not JSON serializable.\n ");
|
|
1654
|
+
static PyMethodDef __pyx_mdef_9datamodel_7parsers_4json_11JSONContent_5encode = {"encode", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9datamodel_7parsers_4json_11JSONContent_5encode, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9datamodel_7parsers_4json_11JSONContent_4encode};
|
|
1655
|
+
static PyObject *__pyx_pw_9datamodel_7parsers_4json_11JSONContent_5encode(PyObject *__pyx_v_self,
|
|
1656
|
+
#if CYTHON_METH_FASTCALL
|
|
1657
|
+
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
|
|
1658
|
+
#else
|
|
1659
|
+
PyObject *__pyx_args, PyObject *__pyx_kwds
|
|
1660
|
+
#endif
|
|
1661
|
+
) {
|
|
1662
|
+
PyObject *__pyx_v_obj = 0;
|
|
1663
|
+
int __pyx_v_naive_utc;
|
|
1664
|
+
int __pyx_v_non_str_keys;
|
|
1665
|
+
PyObject *__pyx_v_kwargs = 0;
|
|
1666
|
+
#if !CYTHON_METH_FASTCALL
|
|
1667
|
+
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
|
|
1668
|
+
#endif
|
|
1669
|
+
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
|
|
1670
|
+
PyObject *__pyx_r = 0;
|
|
1671
|
+
<span class='refnanny'>__Pyx_RefNannyDeclarations</span>
|
|
1672
|
+
<span class='refnanny'>__Pyx_RefNannySetupContext</span>("encode (wrapper)", 0);
|
|
1673
|
+
#if !CYTHON_METH_FASTCALL
|
|
1674
|
+
#if CYTHON_ASSUME_SAFE_MACROS
|
|
1675
|
+
__pyx_nargs = <span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args);
|
|
1676
|
+
#else
|
|
1677
|
+
__pyx_nargs = <span class='py_c_api'>PyTuple_Size</span>(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
|
|
1678
|
+
#endif
|
|
1679
|
+
#endif
|
|
1680
|
+
__pyx_kwvalues = <span class='pyx_c_api'>__Pyx_KwValues_FASTCALL</span>(__pyx_args, __pyx_nargs);
|
|
1681
|
+
__pyx_v_kwargs = <span class='py_c_api'>PyDict_New</span>(); if (unlikely(!__pyx_v_kwargs)) return NULL;
|
|
1682
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_v_kwargs);
|
|
1683
|
+
{
|
|
1684
|
+
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,&__pyx_n_s_naive_utc,&__pyx_n_s_non_str_keys,0};
|
|
1685
|
+
PyObject* values[3] = {0,0,0};
|
|
1686
|
+
if (__pyx_kwds) {
|
|
1687
|
+
Py_ssize_t kw_args;
|
|
1688
|
+
switch (__pyx_nargs) {
|
|
1689
|
+
case 3: values[2] = <span class='pyx_c_api'>__Pyx_Arg_FASTCALL</span>(__pyx_args, 2);
|
|
1690
|
+
CYTHON_FALLTHROUGH;
|
|
1691
|
+
case 2: values[1] = <span class='pyx_c_api'>__Pyx_Arg_FASTCALL</span>(__pyx_args, 1);
|
|
1692
|
+
CYTHON_FALLTHROUGH;
|
|
1693
|
+
case 1: values[0] = <span class='pyx_c_api'>__Pyx_Arg_FASTCALL</span>(__pyx_args, 0);
|
|
1694
|
+
CYTHON_FALLTHROUGH;
|
|
1695
|
+
case 0: break;
|
|
1696
|
+
default: goto __pyx_L5_argtuple_error;
|
|
1697
|
+
}
|
|
1698
|
+
kw_args = <span class='pyx_c_api'>__Pyx_NumKwargs_FASTCALL</span>(__pyx_kwds);
|
|
1699
|
+
switch (__pyx_nargs) {
|
|
1700
|
+
case 0:
|
|
1701
|
+
if (likely((values[0] = <span class='pyx_c_api'>__Pyx_GetKwValue_FASTCALL</span>(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_obj)) != 0)) {
|
|
1702
|
+
(void)<span class='pyx_c_api'>__Pyx_Arg_NewRef_FASTCALL</span>(values[0]);
|
|
1703
|
+
kw_args--;
|
|
1704
|
+
}
|
|
1705
|
+
else if (unlikely(<span class='py_c_api'>PyErr_Occurred</span>())) <span class='error_goto'>__PYX_ERR(0, 141, __pyx_L3_error)</span>
|
|
1706
|
+
else goto __pyx_L5_argtuple_error;
|
|
1707
|
+
CYTHON_FALLTHROUGH;
|
|
1708
|
+
case 1:
|
|
1709
|
+
if (kw_args > 0) {
|
|
1710
|
+
PyObject* value = <span class='pyx_c_api'>__Pyx_GetKwValue_FASTCALL</span>(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_naive_utc);
|
|
1711
|
+
if (value) { values[1] = <span class='pyx_c_api'>__Pyx_Arg_NewRef_FASTCALL</span>(value); kw_args--; }
|
|
1712
|
+
else if (unlikely(<span class='py_c_api'>PyErr_Occurred</span>())) <span class='error_goto'>__PYX_ERR(0, 141, __pyx_L3_error)</span>
|
|
1713
|
+
}
|
|
1714
|
+
CYTHON_FALLTHROUGH;
|
|
1715
|
+
case 2:
|
|
1716
|
+
if (kw_args > 0) {
|
|
1717
|
+
PyObject* value = <span class='pyx_c_api'>__Pyx_GetKwValue_FASTCALL</span>(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_non_str_keys);
|
|
1718
|
+
if (value) { values[2] = <span class='pyx_c_api'>__Pyx_Arg_NewRef_FASTCALL</span>(value); kw_args--; }
|
|
1719
|
+
else if (unlikely(<span class='py_c_api'>PyErr_Occurred</span>())) <span class='error_goto'>__PYX_ERR(0, 141, __pyx_L3_error)</span>
|
|
1720
|
+
}
|
|
1721
|
+
}
|
|
1722
|
+
if (unlikely(kw_args > 0)) {
|
|
1723
|
+
const Py_ssize_t kwd_pos_args = __pyx_nargs;
|
|
1724
|
+
if (unlikely(<span class='pyx_c_api'>__Pyx_ParseOptionalKeywords</span>(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v_kwargs, values + 0, kwd_pos_args, "encode") < 0)) <span class='error_goto'>__PYX_ERR(0, 141, __pyx_L3_error)</span>
|
|
1725
|
+
}
|
|
1726
|
+
} else {
|
|
1727
|
+
switch (__pyx_nargs) {
|
|
1728
|
+
case 3: values[2] = <span class='pyx_c_api'>__Pyx_Arg_FASTCALL</span>(__pyx_args, 2);
|
|
1729
|
+
CYTHON_FALLTHROUGH;
|
|
1730
|
+
case 2: values[1] = <span class='pyx_c_api'>__Pyx_Arg_FASTCALL</span>(__pyx_args, 1);
|
|
1731
|
+
CYTHON_FALLTHROUGH;
|
|
1732
|
+
case 1: values[0] = <span class='pyx_c_api'>__Pyx_Arg_FASTCALL</span>(__pyx_args, 0);
|
|
1733
|
+
break;
|
|
1734
|
+
default: goto __pyx_L5_argtuple_error;
|
|
1735
|
+
}
|
|
1736
|
+
}
|
|
1737
|
+
__pyx_v_obj = values[0];
|
|
1738
|
+
if (values[1]) {
|
|
1739
|
+
__pyx_v_naive_utc = <span class='pyx_c_api'>__Pyx_PyObject_IsTrue</span>(values[1]); if (unlikely((__pyx_v_naive_utc == (int)-1) && <span class='py_c_api'>PyErr_Occurred</span>())) <span class='error_goto'>__PYX_ERR(0, 141, __pyx_L3_error)</span>
|
|
1740
|
+
} else {
|
|
1741
|
+
__pyx_v_naive_utc = ((int)1);
|
|
1742
|
+
}
|
|
1743
|
+
if (values[2]) {
|
|
1744
|
+
__pyx_v_non_str_keys = <span class='pyx_c_api'>__Pyx_PyObject_IsTrue</span>(values[2]); if (unlikely((__pyx_v_non_str_keys == (int)-1) && <span class='py_c_api'>PyErr_Occurred</span>())) <span class='error_goto'>__PYX_ERR(0, 141, __pyx_L3_error)</span>
|
|
1745
|
+
} else {
|
|
1746
|
+
__pyx_v_non_str_keys = ((int)0);
|
|
1747
|
+
}
|
|
1748
|
+
}
|
|
1749
|
+
goto __pyx_L6_skip;
|
|
1750
|
+
__pyx_L5_argtuple_error:;
|
|
1751
|
+
<span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>("encode", 0, 1, 3, __pyx_nargs); <span class='error_goto'>__PYX_ERR(0, 141, __pyx_L3_error)</span>
|
|
1752
|
+
__pyx_L6_skip:;
|
|
1753
|
+
goto __pyx_L4_argument_unpacking_done;
|
|
1754
|
+
__pyx_L3_error:;
|
|
1755
|
+
{
|
|
1756
|
+
Py_ssize_t __pyx_temp;
|
|
1757
|
+
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
|
|
1758
|
+
<span class='pyx_c_api'>__Pyx_Arg_XDECREF_FASTCALL</span>(values[__pyx_temp]);
|
|
1759
|
+
}
|
|
1760
|
+
}
|
|
1761
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_v_kwargs); __pyx_v_kwargs = 0;
|
|
1762
|
+
<span class='pyx_c_api'>__Pyx_AddTraceback</span>("datamodel.parsers.json.JSONContent.encode", __pyx_clineno, __pyx_lineno, __pyx_filename);
|
|
1763
|
+
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>();
|
|
1764
|
+
return NULL;
|
|
1765
|
+
__pyx_L4_argument_unpacking_done:;
|
|
1766
|
+
__pyx_r = __pyx_pf_9datamodel_7parsers_4json_11JSONContent_4encode(((struct __pyx_obj_9datamodel_7parsers_4json_JSONContent *)__pyx_v_self), __pyx_v_obj, __pyx_v_naive_utc, __pyx_v_non_str_keys, __pyx_v_kwargs);
|
|
1767
|
+
|
|
1768
|
+
/* function exit code */
|
|
1769
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_v_kwargs);
|
|
1770
|
+
{
|
|
1771
|
+
Py_ssize_t __pyx_temp;
|
|
1772
|
+
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
|
|
1773
|
+
<span class='pyx_c_api'>__Pyx_Arg_XDECREF_FASTCALL</span>(values[__pyx_temp]);
|
|
1774
|
+
}
|
|
1775
|
+
}
|
|
1776
|
+
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>();
|
|
1777
|
+
return __pyx_r;
|
|
1778
|
+
}
|
|
1779
|
+
|
|
1780
|
+
static PyObject *__pyx_pf_9datamodel_7parsers_4json_11JSONContent_4encode(struct __pyx_obj_9datamodel_7parsers_4json_JSONContent *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_naive_utc, int __pyx_v_non_str_keys, PyObject *__pyx_v_kwargs) {
|
|
1781
|
+
int __pyx_v_opt;
|
|
1782
|
+
PyObject *__pyx_v_options = NULL;
|
|
1783
|
+
PyObject *__pyx_v_ex = NULL;
|
|
1784
|
+
PyObject *__pyx_r = NULL;
|
|
1785
|
+
/* … */
|
|
1786
|
+
/* function exit code */
|
|
1787
|
+
__pyx_L1_error:;
|
|
1788
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_1);
|
|
1789
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_3);
|
|
1790
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_4);
|
|
1791
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_8);
|
|
1792
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_9);
|
|
1793
|
+
<span class='pyx_c_api'>__Pyx_AddTraceback</span>("datamodel.parsers.json.JSONContent.encode", __pyx_clineno, __pyx_lineno, __pyx_filename);
|
|
1794
|
+
__pyx_r = NULL;
|
|
1795
|
+
__pyx_L0:;
|
|
1796
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_v_options);
|
|
1797
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_v_ex);
|
|
1798
|
+
<span class='refnanny'>__Pyx_XGIVEREF</span>(__pyx_r);
|
|
1799
|
+
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>();
|
|
1800
|
+
return __pyx_r;
|
|
1801
|
+
}
|
|
1802
|
+
/* … */
|
|
1803
|
+
__pyx_tuple__6 = <span class='py_c_api'>PyTuple_Pack</span>(8, __pyx_n_s_self, __pyx_n_s_obj, __pyx_n_s_naive_utc, __pyx_n_s_non_str_keys, __pyx_n_s_kwargs, __pyx_n_s_opt, __pyx_n_s_options, __pyx_n_s_ex);<span class='error_goto'> if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 141, __pyx_L1_error)</span>
|
|
1804
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_tuple__6);
|
|
1805
|
+
<span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_tuple__6);
|
|
1806
|
+
__pyx_codeobj__7 = (PyObject*)<span class='pyx_c_api'>__Pyx_PyCode_New</span>(4, 0, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__6, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_datamodel_parsers_json_pyx, __pyx_n_s_encode, 141, __pyx_empty_bytes);<span class='error_goto'> if (unlikely(!__pyx_codeobj__7)) __PYX_ERR(0, 141, __pyx_L1_error)</span>
|
|
1807
|
+
/* … */
|
|
1808
|
+
__pyx_t_3 = <span class='pyx_c_api'>__Pyx_PyDict_NewPresized</span>(1);<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 141, __pyx_L1_error)</span>
|
|
1809
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
1810
|
+
if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_t_3, __pyx_n_s_return, __pyx_n_s_str) < 0) <span class='error_goto'>__PYX_ERR(0, 141, __pyx_L1_error)</span>
|
|
1811
|
+
__pyx_t_4 = <span class='pyx_c_api'>__Pyx_CyFunction_New</span>(&__pyx_mdef_9datamodel_7parsers_4json_11JSONContent_5encode, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_JSONContent_encode, NULL, __pyx_n_s_datamodel_parsers_json, __pyx_d, ((PyObject *)__pyx_codeobj__7));<span class='error_goto'> if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 141, __pyx_L1_error)</span>
|
|
1812
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4);
|
|
1813
|
+
<span class='pyx_c_api'>__Pyx_CyFunction_SetDefaultsTuple</span>(__pyx_t_4, __pyx_tuple__8);
|
|
1814
|
+
<span class='pyx_c_api'>__Pyx_CyFunction_SetAnnotationsDict</span>(__pyx_t_4, __pyx_t_3);
|
|
1815
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
|
|
1816
|
+
if (<span class='pyx_c_api'>__Pyx_SetItemOnTypeDict</span>((PyObject *)__pyx_ptype_9datamodel_7parsers_4json_JSONContent, __pyx_n_s_encode, __pyx_t_4) < 0) <span class='error_goto'>__PYX_ERR(0, 141, __pyx_L1_error)</span>
|
|
1817
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_4); __pyx_t_4 = 0;
|
|
1818
|
+
<span class='py_c_api'>PyType_Modified</span>(__pyx_ptype_9datamodel_7parsers_4json_JSONContent);
|
|
1819
|
+
__pyx_tuple__8 = <span class='py_c_api'>PyTuple_Pack</span>(2, Py_True, Py_False);<span class='error_goto'> if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 141, __pyx_L1_error)</span>
|
|
1820
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_tuple__8);
|
|
1821
|
+
<span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_tuple__8);
|
|
1822
|
+
</pre><pre class="cython line score-0"> <span class="">142</span>: """</pre>
|
|
1823
|
+
<pre class="cython line score-0"> <span class="">143</span>: Custom default method for handling non-standard JSON serializable types.</pre>
|
|
1824
|
+
<pre class="cython line score-0"> <span class="">144</span>: </pre>
|
|
1825
|
+
<pre class="cython line score-0"> <span class="">145</span>: Supported types include Decimal, datetime, UUID, pathlib Paths, numpy arrays,</pre>
|
|
1826
|
+
<pre class="cython line score-0"> <span class="">146</span>: custom Enums, asyncpg Ranges, and more.</pre>
|
|
1827
|
+
<pre class="cython line score-0"> <span class="">147</span>: </pre>
|
|
1828
|
+
<pre class="cython line score-0"> <span class="">148</span>: Parameters:</pre>
|
|
1829
|
+
<pre class="cython line score-0"> <span class="">149</span>: obj: The object to convert to a JSON-compatible format.</pre>
|
|
1830
|
+
<pre class="cython line score-0"> <span class="">150</span>: naive_utc (bool, optional): If True, convert datetime objects to naive UTC.</pre>
|
|
1831
|
+
<pre class="cython line score-0"> <span class="">151</span>: non_str_keys (bool, optional): If True, use non-string keys for dictionaries.</pre>
|
|
1832
|
+
<pre class="cython line score-0"> <span class="">152</span>: </pre>
|
|
1833
|
+
<pre class="cython line score-0"> <span class="">153</span>: Returns:</pre>
|
|
1834
|
+
<pre class="cython line score-0"> <span class="">154</span>: A JSON-serializable representation of `obj`.</pre>
|
|
1835
|
+
<pre class="cython line score-0"> <span class="">155</span>: </pre>
|
|
1836
|
+
<pre class="cython line score-0"> <span class="">156</span>: Raises:</pre>
|
|
1837
|
+
<pre class="cython line score-0"> <span class="">157</span>: TypeError: If `obj` is not JSON serializable.</pre>
|
|
1838
|
+
<pre class="cython line score-0"> <span class="">158</span>: """</pre>
|
|
1839
|
+
<pre class="cython line score-10" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">159</span>: cdef int opt = ORJSON_DEFAULT_OPTIONS</pre>
|
|
1840
|
+
<pre class='cython code score-10 '> <span class='pyx_c_api'>__Pyx_GetModuleGlobalName</span>(__pyx_t_1, __pyx_n_s_ORJSON_DEFAULT_OPTIONS);<span class='error_goto'> if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 159, __pyx_L1_error)</span>
|
|
1841
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1);
|
|
1842
|
+
__pyx_t_2 = <span class='pyx_c_api'>__Pyx_PyInt_As_int</span>(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && <span class='py_c_api'>PyErr_Occurred</span>())) <span class='error_goto'>__PYX_ERR(0, 159, __pyx_L1_error)</span>
|
|
1843
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0;
|
|
1844
|
+
__pyx_v_opt = __pyx_t_2;
|
|
1845
|
+
</pre><pre class="cython line score-0" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">160</span>: if naive_utc:</pre>
|
|
1846
|
+
<pre class='cython code score-0 '> if (__pyx_v_naive_utc) {
|
|
1847
|
+
/* … */
|
|
1848
|
+
}
|
|
1849
|
+
</pre><pre class="cython line score-22" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">161</span>: opt |= orjson.OPT_NAIVE_UTC</pre>
|
|
1850
|
+
<pre class='cython code score-22 '> __pyx_t_1 = <span class='pyx_c_api'>__Pyx_PyInt_From_int</span>(__pyx_v_opt);<span class='error_goto'> if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 161, __pyx_L1_error)</span>
|
|
1851
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1);
|
|
1852
|
+
<span class='pyx_c_api'>__Pyx_GetModuleGlobalName</span>(__pyx_t_3, __pyx_n_s_orjson);<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 161, __pyx_L1_error)</span>
|
|
1853
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
1854
|
+
__pyx_t_4 = <span class='pyx_c_api'>__Pyx_PyObject_GetAttrStr</span>(__pyx_t_3, __pyx_n_s_OPT_NAIVE_UTC);<span class='error_goto'> if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 161, __pyx_L1_error)</span>
|
|
1855
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4);
|
|
1856
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
|
|
1857
|
+
__pyx_t_3 = <span class='py_c_api'>PyNumber_InPlaceOr</span>(__pyx_t_1, __pyx_t_4);<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 161, __pyx_L1_error)</span>
|
|
1858
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
1859
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0;
|
|
1860
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_4); __pyx_t_4 = 0;
|
|
1861
|
+
__pyx_t_2 = <span class='pyx_c_api'>__Pyx_PyInt_As_int</span>(__pyx_t_3); if (unlikely((__pyx_t_2 == (int)-1) && <span class='py_c_api'>PyErr_Occurred</span>())) <span class='error_goto'>__PYX_ERR(0, 161, __pyx_L1_error)</span>
|
|
1862
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
|
|
1863
|
+
__pyx_v_opt = __pyx_t_2;
|
|
1864
|
+
</pre><pre class="cython line score-0" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">162</span>: if non_str_keys:</pre>
|
|
1865
|
+
<pre class='cython code score-0 '> if (__pyx_v_non_str_keys) {
|
|
1866
|
+
/* … */
|
|
1867
|
+
}
|
|
1868
|
+
</pre><pre class="cython line score-22" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">163</span>: opt |= orjson.OPT_NON_STR_KEYS</pre>
|
|
1869
|
+
<pre class='cython code score-22 '> __pyx_t_3 = <span class='pyx_c_api'>__Pyx_PyInt_From_int</span>(__pyx_v_opt);<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 163, __pyx_L1_error)</span>
|
|
1870
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
1871
|
+
<span class='pyx_c_api'>__Pyx_GetModuleGlobalName</span>(__pyx_t_4, __pyx_n_s_orjson);<span class='error_goto'> if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 163, __pyx_L1_error)</span>
|
|
1872
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4);
|
|
1873
|
+
__pyx_t_1 = <span class='pyx_c_api'>__Pyx_PyObject_GetAttrStr</span>(__pyx_t_4, __pyx_n_s_OPT_NON_STR_KEYS);<span class='error_goto'> if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 163, __pyx_L1_error)</span>
|
|
1874
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1);
|
|
1875
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_4); __pyx_t_4 = 0;
|
|
1876
|
+
__pyx_t_4 = <span class='py_c_api'>PyNumber_InPlaceOr</span>(__pyx_t_3, __pyx_t_1);<span class='error_goto'> if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 163, __pyx_L1_error)</span>
|
|
1877
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4);
|
|
1878
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
|
|
1879
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0;
|
|
1880
|
+
__pyx_t_2 = <span class='pyx_c_api'>__Pyx_PyInt_As_int</span>(__pyx_t_4); if (unlikely((__pyx_t_2 == (int)-1) && <span class='py_c_api'>PyErr_Occurred</span>())) <span class='error_goto'>__PYX_ERR(0, 163, __pyx_L1_error)</span>
|
|
1881
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_4); __pyx_t_4 = 0;
|
|
1882
|
+
__pyx_v_opt = __pyx_t_2;
|
|
1883
|
+
</pre><pre class="cython line score-0"> <span class="">164</span>: options = {</pre>
|
|
1884
|
+
<pre class="cython line score-10" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">165</span>: "default": self.default,</pre>
|
|
1885
|
+
<pre class='cython code score-10 '> __pyx_t_4 = <span class='pyx_c_api'>__Pyx_PyDict_NewPresized</span>(2);<span class='error_goto'> if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 165, __pyx_L1_error)</span>
|
|
1886
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4);
|
|
1887
|
+
__pyx_t_1 = <span class='pyx_c_api'>__Pyx_PyObject_GetAttrStr</span>(((PyObject *)__pyx_v_self), __pyx_n_s_default);<span class='error_goto'> if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 165, __pyx_L1_error)</span>
|
|
1888
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1);
|
|
1889
|
+
if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_t_4, __pyx_n_u_default, __pyx_t_1) < 0) <span class='error_goto'>__PYX_ERR(0, 165, __pyx_L1_error)</span>
|
|
1890
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0;
|
|
1891
|
+
</pre><pre class="cython line score-8" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">166</span>: "option": opt</pre>
|
|
1892
|
+
<pre class='cython code score-8 '> __pyx_t_1 = <span class='pyx_c_api'>__Pyx_PyInt_From_int</span>(__pyx_v_opt);<span class='error_goto'> if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 166, __pyx_L1_error)</span>
|
|
1893
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1);
|
|
1894
|
+
if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_t_4, __pyx_n_u_option, __pyx_t_1) < 0) <span class='error_goto'>__PYX_ERR(0, 165, __pyx_L1_error)</span>
|
|
1895
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0;
|
|
1896
|
+
__pyx_v_options = ((PyObject*)__pyx_t_4);
|
|
1897
|
+
__pyx_t_4 = 0;
|
|
1898
|
+
</pre><pre class="cython line score-0"> <span class="">167</span>: }</pre>
|
|
1899
|
+
<pre class="cython line score-1" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">168</span>: options.update(kwargs)</pre>
|
|
1900
|
+
<pre class='cython code score-1 '> __pyx_t_4 = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyDict_Type_update, __pyx_v_options, __pyx_v_kwargs);<span class='error_goto'> if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 168, __pyx_L1_error)</span>
|
|
1901
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4);
|
|
1902
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_4); __pyx_t_4 = 0;
|
|
1903
|
+
</pre><pre class="cython line score-9" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">169</span>: try:</pre>
|
|
1904
|
+
<pre class='cython code score-9 '> {
|
|
1905
|
+
/*try:*/ {
|
|
1906
|
+
/* … */
|
|
1907
|
+
}
|
|
1908
|
+
__pyx_L5_error:;
|
|
1909
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_1); __pyx_t_1 = 0;
|
|
1910
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
|
|
1911
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_4); __pyx_t_4 = 0;
|
|
1912
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_8); __pyx_t_8 = 0;
|
|
1913
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_9); __pyx_t_9 = 0;
|
|
1914
|
+
/* … */
|
|
1915
|
+
__pyx_L7_except_error:;
|
|
1916
|
+
<span class='refnanny'>__Pyx_XGIVEREF</span>(__pyx_t_5);
|
|
1917
|
+
<span class='refnanny'>__Pyx_XGIVEREF</span>(__pyx_t_6);
|
|
1918
|
+
<span class='refnanny'>__Pyx_XGIVEREF</span>(__pyx_t_7);
|
|
1919
|
+
<span class='pyx_c_api'>__Pyx_ExceptionReset</span>(__pyx_t_5, __pyx_t_6, __pyx_t_7);
|
|
1920
|
+
goto __pyx_L1_error;
|
|
1921
|
+
__pyx_L9_try_return:;
|
|
1922
|
+
<span class='refnanny'>__Pyx_XGIVEREF</span>(__pyx_t_5);
|
|
1923
|
+
<span class='refnanny'>__Pyx_XGIVEREF</span>(__pyx_t_6);
|
|
1924
|
+
<span class='refnanny'>__Pyx_XGIVEREF</span>(__pyx_t_7);
|
|
1925
|
+
<span class='pyx_c_api'>__Pyx_ExceptionReset</span>(__pyx_t_5, __pyx_t_6, __pyx_t_7);
|
|
1926
|
+
goto __pyx_L0;
|
|
1927
|
+
}
|
|
1928
|
+
</pre><pre class="cython line score-19" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">170</span>: return orjson.dumps(</pre>
|
|
1929
|
+
<pre class='cython code score-19 '> <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_r);
|
|
1930
|
+
/* … */
|
|
1931
|
+
<span class='pyx_c_api'>__Pyx_GetModuleGlobalName</span>(__pyx_t_1, __pyx_n_s_orjson);<span class='error_goto'> if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 170, __pyx_L5_error)</span>
|
|
1932
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1);
|
|
1933
|
+
/* … */
|
|
1934
|
+
__pyx_t_3 = <span class='pyx_c_api'>__Pyx_PyObject_GetAttrStr</span>(__pyx_t_1, __pyx_n_s_dumps);<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 170, __pyx_L5_error)</span>
|
|
1935
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
1936
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0;
|
|
1937
|
+
/* … */
|
|
1938
|
+
__pyx_t_1 = <span class='py_c_api'>PyTuple_New</span>(1);<span class='error_goto'> if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 170, __pyx_L5_error)</span>
|
|
1939
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1);
|
|
1940
|
+
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_v_obj);
|
|
1941
|
+
<span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_v_obj);
|
|
1942
|
+
if (<span class='pyx_c_api'>__Pyx_PyTuple_SET_ITEM</span>(__pyx_t_1, 0, __pyx_v_obj)) <span class='error_goto'>__PYX_ERR(0, 170, __pyx_L5_error)</span>;
|
|
1943
|
+
/* … */
|
|
1944
|
+
__pyx_t_9 = <span class='pyx_c_api'>__Pyx_PyObject_Call</span>(__pyx_t_3, __pyx_t_1, __pyx_t_8);<span class='error_goto'> if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 170, __pyx_L5_error)</span>
|
|
1945
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_9);
|
|
1946
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
|
|
1947
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0;
|
|
1948
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_8); __pyx_t_8 = 0;
|
|
1949
|
+
</pre><pre class="cython line score-0"> <span class="">171</span>: obj,</pre>
|
|
1950
|
+
<pre class="cython line score-5" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">172</span>: **options</pre>
|
|
1951
|
+
<pre class='cython code score-5 '> __pyx_t_8 = <span class='py_c_api'>PyDict_Copy</span>(__pyx_v_options);<span class='error_goto'> if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 172, __pyx_L5_error)</span>
|
|
1952
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_8);
|
|
1953
|
+
</pre><pre class="cython line score-24" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">173</span>: ).decode('utf-8')</pre>
|
|
1954
|
+
<pre class='cython code score-24 '> __pyx_t_8 = <span class='pyx_c_api'>__Pyx_PyObject_GetAttrStr</span>(__pyx_t_9, __pyx_n_s_decode);<span class='error_goto'> if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 173, __pyx_L5_error)</span>
|
|
1955
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_8);
|
|
1956
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_9); __pyx_t_9 = 0;
|
|
1957
|
+
__pyx_t_9 = NULL;
|
|
1958
|
+
__pyx_t_10 = 0;
|
|
1959
|
+
#if CYTHON_UNPACK_METHODS
|
|
1960
|
+
if (likely(<span class='py_c_api'>PyMethod_Check</span>(__pyx_t_8))) {
|
|
1961
|
+
__pyx_t_9 = <span class='py_macro_api'>PyMethod_GET_SELF</span>(__pyx_t_8);
|
|
1962
|
+
if (likely(__pyx_t_9)) {
|
|
1963
|
+
PyObject* function = <span class='py_macro_api'>PyMethod_GET_FUNCTION</span>(__pyx_t_8);
|
|
1964
|
+
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_t_9);
|
|
1965
|
+
<span class='pyx_macro_api'>__Pyx_INCREF</span>(function);
|
|
1966
|
+
<span class='pyx_macro_api'>__Pyx_DECREF_SET</span>(__pyx_t_8, function);
|
|
1967
|
+
__pyx_t_10 = 1;
|
|
1968
|
+
}
|
|
1969
|
+
}
|
|
1970
|
+
#endif
|
|
1971
|
+
{
|
|
1972
|
+
PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_kp_u_utf_8};
|
|
1973
|
+
__pyx_t_4 = <span class='pyx_c_api'>__Pyx_PyObject_FastCall</span>(__pyx_t_8, __pyx_callargs+1-__pyx_t_10, 1+__pyx_t_10);
|
|
1974
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_9); __pyx_t_9 = 0;
|
|
1975
|
+
if (unlikely(!__pyx_t_4)) <span class='error_goto'>__PYX_ERR(0, 173, __pyx_L5_error)</span>
|
|
1976
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4);
|
|
1977
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_8); __pyx_t_8 = 0;
|
|
1978
|
+
}
|
|
1979
|
+
if (!(likely(<span class='py_c_api'>PyUnicode_CheckExact</span>(__pyx_t_4))||((__pyx_t_4) == Py_None) || <span class='pyx_c_api'>__Pyx_RaiseUnexpectedTypeError</span>("unicode", __pyx_t_4))) <span class='error_goto'>__PYX_ERR(0, 173, __pyx_L5_error)</span>
|
|
1980
|
+
__pyx_r = ((PyObject*)__pyx_t_4);
|
|
1981
|
+
__pyx_t_4 = 0;
|
|
1982
|
+
goto __pyx_L9_try_return;
|
|
1983
|
+
</pre><pre class="cython line score-30" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">174</span>: except orjson.JSONEncodeError as ex:</pre>
|
|
1984
|
+
<pre class='cython code score-30 '> <span class='pyx_c_api'>__Pyx_ErrFetch</span>(&__pyx_t_4, &__pyx_t_8, &__pyx_t_9);
|
|
1985
|
+
<span class='pyx_c_api'>__Pyx_GetModuleGlobalName</span>(__pyx_t_1, __pyx_n_s_orjson);<span class='error_goto'> if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 174, __pyx_L7_except_error)</span>
|
|
1986
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1);
|
|
1987
|
+
__pyx_t_3 = <span class='pyx_c_api'>__Pyx_PyObject_GetAttrStr</span>(__pyx_t_1, __pyx_n_s_JSONEncodeError);<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 174, __pyx_L7_except_error)</span>
|
|
1988
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
1989
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0;
|
|
1990
|
+
__pyx_t_2 = <span class='pyx_c_api'>__Pyx_PyErr_GivenExceptionMatches</span>(__pyx_t_4, __pyx_t_3);
|
|
1991
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
|
|
1992
|
+
<span class='pyx_c_api'>__Pyx_ErrRestore</span>(__pyx_t_4, __pyx_t_8, __pyx_t_9);
|
|
1993
|
+
__pyx_t_4 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0;
|
|
1994
|
+
if (__pyx_t_2) {
|
|
1995
|
+
<span class='pyx_c_api'>__Pyx_AddTraceback</span>("datamodel.parsers.json.JSONContent.encode", __pyx_clineno, __pyx_lineno, __pyx_filename);
|
|
1996
|
+
if (<span class='pyx_c_api'>__Pyx_GetException</span>(&__pyx_t_9, &__pyx_t_8, &__pyx_t_4) < 0) <span class='error_goto'>__PYX_ERR(0, 174, __pyx_L7_except_error)</span>
|
|
1997
|
+
<span class='refnanny'>__Pyx_XGOTREF</span>(__pyx_t_9);
|
|
1998
|
+
<span class='refnanny'>__Pyx_XGOTREF</span>(__pyx_t_8);
|
|
1999
|
+
<span class='refnanny'>__Pyx_XGOTREF</span>(__pyx_t_4);
|
|
2000
|
+
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_t_8);
|
|
2001
|
+
__pyx_v_ex = __pyx_t_8;
|
|
2002
|
+
/*try:*/ {
|
|
2003
|
+
/* … */
|
|
2004
|
+
/*finally:*/ {
|
|
2005
|
+
__pyx_L16_error:;
|
|
2006
|
+
/*exception exit:*/{
|
|
2007
|
+
__Pyx_PyThreadState_declare
|
|
2008
|
+
__Pyx_PyThreadState_assign
|
|
2009
|
+
__pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0;
|
|
2010
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_1); __pyx_t_1 = 0;
|
|
2011
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
|
|
2012
|
+
if (PY_MAJOR_VERSION >= 3) <span class='pyx_c_api'>__Pyx_ExceptionSwap</span>(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
|
|
2013
|
+
if ((PY_MAJOR_VERSION < 3) || unlikely(<span class='pyx_c_api'>__Pyx_GetException</span>(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15) < 0)) <span class='pyx_c_api'>__Pyx_ErrFetch</span>(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
|
|
2014
|
+
<span class='refnanny'>__Pyx_XGOTREF</span>(__pyx_t_13);
|
|
2015
|
+
<span class='refnanny'>__Pyx_XGOTREF</span>(__pyx_t_14);
|
|
2016
|
+
<span class='refnanny'>__Pyx_XGOTREF</span>(__pyx_t_15);
|
|
2017
|
+
<span class='refnanny'>__Pyx_XGOTREF</span>(__pyx_t_16);
|
|
2018
|
+
<span class='refnanny'>__Pyx_XGOTREF</span>(__pyx_t_17);
|
|
2019
|
+
<span class='refnanny'>__Pyx_XGOTREF</span>(__pyx_t_18);
|
|
2020
|
+
__pyx_t_2 = __pyx_lineno; __pyx_t_11 = __pyx_clineno; __pyx_t_12 = __pyx_filename;
|
|
2021
|
+
{
|
|
2022
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_v_ex); __pyx_v_ex = 0;
|
|
2023
|
+
}
|
|
2024
|
+
if (PY_MAJOR_VERSION >= 3) {
|
|
2025
|
+
<span class='refnanny'>__Pyx_XGIVEREF</span>(__pyx_t_16);
|
|
2026
|
+
<span class='refnanny'>__Pyx_XGIVEREF</span>(__pyx_t_17);
|
|
2027
|
+
<span class='refnanny'>__Pyx_XGIVEREF</span>(__pyx_t_18);
|
|
2028
|
+
<span class='pyx_c_api'>__Pyx_ExceptionReset</span>(__pyx_t_16, __pyx_t_17, __pyx_t_18);
|
|
2029
|
+
}
|
|
2030
|
+
<span class='refnanny'>__Pyx_XGIVEREF</span>(__pyx_t_13);
|
|
2031
|
+
<span class='refnanny'>__Pyx_XGIVEREF</span>(__pyx_t_14);
|
|
2032
|
+
<span class='refnanny'>__Pyx_XGIVEREF</span>(__pyx_t_15);
|
|
2033
|
+
<span class='pyx_c_api'>__Pyx_ErrRestore</span>(__pyx_t_13, __pyx_t_14, __pyx_t_15);
|
|
2034
|
+
__pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0;
|
|
2035
|
+
__pyx_lineno = __pyx_t_2; __pyx_clineno = __pyx_t_11; __pyx_filename = __pyx_t_12;
|
|
2036
|
+
goto __pyx_L7_except_error;
|
|
2037
|
+
}
|
|
2038
|
+
}
|
|
2039
|
+
}
|
|
2040
|
+
goto __pyx_L7_except_error;
|
|
2041
|
+
</pre><pre class="cython line score-6" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">175</span>: raise ParserError(</pre>
|
|
2042
|
+
<pre class='cython code score-6 '> __pyx_t_3 = <span class='pyx_c_api'>__Pyx_PyObject_CallOneArg</span>(((PyObject *)__pyx_ptype_9datamodel_10exceptions_ParserError), __pyx_t_1);<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 175, __pyx_L16_error)</span>
|
|
2043
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
2044
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0;
|
|
2045
|
+
<span class='pyx_c_api'>__Pyx_Raise</span>(__pyx_t_3, 0, 0, 0);
|
|
2046
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
|
|
2047
|
+
<span class='error_goto'>__PYX_ERR(0, 175, __pyx_L16_error)</span>
|
|
2048
|
+
}
|
|
2049
|
+
</pre><pre class="cython line score-5" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">176</span>: f"Invalid JSON data: {ex}"</pre>
|
|
2050
|
+
<pre class='cython code score-5 '> __pyx_t_3 = <span class='pyx_c_api'>__Pyx_PyObject_FormatSimple</span>(__pyx_v_ex, __pyx_empty_unicode);<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 176, __pyx_L16_error)</span>
|
|
2051
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
2052
|
+
__pyx_t_1 = <span class='pyx_c_api'>__Pyx_PyUnicode_Concat</span>(__pyx_kp_u_Invalid_JSON_data, __pyx_t_3);<span class='error_goto'> if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 176, __pyx_L16_error)</span>
|
|
2053
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1);
|
|
2054
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
|
|
2055
|
+
</pre><pre class="cython line score-0"> <span class="">177</span>: )</pre>
|
|
2056
|
+
<pre class="cython line score-0"> <span class="">178</span>: </pre>
|
|
2057
|
+
<pre class="cython line score-10" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">179</span>: dumps = encode</pre>
|
|
2058
|
+
<pre class='cython code score-10 '> <span class='pyx_c_api'>__Pyx_GetNameInClass</span>(__pyx_t_4, (PyObject *)__pyx_ptype_9datamodel_7parsers_4json_JSONContent, __pyx_n_s_encode);<span class='error_goto'> if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 179, __pyx_L1_error)</span>
|
|
2059
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4);
|
|
2060
|
+
if (<span class='pyx_c_api'>__Pyx_SetItemOnTypeDict</span>((PyObject *)__pyx_ptype_9datamodel_7parsers_4json_JSONContent, __pyx_n_s_dumps, __pyx_t_4) < 0) <span class='error_goto'>__PYX_ERR(0, 179, __pyx_L1_error)</span>
|
|
2061
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_4); __pyx_t_4 = 0;
|
|
2062
|
+
<span class='py_c_api'>PyType_Modified</span>(__pyx_ptype_9datamodel_7parsers_4json_JSONContent);
|
|
2063
|
+
</pre><pre class="cython line score-0"> <span class="">180</span>: </pre>
|
|
2064
|
+
<pre class="cython line score-77" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">181</span>: @classmethod</pre>
|
|
2065
|
+
<pre class='cython code score-77 '>/* Python wrapper */
|
|
2066
|
+
static PyObject *__pyx_pw_9datamodel_7parsers_4json_11JSONContent_7dump(PyObject *__pyx_v_cls,
|
|
2067
|
+
#if CYTHON_METH_FASTCALL
|
|
2068
|
+
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
|
|
2069
|
+
#else
|
|
2070
|
+
PyObject *__pyx_args, PyObject *__pyx_kwds
|
|
2071
|
+
#endif
|
|
2072
|
+
); /*proto*/
|
|
2073
|
+
<span class='py_macro_api'>PyDoc_STRVAR</span>(__pyx_doc_9datamodel_7parsers_4json_11JSONContent_6dump, "JSONContent.dump(cls, obj, **kwargs)\n\n Class method to encode an object using a new JSONContent instance.\n ");
|
|
2074
|
+
static PyMethodDef __pyx_mdef_9datamodel_7parsers_4json_11JSONContent_7dump = {"dump", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9datamodel_7parsers_4json_11JSONContent_7dump, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9datamodel_7parsers_4json_11JSONContent_6dump};
|
|
2075
|
+
static PyObject *__pyx_pw_9datamodel_7parsers_4json_11JSONContent_7dump(PyObject *__pyx_v_cls,
|
|
2076
|
+
#if CYTHON_METH_FASTCALL
|
|
2077
|
+
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
|
|
2078
|
+
#else
|
|
2079
|
+
PyObject *__pyx_args, PyObject *__pyx_kwds
|
|
2080
|
+
#endif
|
|
2081
|
+
) {
|
|
2082
|
+
PyObject *__pyx_v_obj = 0;
|
|
2083
|
+
PyObject *__pyx_v_kwargs = 0;
|
|
2084
|
+
#if !CYTHON_METH_FASTCALL
|
|
2085
|
+
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
|
|
2086
|
+
#endif
|
|
2087
|
+
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
|
|
2088
|
+
PyObject *__pyx_r = 0;
|
|
2089
|
+
<span class='refnanny'>__Pyx_RefNannyDeclarations</span>
|
|
2090
|
+
<span class='refnanny'>__Pyx_RefNannySetupContext</span>("dump (wrapper)", 0);
|
|
2091
|
+
#if !CYTHON_METH_FASTCALL
|
|
2092
|
+
#if CYTHON_ASSUME_SAFE_MACROS
|
|
2093
|
+
__pyx_nargs = <span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args);
|
|
2094
|
+
#else
|
|
2095
|
+
__pyx_nargs = <span class='py_c_api'>PyTuple_Size</span>(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
|
|
2096
|
+
#endif
|
|
2097
|
+
#endif
|
|
2098
|
+
__pyx_kwvalues = <span class='pyx_c_api'>__Pyx_KwValues_FASTCALL</span>(__pyx_args, __pyx_nargs);
|
|
2099
|
+
__pyx_v_kwargs = <span class='py_c_api'>PyDict_New</span>(); if (unlikely(!__pyx_v_kwargs)) return NULL;
|
|
2100
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_v_kwargs);
|
|
2101
|
+
{
|
|
2102
|
+
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,0};
|
|
2103
|
+
PyObject* values[1] = {0};
|
|
2104
|
+
if (__pyx_kwds) {
|
|
2105
|
+
Py_ssize_t kw_args;
|
|
2106
|
+
switch (__pyx_nargs) {
|
|
2107
|
+
case 1: values[0] = <span class='pyx_c_api'>__Pyx_Arg_FASTCALL</span>(__pyx_args, 0);
|
|
2108
|
+
CYTHON_FALLTHROUGH;
|
|
2109
|
+
case 0: break;
|
|
2110
|
+
default: goto __pyx_L5_argtuple_error;
|
|
2111
|
+
}
|
|
2112
|
+
kw_args = <span class='pyx_c_api'>__Pyx_NumKwargs_FASTCALL</span>(__pyx_kwds);
|
|
2113
|
+
switch (__pyx_nargs) {
|
|
2114
|
+
case 0:
|
|
2115
|
+
if (likely((values[0] = <span class='pyx_c_api'>__Pyx_GetKwValue_FASTCALL</span>(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_obj)) != 0)) {
|
|
2116
|
+
(void)<span class='pyx_c_api'>__Pyx_Arg_NewRef_FASTCALL</span>(values[0]);
|
|
2117
|
+
kw_args--;
|
|
2118
|
+
}
|
|
2119
|
+
else if (unlikely(<span class='py_c_api'>PyErr_Occurred</span>())) <span class='error_goto'>__PYX_ERR(0, 181, __pyx_L3_error)</span>
|
|
2120
|
+
else goto __pyx_L5_argtuple_error;
|
|
2121
|
+
}
|
|
2122
|
+
if (unlikely(kw_args > 0)) {
|
|
2123
|
+
const Py_ssize_t kwd_pos_args = __pyx_nargs;
|
|
2124
|
+
if (unlikely(<span class='pyx_c_api'>__Pyx_ParseOptionalKeywords</span>(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v_kwargs, values + 0, kwd_pos_args, "dump") < 0)) <span class='error_goto'>__PYX_ERR(0, 181, __pyx_L3_error)</span>
|
|
2125
|
+
}
|
|
2126
|
+
} else if (unlikely(__pyx_nargs != 1)) {
|
|
2127
|
+
goto __pyx_L5_argtuple_error;
|
|
2128
|
+
} else {
|
|
2129
|
+
values[0] = <span class='pyx_c_api'>__Pyx_Arg_FASTCALL</span>(__pyx_args, 0);
|
|
2130
|
+
}
|
|
2131
|
+
__pyx_v_obj = values[0];
|
|
2132
|
+
}
|
|
2133
|
+
goto __pyx_L6_skip;
|
|
2134
|
+
__pyx_L5_argtuple_error:;
|
|
2135
|
+
<span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>("dump", 1, 1, 1, __pyx_nargs); <span class='error_goto'>__PYX_ERR(0, 181, __pyx_L3_error)</span>
|
|
2136
|
+
__pyx_L6_skip:;
|
|
2137
|
+
goto __pyx_L4_argument_unpacking_done;
|
|
2138
|
+
__pyx_L3_error:;
|
|
2139
|
+
{
|
|
2140
|
+
Py_ssize_t __pyx_temp;
|
|
2141
|
+
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
|
|
2142
|
+
<span class='pyx_c_api'>__Pyx_Arg_XDECREF_FASTCALL</span>(values[__pyx_temp]);
|
|
2143
|
+
}
|
|
2144
|
+
}
|
|
2145
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_v_kwargs); __pyx_v_kwargs = 0;
|
|
2146
|
+
<span class='pyx_c_api'>__Pyx_AddTraceback</span>("datamodel.parsers.json.JSONContent.dump", __pyx_clineno, __pyx_lineno, __pyx_filename);
|
|
2147
|
+
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>();
|
|
2148
|
+
return NULL;
|
|
2149
|
+
__pyx_L4_argument_unpacking_done:;
|
|
2150
|
+
__pyx_r = __pyx_pf_9datamodel_7parsers_4json_11JSONContent_6dump(((PyTypeObject*)__pyx_v_cls), __pyx_v_obj, __pyx_v_kwargs);
|
|
2151
|
+
int __pyx_lineno = 0;
|
|
2152
|
+
const char *__pyx_filename = NULL;
|
|
2153
|
+
int __pyx_clineno = 0;
|
|
2154
|
+
|
|
2155
|
+
/* function exit code */
|
|
2156
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_v_kwargs);
|
|
2157
|
+
{
|
|
2158
|
+
Py_ssize_t __pyx_temp;
|
|
2159
|
+
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
|
|
2160
|
+
<span class='pyx_c_api'>__Pyx_Arg_XDECREF_FASTCALL</span>(values[__pyx_temp]);
|
|
2161
|
+
}
|
|
2162
|
+
}
|
|
2163
|
+
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>();
|
|
2164
|
+
return __pyx_r;
|
|
2165
|
+
}
|
|
2166
|
+
|
|
2167
|
+
static PyObject *__pyx_pf_9datamodel_7parsers_4json_11JSONContent_6dump(PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_obj, PyObject *__pyx_v_kwargs) {
|
|
2168
|
+
PyObject *__pyx_r = NULL;
|
|
2169
|
+
/* … */
|
|
2170
|
+
/* function exit code */
|
|
2171
|
+
__pyx_L1_error:;
|
|
2172
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_1);
|
|
2173
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_2);
|
|
2174
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_3);
|
|
2175
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_4);
|
|
2176
|
+
<span class='pyx_c_api'>__Pyx_AddTraceback</span>("datamodel.parsers.json.JSONContent.dump", __pyx_clineno, __pyx_lineno, __pyx_filename);
|
|
2177
|
+
__pyx_r = NULL;
|
|
2178
|
+
__pyx_L0:;
|
|
2179
|
+
<span class='refnanny'>__Pyx_XGIVEREF</span>(__pyx_r);
|
|
2180
|
+
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>();
|
|
2181
|
+
return __pyx_r;
|
|
2182
|
+
}
|
|
2183
|
+
/* … */
|
|
2184
|
+
__pyx_tuple__9 = <span class='py_c_api'>PyTuple_Pack</span>(3, __pyx_n_s_cls, __pyx_n_s_obj, __pyx_n_s_kwargs);<span class='error_goto'> if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 181, __pyx_L1_error)</span>
|
|
2185
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_tuple__9);
|
|
2186
|
+
<span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_tuple__9);
|
|
2187
|
+
/* … */
|
|
2188
|
+
__pyx_t_4 = <span class='pyx_c_api'>__Pyx_CyFunction_New</span>(&__pyx_mdef_9datamodel_7parsers_4json_11JSONContent_7dump, __Pyx_CYFUNCTION_CLASSMETHOD | __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_JSONContent_dump, NULL, __pyx_n_s_datamodel_parsers_json, __pyx_d, ((PyObject *)__pyx_codeobj__10));<span class='error_goto'> if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 181, __pyx_L1_error)</span>
|
|
2189
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4);
|
|
2190
|
+
if (<span class='pyx_c_api'>__Pyx_SetItemOnTypeDict</span>((PyObject *)__pyx_ptype_9datamodel_7parsers_4json_JSONContent, __pyx_n_s_dump, __pyx_t_4) < 0) <span class='error_goto'>__PYX_ERR(0, 181, __pyx_L1_error)</span>
|
|
2191
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_4); __pyx_t_4 = 0;
|
|
2192
|
+
<span class='py_c_api'>PyType_Modified</span>(__pyx_ptype_9datamodel_7parsers_4json_JSONContent);
|
|
2193
|
+
<span class='pyx_c_api'>__Pyx_GetNameInClass</span>(__pyx_t_4, (PyObject *)__pyx_ptype_9datamodel_7parsers_4json_JSONContent, __pyx_n_s_dump);<span class='error_goto'> if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 181, __pyx_L1_error)</span>
|
|
2194
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4);
|
|
2195
|
+
__pyx_t_3 = <span class='pyx_c_api'>__Pyx_Method_ClassMethod</span>(__pyx_t_4);<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 181, __pyx_L1_error)</span>
|
|
2196
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
2197
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_4); __pyx_t_4 = 0;
|
|
2198
|
+
if (<span class='pyx_c_api'>__Pyx_SetItemOnTypeDict</span>((PyObject *)__pyx_ptype_9datamodel_7parsers_4json_JSONContent, __pyx_n_s_dump, __pyx_t_3) < 0) <span class='error_goto'>__PYX_ERR(0, 181, __pyx_L1_error)</span>
|
|
2199
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
|
|
2200
|
+
<span class='py_c_api'>PyType_Modified</span>(__pyx_ptype_9datamodel_7parsers_4json_JSONContent);
|
|
2201
|
+
__pyx_codeobj__10 = (PyObject*)<span class='pyx_c_api'>__Pyx_PyCode_New</span>(2, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__9, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_datamodel_parsers_json_pyx, __pyx_n_s_dump, 181, __pyx_empty_bytes);<span class='error_goto'> if (unlikely(!__pyx_codeobj__10)) __PYX_ERR(0, 181, __pyx_L1_error)</span>
|
|
2202
|
+
</pre><pre class="cython line score-0"> <span class="">182</span>: def dump(cls, object obj, **kwargs):</pre>
|
|
2203
|
+
<pre class="cython line score-0"> <span class="">183</span>: """</pre>
|
|
2204
|
+
<pre class="cython line score-0"> <span class="">184</span>: Class method to encode an object using a new JSONContent instance.</pre>
|
|
2205
|
+
<pre class="cython line score-0"> <span class="">185</span>: """</pre>
|
|
2206
|
+
<pre class="cython line score-24" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">186</span>: return cls().encode(obj, **kwargs)</pre>
|
|
2207
|
+
<pre class='cython code score-24 '> <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_r);
|
|
2208
|
+
__pyx_t_1 = <span class='pyx_c_api'>__Pyx_PyObject_CallNoArg</span>(((PyObject *)__pyx_v_cls));<span class='error_goto'> if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 186, __pyx_L1_error)</span>
|
|
2209
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1);
|
|
2210
|
+
__pyx_t_2 = <span class='pyx_c_api'>__Pyx_PyObject_GetAttrStr</span>(__pyx_t_1, __pyx_n_s_encode);<span class='error_goto'> if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 186, __pyx_L1_error)</span>
|
|
2211
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_2);
|
|
2212
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0;
|
|
2213
|
+
__pyx_t_1 = <span class='py_c_api'>PyTuple_New</span>(1);<span class='error_goto'> if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 186, __pyx_L1_error)</span>
|
|
2214
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1);
|
|
2215
|
+
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_v_obj);
|
|
2216
|
+
<span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_v_obj);
|
|
2217
|
+
if (<span class='pyx_c_api'>__Pyx_PyTuple_SET_ITEM</span>(__pyx_t_1, 0, __pyx_v_obj)) <span class='error_goto'>__PYX_ERR(0, 186, __pyx_L1_error)</span>;
|
|
2218
|
+
__pyx_t_3 = <span class='py_c_api'>PyDict_Copy</span>(__pyx_v_kwargs);<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 186, __pyx_L1_error)</span>
|
|
2219
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
2220
|
+
__pyx_t_4 = <span class='pyx_c_api'>__Pyx_PyObject_Call</span>(__pyx_t_2, __pyx_t_1, __pyx_t_3);<span class='error_goto'> if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 186, __pyx_L1_error)</span>
|
|
2221
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4);
|
|
2222
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;
|
|
2223
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0;
|
|
2224
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
|
|
2225
|
+
__pyx_r = __pyx_t_4;
|
|
2226
|
+
__pyx_t_4 = 0;
|
|
2227
|
+
goto __pyx_L0;
|
|
2228
|
+
</pre><pre class="cython line score-0"> <span class="">187</span>: </pre>
|
|
2229
|
+
<pre class="cython line score-59" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">188</span>: def decode(self, object obj):</pre>
|
|
2230
|
+
<pre class='cython code score-59 '>/* Python wrapper */
|
|
2231
|
+
static PyObject *__pyx_pw_9datamodel_7parsers_4json_11JSONContent_9decode(PyObject *__pyx_v_self,
|
|
2232
|
+
#if CYTHON_METH_FASTCALL
|
|
2233
|
+
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
|
|
2234
|
+
#else
|
|
2235
|
+
PyObject *__pyx_args, PyObject *__pyx_kwds
|
|
2236
|
+
#endif
|
|
2237
|
+
); /*proto*/
|
|
2238
|
+
<span class='py_macro_api'>PyDoc_STRVAR</span>(__pyx_doc_9datamodel_7parsers_4json_11JSONContent_8decode, "JSONContent.decode(self, obj)\n\n Decode a JSON string into a Python object.\n\n Parameters:\n obj: A JSON string or bytes.\n\n Returns:\n The corresponding Python object.\n\n Raises:\n ParserError: If the JSON data is invalid.\n ");
|
|
2239
|
+
static PyMethodDef __pyx_mdef_9datamodel_7parsers_4json_11JSONContent_9decode = {"decode", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9datamodel_7parsers_4json_11JSONContent_9decode, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9datamodel_7parsers_4json_11JSONContent_8decode};
|
|
2240
|
+
static PyObject *__pyx_pw_9datamodel_7parsers_4json_11JSONContent_9decode(PyObject *__pyx_v_self,
|
|
2241
|
+
#if CYTHON_METH_FASTCALL
|
|
2242
|
+
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
|
|
2243
|
+
#else
|
|
2244
|
+
PyObject *__pyx_args, PyObject *__pyx_kwds
|
|
2245
|
+
#endif
|
|
2246
|
+
) {
|
|
2247
|
+
PyObject *__pyx_v_obj = 0;
|
|
2248
|
+
#if !CYTHON_METH_FASTCALL
|
|
2249
|
+
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
|
|
2250
|
+
#endif
|
|
2251
|
+
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
|
|
2252
|
+
PyObject *__pyx_r = 0;
|
|
2253
|
+
<span class='refnanny'>__Pyx_RefNannyDeclarations</span>
|
|
2254
|
+
<span class='refnanny'>__Pyx_RefNannySetupContext</span>("decode (wrapper)", 0);
|
|
2255
|
+
#if !CYTHON_METH_FASTCALL
|
|
2256
|
+
#if CYTHON_ASSUME_SAFE_MACROS
|
|
2257
|
+
__pyx_nargs = <span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args);
|
|
2258
|
+
#else
|
|
2259
|
+
__pyx_nargs = <span class='py_c_api'>PyTuple_Size</span>(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
|
|
2260
|
+
#endif
|
|
2261
|
+
#endif
|
|
2262
|
+
__pyx_kwvalues = <span class='pyx_c_api'>__Pyx_KwValues_FASTCALL</span>(__pyx_args, __pyx_nargs);
|
|
2263
|
+
{
|
|
2264
|
+
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,0};
|
|
2265
|
+
PyObject* values[1] = {0};
|
|
2266
|
+
if (__pyx_kwds) {
|
|
2267
|
+
Py_ssize_t kw_args;
|
|
2268
|
+
switch (__pyx_nargs) {
|
|
2269
|
+
case 1: values[0] = <span class='pyx_c_api'>__Pyx_Arg_FASTCALL</span>(__pyx_args, 0);
|
|
2270
|
+
CYTHON_FALLTHROUGH;
|
|
2271
|
+
case 0: break;
|
|
2272
|
+
default: goto __pyx_L5_argtuple_error;
|
|
2273
|
+
}
|
|
2274
|
+
kw_args = <span class='pyx_c_api'>__Pyx_NumKwargs_FASTCALL</span>(__pyx_kwds);
|
|
2275
|
+
switch (__pyx_nargs) {
|
|
2276
|
+
case 0:
|
|
2277
|
+
if (likely((values[0] = <span class='pyx_c_api'>__Pyx_GetKwValue_FASTCALL</span>(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_obj)) != 0)) {
|
|
2278
|
+
(void)<span class='pyx_c_api'>__Pyx_Arg_NewRef_FASTCALL</span>(values[0]);
|
|
2279
|
+
kw_args--;
|
|
2280
|
+
}
|
|
2281
|
+
else if (unlikely(<span class='py_c_api'>PyErr_Occurred</span>())) <span class='error_goto'>__PYX_ERR(0, 188, __pyx_L3_error)</span>
|
|
2282
|
+
else goto __pyx_L5_argtuple_error;
|
|
2283
|
+
}
|
|
2284
|
+
if (unlikely(kw_args > 0)) {
|
|
2285
|
+
const Py_ssize_t kwd_pos_args = __pyx_nargs;
|
|
2286
|
+
if (unlikely(<span class='pyx_c_api'>__Pyx_ParseOptionalKeywords</span>(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "decode") < 0)) <span class='error_goto'>__PYX_ERR(0, 188, __pyx_L3_error)</span>
|
|
2287
|
+
}
|
|
2288
|
+
} else if (unlikely(__pyx_nargs != 1)) {
|
|
2289
|
+
goto __pyx_L5_argtuple_error;
|
|
2290
|
+
} else {
|
|
2291
|
+
values[0] = <span class='pyx_c_api'>__Pyx_Arg_FASTCALL</span>(__pyx_args, 0);
|
|
2292
|
+
}
|
|
2293
|
+
__pyx_v_obj = values[0];
|
|
2294
|
+
}
|
|
2295
|
+
goto __pyx_L6_skip;
|
|
2296
|
+
__pyx_L5_argtuple_error:;
|
|
2297
|
+
<span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>("decode", 1, 1, 1, __pyx_nargs); <span class='error_goto'>__PYX_ERR(0, 188, __pyx_L3_error)</span>
|
|
2298
|
+
__pyx_L6_skip:;
|
|
2299
|
+
goto __pyx_L4_argument_unpacking_done;
|
|
2300
|
+
__pyx_L3_error:;
|
|
2301
|
+
{
|
|
2302
|
+
Py_ssize_t __pyx_temp;
|
|
2303
|
+
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
|
|
2304
|
+
<span class='pyx_c_api'>__Pyx_Arg_XDECREF_FASTCALL</span>(values[__pyx_temp]);
|
|
2305
|
+
}
|
|
2306
|
+
}
|
|
2307
|
+
<span class='pyx_c_api'>__Pyx_AddTraceback</span>("datamodel.parsers.json.JSONContent.decode", __pyx_clineno, __pyx_lineno, __pyx_filename);
|
|
2308
|
+
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>();
|
|
2309
|
+
return NULL;
|
|
2310
|
+
__pyx_L4_argument_unpacking_done:;
|
|
2311
|
+
__pyx_r = __pyx_pf_9datamodel_7parsers_4json_11JSONContent_8decode(((struct __pyx_obj_9datamodel_7parsers_4json_JSONContent *)__pyx_v_self), __pyx_v_obj);
|
|
2312
|
+
int __pyx_lineno = 0;
|
|
2313
|
+
const char *__pyx_filename = NULL;
|
|
2314
|
+
int __pyx_clineno = 0;
|
|
2315
|
+
|
|
2316
|
+
/* function exit code */
|
|
2317
|
+
{
|
|
2318
|
+
Py_ssize_t __pyx_temp;
|
|
2319
|
+
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
|
|
2320
|
+
<span class='pyx_c_api'>__Pyx_Arg_XDECREF_FASTCALL</span>(values[__pyx_temp]);
|
|
2321
|
+
}
|
|
2322
|
+
}
|
|
2323
|
+
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>();
|
|
2324
|
+
return __pyx_r;
|
|
2325
|
+
}
|
|
2326
|
+
|
|
2327
|
+
static PyObject *__pyx_pf_9datamodel_7parsers_4json_11JSONContent_8decode(CYTHON_UNUSED struct __pyx_obj_9datamodel_7parsers_4json_JSONContent *__pyx_v_self, PyObject *__pyx_v_obj) {
|
|
2328
|
+
PyObject *__pyx_v_ex = NULL;
|
|
2329
|
+
PyObject *__pyx_r = NULL;
|
|
2330
|
+
/* … */
|
|
2331
|
+
/* function exit code */
|
|
2332
|
+
__pyx_L1_error:;
|
|
2333
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_4);
|
|
2334
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_5);
|
|
2335
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_6);
|
|
2336
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_8);
|
|
2337
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_9);
|
|
2338
|
+
<span class='pyx_c_api'>__Pyx_AddTraceback</span>("datamodel.parsers.json.JSONContent.decode", __pyx_clineno, __pyx_lineno, __pyx_filename);
|
|
2339
|
+
__pyx_r = NULL;
|
|
2340
|
+
__pyx_L0:;
|
|
2341
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_v_ex);
|
|
2342
|
+
<span class='refnanny'>__Pyx_XGIVEREF</span>(__pyx_r);
|
|
2343
|
+
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>();
|
|
2344
|
+
return __pyx_r;
|
|
2345
|
+
}
|
|
2346
|
+
/* … */
|
|
2347
|
+
__pyx_tuple__11 = <span class='py_c_api'>PyTuple_Pack</span>(3, __pyx_n_s_self, __pyx_n_s_obj, __pyx_n_s_ex);<span class='error_goto'> if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 188, __pyx_L1_error)</span>
|
|
2348
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_tuple__11);
|
|
2349
|
+
<span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_tuple__11);
|
|
2350
|
+
/* … */
|
|
2351
|
+
__pyx_t_3 = <span class='pyx_c_api'>__Pyx_CyFunction_New</span>(&__pyx_mdef_9datamodel_7parsers_4json_11JSONContent_9decode, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_JSONContent_decode, NULL, __pyx_n_s_datamodel_parsers_json, __pyx_d, ((PyObject *)__pyx_codeobj__12));<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 188, __pyx_L1_error)</span>
|
|
2352
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
2353
|
+
if (<span class='pyx_c_api'>__Pyx_SetItemOnTypeDict</span>((PyObject *)__pyx_ptype_9datamodel_7parsers_4json_JSONContent, __pyx_n_s_decode, __pyx_t_3) < 0) <span class='error_goto'>__PYX_ERR(0, 188, __pyx_L1_error)</span>
|
|
2354
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
|
|
2355
|
+
<span class='py_c_api'>PyType_Modified</span>(__pyx_ptype_9datamodel_7parsers_4json_JSONContent);
|
|
2356
|
+
__pyx_codeobj__12 = (PyObject*)<span class='pyx_c_api'>__Pyx_PyCode_New</span>(2, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__11, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_datamodel_parsers_json_pyx, __pyx_n_s_decode, 188, __pyx_empty_bytes);<span class='error_goto'> if (unlikely(!__pyx_codeobj__12)) __PYX_ERR(0, 188, __pyx_L1_error)</span>
|
|
2357
|
+
</pre><pre class="cython line score-0"> <span class="">189</span>: """</pre>
|
|
2358
|
+
<pre class="cython line score-0"> <span class="">190</span>: Decode a JSON string into a Python object.</pre>
|
|
2359
|
+
<pre class="cython line score-0"> <span class="">191</span>: </pre>
|
|
2360
|
+
<pre class="cython line score-0"> <span class="">192</span>: Parameters:</pre>
|
|
2361
|
+
<pre class="cython line score-0"> <span class="">193</span>: obj: A JSON string or bytes.</pre>
|
|
2362
|
+
<pre class="cython line score-0"> <span class="">194</span>: </pre>
|
|
2363
|
+
<pre class="cython line score-0"> <span class="">195</span>: Returns:</pre>
|
|
2364
|
+
<pre class="cython line score-0"> <span class="">196</span>: The corresponding Python object.</pre>
|
|
2365
|
+
<pre class="cython line score-0"> <span class="">197</span>: </pre>
|
|
2366
|
+
<pre class="cython line score-0"> <span class="">198</span>: Raises:</pre>
|
|
2367
|
+
<pre class="cython line score-0"> <span class="">199</span>: ParserError: If the JSON data is invalid.</pre>
|
|
2368
|
+
<pre class="cython line score-0"> <span class="">200</span>: """</pre>
|
|
2369
|
+
<pre class="cython line score-7" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">201</span>: try:</pre>
|
|
2370
|
+
<pre class='cython code score-7 '> {
|
|
2371
|
+
/*try:*/ {
|
|
2372
|
+
/* … */
|
|
2373
|
+
}
|
|
2374
|
+
__pyx_L3_error:;
|
|
2375
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_4); __pyx_t_4 = 0;
|
|
2376
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_5); __pyx_t_5 = 0;
|
|
2377
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_6); __pyx_t_6 = 0;
|
|
2378
|
+
/* … */
|
|
2379
|
+
__pyx_L5_except_error:;
|
|
2380
|
+
<span class='refnanny'>__Pyx_XGIVEREF</span>(__pyx_t_1);
|
|
2381
|
+
<span class='refnanny'>__Pyx_XGIVEREF</span>(__pyx_t_2);
|
|
2382
|
+
<span class='refnanny'>__Pyx_XGIVEREF</span>(__pyx_t_3);
|
|
2383
|
+
<span class='pyx_c_api'>__Pyx_ExceptionReset</span>(__pyx_t_1, __pyx_t_2, __pyx_t_3);
|
|
2384
|
+
goto __pyx_L1_error;
|
|
2385
|
+
__pyx_L7_try_return:;
|
|
2386
|
+
<span class='refnanny'>__Pyx_XGIVEREF</span>(__pyx_t_1);
|
|
2387
|
+
<span class='refnanny'>__Pyx_XGIVEREF</span>(__pyx_t_2);
|
|
2388
|
+
<span class='refnanny'>__Pyx_XGIVEREF</span>(__pyx_t_3);
|
|
2389
|
+
<span class='pyx_c_api'>__Pyx_ExceptionReset</span>(__pyx_t_1, __pyx_t_2, __pyx_t_3);
|
|
2390
|
+
goto __pyx_L0;
|
|
2391
|
+
}
|
|
2392
|
+
</pre><pre class="cython line score-6" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">202</span>: return orjson.loads(</pre>
|
|
2393
|
+
<pre class='cython code score-6 '> <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_r);
|
|
2394
|
+
<span class='pyx_c_api'>__Pyx_GetModuleGlobalName</span>(__pyx_t_5, __pyx_n_s_orjson);<span class='error_goto'> if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 202, __pyx_L3_error)</span>
|
|
2395
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_5);
|
|
2396
|
+
__pyx_t_6 = <span class='pyx_c_api'>__Pyx_PyObject_GetAttrStr</span>(__pyx_t_5, __pyx_n_s_loads);<span class='error_goto'> if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 202, __pyx_L3_error)</span>
|
|
2397
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_6);
|
|
2398
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_5); __pyx_t_5 = 0;
|
|
2399
|
+
</pre><pre class="cython line score-14" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">203</span>: obj</pre>
|
|
2400
|
+
<pre class='cython code score-14 '> __pyx_t_5 = NULL;
|
|
2401
|
+
__pyx_t_7 = 0;
|
|
2402
|
+
#if CYTHON_UNPACK_METHODS
|
|
2403
|
+
if (unlikely(<span class='py_c_api'>PyMethod_Check</span>(__pyx_t_6))) {
|
|
2404
|
+
__pyx_t_5 = <span class='py_macro_api'>PyMethod_GET_SELF</span>(__pyx_t_6);
|
|
2405
|
+
if (likely(__pyx_t_5)) {
|
|
2406
|
+
PyObject* function = <span class='py_macro_api'>PyMethod_GET_FUNCTION</span>(__pyx_t_6);
|
|
2407
|
+
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_t_5);
|
|
2408
|
+
<span class='pyx_macro_api'>__Pyx_INCREF</span>(function);
|
|
2409
|
+
<span class='pyx_macro_api'>__Pyx_DECREF_SET</span>(__pyx_t_6, function);
|
|
2410
|
+
__pyx_t_7 = 1;
|
|
2411
|
+
}
|
|
2412
|
+
}
|
|
2413
|
+
#endif
|
|
2414
|
+
{
|
|
2415
|
+
PyObject *__pyx_callargs[2] = {__pyx_t_5, __pyx_v_obj};
|
|
2416
|
+
__pyx_t_4 = <span class='pyx_c_api'>__Pyx_PyObject_FastCall</span>(__pyx_t_6, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
|
|
2417
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_5); __pyx_t_5 = 0;
|
|
2418
|
+
if (unlikely(!__pyx_t_4)) <span class='error_goto'>__PYX_ERR(0, 202, __pyx_L3_error)</span>
|
|
2419
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4);
|
|
2420
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_6); __pyx_t_6 = 0;
|
|
2421
|
+
}
|
|
2422
|
+
__pyx_r = __pyx_t_4;
|
|
2423
|
+
__pyx_t_4 = 0;
|
|
2424
|
+
goto __pyx_L7_try_return;
|
|
2425
|
+
</pre><pre class="cython line score-0"> <span class="">204</span>: )</pre>
|
|
2426
|
+
<pre class="cython line score-30" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">205</span>: except orjson.JSONDecodeError as ex:</pre>
|
|
2427
|
+
<pre class='cython code score-30 '> <span class='pyx_c_api'>__Pyx_ErrFetch</span>(&__pyx_t_4, &__pyx_t_6, &__pyx_t_5);
|
|
2428
|
+
<span class='pyx_c_api'>__Pyx_GetModuleGlobalName</span>(__pyx_t_8, __pyx_n_s_orjson);<span class='error_goto'> if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 205, __pyx_L5_except_error)</span>
|
|
2429
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_8);
|
|
2430
|
+
__pyx_t_9 = <span class='pyx_c_api'>__Pyx_PyObject_GetAttrStr</span>(__pyx_t_8, __pyx_n_s_JSONDecodeError);<span class='error_goto'> if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 205, __pyx_L5_except_error)</span>
|
|
2431
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_9);
|
|
2432
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_8); __pyx_t_8 = 0;
|
|
2433
|
+
__pyx_t_10 = <span class='pyx_c_api'>__Pyx_PyErr_GivenExceptionMatches</span>(__pyx_t_4, __pyx_t_9);
|
|
2434
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_9); __pyx_t_9 = 0;
|
|
2435
|
+
<span class='pyx_c_api'>__Pyx_ErrRestore</span>(__pyx_t_4, __pyx_t_6, __pyx_t_5);
|
|
2436
|
+
__pyx_t_4 = 0; __pyx_t_6 = 0; __pyx_t_5 = 0;
|
|
2437
|
+
if (__pyx_t_10) {
|
|
2438
|
+
<span class='pyx_c_api'>__Pyx_AddTraceback</span>("datamodel.parsers.json.JSONContent.decode", __pyx_clineno, __pyx_lineno, __pyx_filename);
|
|
2439
|
+
if (<span class='pyx_c_api'>__Pyx_GetException</span>(&__pyx_t_5, &__pyx_t_6, &__pyx_t_4) < 0) <span class='error_goto'>__PYX_ERR(0, 205, __pyx_L5_except_error)</span>
|
|
2440
|
+
<span class='refnanny'>__Pyx_XGOTREF</span>(__pyx_t_5);
|
|
2441
|
+
<span class='refnanny'>__Pyx_XGOTREF</span>(__pyx_t_6);
|
|
2442
|
+
<span class='refnanny'>__Pyx_XGOTREF</span>(__pyx_t_4);
|
|
2443
|
+
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_t_6);
|
|
2444
|
+
__pyx_v_ex = __pyx_t_6;
|
|
2445
|
+
/*try:*/ {
|
|
2446
|
+
/* … */
|
|
2447
|
+
/*finally:*/ {
|
|
2448
|
+
__pyx_L14_error:;
|
|
2449
|
+
/*exception exit:*/{
|
|
2450
|
+
__Pyx_PyThreadState_declare
|
|
2451
|
+
__Pyx_PyThreadState_assign
|
|
2452
|
+
__pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0;
|
|
2453
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_8); __pyx_t_8 = 0;
|
|
2454
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_9); __pyx_t_9 = 0;
|
|
2455
|
+
if (PY_MAJOR_VERSION >= 3) <span class='pyx_c_api'>__Pyx_ExceptionSwap</span>(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
|
|
2456
|
+
if ((PY_MAJOR_VERSION < 3) || unlikely(<span class='pyx_c_api'>__Pyx_GetException</span>(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15) < 0)) <span class='pyx_c_api'>__Pyx_ErrFetch</span>(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15);
|
|
2457
|
+
<span class='refnanny'>__Pyx_XGOTREF</span>(__pyx_t_13);
|
|
2458
|
+
<span class='refnanny'>__Pyx_XGOTREF</span>(__pyx_t_14);
|
|
2459
|
+
<span class='refnanny'>__Pyx_XGOTREF</span>(__pyx_t_15);
|
|
2460
|
+
<span class='refnanny'>__Pyx_XGOTREF</span>(__pyx_t_16);
|
|
2461
|
+
<span class='refnanny'>__Pyx_XGOTREF</span>(__pyx_t_17);
|
|
2462
|
+
<span class='refnanny'>__Pyx_XGOTREF</span>(__pyx_t_18);
|
|
2463
|
+
__pyx_t_10 = __pyx_lineno; __pyx_t_11 = __pyx_clineno; __pyx_t_12 = __pyx_filename;
|
|
2464
|
+
{
|
|
2465
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_v_ex); __pyx_v_ex = 0;
|
|
2466
|
+
}
|
|
2467
|
+
if (PY_MAJOR_VERSION >= 3) {
|
|
2468
|
+
<span class='refnanny'>__Pyx_XGIVEREF</span>(__pyx_t_16);
|
|
2469
|
+
<span class='refnanny'>__Pyx_XGIVEREF</span>(__pyx_t_17);
|
|
2470
|
+
<span class='refnanny'>__Pyx_XGIVEREF</span>(__pyx_t_18);
|
|
2471
|
+
<span class='pyx_c_api'>__Pyx_ExceptionReset</span>(__pyx_t_16, __pyx_t_17, __pyx_t_18);
|
|
2472
|
+
}
|
|
2473
|
+
<span class='refnanny'>__Pyx_XGIVEREF</span>(__pyx_t_13);
|
|
2474
|
+
<span class='refnanny'>__Pyx_XGIVEREF</span>(__pyx_t_14);
|
|
2475
|
+
<span class='refnanny'>__Pyx_XGIVEREF</span>(__pyx_t_15);
|
|
2476
|
+
<span class='pyx_c_api'>__Pyx_ErrRestore</span>(__pyx_t_13, __pyx_t_14, __pyx_t_15);
|
|
2477
|
+
__pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0;
|
|
2478
|
+
__pyx_lineno = __pyx_t_10; __pyx_clineno = __pyx_t_11; __pyx_filename = __pyx_t_12;
|
|
2479
|
+
goto __pyx_L5_except_error;
|
|
2480
|
+
}
|
|
2481
|
+
}
|
|
2482
|
+
}
|
|
2483
|
+
goto __pyx_L5_except_error;
|
|
2484
|
+
</pre><pre class="cython line score-6" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">206</span>: raise ParserError(</pre>
|
|
2485
|
+
<pre class='cython code score-6 '> __pyx_t_9 = <span class='pyx_c_api'>__Pyx_PyObject_CallOneArg</span>(((PyObject *)__pyx_ptype_9datamodel_10exceptions_ParserError), __pyx_t_8);<span class='error_goto'> if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 206, __pyx_L14_error)</span>
|
|
2486
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_9);
|
|
2487
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_8); __pyx_t_8 = 0;
|
|
2488
|
+
<span class='pyx_c_api'>__Pyx_Raise</span>(__pyx_t_9, 0, 0, 0);
|
|
2489
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_9); __pyx_t_9 = 0;
|
|
2490
|
+
<span class='error_goto'>__PYX_ERR(0, 206, __pyx_L14_error)</span>
|
|
2491
|
+
}
|
|
2492
|
+
</pre><pre class="cython line score-5" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">207</span>: f"Invalid JSON data: {ex}"</pre>
|
|
2493
|
+
<pre class='cython code score-5 '> __pyx_t_9 = <span class='pyx_c_api'>__Pyx_PyObject_FormatSimple</span>(__pyx_v_ex, __pyx_empty_unicode);<span class='error_goto'> if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 207, __pyx_L14_error)</span>
|
|
2494
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_9);
|
|
2495
|
+
__pyx_t_8 = <span class='pyx_c_api'>__Pyx_PyUnicode_Concat</span>(__pyx_kp_u_Invalid_JSON_data, __pyx_t_9);<span class='error_goto'> if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 207, __pyx_L14_error)</span>
|
|
2496
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_8);
|
|
2497
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_9); __pyx_t_9 = 0;
|
|
2498
|
+
</pre><pre class="cython line score-0"> <span class="">208</span>: )</pre>
|
|
2499
|
+
<pre class="cython line score-0"> <span class="">209</span>: </pre>
|
|
2500
|
+
<pre class="cython line score-10" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">210</span>: loads = decode</pre>
|
|
2501
|
+
<pre class='cython code score-10 '> <span class='pyx_c_api'>__Pyx_GetNameInClass</span>(__pyx_t_3, (PyObject *)__pyx_ptype_9datamodel_7parsers_4json_JSONContent, __pyx_n_s_decode);<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 210, __pyx_L1_error)</span>
|
|
2502
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
2503
|
+
if (<span class='pyx_c_api'>__Pyx_SetItemOnTypeDict</span>((PyObject *)__pyx_ptype_9datamodel_7parsers_4json_JSONContent, __pyx_n_s_loads, __pyx_t_3) < 0) <span class='error_goto'>__PYX_ERR(0, 210, __pyx_L1_error)</span>
|
|
2504
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
|
|
2505
|
+
<span class='py_c_api'>PyType_Modified</span>(__pyx_ptype_9datamodel_7parsers_4json_JSONContent);
|
|
2506
|
+
</pre><pre class="cython line score-0"> <span class="">211</span>: </pre>
|
|
2507
|
+
<pre class="cython line score-72" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">212</span>: @classmethod</pre>
|
|
2508
|
+
<pre class='cython code score-72 '>/* Python wrapper */
|
|
2509
|
+
static PyObject *__pyx_pw_9datamodel_7parsers_4json_11JSONContent_11load(PyObject *__pyx_v_cls,
|
|
2510
|
+
#if CYTHON_METH_FASTCALL
|
|
2511
|
+
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
|
|
2512
|
+
#else
|
|
2513
|
+
PyObject *__pyx_args, PyObject *__pyx_kwds
|
|
2514
|
+
#endif
|
|
2515
|
+
); /*proto*/
|
|
2516
|
+
<span class='py_macro_api'>PyDoc_STRVAR</span>(__pyx_doc_9datamodel_7parsers_4json_11JSONContent_10load, "JSONContent.load(cls, obj, **kwargs)\n\n Class method to decode JSON data using a new JSONContent instance.\n ");
|
|
2517
|
+
static PyMethodDef __pyx_mdef_9datamodel_7parsers_4json_11JSONContent_11load = {"load", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9datamodel_7parsers_4json_11JSONContent_11load, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9datamodel_7parsers_4json_11JSONContent_10load};
|
|
2518
|
+
static PyObject *__pyx_pw_9datamodel_7parsers_4json_11JSONContent_11load(PyObject *__pyx_v_cls,
|
|
2519
|
+
#if CYTHON_METH_FASTCALL
|
|
2520
|
+
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
|
|
2521
|
+
#else
|
|
2522
|
+
PyObject *__pyx_args, PyObject *__pyx_kwds
|
|
2523
|
+
#endif
|
|
2524
|
+
) {
|
|
2525
|
+
PyObject *__pyx_v_obj = 0;
|
|
2526
|
+
PyObject *__pyx_v_kwargs = 0;
|
|
2527
|
+
#if !CYTHON_METH_FASTCALL
|
|
2528
|
+
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
|
|
2529
|
+
#endif
|
|
2530
|
+
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
|
|
2531
|
+
PyObject *__pyx_r = 0;
|
|
2532
|
+
<span class='refnanny'>__Pyx_RefNannyDeclarations</span>
|
|
2533
|
+
<span class='refnanny'>__Pyx_RefNannySetupContext</span>("load (wrapper)", 0);
|
|
2534
|
+
#if !CYTHON_METH_FASTCALL
|
|
2535
|
+
#if CYTHON_ASSUME_SAFE_MACROS
|
|
2536
|
+
__pyx_nargs = <span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args);
|
|
2537
|
+
#else
|
|
2538
|
+
__pyx_nargs = <span class='py_c_api'>PyTuple_Size</span>(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
|
|
2539
|
+
#endif
|
|
2540
|
+
#endif
|
|
2541
|
+
__pyx_kwvalues = <span class='pyx_c_api'>__Pyx_KwValues_FASTCALL</span>(__pyx_args, __pyx_nargs);
|
|
2542
|
+
__pyx_v_kwargs = <span class='py_c_api'>PyDict_New</span>(); if (unlikely(!__pyx_v_kwargs)) return NULL;
|
|
2543
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_v_kwargs);
|
|
2544
|
+
{
|
|
2545
|
+
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,0};
|
|
2546
|
+
PyObject* values[1] = {0};
|
|
2547
|
+
if (__pyx_kwds) {
|
|
2548
|
+
Py_ssize_t kw_args;
|
|
2549
|
+
switch (__pyx_nargs) {
|
|
2550
|
+
case 1: values[0] = <span class='pyx_c_api'>__Pyx_Arg_FASTCALL</span>(__pyx_args, 0);
|
|
2551
|
+
CYTHON_FALLTHROUGH;
|
|
2552
|
+
case 0: break;
|
|
2553
|
+
default: goto __pyx_L5_argtuple_error;
|
|
2554
|
+
}
|
|
2555
|
+
kw_args = <span class='pyx_c_api'>__Pyx_NumKwargs_FASTCALL</span>(__pyx_kwds);
|
|
2556
|
+
switch (__pyx_nargs) {
|
|
2557
|
+
case 0:
|
|
2558
|
+
if (likely((values[0] = <span class='pyx_c_api'>__Pyx_GetKwValue_FASTCALL</span>(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_obj)) != 0)) {
|
|
2559
|
+
(void)<span class='pyx_c_api'>__Pyx_Arg_NewRef_FASTCALL</span>(values[0]);
|
|
2560
|
+
kw_args--;
|
|
2561
|
+
}
|
|
2562
|
+
else if (unlikely(<span class='py_c_api'>PyErr_Occurred</span>())) <span class='error_goto'>__PYX_ERR(0, 212, __pyx_L3_error)</span>
|
|
2563
|
+
else goto __pyx_L5_argtuple_error;
|
|
2564
|
+
}
|
|
2565
|
+
if (unlikely(kw_args > 0)) {
|
|
2566
|
+
const Py_ssize_t kwd_pos_args = __pyx_nargs;
|
|
2567
|
+
if (unlikely(<span class='pyx_c_api'>__Pyx_ParseOptionalKeywords</span>(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, __pyx_v_kwargs, values + 0, kwd_pos_args, "load") < 0)) <span class='error_goto'>__PYX_ERR(0, 212, __pyx_L3_error)</span>
|
|
2568
|
+
}
|
|
2569
|
+
} else if (unlikely(__pyx_nargs != 1)) {
|
|
2570
|
+
goto __pyx_L5_argtuple_error;
|
|
2571
|
+
} else {
|
|
2572
|
+
values[0] = <span class='pyx_c_api'>__Pyx_Arg_FASTCALL</span>(__pyx_args, 0);
|
|
2573
|
+
}
|
|
2574
|
+
__pyx_v_obj = values[0];
|
|
2575
|
+
}
|
|
2576
|
+
goto __pyx_L6_skip;
|
|
2577
|
+
__pyx_L5_argtuple_error:;
|
|
2578
|
+
<span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>("load", 1, 1, 1, __pyx_nargs); <span class='error_goto'>__PYX_ERR(0, 212, __pyx_L3_error)</span>
|
|
2579
|
+
__pyx_L6_skip:;
|
|
2580
|
+
goto __pyx_L4_argument_unpacking_done;
|
|
2581
|
+
__pyx_L3_error:;
|
|
2582
|
+
{
|
|
2583
|
+
Py_ssize_t __pyx_temp;
|
|
2584
|
+
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
|
|
2585
|
+
<span class='pyx_c_api'>__Pyx_Arg_XDECREF_FASTCALL</span>(values[__pyx_temp]);
|
|
2586
|
+
}
|
|
2587
|
+
}
|
|
2588
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_v_kwargs); __pyx_v_kwargs = 0;
|
|
2589
|
+
<span class='pyx_c_api'>__Pyx_AddTraceback</span>("datamodel.parsers.json.JSONContent.load", __pyx_clineno, __pyx_lineno, __pyx_filename);
|
|
2590
|
+
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>();
|
|
2591
|
+
return NULL;
|
|
2592
|
+
__pyx_L4_argument_unpacking_done:;
|
|
2593
|
+
__pyx_r = __pyx_pf_9datamodel_7parsers_4json_11JSONContent_10load(((PyTypeObject*)__pyx_v_cls), __pyx_v_obj, __pyx_v_kwargs);
|
|
2594
|
+
int __pyx_lineno = 0;
|
|
2595
|
+
const char *__pyx_filename = NULL;
|
|
2596
|
+
int __pyx_clineno = 0;
|
|
2597
|
+
|
|
2598
|
+
/* function exit code */
|
|
2599
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_v_kwargs);
|
|
2600
|
+
{
|
|
2601
|
+
Py_ssize_t __pyx_temp;
|
|
2602
|
+
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
|
|
2603
|
+
<span class='pyx_c_api'>__Pyx_Arg_XDECREF_FASTCALL</span>(values[__pyx_temp]);
|
|
2604
|
+
}
|
|
2605
|
+
}
|
|
2606
|
+
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>();
|
|
2607
|
+
return __pyx_r;
|
|
2608
|
+
}
|
|
2609
|
+
|
|
2610
|
+
static PyObject *__pyx_pf_9datamodel_7parsers_4json_11JSONContent_10load(PyTypeObject *__pyx_v_cls, PyObject *__pyx_v_obj, PyObject *__pyx_v_kwargs) {
|
|
2611
|
+
PyObject *__pyx_r = NULL;
|
|
2612
|
+
/* … */
|
|
2613
|
+
/* function exit code */
|
|
2614
|
+
__pyx_L1_error:;
|
|
2615
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_1);
|
|
2616
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_2);
|
|
2617
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_3);
|
|
2618
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_4);
|
|
2619
|
+
<span class='pyx_c_api'>__Pyx_AddTraceback</span>("datamodel.parsers.json.JSONContent.load", __pyx_clineno, __pyx_lineno, __pyx_filename);
|
|
2620
|
+
__pyx_r = NULL;
|
|
2621
|
+
__pyx_L0:;
|
|
2622
|
+
<span class='refnanny'>__Pyx_XGIVEREF</span>(__pyx_r);
|
|
2623
|
+
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>();
|
|
2624
|
+
return __pyx_r;
|
|
2625
|
+
}
|
|
2626
|
+
/* … */
|
|
2627
|
+
__pyx_t_3 = <span class='pyx_c_api'>__Pyx_CyFunction_New</span>(&__pyx_mdef_9datamodel_7parsers_4json_11JSONContent_11load, __Pyx_CYFUNCTION_CLASSMETHOD | __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_JSONContent_load, NULL, __pyx_n_s_datamodel_parsers_json, __pyx_d, ((PyObject *)__pyx_codeobj__13));<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 212, __pyx_L1_error)</span>
|
|
2628
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
2629
|
+
if (<span class='pyx_c_api'>__Pyx_SetItemOnTypeDict</span>((PyObject *)__pyx_ptype_9datamodel_7parsers_4json_JSONContent, __pyx_n_s_load, __pyx_t_3) < 0) <span class='error_goto'>__PYX_ERR(0, 212, __pyx_L1_error)</span>
|
|
2630
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
|
|
2631
|
+
<span class='py_c_api'>PyType_Modified</span>(__pyx_ptype_9datamodel_7parsers_4json_JSONContent);
|
|
2632
|
+
<span class='pyx_c_api'>__Pyx_GetNameInClass</span>(__pyx_t_3, (PyObject *)__pyx_ptype_9datamodel_7parsers_4json_JSONContent, __pyx_n_s_load);<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 212, __pyx_L1_error)</span>
|
|
2633
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
2634
|
+
__pyx_t_4 = <span class='pyx_c_api'>__Pyx_Method_ClassMethod</span>(__pyx_t_3);<span class='error_goto'> if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 212, __pyx_L1_error)</span>
|
|
2635
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4);
|
|
2636
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
|
|
2637
|
+
if (<span class='pyx_c_api'>__Pyx_SetItemOnTypeDict</span>((PyObject *)__pyx_ptype_9datamodel_7parsers_4json_JSONContent, __pyx_n_s_load, __pyx_t_4) < 0) <span class='error_goto'>__PYX_ERR(0, 212, __pyx_L1_error)</span>
|
|
2638
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_4); __pyx_t_4 = 0;
|
|
2639
|
+
<span class='py_c_api'>PyType_Modified</span>(__pyx_ptype_9datamodel_7parsers_4json_JSONContent);
|
|
2640
|
+
/* … */
|
|
2641
|
+
__pyx_codeobj__13 = (PyObject*)<span class='pyx_c_api'>__Pyx_PyCode_New</span>(2, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_VARKEYWORDS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__9, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_datamodel_parsers_json_pyx, __pyx_n_s_load, 212, __pyx_empty_bytes);<span class='error_goto'> if (unlikely(!__pyx_codeobj__13)) __PYX_ERR(0, 212, __pyx_L1_error)</span>
|
|
2642
|
+
</pre><pre class="cython line score-0"> <span class="">213</span>: def load(cls, object obj, **kwargs):</pre>
|
|
2643
|
+
<pre class="cython line score-0"> <span class="">214</span>: """</pre>
|
|
2644
|
+
<pre class="cython line score-0"> <span class="">215</span>: Class method to decode JSON data using a new JSONContent instance.</pre>
|
|
2645
|
+
<pre class="cython line score-0"> <span class="">216</span>: """</pre>
|
|
2646
|
+
<pre class="cython line score-24" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">217</span>: return cls().decode(obj, **kwargs)</pre>
|
|
2647
|
+
<pre class='cython code score-24 '> <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_r);
|
|
2648
|
+
__pyx_t_1 = <span class='pyx_c_api'>__Pyx_PyObject_CallNoArg</span>(((PyObject *)__pyx_v_cls));<span class='error_goto'> if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 217, __pyx_L1_error)</span>
|
|
2649
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1);
|
|
2650
|
+
__pyx_t_2 = <span class='pyx_c_api'>__Pyx_PyObject_GetAttrStr</span>(__pyx_t_1, __pyx_n_s_decode);<span class='error_goto'> if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 217, __pyx_L1_error)</span>
|
|
2651
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_2);
|
|
2652
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0;
|
|
2653
|
+
__pyx_t_1 = <span class='py_c_api'>PyTuple_New</span>(1);<span class='error_goto'> if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 217, __pyx_L1_error)</span>
|
|
2654
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1);
|
|
2655
|
+
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_v_obj);
|
|
2656
|
+
<span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_v_obj);
|
|
2657
|
+
if (<span class='pyx_c_api'>__Pyx_PyTuple_SET_ITEM</span>(__pyx_t_1, 0, __pyx_v_obj)) <span class='error_goto'>__PYX_ERR(0, 217, __pyx_L1_error)</span>;
|
|
2658
|
+
__pyx_t_3 = <span class='py_c_api'>PyDict_Copy</span>(__pyx_v_kwargs);<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 217, __pyx_L1_error)</span>
|
|
2659
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
2660
|
+
__pyx_t_4 = <span class='pyx_c_api'>__Pyx_PyObject_Call</span>(__pyx_t_2, __pyx_t_1, __pyx_t_3);<span class='error_goto'> if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 217, __pyx_L1_error)</span>
|
|
2661
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4);
|
|
2662
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;
|
|
2663
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0;
|
|
2664
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
|
|
2665
|
+
__pyx_r = __pyx_t_4;
|
|
2666
|
+
__pyx_t_4 = 0;
|
|
2667
|
+
goto __pyx_L0;
|
|
2668
|
+
</pre><pre class="cython line score-0"> <span class="">218</span>: </pre>
|
|
2669
|
+
<pre class="cython line score-106" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">219</span>: cpdef str json_encoder(object obj, bint naive_utc = True, bint non_str_keys = False):</pre>
|
|
2670
|
+
<pre class='cython code score-106 '>static PyObject *__pyx_pw_9datamodel_7parsers_4json_1json_encoder(PyObject *__pyx_self,
|
|
2671
|
+
#if CYTHON_METH_FASTCALL
|
|
2672
|
+
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
|
|
2673
|
+
#else
|
|
2674
|
+
PyObject *__pyx_args, PyObject *__pyx_kwds
|
|
2675
|
+
#endif
|
|
2676
|
+
); /*proto*/
|
|
2677
|
+
static PyObject *__pyx_f_9datamodel_7parsers_4json_json_encoder(PyObject *__pyx_v_obj, CYTHON_UNUSED int __pyx_skip_dispatch, struct __pyx_opt_args_9datamodel_7parsers_4json_json_encoder *__pyx_optional_args) {
|
|
2678
|
+
int __pyx_v_naive_utc = ((int)1);
|
|
2679
|
+
int __pyx_v_non_str_keys = ((int)0);
|
|
2680
|
+
PyObject *__pyx_r = NULL;
|
|
2681
|
+
if (__pyx_optional_args) {
|
|
2682
|
+
if (__pyx_optional_args->__pyx_n > 0) {
|
|
2683
|
+
__pyx_v_naive_utc = __pyx_optional_args->naive_utc;
|
|
2684
|
+
if (__pyx_optional_args->__pyx_n > 1) {
|
|
2685
|
+
__pyx_v_non_str_keys = __pyx_optional_args->non_str_keys;
|
|
2686
|
+
}
|
|
2687
|
+
}
|
|
2688
|
+
}
|
|
2689
|
+
/* … */
|
|
2690
|
+
/* function exit code */
|
|
2691
|
+
__pyx_L1_error:;
|
|
2692
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_1);
|
|
2693
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_2);
|
|
2694
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_3);
|
|
2695
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_4);
|
|
2696
|
+
<span class='pyx_c_api'>__Pyx_AddTraceback</span>("datamodel.parsers.json.json_encoder", __pyx_clineno, __pyx_lineno, __pyx_filename);
|
|
2697
|
+
__pyx_r = 0;
|
|
2698
|
+
__pyx_L0:;
|
|
2699
|
+
<span class='refnanny'>__Pyx_XGIVEREF</span>(__pyx_r);
|
|
2700
|
+
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>();
|
|
2701
|
+
return __pyx_r;
|
|
2702
|
+
}
|
|
2703
|
+
|
|
2704
|
+
/* Python wrapper */
|
|
2705
|
+
static PyObject *__pyx_pw_9datamodel_7parsers_4json_1json_encoder(PyObject *__pyx_self,
|
|
2706
|
+
#if CYTHON_METH_FASTCALL
|
|
2707
|
+
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
|
|
2708
|
+
#else
|
|
2709
|
+
PyObject *__pyx_args, PyObject *__pyx_kwds
|
|
2710
|
+
#endif
|
|
2711
|
+
); /*proto*/
|
|
2712
|
+
<span class='py_macro_api'>PyDoc_STRVAR</span>(__pyx_doc_9datamodel_7parsers_4json_json_encoder, "json_encoder(obj, bool naive_utc=True, bool non_str_keys=False) -> unicode\n\n Encode an object to JSON using the default JSONContent encoder.\n ");
|
|
2713
|
+
static PyMethodDef __pyx_mdef_9datamodel_7parsers_4json_1json_encoder = {"json_encoder", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9datamodel_7parsers_4json_1json_encoder, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9datamodel_7parsers_4json_json_encoder};
|
|
2714
|
+
static PyObject *__pyx_pw_9datamodel_7parsers_4json_1json_encoder(PyObject *__pyx_self,
|
|
2715
|
+
#if CYTHON_METH_FASTCALL
|
|
2716
|
+
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
|
|
2717
|
+
#else
|
|
2718
|
+
PyObject *__pyx_args, PyObject *__pyx_kwds
|
|
2719
|
+
#endif
|
|
2720
|
+
) {
|
|
2721
|
+
PyObject *__pyx_v_obj = 0;
|
|
2722
|
+
int __pyx_v_naive_utc;
|
|
2723
|
+
int __pyx_v_non_str_keys;
|
|
2724
|
+
#if !CYTHON_METH_FASTCALL
|
|
2725
|
+
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
|
|
2726
|
+
#endif
|
|
2727
|
+
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
|
|
2728
|
+
PyObject *__pyx_r = 0;
|
|
2729
|
+
<span class='refnanny'>__Pyx_RefNannyDeclarations</span>
|
|
2730
|
+
<span class='refnanny'>__Pyx_RefNannySetupContext</span>("json_encoder (wrapper)", 0);
|
|
2731
|
+
#if !CYTHON_METH_FASTCALL
|
|
2732
|
+
#if CYTHON_ASSUME_SAFE_MACROS
|
|
2733
|
+
__pyx_nargs = <span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args);
|
|
2734
|
+
#else
|
|
2735
|
+
__pyx_nargs = <span class='py_c_api'>PyTuple_Size</span>(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
|
|
2736
|
+
#endif
|
|
2737
|
+
#endif
|
|
2738
|
+
__pyx_kwvalues = <span class='pyx_c_api'>__Pyx_KwValues_FASTCALL</span>(__pyx_args, __pyx_nargs);
|
|
2739
|
+
{
|
|
2740
|
+
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,&__pyx_n_s_naive_utc,&__pyx_n_s_non_str_keys,0};
|
|
2741
|
+
PyObject* values[3] = {0,0,0};
|
|
2742
|
+
if (__pyx_kwds) {
|
|
2743
|
+
Py_ssize_t kw_args;
|
|
2744
|
+
switch (__pyx_nargs) {
|
|
2745
|
+
case 3: values[2] = <span class='pyx_c_api'>__Pyx_Arg_FASTCALL</span>(__pyx_args, 2);
|
|
2746
|
+
CYTHON_FALLTHROUGH;
|
|
2747
|
+
case 2: values[1] = <span class='pyx_c_api'>__Pyx_Arg_FASTCALL</span>(__pyx_args, 1);
|
|
2748
|
+
CYTHON_FALLTHROUGH;
|
|
2749
|
+
case 1: values[0] = <span class='pyx_c_api'>__Pyx_Arg_FASTCALL</span>(__pyx_args, 0);
|
|
2750
|
+
CYTHON_FALLTHROUGH;
|
|
2751
|
+
case 0: break;
|
|
2752
|
+
default: goto __pyx_L5_argtuple_error;
|
|
2753
|
+
}
|
|
2754
|
+
kw_args = <span class='pyx_c_api'>__Pyx_NumKwargs_FASTCALL</span>(__pyx_kwds);
|
|
2755
|
+
switch (__pyx_nargs) {
|
|
2756
|
+
case 0:
|
|
2757
|
+
if (likely((values[0] = <span class='pyx_c_api'>__Pyx_GetKwValue_FASTCALL</span>(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_obj)) != 0)) {
|
|
2758
|
+
(void)<span class='pyx_c_api'>__Pyx_Arg_NewRef_FASTCALL</span>(values[0]);
|
|
2759
|
+
kw_args--;
|
|
2760
|
+
}
|
|
2761
|
+
else if (unlikely(<span class='py_c_api'>PyErr_Occurred</span>())) <span class='error_goto'>__PYX_ERR(0, 219, __pyx_L3_error)</span>
|
|
2762
|
+
else goto __pyx_L5_argtuple_error;
|
|
2763
|
+
CYTHON_FALLTHROUGH;
|
|
2764
|
+
case 1:
|
|
2765
|
+
if (kw_args > 0) {
|
|
2766
|
+
PyObject* value = <span class='pyx_c_api'>__Pyx_GetKwValue_FASTCALL</span>(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_naive_utc);
|
|
2767
|
+
if (value) { values[1] = <span class='pyx_c_api'>__Pyx_Arg_NewRef_FASTCALL</span>(value); kw_args--; }
|
|
2768
|
+
else if (unlikely(<span class='py_c_api'>PyErr_Occurred</span>())) <span class='error_goto'>__PYX_ERR(0, 219, __pyx_L3_error)</span>
|
|
2769
|
+
}
|
|
2770
|
+
CYTHON_FALLTHROUGH;
|
|
2771
|
+
case 2:
|
|
2772
|
+
if (kw_args > 0) {
|
|
2773
|
+
PyObject* value = <span class='pyx_c_api'>__Pyx_GetKwValue_FASTCALL</span>(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_non_str_keys);
|
|
2774
|
+
if (value) { values[2] = <span class='pyx_c_api'>__Pyx_Arg_NewRef_FASTCALL</span>(value); kw_args--; }
|
|
2775
|
+
else if (unlikely(<span class='py_c_api'>PyErr_Occurred</span>())) <span class='error_goto'>__PYX_ERR(0, 219, __pyx_L3_error)</span>
|
|
2776
|
+
}
|
|
2777
|
+
}
|
|
2778
|
+
if (unlikely(kw_args > 0)) {
|
|
2779
|
+
const Py_ssize_t kwd_pos_args = __pyx_nargs;
|
|
2780
|
+
if (unlikely(<span class='pyx_c_api'>__Pyx_ParseOptionalKeywords</span>(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "json_encoder") < 0)) <span class='error_goto'>__PYX_ERR(0, 219, __pyx_L3_error)</span>
|
|
2781
|
+
}
|
|
2782
|
+
} else {
|
|
2783
|
+
switch (__pyx_nargs) {
|
|
2784
|
+
case 3: values[2] = <span class='pyx_c_api'>__Pyx_Arg_FASTCALL</span>(__pyx_args, 2);
|
|
2785
|
+
CYTHON_FALLTHROUGH;
|
|
2786
|
+
case 2: values[1] = <span class='pyx_c_api'>__Pyx_Arg_FASTCALL</span>(__pyx_args, 1);
|
|
2787
|
+
CYTHON_FALLTHROUGH;
|
|
2788
|
+
case 1: values[0] = <span class='pyx_c_api'>__Pyx_Arg_FASTCALL</span>(__pyx_args, 0);
|
|
2789
|
+
break;
|
|
2790
|
+
default: goto __pyx_L5_argtuple_error;
|
|
2791
|
+
}
|
|
2792
|
+
}
|
|
2793
|
+
__pyx_v_obj = values[0];
|
|
2794
|
+
if (values[1]) {
|
|
2795
|
+
__pyx_v_naive_utc = <span class='pyx_c_api'>__Pyx_PyObject_IsTrue</span>(values[1]); if (unlikely((__pyx_v_naive_utc == (int)-1) && <span class='py_c_api'>PyErr_Occurred</span>())) <span class='error_goto'>__PYX_ERR(0, 219, __pyx_L3_error)</span>
|
|
2796
|
+
} else {
|
|
2797
|
+
__pyx_v_naive_utc = ((int)1);
|
|
2798
|
+
}
|
|
2799
|
+
if (values[2]) {
|
|
2800
|
+
__pyx_v_non_str_keys = <span class='pyx_c_api'>__Pyx_PyObject_IsTrue</span>(values[2]); if (unlikely((__pyx_v_non_str_keys == (int)-1) && <span class='py_c_api'>PyErr_Occurred</span>())) <span class='error_goto'>__PYX_ERR(0, 219, __pyx_L3_error)</span>
|
|
2801
|
+
} else {
|
|
2802
|
+
__pyx_v_non_str_keys = ((int)0);
|
|
2803
|
+
}
|
|
2804
|
+
}
|
|
2805
|
+
goto __pyx_L6_skip;
|
|
2806
|
+
__pyx_L5_argtuple_error:;
|
|
2807
|
+
<span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>("json_encoder", 0, 1, 3, __pyx_nargs); <span class='error_goto'>__PYX_ERR(0, 219, __pyx_L3_error)</span>
|
|
2808
|
+
__pyx_L6_skip:;
|
|
2809
|
+
goto __pyx_L4_argument_unpacking_done;
|
|
2810
|
+
__pyx_L3_error:;
|
|
2811
|
+
{
|
|
2812
|
+
Py_ssize_t __pyx_temp;
|
|
2813
|
+
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
|
|
2814
|
+
<span class='pyx_c_api'>__Pyx_Arg_XDECREF_FASTCALL</span>(values[__pyx_temp]);
|
|
2815
|
+
}
|
|
2816
|
+
}
|
|
2817
|
+
<span class='pyx_c_api'>__Pyx_AddTraceback</span>("datamodel.parsers.json.json_encoder", __pyx_clineno, __pyx_lineno, __pyx_filename);
|
|
2818
|
+
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>();
|
|
2819
|
+
return NULL;
|
|
2820
|
+
__pyx_L4_argument_unpacking_done:;
|
|
2821
|
+
__pyx_r = __pyx_pf_9datamodel_7parsers_4json_json_encoder(__pyx_self, __pyx_v_obj, __pyx_v_naive_utc, __pyx_v_non_str_keys);
|
|
2822
|
+
|
|
2823
|
+
/* function exit code */
|
|
2824
|
+
{
|
|
2825
|
+
Py_ssize_t __pyx_temp;
|
|
2826
|
+
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
|
|
2827
|
+
<span class='pyx_c_api'>__Pyx_Arg_XDECREF_FASTCALL</span>(values[__pyx_temp]);
|
|
2828
|
+
}
|
|
2829
|
+
}
|
|
2830
|
+
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>();
|
|
2831
|
+
return __pyx_r;
|
|
2832
|
+
}
|
|
2833
|
+
|
|
2834
|
+
static PyObject *__pyx_pf_9datamodel_7parsers_4json_json_encoder(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_obj, int __pyx_v_naive_utc, int __pyx_v_non_str_keys) {
|
|
2835
|
+
PyObject *__pyx_r = NULL;
|
|
2836
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_r);
|
|
2837
|
+
__pyx_t_2.__pyx_n = 2;
|
|
2838
|
+
__pyx_t_2.naive_utc = __pyx_v_naive_utc;
|
|
2839
|
+
__pyx_t_2.non_str_keys = __pyx_v_non_str_keys;
|
|
2840
|
+
__pyx_t_1 = __pyx_f_9datamodel_7parsers_4json_json_encoder(__pyx_v_obj, 0, &__pyx_t_2);<span class='error_goto'> if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 219, __pyx_L1_error)</span>
|
|
2841
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1);
|
|
2842
|
+
__pyx_r = __pyx_t_1;
|
|
2843
|
+
__pyx_t_1 = 0;
|
|
2844
|
+
goto __pyx_L0;
|
|
2845
|
+
|
|
2846
|
+
/* function exit code */
|
|
2847
|
+
__pyx_L1_error:;
|
|
2848
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_1);
|
|
2849
|
+
<span class='pyx_c_api'>__Pyx_AddTraceback</span>("datamodel.parsers.json.json_encoder", __pyx_clineno, __pyx_lineno, __pyx_filename);
|
|
2850
|
+
__pyx_r = NULL;
|
|
2851
|
+
__pyx_L0:;
|
|
2852
|
+
<span class='refnanny'>__Pyx_XGIVEREF</span>(__pyx_r);
|
|
2853
|
+
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>();
|
|
2854
|
+
return __pyx_r;
|
|
2855
|
+
}
|
|
2856
|
+
/* … */
|
|
2857
|
+
__pyx_tuple__18 = <span class='py_c_api'>PyTuple_Pack</span>(3, __pyx_n_s_obj, __pyx_n_s_naive_utc, __pyx_n_s_non_str_keys);<span class='error_goto'> if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 219, __pyx_L1_error)</span>
|
|
2858
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_tuple__18);
|
|
2859
|
+
<span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_tuple__18);
|
|
2860
|
+
__pyx_codeobj__19 = (PyObject*)<span class='pyx_c_api'>__Pyx_PyCode_New</span>(3, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__18, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_datamodel_parsers_json_pyx, __pyx_n_s_json_encoder, 219, __pyx_empty_bytes);<span class='error_goto'> if (unlikely(!__pyx_codeobj__19)) __PYX_ERR(0, 219, __pyx_L1_error)</span>
|
|
2861
|
+
/* … */
|
|
2862
|
+
__pyx_t_4 = <span class='pyx_c_api'>__Pyx_CyFunction_New</span>(&__pyx_mdef_9datamodel_7parsers_4json_1json_encoder, 0, __pyx_n_s_json_encoder, NULL, __pyx_n_s_datamodel_parsers_json, __pyx_d, ((PyObject *)__pyx_codeobj__19));<span class='error_goto'> if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 219, __pyx_L1_error)</span>
|
|
2863
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4);
|
|
2864
|
+
<span class='pyx_c_api'>__Pyx_CyFunction_SetDefaultsTuple</span>(__pyx_t_4, __pyx_tuple__20);
|
|
2865
|
+
if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_d, __pyx_n_s_json_encoder, __pyx_t_4) < 0) <span class='error_goto'>__PYX_ERR(0, 219, __pyx_L1_error)</span>
|
|
2866
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_4); __pyx_t_4 = 0;
|
|
2867
|
+
__pyx_tuple__20 = <span class='py_c_api'>PyTuple_Pack</span>(2, Py_True, Py_False);<span class='error_goto'> if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 219, __pyx_L1_error)</span>
|
|
2868
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_tuple__20);
|
|
2869
|
+
<span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_tuple__20);
|
|
2870
|
+
/* … */
|
|
2871
|
+
struct __pyx_opt_args_9datamodel_7parsers_4json_json_encoder {
|
|
2872
|
+
int __pyx_n;
|
|
2873
|
+
int naive_utc;
|
|
2874
|
+
int non_str_keys;
|
|
2875
|
+
};
|
|
2876
|
+
</pre><pre class="cython line score-0"> <span class="">220</span>: """</pre>
|
|
2877
|
+
<pre class="cython line score-0"> <span class="">221</span>: Encode an object to JSON using the default JSONContent encoder.</pre>
|
|
2878
|
+
<pre class="cython line score-0"> <span class="">222</span>: """</pre>
|
|
2879
|
+
<pre class="cython line score-44" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">223</span>: return JSONContent().dumps(obj, naive_utc=naive_utc, non_str_keys=non_str_keys)</pre>
|
|
2880
|
+
<pre class='cython code score-44 '> <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_r);
|
|
2881
|
+
__pyx_t_1 = <span class='pyx_c_api'>__Pyx_PyObject_CallNoArg</span>(((PyObject *)__pyx_ptype_9datamodel_7parsers_4json_JSONContent));<span class='error_goto'> if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 223, __pyx_L1_error)</span>
|
|
2882
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1);
|
|
2883
|
+
__pyx_t_2 = <span class='pyx_c_api'>__Pyx_PyObject_GetAttrStr</span>(__pyx_t_1, __pyx_n_s_dumps);<span class='error_goto'> if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 223, __pyx_L1_error)</span>
|
|
2884
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_2);
|
|
2885
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0;
|
|
2886
|
+
__pyx_t_1 = <span class='py_c_api'>PyTuple_New</span>(1);<span class='error_goto'> if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 223, __pyx_L1_error)</span>
|
|
2887
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1);
|
|
2888
|
+
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_v_obj);
|
|
2889
|
+
<span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_v_obj);
|
|
2890
|
+
if (<span class='pyx_c_api'>__Pyx_PyTuple_SET_ITEM</span>(__pyx_t_1, 0, __pyx_v_obj)) <span class='error_goto'>__PYX_ERR(0, 223, __pyx_L1_error)</span>;
|
|
2891
|
+
__pyx_t_3 = <span class='pyx_c_api'>__Pyx_PyDict_NewPresized</span>(2);<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 223, __pyx_L1_error)</span>
|
|
2892
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
2893
|
+
__pyx_t_4 = <span class='pyx_c_api'>__Pyx_PyBool_FromLong</span>(__pyx_v_naive_utc);<span class='error_goto'> if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 223, __pyx_L1_error)</span>
|
|
2894
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4);
|
|
2895
|
+
if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_t_3, __pyx_n_s_naive_utc, __pyx_t_4) < 0) <span class='error_goto'>__PYX_ERR(0, 223, __pyx_L1_error)</span>
|
|
2896
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_4); __pyx_t_4 = 0;
|
|
2897
|
+
__pyx_t_4 = <span class='pyx_c_api'>__Pyx_PyBool_FromLong</span>(__pyx_v_non_str_keys);<span class='error_goto'> if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 223, __pyx_L1_error)</span>
|
|
2898
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4);
|
|
2899
|
+
if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_t_3, __pyx_n_s_non_str_keys, __pyx_t_4) < 0) <span class='error_goto'>__PYX_ERR(0, 223, __pyx_L1_error)</span>
|
|
2900
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_4); __pyx_t_4 = 0;
|
|
2901
|
+
__pyx_t_4 = <span class='pyx_c_api'>__Pyx_PyObject_Call</span>(__pyx_t_2, __pyx_t_1, __pyx_t_3);<span class='error_goto'> if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 223, __pyx_L1_error)</span>
|
|
2902
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4);
|
|
2903
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;
|
|
2904
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0;
|
|
2905
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
|
|
2906
|
+
if (!(likely(<span class='py_c_api'>PyUnicode_CheckExact</span>(__pyx_t_4))||((__pyx_t_4) == Py_None) || <span class='pyx_c_api'>__Pyx_RaiseUnexpectedTypeError</span>("unicode", __pyx_t_4))) <span class='error_goto'>__PYX_ERR(0, 223, __pyx_L1_error)</span>
|
|
2907
|
+
__pyx_r = ((PyObject*)__pyx_t_4);
|
|
2908
|
+
__pyx_t_4 = 0;
|
|
2909
|
+
goto __pyx_L0;
|
|
2910
|
+
</pre><pre class="cython line score-0"> <span class="">224</span>: </pre>
|
|
2911
|
+
<pre class="cython line score-58" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">225</span>: cpdef object json_decoder(object obj):</pre>
|
|
2912
|
+
<pre class='cython code score-58 '>static PyObject *__pyx_pw_9datamodel_7parsers_4json_3json_decoder(PyObject *__pyx_self,
|
|
2913
|
+
#if CYTHON_METH_FASTCALL
|
|
2914
|
+
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
|
|
2915
|
+
#else
|
|
2916
|
+
PyObject *__pyx_args, PyObject *__pyx_kwds
|
|
2917
|
+
#endif
|
|
2918
|
+
); /*proto*/
|
|
2919
|
+
static PyObject *__pyx_f_9datamodel_7parsers_4json_json_decoder(PyObject *__pyx_v_obj, CYTHON_UNUSED int __pyx_skip_dispatch) {
|
|
2920
|
+
PyObject *__pyx_r = NULL;
|
|
2921
|
+
/* … */
|
|
2922
|
+
/* function exit code */
|
|
2923
|
+
__pyx_L1_error:;
|
|
2924
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_1);
|
|
2925
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_2);
|
|
2926
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_3);
|
|
2927
|
+
<span class='pyx_c_api'>__Pyx_AddTraceback</span>("datamodel.parsers.json.json_decoder", __pyx_clineno, __pyx_lineno, __pyx_filename);
|
|
2928
|
+
__pyx_r = 0;
|
|
2929
|
+
__pyx_L0:;
|
|
2930
|
+
<span class='refnanny'>__Pyx_XGIVEREF</span>(__pyx_r);
|
|
2931
|
+
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>();
|
|
2932
|
+
return __pyx_r;
|
|
2933
|
+
}
|
|
2934
|
+
|
|
2935
|
+
/* Python wrapper */
|
|
2936
|
+
static PyObject *__pyx_pw_9datamodel_7parsers_4json_3json_decoder(PyObject *__pyx_self,
|
|
2937
|
+
#if CYTHON_METH_FASTCALL
|
|
2938
|
+
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
|
|
2939
|
+
#else
|
|
2940
|
+
PyObject *__pyx_args, PyObject *__pyx_kwds
|
|
2941
|
+
#endif
|
|
2942
|
+
); /*proto*/
|
|
2943
|
+
<span class='py_macro_api'>PyDoc_STRVAR</span>(__pyx_doc_9datamodel_7parsers_4json_2json_decoder, "json_decoder(obj)\n\n Decode JSON data using the default JSONContent decoder.\n ");
|
|
2944
|
+
static PyMethodDef __pyx_mdef_9datamodel_7parsers_4json_3json_decoder = {"json_decoder", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9datamodel_7parsers_4json_3json_decoder, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9datamodel_7parsers_4json_2json_decoder};
|
|
2945
|
+
static PyObject *__pyx_pw_9datamodel_7parsers_4json_3json_decoder(PyObject *__pyx_self,
|
|
2946
|
+
#if CYTHON_METH_FASTCALL
|
|
2947
|
+
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
|
|
2948
|
+
#else
|
|
2949
|
+
PyObject *__pyx_args, PyObject *__pyx_kwds
|
|
2950
|
+
#endif
|
|
2951
|
+
) {
|
|
2952
|
+
PyObject *__pyx_v_obj = 0;
|
|
2953
|
+
#if !CYTHON_METH_FASTCALL
|
|
2954
|
+
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
|
|
2955
|
+
#endif
|
|
2956
|
+
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
|
|
2957
|
+
PyObject *__pyx_r = 0;
|
|
2958
|
+
<span class='refnanny'>__Pyx_RefNannyDeclarations</span>
|
|
2959
|
+
<span class='refnanny'>__Pyx_RefNannySetupContext</span>("json_decoder (wrapper)", 0);
|
|
2960
|
+
#if !CYTHON_METH_FASTCALL
|
|
2961
|
+
#if CYTHON_ASSUME_SAFE_MACROS
|
|
2962
|
+
__pyx_nargs = <span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args);
|
|
2963
|
+
#else
|
|
2964
|
+
__pyx_nargs = <span class='py_c_api'>PyTuple_Size</span>(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
|
|
2965
|
+
#endif
|
|
2966
|
+
#endif
|
|
2967
|
+
__pyx_kwvalues = <span class='pyx_c_api'>__Pyx_KwValues_FASTCALL</span>(__pyx_args, __pyx_nargs);
|
|
2968
|
+
{
|
|
2969
|
+
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,0};
|
|
2970
|
+
PyObject* values[1] = {0};
|
|
2971
|
+
if (__pyx_kwds) {
|
|
2972
|
+
Py_ssize_t kw_args;
|
|
2973
|
+
switch (__pyx_nargs) {
|
|
2974
|
+
case 1: values[0] = <span class='pyx_c_api'>__Pyx_Arg_FASTCALL</span>(__pyx_args, 0);
|
|
2975
|
+
CYTHON_FALLTHROUGH;
|
|
2976
|
+
case 0: break;
|
|
2977
|
+
default: goto __pyx_L5_argtuple_error;
|
|
2978
|
+
}
|
|
2979
|
+
kw_args = <span class='pyx_c_api'>__Pyx_NumKwargs_FASTCALL</span>(__pyx_kwds);
|
|
2980
|
+
switch (__pyx_nargs) {
|
|
2981
|
+
case 0:
|
|
2982
|
+
if (likely((values[0] = <span class='pyx_c_api'>__Pyx_GetKwValue_FASTCALL</span>(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_obj)) != 0)) {
|
|
2983
|
+
(void)<span class='pyx_c_api'>__Pyx_Arg_NewRef_FASTCALL</span>(values[0]);
|
|
2984
|
+
kw_args--;
|
|
2985
|
+
}
|
|
2986
|
+
else if (unlikely(<span class='py_c_api'>PyErr_Occurred</span>())) <span class='error_goto'>__PYX_ERR(0, 225, __pyx_L3_error)</span>
|
|
2987
|
+
else goto __pyx_L5_argtuple_error;
|
|
2988
|
+
}
|
|
2989
|
+
if (unlikely(kw_args > 0)) {
|
|
2990
|
+
const Py_ssize_t kwd_pos_args = __pyx_nargs;
|
|
2991
|
+
if (unlikely(<span class='pyx_c_api'>__Pyx_ParseOptionalKeywords</span>(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "json_decoder") < 0)) <span class='error_goto'>__PYX_ERR(0, 225, __pyx_L3_error)</span>
|
|
2992
|
+
}
|
|
2993
|
+
} else if (unlikely(__pyx_nargs != 1)) {
|
|
2994
|
+
goto __pyx_L5_argtuple_error;
|
|
2995
|
+
} else {
|
|
2996
|
+
values[0] = <span class='pyx_c_api'>__Pyx_Arg_FASTCALL</span>(__pyx_args, 0);
|
|
2997
|
+
}
|
|
2998
|
+
__pyx_v_obj = values[0];
|
|
2999
|
+
}
|
|
3000
|
+
goto __pyx_L6_skip;
|
|
3001
|
+
__pyx_L5_argtuple_error:;
|
|
3002
|
+
<span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>("json_decoder", 1, 1, 1, __pyx_nargs); <span class='error_goto'>__PYX_ERR(0, 225, __pyx_L3_error)</span>
|
|
3003
|
+
__pyx_L6_skip:;
|
|
3004
|
+
goto __pyx_L4_argument_unpacking_done;
|
|
3005
|
+
__pyx_L3_error:;
|
|
3006
|
+
{
|
|
3007
|
+
Py_ssize_t __pyx_temp;
|
|
3008
|
+
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
|
|
3009
|
+
<span class='pyx_c_api'>__Pyx_Arg_XDECREF_FASTCALL</span>(values[__pyx_temp]);
|
|
3010
|
+
}
|
|
3011
|
+
}
|
|
3012
|
+
<span class='pyx_c_api'>__Pyx_AddTraceback</span>("datamodel.parsers.json.json_decoder", __pyx_clineno, __pyx_lineno, __pyx_filename);
|
|
3013
|
+
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>();
|
|
3014
|
+
return NULL;
|
|
3015
|
+
__pyx_L4_argument_unpacking_done:;
|
|
3016
|
+
__pyx_r = __pyx_pf_9datamodel_7parsers_4json_2json_decoder(__pyx_self, __pyx_v_obj);
|
|
3017
|
+
int __pyx_lineno = 0;
|
|
3018
|
+
const char *__pyx_filename = NULL;
|
|
3019
|
+
int __pyx_clineno = 0;
|
|
3020
|
+
|
|
3021
|
+
/* function exit code */
|
|
3022
|
+
{
|
|
3023
|
+
Py_ssize_t __pyx_temp;
|
|
3024
|
+
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
|
|
3025
|
+
<span class='pyx_c_api'>__Pyx_Arg_XDECREF_FASTCALL</span>(values[__pyx_temp]);
|
|
3026
|
+
}
|
|
3027
|
+
}
|
|
3028
|
+
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>();
|
|
3029
|
+
return __pyx_r;
|
|
3030
|
+
}
|
|
3031
|
+
|
|
3032
|
+
static PyObject *__pyx_pf_9datamodel_7parsers_4json_2json_decoder(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_obj) {
|
|
3033
|
+
PyObject *__pyx_r = NULL;
|
|
3034
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_r);
|
|
3035
|
+
__pyx_t_1 = __pyx_f_9datamodel_7parsers_4json_json_decoder(__pyx_v_obj, 0);<span class='error_goto'> if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 225, __pyx_L1_error)</span>
|
|
3036
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1);
|
|
3037
|
+
__pyx_r = __pyx_t_1;
|
|
3038
|
+
__pyx_t_1 = 0;
|
|
3039
|
+
goto __pyx_L0;
|
|
3040
|
+
|
|
3041
|
+
/* function exit code */
|
|
3042
|
+
__pyx_L1_error:;
|
|
3043
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_1);
|
|
3044
|
+
<span class='pyx_c_api'>__Pyx_AddTraceback</span>("datamodel.parsers.json.json_decoder", __pyx_clineno, __pyx_lineno, __pyx_filename);
|
|
3045
|
+
__pyx_r = NULL;
|
|
3046
|
+
__pyx_L0:;
|
|
3047
|
+
<span class='refnanny'>__Pyx_XGIVEREF</span>(__pyx_r);
|
|
3048
|
+
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>();
|
|
3049
|
+
return __pyx_r;
|
|
3050
|
+
}
|
|
3051
|
+
/* … */
|
|
3052
|
+
__pyx_tuple__21 = <span class='py_c_api'>PyTuple_Pack</span>(1, __pyx_n_s_obj);<span class='error_goto'> if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 225, __pyx_L1_error)</span>
|
|
3053
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_tuple__21);
|
|
3054
|
+
<span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_tuple__21);
|
|
3055
|
+
/* … */
|
|
3056
|
+
__pyx_t_4 = <span class='pyx_c_api'>__Pyx_CyFunction_New</span>(&__pyx_mdef_9datamodel_7parsers_4json_3json_decoder, 0, __pyx_n_s_json_decoder, NULL, __pyx_n_s_datamodel_parsers_json, __pyx_d, ((PyObject *)__pyx_codeobj__22));<span class='error_goto'> if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 225, __pyx_L1_error)</span>
|
|
3057
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4);
|
|
3058
|
+
if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_d, __pyx_n_s_json_decoder, __pyx_t_4) < 0) <span class='error_goto'>__PYX_ERR(0, 225, __pyx_L1_error)</span>
|
|
3059
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_4); __pyx_t_4 = 0;
|
|
3060
|
+
__pyx_codeobj__22 = (PyObject*)<span class='pyx_c_api'>__Pyx_PyCode_New</span>(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__21, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_datamodel_parsers_json_pyx, __pyx_n_s_json_decoder, 225, __pyx_empty_bytes);<span class='error_goto'> if (unlikely(!__pyx_codeobj__22)) __PYX_ERR(0, 225, __pyx_L1_error)</span>
|
|
3061
|
+
</pre><pre class="cython line score-0"> <span class="">226</span>: """</pre>
|
|
3062
|
+
<pre class="cython line score-0"> <span class="">227</span>: Decode JSON data using the default JSONContent decoder.</pre>
|
|
3063
|
+
<pre class="cython line score-0"> <span class="">228</span>: """</pre>
|
|
3064
|
+
<pre class="cython line score-20" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">229</span>: return JSONContent().loads(obj)</pre>
|
|
3065
|
+
<pre class='cython code score-20 '> <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_r);
|
|
3066
|
+
__pyx_t_2 = <span class='pyx_c_api'>__Pyx_PyObject_CallNoArg</span>(((PyObject *)__pyx_ptype_9datamodel_7parsers_4json_JSONContent));<span class='error_goto'> if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 229, __pyx_L1_error)</span>
|
|
3067
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_2);
|
|
3068
|
+
__pyx_t_3 = <span class='pyx_c_api'>__Pyx_PyObject_GetAttrStr</span>(__pyx_t_2, __pyx_n_s_loads);<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 229, __pyx_L1_error)</span>
|
|
3069
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
3070
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;
|
|
3071
|
+
__pyx_t_2 = NULL;
|
|
3072
|
+
__pyx_t_4 = 0;
|
|
3073
|
+
#if CYTHON_UNPACK_METHODS
|
|
3074
|
+
if (likely(<span class='py_c_api'>PyMethod_Check</span>(__pyx_t_3))) {
|
|
3075
|
+
__pyx_t_2 = <span class='py_macro_api'>PyMethod_GET_SELF</span>(__pyx_t_3);
|
|
3076
|
+
if (likely(__pyx_t_2)) {
|
|
3077
|
+
PyObject* function = <span class='py_macro_api'>PyMethod_GET_FUNCTION</span>(__pyx_t_3);
|
|
3078
|
+
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_t_2);
|
|
3079
|
+
<span class='pyx_macro_api'>__Pyx_INCREF</span>(function);
|
|
3080
|
+
<span class='pyx_macro_api'>__Pyx_DECREF_SET</span>(__pyx_t_3, function);
|
|
3081
|
+
__pyx_t_4 = 1;
|
|
3082
|
+
}
|
|
3083
|
+
}
|
|
3084
|
+
#endif
|
|
3085
|
+
{
|
|
3086
|
+
PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_obj};
|
|
3087
|
+
__pyx_t_1 = <span class='pyx_c_api'>__Pyx_PyObject_FastCall</span>(__pyx_t_3, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
|
|
3088
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_2); __pyx_t_2 = 0;
|
|
3089
|
+
if (unlikely(!__pyx_t_1)) <span class='error_goto'>__PYX_ERR(0, 229, __pyx_L1_error)</span>
|
|
3090
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1);
|
|
3091
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
|
|
3092
|
+
}
|
|
3093
|
+
__pyx_r = __pyx_t_1;
|
|
3094
|
+
__pyx_t_1 = 0;
|
|
3095
|
+
goto __pyx_L0;
|
|
3096
|
+
</pre><pre class="cython line score-0"> <span class="">230</span>: </pre>
|
|
3097
|
+
<pre class="cython line score-0"> <span class="">231</span>: </pre>
|
|
3098
|
+
<pre class="cython line score-55" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">232</span>: cpdef object json_fragment(bytes obj):</pre>
|
|
3099
|
+
<pre class='cython code score-55 '>static PyObject *__pyx_pw_9datamodel_7parsers_4json_5json_fragment(PyObject *__pyx_self,
|
|
3100
|
+
#if CYTHON_METH_FASTCALL
|
|
3101
|
+
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
|
|
3102
|
+
#else
|
|
3103
|
+
PyObject *__pyx_args, PyObject *__pyx_kwds
|
|
3104
|
+
#endif
|
|
3105
|
+
); /*proto*/
|
|
3106
|
+
static PyObject *__pyx_f_9datamodel_7parsers_4json_json_fragment(PyObject *__pyx_v_obj, CYTHON_UNUSED int __pyx_skip_dispatch) {
|
|
3107
|
+
PyObject *__pyx_r = NULL;
|
|
3108
|
+
/* … */
|
|
3109
|
+
/* function exit code */
|
|
3110
|
+
__pyx_L1_error:;
|
|
3111
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_1);
|
|
3112
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_2);
|
|
3113
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_3);
|
|
3114
|
+
<span class='pyx_c_api'>__Pyx_AddTraceback</span>("datamodel.parsers.json.json_fragment", __pyx_clineno, __pyx_lineno, __pyx_filename);
|
|
3115
|
+
__pyx_r = 0;
|
|
3116
|
+
__pyx_L0:;
|
|
3117
|
+
<span class='refnanny'>__Pyx_XGIVEREF</span>(__pyx_r);
|
|
3118
|
+
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>();
|
|
3119
|
+
return __pyx_r;
|
|
3120
|
+
}
|
|
3121
|
+
|
|
3122
|
+
/* Python wrapper */
|
|
3123
|
+
static PyObject *__pyx_pw_9datamodel_7parsers_4json_5json_fragment(PyObject *__pyx_self,
|
|
3124
|
+
#if CYTHON_METH_FASTCALL
|
|
3125
|
+
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
|
|
3126
|
+
#else
|
|
3127
|
+
PyObject *__pyx_args, PyObject *__pyx_kwds
|
|
3128
|
+
#endif
|
|
3129
|
+
); /*proto*/
|
|
3130
|
+
<span class='py_macro_api'>PyDoc_STRVAR</span>(__pyx_doc_9datamodel_7parsers_4json_4json_fragment, "json_fragment(bytes obj)\n\n Return a Orjson Fragment of an already-serialized JSON Document.\n ");
|
|
3131
|
+
static PyMethodDef __pyx_mdef_9datamodel_7parsers_4json_5json_fragment = {"json_fragment", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_9datamodel_7parsers_4json_5json_fragment, __Pyx_METH_FASTCALL|METH_KEYWORDS, __pyx_doc_9datamodel_7parsers_4json_4json_fragment};
|
|
3132
|
+
static PyObject *__pyx_pw_9datamodel_7parsers_4json_5json_fragment(PyObject *__pyx_self,
|
|
3133
|
+
#if CYTHON_METH_FASTCALL
|
|
3134
|
+
PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
|
|
3135
|
+
#else
|
|
3136
|
+
PyObject *__pyx_args, PyObject *__pyx_kwds
|
|
3137
|
+
#endif
|
|
3138
|
+
) {
|
|
3139
|
+
PyObject *__pyx_v_obj = 0;
|
|
3140
|
+
#if !CYTHON_METH_FASTCALL
|
|
3141
|
+
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
|
|
3142
|
+
#endif
|
|
3143
|
+
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
|
|
3144
|
+
PyObject *__pyx_r = 0;
|
|
3145
|
+
<span class='refnanny'>__Pyx_RefNannyDeclarations</span>
|
|
3146
|
+
<span class='refnanny'>__Pyx_RefNannySetupContext</span>("json_fragment (wrapper)", 0);
|
|
3147
|
+
#if !CYTHON_METH_FASTCALL
|
|
3148
|
+
#if CYTHON_ASSUME_SAFE_MACROS
|
|
3149
|
+
__pyx_nargs = <span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args);
|
|
3150
|
+
#else
|
|
3151
|
+
__pyx_nargs = <span class='py_c_api'>PyTuple_Size</span>(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
|
|
3152
|
+
#endif
|
|
3153
|
+
#endif
|
|
3154
|
+
__pyx_kwvalues = <span class='pyx_c_api'>__Pyx_KwValues_FASTCALL</span>(__pyx_args, __pyx_nargs);
|
|
3155
|
+
{
|
|
3156
|
+
PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,0};
|
|
3157
|
+
PyObject* values[1] = {0};
|
|
3158
|
+
if (__pyx_kwds) {
|
|
3159
|
+
Py_ssize_t kw_args;
|
|
3160
|
+
switch (__pyx_nargs) {
|
|
3161
|
+
case 1: values[0] = <span class='pyx_c_api'>__Pyx_Arg_FASTCALL</span>(__pyx_args, 0);
|
|
3162
|
+
CYTHON_FALLTHROUGH;
|
|
3163
|
+
case 0: break;
|
|
3164
|
+
default: goto __pyx_L5_argtuple_error;
|
|
3165
|
+
}
|
|
3166
|
+
kw_args = <span class='pyx_c_api'>__Pyx_NumKwargs_FASTCALL</span>(__pyx_kwds);
|
|
3167
|
+
switch (__pyx_nargs) {
|
|
3168
|
+
case 0:
|
|
3169
|
+
if (likely((values[0] = <span class='pyx_c_api'>__Pyx_GetKwValue_FASTCALL</span>(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_obj)) != 0)) {
|
|
3170
|
+
(void)<span class='pyx_c_api'>__Pyx_Arg_NewRef_FASTCALL</span>(values[0]);
|
|
3171
|
+
kw_args--;
|
|
3172
|
+
}
|
|
3173
|
+
else if (unlikely(<span class='py_c_api'>PyErr_Occurred</span>())) <span class='error_goto'>__PYX_ERR(0, 232, __pyx_L3_error)</span>
|
|
3174
|
+
else goto __pyx_L5_argtuple_error;
|
|
3175
|
+
}
|
|
3176
|
+
if (unlikely(kw_args > 0)) {
|
|
3177
|
+
const Py_ssize_t kwd_pos_args = __pyx_nargs;
|
|
3178
|
+
if (unlikely(<span class='pyx_c_api'>__Pyx_ParseOptionalKeywords</span>(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "json_fragment") < 0)) <span class='error_goto'>__PYX_ERR(0, 232, __pyx_L3_error)</span>
|
|
3179
|
+
}
|
|
3180
|
+
} else if (unlikely(__pyx_nargs != 1)) {
|
|
3181
|
+
goto __pyx_L5_argtuple_error;
|
|
3182
|
+
} else {
|
|
3183
|
+
values[0] = <span class='pyx_c_api'>__Pyx_Arg_FASTCALL</span>(__pyx_args, 0);
|
|
3184
|
+
}
|
|
3185
|
+
__pyx_v_obj = ((PyObject*)values[0]);
|
|
3186
|
+
}
|
|
3187
|
+
goto __pyx_L6_skip;
|
|
3188
|
+
__pyx_L5_argtuple_error:;
|
|
3189
|
+
<span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>("json_fragment", 1, 1, 1, __pyx_nargs); <span class='error_goto'>__PYX_ERR(0, 232, __pyx_L3_error)</span>
|
|
3190
|
+
__pyx_L6_skip:;
|
|
3191
|
+
goto __pyx_L4_argument_unpacking_done;
|
|
3192
|
+
__pyx_L3_error:;
|
|
3193
|
+
{
|
|
3194
|
+
Py_ssize_t __pyx_temp;
|
|
3195
|
+
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
|
|
3196
|
+
<span class='pyx_c_api'>__Pyx_Arg_XDECREF_FASTCALL</span>(values[__pyx_temp]);
|
|
3197
|
+
}
|
|
3198
|
+
}
|
|
3199
|
+
<span class='pyx_c_api'>__Pyx_AddTraceback</span>("datamodel.parsers.json.json_fragment", __pyx_clineno, __pyx_lineno, __pyx_filename);
|
|
3200
|
+
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>();
|
|
3201
|
+
return NULL;
|
|
3202
|
+
__pyx_L4_argument_unpacking_done:;
|
|
3203
|
+
if (unlikely(!<span class='pyx_c_api'>__Pyx_ArgTypeTest</span>(((PyObject *)__pyx_v_obj), (&PyBytes_Type), 1, "obj", 1))) <span class='error_goto'>__PYX_ERR(0, 232, __pyx_L1_error)</span>
|
|
3204
|
+
__pyx_r = __pyx_pf_9datamodel_7parsers_4json_4json_fragment(__pyx_self, __pyx_v_obj);
|
|
3205
|
+
int __pyx_lineno = 0;
|
|
3206
|
+
const char *__pyx_filename = NULL;
|
|
3207
|
+
int __pyx_clineno = 0;
|
|
3208
|
+
|
|
3209
|
+
/* function exit code */
|
|
3210
|
+
goto __pyx_L0;
|
|
3211
|
+
__pyx_L1_error:;
|
|
3212
|
+
__pyx_r = NULL;
|
|
3213
|
+
__pyx_L0:;
|
|
3214
|
+
{
|
|
3215
|
+
Py_ssize_t __pyx_temp;
|
|
3216
|
+
for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
|
|
3217
|
+
<span class='pyx_c_api'>__Pyx_Arg_XDECREF_FASTCALL</span>(values[__pyx_temp]);
|
|
3218
|
+
}
|
|
3219
|
+
}
|
|
3220
|
+
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>();
|
|
3221
|
+
return __pyx_r;
|
|
3222
|
+
}
|
|
3223
|
+
|
|
3224
|
+
static PyObject *__pyx_pf_9datamodel_7parsers_4json_4json_fragment(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_obj) {
|
|
3225
|
+
PyObject *__pyx_r = NULL;
|
|
3226
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_r);
|
|
3227
|
+
__pyx_t_1 = __pyx_f_9datamodel_7parsers_4json_json_fragment(__pyx_v_obj, 0);<span class='error_goto'> if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 232, __pyx_L1_error)</span>
|
|
3228
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1);
|
|
3229
|
+
__pyx_r = __pyx_t_1;
|
|
3230
|
+
__pyx_t_1 = 0;
|
|
3231
|
+
goto __pyx_L0;
|
|
3232
|
+
|
|
3233
|
+
/* function exit code */
|
|
3234
|
+
__pyx_L1_error:;
|
|
3235
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_1);
|
|
3236
|
+
<span class='pyx_c_api'>__Pyx_AddTraceback</span>("datamodel.parsers.json.json_fragment", __pyx_clineno, __pyx_lineno, __pyx_filename);
|
|
3237
|
+
__pyx_r = NULL;
|
|
3238
|
+
__pyx_L0:;
|
|
3239
|
+
<span class='refnanny'>__Pyx_XGIVEREF</span>(__pyx_r);
|
|
3240
|
+
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>();
|
|
3241
|
+
return __pyx_r;
|
|
3242
|
+
}
|
|
3243
|
+
/* … */
|
|
3244
|
+
__pyx_t_4 = <span class='pyx_c_api'>__Pyx_CyFunction_New</span>(&__pyx_mdef_9datamodel_7parsers_4json_5json_fragment, 0, __pyx_n_s_json_fragment, NULL, __pyx_n_s_datamodel_parsers_json, __pyx_d, ((PyObject *)__pyx_codeobj__23));<span class='error_goto'> if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 232, __pyx_L1_error)</span>
|
|
3245
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4);
|
|
3246
|
+
if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_d, __pyx_n_s_json_fragment, __pyx_t_4) < 0) <span class='error_goto'>__PYX_ERR(0, 232, __pyx_L1_error)</span>
|
|
3247
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_4); __pyx_t_4 = 0;
|
|
3248
|
+
/* … */
|
|
3249
|
+
__pyx_codeobj__23 = (PyObject*)<span class='pyx_c_api'>__Pyx_PyCode_New</span>(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__21, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_datamodel_parsers_json_pyx, __pyx_n_s_json_fragment, 232, __pyx_empty_bytes);<span class='error_goto'> if (unlikely(!__pyx_codeobj__23)) __PYX_ERR(0, 232, __pyx_L1_error)</span>
|
|
3250
|
+
</pre><pre class="cython line score-0"> <span class="">233</span>: """</pre>
|
|
3251
|
+
<pre class="cython line score-0"> <span class="">234</span>: Return a Orjson Fragment of an already-serialized JSON Document.</pre>
|
|
3252
|
+
<pre class="cython line score-0"> <span class="">235</span>: """</pre>
|
|
3253
|
+
<pre class="cython line score-20" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">236</span>: return orjson.Fragment(obj)</pre>
|
|
3254
|
+
<pre class='cython code score-20 '> <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_r);
|
|
3255
|
+
<span class='pyx_c_api'>__Pyx_GetModuleGlobalName</span>(__pyx_t_2, __pyx_n_s_orjson);<span class='error_goto'> if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 236, __pyx_L1_error)</span>
|
|
3256
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_2);
|
|
3257
|
+
__pyx_t_3 = <span class='pyx_c_api'>__Pyx_PyObject_GetAttrStr</span>(__pyx_t_2, __pyx_n_s_Fragment);<span class='error_goto'> if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 236, __pyx_L1_error)</span>
|
|
3258
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);
|
|
3259
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;
|
|
3260
|
+
__pyx_t_2 = NULL;
|
|
3261
|
+
__pyx_t_4 = 0;
|
|
3262
|
+
#if CYTHON_UNPACK_METHODS
|
|
3263
|
+
if (unlikely(<span class='py_c_api'>PyMethod_Check</span>(__pyx_t_3))) {
|
|
3264
|
+
__pyx_t_2 = <span class='py_macro_api'>PyMethod_GET_SELF</span>(__pyx_t_3);
|
|
3265
|
+
if (likely(__pyx_t_2)) {
|
|
3266
|
+
PyObject* function = <span class='py_macro_api'>PyMethod_GET_FUNCTION</span>(__pyx_t_3);
|
|
3267
|
+
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_t_2);
|
|
3268
|
+
<span class='pyx_macro_api'>__Pyx_INCREF</span>(function);
|
|
3269
|
+
<span class='pyx_macro_api'>__Pyx_DECREF_SET</span>(__pyx_t_3, function);
|
|
3270
|
+
__pyx_t_4 = 1;
|
|
3271
|
+
}
|
|
3272
|
+
}
|
|
3273
|
+
#endif
|
|
3274
|
+
{
|
|
3275
|
+
PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_v_obj};
|
|
3276
|
+
__pyx_t_1 = <span class='pyx_c_api'>__Pyx_PyObject_FastCall</span>(__pyx_t_3, __pyx_callargs+1-__pyx_t_4, 1+__pyx_t_4);
|
|
3277
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_2); __pyx_t_2 = 0;
|
|
3278
|
+
if (unlikely(!__pyx_t_1)) <span class='error_goto'>__PYX_ERR(0, 236, __pyx_L1_error)</span>
|
|
3279
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1);
|
|
3280
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;
|
|
3281
|
+
}
|
|
3282
|
+
__pyx_r = __pyx_t_1;
|
|
3283
|
+
__pyx_t_1 = 0;
|
|
3284
|
+
goto __pyx_L0;
|
|
3285
|
+
</pre><pre class="cython line score-0"> <span class="">237</span>: </pre>
|
|
3286
|
+
<pre class="cython line score-0"> <span class="">238</span>: </pre>
|
|
3287
|
+
<pre class="cython line score-0"> <span class="">239</span>: cdef class BaseEncoder:</pre>
|
|
3288
|
+
<pre class="cython line score-0"> <span class="">240</span>: """</pre>
|
|
3289
|
+
<pre class="cython line score-0"> <span class="">241</span>: Encoder replacement for json.dumps but using orjson,</pre>
|
|
3290
|
+
<pre class="cython line score-0"> <span class="">242</span>: </pre>
|
|
3291
|
+
<pre class="cython line score-0"> <span class="">243</span>: This is a drop-in replacement for json.dumps using orjson.</pre>
|
|
3292
|
+
<pre class="cython line score-0"> <span class="">244</span>: """</pre>
|
|
3293
|
+
<pre class="cython line score-20" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">245</span>: def __init__(self, *args, **kwargs):</pre>
|
|
3294
|
+
<pre class='cython code score-20 '>/* Python wrapper */
|
|
3295
|
+
static int __pyx_pw_9datamodel_7parsers_4json_11BaseEncoder_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
|
|
3296
|
+
static int __pyx_pw_9datamodel_7parsers_4json_11BaseEncoder_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
|
|
3297
|
+
CYTHON_UNUSED PyObject *__pyx_v_args = 0;
|
|
3298
|
+
CYTHON_UNUSED PyObject *__pyx_v_kwargs = 0;
|
|
3299
|
+
CYTHON_UNUSED Py_ssize_t __pyx_nargs;
|
|
3300
|
+
CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
|
|
3301
|
+
int __pyx_r;
|
|
3302
|
+
<span class='refnanny'>__Pyx_RefNannyDeclarations</span>
|
|
3303
|
+
<span class='refnanny'>__Pyx_RefNannySetupContext</span>("__init__ (wrapper)", 0);
|
|
3304
|
+
#if CYTHON_ASSUME_SAFE_MACROS
|
|
3305
|
+
__pyx_nargs = <span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args);
|
|
3306
|
+
#else
|
|
3307
|
+
__pyx_nargs = <span class='py_c_api'>PyTuple_Size</span>(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
|
|
3308
|
+
#endif
|
|
3309
|
+
__pyx_kwvalues = <span class='pyx_c_api'>__Pyx_KwValues_VARARGS</span>(__pyx_args, __pyx_nargs);
|
|
3310
|
+
if (unlikely(__pyx_kwds) && unlikely(!<span class='pyx_c_api'>__Pyx_CheckKeywordStrings</span>(__pyx_kwds, "__init__", 1))) return -1;
|
|
3311
|
+
<span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_args);
|
|
3312
|
+
__pyx_v_args = __pyx_args;
|
|
3313
|
+
__pyx_r = __pyx_pf_9datamodel_7parsers_4json_11BaseEncoder___init__(((struct __pyx_obj_9datamodel_7parsers_4json_BaseEncoder *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs);
|
|
3314
|
+
|
|
3315
|
+
/* function exit code */
|
|
3316
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_v_args);
|
|
3317
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_v_kwargs);
|
|
3318
|
+
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>();
|
|
3319
|
+
return __pyx_r;
|
|
3320
|
+
}
|
|
3321
|
+
|
|
3322
|
+
static int __pyx_pf_9datamodel_7parsers_4json_11BaseEncoder___init__(struct __pyx_obj_9datamodel_7parsers_4json_BaseEncoder *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, CYTHON_UNUSED PyObject *__pyx_v_kwargs) {
|
|
3323
|
+
PyObject *__pyx_v_rjargs = NULL;
|
|
3324
|
+
PyObject *__pyx_v_rjkwargs = NULL;
|
|
3325
|
+
struct __pyx_obj_9datamodel_7parsers_4json_JSONContent *__pyx_v_encoder = NULL;
|
|
3326
|
+
int __pyx_r;
|
|
3327
|
+
/* … */
|
|
3328
|
+
/* function exit code */
|
|
3329
|
+
__pyx_r = 0;
|
|
3330
|
+
goto __pyx_L0;
|
|
3331
|
+
__pyx_L1_error:;
|
|
3332
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_1);
|
|
3333
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_2);
|
|
3334
|
+
<span class='pyx_c_api'>__Pyx_AddTraceback</span>("datamodel.parsers.json.BaseEncoder.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
|
|
3335
|
+
__pyx_r = -1;
|
|
3336
|
+
__pyx_L0:;
|
|
3337
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_v_rjargs);
|
|
3338
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_v_rjkwargs);
|
|
3339
|
+
<span class='pyx_macro_api'>__Pyx_XDECREF</span>((PyObject *)__pyx_v_encoder);
|
|
3340
|
+
<span class='refnanny'>__Pyx_RefNannyFinishContext</span>();
|
|
3341
|
+
return __pyx_r;
|
|
3342
|
+
}
|
|
3343
|
+
</pre><pre class="cython line score-0"> <span class="">246</span>: # Filter/adapt JSON arguments to ORJSON ones</pre>
|
|
3344
|
+
<pre class="cython line score-1" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">247</span>: rjargs = ()</pre>
|
|
3345
|
+
<pre class='cython code score-1 '> <span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_empty_tuple);
|
|
3346
|
+
__pyx_v_rjargs = __pyx_empty_tuple;
|
|
3347
|
+
</pre><pre class="cython line score-2" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">248</span>: rjkwargs = {}</pre>
|
|
3348
|
+
<pre class='cython code score-2 '> __pyx_t_1 = <span class='pyx_c_api'>__Pyx_PyDict_NewPresized</span>(0);<span class='error_goto'> if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 248, __pyx_L1_error)</span>
|
|
3349
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1);
|
|
3350
|
+
__pyx_v_rjkwargs = ((PyObject*)__pyx_t_1);
|
|
3351
|
+
__pyx_t_1 = 0;
|
|
3352
|
+
</pre><pre class="cython line score-8" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">249</span>: encoder = JSONContent(*rjargs, **rjkwargs)</pre>
|
|
3353
|
+
<pre class='cython code score-8 '> __pyx_t_1 = <span class='py_c_api'>PyDict_Copy</span>(__pyx_v_rjkwargs);<span class='error_goto'> if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 249, __pyx_L1_error)</span>
|
|
3354
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1);
|
|
3355
|
+
__pyx_t_2 = <span class='pyx_c_api'>__Pyx_PyObject_Call</span>(((PyObject *)__pyx_ptype_9datamodel_7parsers_4json_JSONContent), __pyx_v_rjargs, __pyx_t_1);<span class='error_goto'> if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 249, __pyx_L1_error)</span>
|
|
3356
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_2);
|
|
3357
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0;
|
|
3358
|
+
__pyx_v_encoder = ((struct __pyx_obj_9datamodel_7parsers_4json_JSONContent *)__pyx_t_2);
|
|
3359
|
+
__pyx_t_2 = 0;
|
|
3360
|
+
</pre><pre class="cython line score-5" onclick="(function(s){s.display=s.display==='block'?'none':'block'})(this.nextElementSibling.style)">+<span class="">250</span>: self.encode = encoder.__call__</pre>
|
|
3361
|
+
<pre class='cython code score-5 '> __pyx_t_2 = <span class='pyx_c_api'>__Pyx_PyObject_GetAttrStr</span>(((PyObject *)__pyx_v_encoder), __pyx_n_s_call);<span class='error_goto'> if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 250, __pyx_L1_error)</span>
|
|
3362
|
+
<span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_2);
|
|
3363
|
+
if (<span class='pyx_c_api'>__Pyx_PyObject_SetAttrStr</span>(((PyObject *)__pyx_v_self), __pyx_n_s_encode, __pyx_t_2) < 0) <span class='error_goto'>__PYX_ERR(0, 250, __pyx_L1_error)</span>
|
|
3364
|
+
<span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;
|
|
3365
|
+
</pre></div></body></html>
|