@flock/wirespec 0.16.5 → 0.16.6
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.
- package/clikt-clikt.mjs +1148 -1148
- package/colormath-root-colormath.mjs +418 -418
- package/kotlin-kotlin-stdlib.mjs +13 -13
- package/kotlin-kotlin-stdlib.mjs.map +1 -1
- package/kotlin-rgxgen.mjs +1766 -1766
- package/kotlinx-io-kotlinx-io-core.mjs +373 -373
- package/markdown.mjs +1829 -1829
- package/mordant-mordant.mjs +1582 -1582
- package/package.json +5 -1
- package/wirespec-serialization.d.ts +3 -0
- package/wirespec-serialization.mjs +17 -0
- package/wirespec-src-compiler-core.mjs +2935 -2770
- package/wirespec-src-compiler-core.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-java.mjs +177 -177
- package/wirespec-src-compiler-emitters-kotlin.mjs +179 -179
- package/wirespec-src-compiler-emitters-python.mjs +186 -186
- package/wirespec-src-compiler-emitters-python.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-typescript.mjs +774 -628
- package/wirespec-src-compiler-emitters-typescript.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-wirespec.mjs +65 -65
- package/wirespec-src-compiler-lib.mjs +312 -312
- package/wirespec-src-converter-avro.mjs +290 -290
- package/wirespec-src-converter-openapi.mjs +350 -350
- package/wirespec-src-plugin-arguments.mjs +287 -313
- package/wirespec-src-plugin-arguments.mjs.map +1 -1
- package/wirespec-src-plugin-cli.mjs +74 -74
- package/wirespec-src-plugin-npm.mjs +15 -15
- package/wirespec-src-plugin-npm.mjs.map +1 -1
- package/wirespec-src-tools-generator.mjs +25 -25
- package/fetch.ts +0 -0
|
@@ -39,9 +39,9 @@ import {
|
|
|
39
39
|
initMetadataForObject1cxne3s9w65el as initMetadataForObject,
|
|
40
40
|
} from './kotlin-kotlin-stdlib.mjs';
|
|
41
41
|
import {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
ParamType_PATH_getInstance37shm3u2gwzqv as ParamType_PATH_getInstance,
|
|
43
|
+
ParamType_QUERY_getInstance2rxws2q8gjiaa as ParamType_QUERY_getInstance,
|
|
44
|
+
ParamType_HEADER_getInstancez76afw3lekv2 as ParamType_HEADER_getInstance,
|
|
45
45
|
Primitivexjb7c0cm123a as Primitive,
|
|
46
46
|
Custom37hvrfgd6b0uj as Custom,
|
|
47
47
|
Any268baxyo9do19 as Any,
|
|
@@ -89,65 +89,65 @@ initMetadataForClass(PythonEmitter, 'PythonEmitter', PythonEmitter, Emitter);
|
|
|
89
89
|
initMetadataForObject(PythonShared, 'PythonShared');
|
|
90
90
|
//endregion
|
|
91
91
|
function emitReferenceCustomImports(_this__u8e3s4, $this) {
|
|
92
|
-
return 'from ..model.' + _this__u8e3s4.
|
|
92
|
+
return 'from ..model.' + _this__u8e3s4.h29_1 + ' import ' + _this__u8e3s4.h29_1;
|
|
93
93
|
}
|
|
94
94
|
function emit(_this__u8e3s4, $this) {
|
|
95
|
-
return $this.
|
|
95
|
+
return $this.s24(_this__u8e3s4.o26_1) + ': ' + $this.w25(_this__u8e3s4.p26_1);
|
|
96
96
|
}
|
|
97
97
|
function emit_0(_this__u8e3s4, $this) {
|
|
98
|
-
return $this.
|
|
98
|
+
return $this.s24(_this__u8e3s4.f27_1) + ': ' + $this.w25(_this__u8e3s4.g27_1);
|
|
99
99
|
}
|
|
100
100
|
function emitAssignSelf(_this__u8e3s4, $this) {
|
|
101
|
-
return $this.
|
|
101
|
+
return $this.s24(_this__u8e3s4.f27_1) + ' = ' + $this.s24(_this__u8e3s4.f27_1);
|
|
102
102
|
}
|
|
103
103
|
function emitAssignSelf_0(_this__u8e3s4, $this, endpoint) {
|
|
104
|
-
var tmp = $this.
|
|
104
|
+
var tmp = $this.s24(endpoint.h25_1);
|
|
105
105
|
// Inline function 'kotlin.collections.filter' call
|
|
106
106
|
// Inline function 'kotlin.collections.filterTo' call
|
|
107
|
-
var this_0 = $this.
|
|
107
|
+
var this_0 = $this.e26(_this__u8e3s4, endpoint);
|
|
108
108
|
var destination = ArrayList_init_$Create$();
|
|
109
109
|
var tmp0_iterator = this_0.g();
|
|
110
110
|
while (tmp0_iterator.h()) {
|
|
111
111
|
var element = tmp0_iterator.i();
|
|
112
112
|
// Inline function 'community.flock.wirespec.emitters.python.PythonEmitter.emitAssignSelf.<anonymous>' call
|
|
113
|
-
if (element.
|
|
113
|
+
if (element.e27_1.equals(ParamType_PATH_getInstance())) {
|
|
114
114
|
destination.e(element);
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
var tmp_0 = destination;
|
|
118
118
|
var tmp_1 = joinToString(tmp_0, VOID, VOID, VOID, VOID, VOID, PythonEmitter$emitAssignSelf$lambda($this));
|
|
119
|
-
var tmp_2 = $this.
|
|
119
|
+
var tmp_2 = $this.s24(endpoint.h25_1);
|
|
120
120
|
// Inline function 'kotlin.collections.filter' call
|
|
121
121
|
// Inline function 'kotlin.collections.filterTo' call
|
|
122
|
-
var this_1 = $this.
|
|
122
|
+
var this_1 = $this.e26(_this__u8e3s4, endpoint);
|
|
123
123
|
var destination_0 = ArrayList_init_$Create$();
|
|
124
124
|
var tmp0_iterator_0 = this_1.g();
|
|
125
125
|
while (tmp0_iterator_0.h()) {
|
|
126
126
|
var element_0 = tmp0_iterator_0.i();
|
|
127
127
|
// Inline function 'community.flock.wirespec.emitters.python.PythonEmitter.emitAssignSelf.<anonymous>' call
|
|
128
|
-
if (element_0.
|
|
128
|
+
if (element_0.e27_1.equals(ParamType_QUERY_getInstance())) {
|
|
129
129
|
destination_0.e(element_0);
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
var tmp_3 = destination_0;
|
|
133
|
-
var tmp_4 = $this.
|
|
134
|
-
var tmp_5 = $this.
|
|
133
|
+
var tmp_4 = $this.g26(joinToString(tmp_3, ',\n', VOID, VOID, VOID, VOID, PythonEmitter$emitAssignSelf$lambda_0($this)), 1);
|
|
134
|
+
var tmp_5 = $this.s24(endpoint.h25_1);
|
|
135
135
|
// Inline function 'kotlin.collections.filter' call
|
|
136
136
|
// Inline function 'kotlin.collections.filterTo' call
|
|
137
|
-
var this_2 = $this.
|
|
137
|
+
var this_2 = $this.e26(_this__u8e3s4, endpoint);
|
|
138
138
|
var destination_1 = ArrayList_init_$Create$();
|
|
139
139
|
var tmp0_iterator_1 = this_2.g();
|
|
140
140
|
while (tmp0_iterator_1.h()) {
|
|
141
141
|
var element_1 = tmp0_iterator_1.i();
|
|
142
142
|
// Inline function 'community.flock.wirespec.emitters.python.PythonEmitter.emitAssignSelf.<anonymous>' call
|
|
143
|
-
if (element_1.
|
|
143
|
+
if (element_1.e27_1.equals(ParamType_HEADER_getInstance())) {
|
|
144
144
|
destination_1.e(element_1);
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
var tmp_6 = destination_1;
|
|
148
|
-
var tmp_7 = $this.
|
|
148
|
+
var tmp_7 = $this.g26(joinToString(tmp_6, ',\n', VOID, VOID, VOID, VOID, PythonEmitter$emitAssignSelf$lambda_1($this)), 1);
|
|
149
149
|
var tmp_8;
|
|
150
|
-
if (_this__u8e3s4.
|
|
150
|
+
if (_this__u8e3s4.x26_1 == null) {
|
|
151
151
|
tmp_8 = null;
|
|
152
152
|
} else {
|
|
153
153
|
// Inline function 'kotlin.let' call
|
|
@@ -159,23 +159,23 @@ function emitAssignSelf_0(_this__u8e3s4, $this, endpoint) {
|
|
|
159
159
|
return trimMargin('\n |self._path = ' + tmp + '.Request.Path(' + tmp_1 + ')\n |self._queries =' + tmp_2 + '.Request.Queries(' + tmp_4 + ')\n |self._headers = ' + tmp_5 + '.Request.Headers(' + tmp_7 + ')\n |self._body = ' + (tmp1_elvis_lhs == null ? 'None' : tmp1_elvis_lhs) + '\n ');
|
|
160
160
|
}
|
|
161
161
|
function emitAssignSelf_1(_this__u8e3s4, $this, endpoint) {
|
|
162
|
-
var tmp = $this.
|
|
162
|
+
var tmp = $this.s24(endpoint.h25_1);
|
|
163
163
|
// Inline function 'kotlin.collections.filter' call
|
|
164
164
|
// Inline function 'kotlin.collections.filterTo' call
|
|
165
|
-
var this_0 = $this.
|
|
165
|
+
var this_0 = $this.f26(_this__u8e3s4);
|
|
166
166
|
var destination = ArrayList_init_$Create$();
|
|
167
167
|
var tmp0_iterator = this_0.g();
|
|
168
168
|
while (tmp0_iterator.h()) {
|
|
169
169
|
var element = tmp0_iterator.i();
|
|
170
170
|
// Inline function 'community.flock.wirespec.emitters.python.PythonEmitter.emitAssignSelf.<anonymous>' call
|
|
171
|
-
if (element.
|
|
171
|
+
if (element.e27_1.equals(ParamType_HEADER_getInstance())) {
|
|
172
172
|
destination.e(element);
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
175
|
var tmp_0 = destination;
|
|
176
|
-
var tmp_1 = $this.
|
|
176
|
+
var tmp_1 = $this.g26(joinToString(tmp_0, ',\n', VOID, VOID, VOID, VOID, PythonEmitter$emitAssignSelf$lambda_2($this)), 1);
|
|
177
177
|
var tmp_2;
|
|
178
|
-
if (_this__u8e3s4.
|
|
178
|
+
if (_this__u8e3s4.t26_1 == null) {
|
|
179
179
|
tmp_2 = null;
|
|
180
180
|
} else {
|
|
181
181
|
// Inline function 'kotlin.let' call
|
|
@@ -184,15 +184,15 @@ function emitAssignSelf_1(_this__u8e3s4, $this, endpoint) {
|
|
|
184
184
|
tmp_2 = 'body';
|
|
185
185
|
}
|
|
186
186
|
var tmp1_elvis_lhs = tmp_2;
|
|
187
|
-
return trimMargin('\n |self._headers = ' + tmp + '.Response' + _this__u8e3s4.
|
|
187
|
+
return trimMargin('\n |self._headers = ' + tmp + '.Response' + _this__u8e3s4.r26_1 + '.Headers(' + tmp_1 + ')\n |self._body = ' + (tmp1_elvis_lhs == null ? 'None' : tmp1_elvis_lhs) + '\n ');
|
|
188
188
|
}
|
|
189
189
|
function emitType(_this__u8e3s4, $this) {
|
|
190
190
|
var tmp;
|
|
191
191
|
if (_this__u8e3s4 instanceof Dict) {
|
|
192
|
-
tmp = 'Dict[str, ' + $this.
|
|
192
|
+
tmp = 'Dict[str, ' + $this.w25(_this__u8e3s4.r23_1) + ']';
|
|
193
193
|
} else {
|
|
194
194
|
if (_this__u8e3s4 instanceof Iterable) {
|
|
195
|
-
tmp = 'List[' + $this.
|
|
195
|
+
tmp = 'List[' + $this.w25(_this__u8e3s4.o23_1) + ']';
|
|
196
196
|
} else {
|
|
197
197
|
if (_this__u8e3s4 instanceof Unit) {
|
|
198
198
|
tmp = 'None';
|
|
@@ -201,10 +201,10 @@ function emitType(_this__u8e3s4, $this) {
|
|
|
201
201
|
tmp = 'Any';
|
|
202
202
|
} else {
|
|
203
203
|
if (_this__u8e3s4 instanceof Custom) {
|
|
204
|
-
tmp = _this__u8e3s4.
|
|
204
|
+
tmp = _this__u8e3s4.h29_1;
|
|
205
205
|
} else {
|
|
206
206
|
if (_this__u8e3s4 instanceof Primitive) {
|
|
207
|
-
tmp = $this.
|
|
207
|
+
tmp = $this.d2c(_this__u8e3s4.l29_1);
|
|
208
208
|
} else {
|
|
209
209
|
noWhenBranchMatchedException();
|
|
210
210
|
}
|
|
@@ -216,28 +216,28 @@ function emitType(_this__u8e3s4, $this) {
|
|
|
216
216
|
return tmp;
|
|
217
217
|
}
|
|
218
218
|
function emitResponseUnion(_this__u8e3s4, $this) {
|
|
219
|
-
return trimMargin('\n |Response = ' + joinToString(_this__u8e3s4.
|
|
219
|
+
return trimMargin('\n |Response = ' + joinToString(_this__u8e3s4.n25_1, ' | ', VOID, VOID, VOID, VOID, PythonEmitter$emitResponseUnion$lambda) + '\n |\n ');
|
|
220
220
|
}
|
|
221
221
|
function emitHandleClass(_this__u8e3s4, $this) {
|
|
222
|
-
return trimMargin('\n |class Handler(Wirespec.Endpoint.Handler):\n |' + Spacer_instance.toString() + '@abstractmethod\n |' + Spacer_instance.toString() + 'def ' + _this__u8e3s4.
|
|
222
|
+
return trimMargin('\n |class Handler(Wirespec.Endpoint.Handler):\n |' + Spacer_instance.toString() + '@abstractmethod\n |' + Spacer_instance.toString() + 'def ' + _this__u8e3s4.h25_1.b1() + "(self, req: '" + $this.s24(_this__u8e3s4.h25_1) + ".Request') -> '" + $this.s24(_this__u8e3s4.h25_1) + ".Response': pass\n |\n ");
|
|
223
223
|
}
|
|
224
224
|
function emitConvertClass(_this__u8e3s4, $this) {
|
|
225
|
-
return trimMargin('\n |class Convert(Wirespec.Endpoint.Convert[Request, Response]):\n |' + $this.
|
|
225
|
+
return trimMargin('\n |class Convert(Wirespec.Endpoint.Convert[Request, Response]):\n |' + $this.g26(emitToRawRequest(first(_this__u8e3s4.m25_1), $this, _this__u8e3s4), 1) + '\n |' + $this.g26(emitFromRawRequest(first(_this__u8e3s4.m25_1), $this, _this__u8e3s4), 1) + '\n |' + $this.g26(emitToRawResponse(_this__u8e3s4, $this), 1) + '\n |' + $this.g26(emitFromRawResponse(_this__u8e3s4, $this), 1) + '\n |\n ');
|
|
226
226
|
}
|
|
227
227
|
function emitToRawRequest(_this__u8e3s4, $this, endpoint) {
|
|
228
|
-
var tmp = $this.
|
|
228
|
+
var tmp = $this.s24(endpoint.h25_1);
|
|
229
229
|
var tmp_0 = Spacer_instance.toString();
|
|
230
230
|
var tmp_1 = Spacer_instance.toString();
|
|
231
231
|
var tmp_2 = Spacer_instance.toString();
|
|
232
|
-
var tmp_3 = joinToString(endpoint.
|
|
232
|
+
var tmp_3 = joinToString(endpoint.j25_1, VOID, VOID, VOID, VOID, VOID, PythonEmitter$emitToRawRequest$lambda($this));
|
|
233
233
|
var tmp_4 = Spacer_instance.toString();
|
|
234
234
|
var tmp_5 = Spacer_instance.toString();
|
|
235
235
|
var tmp_6 = Spacer_instance.toString();
|
|
236
236
|
var tmp_7 = Spacer_instance.toString();
|
|
237
237
|
var tmp_8;
|
|
238
238
|
// Inline function 'kotlin.collections.isNotEmpty' call
|
|
239
|
-
if (!endpoint.
|
|
240
|
-
tmp_8 = joinToString(endpoint.
|
|
239
|
+
if (!endpoint.k25_1.l()) {
|
|
240
|
+
tmp_8 = joinToString(endpoint.k25_1, ',\n', '{', '}', VOID, VOID, PythonEmitter$emitToRawRequest$lambda_0($this));
|
|
241
241
|
} else {
|
|
242
242
|
tmp_8 = '{}';
|
|
243
243
|
}
|
|
@@ -246,29 +246,29 @@ function emitToRawRequest(_this__u8e3s4, $this, endpoint) {
|
|
|
246
246
|
var tmp_11 = Spacer_instance.toString();
|
|
247
247
|
var tmp_12;
|
|
248
248
|
// Inline function 'kotlin.collections.isNotEmpty' call
|
|
249
|
-
if (!endpoint.
|
|
250
|
-
tmp_12 = joinToString(endpoint.
|
|
249
|
+
if (!endpoint.l25_1.l()) {
|
|
250
|
+
tmp_12 = joinToString(endpoint.l25_1, ',\n', '{', '}', VOID, VOID, PythonEmitter$emitToRawRequest$lambda_1($this));
|
|
251
251
|
} else {
|
|
252
252
|
tmp_12 = '{}';
|
|
253
253
|
}
|
|
254
254
|
var tmp_13 = tmp_12;
|
|
255
255
|
var tmp_14 = Spacer_instance.toString();
|
|
256
256
|
var tmp_15 = Spacer_instance.toString();
|
|
257
|
-
var tmp0_safe_receiver = _this__u8e3s4.
|
|
258
|
-
var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.
|
|
257
|
+
var tmp0_safe_receiver = _this__u8e3s4.x26_1;
|
|
258
|
+
var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.z26_1;
|
|
259
259
|
var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : emitType(tmp1_safe_receiver, $this);
|
|
260
260
|
return trimMargin("\n |@staticmethod\n |def to_raw_request(serialization: Wirespec.Serializer, request: '" + tmp + ".Request') -> Wirespec.RawRequest:\n |" + tmp_0 + 'return Wirespec.RawRequest(\n |' + tmp_1 + tmp_2 + 'path = [' + tmp_3 + '],\n |' + tmp_4 + tmp_5 + 'method = request.method.value,\n |' + tmp_6 + tmp_7 + 'queries = ' + tmp_9 + ',\n |' + tmp_10 + tmp_11 + 'headers = ' + tmp_13 + ',\n |' + tmp_14 + tmp_15 + 'body = serialization.serialize(request.body, ' + (tmp2_elvis_lhs == null ? 'type(None)' : tmp2_elvis_lhs) + '),\n |' + Spacer_instance.toString() + ')\n |\n ');
|
|
261
261
|
}
|
|
262
262
|
function emitFromRawRequest(_this__u8e3s4, $this, endpoint) {
|
|
263
|
-
return trimMargin("\n |@staticmethod\n |def from_raw_request(serialization: Wirespec.Deserializer, request: Wirespec.RawRequest) -> '" + $this.
|
|
263
|
+
return trimMargin("\n |@staticmethod\n |def from_raw_request(serialization: Wirespec.Deserializer, request: Wirespec.RawRequest) -> '" + $this.s24(endpoint.h25_1) + ".Request':\n |" + Spacer_instance.toString() + 'return ' + $this.s24(endpoint.h25_1) + '.Request' + emitDeserializedParams(_this__u8e3s4, $this, endpoint) + '\n |\n ');
|
|
264
264
|
}
|
|
265
265
|
function emitDeserializedParams(_this__u8e3s4, $this, endpoint) {
|
|
266
266
|
// Inline function 'kotlin.let' call
|
|
267
|
-
var tmp = $this.
|
|
267
|
+
var tmp = $this.j26(endpoint);
|
|
268
268
|
var tmp_0 = orNull(joinToString(tmp, VOID, VOID, VOID, VOID, VOID, PythonEmitter$emitDeserializedParams$lambda($this)));
|
|
269
|
-
var tmp_1 = orNull(joinToString(endpoint.
|
|
270
|
-
var tmp_2 = orNull(joinToString(endpoint.
|
|
271
|
-
var tmp0_safe_receiver = _this__u8e3s4.
|
|
269
|
+
var tmp_1 = orNull(joinToString(endpoint.k25_1, ',\n', VOID, VOID, VOID, VOID, PythonEmitter$emitDeserializedParams$lambda_0($this)));
|
|
270
|
+
var tmp_2 = orNull(joinToString(endpoint.l25_1, ',\n', VOID, VOID, VOID, VOID, PythonEmitter$emitDeserializedParams$lambda_1($this)));
|
|
271
|
+
var tmp0_safe_receiver = _this__u8e3s4.x26_1;
|
|
272
272
|
var tmp_3;
|
|
273
273
|
if (tmp0_safe_receiver == null) {
|
|
274
274
|
tmp_3 = null;
|
|
@@ -276,7 +276,7 @@ function emitDeserializedParams(_this__u8e3s4, $this, endpoint) {
|
|
|
276
276
|
// Inline function 'kotlin.let' call
|
|
277
277
|
// Inline function 'kotlin.contracts.contract' call
|
|
278
278
|
// Inline function 'community.flock.wirespec.emitters.python.PythonEmitter.emitDeserializedParams.<anonymous>' call
|
|
279
|
-
tmp_3 = Spacer_instance.
|
|
279
|
+
tmp_3 = Spacer_instance.i27(3) + 'body = serialization.deserialize(request.body, ' + emitType(tmp0_safe_receiver.z26_1, $this) + '),';
|
|
280
280
|
}
|
|
281
281
|
// Inline function 'kotlin.contracts.contract' call
|
|
282
282
|
// Inline function 'community.flock.wirespec.emitters.python.PythonEmitter.emitDeserializedParams.<anonymous>' call
|
|
@@ -284,61 +284,61 @@ function emitDeserializedParams(_this__u8e3s4, $this, endpoint) {
|
|
|
284
284
|
return isBlank(it) ? '()' : '(\n' + it + '\n)';
|
|
285
285
|
}
|
|
286
286
|
function emitDeserialized(_this__u8e3s4, $this) {
|
|
287
|
-
return Spacer_instance.
|
|
287
|
+
return Spacer_instance.i27(3) + $this.s24(_this__u8e3s4.rd_1.o26_1) + ' = serialization.deserialize(request.path[' + _this__u8e3s4.qd_1 + '], ' + emitType(_this__u8e3s4.rd_1.p26_1, $this) + ')';
|
|
288
288
|
}
|
|
289
289
|
function emitDeserializedParams_0(_this__u8e3s4, $this, type, fields) {
|
|
290
|
-
return $this.
|
|
290
|
+
return $this.s24(_this__u8e3s4.v26_1) + ' = serialization.deserialize_param(' + type + '.' + fields + '.get("' + _this__u8e3s4.v26_1.b1() + '".lower()), ' + emitType(_this__u8e3s4.w26_1, $this) + ')';
|
|
291
291
|
}
|
|
292
292
|
function emitToRawResponse(_this__u8e3s4, $this) {
|
|
293
|
-
var tmp = $this.
|
|
293
|
+
var tmp = $this.s24(_this__u8e3s4.h25_1);
|
|
294
294
|
var tmp_0 = Spacer_instance.toString();
|
|
295
|
-
var tmp_1 = $this.
|
|
296
|
-
return trimMargin("\n |@staticmethod\n |def to_raw_response(serialization: Wirespec.Serializer, response: '" + tmp + ".Response') -> Wirespec.RawResponse:\n |" + tmp_0 + 'match response:\n |' + $this.
|
|
295
|
+
var tmp_1 = $this.l26(_this__u8e3s4.n25_1);
|
|
296
|
+
return trimMargin("\n |@staticmethod\n |def to_raw_response(serialization: Wirespec.Serializer, response: '" + tmp + ".Response') -> Wirespec.RawResponse:\n |" + tmp_0 + 'match response:\n |' + $this.g26(joinToString(tmp_1, '\n', VOID, VOID, VOID, VOID, PythonEmitter$emitToRawResponse$lambda($this, _this__u8e3s4)), 2) + '\n |' + Spacer_instance.toString() + Spacer_instance.toString() + 'case _:\n |' + Spacer_instance.toString() + Spacer_instance.toString() + Spacer_instance.toString() + 'raise Exception("Cannot match response with status: " + str(response.status))\n ');
|
|
297
297
|
}
|
|
298
298
|
function emitFromRawResponse(_this__u8e3s4, $this) {
|
|
299
|
-
var tmp = $this.
|
|
299
|
+
var tmp = $this.s24(_this__u8e3s4.h25_1);
|
|
300
300
|
var tmp_0 = Spacer_instance.toString();
|
|
301
301
|
// Inline function 'kotlin.collections.filter' call
|
|
302
302
|
// Inline function 'kotlin.collections.filterTo' call
|
|
303
|
-
var this_0 = $this.
|
|
303
|
+
var this_0 = $this.l26(_this__u8e3s4.n25_1);
|
|
304
304
|
var destination = ArrayList_init_$Create$();
|
|
305
305
|
var tmp0_iterator = this_0.g();
|
|
306
306
|
while (tmp0_iterator.h()) {
|
|
307
307
|
var element = tmp0_iterator.i();
|
|
308
308
|
// Inline function 'community.flock.wirespec.emitters.python.PythonEmitter.emitFromRawResponse.<anonymous>' call
|
|
309
|
-
if (Companion_instance.
|
|
309
|
+
if (Companion_instance.e24(element.r26_1)) {
|
|
310
310
|
destination.e(element);
|
|
311
311
|
}
|
|
312
312
|
}
|
|
313
313
|
var tmp_1 = destination;
|
|
314
|
-
return trimMargin("\n |@staticmethod\n |def from_raw_response(serialization: Wirespec.Deserializer, response: Wirespec.RawResponse) -> '" + tmp + ".Response':\n |" + tmp_0 + 'match response.status_code:\n |' + $this.
|
|
314
|
+
return trimMargin("\n |@staticmethod\n |def from_raw_response(serialization: Wirespec.Deserializer, response: Wirespec.RawResponse) -> '" + tmp + ".Response':\n |" + tmp_0 + 'match response.status_code:\n |' + $this.g26(joinToString(tmp_1, '\n', VOID, VOID, VOID, VOID, PythonEmitter$emitFromRawResponse$lambda($this, _this__u8e3s4)), 2) + '\n |' + Spacer_instance.i27(2) + 'case _:\n |' + Spacer_instance.i27(3) + 'raise Exception("Cannot match response with status: " + str(response.status_code))\n |\n ');
|
|
315
315
|
}
|
|
316
316
|
function emitDeserialized_0(_this__u8e3s4, $this, endpoint) {
|
|
317
|
-
var tmp = 'case ' + _this__u8e3s4.
|
|
318
|
-
var tmp_0 = Spacer_instance.toString() + 'return ' + $this.
|
|
319
|
-
var tmp_1 = Spacer_instance.
|
|
320
|
-
var tmp0_safe_receiver = _this__u8e3s4.
|
|
321
|
-
var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.
|
|
317
|
+
var tmp = 'case ' + _this__u8e3s4.r26_1 + ':';
|
|
318
|
+
var tmp_0 = Spacer_instance.toString() + 'return ' + $this.s24(endpoint.h25_1) + '.Response' + _this__u8e3s4.r26_1 + '(';
|
|
319
|
+
var tmp_1 = Spacer_instance.i27(2);
|
|
320
|
+
var tmp0_safe_receiver = _this__u8e3s4.t26_1;
|
|
321
|
+
var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.z26_1;
|
|
322
322
|
var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : emitType(tmp1_safe_receiver, $this);
|
|
323
323
|
var tmp_2 = tmp_1 + 'body = serialization.deserialize(response.body, ' + (tmp2_elvis_lhs == null ? 'type(None)' : tmp2_elvis_lhs) + '),';
|
|
324
|
-
var tmp3_safe_receiver = orNull(joinToString(_this__u8e3s4.
|
|
325
|
-
return joinToString(listOfNotNull([tmp, tmp_0, tmp_2, tmp3_safe_receiver == null ? null : $this.
|
|
324
|
+
var tmp3_safe_receiver = orNull(joinToString(_this__u8e3s4.s26_1, ',\n', VOID, VOID, VOID, VOID, PythonEmitter$emitDeserialized$lambda($this)));
|
|
325
|
+
return joinToString(listOfNotNull([tmp, tmp_0, tmp_2, tmp3_safe_receiver == null ? null : $this.g26(tmp3_safe_receiver, 2), Spacer_instance.toString() + ')']), '\n');
|
|
326
326
|
}
|
|
327
327
|
function emitSerialized(_this__u8e3s4, $this, endpoint) {
|
|
328
|
-
var tmp = $this.
|
|
329
|
-
var tmp_0 = Spacer_instance.
|
|
330
|
-
var tmp_1 = Spacer_instance.
|
|
331
|
-
var tmp_2 = Spacer_instance.
|
|
328
|
+
var tmp = $this.s24(endpoint.h25_1);
|
|
329
|
+
var tmp_0 = Spacer_instance.i27(1);
|
|
330
|
+
var tmp_1 = Spacer_instance.i27(2);
|
|
331
|
+
var tmp_2 = Spacer_instance.i27(2);
|
|
332
332
|
var tmp_3;
|
|
333
333
|
// Inline function 'kotlin.collections.isNotEmpty' call
|
|
334
|
-
if (!_this__u8e3s4.
|
|
335
|
-
tmp_3 = joinToString(_this__u8e3s4.
|
|
334
|
+
if (!_this__u8e3s4.s26_1.l()) {
|
|
335
|
+
tmp_3 = joinToString(_this__u8e3s4.s26_1, ', ', '{', '}', VOID, VOID, PythonEmitter$emitSerialized$lambda($this));
|
|
336
336
|
} else {
|
|
337
337
|
tmp_3 = '{}';
|
|
338
338
|
}
|
|
339
339
|
var tmp_4 = tmp_3;
|
|
340
|
-
var tmp_5 = Spacer_instance.
|
|
341
|
-
var tmp0_safe_receiver = _this__u8e3s4.
|
|
340
|
+
var tmp_5 = Spacer_instance.i27(2);
|
|
341
|
+
var tmp0_safe_receiver = _this__u8e3s4.t26_1;
|
|
342
342
|
var tmp_6;
|
|
343
343
|
if (tmp0_safe_receiver == null) {
|
|
344
344
|
tmp_6 = null;
|
|
@@ -346,21 +346,21 @@ function emitSerialized(_this__u8e3s4, $this, endpoint) {
|
|
|
346
346
|
// Inline function 'kotlin.let' call
|
|
347
347
|
// Inline function 'kotlin.contracts.contract' call
|
|
348
348
|
// Inline function 'community.flock.wirespec.emitters.python.PythonEmitter.emitSerialized.<anonymous>' call
|
|
349
|
-
tmp_6 = 'serialization.serialize(response.body, ' + emitType(tmp0_safe_receiver.
|
|
349
|
+
tmp_6 = 'serialization.serialize(response.body, ' + emitType(tmp0_safe_receiver.z26_1, $this) + ')';
|
|
350
350
|
}
|
|
351
351
|
var tmp1_elvis_lhs = tmp_6;
|
|
352
|
-
return trimMargin('\n |case ' + tmp + '.Response' + _this__u8e3s4.
|
|
352
|
+
return trimMargin('\n |case ' + tmp + '.Response' + _this__u8e3s4.r26_1 + '():\n |' + tmp_0 + 'return Wirespec.RawResponse(\n |' + tmp_1 + 'status_code = response.status,\n |' + tmp_2 + 'headers = ' + tmp_4 + ',\n |' + tmp_5 + 'body = ' + (tmp1_elvis_lhs == null ? 'type(None)' : tmp1_elvis_lhs) + ',\n |' + Spacer_instance.i27(1) + ')\n ');
|
|
353
353
|
}
|
|
354
354
|
function emitSerializedParams(_this__u8e3s4, $this, type, fields) {
|
|
355
|
-
return '"' + _this__u8e3s4.
|
|
355
|
+
return '"' + _this__u8e3s4.v26_1.b1() + '": serialization.serialize_param(' + type + '.' + fields + '.' + $this.s24(_this__u8e3s4.v26_1) + ', ' + emitType(_this__u8e3s4.w26_1, $this) + ')';
|
|
356
356
|
}
|
|
357
357
|
function emitObject(_this__u8e3s4, $this, name, extends_0, spaces, block) {
|
|
358
358
|
var tmp;
|
|
359
359
|
if (_this__u8e3s4.l()) {
|
|
360
|
-
tmp = trimMargin('\n |' + Spacer_instance.
|
|
360
|
+
tmp = trimMargin('\n |' + Spacer_instance.i27(spaces) + '@dataclass\n |' + Spacer_instance.i27(spaces) + 'class ' + name + ' (' + extends_0 + '): pass\n ');
|
|
361
361
|
} else {
|
|
362
|
-
var tmp_0 = Spacer_instance.
|
|
363
|
-
var tmp_1 = Spacer_instance.
|
|
362
|
+
var tmp_0 = Spacer_instance.i27(spaces);
|
|
363
|
+
var tmp_1 = Spacer_instance.i27(spaces);
|
|
364
364
|
tmp = trimMargin('\n |' + tmp_0 + '@dataclass\n |' + tmp_1 + 'class ' + name + ' (' + extends_0 + '):\n |' + joinToString(_this__u8e3s4, '\n', VOID, VOID, VOID, VOID, PythonEmitter$emitObject$lambda(spaces, block)) + '\n ');
|
|
365
365
|
}
|
|
366
366
|
return tmp;
|
|
@@ -370,8 +370,8 @@ function emitObject$default(_this__u8e3s4, $this, name, extends_0, spaces, block
|
|
|
370
370
|
return emitObject(_this__u8e3s4, $this, name, extends_0, spaces, block);
|
|
371
371
|
}
|
|
372
372
|
function emit_1(_this__u8e3s4, $this) {
|
|
373
|
-
var tmp1_safe_receiver = _this__u8e3s4 == null ? null : _this__u8e3s4.
|
|
374
|
-
var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : $this.
|
|
373
|
+
var tmp1_safe_receiver = _this__u8e3s4 == null ? null : _this__u8e3s4.z26_1;
|
|
374
|
+
var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : $this.w25(tmp1_safe_receiver);
|
|
375
375
|
return tmp2_elvis_lhs == null ? 'None' : tmp2_elvis_lhs;
|
|
376
376
|
}
|
|
377
377
|
function sanitizeSymbol(_this__u8e3s4, $this) {
|
|
@@ -388,7 +388,7 @@ function sanitizeSymbol(_this__u8e3s4, $this) {
|
|
|
388
388
|
// Inline function 'community.flock.wirespec.emitters.python.PythonEmitter.sanitizeSymbol.<anonymous>' call
|
|
389
389
|
var tmp1 = index;
|
|
390
390
|
index = tmp1 + 1 | 0;
|
|
391
|
-
var tmp$ret$0 = checkIndexOverflow(tmp1) > 0 ? Companion_instance.
|
|
391
|
+
var tmp$ret$0 = checkIndexOverflow(tmp1) > 0 ? Companion_instance.z23(item) : item;
|
|
392
392
|
destination.e(tmp$ret$0);
|
|
393
393
|
}
|
|
394
394
|
// Inline function 'kotlin.text.filterTo' call
|
|
@@ -428,8 +428,8 @@ function sanitizeSymbol(_this__u8e3s4, $this) {
|
|
|
428
428
|
}
|
|
429
429
|
function Companion() {
|
|
430
430
|
Companion_instance_2 = this;
|
|
431
|
-
this.
|
|
432
|
-
this.
|
|
431
|
+
this.e2c_1 = setOf(['False', 'None', 'True', 'and', 'as', 'assert', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'nonlocal', 'not', 'or', 'pass', 'raise', 'return', 'try', 'while', 'with', 'yield']);
|
|
432
|
+
this.f2c_1 = 'type(None)';
|
|
433
433
|
}
|
|
434
434
|
var Companion_instance_2;
|
|
435
435
|
function Companion_getInstance() {
|
|
@@ -438,16 +438,16 @@ function Companion_getInstance() {
|
|
|
438
438
|
return Companion_instance_2;
|
|
439
439
|
}
|
|
440
440
|
function sam$kotlin_Comparator$0(function_0) {
|
|
441
|
-
this.
|
|
441
|
+
this.g2c_1 = function_0;
|
|
442
442
|
}
|
|
443
443
|
protoOf(sam$kotlin_Comparator$0).uc = function (a, b) {
|
|
444
|
-
return this.
|
|
444
|
+
return this.g2c_1(a, b);
|
|
445
445
|
};
|
|
446
446
|
protoOf(sam$kotlin_Comparator$0).compare = function (a, b) {
|
|
447
447
|
return this.uc(a, b);
|
|
448
448
|
};
|
|
449
449
|
protoOf(sam$kotlin_Comparator$0).p3 = function () {
|
|
450
|
-
return this.
|
|
450
|
+
return this.g2c_1;
|
|
451
451
|
};
|
|
452
452
|
protoOf(sam$kotlin_Comparator$0).equals = function (other) {
|
|
453
453
|
var tmp;
|
|
@@ -468,13 +468,13 @@ protoOf(sam$kotlin_Comparator$0).hashCode = function () {
|
|
|
468
468
|
return hashCode(this.p3());
|
|
469
469
|
};
|
|
470
470
|
function emit$_anonymous_$emitInit_7cggmt(this$0, def) {
|
|
471
|
-
return 'from .' + this$0.
|
|
471
|
+
return 'from .' + this$0.s24(def.m24()) + ' import ' + this$0.s24(def.m24());
|
|
472
472
|
}
|
|
473
473
|
function PythonEmitter$emit$lambda(this$0) {
|
|
474
474
|
return function (a, b) {
|
|
475
475
|
// Inline function 'kotlin.comparisons.compareValuesBy' call
|
|
476
|
-
var tmp = this$0.
|
|
477
|
-
var tmp$ret$1 = this$0.
|
|
476
|
+
var tmp = this$0.h2c(a);
|
|
477
|
+
var tmp$ret$1 = this$0.h2c(b);
|
|
478
478
|
return compareValues(tmp, tmp$ret$1);
|
|
479
479
|
};
|
|
480
480
|
}
|
|
@@ -490,7 +490,7 @@ function PythonEmitter$emit$lambda_1(this$0) {
|
|
|
490
490
|
}
|
|
491
491
|
function PythonEmitter$emit$lambda_2(this$0) {
|
|
492
492
|
return function (it) {
|
|
493
|
-
return Spacer_instance.toString() + this$0.
|
|
493
|
+
return Spacer_instance.toString() + this$0.v25(it);
|
|
494
494
|
};
|
|
495
495
|
}
|
|
496
496
|
function PythonEmitter$emitAssignSelf$lambda(this$0) {
|
|
@@ -520,11 +520,11 @@ function PythonEmitter$emit$lambda_3(this$0) {
|
|
|
520
520
|
}
|
|
521
521
|
function PythonEmitter$emit$lambda_4(this$0, $endpoint) {
|
|
522
522
|
return function (it) {
|
|
523
|
-
return this$0.
|
|
523
|
+
return this$0.i2c(it, $endpoint);
|
|
524
524
|
};
|
|
525
525
|
}
|
|
526
526
|
function PythonEmitter$emitResponseUnion$lambda(it) {
|
|
527
|
-
return 'Response' + it.
|
|
527
|
+
return 'Response' + it.r26_1;
|
|
528
528
|
}
|
|
529
529
|
function PythonEmitter$emit$lambda_5(this$0) {
|
|
530
530
|
return function (it) {
|
|
@@ -533,12 +533,12 @@ function PythonEmitter$emit$lambda_5(this$0) {
|
|
|
533
533
|
}
|
|
534
534
|
function PythonEmitter$emit$lambda_6(this$0) {
|
|
535
535
|
return function (it) {
|
|
536
|
-
return this$0.
|
|
536
|
+
return this$0.v25(it);
|
|
537
537
|
};
|
|
538
538
|
}
|
|
539
539
|
function PythonEmitter$emit$lambda_7(this$0) {
|
|
540
540
|
return function (it) {
|
|
541
|
-
return this$0.
|
|
541
|
+
return this$0.v25(it);
|
|
542
542
|
};
|
|
543
543
|
}
|
|
544
544
|
function PythonEmitter$emit$lambda_8(this$0) {
|
|
@@ -550,10 +550,10 @@ function PythonEmitter$emitToRawRequest$lambda(this$0) {
|
|
|
550
550
|
return function (it) {
|
|
551
551
|
var tmp;
|
|
552
552
|
if (it instanceof Literal) {
|
|
553
|
-
tmp = '"' + it.
|
|
553
|
+
tmp = '"' + it.q26_1 + '"';
|
|
554
554
|
} else {
|
|
555
555
|
if (it instanceof Param) {
|
|
556
|
-
tmp = 'str(request.path.' + this$0.
|
|
556
|
+
tmp = 'str(request.path.' + this$0.s24(it.o26_1) + ')';
|
|
557
557
|
} else {
|
|
558
558
|
noWhenBranchMatchedException();
|
|
559
559
|
}
|
|
@@ -588,7 +588,7 @@ function PythonEmitter$emitDeserializedParams$lambda_1(this$0) {
|
|
|
588
588
|
}
|
|
589
589
|
function PythonEmitter$emit$lambda_9(this$0) {
|
|
590
590
|
return function (it) {
|
|
591
|
-
return this$0.
|
|
591
|
+
return this$0.v25(it);
|
|
592
592
|
};
|
|
593
593
|
}
|
|
594
594
|
function PythonEmitter$emit$lambda_10(this$0) {
|
|
@@ -618,36 +618,36 @@ function PythonEmitter$emitSerialized$lambda(this$0) {
|
|
|
618
618
|
}
|
|
619
619
|
function PythonEmitter$emitObject$lambda($spaces, $block) {
|
|
620
620
|
return function (it) {
|
|
621
|
-
return Spacer_instance.
|
|
621
|
+
return Spacer_instance.i27($spaces + 2 | 0) + $block(it);
|
|
622
622
|
};
|
|
623
623
|
}
|
|
624
624
|
function PythonEmitter$emit$lambda_11(this$0) {
|
|
625
625
|
return function (it) {
|
|
626
|
-
return Spacer_instance.toString() + this$0.
|
|
626
|
+
return Spacer_instance.toString() + this$0.v2a(this$0.u2a(it)) + ' = "' + it + '"';
|
|
627
627
|
};
|
|
628
628
|
}
|
|
629
629
|
function PythonEmitter(packageName, emitShared) {
|
|
630
630
|
Companion_getInstance();
|
|
631
|
-
packageName = packageName === VOID ? Companion_instance_0.
|
|
632
|
-
emitShared = emitShared === VOID ? Companion_instance_1.
|
|
631
|
+
packageName = packageName === VOID ? Companion_instance_0.a27('community.flock.wirespec.generated') : packageName;
|
|
632
|
+
emitShared = emitShared === VOID ? Companion_instance_1.v23() : emitShared;
|
|
633
633
|
Emitter.call(this);
|
|
634
|
-
this.
|
|
635
|
-
this.
|
|
636
|
-
this.
|
|
637
|
-
this.
|
|
638
|
-
this.
|
|
639
|
-
this.
|
|
640
|
-
}
|
|
641
|
-
protoOf(PythonEmitter).
|
|
642
|
-
return this.z2b_1;
|
|
643
|
-
};
|
|
644
|
-
protoOf(PythonEmitter).u2a = function () {
|
|
634
|
+
this.x2b_1 = packageName;
|
|
635
|
+
this.y2b_1 = emitShared;
|
|
636
|
+
this.z2b_1 = 'import re\n\nfrom abc import abstractmethod\nfrom dataclasses import dataclass\nfrom typing import List, Optional\nfrom enum import Enum\n\nfrom ..wirespec import T, Wirespec\n';
|
|
637
|
+
this.a2c_1 = FileExtension_Python_getInstance();
|
|
638
|
+
this.b2c_1 = PythonShared_instance;
|
|
639
|
+
this.c2c_1 = '#';
|
|
640
|
+
}
|
|
641
|
+
protoOf(PythonEmitter).k24 = function () {
|
|
645
642
|
return this.a2c_1;
|
|
646
643
|
};
|
|
647
|
-
protoOf(PythonEmitter).
|
|
644
|
+
protoOf(PythonEmitter).x2a = function () {
|
|
648
645
|
return this.b2c_1;
|
|
649
646
|
};
|
|
650
|
-
protoOf(PythonEmitter).
|
|
647
|
+
protoOf(PythonEmitter).b26 = function () {
|
|
648
|
+
return this.c2c_1;
|
|
649
|
+
};
|
|
650
|
+
protoOf(PythonEmitter).h2c = function (definition) {
|
|
651
651
|
var tmp;
|
|
652
652
|
if (definition instanceof Enum) {
|
|
653
653
|
tmp = 1;
|
|
@@ -676,9 +676,9 @@ protoOf(PythonEmitter).g2c = function (definition) {
|
|
|
676
676
|
}
|
|
677
677
|
return tmp;
|
|
678
678
|
};
|
|
679
|
-
protoOf(PythonEmitter).
|
|
679
|
+
protoOf(PythonEmitter).g24 = function (module_0, logger) {
|
|
680
680
|
// Inline function 'kotlin.collections.sortedBy' call
|
|
681
|
-
var this_0 = module_0.
|
|
681
|
+
var this_0 = module_0.d24_1;
|
|
682
682
|
// Inline function 'kotlin.comparisons.compareBy' call
|
|
683
683
|
var tmp = PythonEmitter$emit$lambda(this);
|
|
684
684
|
var tmp$ret$0 = new sam$kotlin_Comparator$0(tmp);
|
|
@@ -687,13 +687,13 @@ protoOf(PythonEmitter).s24 = function (module_0, logger) {
|
|
|
687
687
|
// Inline function 'kotlin.let' call
|
|
688
688
|
// Inline function 'kotlin.contracts.contract' call
|
|
689
689
|
// Inline function 'community.flock.wirespec.emitters.python.PythonEmitter.emit.<anonymous>' call
|
|
690
|
-
var it = protoOf(Emitter).
|
|
691
|
-
var init = new Emitted(this.
|
|
692
|
-
var tmp_0 = this.
|
|
690
|
+
var it = protoOf(Emitter).g24.call(this, module_0.e28(VOID, statements), logger);
|
|
691
|
+
var init = new Emitted(this.x2b_1.d27() + '__init__', 'from . import model\nfrom . import endpoint\nfrom . import wirespec\n');
|
|
692
|
+
var tmp_0 = this.x2b_1.d27() + 'endpoint/' + '__init__';
|
|
693
693
|
// Inline function 'kotlin.collections.map' call
|
|
694
694
|
// Inline function 'kotlin.collections.filter' call
|
|
695
695
|
// Inline function 'kotlin.collections.filterTo' call
|
|
696
|
-
var this_1 = module_0.
|
|
696
|
+
var this_1 = module_0.d24_1;
|
|
697
697
|
var destination = ArrayList_init_$Create$();
|
|
698
698
|
var tmp0_iterator = this_1.g();
|
|
699
699
|
while (tmp0_iterator.h()) {
|
|
@@ -713,11 +713,11 @@ protoOf(PythonEmitter).s24 = function (module_0, logger) {
|
|
|
713
713
|
destination_0.e(tmp$ret$5);
|
|
714
714
|
}
|
|
715
715
|
var initEndpoint = new Emitted(tmp_0, joinToString(destination_0, '\n'));
|
|
716
|
-
var tmp_1 = this.
|
|
716
|
+
var tmp_1 = this.x2b_1.d27() + 'model/' + '__init__';
|
|
717
717
|
// Inline function 'kotlin.collections.map' call
|
|
718
718
|
// Inline function 'kotlin.collections.filter' call
|
|
719
719
|
// Inline function 'kotlin.collections.filterTo' call
|
|
720
|
-
var this_2 = module_0.
|
|
720
|
+
var this_2 = module_0.d24_1;
|
|
721
721
|
var destination_1 = ArrayList_init_$Create$();
|
|
722
722
|
var tmp0_iterator_1 = this_2.g();
|
|
723
723
|
while (tmp0_iterator_1.h()) {
|
|
@@ -737,50 +737,50 @@ protoOf(PythonEmitter).s24 = function (module_0, logger) {
|
|
|
737
737
|
destination_2.e(tmp$ret$11);
|
|
738
738
|
}
|
|
739
739
|
var initModel = new Emitted(tmp_1, joinToString(destination_2, '\n'));
|
|
740
|
-
var shared = new Emitted(this.
|
|
741
|
-
return this.
|
|
740
|
+
var shared = new Emitted(this.x2b_1.d27() + 'wirespec', this.x2a().k2c_1);
|
|
741
|
+
return this.y2b_1.w23_1 ? it.pk(init).pk(initEndpoint).pk(initModel).pk(shared) : it.pk(init);
|
|
742
742
|
};
|
|
743
|
-
protoOf(PythonEmitter).
|
|
744
|
-
var subPackageName = plus(this.
|
|
743
|
+
protoOf(PythonEmitter).l24 = function (definition, module_0, logger) {
|
|
744
|
+
var subPackageName = plus(this.x2b_1, definition);
|
|
745
745
|
// Inline function 'kotlin.let' call
|
|
746
746
|
// Inline function 'kotlin.contracts.contract' call
|
|
747
747
|
// Inline function 'community.flock.wirespec.emitters.python.PythonEmitter.emit.<anonymous>' call
|
|
748
|
-
var it = protoOf(Emitter).
|
|
749
|
-
var tmp = subPackageName.
|
|
748
|
+
var it = protoOf(Emitter).l24.call(this, definition, module_0, logger);
|
|
749
|
+
var tmp = subPackageName.d27() + sanitizeSymbol(it.x23_1, this);
|
|
750
750
|
// Inline function 'kotlin.text.trimStart' call
|
|
751
|
-
var this_0 = trimMargin('\n |' + this.
|
|
751
|
+
var this_0 = trimMargin('\n |' + this.z2b_1 + '\n |' + it.y23_1 + '\n ');
|
|
752
752
|
var tmp$ret$0 = toString(trimStart(isCharSequence(this_0) ? this_0 : THROW_CCE()));
|
|
753
753
|
return new Emitted(tmp, tmp$ret$0);
|
|
754
754
|
};
|
|
755
|
-
protoOf(PythonEmitter).
|
|
755
|
+
protoOf(PythonEmitter).t25 = function (type, module_0) {
|
|
756
756
|
var tmp;
|
|
757
|
-
if (type.
|
|
758
|
-
var tmp_0 = this.
|
|
757
|
+
if (type.r25_1.u26_1.l()) {
|
|
758
|
+
var tmp_0 = this.s24(type.q25_1);
|
|
759
759
|
var tmp_1 = Spacer_instance.toString();
|
|
760
|
-
var tmp_2 = this.
|
|
760
|
+
var tmp_2 = this.i26(type);
|
|
761
761
|
tmp = trimMargin('\n |@dataclass\n |class ' + tmp_0 + ':\n |' + tmp_1 + 'pass\n |\n |' + joinToString(tmp_2, '\n', VOID, VOID, VOID, VOID, PythonEmitter$emit$lambda_0(this)) + '\n |\n ');
|
|
762
762
|
} else {
|
|
763
|
-
var tmp_3 = this.
|
|
764
|
-
var tmp_4 = this.
|
|
765
|
-
var tmp_5 = this.
|
|
763
|
+
var tmp_3 = this.s24(type.q25_1);
|
|
764
|
+
var tmp_4 = this.u25(type.r25_1);
|
|
765
|
+
var tmp_5 = this.i26(type);
|
|
766
766
|
tmp = trimMargin('\n |@dataclass\n |class ' + tmp_3 + ':\n |' + tmp_4 + '\n |\n |' + joinToString(tmp_5, '\n', VOID, VOID, VOID, VOID, PythonEmitter$emit$lambda_1(this)) + '\n ');
|
|
767
767
|
}
|
|
768
768
|
return tmp;
|
|
769
769
|
};
|
|
770
|
-
protoOf(PythonEmitter).
|
|
770
|
+
protoOf(PythonEmitter).u25 = function (_this__u8e3s4) {
|
|
771
771
|
return joinToString(_this__u8e3s4.u26_1, '\n', VOID, VOID, VOID, VOID, PythonEmitter$emit$lambda_2(this));
|
|
772
772
|
};
|
|
773
|
-
protoOf(PythonEmitter).
|
|
774
|
-
return this.
|
|
773
|
+
protoOf(PythonEmitter).v25 = function (_this__u8e3s4) {
|
|
774
|
+
return this.s24(_this__u8e3s4.v26_1) + ": '" + this.w25(_this__u8e3s4.w26_1) + "'";
|
|
775
775
|
};
|
|
776
|
-
protoOf(PythonEmitter).
|
|
776
|
+
protoOf(PythonEmitter).w25 = function (_this__u8e3s4) {
|
|
777
777
|
// Inline function 'kotlin.let' call
|
|
778
778
|
// Inline function 'kotlin.contracts.contract' call
|
|
779
779
|
// Inline function 'community.flock.wirespec.emitters.python.PythonEmitter.emit.<anonymous>' call
|
|
780
780
|
var it = emitType(_this__u8e3s4, this);
|
|
781
781
|
return _this__u8e3s4.hm() ? 'Optional[' + it + ']' : it;
|
|
782
782
|
};
|
|
783
|
-
protoOf(PythonEmitter).
|
|
783
|
+
protoOf(PythonEmitter).d2c = function (_this__u8e3s4) {
|
|
784
784
|
var tmp;
|
|
785
785
|
if (_this__u8e3s4 instanceof String_0) {
|
|
786
786
|
tmp = 'str';
|
|
@@ -805,44 +805,44 @@ protoOf(PythonEmitter).c2c = function (_this__u8e3s4) {
|
|
|
805
805
|
}
|
|
806
806
|
return tmp;
|
|
807
807
|
};
|
|
808
|
-
protoOf(PythonEmitter).
|
|
808
|
+
protoOf(PythonEmitter).s24 = function (identifier) {
|
|
809
809
|
var tmp;
|
|
810
810
|
if (identifier instanceof DefinitionIdentifier) {
|
|
811
811
|
tmp = sanitizeSymbol(identifier.b1(), this);
|
|
812
812
|
} else {
|
|
813
813
|
if (identifier instanceof FieldIdentifier) {
|
|
814
|
-
tmp = this.
|
|
814
|
+
tmp = this.v2a(sanitizeSymbol(identifier.b1(), this));
|
|
815
815
|
} else {
|
|
816
816
|
noWhenBranchMatchedException();
|
|
817
817
|
}
|
|
818
818
|
}
|
|
819
819
|
return tmp;
|
|
820
820
|
};
|
|
821
|
-
protoOf(PythonEmitter).
|
|
822
|
-
return trimMargin('\n |@dataclass\n |class ' + sanitizeSymbol(refined.
|
|
821
|
+
protoOf(PythonEmitter).b25 = function (refined) {
|
|
822
|
+
return trimMargin('\n |@dataclass\n |class ' + sanitizeSymbol(refined.z24_1.b1(), this) + '(Wirespec.Refined):\n |' + Spacer_instance.toString() + 'value: str\n |\n |' + Spacer_instance.toString() + 'def validate(self) -> bool:\n |' + Spacer_instance.i27(2) + 'return ' + this.z25(refined) + '\n |\n |' + Spacer_instance.toString() + 'def __str__(self) -> str:\n |' + Spacer_instance.i27(2) + 'return self.value\n ');
|
|
823
823
|
};
|
|
824
|
-
protoOf(PythonEmitter).
|
|
824
|
+
protoOf(PythonEmitter).z25 = function (_this__u8e3s4) {
|
|
825
825
|
var defaultReturn = 'true';
|
|
826
|
-
var type = _this__u8e3s4.
|
|
826
|
+
var type = _this__u8e3s4.a25_1.l29_1;
|
|
827
827
|
var tmp;
|
|
828
828
|
if (type instanceof Integer) {
|
|
829
|
-
var tmp0_safe_receiver = type.
|
|
830
|
-
var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : this.
|
|
829
|
+
var tmp0_safe_receiver = type.r28_1;
|
|
830
|
+
var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : this.x25(tmp0_safe_receiver);
|
|
831
831
|
tmp = tmp1_elvis_lhs == null ? defaultReturn : tmp1_elvis_lhs;
|
|
832
832
|
} else {
|
|
833
833
|
if (type instanceof Number_0) {
|
|
834
|
-
var tmp2_safe_receiver = type.
|
|
835
|
-
var tmp3_elvis_lhs = tmp2_safe_receiver == null ? null : this.
|
|
834
|
+
var tmp2_safe_receiver = type.u28_1;
|
|
835
|
+
var tmp3_elvis_lhs = tmp2_safe_receiver == null ? null : this.x25(tmp2_safe_receiver);
|
|
836
836
|
tmp = tmp3_elvis_lhs == null ? defaultReturn : tmp3_elvis_lhs;
|
|
837
837
|
} else {
|
|
838
838
|
if (type instanceof String_0) {
|
|
839
|
-
var tmp4_safe_receiver = type.
|
|
839
|
+
var tmp4_safe_receiver = type.o28_1;
|
|
840
840
|
var tmp_0;
|
|
841
841
|
var tmp_1 = tmp4_safe_receiver;
|
|
842
842
|
if ((tmp_1 == null ? null : new RegExp_0(tmp_1)) == null) {
|
|
843
843
|
tmp_0 = null;
|
|
844
844
|
} else {
|
|
845
|
-
tmp_0 = this.
|
|
845
|
+
tmp_0 = this.x25(new RegExp_0(tmp4_safe_receiver));
|
|
846
846
|
}
|
|
847
847
|
var tmp5_elvis_lhs = tmp_0;
|
|
848
848
|
tmp = tmp5_elvis_lhs == null ? defaultReturn : tmp5_elvis_lhs;
|
|
@@ -861,36 +861,36 @@ protoOf(PythonEmitter).y2a = function (_this__u8e3s4) {
|
|
|
861
861
|
}
|
|
862
862
|
return tmp;
|
|
863
863
|
};
|
|
864
|
-
protoOf(PythonEmitter).
|
|
864
|
+
protoOf(PythonEmitter).x25 = function (_this__u8e3s4) {
|
|
865
865
|
var tmp;
|
|
866
866
|
if (_this__u8e3s4 instanceof RegExp_0) {
|
|
867
|
-
tmp = Spacer_instance.toString() + 'bool(re.match(r"' + _RegExp___get_value__impl__7o7618(_this__u8e3s4.
|
|
867
|
+
tmp = Spacer_instance.toString() + 'bool(re.match(r"' + _RegExp___get_value__impl__7o7618(_this__u8e3s4.l28_1) + '", self.value))';
|
|
868
868
|
} else {
|
|
869
869
|
if (_this__u8e3s4 instanceof Bound) {
|
|
870
|
-
tmp = Spacer_instance.toString() + _this__u8e3s4.
|
|
870
|
+
tmp = Spacer_instance.toString() + _this__u8e3s4.m28_1 + ' < record.value < ' + _this__u8e3s4.n28_1 + ';';
|
|
871
871
|
} else {
|
|
872
872
|
noWhenBranchMatchedException();
|
|
873
873
|
}
|
|
874
874
|
}
|
|
875
875
|
return tmp;
|
|
876
876
|
};
|
|
877
|
-
protoOf(PythonEmitter).
|
|
878
|
-
var tmp = this.
|
|
877
|
+
protoOf(PythonEmitter).o25 = function (endpoint) {
|
|
878
|
+
var tmp = this.i26(endpoint);
|
|
879
879
|
var tmp_0 = joinToString(tmp, '\n', VOID, VOID, VOID, VOID, PythonEmitter$emit$lambda_3(this));
|
|
880
|
-
var tmp_1 = this.
|
|
881
|
-
var tmp_2 = this.
|
|
882
|
-
var tmp_3 = this.
|
|
883
|
-
return trimMargin('\n |' + tmp_0 + '\n |\n |class ' + tmp_1 + ' (Wirespec.Endpoint):\n |' + tmp_2 + '\n |' + this.
|
|
880
|
+
var tmp_1 = this.s24(endpoint.h25_1);
|
|
881
|
+
var tmp_2 = this.g26(this.a2b(first(endpoint.m25_1), endpoint), 1);
|
|
882
|
+
var tmp_3 = this.l26(endpoint.n25_1);
|
|
883
|
+
return trimMargin('\n |' + tmp_0 + '\n |\n |class ' + tmp_1 + ' (Wirespec.Endpoint):\n |' + tmp_2 + '\n |' + this.g26(joinToString(tmp_3, '\n', VOID, VOID, VOID, VOID, PythonEmitter$emit$lambda_4(this, endpoint)), 1) + '\n |' + this.g26(emitResponseUnion(endpoint, this), 1) + '\n |' + this.g26(emitHandleClass(endpoint, this), 1) + '\n |' + this.g26(emitConvertClass(endpoint, this), 1) + '\n |\n ');
|
|
884
884
|
};
|
|
885
885
|
protoOf(PythonEmitter).a2b = function (_this__u8e3s4, endpoint) {
|
|
886
|
-
var tmp = emit_1(_this__u8e3s4.
|
|
887
|
-
var tmp_0 = this.
|
|
886
|
+
var tmp = emit_1(_this__u8e3s4.x26_1, this);
|
|
887
|
+
var tmp_0 = this.d26(endpoint);
|
|
888
888
|
var tmp_1 = emitObject$default(tmp_0, this, 'Path', 'Wirespec.Request.Path', VOID, PythonEmitter$emit$lambda_5(this));
|
|
889
|
-
var tmp_2 = emitObject$default(endpoint.
|
|
890
|
-
var tmp_3 = emitObject$default(endpoint.
|
|
889
|
+
var tmp_2 = emitObject$default(endpoint.k25_1, this, 'Queries', 'Wirespec.Request.Queries', VOID, PythonEmitter$emit$lambda_6(this));
|
|
890
|
+
var tmp_3 = emitObject$default(endpoint.l25_1, this, 'Headers', 'Wirespec.Request.Headers', VOID, PythonEmitter$emit$lambda_7(this));
|
|
891
891
|
var tmp_4 = Spacer_instance.toString();
|
|
892
892
|
var tmp_5 = Spacer_instance.toString();
|
|
893
|
-
var tmp_6 = emit_1(_this__u8e3s4.
|
|
893
|
+
var tmp_6 = emit_1(_this__u8e3s4.x26_1, this);
|
|
894
894
|
var tmp_7 = Spacer_instance.toString();
|
|
895
895
|
var tmp_8 = Spacer_instance.toString();
|
|
896
896
|
var tmp_9 = Spacer_instance.toString();
|
|
@@ -906,46 +906,46 @@ protoOf(PythonEmitter).a2b = function (_this__u8e3s4, endpoint) {
|
|
|
906
906
|
var tmp_19 = Spacer_instance.toString();
|
|
907
907
|
var tmp_20 = Spacer_instance.toString();
|
|
908
908
|
var tmp_21 = Spacer_instance.toString();
|
|
909
|
-
var tmp_22 = emit_1(_this__u8e3s4.
|
|
909
|
+
var tmp_22 = emit_1(_this__u8e3s4.x26_1, this);
|
|
910
910
|
var tmp_23 = Spacer_instance.toString();
|
|
911
911
|
var tmp_24 = Spacer_instance.toString();
|
|
912
912
|
var tmp_25 = Spacer_instance.toString();
|
|
913
913
|
var tmp_26 = Spacer_instance.toString();
|
|
914
914
|
var tmp_27 = Spacer_instance.toString();
|
|
915
|
-
var tmp_28 = this.
|
|
916
|
-
return trimMargin('\n |@dataclass\n |class Request(Wirespec.Request[' + tmp + ']):\n |' + tmp_1 + '\n |' + tmp_2 + '\n |' + tmp_3 + '\n |\n |' + tmp_4 + '@property\n |' + tmp_5 + 'def body(self) -> ' + tmp_6 + ':\n |' + tmp_7 + tmp_8 + 'return self._body\n |\n |' + tmp_9 + '@property\n |' + tmp_10 + 'def path(self) -> Path:\n |' + tmp_11 + tmp_12 + 'return self._path\n |\n |' + tmp_13 + '@property\n |' + tmp_14 + 'def queries(self) -> Queries:\n |' + tmp_15 + tmp_16 + 'return self._queries\n |\n |' + tmp_17 + '@property\n |' + tmp_18 + 'def headers(self) -> Headers:\n |' + tmp_19 + tmp_20 + 'return self._headers\n |\n |' + tmp_21 + '_body: ' + tmp_22 + '\n |' + tmp_23 + '_headers: Headers\n |' + tmp_24 + '_queries: Queries\n |' + tmp_25 + '_path: Path\n |' + tmp_26 + 'method: Wirespec.Method = Wirespec.Method.' + endpoint.
|
|
915
|
+
var tmp_28 = this.e26(_this__u8e3s4, endpoint);
|
|
916
|
+
return trimMargin('\n |@dataclass\n |class Request(Wirespec.Request[' + tmp + ']):\n |' + tmp_1 + '\n |' + tmp_2 + '\n |' + tmp_3 + '\n |\n |' + tmp_4 + '@property\n |' + tmp_5 + 'def body(self) -> ' + tmp_6 + ':\n |' + tmp_7 + tmp_8 + 'return self._body\n |\n |' + tmp_9 + '@property\n |' + tmp_10 + 'def path(self) -> Path:\n |' + tmp_11 + tmp_12 + 'return self._path\n |\n |' + tmp_13 + '@property\n |' + tmp_14 + 'def queries(self) -> Queries:\n |' + tmp_15 + tmp_16 + 'return self._queries\n |\n |' + tmp_17 + '@property\n |' + tmp_18 + 'def headers(self) -> Headers:\n |' + tmp_19 + tmp_20 + 'return self._headers\n |\n |' + tmp_21 + '_body: ' + tmp_22 + '\n |' + tmp_23 + '_headers: Headers\n |' + tmp_24 + '_queries: Queries\n |' + tmp_25 + '_path: Path\n |' + tmp_26 + 'method: Wirespec.Method = Wirespec.Method.' + endpoint.i25_1.q2_1 + '\n |\n |' + tmp_27 + 'def __init__(self, ' + joinToString(tmp_28, ', ', VOID, VOID, VOID, VOID, PythonEmitter$emit$lambda_8(this)) + '):\n |' + this.g26(emitAssignSelf_0(_this__u8e3s4, this, endpoint), 2) + '\n |\n ');
|
|
917
917
|
};
|
|
918
|
-
protoOf(PythonEmitter).
|
|
919
|
-
var tmp = emit_1(_this__u8e3s4.
|
|
920
|
-
var tmp_0 = emitObject$default(_this__u8e3s4.
|
|
918
|
+
protoOf(PythonEmitter).i2c = function (_this__u8e3s4, endpoint) {
|
|
919
|
+
var tmp = emit_1(_this__u8e3s4.t26_1, this);
|
|
920
|
+
var tmp_0 = emitObject$default(_this__u8e3s4.s26_1, this, 'Headers', 'Wirespec.Response.Headers', VOID, PythonEmitter$emit$lambda_9(this));
|
|
921
921
|
var tmp_1 = Spacer_instance.toString();
|
|
922
922
|
var tmp_2 = Spacer_instance.toString();
|
|
923
923
|
var tmp_3 = Spacer_instance.toString();
|
|
924
924
|
var tmp_4 = Spacer_instance.toString();
|
|
925
925
|
var tmp_5 = Spacer_instance.toString();
|
|
926
926
|
var tmp_6 = Spacer_instance.toString();
|
|
927
|
-
var tmp_7 = emit_1(_this__u8e3s4.
|
|
927
|
+
var tmp_7 = emit_1(_this__u8e3s4.t26_1, this);
|
|
928
928
|
var tmp_8 = Spacer_instance.toString();
|
|
929
929
|
var tmp_9 = Spacer_instance.toString();
|
|
930
930
|
var tmp_10 = Spacer_instance.toString();
|
|
931
|
-
var tmp_11 = emit_1(_this__u8e3s4.
|
|
931
|
+
var tmp_11 = emit_1(_this__u8e3s4.t26_1, this);
|
|
932
932
|
var tmp_12 = Spacer_instance.toString();
|
|
933
933
|
var tmp_13 = Spacer_instance.toString();
|
|
934
934
|
var tmp_14 = Spacer_instance.toString();
|
|
935
|
-
var tmp_15 = this.
|
|
936
|
-
return trimMargin('\n |@dataclass\n |class Response' + _this__u8e3s4.
|
|
935
|
+
var tmp_15 = this.f26(_this__u8e3s4);
|
|
936
|
+
return trimMargin('\n |@dataclass\n |class Response' + _this__u8e3s4.r26_1 + '(Wirespec.Response[' + tmp + ']):\n |' + tmp_0 + '\n |\n |' + tmp_1 + '@property\n |' + tmp_2 + 'def headers(self) -> Headers:\n |' + tmp_3 + tmp_4 + 'return self._headers\n |\n |' + tmp_5 + '@property\n |' + tmp_6 + 'def body(self) -> ' + tmp_7 + ':\n |' + tmp_8 + tmp_9 + 'return self._body\n |\n |' + tmp_10 + '_body: ' + tmp_11 + '\n |' + tmp_12 + '_headers: Headers\n |' + tmp_13 + 'status: int = ' + _this__u8e3s4.r26_1 + '\n |\n |' + tmp_14 + 'def __init__(self, ' + joinToString(tmp_15, ', ', VOID, VOID, VOID, VOID, PythonEmitter$emit$lambda_10(this)) + '):\n |' + this.g26(emitAssignSelf_1(_this__u8e3s4, this, endpoint), 2) + '\n |\n ');
|
|
937
937
|
};
|
|
938
|
-
protoOf(PythonEmitter).
|
|
938
|
+
protoOf(PythonEmitter).t24 = function (channel) {
|
|
939
939
|
return '';
|
|
940
940
|
};
|
|
941
|
-
protoOf(PythonEmitter).
|
|
942
|
-
var tmp = sanitizeSymbol(enum_0.
|
|
943
|
-
return trimMargin('\n |class ' + tmp + '(str, Enum):\n |' + joinToString(enum_0.
|
|
941
|
+
protoOf(PythonEmitter).f25 = function (enum_0, module_0) {
|
|
942
|
+
var tmp = sanitizeSymbol(enum_0.d25_1.b1(), this);
|
|
943
|
+
return trimMargin('\n |class ' + tmp + '(str, Enum):\n |' + joinToString(enum_0.e25_1, '\n', VOID, VOID, VOID, VOID, PythonEmitter$emit$lambda_11(this)) + '\n |\n |' + Spacer_instance.toString() + '@property\n |' + Spacer_instance.toString() + 'def label(self) -> str:\n |' + Spacer_instance.i27(2) + 'return self.value\n |\n |' + Spacer_instance.toString() + 'def __str__(self) -> str:\n |' + Spacer_instance.i27(2) + 'return self.value\n ');
|
|
944
944
|
};
|
|
945
|
-
protoOf(PythonEmitter).
|
|
946
|
-
return trimMargin('\n |class ' + this.
|
|
945
|
+
protoOf(PythonEmitter).x24 = function (union) {
|
|
946
|
+
return trimMargin('\n |class ' + this.s24(union.v24_1) + '(ABC):\n |' + Spacer_instance.toString() + 'pass\n ');
|
|
947
947
|
};
|
|
948
|
-
protoOf(PythonEmitter).
|
|
948
|
+
protoOf(PythonEmitter).u2a = function (_this__u8e3s4) {
|
|
949
949
|
// Inline function 'kotlin.let' call
|
|
950
950
|
// Inline function 'kotlin.contracts.contract' call
|
|
951
951
|
// Inline function 'community.flock.wirespec.emitters.python.PythonEmitter.sanitizeEnum.<anonymous>' call
|
|
@@ -966,12 +966,12 @@ protoOf(PythonEmitter).r2a = function (_this__u8e3s4) {
|
|
|
966
966
|
}
|
|
967
967
|
return tmp;
|
|
968
968
|
};
|
|
969
|
-
protoOf(PythonEmitter).
|
|
970
|
-
return Companion_getInstance().
|
|
969
|
+
protoOf(PythonEmitter).v2a = function (_this__u8e3s4) {
|
|
970
|
+
return Companion_getInstance().e2c_1.o1(_this__u8e3s4) ? '_' + _this__u8e3s4 : _this__u8e3s4;
|
|
971
971
|
};
|
|
972
972
|
function PythonShared() {
|
|
973
|
-
this.
|
|
974
|
-
this.
|
|
973
|
+
this.j2c_1 = 'shared';
|
|
974
|
+
this.k2c_1 = "from abc import ABC, abstractmethod\nfrom dataclasses import dataclass\nfrom enum import Enum\nfrom typing import Generic, List, Dict, Optional, TypeVar\n\nT = TypeVar('T')\nREQ = TypeVar('REQ')\nRES = TypeVar('RES')\n\nclass Wirespec:\n\n class Refined(ABC):\n @property\n @abstractmethod\n def value(self) -> str: pass\n\n class Endpoint(ABC):\n\n class Handler(ABC):\n pass\n\n class Convert(ABC, Generic[REQ, RES]):\n @staticmethod\n @abstractmethod\n def to_raw_request(serializer: 'Wirespec.Serializer', req: REQ) -> 'Wirespec.RawRequest': pass\n\n @staticmethod\n @abstractmethod\n def from_raw_response(serializer: 'Wirespec.Deserializer', res: 'Wirespec.RawResponse') -> RES: pass\n\n @staticmethod\n @abstractmethod\n def to_raw_response(serializer: 'Wirespec.Serializer', res: RES) -> 'Wirespec.RawResponse': pass\n\n @staticmethod\n @abstractmethod\n def from_raw_request(serializer: 'Wirespec.Deserializer[T]', req: 'Wirespec.RawRequest') -> REQ: pass\n\n class Method(Enum):\n GET = \"GET\"\n PUT = \"PUT\"\n POST = \"POST\"\n DELETE = \"DELETE\"\n OPTIONS = \"OPTIONS\"\n HEAD = \"HEAD\"\n PATCH = \"PATCH\"\n TRACE = \"TRACE\"\n\n class Request(Generic[T], ABC):\n\n class Path(ABC): pass\n\n class Queries(ABC): pass\n\n class Headers(ABC): pass\n\n @property\n @abstractmethod\n def path(self) -> Path: pass\n\n @property\n @abstractmethod\n def method(self) -> 'Wirespec.Method': pass\n\n @property\n @abstractmethod\n def queries(self) -> Queries: pass\n\n @property\n @abstractmethod\n def headers(self) -> Headers: pass\n\n @property\n @abstractmethod\n def body(self) -> T: pass\n\n class Response(Generic[T], ABC):\n\n class Headers(ABC): pass\n\n @property\n @abstractmethod\n def status(self) -> int: pass\n\n @property\n @abstractmethod\n def headers(self) -> Headers: pass\n\n @property\n @abstractmethod\n def body(self) -> T: pass\n\n class Serializer(Generic[T], ABC):\n @abstractmethod\n def serialize(self, value: T, t: type[T]) -> str: pass\n @abstractmethod\n def serialize_param(self, value: T, t: type[T]) -> List[str]: pass\n\n class Deserializer(Generic[T], ABC):\n @abstractmethod\n def deserialize(self, value: str | None, t: type[T]) -> T: pass\n @abstractmethod\n def deserialize_param(self, value: List[str] | None, t: type[T]) -> T: pass\n\n class Serialization(Serializer, Deserializer):\n @abstractmethod\n def serialize(self, value: T, t: type[T]) -> str: pass\n @abstractmethod\n def serialize_param(self, value: T, t: type[T]) -> List[str]: pass\n @abstractmethod\n def deserialize(self, value: str | None, t: type[T]) -> T: pass\n @abstractmethod\n def deserialize_param(self, value: List[str] | None, t: type[T]) -> T: pass\n\n @dataclass\n class RawRequest:\n method: str\n path: List[str]\n queries: Dict[str, List[str]]\n headers: Dict[str, List[str]]\n body: Optional[str]\n\n\n @dataclass\n class RawResponse:\n status_code: int\n headers: Dict[str, List[str]]\n body: Optional[str]\n";
|
|
975
975
|
}
|
|
976
976
|
protoOf(PythonShared).toString = function () {
|
|
977
977
|
return 'PythonShared';
|