@flock/wirespec 0.16.13 → 0.17.0
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 +1166 -1166
- package/colormath-root-colormath.mjs +425 -425
- package/kotlin-kotlin-stdlib.mjs +6 -2
- package/kotlin-kotlin-stdlib.mjs.map +1 -1
- package/kotlin-rgxgen.mjs +1767 -1767
- package/kotlinx-io-kotlinx-io-core.mjs +380 -380
- package/markdown.mjs +1864 -1864
- package/mordant-mordant.mjs +1638 -1638
- package/package.json +1 -1
- package/wirespec-src-compiler-core.mjs +3947 -3030
- package/wirespec-src-compiler-core.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-java.mjs +245 -245
- package/wirespec-src-compiler-emitters-java.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-kotlin.mjs +181 -181
- package/wirespec-src-compiler-emitters-python.mjs +244 -244
- package/wirespec-src-compiler-emitters-python.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-typescript.mjs +227 -227
- package/wirespec-src-compiler-emitters-typescript.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-wirespec.mjs +72 -72
- package/wirespec-src-compiler-emitters-wirespec.mjs.map +1 -1
- package/wirespec-src-compiler-lib.mjs +411 -397
- package/wirespec-src-compiler-lib.mjs.map +1 -1
- package/wirespec-src-converter-avro.mjs +295 -290
- package/wirespec-src-converter-avro.mjs.map +1 -1
- package/wirespec-src-converter-openapi.mjs +525 -497
- package/wirespec-src-converter-openapi.mjs.map +1 -1
- package/wirespec-src-plugin-arguments.mjs +136 -136
- package/wirespec-src-plugin-cli.mjs +75 -75
- package/wirespec-src-plugin-npm.d.ts +1 -1
- package/wirespec-src-plugin-npm.mjs +314 -195
- package/wirespec-src-plugin-npm.mjs.map +1 -1
- package/wirespec-src-tools-generator.mjs +24 -24
|
@@ -100,10 +100,10 @@ initMetadataForClass(sam$kotlin_Comparator$0, 'sam$kotlin_Comparator$0', VOID, V
|
|
|
100
100
|
function emit_0(identifier) {
|
|
101
101
|
var tmp;
|
|
102
102
|
if (identifier instanceof DefinitionIdentifier) {
|
|
103
|
-
tmp = this.
|
|
103
|
+
tmp = this.x2a(identifier);
|
|
104
104
|
} else {
|
|
105
105
|
if (identifier instanceof FieldIdentifier) {
|
|
106
|
-
tmp = this.
|
|
106
|
+
tmp = this.z2a(this.x2a(identifier));
|
|
107
107
|
} else {
|
|
108
108
|
noWhenBranchMatchedException();
|
|
109
109
|
}
|
|
@@ -124,7 +124,7 @@ function sanitize(_this__u8e3s4) {
|
|
|
124
124
|
// Inline function 'community.flock.wirespec.emitters.python.PythonIdentifierEmitter.sanitize.<anonymous>' call
|
|
125
125
|
var tmp1 = index;
|
|
126
126
|
index = tmp1 + 1 | 0;
|
|
127
|
-
var tmp$ret$0 = checkIndexOverflow(tmp1) > 0 ? Companion_instance_1.
|
|
127
|
+
var tmp$ret$0 = checkIndexOverflow(tmp1) > 0 ? Companion_instance_1.f26(item) : item;
|
|
128
128
|
destination.e(tmp$ret$0);
|
|
129
129
|
}
|
|
130
130
|
// Inline function 'kotlin.text.filterTo' call
|
|
@@ -163,44 +163,44 @@ function sanitize(_this__u8e3s4) {
|
|
|
163
163
|
return tmp;
|
|
164
164
|
}
|
|
165
165
|
function sanitizeKeywords(_this__u8e3s4) {
|
|
166
|
-
return Companion_getInstance().
|
|
166
|
+
return Companion_getInstance().v2c_1.o1(_this__u8e3s4) ? '_' + _this__u8e3s4 : _this__u8e3s4;
|
|
167
167
|
}
|
|
168
168
|
initMetadataForInterface(PythonIdentifierEmitter, 'PythonIdentifierEmitter');
|
|
169
169
|
function emit_1(type, module_0) {
|
|
170
170
|
var tmp;
|
|
171
|
-
if (type.
|
|
172
|
-
var tmp_0 = this.
|
|
171
|
+
if (type.o24_1.k24_1.l()) {
|
|
172
|
+
var tmp_0 = this.n26(type.n24_1);
|
|
173
173
|
var tmp_1 = Spacer_instance.toString();
|
|
174
174
|
var tmp_2 = importReferences(type);
|
|
175
175
|
tmp = trimMargin('\n |@dataclass\n |class ' + tmp_0 + ':\n |' + tmp_1 + 'pass\n |\n |' + joinToString(tmp_2, '\n', VOID, VOID, VOID, VOID, PythonTypeDefinitionEmitter$emit$lambda(this)) + '\n |\n ');
|
|
176
176
|
} else {
|
|
177
|
-
var tmp_3 = this.
|
|
178
|
-
var tmp_4 = this.
|
|
177
|
+
var tmp_3 = this.n26(type.n24_1);
|
|
178
|
+
var tmp_4 = this.m25(type.o24_1);
|
|
179
179
|
var tmp_5 = importReferences(type);
|
|
180
180
|
tmp = trimMargin('\n |@dataclass\n |class ' + tmp_3 + ':\n |' + tmp_4 + '\n |\n |' + joinToString(tmp_5, '\n', VOID, VOID, VOID, VOID, PythonTypeDefinitionEmitter$emit$lambda_0(this)) + '\n ');
|
|
181
181
|
}
|
|
182
182
|
return tmp;
|
|
183
183
|
}
|
|
184
184
|
function emit_2(_this__u8e3s4) {
|
|
185
|
-
return joinToString(_this__u8e3s4.
|
|
185
|
+
return joinToString(_this__u8e3s4.k24_1, '\n', VOID, VOID, VOID, VOID, PythonTypeDefinitionEmitter$emit$lambda_1(this));
|
|
186
186
|
}
|
|
187
187
|
function emit_3(_this__u8e3s4) {
|
|
188
|
-
return this.
|
|
188
|
+
return this.n26(_this__u8e3s4.r24_1) + ": '" + this.o25(_this__u8e3s4.s24_1) + "'";
|
|
189
189
|
}
|
|
190
190
|
function emit_4(_this__u8e3s4) {
|
|
191
191
|
// Inline function 'kotlin.let' call
|
|
192
192
|
// Inline function 'kotlin.contracts.contract' call
|
|
193
193
|
// Inline function 'community.flock.wirespec.emitters.python.PythonTypeDefinitionEmitter.emit.<anonymous>' call
|
|
194
|
-
var it = this.
|
|
194
|
+
var it = this.t2c(_this__u8e3s4);
|
|
195
195
|
return _this__u8e3s4.jm() ? 'Optional[' + it + ']' : it;
|
|
196
196
|
}
|
|
197
197
|
function emitType(_this__u8e3s4) {
|
|
198
198
|
var tmp;
|
|
199
199
|
if (_this__u8e3s4 instanceof Dict) {
|
|
200
|
-
tmp = 'Dict[str, ' + this.
|
|
200
|
+
tmp = 'Dict[str, ' + this.o25(_this__u8e3s4.u23_1) + ']';
|
|
201
201
|
} else {
|
|
202
202
|
if (_this__u8e3s4 instanceof Iterable) {
|
|
203
|
-
tmp = 'List[' + this.
|
|
203
|
+
tmp = 'List[' + this.o25(_this__u8e3s4.r23_1) + ']';
|
|
204
204
|
} else {
|
|
205
205
|
if (_this__u8e3s4 instanceof Unit) {
|
|
206
206
|
tmp = 'None';
|
|
@@ -209,10 +209,10 @@ function emitType(_this__u8e3s4) {
|
|
|
209
209
|
tmp = 'Any';
|
|
210
210
|
} else {
|
|
211
211
|
if (_this__u8e3s4 instanceof Custom) {
|
|
212
|
-
tmp = _this__u8e3s4.
|
|
212
|
+
tmp = _this__u8e3s4.r29_1;
|
|
213
213
|
} else {
|
|
214
214
|
if (_this__u8e3s4 instanceof Primitive) {
|
|
215
|
-
tmp = this.
|
|
215
|
+
tmp = this.r2c(_this__u8e3s4.v29_1);
|
|
216
216
|
} else {
|
|
217
217
|
noWhenBranchMatchedException();
|
|
218
218
|
}
|
|
@@ -251,10 +251,10 @@ function emit_5(_this__u8e3s4) {
|
|
|
251
251
|
function emit_6(_this__u8e3s4) {
|
|
252
252
|
var tmp;
|
|
253
253
|
if (_this__u8e3s4 instanceof RegExp_0) {
|
|
254
|
-
tmp = Spacer_instance.toString() + 'bool(re.match(r"' + _RegExp___get_value__impl__7o7618(_this__u8e3s4.
|
|
254
|
+
tmp = Spacer_instance.toString() + 'bool(re.match(r"' + _RegExp___get_value__impl__7o7618(_this__u8e3s4.v28_1) + '", self.value))';
|
|
255
255
|
} else {
|
|
256
256
|
if (_this__u8e3s4 instanceof Bound) {
|
|
257
|
-
tmp = Spacer_instance.toString() + _this__u8e3s4.
|
|
257
|
+
tmp = Spacer_instance.toString() + _this__u8e3s4.w28_1 + ' < record.value < ' + _this__u8e3s4.x28_1 + ';';
|
|
258
258
|
} else {
|
|
259
259
|
noWhenBranchMatchedException();
|
|
260
260
|
}
|
|
@@ -262,26 +262,100 @@ function emit_6(_this__u8e3s4) {
|
|
|
262
262
|
return tmp;
|
|
263
263
|
}
|
|
264
264
|
function emitReferenceCustomImports(_this__u8e3s4) {
|
|
265
|
-
return 'from ..model.' + _this__u8e3s4.
|
|
265
|
+
return 'from ..model.' + _this__u8e3s4.r29_1 + ' import ' + _this__u8e3s4.r29_1;
|
|
266
266
|
}
|
|
267
267
|
initMetadataForInterface(PythonTypeDefinitionEmitter, 'PythonTypeDefinitionEmitter', VOID, VOID, [TypeDefinitionEmitter, PythonIdentifierEmitter]);
|
|
268
|
-
function emit_7(
|
|
268
|
+
function emit_7(refined) {
|
|
269
|
+
return trimMargin('\n |@dataclass\n |class ' + this.x2a(refined.s26_1) + '(Wirespec.Refined):\n |' + Spacer_instance.toString() + 'value: str\n |\n |' + Spacer_instance.toString() + 'def validate(self) -> bool:\n |' + Spacer_instance.h27(2) + 'return ' + this.b27(refined) + '\n |\n |' + Spacer_instance.toString() + 'def __str__(self) -> str:\n |' + Spacer_instance.h27(2) + 'return self.value\n ');
|
|
270
|
+
}
|
|
271
|
+
function emitValidator(_this__u8e3s4) {
|
|
272
|
+
var defaultReturn = 'true';
|
|
273
|
+
var type = _this__u8e3s4.t26_1.v29_1;
|
|
274
|
+
var tmp;
|
|
275
|
+
if (type instanceof Integer) {
|
|
276
|
+
var tmp0_safe_receiver = type.b29_1;
|
|
277
|
+
var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : this.p25(tmp0_safe_receiver);
|
|
278
|
+
tmp = tmp1_elvis_lhs == null ? defaultReturn : tmp1_elvis_lhs;
|
|
279
|
+
} else {
|
|
280
|
+
if (type instanceof Number_0) {
|
|
281
|
+
var tmp2_safe_receiver = type.e29_1;
|
|
282
|
+
var tmp3_elvis_lhs = tmp2_safe_receiver == null ? null : this.p25(tmp2_safe_receiver);
|
|
283
|
+
tmp = tmp3_elvis_lhs == null ? defaultReturn : tmp3_elvis_lhs;
|
|
284
|
+
} else {
|
|
285
|
+
if (type instanceof String_0) {
|
|
286
|
+
var tmp4_safe_receiver = type.y28_1;
|
|
287
|
+
var tmp_0;
|
|
288
|
+
var tmp_1 = tmp4_safe_receiver;
|
|
289
|
+
if ((tmp_1 == null ? null : new RegExp_0(tmp_1)) == null) {
|
|
290
|
+
tmp_0 = null;
|
|
291
|
+
} else {
|
|
292
|
+
tmp_0 = this.p25(new RegExp_0(tmp4_safe_receiver));
|
|
293
|
+
}
|
|
294
|
+
var tmp5_elvis_lhs = tmp_0;
|
|
295
|
+
tmp = tmp5_elvis_lhs == null ? defaultReturn : tmp5_elvis_lhs;
|
|
296
|
+
} else {
|
|
297
|
+
if (equals(type, Boolean_instance)) {
|
|
298
|
+
tmp = defaultReturn;
|
|
299
|
+
} else {
|
|
300
|
+
if (equals(type, Bytes_instance)) {
|
|
301
|
+
tmp = defaultReturn;
|
|
302
|
+
} else {
|
|
303
|
+
noWhenBranchMatchedException();
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
return tmp;
|
|
310
|
+
}
|
|
311
|
+
initMetadataForInterface(PythonRefinedTypeDefinitionEmitter, 'PythonRefinedTypeDefinitionEmitter', VOID, VOID, [PythonTypeDefinitionEmitter, PythonIdentifierEmitter]);
|
|
312
|
+
function emit_8(union) {
|
|
313
|
+
return trimMargin('\n |class ' + this.n26(union.i24_1) + '(ABC):\n |' + Spacer_instance.toString() + 'pass\n ');
|
|
314
|
+
}
|
|
315
|
+
initMetadataForInterface(PythonUnionDefinitionEmitter, 'PythonUnionDefinitionEmitter', VOID, VOID, [PythonIdentifierEmitter]);
|
|
316
|
+
function emit_9(enum_0, module_0) {
|
|
317
|
+
var tmp = this.x2a(enum_0.x26_1);
|
|
318
|
+
return trimMargin('\n |class ' + tmp + '(str, Enum):\n |' + joinToString(enum_0.y26_1, '\n', VOID, VOID, VOID, VOID, PythonEnumDefinitionEmitter$emit$lambda(this)) + '\n |\n |' + Spacer_instance.toString() + '@property\n |' + Spacer_instance.toString() + 'def label(self) -> str:\n |' + Spacer_instance.h27(2) + 'return self.value\n |\n |' + Spacer_instance.toString() + 'def __str__(self) -> str:\n |' + Spacer_instance.h27(2) + 'return self.value\n ');
|
|
319
|
+
}
|
|
320
|
+
function sanitizeEnum(_this__u8e3s4) {
|
|
321
|
+
// Inline function 'kotlin.let' call
|
|
322
|
+
// Inline function 'kotlin.contracts.contract' call
|
|
323
|
+
// Inline function 'community.flock.wirespec.emitters.python.PythonEnumDefinitionEmitter.sanitizeEnum.<anonymous>' call
|
|
324
|
+
var it = joinToString(split(_this__u8e3s4, ['-', ', ', '.', ' ', '//']), '_');
|
|
325
|
+
var tmp;
|
|
326
|
+
var tmp0_safe_receiver = firstOrNull(it);
|
|
327
|
+
var tmp_0;
|
|
328
|
+
var tmp_1 = tmp0_safe_receiver;
|
|
329
|
+
if ((tmp_1 == null ? null : new Char(tmp_1)) == null) {
|
|
330
|
+
tmp_0 = null;
|
|
331
|
+
} else {
|
|
332
|
+
tmp_0 = isDigit(tmp0_safe_receiver);
|
|
333
|
+
}
|
|
334
|
+
if (tmp_0 === true) {
|
|
335
|
+
tmp = '_' + it;
|
|
336
|
+
} else {
|
|
337
|
+
tmp = it;
|
|
338
|
+
}
|
|
339
|
+
return tmp;
|
|
340
|
+
}
|
|
341
|
+
initMetadataForInterface(PythonEnumDefinitionEmitter, 'PythonEnumDefinitionEmitter', VOID, VOID, [PythonIdentifierEmitter]);
|
|
342
|
+
function emit_10(endpoint) {
|
|
269
343
|
var tmp = importReferences(endpoint);
|
|
270
344
|
var tmp_0 = joinToString(tmp, '\n', VOID, VOID, VOID, VOID, PythonEndpointDefinitionEmitter$emit$lambda(this));
|
|
271
|
-
var tmp_1 = this.
|
|
272
|
-
var tmp_2 = spacer(this.
|
|
273
|
-
var tmp_3 = distinctByStatus(endpoint.
|
|
345
|
+
var tmp_1 = this.n26(endpoint.w24_1);
|
|
346
|
+
var tmp_2 = spacer(this.j2b(first(endpoint.b25_1), endpoint), 1);
|
|
347
|
+
var tmp_3 = distinctByStatus(endpoint.c25_1);
|
|
274
348
|
return trimMargin('\n |' + tmp_0 + '\n |\n |class ' + tmp_1 + ' (Wirespec.Endpoint):\n |' + tmp_2 + '\n |' + spacer(joinToString(tmp_3, '\n', VOID, VOID, VOID, VOID, PythonEndpointDefinitionEmitter$emit$lambda_0(this, endpoint)), 1) + '\n |' + spacer(emitResponseUnion(endpoint, this), 1) + '\n |' + spacer(emitHandleClass(endpoint, this), 1) + '\n |' + spacer(emitConvertClass(endpoint, this), 1) + '\n |\n ');
|
|
275
349
|
}
|
|
276
|
-
function
|
|
277
|
-
var tmp = emit_15(_this__u8e3s4.
|
|
350
|
+
function emit_11(_this__u8e3s4, endpoint) {
|
|
351
|
+
var tmp = emit_15(_this__u8e3s4.f25_1, this);
|
|
278
352
|
var tmp_0 = get_pathParams(endpoint);
|
|
279
353
|
var tmp_1 = emitObject$default(tmp_0, this, 'Path', 'Wirespec.Request.Path', VOID, PythonEndpointDefinitionEmitter$emit$lambda_1(this));
|
|
280
|
-
var tmp_2 = emitObject$default(endpoint.
|
|
281
|
-
var tmp_3 = emitObject$default(endpoint.
|
|
354
|
+
var tmp_2 = emitObject$default(endpoint.z24_1, this, 'Queries', 'Wirespec.Request.Queries', VOID, PythonEndpointDefinitionEmitter$emit$lambda_2(this));
|
|
355
|
+
var tmp_3 = emitObject$default(endpoint.a25_1, this, 'Headers', 'Wirespec.Request.Headers', VOID, PythonEndpointDefinitionEmitter$emit$lambda_3(this));
|
|
282
356
|
var tmp_4 = Spacer_instance.toString();
|
|
283
357
|
var tmp_5 = Spacer_instance.toString();
|
|
284
|
-
var tmp_6 = emit_15(_this__u8e3s4.
|
|
358
|
+
var tmp_6 = emit_15(_this__u8e3s4.f25_1, this);
|
|
285
359
|
var tmp_7 = Spacer_instance.toString();
|
|
286
360
|
var tmp_8 = Spacer_instance.toString();
|
|
287
361
|
var tmp_9 = Spacer_instance.toString();
|
|
@@ -297,127 +371,53 @@ function emit_8(_this__u8e3s4, endpoint) {
|
|
|
297
371
|
var tmp_19 = Spacer_instance.toString();
|
|
298
372
|
var tmp_20 = Spacer_instance.toString();
|
|
299
373
|
var tmp_21 = Spacer_instance.toString();
|
|
300
|
-
var tmp_22 = emit_15(_this__u8e3s4.
|
|
374
|
+
var tmp_22 = emit_15(_this__u8e3s4.f25_1, this);
|
|
301
375
|
var tmp_23 = Spacer_instance.toString();
|
|
302
376
|
var tmp_24 = Spacer_instance.toString();
|
|
303
377
|
var tmp_25 = Spacer_instance.toString();
|
|
304
378
|
var tmp_26 = Spacer_instance.toString();
|
|
305
379
|
var tmp_27 = Spacer_instance.toString();
|
|
306
380
|
var tmp_28 = paramList(_this__u8e3s4, endpoint);
|
|
307
|
-
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.
|
|
381
|
+
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.x24_1.q2_1 + '\n |\n |' + tmp_27 + 'def __init__(self, ' + joinToString(tmp_28, ', ', VOID, VOID, VOID, VOID, PythonEndpointDefinitionEmitter$emit$lambda_4(this)) + '):\n |' + spacer(emitAssignSelf_0(_this__u8e3s4, this, endpoint), 2) + '\n |\n ');
|
|
308
382
|
}
|
|
309
|
-
function
|
|
310
|
-
var tmp = emit_15(_this__u8e3s4.
|
|
311
|
-
var tmp_0 = emitObject$default(_this__u8e3s4.
|
|
383
|
+
function emit_12(_this__u8e3s4, endpoint) {
|
|
384
|
+
var tmp = emit_15(_this__u8e3s4.k25_1, this);
|
|
385
|
+
var tmp_0 = emitObject$default(_this__u8e3s4.j25_1, this, 'Headers', 'Wirespec.Response.Headers', VOID, PythonEndpointDefinitionEmitter$emit$lambda_5(this));
|
|
312
386
|
var tmp_1 = Spacer_instance.toString();
|
|
313
387
|
var tmp_2 = Spacer_instance.toString();
|
|
314
388
|
var tmp_3 = Spacer_instance.toString();
|
|
315
389
|
var tmp_4 = Spacer_instance.toString();
|
|
316
390
|
var tmp_5 = Spacer_instance.toString();
|
|
317
391
|
var tmp_6 = Spacer_instance.toString();
|
|
318
|
-
var tmp_7 = emit_15(_this__u8e3s4.
|
|
392
|
+
var tmp_7 = emit_15(_this__u8e3s4.k25_1, this);
|
|
319
393
|
var tmp_8 = Spacer_instance.toString();
|
|
320
394
|
var tmp_9 = Spacer_instance.toString();
|
|
321
395
|
var tmp_10 = Spacer_instance.toString();
|
|
322
|
-
var tmp_11 = emit_15(_this__u8e3s4.
|
|
396
|
+
var tmp_11 = emit_15(_this__u8e3s4.k25_1, this);
|
|
323
397
|
var tmp_12 = Spacer_instance.toString();
|
|
324
398
|
var tmp_13 = Spacer_instance.toString();
|
|
325
399
|
var tmp_14 = Spacer_instance.toString();
|
|
326
400
|
var tmp_15 = paramList_0(_this__u8e3s4);
|
|
327
|
-
return trimMargin('\n |@dataclass\n |class Response' + _this__u8e3s4.
|
|
401
|
+
return trimMargin('\n |@dataclass\n |class Response' + _this__u8e3s4.i25_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.i25_1 + '\n |\n |' + tmp_14 + 'def __init__(self, ' + joinToString(tmp_15, ', ', VOID, VOID, VOID, VOID, PythonEndpointDefinitionEmitter$emit$lambda_6(this)) + '):\n |' + spacer(emitAssignSelf_1(_this__u8e3s4, this, endpoint), 2) + '\n |\n ');
|
|
328
402
|
}
|
|
329
403
|
initMetadataForInterface(PythonEndpointDefinitionEmitter, 'PythonEndpointDefinitionEmitter', VOID, VOID, [PythonTypeDefinitionEmitter]);
|
|
330
|
-
|
|
331
|
-
var tmp = this.i2a(enum_0.q26_1);
|
|
332
|
-
return trimMargin('\n |class ' + tmp + '(str, Enum):\n |' + joinToString(enum_0.r26_1, '\n', VOID, VOID, VOID, VOID, PythonEnumDefinitionEmitter$emit$lambda(this)) + '\n |\n |' + Spacer_instance.toString() + '@property\n |' + Spacer_instance.toString() + 'def label(self) -> str:\n |' + Spacer_instance.a27(2) + 'return self.value\n |\n |' + Spacer_instance.toString() + 'def __str__(self) -> str:\n |' + Spacer_instance.a27(2) + 'return self.value\n ');
|
|
333
|
-
}
|
|
334
|
-
function sanitizeEnum(_this__u8e3s4) {
|
|
335
|
-
// Inline function 'kotlin.let' call
|
|
336
|
-
// Inline function 'kotlin.contracts.contract' call
|
|
337
|
-
// Inline function 'community.flock.wirespec.emitters.python.PythonEnumDefinitionEmitter.sanitizeEnum.<anonymous>' call
|
|
338
|
-
var it = joinToString(split(_this__u8e3s4, ['-', ', ', '.', ' ', '//']), '_');
|
|
339
|
-
var tmp;
|
|
340
|
-
var tmp0_safe_receiver = firstOrNull(it);
|
|
341
|
-
var tmp_0;
|
|
342
|
-
var tmp_1 = tmp0_safe_receiver;
|
|
343
|
-
if ((tmp_1 == null ? null : new Char(tmp_1)) == null) {
|
|
344
|
-
tmp_0 = null;
|
|
345
|
-
} else {
|
|
346
|
-
tmp_0 = isDigit(tmp0_safe_receiver);
|
|
347
|
-
}
|
|
348
|
-
if (tmp_0 === true) {
|
|
349
|
-
tmp = '_' + it;
|
|
350
|
-
} else {
|
|
351
|
-
tmp = it;
|
|
352
|
-
}
|
|
353
|
-
return tmp;
|
|
354
|
-
}
|
|
355
|
-
initMetadataForInterface(PythonEnumDefinitionEmitter, 'PythonEnumDefinitionEmitter', VOID, VOID, [PythonIdentifierEmitter]);
|
|
356
|
-
function emit_11(refined) {
|
|
357
|
-
return trimMargin('\n |@dataclass\n |class ' + this.i2a(refined.m26_1) + '(Wirespec.Refined):\n |' + Spacer_instance.toString() + 'value: str\n |\n |' + Spacer_instance.toString() + 'def validate(self) -> bool:\n |' + Spacer_instance.a27(2) + 'return ' + this.u26(refined) + '\n |\n |' + Spacer_instance.toString() + 'def __str__(self) -> str:\n |' + Spacer_instance.a27(2) + 'return self.value\n ');
|
|
358
|
-
}
|
|
359
|
-
function emitValidator(_this__u8e3s4) {
|
|
360
|
-
var defaultReturn = 'true';
|
|
361
|
-
var type = _this__u8e3s4.n26_1.g29_1;
|
|
362
|
-
var tmp;
|
|
363
|
-
if (type instanceof Integer) {
|
|
364
|
-
var tmp0_safe_receiver = type.m28_1;
|
|
365
|
-
var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : this.k25(tmp0_safe_receiver);
|
|
366
|
-
tmp = tmp1_elvis_lhs == null ? defaultReturn : tmp1_elvis_lhs;
|
|
367
|
-
} else {
|
|
368
|
-
if (type instanceof Number_0) {
|
|
369
|
-
var tmp2_safe_receiver = type.p28_1;
|
|
370
|
-
var tmp3_elvis_lhs = tmp2_safe_receiver == null ? null : this.k25(tmp2_safe_receiver);
|
|
371
|
-
tmp = tmp3_elvis_lhs == null ? defaultReturn : tmp3_elvis_lhs;
|
|
372
|
-
} else {
|
|
373
|
-
if (type instanceof String_0) {
|
|
374
|
-
var tmp4_safe_receiver = type.j28_1;
|
|
375
|
-
var tmp_0;
|
|
376
|
-
var tmp_1 = tmp4_safe_receiver;
|
|
377
|
-
if ((tmp_1 == null ? null : new RegExp_0(tmp_1)) == null) {
|
|
378
|
-
tmp_0 = null;
|
|
379
|
-
} else {
|
|
380
|
-
tmp_0 = this.k25(new RegExp_0(tmp4_safe_receiver));
|
|
381
|
-
}
|
|
382
|
-
var tmp5_elvis_lhs = tmp_0;
|
|
383
|
-
tmp = tmp5_elvis_lhs == null ? defaultReturn : tmp5_elvis_lhs;
|
|
384
|
-
} else {
|
|
385
|
-
if (equals(type, Boolean_instance)) {
|
|
386
|
-
tmp = defaultReturn;
|
|
387
|
-
} else {
|
|
388
|
-
if (equals(type, Bytes_instance)) {
|
|
389
|
-
tmp = defaultReturn;
|
|
390
|
-
} else {
|
|
391
|
-
noWhenBranchMatchedException();
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
return tmp;
|
|
398
|
-
}
|
|
399
|
-
initMetadataForInterface(PythonRefinedTypeDefinitionEmitter, 'PythonRefinedTypeDefinitionEmitter', VOID, VOID, [PythonTypeDefinitionEmitter, PythonIdentifierEmitter]);
|
|
400
|
-
function emit_12(union) {
|
|
401
|
-
return trimMargin('\n |class ' + this.i26(union.g24_1) + '(ABC):\n |' + Spacer_instance.toString() + 'pass\n ');
|
|
402
|
-
}
|
|
403
|
-
initMetadataForInterface(PythonUnionDefinitionEmitter, 'PythonUnionDefinitionEmitter', VOID, VOID, [PythonIdentifierEmitter]);
|
|
404
|
-
initMetadataForClass(PythonEmitter, 'PythonEmitter', PythonEmitter, LanguageEmitter, [LanguageEmitter, PythonEndpointDefinitionEmitter, PythonEnumDefinitionEmitter, PythonRefinedTypeDefinitionEmitter, PythonIdentifierEmitter, PythonChannelDefinitionEmitter, PythonUnionDefinitionEmitter, PythonTypeDefinitionEmitter]);
|
|
404
|
+
initMetadataForClass(PythonEmitter, 'PythonEmitter', PythonEmitter, LanguageEmitter, [LanguageEmitter, PythonRefinedTypeDefinitionEmitter, PythonUnionDefinitionEmitter, PythonEnumDefinitionEmitter, PythonEndpointDefinitionEmitter, PythonChannelDefinitionEmitter, PythonIdentifierEmitter, PythonTypeDefinitionEmitter]);
|
|
405
405
|
initMetadataForCompanion(Companion);
|
|
406
406
|
initMetadataForObject(PythonShared, 'PythonShared');
|
|
407
407
|
//endregion
|
|
408
408
|
function PythonChannelDefinitionEmitter() {
|
|
409
409
|
}
|
|
410
410
|
function sam$kotlin_Comparator$0(function_0) {
|
|
411
|
-
this.
|
|
411
|
+
this.h2c_1 = function_0;
|
|
412
412
|
}
|
|
413
413
|
protoOf(sam$kotlin_Comparator$0).uc = function (a, b) {
|
|
414
|
-
return this.
|
|
414
|
+
return this.h2c_1(a, b);
|
|
415
415
|
};
|
|
416
416
|
protoOf(sam$kotlin_Comparator$0).compare = function (a, b) {
|
|
417
417
|
return this.uc(a, b);
|
|
418
418
|
};
|
|
419
419
|
protoOf(sam$kotlin_Comparator$0).p3 = function () {
|
|
420
|
-
return this.
|
|
420
|
+
return this.h2c_1;
|
|
421
421
|
};
|
|
422
422
|
protoOf(sam$kotlin_Comparator$0).equals = function (other) {
|
|
423
423
|
var tmp;
|
|
@@ -438,37 +438,37 @@ protoOf(sam$kotlin_Comparator$0).hashCode = function () {
|
|
|
438
438
|
return hashCode(this.p3());
|
|
439
439
|
};
|
|
440
440
|
function emit$_anonymous_$emitInit_7cggmt(this$0, def) {
|
|
441
|
-
return 'from .' + this$0.
|
|
441
|
+
return 'from .' + this$0.n26(def.l26()) + ' import ' + this$0.n26(def.l26());
|
|
442
442
|
}
|
|
443
443
|
function PythonEmitter$emit$lambda(this$0) {
|
|
444
444
|
return function (a, b) {
|
|
445
445
|
// Inline function 'kotlin.comparisons.compareValuesBy' call
|
|
446
|
-
var tmp = this$0.
|
|
447
|
-
var tmp$ret$1 = this$0.
|
|
446
|
+
var tmp = this$0.o2c(a);
|
|
447
|
+
var tmp$ret$1 = this$0.o2c(b);
|
|
448
448
|
return compareValues(tmp, tmp$ret$1);
|
|
449
449
|
};
|
|
450
450
|
}
|
|
451
451
|
function PythonEmitter(packageName, emitShared) {
|
|
452
|
-
packageName = packageName === VOID ? Companion_instance.
|
|
452
|
+
packageName = packageName === VOID ? Companion_instance.c27('community.flock.wirespec.generated') : packageName;
|
|
453
453
|
emitShared = emitShared === VOID ? Companion_instance_0.y23() : emitShared;
|
|
454
454
|
LanguageEmitter.call(this);
|
|
455
|
-
this.
|
|
456
|
-
this.
|
|
457
|
-
this.
|
|
458
|
-
this.
|
|
459
|
-
this.
|
|
460
|
-
this.
|
|
461
|
-
}
|
|
462
|
-
protoOf(PythonEmitter).
|
|
463
|
-
return this.
|
|
455
|
+
this.i2c_1 = packageName;
|
|
456
|
+
this.j2c_1 = emitShared;
|
|
457
|
+
this.k2c_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';
|
|
458
|
+
this.l2c_1 = FileExtension_Python_getInstance();
|
|
459
|
+
this.m2c_1 = PythonShared_instance;
|
|
460
|
+
this.n2c_1 = '#';
|
|
461
|
+
}
|
|
462
|
+
protoOf(PythonEmitter).v25 = function () {
|
|
463
|
+
return this.l2c_1;
|
|
464
464
|
};
|
|
465
|
-
protoOf(PythonEmitter).
|
|
466
|
-
return this.
|
|
465
|
+
protoOf(PythonEmitter).g2b = function () {
|
|
466
|
+
return this.m2c_1;
|
|
467
467
|
};
|
|
468
|
-
protoOf(PythonEmitter).
|
|
469
|
-
return this.
|
|
468
|
+
protoOf(PythonEmitter).w25 = function () {
|
|
469
|
+
return this.n2c_1;
|
|
470
470
|
};
|
|
471
|
-
protoOf(PythonEmitter).
|
|
471
|
+
protoOf(PythonEmitter).o2c = function (definition) {
|
|
472
472
|
var tmp;
|
|
473
473
|
if (definition instanceof Enum) {
|
|
474
474
|
tmp = 1;
|
|
@@ -497,9 +497,9 @@ protoOf(PythonEmitter).z2b = function (definition) {
|
|
|
497
497
|
}
|
|
498
498
|
return tmp;
|
|
499
499
|
};
|
|
500
|
-
protoOf(PythonEmitter).
|
|
500
|
+
protoOf(PythonEmitter).j26 = function (module_0, logger) {
|
|
501
501
|
// Inline function 'kotlin.collections.sortedBy' call
|
|
502
|
-
var this_0 = module_0.
|
|
502
|
+
var this_0 = module_0.u25_1;
|
|
503
503
|
// Inline function 'kotlin.comparisons.compareBy' call
|
|
504
504
|
var tmp = PythonEmitter$emit$lambda(this);
|
|
505
505
|
var tmp$ret$0 = new sam$kotlin_Comparator$0(tmp);
|
|
@@ -508,13 +508,13 @@ protoOf(PythonEmitter).e26 = function (module_0, logger) {
|
|
|
508
508
|
// Inline function 'kotlin.let' call
|
|
509
509
|
// Inline function 'kotlin.contracts.contract' call
|
|
510
510
|
// Inline function 'community.flock.wirespec.emitters.python.PythonEmitter.emit.<anonymous>' call
|
|
511
|
-
var it = protoOf(LanguageEmitter).
|
|
512
|
-
var init = new Emitted(this.
|
|
513
|
-
var tmp_0 = this.
|
|
511
|
+
var it = protoOf(LanguageEmitter).j26.call(this, module_0.h28(VOID, statements), logger);
|
|
512
|
+
var init = new Emitted(this.i2c_1.f27() + '__init__', 'from . import model\nfrom . import endpoint\nfrom . import wirespec\n');
|
|
513
|
+
var tmp_0 = this.i2c_1.f27() + 'endpoint/' + '__init__';
|
|
514
514
|
// Inline function 'kotlin.collections.map' call
|
|
515
515
|
// Inline function 'kotlin.collections.filter' call
|
|
516
516
|
// Inline function 'kotlin.collections.filterTo' call
|
|
517
|
-
var this_1 = module_0.
|
|
517
|
+
var this_1 = module_0.u25_1;
|
|
518
518
|
var destination = ArrayList_init_$Create$();
|
|
519
519
|
var tmp0_iterator = this_1.g();
|
|
520
520
|
while (tmp0_iterator.h()) {
|
|
@@ -534,11 +534,11 @@ protoOf(PythonEmitter).e26 = function (module_0, logger) {
|
|
|
534
534
|
destination_0.e(tmp$ret$5);
|
|
535
535
|
}
|
|
536
536
|
var initEndpoint = new Emitted(tmp_0, joinToString(destination_0, '\n'));
|
|
537
|
-
var tmp_1 = this.
|
|
537
|
+
var tmp_1 = this.i2c_1.f27() + 'model/' + '__init__';
|
|
538
538
|
// Inline function 'kotlin.collections.map' call
|
|
539
539
|
// Inline function 'kotlin.collections.filter' call
|
|
540
540
|
// Inline function 'kotlin.collections.filterTo' call
|
|
541
|
-
var this_2 = module_0.
|
|
541
|
+
var this_2 = module_0.u25_1;
|
|
542
542
|
var destination_1 = ArrayList_init_$Create$();
|
|
543
543
|
var tmp0_iterator_1 = this_2.g();
|
|
544
544
|
while (tmp0_iterator_1.h()) {
|
|
@@ -558,35 +558,35 @@ protoOf(PythonEmitter).e26 = function (module_0, logger) {
|
|
|
558
558
|
destination_2.e(tmp$ret$11);
|
|
559
559
|
}
|
|
560
560
|
var initModel = new Emitted(tmp_1, joinToString(destination_2, '\n'));
|
|
561
|
-
var shared = new Emitted(this.
|
|
562
|
-
return this.
|
|
561
|
+
var shared = new Emitted(this.i2c_1.f27() + 'wirespec', this.g2b().q2c_1);
|
|
562
|
+
return this.j2c_1.z23_1 ? it.vk(init).vk(initEndpoint).vk(initModel).vk(shared) : it.vk(init);
|
|
563
563
|
};
|
|
564
|
-
protoOf(PythonEmitter).
|
|
565
|
-
var subPackageName = plus(this.
|
|
564
|
+
protoOf(PythonEmitter).k26 = function (definition, module_0, logger) {
|
|
565
|
+
var subPackageName = plus(this.i2c_1, definition);
|
|
566
566
|
// Inline function 'kotlin.let' call
|
|
567
567
|
// Inline function 'kotlin.contracts.contract' call
|
|
568
568
|
// Inline function 'community.flock.wirespec.emitters.python.PythonEmitter.emit.<anonymous>' call
|
|
569
|
-
var it = protoOf(LanguageEmitter).
|
|
570
|
-
var tmp = subPackageName.
|
|
569
|
+
var it = protoOf(LanguageEmitter).k26.call(this, definition, module_0, logger);
|
|
570
|
+
var tmp = subPackageName.f27() + it.a24_1;
|
|
571
571
|
// Inline function 'kotlin.text.trimStart' call
|
|
572
|
-
var this_0 = trimMargin('\n |' + this.
|
|
572
|
+
var this_0 = trimMargin('\n |' + this.k2c_1 + '\n |' + it.b24_1 + '\n ');
|
|
573
573
|
var tmp$ret$0 = toString(trimStart(isCharSequence(this_0) ? this_0 : THROW_CCE()));
|
|
574
574
|
return new Emitted(tmp, tmp$ret$0);
|
|
575
575
|
};
|
|
576
576
|
function emitToRawRequest(_this__u8e3s4, $this, endpoint) {
|
|
577
|
-
var tmp = $this.
|
|
577
|
+
var tmp = $this.n26(endpoint.w24_1);
|
|
578
578
|
var tmp_0 = Spacer_instance.toString();
|
|
579
579
|
var tmp_1 = Spacer_instance.toString();
|
|
580
580
|
var tmp_2 = Spacer_instance.toString();
|
|
581
|
-
var tmp_3 = joinToString(endpoint.
|
|
581
|
+
var tmp_3 = joinToString(endpoint.y24_1, VOID, VOID, VOID, VOID, VOID, PythonEndpointDefinitionEmitter$emitToRawRequest$lambda($this));
|
|
582
582
|
var tmp_4 = Spacer_instance.toString();
|
|
583
583
|
var tmp_5 = Spacer_instance.toString();
|
|
584
584
|
var tmp_6 = Spacer_instance.toString();
|
|
585
585
|
var tmp_7 = Spacer_instance.toString();
|
|
586
586
|
var tmp_8;
|
|
587
587
|
// Inline function 'kotlin.collections.isNotEmpty' call
|
|
588
|
-
if (!endpoint.
|
|
589
|
-
tmp_8 = joinToString(endpoint.
|
|
588
|
+
if (!endpoint.z24_1.l()) {
|
|
589
|
+
tmp_8 = joinToString(endpoint.z24_1, ',\n', '{', '}', VOID, VOID, PythonEndpointDefinitionEmitter$emitToRawRequest$lambda_0($this));
|
|
590
590
|
} else {
|
|
591
591
|
tmp_8 = '{}';
|
|
592
592
|
}
|
|
@@ -595,29 +595,29 @@ function emitToRawRequest(_this__u8e3s4, $this, endpoint) {
|
|
|
595
595
|
var tmp_11 = Spacer_instance.toString();
|
|
596
596
|
var tmp_12;
|
|
597
597
|
// Inline function 'kotlin.collections.isNotEmpty' call
|
|
598
|
-
if (!endpoint.
|
|
599
|
-
tmp_12 = joinToString(endpoint.
|
|
598
|
+
if (!endpoint.a25_1.l()) {
|
|
599
|
+
tmp_12 = joinToString(endpoint.a25_1, ',\n', '{', '}', VOID, VOID, PythonEndpointDefinitionEmitter$emitToRawRequest$lambda_1($this));
|
|
600
600
|
} else {
|
|
601
601
|
tmp_12 = '{}';
|
|
602
602
|
}
|
|
603
603
|
var tmp_13 = tmp_12;
|
|
604
604
|
var tmp_14 = Spacer_instance.toString();
|
|
605
605
|
var tmp_15 = Spacer_instance.toString();
|
|
606
|
-
var tmp0_safe_receiver = _this__u8e3s4.
|
|
607
|
-
var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.
|
|
608
|
-
var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : $this.
|
|
606
|
+
var tmp0_safe_receiver = _this__u8e3s4.f25_1;
|
|
607
|
+
var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.h25_1;
|
|
608
|
+
var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : $this.t2c(tmp1_safe_receiver);
|
|
609
609
|
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 ');
|
|
610
610
|
}
|
|
611
611
|
function emitFromRawRequest(_this__u8e3s4, $this, endpoint) {
|
|
612
|
-
return trimMargin("\n |@staticmethod\n |def from_raw_request(serialization: Wirespec.Deserializer, request: Wirespec.RawRequest) -> '" + $this.
|
|
612
|
+
return trimMargin("\n |@staticmethod\n |def from_raw_request(serialization: Wirespec.Deserializer, request: Wirespec.RawRequest) -> '" + $this.n26(endpoint.w24_1) + ".Request':\n |" + Spacer_instance.toString() + 'return ' + $this.n26(endpoint.w24_1) + '.Request' + emitDeserializedParams(_this__u8e3s4, $this, endpoint) + '\n |\n ');
|
|
613
613
|
}
|
|
614
614
|
function emitDeserializedParams(_this__u8e3s4, $this, endpoint) {
|
|
615
615
|
// Inline function 'kotlin.let' call
|
|
616
616
|
var tmp = get_indexedPathParams(endpoint);
|
|
617
617
|
var tmp_0 = orNull(joinToString(tmp, VOID, VOID, VOID, VOID, VOID, PythonEndpointDefinitionEmitter$emitDeserializedParams$lambda($this)));
|
|
618
|
-
var tmp_1 = orNull(joinToString(endpoint.
|
|
619
|
-
var tmp_2 = orNull(joinToString(endpoint.
|
|
620
|
-
var tmp0_safe_receiver = _this__u8e3s4.
|
|
618
|
+
var tmp_1 = orNull(joinToString(endpoint.z24_1, ',\n', VOID, VOID, VOID, VOID, PythonEndpointDefinitionEmitter$emitDeserializedParams$lambda_0($this)));
|
|
619
|
+
var tmp_2 = orNull(joinToString(endpoint.a25_1, ',\n', VOID, VOID, VOID, VOID, PythonEndpointDefinitionEmitter$emitDeserializedParams$lambda_1($this)));
|
|
620
|
+
var tmp0_safe_receiver = _this__u8e3s4.f25_1;
|
|
621
621
|
var tmp_3;
|
|
622
622
|
if (tmp0_safe_receiver == null) {
|
|
623
623
|
tmp_3 = null;
|
|
@@ -625,7 +625,7 @@ function emitDeserializedParams(_this__u8e3s4, $this, endpoint) {
|
|
|
625
625
|
// Inline function 'kotlin.let' call
|
|
626
626
|
// Inline function 'kotlin.contracts.contract' call
|
|
627
627
|
// Inline function 'community.flock.wirespec.emitters.python.PythonEndpointDefinitionEmitter.emitDeserializedParams.<anonymous>' call
|
|
628
|
-
tmp_3 = Spacer_instance.
|
|
628
|
+
tmp_3 = Spacer_instance.h27(3) + 'body = serialization.deserialize(request.body, ' + $this.t2c(tmp0_safe_receiver.h25_1) + '),';
|
|
629
629
|
}
|
|
630
630
|
// Inline function 'kotlin.contracts.contract' call
|
|
631
631
|
// Inline function 'community.flock.wirespec.emitters.python.PythonEndpointDefinitionEmitter.emitDeserializedParams.<anonymous>' call
|
|
@@ -633,22 +633,22 @@ function emitDeserializedParams(_this__u8e3s4, $this, endpoint) {
|
|
|
633
633
|
return isBlank(it) ? '()' : '(\n' + it + '\n)';
|
|
634
634
|
}
|
|
635
635
|
function emitResponseUnion(_this__u8e3s4, $this) {
|
|
636
|
-
return trimMargin('\n |Response = ' + joinToString(_this__u8e3s4.
|
|
636
|
+
return trimMargin('\n |Response = ' + joinToString(_this__u8e3s4.c25_1, ' | ', VOID, VOID, VOID, VOID, PythonEndpointDefinitionEmitter$emitResponseUnion$lambda) + '\n |\n ');
|
|
637
637
|
}
|
|
638
638
|
function emitHandleClass(_this__u8e3s4, $this) {
|
|
639
|
-
return trimMargin('\n |class Handler(Wirespec.Endpoint.Handler):\n |' + Spacer_instance.toString() + '@abstractmethod\n |' + Spacer_instance.toString() + 'def ' + _this__u8e3s4.
|
|
639
|
+
return trimMargin('\n |class Handler(Wirespec.Endpoint.Handler):\n |' + Spacer_instance.toString() + '@abstractmethod\n |' + Spacer_instance.toString() + 'def ' + _this__u8e3s4.w24_1.b1() + "(self, req: '" + $this.n26(_this__u8e3s4.w24_1) + ".Request') -> '" + $this.n26(_this__u8e3s4.w24_1) + ".Response': pass\n |\n ");
|
|
640
640
|
}
|
|
641
641
|
function emitConvertClass(_this__u8e3s4, $this) {
|
|
642
|
-
return trimMargin('\n |class Convert(Wirespec.Endpoint.Convert[Request, Response]):\n |' + spacer(emitToRawRequest(first(_this__u8e3s4.
|
|
642
|
+
return trimMargin('\n |class Convert(Wirespec.Endpoint.Convert[Request, Response]):\n |' + spacer(emitToRawRequest(first(_this__u8e3s4.b25_1), $this, _this__u8e3s4), 1) + '\n |' + spacer(emitFromRawRequest(first(_this__u8e3s4.b25_1), $this, _this__u8e3s4), 1) + '\n |' + spacer(emitToRawResponse(_this__u8e3s4, $this), 1) + '\n |' + spacer(emitFromRawResponse(_this__u8e3s4, $this), 1) + '\n |\n ');
|
|
643
643
|
}
|
|
644
644
|
function emit_13(_this__u8e3s4, $this) {
|
|
645
|
-
return $this.
|
|
645
|
+
return $this.n26(_this__u8e3s4.a26_1) + ': ' + $this.o25(_this__u8e3s4.b26_1);
|
|
646
646
|
}
|
|
647
647
|
function emitAssignSelf(_this__u8e3s4, $this) {
|
|
648
|
-
return $this.
|
|
648
|
+
return $this.n26(_this__u8e3s4.a26_1) + ' = ' + $this.n26(_this__u8e3s4.a26_1);
|
|
649
649
|
}
|
|
650
650
|
function emitAssignSelf_0(_this__u8e3s4, $this, endpoint) {
|
|
651
|
-
var tmp = $this.
|
|
651
|
+
var tmp = $this.n26(endpoint.w24_1);
|
|
652
652
|
// Inline function 'kotlin.collections.filter' call
|
|
653
653
|
// Inline function 'kotlin.collections.filterTo' call
|
|
654
654
|
var this_0 = paramList(_this__u8e3s4, endpoint);
|
|
@@ -657,13 +657,13 @@ function emitAssignSelf_0(_this__u8e3s4, $this, endpoint) {
|
|
|
657
657
|
while (tmp0_iterator.h()) {
|
|
658
658
|
var element = tmp0_iterator.i();
|
|
659
659
|
// Inline function 'community.flock.wirespec.emitters.python.PythonEndpointDefinitionEmitter.emitAssignSelf.<anonymous>' call
|
|
660
|
-
if (element.
|
|
660
|
+
if (element.z25_1.equals(ParamType_PATH_getInstance())) {
|
|
661
661
|
destination.e(element);
|
|
662
662
|
}
|
|
663
663
|
}
|
|
664
664
|
var tmp_0 = destination;
|
|
665
665
|
var tmp_1 = joinToString(tmp_0, VOID, VOID, VOID, VOID, VOID, PythonEndpointDefinitionEmitter$emitAssignSelf$lambda($this));
|
|
666
|
-
var tmp_2 = $this.
|
|
666
|
+
var tmp_2 = $this.n26(endpoint.w24_1);
|
|
667
667
|
// Inline function 'kotlin.collections.filter' call
|
|
668
668
|
// Inline function 'kotlin.collections.filterTo' call
|
|
669
669
|
var this_1 = paramList(_this__u8e3s4, endpoint);
|
|
@@ -672,13 +672,13 @@ function emitAssignSelf_0(_this__u8e3s4, $this, endpoint) {
|
|
|
672
672
|
while (tmp0_iterator_0.h()) {
|
|
673
673
|
var element_0 = tmp0_iterator_0.i();
|
|
674
674
|
// Inline function 'community.flock.wirespec.emitters.python.PythonEndpointDefinitionEmitter.emitAssignSelf.<anonymous>' call
|
|
675
|
-
if (element_0.
|
|
675
|
+
if (element_0.z25_1.equals(ParamType_QUERY_getInstance())) {
|
|
676
676
|
destination_0.e(element_0);
|
|
677
677
|
}
|
|
678
678
|
}
|
|
679
679
|
var tmp_3 = destination_0;
|
|
680
680
|
var tmp_4 = spacer(joinToString(tmp_3, ',\n', VOID, VOID, VOID, VOID, PythonEndpointDefinitionEmitter$emitAssignSelf$lambda_0($this)), 1);
|
|
681
|
-
var tmp_5 = $this.
|
|
681
|
+
var tmp_5 = $this.n26(endpoint.w24_1);
|
|
682
682
|
// Inline function 'kotlin.collections.filter' call
|
|
683
683
|
// Inline function 'kotlin.collections.filterTo' call
|
|
684
684
|
var this_2 = paramList(_this__u8e3s4, endpoint);
|
|
@@ -687,14 +687,14 @@ function emitAssignSelf_0(_this__u8e3s4, $this, endpoint) {
|
|
|
687
687
|
while (tmp0_iterator_1.h()) {
|
|
688
688
|
var element_1 = tmp0_iterator_1.i();
|
|
689
689
|
// Inline function 'community.flock.wirespec.emitters.python.PythonEndpointDefinitionEmitter.emitAssignSelf.<anonymous>' call
|
|
690
|
-
if (element_1.
|
|
690
|
+
if (element_1.z25_1.equals(ParamType_HEADER_getInstance())) {
|
|
691
691
|
destination_1.e(element_1);
|
|
692
692
|
}
|
|
693
693
|
}
|
|
694
694
|
var tmp_6 = destination_1;
|
|
695
695
|
var tmp_7 = spacer(joinToString(tmp_6, ',\n', VOID, VOID, VOID, VOID, PythonEndpointDefinitionEmitter$emitAssignSelf$lambda_1($this)), 1);
|
|
696
696
|
var tmp_8;
|
|
697
|
-
if (_this__u8e3s4.
|
|
697
|
+
if (_this__u8e3s4.f25_1 == null) {
|
|
698
698
|
tmp_8 = null;
|
|
699
699
|
} else {
|
|
700
700
|
// Inline function 'kotlin.let' call
|
|
@@ -706,7 +706,7 @@ function emitAssignSelf_0(_this__u8e3s4, $this, endpoint) {
|
|
|
706
706
|
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 ');
|
|
707
707
|
}
|
|
708
708
|
function emitAssignSelf_1(_this__u8e3s4, $this, endpoint) {
|
|
709
|
-
var tmp = $this.
|
|
709
|
+
var tmp = $this.n26(endpoint.w24_1);
|
|
710
710
|
// Inline function 'kotlin.collections.filter' call
|
|
711
711
|
// Inline function 'kotlin.collections.filterTo' call
|
|
712
712
|
var this_0 = paramList_0(_this__u8e3s4);
|
|
@@ -715,14 +715,14 @@ function emitAssignSelf_1(_this__u8e3s4, $this, endpoint) {
|
|
|
715
715
|
while (tmp0_iterator.h()) {
|
|
716
716
|
var element = tmp0_iterator.i();
|
|
717
717
|
// Inline function 'community.flock.wirespec.emitters.python.PythonEndpointDefinitionEmitter.emitAssignSelf.<anonymous>' call
|
|
718
|
-
if (element.
|
|
718
|
+
if (element.z25_1.equals(ParamType_HEADER_getInstance())) {
|
|
719
719
|
destination.e(element);
|
|
720
720
|
}
|
|
721
721
|
}
|
|
722
722
|
var tmp_0 = destination;
|
|
723
723
|
var tmp_1 = spacer(joinToString(tmp_0, ',\n', VOID, VOID, VOID, VOID, PythonEndpointDefinitionEmitter$emitAssignSelf$lambda_2($this)), 1);
|
|
724
724
|
var tmp_2;
|
|
725
|
-
if (_this__u8e3s4.
|
|
725
|
+
if (_this__u8e3s4.k25_1 == null) {
|
|
726
726
|
tmp_2 = null;
|
|
727
727
|
} else {
|
|
728
728
|
// Inline function 'kotlin.let' call
|
|
@@ -731,64 +731,64 @@ function emitAssignSelf_1(_this__u8e3s4, $this, endpoint) {
|
|
|
731
731
|
tmp_2 = 'body';
|
|
732
732
|
}
|
|
733
733
|
var tmp1_elvis_lhs = tmp_2;
|
|
734
|
-
return trimMargin('\n |self._headers = ' + tmp + '.Response' + _this__u8e3s4.
|
|
734
|
+
return trimMargin('\n |self._headers = ' + tmp + '.Response' + _this__u8e3s4.i25_1 + '.Headers(' + tmp_1 + ')\n |self._body = ' + (tmp1_elvis_lhs == null ? 'None' : tmp1_elvis_lhs) + '\n ');
|
|
735
735
|
}
|
|
736
736
|
function emitDeserialized(_this__u8e3s4, $this) {
|
|
737
|
-
return Spacer_instance.
|
|
737
|
+
return Spacer_instance.h27(3) + $this.n26(_this__u8e3s4.rd_1.d25_1) + ' = serialization.deserialize(request.path[' + _this__u8e3s4.qd_1 + '], ' + $this.t2c(_this__u8e3s4.rd_1.e25_1) + ')';
|
|
738
738
|
}
|
|
739
739
|
function emitDeserializedParams_0(_this__u8e3s4, $this, type, fields) {
|
|
740
|
-
return $this.
|
|
740
|
+
return $this.n26(_this__u8e3s4.r24_1) + ' = serialization.deserialize_param(' + type + '.' + fields + '.get("' + _this__u8e3s4.r24_1.b1() + '".lower()), ' + $this.t2c(_this__u8e3s4.s24_1) + ')';
|
|
741
741
|
}
|
|
742
742
|
function emitToRawResponse(_this__u8e3s4, $this) {
|
|
743
|
-
var tmp = $this.
|
|
743
|
+
var tmp = $this.n26(_this__u8e3s4.w24_1);
|
|
744
744
|
var tmp_0 = Spacer_instance.toString();
|
|
745
|
-
var tmp_1 = distinctByStatus(_this__u8e3s4.
|
|
745
|
+
var tmp_1 = distinctByStatus(_this__u8e3s4.c25_1);
|
|
746
746
|
return trimMargin("\n |@staticmethod\n |def to_raw_response(serialization: Wirespec.Serializer, response: '" + tmp + ".Response') -> Wirespec.RawResponse:\n |" + tmp_0 + 'match response:\n |' + spacer(joinToString(tmp_1, '\n', VOID, VOID, VOID, VOID, PythonEndpointDefinitionEmitter$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 ');
|
|
747
747
|
}
|
|
748
748
|
function emitFromRawResponse(_this__u8e3s4, $this) {
|
|
749
|
-
var tmp = $this.
|
|
749
|
+
var tmp = $this.n26(_this__u8e3s4.w24_1);
|
|
750
750
|
var tmp_0 = Spacer_instance.toString();
|
|
751
751
|
// Inline function 'kotlin.collections.filter' call
|
|
752
752
|
// Inline function 'kotlin.collections.filterTo' call
|
|
753
|
-
var this_0 = distinctByStatus(_this__u8e3s4.
|
|
753
|
+
var this_0 = distinctByStatus(_this__u8e3s4.c25_1);
|
|
754
754
|
var destination = ArrayList_init_$Create$();
|
|
755
755
|
var tmp0_iterator = this_0.g();
|
|
756
756
|
while (tmp0_iterator.h()) {
|
|
757
757
|
var element = tmp0_iterator.i();
|
|
758
758
|
// Inline function 'community.flock.wirespec.emitters.python.PythonEndpointDefinitionEmitter.emitFromRawResponse.<anonymous>' call
|
|
759
|
-
if (Companion_instance_1.
|
|
759
|
+
if (Companion_instance_1.i26(element.i25_1)) {
|
|
760
760
|
destination.e(element);
|
|
761
761
|
}
|
|
762
762
|
}
|
|
763
763
|
var tmp_1 = destination;
|
|
764
|
-
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 |' + spacer(joinToString(tmp_1, '\n', VOID, VOID, VOID, VOID, PythonEndpointDefinitionEmitter$emitFromRawResponse$lambda($this, _this__u8e3s4)), 2) + '\n |' + Spacer_instance.
|
|
764
|
+
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 |' + spacer(joinToString(tmp_1, '\n', VOID, VOID, VOID, VOID, PythonEndpointDefinitionEmitter$emitFromRawResponse$lambda($this, _this__u8e3s4)), 2) + '\n |' + Spacer_instance.h27(2) + 'case _:\n |' + Spacer_instance.h27(3) + 'raise Exception("Cannot match response with status: " + str(response.status_code))\n |\n ');
|
|
765
765
|
}
|
|
766
766
|
function emitDeserialized_0(_this__u8e3s4, $this, endpoint) {
|
|
767
|
-
var tmp = 'case ' + _this__u8e3s4.
|
|
768
|
-
var tmp_0 = Spacer_instance.toString() + 'return ' + $this.
|
|
769
|
-
var tmp_1 = Spacer_instance.
|
|
770
|
-
var tmp0_safe_receiver = _this__u8e3s4.
|
|
771
|
-
var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.
|
|
772
|
-
var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : $this.
|
|
767
|
+
var tmp = 'case ' + _this__u8e3s4.i25_1 + ':';
|
|
768
|
+
var tmp_0 = Spacer_instance.toString() + 'return ' + $this.n26(endpoint.w24_1) + '.Response' + _this__u8e3s4.i25_1 + '(';
|
|
769
|
+
var tmp_1 = Spacer_instance.h27(2);
|
|
770
|
+
var tmp0_safe_receiver = _this__u8e3s4.k25_1;
|
|
771
|
+
var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.h25_1;
|
|
772
|
+
var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : $this.t2c(tmp1_safe_receiver);
|
|
773
773
|
var tmp_2 = tmp_1 + 'body = serialization.deserialize(response.body, ' + (tmp2_elvis_lhs == null ? 'type(None)' : tmp2_elvis_lhs) + '),';
|
|
774
|
-
var tmp3_safe_receiver = orNull(joinToString(_this__u8e3s4.
|
|
774
|
+
var tmp3_safe_receiver = orNull(joinToString(_this__u8e3s4.j25_1, ',\n', VOID, VOID, VOID, VOID, PythonEndpointDefinitionEmitter$emitDeserialized$lambda($this)));
|
|
775
775
|
return joinToString(listOfNotNull([tmp, tmp_0, tmp_2, tmp3_safe_receiver == null ? null : spacer(tmp3_safe_receiver, 2), Spacer_instance.toString() + ')']), '\n');
|
|
776
776
|
}
|
|
777
777
|
function emitSerialized(_this__u8e3s4, $this, endpoint) {
|
|
778
|
-
var tmp = $this.
|
|
779
|
-
var tmp_0 = Spacer_instance.
|
|
780
|
-
var tmp_1 = Spacer_instance.
|
|
781
|
-
var tmp_2 = Spacer_instance.
|
|
778
|
+
var tmp = $this.n26(endpoint.w24_1);
|
|
779
|
+
var tmp_0 = Spacer_instance.h27(1);
|
|
780
|
+
var tmp_1 = Spacer_instance.h27(2);
|
|
781
|
+
var tmp_2 = Spacer_instance.h27(2);
|
|
782
782
|
var tmp_3;
|
|
783
783
|
// Inline function 'kotlin.collections.isNotEmpty' call
|
|
784
|
-
if (!_this__u8e3s4.
|
|
785
|
-
tmp_3 = joinToString(_this__u8e3s4.
|
|
784
|
+
if (!_this__u8e3s4.j25_1.l()) {
|
|
785
|
+
tmp_3 = joinToString(_this__u8e3s4.j25_1, ', ', '{', '}', VOID, VOID, PythonEndpointDefinitionEmitter$emitSerialized$lambda($this));
|
|
786
786
|
} else {
|
|
787
787
|
tmp_3 = '{}';
|
|
788
788
|
}
|
|
789
789
|
var tmp_4 = tmp_3;
|
|
790
|
-
var tmp_5 = Spacer_instance.
|
|
791
|
-
var tmp0_safe_receiver = _this__u8e3s4.
|
|
790
|
+
var tmp_5 = Spacer_instance.h27(2);
|
|
791
|
+
var tmp0_safe_receiver = _this__u8e3s4.k25_1;
|
|
792
792
|
var tmp_6;
|
|
793
793
|
if (tmp0_safe_receiver == null) {
|
|
794
794
|
tmp_6 = null;
|
|
@@ -796,21 +796,21 @@ function emitSerialized(_this__u8e3s4, $this, endpoint) {
|
|
|
796
796
|
// Inline function 'kotlin.let' call
|
|
797
797
|
// Inline function 'kotlin.contracts.contract' call
|
|
798
798
|
// Inline function 'community.flock.wirespec.emitters.python.PythonEndpointDefinitionEmitter.emitSerialized.<anonymous>' call
|
|
799
|
-
tmp_6 = 'serialization.serialize(response.body, ' + $this.
|
|
799
|
+
tmp_6 = 'serialization.serialize(response.body, ' + $this.t2c(tmp0_safe_receiver.h25_1) + ')';
|
|
800
800
|
}
|
|
801
801
|
var tmp1_elvis_lhs = tmp_6;
|
|
802
|
-
return trimMargin('\n |case ' + tmp + '.Response' + _this__u8e3s4.
|
|
802
|
+
return trimMargin('\n |case ' + tmp + '.Response' + _this__u8e3s4.i25_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.h27(1) + ')\n ');
|
|
803
803
|
}
|
|
804
804
|
function emitSerializedParams(_this__u8e3s4, $this, type, fields) {
|
|
805
|
-
return '"' + _this__u8e3s4.
|
|
805
|
+
return '"' + _this__u8e3s4.r24_1.b1() + '": serialization.serialize_param(' + type + '.' + fields + '.' + $this.n26(_this__u8e3s4.r24_1) + ', ' + $this.t2c(_this__u8e3s4.s24_1) + ')';
|
|
806
806
|
}
|
|
807
807
|
function emitObject(_this__u8e3s4, $this, name, extends_0, spaces, block) {
|
|
808
808
|
var tmp;
|
|
809
809
|
if (_this__u8e3s4.l()) {
|
|
810
|
-
tmp = trimMargin('\n |' + Spacer_instance.
|
|
810
|
+
tmp = trimMargin('\n |' + Spacer_instance.h27(spaces) + '@dataclass\n |' + Spacer_instance.h27(spaces) + 'class ' + name + ' (' + extends_0 + '): pass\n ');
|
|
811
811
|
} else {
|
|
812
|
-
var tmp_0 = Spacer_instance.
|
|
813
|
-
var tmp_1 = Spacer_instance.
|
|
812
|
+
var tmp_0 = Spacer_instance.h27(spaces);
|
|
813
|
+
var tmp_1 = Spacer_instance.h27(spaces);
|
|
814
814
|
tmp = trimMargin('\n |' + tmp_0 + '@dataclass\n |' + tmp_1 + 'class ' + name + ' (' + extends_0 + '):\n |' + joinToString(_this__u8e3s4, '\n', VOID, VOID, VOID, VOID, PythonEndpointDefinitionEmitter$emitObject$lambda(spaces, block)) + '\n ');
|
|
815
815
|
}
|
|
816
816
|
return tmp;
|
|
@@ -820,21 +820,21 @@ function emitObject$default(_this__u8e3s4, $this, name, extends_0, spaces, block
|
|
|
820
820
|
return emitObject(_this__u8e3s4, $this, name, extends_0, spaces, block);
|
|
821
821
|
}
|
|
822
822
|
function emit_14(_this__u8e3s4, $this) {
|
|
823
|
-
return $this.
|
|
823
|
+
return $this.n26(_this__u8e3s4.d25_1) + ': ' + $this.o25(_this__u8e3s4.e25_1);
|
|
824
824
|
}
|
|
825
825
|
function emit_15(_this__u8e3s4, $this) {
|
|
826
|
-
var tmp1_safe_receiver = _this__u8e3s4 == null ? null : _this__u8e3s4.
|
|
827
|
-
var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : $this.
|
|
826
|
+
var tmp1_safe_receiver = _this__u8e3s4 == null ? null : _this__u8e3s4.h25_1;
|
|
827
|
+
var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : $this.o25(tmp1_safe_receiver);
|
|
828
828
|
return tmp2_elvis_lhs == null ? 'None' : tmp2_elvis_lhs;
|
|
829
829
|
}
|
|
830
830
|
function PythonEndpointDefinitionEmitter$emit$lambda(this$0) {
|
|
831
831
|
return function (it) {
|
|
832
|
-
return this$0.
|
|
832
|
+
return this$0.u2c(it);
|
|
833
833
|
};
|
|
834
834
|
}
|
|
835
835
|
function PythonEndpointDefinitionEmitter$emit$lambda_0(this$0, $endpoint) {
|
|
836
836
|
return function (it) {
|
|
837
|
-
return this$0.
|
|
837
|
+
return this$0.s2c(it, $endpoint);
|
|
838
838
|
};
|
|
839
839
|
}
|
|
840
840
|
function PythonEndpointDefinitionEmitter$emit$lambda_1(this$0) {
|
|
@@ -844,12 +844,12 @@ function PythonEndpointDefinitionEmitter$emit$lambda_1(this$0) {
|
|
|
844
844
|
}
|
|
845
845
|
function PythonEndpointDefinitionEmitter$emit$lambda_2(this$0) {
|
|
846
846
|
return function (it) {
|
|
847
|
-
return this$0.
|
|
847
|
+
return this$0.n25(it);
|
|
848
848
|
};
|
|
849
849
|
}
|
|
850
850
|
function PythonEndpointDefinitionEmitter$emit$lambda_3(this$0) {
|
|
851
851
|
return function (it) {
|
|
852
|
-
return this$0.
|
|
852
|
+
return this$0.n25(it);
|
|
853
853
|
};
|
|
854
854
|
}
|
|
855
855
|
function PythonEndpointDefinitionEmitter$emit$lambda_4(this$0) {
|
|
@@ -861,10 +861,10 @@ function PythonEndpointDefinitionEmitter$emitToRawRequest$lambda(this$0) {
|
|
|
861
861
|
return function (it) {
|
|
862
862
|
var tmp;
|
|
863
863
|
if (it instanceof Literal) {
|
|
864
|
-
tmp = '"' + it.
|
|
864
|
+
tmp = '"' + it.y25_1 + '"';
|
|
865
865
|
} else {
|
|
866
866
|
if (it instanceof Param) {
|
|
867
|
-
tmp = 'str(request.path.' + this$0.
|
|
867
|
+
tmp = 'str(request.path.' + this$0.n26(it.d25_1) + ')';
|
|
868
868
|
} else {
|
|
869
869
|
noWhenBranchMatchedException();
|
|
870
870
|
}
|
|
@@ -898,7 +898,7 @@ function PythonEndpointDefinitionEmitter$emitDeserializedParams$lambda_1(this$0)
|
|
|
898
898
|
};
|
|
899
899
|
}
|
|
900
900
|
function PythonEndpointDefinitionEmitter$emitResponseUnion$lambda(it) {
|
|
901
|
-
return 'Response' + it.
|
|
901
|
+
return 'Response' + it.i25_1;
|
|
902
902
|
}
|
|
903
903
|
function PythonEndpointDefinitionEmitter$emitAssignSelf$lambda(this$0) {
|
|
904
904
|
return function (it) {
|
|
@@ -922,7 +922,7 @@ function PythonEndpointDefinitionEmitter$emitAssignSelf$lambda_2(this$0) {
|
|
|
922
922
|
}
|
|
923
923
|
function PythonEndpointDefinitionEmitter$emit$lambda_5(this$0) {
|
|
924
924
|
return function (it) {
|
|
925
|
-
return this$0.
|
|
925
|
+
return this$0.n25(it);
|
|
926
926
|
};
|
|
927
927
|
}
|
|
928
928
|
function PythonEndpointDefinitionEmitter$emit$lambda_6(this$0) {
|
|
@@ -952,21 +952,21 @@ function PythonEndpointDefinitionEmitter$emitSerialized$lambda(this$0) {
|
|
|
952
952
|
}
|
|
953
953
|
function PythonEndpointDefinitionEmitter$emitObject$lambda($spaces, $block) {
|
|
954
954
|
return function (it) {
|
|
955
|
-
return Spacer_instance.
|
|
955
|
+
return Spacer_instance.h27($spaces + 2 | 0) + $block(it);
|
|
956
956
|
};
|
|
957
957
|
}
|
|
958
958
|
function PythonEndpointDefinitionEmitter() {
|
|
959
959
|
}
|
|
960
960
|
function PythonEnumDefinitionEmitter$emit$lambda(this$0) {
|
|
961
961
|
return function (it) {
|
|
962
|
-
return Spacer_instance.toString() + this$0.
|
|
962
|
+
return Spacer_instance.toString() + this$0.z2a(this$0.m2b(it)) + ' = "' + it + '"';
|
|
963
963
|
};
|
|
964
964
|
}
|
|
965
965
|
function PythonEnumDefinitionEmitter() {
|
|
966
966
|
}
|
|
967
967
|
function Companion() {
|
|
968
968
|
Companion_instance_2 = this;
|
|
969
|
-
this.
|
|
969
|
+
this.v2c_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']);
|
|
970
970
|
}
|
|
971
971
|
var Companion_instance_2;
|
|
972
972
|
function Companion_getInstance() {
|
|
@@ -979,8 +979,8 @@ function PythonIdentifierEmitter() {
|
|
|
979
979
|
function PythonRefinedTypeDefinitionEmitter() {
|
|
980
980
|
}
|
|
981
981
|
function PythonShared() {
|
|
982
|
-
this.
|
|
983
|
-
this.
|
|
982
|
+
this.p2c_1 = 'shared';
|
|
983
|
+
this.q2c_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";
|
|
984
984
|
}
|
|
985
985
|
protoOf(PythonShared).toString = function () {
|
|
986
986
|
return 'PythonShared';
|
|
@@ -1002,17 +1002,17 @@ function PythonShared_getInstance() {
|
|
|
1002
1002
|
}
|
|
1003
1003
|
function PythonTypeDefinitionEmitter$emit$lambda(this$0) {
|
|
1004
1004
|
return function (it) {
|
|
1005
|
-
return this$0.
|
|
1005
|
+
return this$0.u2c(it);
|
|
1006
1006
|
};
|
|
1007
1007
|
}
|
|
1008
1008
|
function PythonTypeDefinitionEmitter$emit$lambda_0(this$0) {
|
|
1009
1009
|
return function (it) {
|
|
1010
|
-
return this$0.
|
|
1010
|
+
return this$0.u2c(it);
|
|
1011
1011
|
};
|
|
1012
1012
|
}
|
|
1013
1013
|
function PythonTypeDefinitionEmitter$emit$lambda_1(this$0) {
|
|
1014
1014
|
return function (it) {
|
|
1015
|
-
return Spacer_instance.toString() + this$0.
|
|
1015
|
+
return Spacer_instance.toString() + this$0.n25(it);
|
|
1016
1016
|
};
|
|
1017
1017
|
}
|
|
1018
1018
|
function PythonTypeDefinitionEmitter() {
|
|
@@ -1020,26 +1020,26 @@ function PythonTypeDefinitionEmitter() {
|
|
|
1020
1020
|
function PythonUnionDefinitionEmitter() {
|
|
1021
1021
|
}
|
|
1022
1022
|
//region block: post-declaration
|
|
1023
|
-
protoOf(PythonEmitter).
|
|
1024
|
-
protoOf(PythonEmitter).
|
|
1025
|
-
protoOf(PythonEmitter).
|
|
1026
|
-
protoOf(PythonEmitter).
|
|
1027
|
-
protoOf(PythonEmitter).
|
|
1028
|
-
protoOf(PythonEmitter).
|
|
1029
|
-
protoOf(PythonEmitter).
|
|
1030
|
-
protoOf(PythonEmitter).
|
|
1031
|
-
protoOf(PythonEmitter).
|
|
1032
|
-
protoOf(PythonEmitter).
|
|
1033
|
-
protoOf(PythonEmitter).
|
|
1034
|
-
protoOf(PythonEmitter).
|
|
1035
|
-
protoOf(PythonEmitter).
|
|
1036
|
-
protoOf(PythonEmitter).
|
|
1037
|
-
protoOf(PythonEmitter).
|
|
1038
|
-
protoOf(PythonEmitter).
|
|
1039
|
-
protoOf(PythonEmitter).
|
|
1040
|
-
protoOf(PythonEmitter).
|
|
1041
|
-
protoOf(PythonEmitter).
|
|
1042
|
-
protoOf(PythonEmitter).
|
|
1023
|
+
protoOf(PythonEmitter).n26 = emit_0;
|
|
1024
|
+
protoOf(PythonEmitter).l25 = emit_1;
|
|
1025
|
+
protoOf(PythonEmitter).m25 = emit_2;
|
|
1026
|
+
protoOf(PythonEmitter).n25 = emit_3;
|
|
1027
|
+
protoOf(PythonEmitter).o25 = emit_4;
|
|
1028
|
+
protoOf(PythonEmitter).r2c = emit_5;
|
|
1029
|
+
protoOf(PythonEmitter).p25 = emit_6;
|
|
1030
|
+
protoOf(PythonEmitter).a27 = emit_10;
|
|
1031
|
+
protoOf(PythonEmitter).j2b = emit_11;
|
|
1032
|
+
protoOf(PythonEmitter).s2c = emit_12;
|
|
1033
|
+
protoOf(PythonEmitter).o26 = emit;
|
|
1034
|
+
protoOf(PythonEmitter).z26 = emit_9;
|
|
1035
|
+
protoOf(PythonEmitter).p26 = emit_8;
|
|
1036
|
+
protoOf(PythonEmitter).u26 = emit_7;
|
|
1037
|
+
protoOf(PythonEmitter).b27 = emitValidator;
|
|
1038
|
+
protoOf(PythonEmitter).x2a = sanitize;
|
|
1039
|
+
protoOf(PythonEmitter).z2a = sanitizeKeywords;
|
|
1040
|
+
protoOf(PythonEmitter).t2c = emitType;
|
|
1041
|
+
protoOf(PythonEmitter).u2c = emitReferenceCustomImports;
|
|
1042
|
+
protoOf(PythonEmitter).m2b = sanitizeEnum;
|
|
1043
1043
|
//endregion
|
|
1044
1044
|
//region block: init
|
|
1045
1045
|
PythonShared_instance = new PythonShared();
|