@flock/wirespec 0.17.20 → 0.18.1-RC.2
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/arrow-arrow-annotations.mjs.map +1 -1
- package/arrow-arrow-atomic.mjs +13 -13
- package/arrow-arrow-atomic.mjs.map +1 -1
- package/arrow-arrow-core.mjs +588 -431
- package/arrow-arrow-core.mjs.map +1 -1
- package/arrow-arrow-exception-utils.mjs +30 -0
- package/arrow-arrow-exception-utils.mjs.map +1 -0
- package/clikt-clikt-mordant.mjs +318 -0
- package/clikt-clikt-mordant.mjs.map +1 -0
- package/clikt-clikt.mjs +3834 -3696
- package/clikt-clikt.mjs.map +1 -1
- package/colormath-root-colormath.mjs +619 -682
- package/colormath-root-colormath.mjs.map +1 -1
- package/kotlin-js-core.mjs +4 -0
- package/kotlin-js-core.mjs.map +1 -0
- package/kotlin-js.mjs +4 -0
- package/kotlin-js.mjs.map +1 -0
- package/kotlin-kotlin-stdlib.mjs +6284 -5825
- package/kotlin-kotlin-stdlib.mjs.map +1 -1
- package/kotlin-openapi-bindings.mjs +8163 -8198
- package/kotlin-openapi-bindings.mjs.map +1 -1
- package/kotlin-plugins-js-plain-objects-runtime.mjs +4 -0
- package/kotlin-plugins-js-plain-objects-runtime.mjs.map +1 -0
- package/kotlin-rgxgen.mjs +2007 -2062
- package/kotlin-rgxgen.mjs.map +1 -1
- package/kotlin_org_jetbrains_kotlin_kotlin_dom_api_compat.mjs.map +1 -1
- package/kotlinx-atomicfu.mjs +4 -0
- package/kotlinx-atomicfu.mjs.map +1 -0
- package/kotlinx-coroutines-core.mjs +4 -0
- package/kotlinx-coroutines-core.mjs.map +1 -0
- package/kotlinx-io-kotlinx-io-bytestring.mjs.map +1 -1
- package/kotlinx-io-kotlinx-io-core.mjs +803 -839
- package/kotlinx-io-kotlinx-io-core.mjs.map +1 -1
- package/kotlinx-serialization-kotlinx-serialization-core.mjs +2483 -2553
- package/kotlinx-serialization-kotlinx-serialization-core.mjs.map +1 -1
- package/kotlinx-serialization-kotlinx-serialization-json.mjs +1861 -1928
- package/kotlinx-serialization-kotlinx-serialization-json.mjs.map +1 -1
- package/mordant-mordant-omnibus.mjs +4 -0
- package/mordant-mordant-omnibus.mjs.map +1 -0
- package/mordant-mordant.mjs +2525 -4426
- package/mordant-mordant.mjs.map +1 -1
- package/package.json +4 -7
- package/seskar-core.mjs +4 -0
- package/seskar-core.mjs.map +1 -0
- package/wirespec-bin.mjs +13 -1
- package/wirespec-fetch.d.ts +4 -1
- package/wirespec-fetch.mjs +34 -0
- package/wirespec-serialization.d.ts +13 -2
- package/wirespec-serialization.mjs +22 -1
- package/wirespec-src-compiler-core.mjs +2857 -3909
- package/wirespec-src-compiler-core.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-java.mjs +1370 -413
- package/wirespec-src-compiler-emitters-java.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-kotlin.mjs +1015 -337
- package/wirespec-src-compiler-emitters-kotlin.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-python.mjs +1465 -387
- package/wirespec-src-compiler-emitters-python.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-rust.mjs +2461 -0
- package/wirespec-src-compiler-emitters-rust.mjs.map +1 -0
- package/wirespec-src-compiler-emitters-scala.mjs +1010 -0
- package/wirespec-src-compiler-emitters-scala.mjs.map +1 -0
- package/wirespec-src-compiler-emitters-typescript.mjs +1533 -450
- package/wirespec-src-compiler-emitters-typescript.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-wirespec.mjs +122 -144
- package/wirespec-src-compiler-emitters-wirespec.mjs.map +1 -1
- package/wirespec-src-compiler-ir.mjs +17369 -0
- package/wirespec-src-compiler-ir.mjs.map +1 -0
- package/wirespec-src-compiler-lib.mjs +662 -728
- package/wirespec-src-compiler-lib.mjs.map +1 -1
- package/wirespec-src-converter-avro.mjs +630 -656
- package/wirespec-src-converter-avro.mjs.map +1 -1
- package/wirespec-src-converter-common.mjs.map +1 -1
- package/wirespec-src-converter-openapi.mjs +1705 -2024
- package/wirespec-src-converter-openapi.mjs.map +1 -1
- package/wirespec-src-plugin-arguments.mjs +418 -459
- package/wirespec-src-plugin-arguments.mjs.map +1 -1
- package/wirespec-src-plugin-cli.mjs +367 -331
- package/wirespec-src-plugin-cli.mjs.map +1 -1
- package/{wirespec-src-plugin-npm.d.ts → wirespec-src-plugin-npm.d.mts} +247 -0
- package/wirespec-src-plugin-npm.mjs +166 -359
- package/wirespec-src-plugin-npm.mjs.map +1 -1
- package/wirespec-src-tools-generator.mjs +79 -106
- package/wirespec-src-tools-generator.mjs.map +1 -1
- package/arrow-arrow-continuations.mjs +0 -18
- package/arrow-arrow-continuations.mjs.map +0 -1
- package/markdown.mjs +0 -6756
- package/markdown.mjs.map +0 -1
|
@@ -7,15 +7,15 @@ import {
|
|
|
7
7
|
Comparator2b3maoeh98xtg as Comparator,
|
|
8
8
|
hashCodeq5arwsb9dgti as hashCode,
|
|
9
9
|
initMetadataForClassbxx6q50dy2s7 as initMetadataForClass,
|
|
10
|
-
|
|
10
|
+
VOID3gxj6tk5isa35 as VOID,
|
|
11
11
|
compareValues1n2ayl87ihzfk as compareValues,
|
|
12
12
|
noWhenBranchMatchedException2a6r7ubxgky5j as noWhenBranchMatchedException,
|
|
13
13
|
sortedWith2csnbbb21k0lg as sortedWith,
|
|
14
14
|
ensureNotNull1e947j3ixpazm as ensureNotNull,
|
|
15
|
-
ArrayList_init_$Create$
|
|
16
|
-
|
|
15
|
+
ArrayList_init_$Create$1jemgvhi5v0js as ArrayList_init_$Create$,
|
|
16
|
+
Unit_instance28fytmsmm6r23 as Unit_instance,
|
|
17
17
|
collectionSizeOrDefault36dulx8yinfqm as collectionSizeOrDefault,
|
|
18
|
-
ArrayList_init_$Create$
|
|
18
|
+
ArrayList_init_$Create$3ivpeip4ouddx as ArrayList_init_$Create$_0,
|
|
19
19
|
joinToString1cxrrlmo0chqs as joinToString,
|
|
20
20
|
trimMarginhyd3fsmh8iev as trimMargin,
|
|
21
21
|
THROW_CCE2g6jy02ryeudk as THROW_CCE,
|
|
@@ -26,6 +26,7 @@ import {
|
|
|
26
26
|
listOfNotNull2woi2boe01ub4 as listOfNotNull,
|
|
27
27
|
isBlank1dvkhjjvox3p0 as isBlank,
|
|
28
28
|
first58ocm7j58k3q as first,
|
|
29
|
+
substring3saq8ornu0luv as substring,
|
|
29
30
|
startsWith26w8qjqapeeq6 as startsWith,
|
|
30
31
|
split2bvyvnrlcifjv as split,
|
|
31
32
|
firstOrNulltrxqttxfxqju as firstOrNull,
|
|
@@ -34,18 +35,40 @@ import {
|
|
|
34
35
|
setOf45ia9pnfhe90 as setOf,
|
|
35
36
|
initMetadataForCompanion1wyw17z38v6ac as initMetadataForCompanion,
|
|
36
37
|
checkIndexOverflow3frtmheghr0th as checkIndexOverflow,
|
|
37
|
-
StringBuilder_init_$Create$
|
|
38
|
+
StringBuilder_init_$Create$322n630qt3r8c as StringBuilder_init_$Create$,
|
|
38
39
|
charSequenceLength3278n89t01tmv as charSequenceLength,
|
|
39
40
|
charSequenceGet1vxk1y5n17t1z as charSequenceGet,
|
|
40
41
|
isLetterOrDigit2kuxd9e198haf as isLetterOrDigit,
|
|
41
|
-
|
|
42
|
+
_Char___init__impl__6a9atx1csff5kwtduxl as _Char___init__impl__6a9atx,
|
|
43
|
+
KProperty1ca4yb4wlo496 as KProperty1,
|
|
44
|
+
getPropertyCallableRef3hckxc0xueiaj as getPropertyCallableRef,
|
|
45
|
+
listOf1jh22dvmctj1r as listOf,
|
|
46
|
+
firstOrNull1982767dljvdy as firstOrNull_0,
|
|
47
|
+
toSet2orjxp16sotqu as toSet,
|
|
48
|
+
emptySetcxexqki71qfa as emptySet,
|
|
49
|
+
listOfvhqybd2zx248 as listOf_0,
|
|
50
|
+
to2cs3ny02qtbcb as to,
|
|
51
|
+
toMap1vec9topfei08 as toMap,
|
|
52
|
+
removePrefix279df90bhrqqg as removePrefix,
|
|
53
|
+
plus310ted5e4i90h as plus,
|
|
54
|
+
contains3ue2qo8xhmpf1 as contains,
|
|
55
|
+
mapCapacity1h45rc3eh9p2l as mapCapacity,
|
|
56
|
+
LinkedHashMap_init_$Create$1s75e1k23v4xj as LinkedHashMap_init_$Create$,
|
|
57
|
+
lazy2hsh8ze7j6ikd as lazy,
|
|
58
|
+
Collection1k04j3hzsbod0 as Collection,
|
|
59
|
+
emptyList1g2z5xcrvp2zy as emptyList,
|
|
60
|
+
dropLast1vpiyky649o34 as dropLast,
|
|
61
|
+
drop3na99dw9feawf as drop,
|
|
62
|
+
HashSet_init_$Create$33p49hmosnvr4 as HashSet_init_$Create$,
|
|
63
|
+
Paire9pteg33gng7 as Pair,
|
|
64
|
+
addAll1k27qatfgp3k5 as addAll,
|
|
42
65
|
initMetadataForObject1cxne3s9w65el as initMetadataForObject,
|
|
43
66
|
} from './kotlin-kotlin-stdlib.mjs';
|
|
44
67
|
import {
|
|
45
68
|
LanguageEmitterxhzgykhux3qm as LanguageEmitter,
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
69
|
+
Companion_instance1a2xqc448tlhh as Companion_instance,
|
|
70
|
+
Companion_instance2ryk3262e300f as Companion_instance_0,
|
|
71
|
+
FileExtension_Python_getInstance36wtqnbvfrtmh as FileExtension_Python_getInstance,
|
|
49
72
|
Channel2fhxi4a4pwb64 as Channel,
|
|
50
73
|
Endpoint1jsq06yr3xdhp as Endpoint,
|
|
51
74
|
Unionccsavx6nrdr2 as Union,
|
|
@@ -54,28 +77,30 @@ import {
|
|
|
54
77
|
Enum3l2iuc342kle6 as Enum,
|
|
55
78
|
Emitted12h24rpo4uifw as Emitted,
|
|
56
79
|
Model1nx3had6rojzt as Model,
|
|
57
|
-
plus3lrm73de10b42 as
|
|
58
|
-
|
|
80
|
+
plus3lrm73de10b42 as plus_0,
|
|
81
|
+
Spacer_instance1p6915grp4mfk as Spacer_instance,
|
|
59
82
|
get_indexedPathParams2pzt0qs62068 as get_indexedPathParams,
|
|
60
83
|
orNull2zq556ke3x99j as orNull,
|
|
61
84
|
spacer28p2fwyb64afn as spacer,
|
|
62
85
|
paramList3pq2vf0mu7as2 as paramList,
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
86
|
+
ParamType_PATH_getInstance1s6cfiqhj36ec as ParamType_PATH_getInstance,
|
|
87
|
+
ParamType_QUERY_getInstance3ol0cloa3avmm as ParamType_QUERY_getInstance,
|
|
88
|
+
ParamType_HEADER_getInstance1y4wl8ecf0tb5 as ParamType_HEADER_getInstance,
|
|
66
89
|
paramList1sr74geu9w202 as paramList_0,
|
|
67
90
|
distinctByStatus134zrt4nyr6p2 as distinctByStatus,
|
|
68
|
-
|
|
91
|
+
Companion_instancebcq57hoyp8c2 as Companion_instance_1,
|
|
69
92
|
Paramvfwnys2w6aj1 as Param,
|
|
70
93
|
Literal331hu9r04vptz as Literal,
|
|
71
94
|
importReferencesy4xv7r53sjjs as importReferences,
|
|
72
95
|
get_pathParamsf41cxx5qebxt as get_pathParams,
|
|
73
96
|
FieldIdentifier34k7iphndcnl0 as FieldIdentifier,
|
|
74
97
|
DefinitionIdentifiervfasqdb33qef as DefinitionIdentifier,
|
|
75
|
-
|
|
76
|
-
Boolean_instance15dmfsx1e5thd as Boolean_instance,
|
|
77
|
-
RegExpiyof7szm5zfu as RegExp_0,
|
|
98
|
+
Shared1uygqfbd22ukz as Shared,
|
|
78
99
|
String1czvr8pxnm6on as String_0,
|
|
100
|
+
plus14o24vdaiongg as plus_1,
|
|
101
|
+
Bytes_instance1o9u095wd3kx6 as Bytes_instance,
|
|
102
|
+
Boolean_instance237vwt01w3hs8 as Boolean_instance,
|
|
103
|
+
RegExpiyof7szm5zfu as RegExp_0,
|
|
79
104
|
Number1mui0heypwdhp as Number_0,
|
|
80
105
|
Integer39lqx4uc63u28 as Integer,
|
|
81
106
|
Primitive1i8my14jkp3nk as Primitive,
|
|
@@ -87,25 +112,81 @@ import {
|
|
|
87
112
|
Bytes3eoc50vgt1uem as Bytes,
|
|
88
113
|
Boolean1fpfi8m5jt3fg as Boolean_0,
|
|
89
114
|
Bound2mp7s0560derz as Bound,
|
|
90
|
-
|
|
115
|
+
_RegExp___get_value__impl__7o76182iqk274prw39c as _RegExp___get_value__impl__7o7618,
|
|
91
116
|
TypeDefinitionEmitter18est4d94fpw8 as TypeDefinitionEmitter,
|
|
92
117
|
} from './wirespec-src-compiler-core.mjs';
|
|
93
|
-
import {
|
|
118
|
+
import {
|
|
119
|
+
NonEmptyList3ak25ihy2gcvs as NonEmptyList,
|
|
120
|
+
toNonEmptyListOrNull2ovnnazjb3msz as toNonEmptyListOrNull,
|
|
121
|
+
NonEmptyList__plus_impl_xqmb92tle8a7jcf2wm as NonEmptyList__plus_impl_xqmb9,
|
|
122
|
+
NonEmptyList__plus_impl_xqmb91y38uyofmba13 as NonEmptyList__plus_impl_xqmb9_0,
|
|
123
|
+
} from './arrow-arrow-core.mjs';
|
|
124
|
+
import {
|
|
125
|
+
import5uhkz67bd8tt as import_0,
|
|
126
|
+
TransformScopeyrd3lf4zrk76 as TransformScope,
|
|
127
|
+
TransformerBuildera6a1gvlhjj9b as TransformerBuilder,
|
|
128
|
+
transform3eti8i2bqvifx as transform,
|
|
129
|
+
Elementitq62jg6fid3 as Element,
|
|
130
|
+
File3dimy4iqmuock as File,
|
|
131
|
+
Struct39wf79cwtn4ty as Struct,
|
|
132
|
+
Nameoqr8dt2fim9d as Name,
|
|
133
|
+
transformChildren2mszeagj5nq4c as transformChildren,
|
|
134
|
+
sanitizeFieldName1ptgy1kxy8u2m as sanitizeFieldName,
|
|
135
|
+
ConstructorStatement1x4n4sr59iy4n as ConstructorStatement,
|
|
136
|
+
SanitizationConfig11mmn3p2c03c1 as SanitizationConfig,
|
|
137
|
+
convert13xvfhgrf57n5 as convert,
|
|
138
|
+
generatePython28c6k5s89bmk1 as generatePython,
|
|
139
|
+
FieldCall1iz7z2fx2xo4p as FieldCall,
|
|
140
|
+
Companion_getInstance3gvtuyxc9uhxj as Companion_getInstance,
|
|
141
|
+
VariableReference2vlynnhaw1i64 as VariableReference,
|
|
142
|
+
Custom2si7lto3wompr as Custom_0,
|
|
143
|
+
Parameteruqoxd4rzw7ga as Parameter,
|
|
144
|
+
Function21cuq8qizkin7 as Function,
|
|
145
|
+
transformChildrend9p91tpcqdkx as transformChildren_0,
|
|
146
|
+
Enumlszg09mwd24f as Enum_0,
|
|
147
|
+
Boolean_instance27opaqtiiiysz as Boolean_instance_0,
|
|
148
|
+
String_instance3uxvo48ki208u as String_instance,
|
|
149
|
+
RawExpression2bo7ldfrptjia as RawExpression,
|
|
150
|
+
Interface3pn84xq686t2r as Interface,
|
|
151
|
+
FunctionCall30872kpnbr7op as FunctionCall,
|
|
152
|
+
PythonGenerator_instance3bpw212sztsap as PythonGenerator_instance,
|
|
153
|
+
emit3bzdcd0f6nwtj as emit,
|
|
154
|
+
RawElement2yts1x2rbem1g as RawElement,
|
|
155
|
+
emitn3eihixilqyh as emit_0,
|
|
156
|
+
prependImports32gcj3yb8voha as prependImports,
|
|
157
|
+
placeInModule10pilwex0h8tn as placeInModule,
|
|
158
|
+
convertWithValidation3ar3nbcqsbkpn as convertWithValidation,
|
|
159
|
+
sanitizeNames2wqmyf8vafp9x as sanitizeNames,
|
|
160
|
+
convert11ert2po54h1y as convert_0,
|
|
161
|
+
convert37aabdzvtv9vg as convert_1,
|
|
162
|
+
convert17zcptkz4mhr4 as convert_2,
|
|
163
|
+
function12vu2kapzno4w as function_0,
|
|
164
|
+
convertConstraintkgpvomct0x0s as convertConstraint,
|
|
165
|
+
convert32tuiui3czihh as convert_3,
|
|
166
|
+
Namespace345pal554qu3j as Namespace,
|
|
167
|
+
flattenNestedStructs3rzqu1ggdb6h2 as flattenNestedStructs,
|
|
168
|
+
Union38f3pecvfcpxh as Union_0,
|
|
169
|
+
convert1cn4bolzoed8c as convert_4,
|
|
170
|
+
emitEndpointClient1meajc90wf3el as emitEndpointClient,
|
|
171
|
+
emitClient32kfwzg2hm5vj as emitClient,
|
|
172
|
+
emit1oxjujel6f3jb as emit_1,
|
|
173
|
+
IrEmitterh2m93ojzvkep as IrEmitter,
|
|
174
|
+
} from './wirespec-src-compiler-ir.mjs';
|
|
94
175
|
//region block: imports
|
|
95
176
|
//endregion
|
|
96
177
|
//region block: pre-declaration
|
|
97
|
-
function
|
|
178
|
+
function emit_2(channel) {
|
|
98
179
|
return '';
|
|
99
180
|
}
|
|
100
181
|
initMetadataForInterface(PythonChannelDefinitionEmitter, 'PythonChannelDefinitionEmitter');
|
|
101
182
|
initMetadataForClass(sam$kotlin_Comparator$0, 'sam$kotlin_Comparator$0', VOID, VOID, [Comparator, FunctionAdapter]);
|
|
102
|
-
function
|
|
183
|
+
function emit_3(identifier) {
|
|
103
184
|
var tmp;
|
|
104
185
|
if (identifier instanceof DefinitionIdentifier) {
|
|
105
|
-
tmp = this.
|
|
186
|
+
tmp = this.s1w(identifier);
|
|
106
187
|
} else {
|
|
107
188
|
if (identifier instanceof FieldIdentifier) {
|
|
108
|
-
tmp = this.
|
|
189
|
+
tmp = this.a1w(this.s1w(identifier));
|
|
109
190
|
} else {
|
|
110
191
|
noWhenBranchMatchedException();
|
|
111
192
|
}
|
|
@@ -113,40 +194,36 @@ function emit_0(identifier) {
|
|
|
113
194
|
return tmp;
|
|
114
195
|
}
|
|
115
196
|
function sanitize(_this__u8e3s4) {
|
|
116
|
-
// Inline function 'kotlin.let' call
|
|
117
|
-
// Inline function 'kotlin.text.filter' call
|
|
118
197
|
// Inline function 'kotlin.collections.mapIndexed' call
|
|
119
|
-
var this_0 = split(_this__u8e3s4.
|
|
198
|
+
var this_0 = split(_this__u8e3s4.l1(), ['.', ' ']);
|
|
120
199
|
// Inline function 'kotlin.collections.mapIndexedTo' call
|
|
121
200
|
var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
|
|
122
201
|
var index = 0;
|
|
123
|
-
var
|
|
124
|
-
while (
|
|
125
|
-
var item =
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
destination.e(tmp$ret$0);
|
|
202
|
+
var _iterator__ex2g4s = this_0.t();
|
|
203
|
+
while (_iterator__ex2g4s.u()) {
|
|
204
|
+
var item = _iterator__ex2g4s.v();
|
|
205
|
+
var _unary__edvuaz = index;
|
|
206
|
+
index = _unary__edvuaz + 1 | 0;
|
|
207
|
+
var tmp$ret$0 = checkIndexOverflow(_unary__edvuaz) > 0 ? Companion_instance_1.oq(item) : item;
|
|
208
|
+
destination.x(tmp$ret$0);
|
|
131
209
|
}
|
|
210
|
+
// Inline function 'kotlin.text.filter' call
|
|
211
|
+
var tmp0 = joinToString(destination, '');
|
|
132
212
|
// Inline function 'kotlin.text.filterTo' call
|
|
133
|
-
var this_1 = joinToString(destination, '');
|
|
134
213
|
var destination_0 = StringBuilder_init_$Create$();
|
|
135
214
|
var inductionVariable = 0;
|
|
136
|
-
var last = charSequenceLength(
|
|
215
|
+
var last = charSequenceLength(tmp0);
|
|
137
216
|
if (inductionVariable < last)
|
|
138
217
|
do {
|
|
139
218
|
var index_0 = inductionVariable;
|
|
140
219
|
inductionVariable = inductionVariable + 1 | 0;
|
|
141
|
-
var element = charSequenceGet(
|
|
142
|
-
// Inline function 'community.flock.wirespec.emitters.python.PythonIdentifierEmitter.sanitize.<anonymous>' call
|
|
220
|
+
var element = charSequenceGet(tmp0, index_0);
|
|
143
221
|
if (isLetterOrDigit(element) || element === _Char___init__impl__6a9atx(95)) {
|
|
144
|
-
destination_0.
|
|
222
|
+
destination_0.s(element);
|
|
145
223
|
}
|
|
146
224
|
}
|
|
147
225
|
while (inductionVariable < last);
|
|
148
|
-
// Inline function 'kotlin.
|
|
149
|
-
// Inline function 'community.flock.wirespec.emitters.python.PythonIdentifierEmitter.sanitize.<anonymous>' call
|
|
226
|
+
// Inline function 'kotlin.let' call
|
|
150
227
|
var it = destination_0.toString();
|
|
151
228
|
var tmp;
|
|
152
229
|
var tmp0_safe_receiver = firstOrNull(it);
|
|
@@ -165,44 +242,47 @@ function sanitize(_this__u8e3s4) {
|
|
|
165
242
|
return tmp;
|
|
166
243
|
}
|
|
167
244
|
function sanitizeKeywords(_this__u8e3s4) {
|
|
168
|
-
return
|
|
245
|
+
return Companion_getInstance_0().f1y_1.u1(_this__u8e3s4) ? '_' + _this__u8e3s4 : _this__u8e3s4;
|
|
169
246
|
}
|
|
170
247
|
initMetadataForInterface(PythonIdentifierEmitter, 'PythonIdentifierEmitter');
|
|
171
|
-
function
|
|
248
|
+
function emit_4(enum_0, module_0) {
|
|
249
|
+
var tmp = this.s1w(enum_0.gr_1);
|
|
250
|
+
return trimMargin('\n |class ' + tmp + '(str, Enum):\n |' + joinToString(enum_0.hr_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.qr(2) + 'return self.value\n |\n |' + Spacer_instance.toString() + 'def __str__(self) -> str:\n |' + Spacer_instance.qr(2) + 'return self.value\n ');
|
|
251
|
+
}
|
|
252
|
+
initMetadataForInterface(PythonEnumDefinitionEmitter, 'PythonEnumDefinitionEmitter', VOID, VOID, [PythonIdentifierEmitter]);
|
|
253
|
+
function emit_5(type, module_0) {
|
|
172
254
|
var tmp;
|
|
173
|
-
if (type.
|
|
174
|
-
var tmp_0 = this.
|
|
255
|
+
if (type.wo_1.so_1.r()) {
|
|
256
|
+
var tmp_0 = this.wq(type.vo_1);
|
|
175
257
|
var tmp_1 = Spacer_instance.toString();
|
|
176
258
|
var tmp_2 = importReferences(type);
|
|
177
259
|
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 ');
|
|
178
260
|
} else {
|
|
179
|
-
var tmp_3 = this.
|
|
180
|
-
var tmp_4 = this.
|
|
261
|
+
var tmp_3 = this.wq(type.vo_1);
|
|
262
|
+
var tmp_4 = this.vp(type.wo_1);
|
|
181
263
|
var tmp_5 = importReferences(type);
|
|
182
264
|
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 ');
|
|
183
265
|
}
|
|
184
266
|
return tmp;
|
|
185
267
|
}
|
|
186
|
-
function
|
|
187
|
-
return joinToString(_this__u8e3s4.
|
|
268
|
+
function emit_6(_this__u8e3s4) {
|
|
269
|
+
return joinToString(_this__u8e3s4.so_1, '\n', VOID, VOID, VOID, VOID, PythonTypeDefinitionEmitter$emit$lambda_1(this));
|
|
188
270
|
}
|
|
189
|
-
function
|
|
190
|
-
return this.
|
|
271
|
+
function emit_7(_this__u8e3s4) {
|
|
272
|
+
return this.wq(_this__u8e3s4.ap_1) + ": '" + this.xp(_this__u8e3s4.bp_1) + "'";
|
|
191
273
|
}
|
|
192
|
-
function
|
|
274
|
+
function emit_8(_this__u8e3s4) {
|
|
193
275
|
// Inline function 'kotlin.let' call
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
var it = this.j2c(_this__u8e3s4);
|
|
197
|
-
return _this__u8e3s4.jm() ? 'Optional[' + it + ']' : it;
|
|
276
|
+
var it = this.d1y(_this__u8e3s4);
|
|
277
|
+
return _this__u8e3s4.du() ? 'Optional[' + it + ']' : it;
|
|
198
278
|
}
|
|
199
279
|
function emitType(_this__u8e3s4) {
|
|
200
280
|
var tmp;
|
|
201
281
|
if (_this__u8e3s4 instanceof Dict) {
|
|
202
|
-
tmp = 'Dict[str, ' + this.
|
|
282
|
+
tmp = 'Dict[str, ' + this.xp(_this__u8e3s4.co_1) + ']';
|
|
203
283
|
} else {
|
|
204
284
|
if (_this__u8e3s4 instanceof Iterable) {
|
|
205
|
-
tmp = 'List[' + this.
|
|
285
|
+
tmp = 'List[' + this.xp(_this__u8e3s4.zn_1) + ']';
|
|
206
286
|
} else {
|
|
207
287
|
if (_this__u8e3s4 instanceof Unit) {
|
|
208
288
|
tmp = 'None';
|
|
@@ -211,10 +291,10 @@ function emitType(_this__u8e3s4) {
|
|
|
211
291
|
tmp = 'Any';
|
|
212
292
|
} else {
|
|
213
293
|
if (_this__u8e3s4 instanceof Custom) {
|
|
214
|
-
tmp = _this__u8e3s4.
|
|
294
|
+
tmp = _this__u8e3s4.lu_1;
|
|
215
295
|
} else {
|
|
216
296
|
if (_this__u8e3s4 instanceof Primitive) {
|
|
217
|
-
tmp = this.
|
|
297
|
+
tmp = this.b1y(_this__u8e3s4.pu_1);
|
|
218
298
|
} else {
|
|
219
299
|
noWhenBranchMatchedException();
|
|
220
300
|
}
|
|
@@ -225,7 +305,7 @@ function emitType(_this__u8e3s4) {
|
|
|
225
305
|
}
|
|
226
306
|
return tmp;
|
|
227
307
|
}
|
|
228
|
-
function
|
|
308
|
+
function emit_9(_this__u8e3s4) {
|
|
229
309
|
var tmp;
|
|
230
310
|
if (_this__u8e3s4 instanceof String_0) {
|
|
231
311
|
tmp = 'str';
|
|
@@ -250,37 +330,31 @@ function emit_5(_this__u8e3s4) {
|
|
|
250
330
|
}
|
|
251
331
|
return tmp;
|
|
252
332
|
}
|
|
253
|
-
function
|
|
333
|
+
function emit_10(_this__u8e3s4) {
|
|
254
334
|
var tmp;
|
|
255
335
|
if (_this__u8e3s4 instanceof RegExp_0) {
|
|
256
|
-
tmp = 'bool(re.match(r"' + _RegExp___get_value__impl__7o7618(_this__u8e3s4.
|
|
336
|
+
tmp = 'bool(re.match(r"' + _RegExp___get_value__impl__7o7618(_this__u8e3s4.ys_1) + '", self.value))';
|
|
257
337
|
} else {
|
|
258
338
|
if (_this__u8e3s4 instanceof Bound) {
|
|
259
|
-
var tmp1_safe_receiver = _this__u8e3s4.
|
|
339
|
+
var tmp1_safe_receiver = _this__u8e3s4.pt_1;
|
|
260
340
|
var tmp_0;
|
|
261
341
|
if (tmp1_safe_receiver == null) {
|
|
262
342
|
tmp_0 = null;
|
|
263
343
|
} else {
|
|
264
344
|
// Inline function 'kotlin.let' call
|
|
265
|
-
// Inline function 'kotlin.contracts.contract' call
|
|
266
|
-
// Inline function 'community.flock.wirespec.emitters.python.PythonTypeDefinitionEmitter.emit.<anonymous>' call
|
|
267
345
|
tmp_0 = tmp1_safe_receiver + ' < self.value';
|
|
268
346
|
}
|
|
269
347
|
var minCheck = tmp_0;
|
|
270
|
-
var tmp2_safe_receiver = _this__u8e3s4.
|
|
348
|
+
var tmp2_safe_receiver = _this__u8e3s4.qt_1;
|
|
271
349
|
var tmp_1;
|
|
272
350
|
if (tmp2_safe_receiver == null) {
|
|
273
351
|
tmp_1 = null;
|
|
274
352
|
} else {
|
|
275
353
|
// Inline function 'kotlin.let' call
|
|
276
|
-
// Inline function 'kotlin.contracts.contract' call
|
|
277
|
-
// Inline function 'community.flock.wirespec.emitters.python.PythonTypeDefinitionEmitter.emit.<anonymous>' call
|
|
278
354
|
tmp_1 = 'self.value < ' + tmp2_safe_receiver;
|
|
279
355
|
}
|
|
280
356
|
var maxCheck = tmp_1;
|
|
281
357
|
// Inline function 'kotlin.let' call
|
|
282
|
-
// Inline function 'kotlin.contracts.contract' call
|
|
283
|
-
// Inline function 'community.flock.wirespec.emitters.python.PythonTypeDefinitionEmitter.emit.<anonymous>' call
|
|
284
358
|
var it = joinToString(listOfNotNull([minCheck, maxCheck]), ' and ');
|
|
285
359
|
var tmp_2;
|
|
286
360
|
// Inline function 'kotlin.text.isEmpty' call
|
|
@@ -297,38 +371,34 @@ function emit_6(_this__u8e3s4) {
|
|
|
297
371
|
return tmp;
|
|
298
372
|
}
|
|
299
373
|
function emitReferenceCustomImports(_this__u8e3s4) {
|
|
300
|
-
return 'from ..model.' + _this__u8e3s4.
|
|
374
|
+
return 'from ..model.' + _this__u8e3s4.lu_1 + ' import ' + _this__u8e3s4.lu_1;
|
|
301
375
|
}
|
|
302
376
|
initMetadataForInterface(PythonTypeDefinitionEmitter, 'PythonTypeDefinitionEmitter', VOID, VOID, [TypeDefinitionEmitter, PythonIdentifierEmitter]);
|
|
303
|
-
function
|
|
304
|
-
return trimMargin('\n |class ' + this.
|
|
305
|
-
}
|
|
306
|
-
initMetadataForInterface(PythonUnionDefinitionEmitter, 'PythonUnionDefinitionEmitter', VOID, VOID, [PythonIdentifierEmitter]);
|
|
307
|
-
function emit_8(refined) {
|
|
308
|
-
return trimMargin('\n |@dataclass\n |class ' + this.j2a(refined.d26_1) + '(Wirespec.Refined):\n |' + Spacer_instance.toString() + 'value: ' + this.j2c(refined.e26_1) + '\n |\n |' + Spacer_instance.toString() + 'def validate(self) -> bool:\n |' + Spacer_instance.s26(2) + 'return ' + this.m26(refined) + '\n |\n |' + Spacer_instance.toString() + 'def __str__(self) -> str:\n |' + Spacer_instance.s26(2) + 'return str(self.value)\n |\n ');
|
|
377
|
+
function emit_11(refined) {
|
|
378
|
+
return trimMargin('\n |@dataclass\n |class ' + this.s1w(refined.br_1) + '(Wirespec.Refined):\n |' + Spacer_instance.toString() + 'value: ' + this.d1y(refined.cr_1) + '\n |\n |' + Spacer_instance.toString() + 'def validate(self) -> bool:\n |' + Spacer_instance.qr(2) + 'return ' + this.kr(refined) + '\n |\n |' + Spacer_instance.toString() + 'def __str__(self) -> str:\n |' + Spacer_instance.qr(2) + 'return str(self.value)\n |\n ');
|
|
309
379
|
}
|
|
310
380
|
function emitValidator(_this__u8e3s4) {
|
|
311
381
|
var defaultReturn = 'True';
|
|
312
|
-
var type = _this__u8e3s4.
|
|
382
|
+
var type = _this__u8e3s4.cr_1.pu_1;
|
|
313
383
|
var tmp;
|
|
314
384
|
if (type instanceof Integer) {
|
|
315
|
-
var tmp0_safe_receiver = type.
|
|
316
|
-
var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : this.
|
|
385
|
+
var tmp0_safe_receiver = type.ut_1;
|
|
386
|
+
var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : this.yp(tmp0_safe_receiver);
|
|
317
387
|
tmp = tmp1_elvis_lhs == null ? defaultReturn : tmp1_elvis_lhs;
|
|
318
388
|
} else {
|
|
319
389
|
if (type instanceof Number_0) {
|
|
320
|
-
var tmp2_safe_receiver = type.
|
|
321
|
-
var tmp3_elvis_lhs = tmp2_safe_receiver == null ? null : this.
|
|
390
|
+
var tmp2_safe_receiver = type.xt_1;
|
|
391
|
+
var tmp3_elvis_lhs = tmp2_safe_receiver == null ? null : this.yp(tmp2_safe_receiver);
|
|
322
392
|
tmp = tmp3_elvis_lhs == null ? defaultReturn : tmp3_elvis_lhs;
|
|
323
393
|
} else {
|
|
324
394
|
if (type instanceof String_0) {
|
|
325
|
-
var tmp4_safe_receiver = type.
|
|
395
|
+
var tmp4_safe_receiver = type.rt_1;
|
|
326
396
|
var tmp_0;
|
|
327
397
|
var tmp_1 = tmp4_safe_receiver;
|
|
328
398
|
if ((tmp_1 == null ? null : new RegExp_0(tmp_1)) == null) {
|
|
329
399
|
tmp_0 = null;
|
|
330
400
|
} else {
|
|
331
|
-
tmp_0 = this.
|
|
401
|
+
tmp_0 = this.yp(new RegExp_0(tmp4_safe_receiver));
|
|
332
402
|
}
|
|
333
403
|
var tmp5_elvis_lhs = tmp_0;
|
|
334
404
|
tmp = tmp5_elvis_lhs == null ? defaultReturn : tmp5_elvis_lhs;
|
|
@@ -348,23 +418,27 @@ function emitValidator(_this__u8e3s4) {
|
|
|
348
418
|
return tmp;
|
|
349
419
|
}
|
|
350
420
|
initMetadataForInterface(PythonRefinedTypeDefinitionEmitter, 'PythonRefinedTypeDefinitionEmitter', VOID, VOID, [PythonTypeDefinitionEmitter, PythonIdentifierEmitter]);
|
|
351
|
-
function
|
|
421
|
+
function emit_12(union) {
|
|
422
|
+
return trimMargin('\n |class ' + this.wq(union.qo_1) + '(ABC):\n |' + Spacer_instance.toString() + 'pass\n ');
|
|
423
|
+
}
|
|
424
|
+
initMetadataForInterface(PythonUnionDefinitionEmitter, 'PythonUnionDefinitionEmitter', VOID, VOID, [PythonIdentifierEmitter]);
|
|
425
|
+
function emit_13(endpoint) {
|
|
352
426
|
var tmp = importReferences(endpoint);
|
|
353
427
|
var tmp_0 = joinToString(tmp, '\n', VOID, VOID, VOID, VOID, PythonEndpointDefinitionEmitter$emit$lambda(this));
|
|
354
|
-
var tmp_1 = this.
|
|
355
|
-
var tmp_2 = spacer(this.
|
|
356
|
-
var tmp_3 = distinctByStatus(endpoint.
|
|
357
|
-
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(
|
|
428
|
+
var tmp_1 = this.wq(endpoint.ep_1);
|
|
429
|
+
var tmp_2 = spacer(this.x1v(first(endpoint.jp_1), endpoint), 1);
|
|
430
|
+
var tmp_3 = distinctByStatus(endpoint.kp_1);
|
|
431
|
+
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(this, endpoint), 1) + '\n |' + spacer(emitHandleClass(this, endpoint), 1) + '\n |' + spacer(emitConvertClass(this, endpoint), 1) + '\n |\n ');
|
|
358
432
|
}
|
|
359
|
-
function
|
|
360
|
-
var tmp =
|
|
433
|
+
function emit_14(_this__u8e3s4, endpoint) {
|
|
434
|
+
var tmp = emit_18(this, _this__u8e3s4.np_1);
|
|
361
435
|
var tmp_0 = get_pathParams(endpoint);
|
|
362
|
-
var tmp_1 = emitObject$default(
|
|
363
|
-
var tmp_2 = emitObject$default(endpoint.
|
|
364
|
-
var tmp_3 = emitObject$default(endpoint.
|
|
436
|
+
var tmp_1 = emitObject$default(this, tmp_0, 'Path', 'Wirespec.Request.Path', VOID, PythonEndpointDefinitionEmitter$emit$lambda_1(this));
|
|
437
|
+
var tmp_2 = emitObject$default(this, endpoint.hp_1, 'Queries', 'Wirespec.Request.Queries', VOID, PythonEndpointDefinitionEmitter$emit$lambda_2(this));
|
|
438
|
+
var tmp_3 = emitObject$default(this, endpoint.ip_1, 'Headers', 'Wirespec.Request.Headers', VOID, PythonEndpointDefinitionEmitter$emit$lambda_3(this));
|
|
365
439
|
var tmp_4 = Spacer_instance.toString();
|
|
366
440
|
var tmp_5 = Spacer_instance.toString();
|
|
367
|
-
var tmp_6 =
|
|
441
|
+
var tmp_6 = emit_18(this, _this__u8e3s4.np_1);
|
|
368
442
|
var tmp_7 = Spacer_instance.toString();
|
|
369
443
|
var tmp_8 = Spacer_instance.toString();
|
|
370
444
|
var tmp_9 = Spacer_instance.toString();
|
|
@@ -380,65 +454,64 @@ function emit_10(_this__u8e3s4, endpoint) {
|
|
|
380
454
|
var tmp_19 = Spacer_instance.toString();
|
|
381
455
|
var tmp_20 = Spacer_instance.toString();
|
|
382
456
|
var tmp_21 = Spacer_instance.toString();
|
|
383
|
-
var tmp_22 =
|
|
457
|
+
var tmp_22 = emit_18(this, _this__u8e3s4.np_1);
|
|
384
458
|
var tmp_23 = Spacer_instance.toString();
|
|
385
459
|
var tmp_24 = Spacer_instance.toString();
|
|
386
460
|
var tmp_25 = Spacer_instance.toString();
|
|
387
461
|
var tmp_26 = Spacer_instance.toString();
|
|
388
462
|
var tmp_27 = Spacer_instance.toString();
|
|
389
463
|
var tmp_28 = paramList(_this__u8e3s4, endpoint);
|
|
390
|
-
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.
|
|
464
|
+
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.fp_1.a3_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, _this__u8e3s4, endpoint), 2) + '\n |\n ');
|
|
391
465
|
}
|
|
392
|
-
function
|
|
393
|
-
var tmp =
|
|
394
|
-
var tmp_0 = emitObject$default(_this__u8e3s4.
|
|
466
|
+
function emit_15(_this__u8e3s4, endpoint) {
|
|
467
|
+
var tmp = emit_18(this, _this__u8e3s4.sp_1);
|
|
468
|
+
var tmp_0 = emitObject$default(this, _this__u8e3s4.rp_1, 'Headers', 'Wirespec.Response.Headers', VOID, PythonEndpointDefinitionEmitter$emit$lambda_5(this));
|
|
395
469
|
var tmp_1 = Spacer_instance.toString();
|
|
396
470
|
var tmp_2 = Spacer_instance.toString();
|
|
397
471
|
var tmp_3 = Spacer_instance.toString();
|
|
398
472
|
var tmp_4 = Spacer_instance.toString();
|
|
399
473
|
var tmp_5 = Spacer_instance.toString();
|
|
400
474
|
var tmp_6 = Spacer_instance.toString();
|
|
401
|
-
var tmp_7 =
|
|
475
|
+
var tmp_7 = emit_18(this, _this__u8e3s4.sp_1);
|
|
402
476
|
var tmp_8 = Spacer_instance.toString();
|
|
403
477
|
var tmp_9 = Spacer_instance.toString();
|
|
404
478
|
var tmp_10 = Spacer_instance.toString();
|
|
405
|
-
var tmp_11 =
|
|
479
|
+
var tmp_11 = emit_18(this, _this__u8e3s4.sp_1);
|
|
406
480
|
var tmp_12 = Spacer_instance.toString();
|
|
407
481
|
var tmp_13 = Spacer_instance.toString();
|
|
408
482
|
var tmp_14 = Spacer_instance.toString();
|
|
409
483
|
var tmp_15 = paramList_0(_this__u8e3s4);
|
|
410
|
-
return trimMargin('\n |@dataclass\n |class Response' + _this__u8e3s4.
|
|
484
|
+
return trimMargin('\n |@dataclass\n |class Response' + _this__u8e3s4.qp_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.qp_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, _this__u8e3s4, endpoint), 2) + '\n |\n ');
|
|
411
485
|
}
|
|
412
486
|
initMetadataForInterface(PythonEndpointDefinitionEmitter, 'PythonEndpointDefinitionEmitter', VOID, VOID, [PythonTypeDefinitionEmitter]);
|
|
413
|
-
|
|
414
|
-
var tmp = this.j2a(enum_0.i26_1);
|
|
415
|
-
return trimMargin('\n |class ' + tmp + '(str, Enum):\n |' + joinToString(enum_0.j26_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.s26(2) + 'return self.value\n |\n |' + Spacer_instance.toString() + 'def __str__(self) -> str:\n |' + Spacer_instance.s26(2) + 'return self.value\n ');
|
|
416
|
-
}
|
|
417
|
-
initMetadataForInterface(PythonEnumDefinitionEmitter, 'PythonEnumDefinitionEmitter', VOID, VOID, [PythonIdentifierEmitter]);
|
|
418
|
-
initMetadataForClass(PythonEmitter, 'PythonEmitter', PythonEmitter, LanguageEmitter, [LanguageEmitter, PythonTypeDefinitionEmitter, PythonIdentifierEmitter, PythonUnionDefinitionEmitter, PythonRefinedTypeDefinitionEmitter, PythonChannelDefinitionEmitter, PythonEndpointDefinitionEmitter, PythonEnumDefinitionEmitter]);
|
|
487
|
+
initMetadataForClass(PythonEmitter, 'PythonEmitter', PythonEmitter, LanguageEmitter, [LanguageEmitter, PythonEnumDefinitionEmitter, PythonIdentifierEmitter, PythonTypeDefinitionEmitter, PythonChannelDefinitionEmitter, PythonRefinedTypeDefinitionEmitter, PythonUnionDefinitionEmitter, PythonEndpointDefinitionEmitter]);
|
|
419
488
|
initMetadataForCompanion(Companion);
|
|
489
|
+
initMetadataForCompanion(Companion_0);
|
|
490
|
+
initMetadataForClass(sam$kotlin_Comparator$0_0, 'sam$kotlin_Comparator$0', VOID, VOID, [Comparator, FunctionAdapter]);
|
|
491
|
+
initMetadataForClass(PythonIrEmitter$shared$1);
|
|
492
|
+
initMetadataForClass(PythonIrEmitter, 'PythonIrEmitter', PythonIrEmitter, VOID, [IrEmitter]);
|
|
420
493
|
initMetadataForObject(PythonShared, 'PythonShared');
|
|
421
494
|
//endregion
|
|
422
495
|
function PythonChannelDefinitionEmitter() {
|
|
423
496
|
}
|
|
424
497
|
function sam$kotlin_Comparator$0(function_0) {
|
|
425
|
-
this.
|
|
498
|
+
this.r1x_1 = function_0;
|
|
426
499
|
}
|
|
427
|
-
protoOf(sam$kotlin_Comparator$0).
|
|
428
|
-
return this.
|
|
500
|
+
protoOf(sam$kotlin_Comparator$0).qd = function (a, b) {
|
|
501
|
+
return this.r1x_1(a, b);
|
|
429
502
|
};
|
|
430
503
|
protoOf(sam$kotlin_Comparator$0).compare = function (a, b) {
|
|
431
|
-
return this.
|
|
504
|
+
return this.qd(a, b);
|
|
432
505
|
};
|
|
433
|
-
protoOf(sam$kotlin_Comparator$0).
|
|
434
|
-
return this.
|
|
506
|
+
protoOf(sam$kotlin_Comparator$0).l3 = function () {
|
|
507
|
+
return this.r1x_1;
|
|
435
508
|
};
|
|
436
509
|
protoOf(sam$kotlin_Comparator$0).equals = function (other) {
|
|
437
510
|
var tmp;
|
|
438
511
|
if (!(other == null) ? isInterface(other, Comparator) : false) {
|
|
439
512
|
var tmp_0;
|
|
440
513
|
if (!(other == null) ? isInterface(other, FunctionAdapter) : false) {
|
|
441
|
-
tmp_0 = equals(this.
|
|
514
|
+
tmp_0 = equals(this.l3(), other.l3());
|
|
442
515
|
} else {
|
|
443
516
|
tmp_0 = false;
|
|
444
517
|
}
|
|
@@ -449,40 +522,40 @@ protoOf(sam$kotlin_Comparator$0).equals = function (other) {
|
|
|
449
522
|
return tmp;
|
|
450
523
|
};
|
|
451
524
|
protoOf(sam$kotlin_Comparator$0).hashCode = function () {
|
|
452
|
-
return hashCode(this.
|
|
525
|
+
return hashCode(this.l3());
|
|
453
526
|
};
|
|
454
|
-
function emit$_anonymous_$emitInit_7cggmt(this$0, def) {
|
|
455
|
-
return 'from .' + this$0.y25(def.x25()) + ' import ' + this$0.y25(def.x25());
|
|
456
|
-
}
|
|
457
527
|
function PythonEmitter$emit$lambda(this$0) {
|
|
458
528
|
return function (a, b) {
|
|
459
529
|
// Inline function 'kotlin.comparisons.compareValuesBy' call
|
|
460
|
-
var tmp = this$0.
|
|
461
|
-
var tmp$ret$1 = this$0.
|
|
530
|
+
var tmp = this$0.y1x(a);
|
|
531
|
+
var tmp$ret$1 = this$0.y1x(b);
|
|
462
532
|
return compareValues(tmp, tmp$ret$1);
|
|
463
533
|
};
|
|
464
534
|
}
|
|
535
|
+
function emit$emitInit(this$0, def) {
|
|
536
|
+
return 'from .' + this$0.wq(def.vq()) + ' import ' + this$0.wq(def.vq());
|
|
537
|
+
}
|
|
465
538
|
function PythonEmitter(packageName, emitShared) {
|
|
466
|
-
packageName = packageName === VOID ? Companion_instance.
|
|
467
|
-
emitShared = emitShared === VOID ? Companion_instance_0.
|
|
539
|
+
packageName = packageName === VOID ? Companion_instance.lr('community.flock.wirespec.generated') : packageName;
|
|
540
|
+
emitShared = emitShared === VOID ? Companion_instance_0.go() : emitShared;
|
|
468
541
|
LanguageEmitter.call(this);
|
|
469
|
-
this.
|
|
470
|
-
this.
|
|
471
|
-
this.
|
|
472
|
-
this.
|
|
473
|
-
this.
|
|
474
|
-
this.
|
|
475
|
-
}
|
|
476
|
-
protoOf(PythonEmitter).
|
|
477
|
-
return this.
|
|
542
|
+
this.s1x_1 = packageName;
|
|
543
|
+
this.t1x_1 = emitShared;
|
|
544
|
+
this.u1x_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';
|
|
545
|
+
this.v1x_1 = FileExtension_Python_getInstance();
|
|
546
|
+
this.w1x_1 = PythonShared_instance;
|
|
547
|
+
this.x1x_1 = '#';
|
|
548
|
+
}
|
|
549
|
+
protoOf(PythonEmitter).eq = function () {
|
|
550
|
+
return this.v1x_1;
|
|
478
551
|
};
|
|
479
|
-
protoOf(PythonEmitter).
|
|
480
|
-
return this.
|
|
552
|
+
protoOf(PythonEmitter).t1v = function () {
|
|
553
|
+
return this.w1x_1;
|
|
481
554
|
};
|
|
482
|
-
protoOf(PythonEmitter).
|
|
483
|
-
return this.
|
|
555
|
+
protoOf(PythonEmitter).fq = function () {
|
|
556
|
+
return this.x1x_1;
|
|
484
557
|
};
|
|
485
|
-
protoOf(PythonEmitter).
|
|
558
|
+
protoOf(PythonEmitter).y1x = function (definition) {
|
|
486
559
|
var tmp;
|
|
487
560
|
if (definition instanceof Enum) {
|
|
488
561
|
tmp = 1;
|
|
@@ -511,96 +584,89 @@ protoOf(PythonEmitter).e2c = function (definition) {
|
|
|
511
584
|
}
|
|
512
585
|
return tmp;
|
|
513
586
|
};
|
|
514
|
-
protoOf(PythonEmitter).
|
|
587
|
+
protoOf(PythonEmitter).tq = function (module_0, logger) {
|
|
515
588
|
// Inline function 'kotlin.collections.sortedBy' call
|
|
516
|
-
var this_0 = module_0.
|
|
589
|
+
var this_0 = new NonEmptyList(module_0.dq_1);
|
|
517
590
|
// Inline function 'kotlin.comparisons.compareBy' call
|
|
518
591
|
var tmp = PythonEmitter$emit$lambda(this);
|
|
519
592
|
var tmp$ret$0 = new sam$kotlin_Comparator$0(tmp);
|
|
520
593
|
var tmp$ret$1 = sortedWith(this_0, tmp$ret$0);
|
|
521
|
-
var
|
|
594
|
+
var tmp_0 = toNonEmptyListOrNull(tmp$ret$1);
|
|
595
|
+
var statements = ensureNotNull(tmp_0 == null ? null : new NonEmptyList(tmp_0)).yl_1;
|
|
522
596
|
// Inline function 'kotlin.let' call
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
var
|
|
526
|
-
var init = new Emitted(this.y2b_1.q26() + '__init__', 'from . import model\nfrom . import endpoint\nfrom . import wirespec\n');
|
|
527
|
-
var tmp_0 = this.y2b_1.q26() + 'endpoint/' + '__init__';
|
|
528
|
-
// Inline function 'kotlin.collections.map' call
|
|
597
|
+
var it = protoOf(LanguageEmitter).tq.call(this, module_0.wu(VOID, statements), logger);
|
|
598
|
+
var init = new Emitted(this.s1x_1.or() + '__init__', 'from . import model\nfrom . import endpoint\nfrom . import wirespec\n');
|
|
599
|
+
var tmp_1 = this.s1x_1.or() + 'endpoint/' + '__init__';
|
|
529
600
|
// Inline function 'kotlin.collections.filter' call
|
|
601
|
+
var tmp0 = new NonEmptyList(module_0.dq_1);
|
|
530
602
|
// Inline function 'kotlin.collections.filterTo' call
|
|
531
|
-
var this_1 = module_0.f25_1;
|
|
532
603
|
var destination = ArrayList_init_$Create$();
|
|
533
|
-
var
|
|
534
|
-
while (
|
|
535
|
-
var element =
|
|
536
|
-
// Inline function 'community.flock.wirespec.emitters.python.PythonEmitter.emit.<anonymous>.<anonymous>' call
|
|
604
|
+
var _iterator__ex2g4s = tmp0.t();
|
|
605
|
+
while (_iterator__ex2g4s.u()) {
|
|
606
|
+
var element = _iterator__ex2g4s.v();
|
|
537
607
|
if (element instanceof Endpoint) {
|
|
538
|
-
destination.
|
|
608
|
+
destination.x(element);
|
|
539
609
|
}
|
|
540
610
|
}
|
|
611
|
+
// Inline function 'kotlin.collections.map' call
|
|
541
612
|
// Inline function 'kotlin.collections.mapTo' call
|
|
542
613
|
var destination_0 = ArrayList_init_$Create$_0(collectionSizeOrDefault(destination, 10));
|
|
543
|
-
var
|
|
544
|
-
while (
|
|
545
|
-
var item =
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
var
|
|
551
|
-
var tmp_1 = this.y2b_1.q26() + 'model/' + '__init__';
|
|
552
|
-
// Inline function 'kotlin.collections.map' call
|
|
614
|
+
var _iterator__ex2g4s_0 = destination.t();
|
|
615
|
+
while (_iterator__ex2g4s_0.u()) {
|
|
616
|
+
var item = _iterator__ex2g4s_0.v();
|
|
617
|
+
var tmp$ret$5 = emit$emitInit(this, item);
|
|
618
|
+
destination_0.x(tmp$ret$5);
|
|
619
|
+
}
|
|
620
|
+
var initEndpoint = new Emitted(tmp_1, joinToString(destination_0, '\n'));
|
|
621
|
+
var tmp_2 = this.s1x_1.or() + 'model/' + '__init__';
|
|
553
622
|
// Inline function 'kotlin.collections.filter' call
|
|
623
|
+
var tmp0_0 = new NonEmptyList(module_0.dq_1);
|
|
554
624
|
// Inline function 'kotlin.collections.filterTo' call
|
|
555
|
-
var this_2 = module_0.f25_1;
|
|
556
625
|
var destination_1 = ArrayList_init_$Create$();
|
|
557
|
-
var
|
|
558
|
-
while (
|
|
559
|
-
var element_0 =
|
|
560
|
-
// Inline function 'community.flock.wirespec.emitters.python.PythonEmitter.emit.<anonymous>.<anonymous>' call
|
|
626
|
+
var _iterator__ex2g4s_1 = tmp0_0.t();
|
|
627
|
+
while (_iterator__ex2g4s_1.u()) {
|
|
628
|
+
var element_0 = _iterator__ex2g4s_1.v();
|
|
561
629
|
if (isInterface(element_0, Model)) {
|
|
562
|
-
destination_1.
|
|
630
|
+
destination_1.x(element_0);
|
|
563
631
|
}
|
|
564
632
|
}
|
|
633
|
+
// Inline function 'kotlin.collections.map' call
|
|
565
634
|
// Inline function 'kotlin.collections.mapTo' call
|
|
566
635
|
var destination_2 = ArrayList_init_$Create$_0(collectionSizeOrDefault(destination_1, 10));
|
|
567
|
-
var
|
|
568
|
-
while (
|
|
569
|
-
var item_0 =
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
var
|
|
575
|
-
|
|
576
|
-
return this.z2b_1.j23_1 ? it.vk(init).vk(initEndpoint).vk(initModel).vk(shared) : it.vk(init);
|
|
636
|
+
var _iterator__ex2g4s_2 = destination_1.t();
|
|
637
|
+
while (_iterator__ex2g4s_2.u()) {
|
|
638
|
+
var item_0 = _iterator__ex2g4s_2.v();
|
|
639
|
+
var tmp$ret$11 = emit$emitInit(this, item_0);
|
|
640
|
+
destination_2.x(tmp$ret$11);
|
|
641
|
+
}
|
|
642
|
+
var initModel = new Emitted(tmp_2, joinToString(destination_2, '\n'));
|
|
643
|
+
var shared = new Emitted(this.s1x_1.or() + 'wirespec', this.t1v().a1y_1);
|
|
644
|
+
return this.t1x_1.ho_1 ? NonEmptyList__plus_impl_xqmb9(NonEmptyList__plus_impl_xqmb9(NonEmptyList__plus_impl_xqmb9(NonEmptyList__plus_impl_xqmb9(it, init), initEndpoint), initModel), shared) : NonEmptyList__plus_impl_xqmb9(it, init);
|
|
577
645
|
};
|
|
578
|
-
protoOf(PythonEmitter).
|
|
579
|
-
var subPackageName =
|
|
646
|
+
protoOf(PythonEmitter).uq = function (definition, module_0, logger) {
|
|
647
|
+
var subPackageName = plus_0(this.s1x_1, definition);
|
|
580
648
|
// Inline function 'kotlin.let' call
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
var it = protoOf(LanguageEmitter).w25.call(this, definition, module_0, logger);
|
|
584
|
-
var tmp = subPackageName.q26() + it.k23_1;
|
|
649
|
+
var it = protoOf(LanguageEmitter).uq.call(this, definition, module_0, logger);
|
|
650
|
+
var tmp = subPackageName.or() + it.io_1;
|
|
585
651
|
// Inline function 'kotlin.text.trimStart' call
|
|
586
|
-
var this_0 = trimMargin('\n |' + this.
|
|
652
|
+
var this_0 = trimMargin('\n |' + this.u1x_1 + '\n |' + it.jo_1 + '\n ');
|
|
587
653
|
var tmp$ret$0 = toString(trimStart(isCharSequence(this_0) ? this_0 : THROW_CCE()));
|
|
588
654
|
return new Emitted(tmp, tmp$ret$0);
|
|
589
655
|
};
|
|
590
|
-
function emitToRawRequest(
|
|
591
|
-
var tmp = $this.
|
|
656
|
+
function emitToRawRequest($this, _this__u8e3s4, endpoint) {
|
|
657
|
+
var tmp = $this.wq(endpoint.ep_1);
|
|
592
658
|
var tmp_0 = Spacer_instance.toString();
|
|
593
659
|
var tmp_1 = Spacer_instance.toString();
|
|
594
660
|
var tmp_2 = Spacer_instance.toString();
|
|
595
|
-
var tmp_3 = joinToString(endpoint.
|
|
661
|
+
var tmp_3 = joinToString(endpoint.gp_1, VOID, VOID, VOID, VOID, VOID, PythonEndpointDefinitionEmitter$emitToRawRequest$lambda($this));
|
|
596
662
|
var tmp_4 = Spacer_instance.toString();
|
|
597
663
|
var tmp_5 = Spacer_instance.toString();
|
|
598
664
|
var tmp_6 = Spacer_instance.toString();
|
|
599
665
|
var tmp_7 = Spacer_instance.toString();
|
|
600
666
|
var tmp_8;
|
|
601
667
|
// Inline function 'kotlin.collections.isNotEmpty' call
|
|
602
|
-
if (!endpoint.
|
|
603
|
-
tmp_8 = prependIndent(joinToString(endpoint.
|
|
668
|
+
if (!endpoint.hp_1.r()) {
|
|
669
|
+
tmp_8 = prependIndent(joinToString(endpoint.hp_1, ',\n', VOID, VOID, VOID, VOID, PythonEndpointDefinitionEmitter$emitToRawRequest$lambda_0($this)), Spacer_instance.qr(3));
|
|
604
670
|
} else {
|
|
605
671
|
tmp_8 = '';
|
|
606
672
|
}
|
|
@@ -611,8 +677,8 @@ function emitToRawRequest(_this__u8e3s4, $this, endpoint) {
|
|
|
611
677
|
var tmp_13 = Spacer_instance.toString();
|
|
612
678
|
var tmp_14;
|
|
613
679
|
// Inline function 'kotlin.collections.isNotEmpty' call
|
|
614
|
-
if (!endpoint.
|
|
615
|
-
tmp_14 = prependIndent(joinToString(endpoint.
|
|
680
|
+
if (!endpoint.ip_1.r()) {
|
|
681
|
+
tmp_14 = prependIndent(joinToString(endpoint.ip_1, ',\n', VOID, VOID, VOID, VOID, PythonEndpointDefinitionEmitter$emitToRawRequest$lambda_1($this)), Spacer_instance.qr(3));
|
|
616
682
|
} else {
|
|
617
683
|
tmp_14 = '';
|
|
618
684
|
}
|
|
@@ -621,282 +687,267 @@ function emitToRawRequest(_this__u8e3s4, $this, endpoint) {
|
|
|
621
687
|
var tmp_17 = Spacer_instance.toString();
|
|
622
688
|
var tmp_18 = Spacer_instance.toString();
|
|
623
689
|
var tmp_19 = Spacer_instance.toString();
|
|
624
|
-
var tmp0_safe_receiver = _this__u8e3s4.
|
|
625
|
-
var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.
|
|
626
|
-
var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : $this.
|
|
690
|
+
var tmp0_safe_receiver = _this__u8e3s4.np_1;
|
|
691
|
+
var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.pp_1;
|
|
692
|
+
var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : $this.d1y(tmp1_safe_receiver);
|
|
627
693
|
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 = {\n |' + tmp_9 + '\n |' + tmp_10 + tmp_11 + '},\n |' + tmp_12 + tmp_13 + 'headers = {\n |' + tmp_15 + '\n |' + tmp_16 + tmp_17 + '},\n |' + tmp_18 + tmp_19 + 'body = serialization.serialize(request.body, ' + (tmp2_elvis_lhs == null ? 'type(None)' : tmp2_elvis_lhs) + '),\n |' + Spacer_instance.toString() + ')\n |\n ');
|
|
628
694
|
}
|
|
629
|
-
function emitFromRawRequest(
|
|
630
|
-
return trimMargin("\n |@staticmethod\n |def from_raw_request(serialization: Wirespec.Deserializer, request: Wirespec.RawRequest) -> '" + $this.
|
|
695
|
+
function emitFromRawRequest($this, _this__u8e3s4, endpoint) {
|
|
696
|
+
return trimMargin("\n |@staticmethod\n |def from_raw_request(serialization: Wirespec.Deserializer, request: Wirespec.RawRequest) -> '" + $this.wq(endpoint.ep_1) + ".Request':\n |" + Spacer_instance.toString() + 'return ' + $this.wq(endpoint.ep_1) + '.Request' + emitDeserializedParams($this, _this__u8e3s4, endpoint) + '\n |\n ');
|
|
631
697
|
}
|
|
632
|
-
function emitDeserializedParams(
|
|
633
|
-
// Inline function 'kotlin.let' call
|
|
698
|
+
function emitDeserializedParams($this, _this__u8e3s4, endpoint) {
|
|
634
699
|
var tmp = get_indexedPathParams(endpoint);
|
|
635
700
|
var tmp_0 = orNull(joinToString(tmp, VOID, VOID, VOID, VOID, VOID, PythonEndpointDefinitionEmitter$emitDeserializedParams$lambda($this)));
|
|
636
|
-
var tmp_1 = orNull(joinToString(endpoint.
|
|
637
|
-
var tmp_2 = orNull(joinToString(endpoint.
|
|
638
|
-
var tmp0_safe_receiver = _this__u8e3s4.
|
|
701
|
+
var tmp_1 = orNull(joinToString(endpoint.hp_1, ',\n', VOID, VOID, VOID, VOID, PythonEndpointDefinitionEmitter$emitDeserializedParams$lambda_0($this)));
|
|
702
|
+
var tmp_2 = orNull(joinToString(endpoint.ip_1, ',\n', VOID, VOID, VOID, VOID, PythonEndpointDefinitionEmitter$emitDeserializedParams$lambda_1($this)));
|
|
703
|
+
var tmp0_safe_receiver = _this__u8e3s4.np_1;
|
|
639
704
|
var tmp_3;
|
|
640
705
|
if (tmp0_safe_receiver == null) {
|
|
641
706
|
tmp_3 = null;
|
|
642
707
|
} else {
|
|
643
708
|
// Inline function 'kotlin.let' call
|
|
644
|
-
|
|
645
|
-
// Inline function 'community.flock.wirespec.emitters.python.PythonEndpointDefinitionEmitter.emitDeserializedParams.<anonymous>' call
|
|
646
|
-
tmp_3 = Spacer_instance.s26(3) + 'body = serialization.deserialize(request.body, ' + $this.j2c(tmp0_safe_receiver.r24_1) + '),';
|
|
709
|
+
tmp_3 = Spacer_instance.qr(3) + 'body = serialization.deserialize(request.body, ' + $this.d1y(tmp0_safe_receiver.pp_1) + '),';
|
|
647
710
|
}
|
|
648
|
-
// Inline function 'kotlin.
|
|
649
|
-
// Inline function 'community.flock.wirespec.emitters.python.PythonEndpointDefinitionEmitter.emitDeserializedParams.<anonymous>' call
|
|
711
|
+
// Inline function 'kotlin.let' call
|
|
650
712
|
var it = joinToString(listOfNotNull([tmp_0, tmp_1, tmp_2, tmp_3]), ',\n');
|
|
651
713
|
return isBlank(it) ? '()' : '(\n' + it + '\n)';
|
|
652
714
|
}
|
|
653
|
-
function emitResponseUnion(
|
|
654
|
-
return trimMargin('\n |Response = ' + joinToString(_this__u8e3s4.
|
|
715
|
+
function emitResponseUnion($this, _this__u8e3s4) {
|
|
716
|
+
return trimMargin('\n |Response = ' + joinToString(_this__u8e3s4.kp_1, ' | ', VOID, VOID, VOID, VOID, PythonEndpointDefinitionEmitter$emitResponseUnion$lambda) + '\n |\n ');
|
|
655
717
|
}
|
|
656
|
-
function emitHandleClass(
|
|
657
|
-
return trimMargin('\n |class Handler(Wirespec.Endpoint.Handler):\n |' + Spacer_instance.toString() + '@abstractmethod\n |' + Spacer_instance.toString() + 'def ' + _this__u8e3s4.
|
|
718
|
+
function emitHandleClass($this, _this__u8e3s4) {
|
|
719
|
+
return trimMargin('\n |class Handler(Wirespec.Endpoint.Handler):\n |' + Spacer_instance.toString() + '@abstractmethod\n |' + Spacer_instance.toString() + 'def ' + _this__u8e3s4.ep_1.l1() + "(self, req: '" + $this.wq(_this__u8e3s4.ep_1) + ".Request') -> '" + $this.wq(_this__u8e3s4.ep_1) + ".Response': pass\n |\n ");
|
|
658
720
|
}
|
|
659
|
-
function emitConvertClass(
|
|
660
|
-
return trimMargin('\n |class Convert(Wirespec.Endpoint.Convert[Request, Response]):\n |' + spacer(emitToRawRequest(first(_this__u8e3s4.
|
|
721
|
+
function emitConvertClass($this, _this__u8e3s4) {
|
|
722
|
+
return trimMargin('\n |class Convert(Wirespec.Endpoint.Convert[Request, Response]):\n |' + spacer(emitToRawRequest($this, first(_this__u8e3s4.jp_1), _this__u8e3s4), 1) + '\n |' + spacer(emitFromRawRequest($this, first(_this__u8e3s4.jp_1), _this__u8e3s4), 1) + '\n |' + spacer(emitToRawResponse($this, _this__u8e3s4), 1) + '\n |' + spacer(emitFromRawResponse($this, _this__u8e3s4), 1) + '\n |\n ');
|
|
661
723
|
}
|
|
662
|
-
function
|
|
663
|
-
return $this.
|
|
724
|
+
function emit_16($this, _this__u8e3s4) {
|
|
725
|
+
return $this.wq(_this__u8e3s4.jq_1) + ': ' + $this.xp(_this__u8e3s4.kq_1);
|
|
664
726
|
}
|
|
665
|
-
function emitAssignSelf(
|
|
666
|
-
return $this.
|
|
727
|
+
function emitAssignSelf($this, _this__u8e3s4) {
|
|
728
|
+
return $this.wq(_this__u8e3s4.jq_1) + ' = ' + $this.wq(_this__u8e3s4.jq_1);
|
|
667
729
|
}
|
|
668
|
-
function emitAssignSelf_0(
|
|
669
|
-
var tmp = $this.
|
|
730
|
+
function emitAssignSelf_0($this, _this__u8e3s4, endpoint) {
|
|
731
|
+
var tmp = $this.wq(endpoint.ep_1);
|
|
670
732
|
// Inline function 'kotlin.collections.filter' call
|
|
733
|
+
var tmp0 = paramList(_this__u8e3s4, endpoint);
|
|
671
734
|
// Inline function 'kotlin.collections.filterTo' call
|
|
672
|
-
var this_0 = paramList(_this__u8e3s4, endpoint);
|
|
673
735
|
var destination = ArrayList_init_$Create$();
|
|
674
|
-
var
|
|
675
|
-
while (
|
|
676
|
-
var element =
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
destination.e(element);
|
|
736
|
+
var _iterator__ex2g4s = tmp0.t();
|
|
737
|
+
while (_iterator__ex2g4s.u()) {
|
|
738
|
+
var element = _iterator__ex2g4s.v();
|
|
739
|
+
if (element.iq_1.equals(ParamType_PATH_getInstance())) {
|
|
740
|
+
destination.x(element);
|
|
680
741
|
}
|
|
681
742
|
}
|
|
682
743
|
var tmp_0 = destination;
|
|
683
744
|
var tmp_1 = joinToString(tmp_0, VOID, VOID, VOID, VOID, VOID, PythonEndpointDefinitionEmitter$emitAssignSelf$lambda($this));
|
|
684
|
-
var tmp_2 = $this.
|
|
745
|
+
var tmp_2 = $this.wq(endpoint.ep_1);
|
|
685
746
|
// Inline function 'kotlin.collections.filter' call
|
|
747
|
+
var tmp0_0 = paramList(_this__u8e3s4, endpoint);
|
|
686
748
|
// Inline function 'kotlin.collections.filterTo' call
|
|
687
|
-
var this_1 = paramList(_this__u8e3s4, endpoint);
|
|
688
749
|
var destination_0 = ArrayList_init_$Create$();
|
|
689
|
-
var
|
|
690
|
-
while (
|
|
691
|
-
var element_0 =
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
destination_0.e(element_0);
|
|
750
|
+
var _iterator__ex2g4s_0 = tmp0_0.t();
|
|
751
|
+
while (_iterator__ex2g4s_0.u()) {
|
|
752
|
+
var element_0 = _iterator__ex2g4s_0.v();
|
|
753
|
+
if (element_0.iq_1.equals(ParamType_QUERY_getInstance())) {
|
|
754
|
+
destination_0.x(element_0);
|
|
695
755
|
}
|
|
696
756
|
}
|
|
697
757
|
var tmp_3 = destination_0;
|
|
698
758
|
var tmp_4 = spacer(joinToString(tmp_3, ',\n', VOID, VOID, VOID, VOID, PythonEndpointDefinitionEmitter$emitAssignSelf$lambda_0($this)), 1);
|
|
699
|
-
var tmp_5 = $this.
|
|
759
|
+
var tmp_5 = $this.wq(endpoint.ep_1);
|
|
700
760
|
// Inline function 'kotlin.collections.filter' call
|
|
761
|
+
var tmp0_1 = paramList(_this__u8e3s4, endpoint);
|
|
701
762
|
// Inline function 'kotlin.collections.filterTo' call
|
|
702
|
-
var this_2 = paramList(_this__u8e3s4, endpoint);
|
|
703
763
|
var destination_1 = ArrayList_init_$Create$();
|
|
704
|
-
var
|
|
705
|
-
while (
|
|
706
|
-
var element_1 =
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
destination_1.e(element_1);
|
|
764
|
+
var _iterator__ex2g4s_1 = tmp0_1.t();
|
|
765
|
+
while (_iterator__ex2g4s_1.u()) {
|
|
766
|
+
var element_1 = _iterator__ex2g4s_1.v();
|
|
767
|
+
if (element_1.iq_1.equals(ParamType_HEADER_getInstance())) {
|
|
768
|
+
destination_1.x(element_1);
|
|
710
769
|
}
|
|
711
770
|
}
|
|
712
771
|
var tmp_6 = destination_1;
|
|
713
772
|
var tmp_7 = spacer(joinToString(tmp_6, ',\n', VOID, VOID, VOID, VOID, PythonEndpointDefinitionEmitter$emitAssignSelf$lambda_1($this)), 1);
|
|
714
773
|
var tmp_8;
|
|
715
|
-
if (_this__u8e3s4.
|
|
774
|
+
if (_this__u8e3s4.np_1 == null) {
|
|
716
775
|
tmp_8 = null;
|
|
717
776
|
} else {
|
|
718
777
|
// Inline function 'kotlin.let' call
|
|
719
|
-
// Inline function 'kotlin.contracts.contract' call
|
|
720
|
-
// Inline function 'community.flock.wirespec.emitters.python.PythonEndpointDefinitionEmitter.emitAssignSelf.<anonymous>' call
|
|
721
778
|
tmp_8 = 'body';
|
|
722
779
|
}
|
|
723
780
|
var tmp1_elvis_lhs = tmp_8;
|
|
724
781
|
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 ');
|
|
725
782
|
}
|
|
726
|
-
function emitAssignSelf_1(
|
|
727
|
-
var tmp = $this.
|
|
783
|
+
function emitAssignSelf_1($this, _this__u8e3s4, endpoint) {
|
|
784
|
+
var tmp = $this.wq(endpoint.ep_1);
|
|
728
785
|
// Inline function 'kotlin.collections.filter' call
|
|
786
|
+
var tmp0 = paramList_0(_this__u8e3s4);
|
|
729
787
|
// Inline function 'kotlin.collections.filterTo' call
|
|
730
|
-
var this_0 = paramList_0(_this__u8e3s4);
|
|
731
788
|
var destination = ArrayList_init_$Create$();
|
|
732
|
-
var
|
|
733
|
-
while (
|
|
734
|
-
var element =
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
destination.e(element);
|
|
789
|
+
var _iterator__ex2g4s = tmp0.t();
|
|
790
|
+
while (_iterator__ex2g4s.u()) {
|
|
791
|
+
var element = _iterator__ex2g4s.v();
|
|
792
|
+
if (element.iq_1.equals(ParamType_HEADER_getInstance())) {
|
|
793
|
+
destination.x(element);
|
|
738
794
|
}
|
|
739
795
|
}
|
|
740
796
|
var tmp_0 = destination;
|
|
741
797
|
var tmp_1 = spacer(joinToString(tmp_0, ',\n', VOID, VOID, VOID, VOID, PythonEndpointDefinitionEmitter$emitAssignSelf$lambda_2($this)), 1);
|
|
742
798
|
var tmp_2;
|
|
743
|
-
if (_this__u8e3s4.
|
|
799
|
+
if (_this__u8e3s4.sp_1 == null) {
|
|
744
800
|
tmp_2 = null;
|
|
745
801
|
} else {
|
|
746
802
|
// Inline function 'kotlin.let' call
|
|
747
|
-
// Inline function 'kotlin.contracts.contract' call
|
|
748
|
-
// Inline function 'community.flock.wirespec.emitters.python.PythonEndpointDefinitionEmitter.emitAssignSelf.<anonymous>' call
|
|
749
803
|
tmp_2 = 'body';
|
|
750
804
|
}
|
|
751
805
|
var tmp1_elvis_lhs = tmp_2;
|
|
752
|
-
return trimMargin('\n |self._headers = ' + tmp + '.Response' + _this__u8e3s4.
|
|
806
|
+
return trimMargin('\n |self._headers = ' + tmp + '.Response' + _this__u8e3s4.qp_1 + '.Headers(' + tmp_1 + ')\n |self._body = ' + (tmp1_elvis_lhs == null ? 'None' : tmp1_elvis_lhs) + '\n ');
|
|
753
807
|
}
|
|
754
|
-
function emitDeserialized(
|
|
755
|
-
return Spacer_instance.
|
|
808
|
+
function emitDeserialized($this, _this__u8e3s4) {
|
|
809
|
+
return Spacer_instance.qr(3) + $this.wq(_this__u8e3s4.me_1.lp_1) + ' = serialization.deserialize(request.path[' + _this__u8e3s4.le_1 + '], ' + $this.d1y(_this__u8e3s4.me_1.mp_1) + ')';
|
|
756
810
|
}
|
|
757
|
-
function emitDeserializedParams_0(
|
|
811
|
+
function emitDeserializedParams_0($this, _this__u8e3s4, type, fields, spaces, caseSensitive) {
|
|
758
812
|
var tmp;
|
|
759
813
|
if (caseSensitive) {
|
|
760
|
-
tmp = Spacer_instance.
|
|
814
|
+
tmp = Spacer_instance.qr(spaces) + $this.wq(_this__u8e3s4.ap_1) + ' = serialization.deserialize_param(' + type + '.' + fields + '.get("' + _this__u8e3s4.ap_1.l1() + '"), ' + $this.d1y(_this__u8e3s4.bp_1) + ')';
|
|
761
815
|
} else {
|
|
762
|
-
var tmp_0 = Spacer_instance.
|
|
763
|
-
var tmp_1 = $this.
|
|
816
|
+
var tmp_0 = Spacer_instance.qr(spaces);
|
|
817
|
+
var tmp_1 = $this.wq(_this__u8e3s4.ap_1);
|
|
764
818
|
// Inline function 'kotlin.text.lowercase' call
|
|
765
819
|
// Inline function 'kotlin.js.asDynamic' call
|
|
766
|
-
tmp = tmp_0 + tmp_1 + ' = serialization.deserialize_param(next((v for k, v in ' + type + '.' + fields + '.items() if k.lower() == "' + _this__u8e3s4.
|
|
820
|
+
tmp = tmp_0 + tmp_1 + ' = serialization.deserialize_param(next((v for k, v in ' + type + '.' + fields + '.items() if k.lower() == "' + _this__u8e3s4.ap_1.l1().toLowerCase() + '"), None), ' + $this.d1y(_this__u8e3s4.bp_1) + ')';
|
|
767
821
|
}
|
|
768
822
|
return tmp;
|
|
769
823
|
}
|
|
770
|
-
function emitDeserializedParams$default(
|
|
824
|
+
function emitDeserializedParams$default($this, _this__u8e3s4, type, fields, spaces, caseSensitive, $super) {
|
|
771
825
|
spaces = spaces === VOID ? 3 : spaces;
|
|
772
826
|
caseSensitive = caseSensitive === VOID ? true : caseSensitive;
|
|
773
|
-
return emitDeserializedParams_0(
|
|
827
|
+
return emitDeserializedParams_0($this, _this__u8e3s4, type, fields, spaces, caseSensitive);
|
|
774
828
|
}
|
|
775
|
-
function emitToRawResponse(
|
|
776
|
-
var tmp = $this.
|
|
829
|
+
function emitToRawResponse($this, _this__u8e3s4) {
|
|
830
|
+
var tmp = $this.wq(_this__u8e3s4.ep_1);
|
|
777
831
|
var tmp_0 = Spacer_instance.toString();
|
|
778
|
-
var tmp_1 = distinctByStatus(_this__u8e3s4.
|
|
832
|
+
var tmp_1 = distinctByStatus(_this__u8e3s4.kp_1);
|
|
779
833
|
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 ');
|
|
780
834
|
}
|
|
781
|
-
function emitFromRawResponse(
|
|
782
|
-
var tmp = $this.
|
|
835
|
+
function emitFromRawResponse($this, _this__u8e3s4) {
|
|
836
|
+
var tmp = $this.wq(_this__u8e3s4.ep_1);
|
|
783
837
|
var tmp_0 = Spacer_instance.toString();
|
|
784
838
|
// Inline function 'kotlin.collections.filter' call
|
|
839
|
+
var tmp0 = distinctByStatus(_this__u8e3s4.kp_1);
|
|
785
840
|
// Inline function 'kotlin.collections.filterTo' call
|
|
786
|
-
var this_0 = distinctByStatus(_this__u8e3s4.m24_1);
|
|
787
841
|
var destination = ArrayList_init_$Create$();
|
|
788
|
-
var
|
|
789
|
-
while (
|
|
790
|
-
var element =
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
destination.e(element);
|
|
842
|
+
var _iterator__ex2g4s = tmp0.t();
|
|
843
|
+
while (_iterator__ex2g4s.u()) {
|
|
844
|
+
var element = _iterator__ex2g4s.v();
|
|
845
|
+
if (Companion_instance_1.rq(element.qp_1)) {
|
|
846
|
+
destination.x(element);
|
|
794
847
|
}
|
|
795
848
|
}
|
|
796
849
|
var tmp_1 = destination;
|
|
797
|
-
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.
|
|
798
|
-
}
|
|
799
|
-
function emitDeserialized_0(
|
|
800
|
-
var tmp = 'case ' + _this__u8e3s4.
|
|
801
|
-
var tmp_0 = Spacer_instance.toString() + 'return ' + $this.
|
|
802
|
-
var tmp_1 = Spacer_instance.
|
|
803
|
-
var tmp0_safe_receiver = _this__u8e3s4.
|
|
804
|
-
var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.
|
|
805
|
-
var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : $this.
|
|
850
|
+
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.qr(2) + 'case _:\n |' + Spacer_instance.qr(3) + 'raise Exception("Cannot match response with status: " + str(response.status_code))\n |\n ');
|
|
851
|
+
}
|
|
852
|
+
function emitDeserialized_0($this, _this__u8e3s4, endpoint) {
|
|
853
|
+
var tmp = 'case ' + _this__u8e3s4.qp_1 + ':';
|
|
854
|
+
var tmp_0 = Spacer_instance.toString() + 'return ' + $this.wq(endpoint.ep_1) + '.Response' + _this__u8e3s4.qp_1 + '(';
|
|
855
|
+
var tmp_1 = Spacer_instance.qr(2);
|
|
856
|
+
var tmp0_safe_receiver = _this__u8e3s4.sp_1;
|
|
857
|
+
var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.pp_1;
|
|
858
|
+
var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : $this.d1y(tmp1_safe_receiver);
|
|
806
859
|
var tmp_2 = tmp_1 + 'body = serialization.deserialize(response.body, ' + (tmp2_elvis_lhs == null ? 'type(None)' : tmp2_elvis_lhs) + '),';
|
|
807
|
-
return joinToString(listOfNotNull([tmp, tmp_0, tmp_2, orNull(joinToString(_this__u8e3s4.
|
|
860
|
+
return joinToString(listOfNotNull([tmp, tmp_0, tmp_2, orNull(joinToString(_this__u8e3s4.rp_1, ',\n', VOID, VOID, VOID, VOID, PythonEndpointDefinitionEmitter$emitDeserialized$lambda($this))), Spacer_instance.toString() + ')']), '\n');
|
|
808
861
|
}
|
|
809
|
-
function emitSerialized(
|
|
810
|
-
var tmp = $this.
|
|
811
|
-
var tmp_0 = Spacer_instance.
|
|
812
|
-
var tmp_1 = Spacer_instance.
|
|
813
|
-
var tmp_2 = Spacer_instance.
|
|
862
|
+
function emitSerialized($this, _this__u8e3s4, endpoint) {
|
|
863
|
+
var tmp = $this.wq(endpoint.ep_1);
|
|
864
|
+
var tmp_0 = Spacer_instance.qr(1);
|
|
865
|
+
var tmp_1 = Spacer_instance.qr(2);
|
|
866
|
+
var tmp_2 = Spacer_instance.qr(2);
|
|
814
867
|
var tmp_3;
|
|
815
868
|
// Inline function 'kotlin.collections.isNotEmpty' call
|
|
816
|
-
if (!_this__u8e3s4.
|
|
817
|
-
tmp_3 = joinToString(_this__u8e3s4.
|
|
869
|
+
if (!_this__u8e3s4.rp_1.r()) {
|
|
870
|
+
tmp_3 = joinToString(_this__u8e3s4.rp_1, ', ', '{', '}', VOID, VOID, PythonEndpointDefinitionEmitter$emitSerialized$lambda($this));
|
|
818
871
|
} else {
|
|
819
872
|
tmp_3 = '{}';
|
|
820
873
|
}
|
|
821
874
|
var tmp_4 = tmp_3;
|
|
822
|
-
var tmp_5 = Spacer_instance.
|
|
823
|
-
var tmp0_safe_receiver = _this__u8e3s4.
|
|
875
|
+
var tmp_5 = Spacer_instance.qr(2);
|
|
876
|
+
var tmp0_safe_receiver = _this__u8e3s4.sp_1;
|
|
824
877
|
var tmp_6;
|
|
825
878
|
if (tmp0_safe_receiver == null) {
|
|
826
879
|
tmp_6 = null;
|
|
827
880
|
} else {
|
|
828
881
|
// Inline function 'kotlin.let' call
|
|
829
|
-
|
|
830
|
-
// Inline function 'community.flock.wirespec.emitters.python.PythonEndpointDefinitionEmitter.emitSerialized.<anonymous>' call
|
|
831
|
-
tmp_6 = 'serialization.serialize(response.body, ' + $this.j2c(tmp0_safe_receiver.r24_1) + ')';
|
|
882
|
+
tmp_6 = 'serialization.serialize(response.body, ' + $this.d1y(tmp0_safe_receiver.pp_1) + ')';
|
|
832
883
|
}
|
|
833
884
|
var tmp1_elvis_lhs = tmp_6;
|
|
834
|
-
return trimMargin('\n |case ' + tmp + '.Response' + _this__u8e3s4.
|
|
885
|
+
return trimMargin('\n |case ' + tmp + '.Response' + _this__u8e3s4.qp_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.qr(1) + ')\n ');
|
|
835
886
|
}
|
|
836
|
-
function emitSerializedParams(
|
|
837
|
-
return '"' + _this__u8e3s4.
|
|
887
|
+
function emitSerializedParams($this, _this__u8e3s4, type, fields) {
|
|
888
|
+
return '"' + _this__u8e3s4.ap_1.l1() + '": serialization.serialize_param(' + type + '.' + fields + '.' + $this.wq(_this__u8e3s4.ap_1) + ', ' + $this.d1y(_this__u8e3s4.bp_1) + ')';
|
|
838
889
|
}
|
|
839
|
-
function emitObject(
|
|
890
|
+
function emitObject($this, _this__u8e3s4, name, extends_0, spaces, block) {
|
|
840
891
|
var tmp;
|
|
841
|
-
if (_this__u8e3s4.
|
|
842
|
-
tmp = trimMargin('\n |' + Spacer_instance.
|
|
892
|
+
if (_this__u8e3s4.r()) {
|
|
893
|
+
tmp = trimMargin('\n |' + Spacer_instance.qr(spaces) + '@dataclass\n |' + Spacer_instance.qr(spaces) + 'class ' + name + ' (' + extends_0 + '): pass\n ');
|
|
843
894
|
} else {
|
|
844
|
-
var tmp_0 = Spacer_instance.
|
|
845
|
-
var tmp_1 = Spacer_instance.
|
|
895
|
+
var tmp_0 = Spacer_instance.qr(spaces);
|
|
896
|
+
var tmp_1 = Spacer_instance.qr(spaces);
|
|
846
897
|
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 ');
|
|
847
898
|
}
|
|
848
899
|
return tmp;
|
|
849
900
|
}
|
|
850
|
-
function emitObject$default(
|
|
901
|
+
function emitObject$default($this, _this__u8e3s4, name, extends_0, spaces, block, $super) {
|
|
851
902
|
spaces = spaces === VOID ? 1 : spaces;
|
|
852
|
-
return emitObject(
|
|
903
|
+
return emitObject($this, _this__u8e3s4, name, extends_0, spaces, block);
|
|
853
904
|
}
|
|
854
|
-
function
|
|
855
|
-
return $this.
|
|
905
|
+
function emit_17($this, _this__u8e3s4) {
|
|
906
|
+
return $this.wq(_this__u8e3s4.lp_1) + ': ' + $this.xp(_this__u8e3s4.mp_1);
|
|
856
907
|
}
|
|
857
|
-
function
|
|
858
|
-
var tmp1_safe_receiver = _this__u8e3s4 == null ? null : _this__u8e3s4.
|
|
859
|
-
var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : $this.
|
|
908
|
+
function emit_18($this, _this__u8e3s4) {
|
|
909
|
+
var tmp1_safe_receiver = _this__u8e3s4 == null ? null : _this__u8e3s4.pp_1;
|
|
910
|
+
var tmp2_elvis_lhs = tmp1_safe_receiver == null ? null : $this.xp(tmp1_safe_receiver);
|
|
860
911
|
return tmp2_elvis_lhs == null ? 'None' : tmp2_elvis_lhs;
|
|
861
912
|
}
|
|
862
913
|
function PythonEndpointDefinitionEmitter$emit$lambda(this$0) {
|
|
863
914
|
return function (it) {
|
|
864
|
-
return this$0.
|
|
915
|
+
return this$0.e1y(it);
|
|
865
916
|
};
|
|
866
917
|
}
|
|
867
918
|
function PythonEndpointDefinitionEmitter$emit$lambda_0(this$0, $endpoint) {
|
|
868
919
|
return function (it) {
|
|
869
|
-
return this$0.
|
|
920
|
+
return this$0.c1y(it, $endpoint);
|
|
870
921
|
};
|
|
871
922
|
}
|
|
872
923
|
function PythonEndpointDefinitionEmitter$emit$lambda_1(this$0) {
|
|
873
924
|
return function (it) {
|
|
874
|
-
return
|
|
925
|
+
return emit_17(this$0, it);
|
|
875
926
|
};
|
|
876
927
|
}
|
|
877
928
|
function PythonEndpointDefinitionEmitter$emit$lambda_2(this$0) {
|
|
878
929
|
return function (it) {
|
|
879
|
-
return this$0.
|
|
930
|
+
return this$0.wp(it);
|
|
880
931
|
};
|
|
881
932
|
}
|
|
882
933
|
function PythonEndpointDefinitionEmitter$emit$lambda_3(this$0) {
|
|
883
934
|
return function (it) {
|
|
884
|
-
return this$0.
|
|
935
|
+
return this$0.wp(it);
|
|
885
936
|
};
|
|
886
937
|
}
|
|
887
938
|
function PythonEndpointDefinitionEmitter$emit$lambda_4(this$0) {
|
|
888
939
|
return function (it) {
|
|
889
|
-
return
|
|
940
|
+
return emit_16(this$0, it);
|
|
890
941
|
};
|
|
891
942
|
}
|
|
892
943
|
function PythonEndpointDefinitionEmitter$emitToRawRequest$lambda(this$0) {
|
|
893
944
|
return function (it) {
|
|
894
945
|
var tmp;
|
|
895
946
|
if (it instanceof Literal) {
|
|
896
|
-
tmp = '"' + it.
|
|
947
|
+
tmp = '"' + it.hq_1 + '"';
|
|
897
948
|
} else {
|
|
898
949
|
if (it instanceof Param) {
|
|
899
|
-
tmp = 'str(request.path.' + this$0.
|
|
950
|
+
tmp = 'str(request.path.' + this$0.wq(it.lp_1) + ')';
|
|
900
951
|
} else {
|
|
901
952
|
noWhenBranchMatchedException();
|
|
902
953
|
}
|
|
@@ -906,105 +957,95 @@ function PythonEndpointDefinitionEmitter$emitToRawRequest$lambda(this$0) {
|
|
|
906
957
|
}
|
|
907
958
|
function PythonEndpointDefinitionEmitter$emitToRawRequest$lambda_0(this$0) {
|
|
908
959
|
return function (it) {
|
|
909
|
-
return emitSerializedParams(
|
|
960
|
+
return emitSerializedParams(this$0, it, 'request', 'queries');
|
|
910
961
|
};
|
|
911
962
|
}
|
|
912
963
|
function PythonEndpointDefinitionEmitter$emitToRawRequest$lambda_1(this$0) {
|
|
913
964
|
return function (it) {
|
|
914
|
-
return emitSerializedParams(
|
|
965
|
+
return emitSerializedParams(this$0, it, 'request', 'headers');
|
|
915
966
|
};
|
|
916
967
|
}
|
|
917
968
|
function PythonEndpointDefinitionEmitter$emitDeserializedParams$lambda(this$0) {
|
|
918
969
|
return function (it) {
|
|
919
|
-
return emitDeserialized(
|
|
970
|
+
return emitDeserialized(this$0, it);
|
|
920
971
|
};
|
|
921
972
|
}
|
|
922
973
|
function PythonEndpointDefinitionEmitter$emitDeserializedParams$lambda_0(this$0) {
|
|
923
974
|
return function (it) {
|
|
924
|
-
return emitDeserializedParams$default(
|
|
975
|
+
return emitDeserializedParams$default(this$0, it, 'request', 'queries');
|
|
925
976
|
};
|
|
926
977
|
}
|
|
927
978
|
function PythonEndpointDefinitionEmitter$emitDeserializedParams$lambda_1(this$0) {
|
|
928
979
|
return function (it) {
|
|
929
|
-
return emitDeserializedParams$default(
|
|
980
|
+
return emitDeserializedParams$default(this$0, it, 'request', 'headers', VOID, false);
|
|
930
981
|
};
|
|
931
982
|
}
|
|
932
983
|
function PythonEndpointDefinitionEmitter$emitResponseUnion$lambda(it) {
|
|
933
|
-
return 'Response' + it.
|
|
984
|
+
return 'Response' + it.qp_1;
|
|
934
985
|
}
|
|
935
986
|
function PythonEndpointDefinitionEmitter$emitAssignSelf$lambda(this$0) {
|
|
936
987
|
return function (it) {
|
|
937
|
-
return emitAssignSelf(
|
|
988
|
+
return emitAssignSelf(this$0, it);
|
|
938
989
|
};
|
|
939
990
|
}
|
|
940
991
|
function PythonEndpointDefinitionEmitter$emitAssignSelf$lambda_0(this$0) {
|
|
941
992
|
return function (it) {
|
|
942
|
-
return emitAssignSelf(
|
|
993
|
+
return emitAssignSelf(this$0, it);
|
|
943
994
|
};
|
|
944
995
|
}
|
|
945
996
|
function PythonEndpointDefinitionEmitter$emitAssignSelf$lambda_1(this$0) {
|
|
946
997
|
return function (it) {
|
|
947
|
-
return emitAssignSelf(
|
|
998
|
+
return emitAssignSelf(this$0, it);
|
|
948
999
|
};
|
|
949
1000
|
}
|
|
950
1001
|
function PythonEndpointDefinitionEmitter$emitAssignSelf$lambda_2(this$0) {
|
|
951
1002
|
return function (it) {
|
|
952
|
-
return emitAssignSelf(
|
|
1003
|
+
return emitAssignSelf(this$0, it);
|
|
953
1004
|
};
|
|
954
1005
|
}
|
|
955
1006
|
function PythonEndpointDefinitionEmitter$emit$lambda_5(this$0) {
|
|
956
1007
|
return function (it) {
|
|
957
|
-
return this$0.
|
|
1008
|
+
return this$0.wp(it);
|
|
958
1009
|
};
|
|
959
1010
|
}
|
|
960
1011
|
function PythonEndpointDefinitionEmitter$emit$lambda_6(this$0) {
|
|
961
1012
|
return function (it) {
|
|
962
|
-
return
|
|
1013
|
+
return emit_16(this$0, it);
|
|
963
1014
|
};
|
|
964
1015
|
}
|
|
965
1016
|
function PythonEndpointDefinitionEmitter$emitToRawResponse$lambda(this$0, $this_emitToRawResponse) {
|
|
966
1017
|
return function (it) {
|
|
967
|
-
return emitSerialized(
|
|
1018
|
+
return emitSerialized(this$0, it, $this_emitToRawResponse);
|
|
968
1019
|
};
|
|
969
1020
|
}
|
|
970
1021
|
function PythonEndpointDefinitionEmitter$emitFromRawResponse$lambda(this$0, $this_emitFromRawResponse) {
|
|
971
1022
|
return function (it) {
|
|
972
|
-
return emitDeserialized_0(
|
|
1023
|
+
return emitDeserialized_0(this$0, it, $this_emitFromRawResponse);
|
|
973
1024
|
};
|
|
974
1025
|
}
|
|
975
1026
|
function PythonEndpointDefinitionEmitter$emitDeserialized$lambda(this$0) {
|
|
976
1027
|
return function (it) {
|
|
977
|
-
return emitDeserializedParams_0(
|
|
1028
|
+
return emitDeserializedParams_0(this$0, it, 'response', 'headers', 2, false);
|
|
978
1029
|
};
|
|
979
1030
|
}
|
|
980
1031
|
function PythonEndpointDefinitionEmitter$emitSerialized$lambda(this$0) {
|
|
981
1032
|
return function (it) {
|
|
982
|
-
return emitSerializedParams(
|
|
1033
|
+
return emitSerializedParams(this$0, it, 'response', 'headers');
|
|
983
1034
|
};
|
|
984
1035
|
}
|
|
985
1036
|
function PythonEndpointDefinitionEmitter$emitObject$lambda($spaces, $block) {
|
|
986
1037
|
return function (it) {
|
|
987
|
-
return Spacer_instance.
|
|
1038
|
+
return Spacer_instance.qr($spaces + 2 | 0) + $block(it);
|
|
988
1039
|
};
|
|
989
1040
|
}
|
|
990
1041
|
function PythonEndpointDefinitionEmitter() {
|
|
991
1042
|
}
|
|
992
|
-
function sanitizeNegative(
|
|
993
|
-
|
|
994
|
-
if (startsWith(_this__u8e3s4, '-')) {
|
|
995
|
-
// Inline function 'kotlin.text.substring' call
|
|
996
|
-
// Inline function 'kotlin.js.asDynamic' call
|
|
997
|
-
tmp = '__' + _this__u8e3s4.substring(1);
|
|
998
|
-
} else {
|
|
999
|
-
tmp = _this__u8e3s4;
|
|
1000
|
-
}
|
|
1001
|
-
return tmp;
|
|
1043
|
+
function sanitizeNegative($this, _this__u8e3s4) {
|
|
1044
|
+
return startsWith(_this__u8e3s4, '-') ? '__' + substring(_this__u8e3s4, 1) : _this__u8e3s4;
|
|
1002
1045
|
}
|
|
1003
|
-
function sanitizeEnum(
|
|
1046
|
+
function sanitizeEnum($this, _this__u8e3s4) {
|
|
1004
1047
|
// Inline function 'kotlin.let' call
|
|
1005
|
-
|
|
1006
|
-
// Inline function 'community.flock.wirespec.emitters.python.PythonEnumDefinitionEmitter.sanitizeEnum.<anonymous>' call
|
|
1007
|
-
var it = joinToString(split(sanitizeNegative(_this__u8e3s4, $this), ['-', ', ', '.', ' ', '//']), '_');
|
|
1048
|
+
var it = joinToString(split(sanitizeNegative($this, _this__u8e3s4), ['-', ', ', '.', ' ', '//']), '_');
|
|
1008
1049
|
var tmp;
|
|
1009
1050
|
var tmp0_safe_receiver = firstOrNull(it);
|
|
1010
1051
|
var tmp_0;
|
|
@@ -1023,29 +1064,1066 @@ function sanitizeEnum(_this__u8e3s4, $this) {
|
|
|
1023
1064
|
}
|
|
1024
1065
|
function PythonEnumDefinitionEmitter$emit$lambda(this$0) {
|
|
1025
1066
|
return function (it) {
|
|
1026
|
-
return Spacer_instance.toString() + this$0.
|
|
1067
|
+
return Spacer_instance.toString() + this$0.a1w(sanitizeEnum(this$0, it)) + ' = "' + it + '"';
|
|
1027
1068
|
};
|
|
1028
1069
|
}
|
|
1029
1070
|
function PythonEnumDefinitionEmitter() {
|
|
1030
1071
|
}
|
|
1031
1072
|
function Companion() {
|
|
1032
1073
|
Companion_instance_2 = this;
|
|
1033
|
-
this.
|
|
1074
|
+
this.f1y_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']);
|
|
1034
1075
|
}
|
|
1035
1076
|
var Companion_instance_2;
|
|
1036
|
-
function
|
|
1077
|
+
function Companion_getInstance_0() {
|
|
1037
1078
|
if (Companion_instance_2 == null)
|
|
1038
1079
|
new Companion();
|
|
1039
1080
|
return Companion_instance_2;
|
|
1040
1081
|
}
|
|
1041
1082
|
function PythonIdentifierEmitter() {
|
|
1042
1083
|
}
|
|
1084
|
+
function _get_sanitizationConfig__sns434($this) {
|
|
1085
|
+
var tmp0 = $this.k1y_1;
|
|
1086
|
+
var tmp = KProperty1;
|
|
1087
|
+
// Inline function 'kotlin.getValue' call
|
|
1088
|
+
getPropertyCallableRef('sanitizationConfig', 1, tmp, PythonIrEmitter$_get_sanitizationConfig_$ref_1q5eai(), null);
|
|
1089
|
+
return tmp0.l1();
|
|
1090
|
+
}
|
|
1091
|
+
function sanitize_0($this, _this__u8e3s4) {
|
|
1092
|
+
// Inline function 'kotlin.collections.mapIndexed' call
|
|
1093
|
+
var this_0 = split(_this__u8e3s4.l1(), ['.', ' ']);
|
|
1094
|
+
// Inline function 'kotlin.collections.mapIndexedTo' call
|
|
1095
|
+
var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
|
|
1096
|
+
var index = 0;
|
|
1097
|
+
var _iterator__ex2g4s = this_0.t();
|
|
1098
|
+
while (_iterator__ex2g4s.u()) {
|
|
1099
|
+
var item = _iterator__ex2g4s.v();
|
|
1100
|
+
var _unary__edvuaz = index;
|
|
1101
|
+
index = _unary__edvuaz + 1 | 0;
|
|
1102
|
+
var tmp$ret$0 = checkIndexOverflow(_unary__edvuaz) > 0 ? Companion_instance_1.oq(item) : item;
|
|
1103
|
+
destination.x(tmp$ret$0);
|
|
1104
|
+
}
|
|
1105
|
+
// Inline function 'kotlin.text.filter' call
|
|
1106
|
+
var tmp0 = joinToString(destination, '');
|
|
1107
|
+
// Inline function 'kotlin.text.filterTo' call
|
|
1108
|
+
var destination_0 = StringBuilder_init_$Create$();
|
|
1109
|
+
var inductionVariable = 0;
|
|
1110
|
+
var last = charSequenceLength(tmp0);
|
|
1111
|
+
if (inductionVariable < last)
|
|
1112
|
+
do {
|
|
1113
|
+
var index_0 = inductionVariable;
|
|
1114
|
+
inductionVariable = inductionVariable + 1 | 0;
|
|
1115
|
+
var element = charSequenceGet(tmp0, index_0);
|
|
1116
|
+
if (isLetterOrDigit(element) || element === _Char___init__impl__6a9atx(95)) {
|
|
1117
|
+
destination_0.s(element);
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
1120
|
+
while (inductionVariable < last);
|
|
1121
|
+
// Inline function 'kotlin.let' call
|
|
1122
|
+
var it = destination_0.toString();
|
|
1123
|
+
var tmp;
|
|
1124
|
+
var tmp0_safe_receiver = firstOrNull(it);
|
|
1125
|
+
var tmp_0;
|
|
1126
|
+
var tmp_1 = tmp0_safe_receiver;
|
|
1127
|
+
if ((tmp_1 == null ? null : new Char(tmp_1)) == null) {
|
|
1128
|
+
tmp_0 = null;
|
|
1129
|
+
} else {
|
|
1130
|
+
tmp_0 = isDigit(tmp0_safe_receiver);
|
|
1131
|
+
}
|
|
1132
|
+
if (tmp_0 === true) {
|
|
1133
|
+
tmp = '_' + it;
|
|
1134
|
+
} else {
|
|
1135
|
+
tmp = it;
|
|
1136
|
+
}
|
|
1137
|
+
// Inline function 'kotlin.let' call
|
|
1138
|
+
var it_0 = tmp;
|
|
1139
|
+
var tmp_2;
|
|
1140
|
+
if (_this__u8e3s4 instanceof FieldIdentifier) {
|
|
1141
|
+
tmp_2 = sanitizeKeywords_0($this, it_0);
|
|
1142
|
+
} else {
|
|
1143
|
+
tmp_2 = it_0;
|
|
1144
|
+
}
|
|
1145
|
+
return tmp_2;
|
|
1146
|
+
}
|
|
1147
|
+
function sanitizeKeywords_0($this, _this__u8e3s4) {
|
|
1148
|
+
return Companion_getInstance_1().n1y_1.u1(_this__u8e3s4) ? '_' + _this__u8e3s4 : _this__u8e3s4;
|
|
1149
|
+
}
|
|
1150
|
+
function sanitizeEnum_0($this, _this__u8e3s4) {
|
|
1151
|
+
// Inline function 'kotlin.let' call
|
|
1152
|
+
var it = joinToString(split(_this__u8e3s4, ['-', ', ', '.', ' ', '//']), '_');
|
|
1153
|
+
var tmp;
|
|
1154
|
+
var tmp0_safe_receiver = firstOrNull(it);
|
|
1155
|
+
var tmp_0;
|
|
1156
|
+
var tmp_1 = tmp0_safe_receiver;
|
|
1157
|
+
if ((tmp_1 == null ? null : new Char(tmp_1)) == null) {
|
|
1158
|
+
tmp_0 = null;
|
|
1159
|
+
} else {
|
|
1160
|
+
tmp_0 = isDigit(tmp0_safe_receiver);
|
|
1161
|
+
}
|
|
1162
|
+
if (tmp_0 === true) {
|
|
1163
|
+
tmp = '_' + it;
|
|
1164
|
+
} else {
|
|
1165
|
+
tmp = it;
|
|
1166
|
+
}
|
|
1167
|
+
return tmp;
|
|
1168
|
+
}
|
|
1169
|
+
function sort($this, definition) {
|
|
1170
|
+
var tmp;
|
|
1171
|
+
if (definition instanceof Enum) {
|
|
1172
|
+
tmp = 1;
|
|
1173
|
+
} else {
|
|
1174
|
+
if (definition instanceof Refined) {
|
|
1175
|
+
tmp = 2;
|
|
1176
|
+
} else {
|
|
1177
|
+
if (definition instanceof Type) {
|
|
1178
|
+
tmp = 3;
|
|
1179
|
+
} else {
|
|
1180
|
+
if (definition instanceof Union) {
|
|
1181
|
+
tmp = 4;
|
|
1182
|
+
} else {
|
|
1183
|
+
if (definition instanceof Endpoint) {
|
|
1184
|
+
tmp = 5;
|
|
1185
|
+
} else {
|
|
1186
|
+
if (definition instanceof Channel) {
|
|
1187
|
+
tmp = 6;
|
|
1188
|
+
} else {
|
|
1189
|
+
noWhenBranchMatchedException();
|
|
1190
|
+
}
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
}
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
return tmp;
|
|
1197
|
+
}
|
|
1198
|
+
function buildImports($this, wirespecPath) {
|
|
1199
|
+
return listOf([import_0('__future__', 'annotations'), import_0('', 're'), import_0('abc', 'ABC'), import_0('abc', 'abstractmethod'), import_0('dataclasses', 'dataclass'), import_0('typing', 'Any'), import_0('typing', 'Generic'), import_0('typing', 'List'), import_0('typing', 'Optional'), import_0('', 'enum'), import_0(wirespecPath, 'T'), import_0(wirespecPath, 'Wirespec'), import_0(wirespecPath, '_raise')]);
|
|
1200
|
+
}
|
|
1201
|
+
function snakeCaseHandlerAndCallMethods($this, _this__u8e3s4) {
|
|
1202
|
+
// Inline function 'community.flock.wirespec.ir.core.transform' call
|
|
1203
|
+
var scope = new TransformScope(_this__u8e3s4);
|
|
1204
|
+
// Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
|
|
1205
|
+
var tmp = scope;
|
|
1206
|
+
// Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
|
|
1207
|
+
var this_0 = scope.z1t_1;
|
|
1208
|
+
// Inline function 'community.flock.wirespec.ir.core.transformer' call
|
|
1209
|
+
// Inline function 'kotlin.apply' call
|
|
1210
|
+
var this_1 = new TransformerBuilder();
|
|
1211
|
+
this_1.d1h(PythonIrEmitter$snakeCaseHandlerAndCallMethods$lambda);
|
|
1212
|
+
var tmp$ret$2 = this_1.e1h();
|
|
1213
|
+
tmp.z1t_1 = transform(this_0, tmp$ret$2);
|
|
1214
|
+
var tmp_0 = scope.z1t_1;
|
|
1215
|
+
return isInterface(tmp_0, Element) ? tmp_0 : THROW_CCE();
|
|
1216
|
+
}
|
|
1217
|
+
function flattenEndpointTypeRefs($this, _this__u8e3s4, endpointName) {
|
|
1218
|
+
// Inline function 'community.flock.wirespec.ir.core.transform' call
|
|
1219
|
+
var scope = new TransformScope(_this__u8e3s4);
|
|
1220
|
+
scope.f1u(PythonIrEmitter$flattenEndpointTypeRefs$lambda(endpointName));
|
|
1221
|
+
var tmp = scope.z1t_1;
|
|
1222
|
+
return isInterface(tmp, Element) ? tmp : THROW_CCE();
|
|
1223
|
+
}
|
|
1224
|
+
function addSelfReceiverToClientFields($this, _this__u8e3s4) {
|
|
1225
|
+
var tmp0_safe_receiver = _this__u8e3s4 instanceof File ? _this__u8e3s4 : null;
|
|
1226
|
+
var tmp;
|
|
1227
|
+
if (tmp0_safe_receiver == null) {
|
|
1228
|
+
tmp = null;
|
|
1229
|
+
} else {
|
|
1230
|
+
// Inline function 'community.flock.wirespec.ir.core.findElement' call
|
|
1231
|
+
// Inline function 'kotlin.collections.filterIsInstance' call
|
|
1232
|
+
var tmp0 = tmp0_safe_receiver.v1m();
|
|
1233
|
+
// Inline function 'kotlin.collections.filterIsInstanceTo' call
|
|
1234
|
+
var destination = ArrayList_init_$Create$();
|
|
1235
|
+
var _iterator__ex2g4s = tmp0.t();
|
|
1236
|
+
while (_iterator__ex2g4s.u()) {
|
|
1237
|
+
var element = _iterator__ex2g4s.v();
|
|
1238
|
+
if (element instanceof Struct) {
|
|
1239
|
+
destination.x(element);
|
|
1240
|
+
}
|
|
1241
|
+
}
|
|
1242
|
+
tmp = firstOrNull_0(destination);
|
|
1243
|
+
}
|
|
1244
|
+
var struct = tmp;
|
|
1245
|
+
var tmp2_safe_receiver = struct == null ? null : struct.g1n_1;
|
|
1246
|
+
var tmp_0;
|
|
1247
|
+
if (tmp2_safe_receiver == null) {
|
|
1248
|
+
tmp_0 = null;
|
|
1249
|
+
} else {
|
|
1250
|
+
// Inline function 'kotlin.collections.map' call
|
|
1251
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
1252
|
+
var destination_0 = ArrayList_init_$Create$_0(collectionSizeOrDefault(tmp2_safe_receiver, 10));
|
|
1253
|
+
var _iterator__ex2g4s_0 = tmp2_safe_receiver.t();
|
|
1254
|
+
while (_iterator__ex2g4s_0.u()) {
|
|
1255
|
+
var item = _iterator__ex2g4s_0.v();
|
|
1256
|
+
var tmp$ret$3 = item.m1n_1.s1h();
|
|
1257
|
+
destination_0.x(tmp$ret$3);
|
|
1258
|
+
}
|
|
1259
|
+
tmp_0 = destination_0;
|
|
1260
|
+
}
|
|
1261
|
+
var tmp3_safe_receiver = tmp_0;
|
|
1262
|
+
var tmp4_elvis_lhs = tmp3_safe_receiver == null ? null : toSet(tmp3_safe_receiver);
|
|
1263
|
+
var fieldNames = tmp4_elvis_lhs == null ? emptySet() : tmp4_elvis_lhs;
|
|
1264
|
+
if (fieldNames.r())
|
|
1265
|
+
return _this__u8e3s4;
|
|
1266
|
+
// Inline function 'community.flock.wirespec.ir.core.transform' call
|
|
1267
|
+
var scope = new TransformScope(_this__u8e3s4);
|
|
1268
|
+
scope.i1u(PythonIrEmitter$addSelfReceiverToClientFields$lambda(fieldNames));
|
|
1269
|
+
var tmp_1 = scope.z1t_1;
|
|
1270
|
+
return isInterface(tmp_1, Element) ? tmp_1 : THROW_CCE();
|
|
1271
|
+
}
|
|
1272
|
+
function snakeCaseClientFunctions($this, _this__u8e3s4) {
|
|
1273
|
+
// Inline function 'community.flock.wirespec.ir.core.transform' call
|
|
1274
|
+
var scope = new TransformScope(_this__u8e3s4);
|
|
1275
|
+
// Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
|
|
1276
|
+
var tmp = scope;
|
|
1277
|
+
// Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
|
|
1278
|
+
var this_0 = scope.z1t_1;
|
|
1279
|
+
// Inline function 'community.flock.wirespec.ir.core.transformer' call
|
|
1280
|
+
// Inline function 'kotlin.apply' call
|
|
1281
|
+
var this_1 = new TransformerBuilder();
|
|
1282
|
+
this_1.d1h(PythonIrEmitter$snakeCaseClientFunctions$lambda);
|
|
1283
|
+
var tmp$ret$2 = this_1.e1h();
|
|
1284
|
+
tmp.z1t_1 = transform(this_0, tmp$ret$2);
|
|
1285
|
+
scope.i1u(PythonIrEmitter$snakeCaseClientFunctions$lambda_0);
|
|
1286
|
+
var tmp_0 = scope.z1t_1;
|
|
1287
|
+
return isInterface(tmp_0, Element) ? tmp_0 : THROW_CCE();
|
|
1288
|
+
}
|
|
1289
|
+
function Companion_0() {
|
|
1290
|
+
Companion_instance_3 = this;
|
|
1291
|
+
this.n1y_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']);
|
|
1292
|
+
}
|
|
1293
|
+
var Companion_instance_3;
|
|
1294
|
+
function Companion_getInstance_1() {
|
|
1295
|
+
if (Companion_instance_3 == null)
|
|
1296
|
+
new Companion_0();
|
|
1297
|
+
return Companion_instance_3;
|
|
1298
|
+
}
|
|
1299
|
+
function sam$kotlin_Comparator$0_0(function_0) {
|
|
1300
|
+
this.o1y_1 = function_0;
|
|
1301
|
+
}
|
|
1302
|
+
protoOf(sam$kotlin_Comparator$0_0).qd = function (a, b) {
|
|
1303
|
+
return this.o1y_1(a, b);
|
|
1304
|
+
};
|
|
1305
|
+
protoOf(sam$kotlin_Comparator$0_0).compare = function (a, b) {
|
|
1306
|
+
return this.qd(a, b);
|
|
1307
|
+
};
|
|
1308
|
+
protoOf(sam$kotlin_Comparator$0_0).l3 = function () {
|
|
1309
|
+
return this.o1y_1;
|
|
1310
|
+
};
|
|
1311
|
+
protoOf(sam$kotlin_Comparator$0_0).equals = function (other) {
|
|
1312
|
+
var tmp;
|
|
1313
|
+
if (!(other == null) ? isInterface(other, Comparator) : false) {
|
|
1314
|
+
var tmp_0;
|
|
1315
|
+
if (!(other == null) ? isInterface(other, FunctionAdapter) : false) {
|
|
1316
|
+
tmp_0 = equals(this.l3(), other.l3());
|
|
1317
|
+
} else {
|
|
1318
|
+
tmp_0 = false;
|
|
1319
|
+
}
|
|
1320
|
+
tmp = tmp_0;
|
|
1321
|
+
} else {
|
|
1322
|
+
tmp = false;
|
|
1323
|
+
}
|
|
1324
|
+
return tmp;
|
|
1325
|
+
};
|
|
1326
|
+
protoOf(sam$kotlin_Comparator$0_0).hashCode = function () {
|
|
1327
|
+
return hashCode(this.l3());
|
|
1328
|
+
};
|
|
1329
|
+
function PythonIrEmitter$sanitizationConfig$delegate$lambda$lambda(it) {
|
|
1330
|
+
return '_' + it;
|
|
1331
|
+
}
|
|
1332
|
+
function PythonIrEmitter$sanitizationConfig$delegate$lambda$lambda_0(name) {
|
|
1333
|
+
var sanitized = name.n1h_1.a1() > 1 ? name.r1l() : name.s1h();
|
|
1334
|
+
return new Name(listOf_0(sanitized));
|
|
1335
|
+
}
|
|
1336
|
+
function PythonIrEmitter$sanitizationConfig$delegate$lambda$lambda_1(name) {
|
|
1337
|
+
return new Name(listOf_0(name.r1l()));
|
|
1338
|
+
}
|
|
1339
|
+
function PythonIrEmitter$sanitizationConfig$delegate$lambda$lambda_2(it) {
|
|
1340
|
+
return it;
|
|
1341
|
+
}
|
|
1342
|
+
function PythonIrEmitter$sanitizationConfig$delegate$lambda$lambda_3(this$0) {
|
|
1343
|
+
return function (stmt, tr) {
|
|
1344
|
+
var tmp;
|
|
1345
|
+
if (stmt instanceof ConstructorStatement) {
|
|
1346
|
+
var tmp_0 = tr.r1t(stmt.p1m_1);
|
|
1347
|
+
// Inline function 'kotlin.collections.map' call
|
|
1348
|
+
var this_0 = stmt.q1m_1;
|
|
1349
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
1350
|
+
var destination = ArrayList_init_$Create$_0(this_0.a1());
|
|
1351
|
+
// Inline function 'kotlin.collections.iterator' call
|
|
1352
|
+
var _iterator__ex2g4s = this_0.j1().t();
|
|
1353
|
+
while (_iterator__ex2g4s.u()) {
|
|
1354
|
+
var item = _iterator__ex2g4s.v();
|
|
1355
|
+
// Inline function 'kotlin.collections.component1' call
|
|
1356
|
+
var k = item.k1();
|
|
1357
|
+
// Inline function 'kotlin.collections.component2' call
|
|
1358
|
+
var v = item.l1();
|
|
1359
|
+
var tmp$ret$3 = to(sanitizeFieldName(_get_sanitizationConfig__sns434(this$0), k), tr.u1t(v));
|
|
1360
|
+
destination.x(tmp$ret$3);
|
|
1361
|
+
}
|
|
1362
|
+
tmp = new ConstructorStatement(tmp_0, toMap(destination));
|
|
1363
|
+
} else {
|
|
1364
|
+
tmp = transformChildren(stmt, tr);
|
|
1365
|
+
}
|
|
1366
|
+
return tmp;
|
|
1367
|
+
};
|
|
1368
|
+
}
|
|
1369
|
+
function PythonIrEmitter$sanitizationConfig$delegate$lambda(this$0) {
|
|
1370
|
+
return function () {
|
|
1371
|
+
var tmp = Companion_getInstance_1().n1y_1;
|
|
1372
|
+
var tmp_0 = PythonIrEmitter$sanitizationConfig$delegate$lambda$lambda;
|
|
1373
|
+
var tmp_1 = PythonIrEmitter$sanitizationConfig$delegate$lambda$lambda_0;
|
|
1374
|
+
var tmp_2 = PythonIrEmitter$sanitizationConfig$delegate$lambda$lambda_1;
|
|
1375
|
+
var tmp_3 = PythonIrEmitter$sanitizationConfig$delegate$lambda$lambda_2;
|
|
1376
|
+
return new SanitizationConfig(tmp, tmp_0, tmp_1, tmp_2, tmp_3, PythonIrEmitter$sanitizationConfig$delegate$lambda$lambda_3(this$0));
|
|
1377
|
+
};
|
|
1378
|
+
}
|
|
1379
|
+
function PythonIrEmitter$_get_sanitizationConfig_$ref_1q5eai() {
|
|
1380
|
+
return function (p0) {
|
|
1381
|
+
return _get_sanitizationConfig__sns434(p0);
|
|
1382
|
+
};
|
|
1383
|
+
}
|
|
1384
|
+
function PythonIrEmitter$shared$1(this$0) {
|
|
1385
|
+
this.p1y_1 = 'shared';
|
|
1386
|
+
this.q1y_1 = this$0.l1y_1 + generatePython(convert(new Shared(this.p1y_1)));
|
|
1387
|
+
}
|
|
1388
|
+
protoOf(PythonIrEmitter$shared$1).r1w = function () {
|
|
1389
|
+
return this.q1y_1;
|
|
1390
|
+
};
|
|
1391
|
+
function PythonIrEmitter$emit$lambda(this$0) {
|
|
1392
|
+
return function (a, b) {
|
|
1393
|
+
// Inline function 'kotlin.comparisons.compareValuesBy' call
|
|
1394
|
+
var this_0 = this$0;
|
|
1395
|
+
var tmp = sort(this_0, a);
|
|
1396
|
+
var this_1 = this$0;
|
|
1397
|
+
var tmp$ret$1 = sort(this_1, b);
|
|
1398
|
+
return compareValues(tmp, tmp$ret$1);
|
|
1399
|
+
};
|
|
1400
|
+
}
|
|
1401
|
+
function emit$emitInitImport(this$0, def) {
|
|
1402
|
+
return import_0('.' + sanitize_0(this$0, def.vq()), sanitize_0(this$0, def.vq()));
|
|
1403
|
+
}
|
|
1404
|
+
function PythonIrEmitter$emit$lambda$lambda($fieldNames) {
|
|
1405
|
+
return function (s, t) {
|
|
1406
|
+
var tmp;
|
|
1407
|
+
var tmp_0;
|
|
1408
|
+
var tmp_1;
|
|
1409
|
+
if (s instanceof FieldCall) {
|
|
1410
|
+
tmp_1 = s.i1p_1 == null;
|
|
1411
|
+
} else {
|
|
1412
|
+
tmp_1 = false;
|
|
1413
|
+
}
|
|
1414
|
+
if (tmp_1) {
|
|
1415
|
+
tmp_0 = $fieldNames.u1(s.j1p_1.r1l());
|
|
1416
|
+
} else {
|
|
1417
|
+
tmp_0 = false;
|
|
1418
|
+
}
|
|
1419
|
+
if (tmp_0) {
|
|
1420
|
+
tmp = new FieldCall(new VariableReference(Companion_getInstance().m1h('self')), s.j1p_1);
|
|
1421
|
+
} else {
|
|
1422
|
+
tmp = transformChildren(s, t);
|
|
1423
|
+
}
|
|
1424
|
+
return tmp;
|
|
1425
|
+
};
|
|
1426
|
+
}
|
|
1427
|
+
function PythonIrEmitter$emit$lambda_0($fieldNames) {
|
|
1428
|
+
return function (element, transformer) {
|
|
1429
|
+
var tmp;
|
|
1430
|
+
if (element instanceof Function) {
|
|
1431
|
+
var tmp_0;
|
|
1432
|
+
if (element.t1j_1.equals(Companion_getInstance().m1h('validate'))) {
|
|
1433
|
+
// Inline function 'community.flock.wirespec.ir.core.transform' call
|
|
1434
|
+
var this_0 = element.b1k(VOID, VOID, listOf_0(new Parameter(Companion_getInstance().m1h('self'), new Custom_0(''))));
|
|
1435
|
+
var scope = new TransformScope(this_0);
|
|
1436
|
+
scope.i1u(PythonIrEmitter$emit$lambda$lambda($fieldNames));
|
|
1437
|
+
var tmp_1 = scope.z1t_1;
|
|
1438
|
+
tmp_0 = isInterface(tmp_1, Element) ? tmp_1 : THROW_CCE();
|
|
1439
|
+
} else {
|
|
1440
|
+
tmp_0 = element;
|
|
1441
|
+
}
|
|
1442
|
+
tmp = tmp_0;
|
|
1443
|
+
} else {
|
|
1444
|
+
tmp = element;
|
|
1445
|
+
}
|
|
1446
|
+
var transformed = tmp;
|
|
1447
|
+
return transformChildren_0(transformed, transformer);
|
|
1448
|
+
};
|
|
1449
|
+
}
|
|
1450
|
+
function PythonIrEmitter$emit$lambda_1(this$0) {
|
|
1451
|
+
return function (element, transformer) {
|
|
1452
|
+
var tmp;
|
|
1453
|
+
if (element instanceof Enum_0) {
|
|
1454
|
+
// Inline function 'kotlin.collections.map' call
|
|
1455
|
+
var this_0 = element.f1o_1;
|
|
1456
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
1457
|
+
var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
|
|
1458
|
+
var _iterator__ex2g4s = this_0.t();
|
|
1459
|
+
while (_iterator__ex2g4s.u()) {
|
|
1460
|
+
var item = _iterator__ex2g4s.v();
|
|
1461
|
+
var tmp$ret$0 = item.c1o(Companion_getInstance().m1h(sanitizeKeywords_0(this$0, sanitizeEnum_0(this$0, item.z1n_1.s1h()))));
|
|
1462
|
+
destination.x(tmp$ret$0);
|
|
1463
|
+
}
|
|
1464
|
+
tmp = element.k1o(VOID, VOID, destination);
|
|
1465
|
+
} else {
|
|
1466
|
+
tmp = element;
|
|
1467
|
+
}
|
|
1468
|
+
var transformed = tmp;
|
|
1469
|
+
return transformChildren_0(transformed, transformer);
|
|
1470
|
+
};
|
|
1471
|
+
}
|
|
1472
|
+
function PythonIrEmitter$emit$lambda_2($constraintExpr) {
|
|
1473
|
+
return function ($this$function) {
|
|
1474
|
+
$this$function.l1i('self', new Custom_0(''));
|
|
1475
|
+
$this$function.k1i(Boolean_instance_0);
|
|
1476
|
+
$this$function.j1k($constraintExpr);
|
|
1477
|
+
return Unit_instance;
|
|
1478
|
+
};
|
|
1479
|
+
}
|
|
1480
|
+
function PythonIrEmitter$emit$lambda_3($toStringExpr) {
|
|
1481
|
+
return function ($this$function) {
|
|
1482
|
+
$this$function.l1i('self', new Custom_0(''));
|
|
1483
|
+
$this$function.k1i(String_instance);
|
|
1484
|
+
$this$function.j1k(new RawExpression($toStringExpr));
|
|
1485
|
+
return Unit_instance;
|
|
1486
|
+
};
|
|
1487
|
+
}
|
|
1488
|
+
function PythonIrEmitter$emit$lambda_4($updatedStruct) {
|
|
1489
|
+
return function (element, transformer) {
|
|
1490
|
+
var tmp;
|
|
1491
|
+
if (element instanceof Struct) {
|
|
1492
|
+
tmp = $updatedStruct;
|
|
1493
|
+
} else {
|
|
1494
|
+
tmp = element;
|
|
1495
|
+
}
|
|
1496
|
+
var transformed = tmp;
|
|
1497
|
+
return transformChildren_0(transformed, transformer);
|
|
1498
|
+
};
|
|
1499
|
+
}
|
|
1500
|
+
function PythonIrEmitter$snakeCaseHandlerAndCallMethods$lambda(element, transformer) {
|
|
1501
|
+
var tmp;
|
|
1502
|
+
if (element instanceof Interface) {
|
|
1503
|
+
var tmp_0;
|
|
1504
|
+
if (element.m1o_1.equals(Companion_getInstance().m1h('Handler')) || element.m1o_1.equals(Companion_getInstance().m1h('Call'))) {
|
|
1505
|
+
// Inline function 'kotlin.collections.map' call
|
|
1506
|
+
var this_0 = element.n1o_1;
|
|
1507
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
1508
|
+
var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
|
|
1509
|
+
var _iterator__ex2g4s = this_0.t();
|
|
1510
|
+
while (_iterator__ex2g4s.u()) {
|
|
1511
|
+
var item = _iterator__ex2g4s.v();
|
|
1512
|
+
var tmp_1;
|
|
1513
|
+
if (item instanceof Function) {
|
|
1514
|
+
tmp_1 = item.b1k(Companion_getInstance().m1h(item.t1j_1.y1l()));
|
|
1515
|
+
} else {
|
|
1516
|
+
tmp_1 = item;
|
|
1517
|
+
}
|
|
1518
|
+
var tmp$ret$0 = tmp_1;
|
|
1519
|
+
destination.x(tmp$ret$0);
|
|
1520
|
+
}
|
|
1521
|
+
tmp_0 = element.t1o(VOID, destination);
|
|
1522
|
+
} else {
|
|
1523
|
+
tmp_0 = element;
|
|
1524
|
+
}
|
|
1525
|
+
tmp = tmp_0;
|
|
1526
|
+
} else {
|
|
1527
|
+
tmp = element;
|
|
1528
|
+
}
|
|
1529
|
+
var transformed = tmp;
|
|
1530
|
+
return transformChildren_0(transformed, transformer);
|
|
1531
|
+
}
|
|
1532
|
+
function PythonIrEmitter$flattenEndpointTypeRefs$lambda($endpointName) {
|
|
1533
|
+
return function (type, _unused_var__etf5q3) {
|
|
1534
|
+
var tmp;
|
|
1535
|
+
var tmp_0;
|
|
1536
|
+
if (type instanceof Custom_0) {
|
|
1537
|
+
tmp_0 = startsWith(type.q1h_1, $endpointName + '.');
|
|
1538
|
+
} else {
|
|
1539
|
+
tmp_0 = false;
|
|
1540
|
+
}
|
|
1541
|
+
if (tmp_0) {
|
|
1542
|
+
var suffix = removePrefix(type.q1h_1, $endpointName + '.');
|
|
1543
|
+
switch (suffix) {
|
|
1544
|
+
case 'Call':
|
|
1545
|
+
case 'Handler':
|
|
1546
|
+
tmp = type;
|
|
1547
|
+
break;
|
|
1548
|
+
default:
|
|
1549
|
+
tmp = type.n1m(suffix);
|
|
1550
|
+
break;
|
|
1551
|
+
}
|
|
1552
|
+
} else {
|
|
1553
|
+
tmp = type;
|
|
1554
|
+
}
|
|
1555
|
+
return tmp;
|
|
1556
|
+
};
|
|
1557
|
+
}
|
|
1558
|
+
function PythonIrEmitter$addSelfReceiverToClientFields$lambda($fieldNames) {
|
|
1559
|
+
return function (stmt, tr) {
|
|
1560
|
+
var tmp;
|
|
1561
|
+
if (stmt instanceof FieldCall) {
|
|
1562
|
+
var tmp_0;
|
|
1563
|
+
if (stmt.i1p_1 == null && $fieldNames.u1(stmt.j1p_1.s1h())) {
|
|
1564
|
+
tmp_0 = new FieldCall(new VariableReference(Companion_getInstance().m1h('self')), stmt.j1p_1);
|
|
1565
|
+
} else {
|
|
1566
|
+
var tmp1_safe_receiver = stmt.i1p_1;
|
|
1567
|
+
var tmp_1;
|
|
1568
|
+
if (tmp1_safe_receiver == null) {
|
|
1569
|
+
tmp_1 = null;
|
|
1570
|
+
} else {
|
|
1571
|
+
// Inline function 'kotlin.let' call
|
|
1572
|
+
tmp_1 = tr.u1t(tmp1_safe_receiver);
|
|
1573
|
+
}
|
|
1574
|
+
tmp_0 = new FieldCall(tmp_1, stmt.j1p_1);
|
|
1575
|
+
}
|
|
1576
|
+
tmp = tmp_0;
|
|
1577
|
+
} else {
|
|
1578
|
+
tmp = transformChildren(stmt, tr);
|
|
1579
|
+
}
|
|
1580
|
+
return tmp;
|
|
1581
|
+
};
|
|
1582
|
+
}
|
|
1583
|
+
function PythonIrEmitter$snakeCaseClientFunctions$lambda(element, transformer) {
|
|
1584
|
+
var tmp;
|
|
1585
|
+
if (element instanceof Function) {
|
|
1586
|
+
tmp = element.b1k(Companion_getInstance().m1h(element.t1j_1.y1l()), VOID, plus(listOf_0(new Parameter(Companion_getInstance().m1h('self'), new Custom_0(''))), element.v1j_1));
|
|
1587
|
+
} else {
|
|
1588
|
+
tmp = element;
|
|
1589
|
+
}
|
|
1590
|
+
var transformed = tmp;
|
|
1591
|
+
return transformChildren_0(transformed, transformer);
|
|
1592
|
+
}
|
|
1593
|
+
function PythonIrEmitter$snakeCaseClientFunctions$lambda_0(stmt, tr) {
|
|
1594
|
+
var tmp;
|
|
1595
|
+
if (stmt instanceof FunctionCall) {
|
|
1596
|
+
var nameStr = stmt.b1m_1.s1h();
|
|
1597
|
+
var newName = contains(nameStr, '.') ? stmt.b1m_1 : Companion_getInstance().m1h(Companion_getInstance().m1h(nameStr).y1l());
|
|
1598
|
+
var tmp1_safe_receiver = stmt.z1l_1;
|
|
1599
|
+
var tmp_0;
|
|
1600
|
+
if (tmp1_safe_receiver == null) {
|
|
1601
|
+
tmp_0 = null;
|
|
1602
|
+
} else {
|
|
1603
|
+
// Inline function 'kotlin.let' call
|
|
1604
|
+
tmp_0 = tr.u1t(tmp1_safe_receiver);
|
|
1605
|
+
}
|
|
1606
|
+
var tmp2_receiver = tmp_0;
|
|
1607
|
+
// Inline function 'kotlin.collections.mapValues' call
|
|
1608
|
+
var this_0 = stmt.c1m_1;
|
|
1609
|
+
// Inline function 'kotlin.collections.mapValuesTo' call
|
|
1610
|
+
var destination = LinkedHashMap_init_$Create$(mapCapacity(this_0.a1()));
|
|
1611
|
+
// Inline function 'kotlin.collections.associateByTo' call
|
|
1612
|
+
var _iterator__ex2g4s = this_0.j1().t();
|
|
1613
|
+
while (_iterator__ex2g4s.u()) {
|
|
1614
|
+
var element = _iterator__ex2g4s.v();
|
|
1615
|
+
var tmp_1 = element.k1();
|
|
1616
|
+
// Inline function 'kotlin.collections.component2' call
|
|
1617
|
+
var v = element.l1();
|
|
1618
|
+
var tmp$ret$4 = tr.u1t(v);
|
|
1619
|
+
destination.w2(tmp_1, tmp$ret$4);
|
|
1620
|
+
}
|
|
1621
|
+
var tmp4_isAwait = !(stmt.z1l_1 == null);
|
|
1622
|
+
tmp = new FunctionCall(tmp2_receiver, VOID, newName, destination, tmp4_isAwait);
|
|
1623
|
+
} else {
|
|
1624
|
+
tmp = transformChildren(stmt, tr);
|
|
1625
|
+
}
|
|
1626
|
+
return tmp;
|
|
1627
|
+
}
|
|
1628
|
+
function PythonIrEmitter(packageName, emitShared) {
|
|
1629
|
+
Companion_getInstance_1();
|
|
1630
|
+
packageName = packageName === VOID ? Companion_instance.lr('community.flock.wirespec.generated') : packageName;
|
|
1631
|
+
emitShared = emitShared === VOID ? Companion_instance_0.go() : emitShared;
|
|
1632
|
+
this.g1y_1 = packageName;
|
|
1633
|
+
this.h1y_1 = emitShared;
|
|
1634
|
+
this.i1y_1 = PythonGenerator_instance;
|
|
1635
|
+
this.j1y_1 = FileExtension_Python_getInstance();
|
|
1636
|
+
var tmp = this;
|
|
1637
|
+
tmp.k1y_1 = lazy(PythonIrEmitter$sanitizationConfig$delegate$lambda(this));
|
|
1638
|
+
this.l1y_1 = "from __future__ import annotations\n\nimport enum\nfrom abc import ABC, abstractmethod\nfrom dataclasses import dataclass\nfrom typing import Any, Generic, Optional, Type, TypeVar\n\nT = TypeVar('T')\n\n\ndef _raise(msg: str) -> Any:\n raise Exception(msg)\n\n";
|
|
1639
|
+
var tmp_0 = this;
|
|
1640
|
+
tmp_0.m1y_1 = new PythonIrEmitter$shared$1(this);
|
|
1641
|
+
}
|
|
1642
|
+
protoOf(PythonIrEmitter).m1u = function () {
|
|
1643
|
+
return this.i1y_1;
|
|
1644
|
+
};
|
|
1645
|
+
protoOf(PythonIrEmitter).eq = function () {
|
|
1646
|
+
return this.j1y_1;
|
|
1647
|
+
};
|
|
1648
|
+
protoOf(PythonIrEmitter).t1v = function () {
|
|
1649
|
+
return this.m1y_1;
|
|
1650
|
+
};
|
|
1651
|
+
protoOf(PythonIrEmitter).n1u = function (module_0, logger) {
|
|
1652
|
+
// Inline function 'kotlin.collections.sortedBy' call
|
|
1653
|
+
var this_0 = new NonEmptyList(module_0.dq_1);
|
|
1654
|
+
// Inline function 'kotlin.comparisons.compareBy' call
|
|
1655
|
+
var tmp = PythonIrEmitter$emit$lambda(this);
|
|
1656
|
+
var tmp$ret$0 = new sam$kotlin_Comparator$0_0(tmp);
|
|
1657
|
+
var tmp$ret$1 = sortedWith(this_0, tmp$ret$0);
|
|
1658
|
+
var tmp_0 = toNonEmptyListOrNull(tmp$ret$1);
|
|
1659
|
+
var statements = ensureNotNull(tmp_0 == null ? null : new NonEmptyList(tmp_0)).yl_1;
|
|
1660
|
+
// Inline function 'kotlin.let' call
|
|
1661
|
+
var it = emit.call(this, module_0.wu(VOID, statements), logger);
|
|
1662
|
+
var tmp0 = new NonEmptyList(module_0.dq_1);
|
|
1663
|
+
var tmp$ret$2;
|
|
1664
|
+
$l$block_0: {
|
|
1665
|
+
// Inline function 'kotlin.collections.any' call
|
|
1666
|
+
var tmp_1;
|
|
1667
|
+
if (isInterface(tmp0, Collection)) {
|
|
1668
|
+
tmp_1 = tmp0.r();
|
|
1669
|
+
} else {
|
|
1670
|
+
tmp_1 = false;
|
|
1671
|
+
}
|
|
1672
|
+
if (tmp_1) {
|
|
1673
|
+
tmp$ret$2 = false;
|
|
1674
|
+
break $l$block_0;
|
|
1675
|
+
}
|
|
1676
|
+
var _iterator__ex2g4s = tmp0.t();
|
|
1677
|
+
while (_iterator__ex2g4s.u()) {
|
|
1678
|
+
var element = _iterator__ex2g4s.v();
|
|
1679
|
+
if (element instanceof Endpoint) {
|
|
1680
|
+
tmp$ret$2 = true;
|
|
1681
|
+
break $l$block_0;
|
|
1682
|
+
}
|
|
1683
|
+
}
|
|
1684
|
+
tmp$ret$2 = false;
|
|
1685
|
+
}
|
|
1686
|
+
var hasEndpoints = tmp$ret$2;
|
|
1687
|
+
var initElements = plus(plus(listOf([import_0('.', 'model'), import_0('.', 'endpoint')]), hasEndpoints ? listOf_0(import_0('.', 'client')) : emptyList()), listOf_0(import_0('.', 'wirespec')));
|
|
1688
|
+
var init = new File(Companion_getInstance().m1h(this.g1y_1.or() + '__init__'), initElements);
|
|
1689
|
+
var tmp_2 = Companion_getInstance().m1h(this.g1y_1.or() + 'endpoint/' + '__init__');
|
|
1690
|
+
// Inline function 'kotlin.collections.filter' call
|
|
1691
|
+
var tmp0_0 = new NonEmptyList(module_0.dq_1);
|
|
1692
|
+
// Inline function 'kotlin.collections.filterTo' call
|
|
1693
|
+
var destination = ArrayList_init_$Create$();
|
|
1694
|
+
var _iterator__ex2g4s_0 = tmp0_0.t();
|
|
1695
|
+
while (_iterator__ex2g4s_0.u()) {
|
|
1696
|
+
var element_0 = _iterator__ex2g4s_0.v();
|
|
1697
|
+
if (element_0 instanceof Endpoint) {
|
|
1698
|
+
destination.x(element_0);
|
|
1699
|
+
}
|
|
1700
|
+
}
|
|
1701
|
+
// Inline function 'kotlin.collections.map' call
|
|
1702
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
1703
|
+
var destination_0 = ArrayList_init_$Create$_0(collectionSizeOrDefault(destination, 10));
|
|
1704
|
+
var _iterator__ex2g4s_1 = destination.t();
|
|
1705
|
+
while (_iterator__ex2g4s_1.u()) {
|
|
1706
|
+
var item = _iterator__ex2g4s_1.v();
|
|
1707
|
+
var tmp$ret$7 = emit$emitInitImport(this, item);
|
|
1708
|
+
destination_0.x(tmp$ret$7);
|
|
1709
|
+
}
|
|
1710
|
+
var initEndpoint = new File(tmp_2, destination_0);
|
|
1711
|
+
var tmp_3 = Companion_getInstance().m1h(this.g1y_1.or() + 'model/' + '__init__');
|
|
1712
|
+
// Inline function 'kotlin.collections.filter' call
|
|
1713
|
+
var tmp0_1 = new NonEmptyList(module_0.dq_1);
|
|
1714
|
+
// Inline function 'kotlin.collections.filterTo' call
|
|
1715
|
+
var destination_1 = ArrayList_init_$Create$();
|
|
1716
|
+
var _iterator__ex2g4s_2 = tmp0_1.t();
|
|
1717
|
+
while (_iterator__ex2g4s_2.u()) {
|
|
1718
|
+
var element_1 = _iterator__ex2g4s_2.v();
|
|
1719
|
+
if (isInterface(element_1, Model)) {
|
|
1720
|
+
destination_1.x(element_1);
|
|
1721
|
+
}
|
|
1722
|
+
}
|
|
1723
|
+
// Inline function 'kotlin.collections.map' call
|
|
1724
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
1725
|
+
var destination_2 = ArrayList_init_$Create$_0(collectionSizeOrDefault(destination_1, 10));
|
|
1726
|
+
var _iterator__ex2g4s_3 = destination_1.t();
|
|
1727
|
+
while (_iterator__ex2g4s_3.u()) {
|
|
1728
|
+
var item_0 = _iterator__ex2g4s_3.v();
|
|
1729
|
+
var tmp$ret$13 = emit$emitInitImport(this, item_0);
|
|
1730
|
+
destination_2.x(tmp$ret$13);
|
|
1731
|
+
}
|
|
1732
|
+
var initModel = new File(tmp_3, destination_2);
|
|
1733
|
+
var initClient = hasEndpoints ? listOf_0(new File(Companion_getInstance().m1h(this.g1y_1.or() + 'client/' + '__init__'), emptyList())) : emptyList();
|
|
1734
|
+
var shared = new File(Companion_getInstance().m1h(this.g1y_1.or() + 'wirespec'), listOf_0(new RawElement(this.t1v().r1w())));
|
|
1735
|
+
var tmp0_2 = dropLast(split(this.g1y_1.mr_1, ['.']), 1);
|
|
1736
|
+
var tmp$ret$16;
|
|
1737
|
+
$l$block_1: {
|
|
1738
|
+
// Inline function 'kotlin.collections.runningFold' call
|
|
1739
|
+
var estimatedSize = collectionSizeOrDefault(tmp0_2, 9);
|
|
1740
|
+
if (estimatedSize === 0) {
|
|
1741
|
+
tmp$ret$16 = listOf_0('');
|
|
1742
|
+
break $l$block_1;
|
|
1743
|
+
}
|
|
1744
|
+
// Inline function 'kotlin.apply' call
|
|
1745
|
+
var this_1 = ArrayList_init_$Create$_0(estimatedSize + 1 | 0);
|
|
1746
|
+
this_1.x('');
|
|
1747
|
+
var result = this_1;
|
|
1748
|
+
var accumulator = '';
|
|
1749
|
+
var _iterator__ex2g4s_4 = tmp0_2.t();
|
|
1750
|
+
while (_iterator__ex2g4s_4.u()) {
|
|
1751
|
+
var element_2 = _iterator__ex2g4s_4.v();
|
|
1752
|
+
var acc = accumulator;
|
|
1753
|
+
var tmp_4;
|
|
1754
|
+
// Inline function 'kotlin.text.isEmpty' call
|
|
1755
|
+
if (charSequenceLength(acc) === 0) {
|
|
1756
|
+
tmp_4 = element_2;
|
|
1757
|
+
} else {
|
|
1758
|
+
tmp_4 = acc + '/' + element_2;
|
|
1759
|
+
}
|
|
1760
|
+
accumulator = tmp_4;
|
|
1761
|
+
result.x(accumulator);
|
|
1762
|
+
}
|
|
1763
|
+
tmp$ret$16 = result;
|
|
1764
|
+
}
|
|
1765
|
+
// Inline function 'kotlin.collections.map' call
|
|
1766
|
+
var this_2 = drop(tmp$ret$16, 1);
|
|
1767
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
1768
|
+
var destination_3 = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_2, 10));
|
|
1769
|
+
var _iterator__ex2g4s_5 = this_2.t();
|
|
1770
|
+
while (_iterator__ex2g4s_5.u()) {
|
|
1771
|
+
var item_1 = _iterator__ex2g4s_5.v();
|
|
1772
|
+
var tmp$ret$21 = new File(Companion_getInstance().m1h(item_1 + '/__init__'), emptyList());
|
|
1773
|
+
destination_3.x(tmp$ret$21);
|
|
1774
|
+
}
|
|
1775
|
+
var parentInits = destination_3;
|
|
1776
|
+
return this.h1y_1.ho_1 ? NonEmptyList__plus_impl_xqmb9_0(NonEmptyList__plus_impl_xqmb9(NonEmptyList__plus_impl_xqmb9_0(NonEmptyList__plus_impl_xqmb9(NonEmptyList__plus_impl_xqmb9(NonEmptyList__plus_impl_xqmb9(it, init), initEndpoint), initModel), initClient), shared), parentInits) : NonEmptyList__plus_impl_xqmb9_0(NonEmptyList__plus_impl_xqmb9(it, init), parentInits);
|
|
1777
|
+
};
|
|
1778
|
+
protoOf(PythonIrEmitter).uq = function (definition, module_0, logger) {
|
|
1779
|
+
var file = emit_0.call(this, definition, module_0, logger);
|
|
1780
|
+
return placeInModule(prependImports(file, buildImports(this, '..wirespec')), this.g1y_1, definition);
|
|
1781
|
+
};
|
|
1782
|
+
protoOf(PythonIrEmitter).up = function (type, module_0) {
|
|
1783
|
+
// Inline function 'kotlin.collections.distinctBy' call
|
|
1784
|
+
var this_0 = importReferences(type);
|
|
1785
|
+
var set = HashSet_init_$Create$();
|
|
1786
|
+
var list = ArrayList_init_$Create$();
|
|
1787
|
+
var _iterator__ex2g4s = this_0.t();
|
|
1788
|
+
while (_iterator__ex2g4s.u()) {
|
|
1789
|
+
var e = _iterator__ex2g4s.v();
|
|
1790
|
+
var key = e.lu_1;
|
|
1791
|
+
if (set.x(key)) {
|
|
1792
|
+
list.x(e);
|
|
1793
|
+
}
|
|
1794
|
+
}
|
|
1795
|
+
// Inline function 'kotlin.collections.map' call
|
|
1796
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
1797
|
+
var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(list, 10));
|
|
1798
|
+
var _iterator__ex2g4s_0 = list.t();
|
|
1799
|
+
while (_iterator__ex2g4s_0.u()) {
|
|
1800
|
+
var item = _iterator__ex2g4s_0.v();
|
|
1801
|
+
var tmp$ret$2 = import_0('.' + item.lu_1, item.lu_1);
|
|
1802
|
+
destination.x(tmp$ret$2);
|
|
1803
|
+
}
|
|
1804
|
+
var typeImports = destination;
|
|
1805
|
+
// Inline function 'kotlin.collections.map' call
|
|
1806
|
+
var this_1 = type.wo_1.so_1;
|
|
1807
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
1808
|
+
var destination_0 = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_1, 10));
|
|
1809
|
+
var _iterator__ex2g4s_1 = this_1.t();
|
|
1810
|
+
while (_iterator__ex2g4s_1.u()) {
|
|
1811
|
+
var item_0 = _iterator__ex2g4s_1.v();
|
|
1812
|
+
var tmp$ret$5 = item_0.ap_1.l1();
|
|
1813
|
+
destination_0.x(tmp$ret$5);
|
|
1814
|
+
}
|
|
1815
|
+
var fieldNames = toSet(destination_0);
|
|
1816
|
+
// Inline function 'community.flock.wirespec.ir.core.transform' call
|
|
1817
|
+
var this_2 = convertWithValidation(type, module_0);
|
|
1818
|
+
var scope = new TransformScope(this_2);
|
|
1819
|
+
// Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
|
|
1820
|
+
var tmp = scope;
|
|
1821
|
+
// Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
|
|
1822
|
+
var this_3 = scope.z1t_1;
|
|
1823
|
+
// Inline function 'community.flock.wirespec.ir.core.transformer' call
|
|
1824
|
+
// Inline function 'kotlin.apply' call
|
|
1825
|
+
var this_4 = new TransformerBuilder();
|
|
1826
|
+
this_4.d1h(PythonIrEmitter$emit$lambda_0(fieldNames));
|
|
1827
|
+
var tmp$ret$10 = this_4.e1h();
|
|
1828
|
+
tmp.z1t_1 = transform(this_3, tmp$ret$10);
|
|
1829
|
+
var tmp_0 = scope.z1t_1;
|
|
1830
|
+
var tmp$ret$14 = isInterface(tmp_0, Element) ? tmp_0 : THROW_CCE();
|
|
1831
|
+
var file = sanitizeNames(tmp$ret$14, _get_sanitizationConfig__sns434(this));
|
|
1832
|
+
var tmp_1;
|
|
1833
|
+
// Inline function 'kotlin.collections.isNotEmpty' call
|
|
1834
|
+
if (!typeImports.r()) {
|
|
1835
|
+
tmp_1 = file.x1m(VOID, plus(typeImports, file.u1m_1));
|
|
1836
|
+
} else {
|
|
1837
|
+
tmp_1 = file;
|
|
1838
|
+
}
|
|
1839
|
+
return tmp_1;
|
|
1840
|
+
};
|
|
1841
|
+
protoOf(PythonIrEmitter).ir = function (enum_0, module_0) {
|
|
1842
|
+
// Inline function 'community.flock.wirespec.ir.core.transform' call
|
|
1843
|
+
var this_0 = convert_0(enum_0);
|
|
1844
|
+
var scope = new TransformScope(this_0);
|
|
1845
|
+
// Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
|
|
1846
|
+
var tmp = scope;
|
|
1847
|
+
// Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
|
|
1848
|
+
var this_1 = scope.z1t_1;
|
|
1849
|
+
// Inline function 'community.flock.wirespec.ir.core.transformer' call
|
|
1850
|
+
// Inline function 'kotlin.apply' call
|
|
1851
|
+
var this_2 = new TransformerBuilder();
|
|
1852
|
+
this_2.d1h(PythonIrEmitter$emit$lambda_1(this));
|
|
1853
|
+
var tmp$ret$2 = this_2.e1h();
|
|
1854
|
+
tmp.z1t_1 = transform(this_1, tmp$ret$2);
|
|
1855
|
+
var tmp_0 = scope.z1t_1;
|
|
1856
|
+
var tmp$ret$6 = isInterface(tmp_0, Element) ? tmp_0 : THROW_CCE();
|
|
1857
|
+
return sanitizeNames(tmp$ret$6, _get_sanitizationConfig__sns434(this));
|
|
1858
|
+
};
|
|
1859
|
+
protoOf(PythonIrEmitter).yq = function (union) {
|
|
1860
|
+
return sanitizeNames(convert_1(union), _get_sanitizationConfig__sns434(this));
|
|
1861
|
+
};
|
|
1862
|
+
protoOf(PythonIrEmitter).dr = function (refined) {
|
|
1863
|
+
var file = convert_2(refined);
|
|
1864
|
+
// Inline function 'community.flock.wirespec.ir.core.findElement' call
|
|
1865
|
+
// Inline function 'kotlin.collections.filterIsInstance' call
|
|
1866
|
+
var tmp0 = file.v1m();
|
|
1867
|
+
// Inline function 'kotlin.collections.filterIsInstanceTo' call
|
|
1868
|
+
var destination = ArrayList_init_$Create$();
|
|
1869
|
+
var _iterator__ex2g4s = tmp0.t();
|
|
1870
|
+
while (_iterator__ex2g4s.u()) {
|
|
1871
|
+
var element = _iterator__ex2g4s.v();
|
|
1872
|
+
if (element instanceof Struct) {
|
|
1873
|
+
destination.x(element);
|
|
1874
|
+
}
|
|
1875
|
+
}
|
|
1876
|
+
var tmp$ret$2 = firstOrNull_0(destination);
|
|
1877
|
+
var struct = ensureNotNull(tmp$ret$2);
|
|
1878
|
+
// Inline function 'kotlin.collections.mapNotNull' call
|
|
1879
|
+
var tmp0_0 = struct.j1n_1;
|
|
1880
|
+
// Inline function 'kotlin.collections.mapNotNullTo' call
|
|
1881
|
+
var destination_0 = ArrayList_init_$Create$();
|
|
1882
|
+
// Inline function 'kotlin.collections.forEach' call
|
|
1883
|
+
var _iterator__ex2g4s_0 = tmp0_0.t();
|
|
1884
|
+
while (_iterator__ex2g4s_0.u()) {
|
|
1885
|
+
var element_0 = _iterator__ex2g4s_0.v();
|
|
1886
|
+
var tmp;
|
|
1887
|
+
var tmp_0;
|
|
1888
|
+
if (element_0 instanceof Function) {
|
|
1889
|
+
tmp_0 = element_0.t1j_1.equals(Companion_getInstance().m1h('validate'));
|
|
1890
|
+
} else {
|
|
1891
|
+
tmp_0 = false;
|
|
1892
|
+
}
|
|
1893
|
+
if (tmp_0) {
|
|
1894
|
+
var constraintExpr = convertConstraint(refined.cr_1, new FieldCall(new VariableReference(Companion_getInstance().m1h('self')), Companion_getInstance().m1h('value')));
|
|
1895
|
+
tmp = function_0('validate', VOID, VOID, PythonIrEmitter$emit$lambda_2(constraintExpr));
|
|
1896
|
+
} else {
|
|
1897
|
+
var tmp_1;
|
|
1898
|
+
if (element_0 instanceof Function) {
|
|
1899
|
+
tmp_1 = element_0.t1j_1.equals(Companion_getInstance().m1h('toString'));
|
|
1900
|
+
} else {
|
|
1901
|
+
tmp_1 = false;
|
|
1902
|
+
}
|
|
1903
|
+
if (tmp_1) {
|
|
1904
|
+
var tmp_2;
|
|
1905
|
+
if (refined.cr_1.pu_1 instanceof String_0) {
|
|
1906
|
+
tmp_2 = 'self.value';
|
|
1907
|
+
} else {
|
|
1908
|
+
tmp_2 = 'str(self.value)';
|
|
1909
|
+
}
|
|
1910
|
+
var toStringExpr = tmp_2;
|
|
1911
|
+
tmp = function_0('__str__', VOID, VOID, PythonIrEmitter$emit$lambda_3(toStringExpr));
|
|
1912
|
+
} else {
|
|
1913
|
+
tmp = element_0;
|
|
1914
|
+
}
|
|
1915
|
+
}
|
|
1916
|
+
var tmp0_safe_receiver = tmp;
|
|
1917
|
+
if (tmp0_safe_receiver == null)
|
|
1918
|
+
null;
|
|
1919
|
+
else {
|
|
1920
|
+
// Inline function 'kotlin.let' call
|
|
1921
|
+
destination_0.x(tmp0_safe_receiver);
|
|
1922
|
+
}
|
|
1923
|
+
}
|
|
1924
|
+
var updatedStruct = struct.l1n(VOID, VOID, VOID, VOID, destination_0);
|
|
1925
|
+
// Inline function 'community.flock.wirespec.ir.core.transform' call
|
|
1926
|
+
var scope = new TransformScope(file);
|
|
1927
|
+
// Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
|
|
1928
|
+
var tmp_3 = scope;
|
|
1929
|
+
// Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
|
|
1930
|
+
var this_0 = scope.z1t_1;
|
|
1931
|
+
// Inline function 'community.flock.wirespec.ir.core.transformer' call
|
|
1932
|
+
// Inline function 'kotlin.apply' call
|
|
1933
|
+
var this_1 = new TransformerBuilder();
|
|
1934
|
+
this_1.d1h(PythonIrEmitter$emit$lambda_4(updatedStruct));
|
|
1935
|
+
var tmp$ret$12 = this_1.e1h();
|
|
1936
|
+
tmp_3.z1t_1 = transform(this_0, tmp$ret$12);
|
|
1937
|
+
var tmp_4 = scope.z1t_1;
|
|
1938
|
+
var tmp$ret$16 = isInterface(tmp_4, Element) ? tmp_4 : THROW_CCE();
|
|
1939
|
+
return sanitizeNames(tmp$ret$16, _get_sanitizationConfig__sns434(this));
|
|
1940
|
+
};
|
|
1941
|
+
protoOf(PythonIrEmitter).jr = function (endpoint) {
|
|
1942
|
+
// Inline function 'kotlin.collections.distinctBy' call
|
|
1943
|
+
var this_0 = importReferences(endpoint);
|
|
1944
|
+
var set = HashSet_init_$Create$();
|
|
1945
|
+
var list = ArrayList_init_$Create$();
|
|
1946
|
+
var _iterator__ex2g4s = this_0.t();
|
|
1947
|
+
while (_iterator__ex2g4s.u()) {
|
|
1948
|
+
var e = _iterator__ex2g4s.v();
|
|
1949
|
+
var key = e.lu_1;
|
|
1950
|
+
if (set.x(key)) {
|
|
1951
|
+
list.x(e);
|
|
1952
|
+
}
|
|
1953
|
+
}
|
|
1954
|
+
// Inline function 'kotlin.collections.map' call
|
|
1955
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
1956
|
+
var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(list, 10));
|
|
1957
|
+
var _iterator__ex2g4s_0 = list.t();
|
|
1958
|
+
while (_iterator__ex2g4s_0.u()) {
|
|
1959
|
+
var item = _iterator__ex2g4s_0.v();
|
|
1960
|
+
var tmp$ret$2 = import_0('..model.' + item.lu_1, item.lu_1);
|
|
1961
|
+
destination.x(tmp$ret$2);
|
|
1962
|
+
}
|
|
1963
|
+
var endpointImports = destination;
|
|
1964
|
+
// Inline function 'community.flock.wirespec.ir.core.findElement' call
|
|
1965
|
+
// Inline function 'kotlin.collections.filterIsInstance' call
|
|
1966
|
+
var tmp0 = convert_3(endpoint).v1m();
|
|
1967
|
+
// Inline function 'kotlin.collections.filterIsInstanceTo' call
|
|
1968
|
+
var destination_0 = ArrayList_init_$Create$();
|
|
1969
|
+
var _iterator__ex2g4s_1 = tmp0.t();
|
|
1970
|
+
while (_iterator__ex2g4s_1.u()) {
|
|
1971
|
+
var element = _iterator__ex2g4s_1.v();
|
|
1972
|
+
if (element instanceof Namespace) {
|
|
1973
|
+
destination_0.x(element);
|
|
1974
|
+
}
|
|
1975
|
+
}
|
|
1976
|
+
var tmp$ret$7 = firstOrNull_0(destination_0);
|
|
1977
|
+
var converted = ensureNotNull(tmp$ret$7);
|
|
1978
|
+
var flattened = flattenNestedStructs(converted);
|
|
1979
|
+
// Inline function 'kotlin.collections.partition' call
|
|
1980
|
+
var this_1 = flattened.a1n_1;
|
|
1981
|
+
var first = ArrayList_init_$Create$();
|
|
1982
|
+
var second = ArrayList_init_$Create$();
|
|
1983
|
+
var _iterator__ex2g4s_2 = this_1.t();
|
|
1984
|
+
while (_iterator__ex2g4s_2.u()) {
|
|
1985
|
+
var element_0 = _iterator__ex2g4s_2.v();
|
|
1986
|
+
var tmp;
|
|
1987
|
+
if (element_0 instanceof Struct) {
|
|
1988
|
+
tmp = true;
|
|
1989
|
+
} else {
|
|
1990
|
+
tmp = element_0 instanceof Union_0;
|
|
1991
|
+
}
|
|
1992
|
+
if (tmp) {
|
|
1993
|
+
first.x(element_0);
|
|
1994
|
+
} else {
|
|
1995
|
+
second.x(element_0);
|
|
1996
|
+
}
|
|
1997
|
+
}
|
|
1998
|
+
var _destruct__k2r9zo = new Pair(first, second);
|
|
1999
|
+
var moduleElements = _destruct__k2r9zo.ne();
|
|
2000
|
+
var classElements = _destruct__k2r9zo.oe();
|
|
2001
|
+
var endpointClass = new Namespace(converted.z1m_1, classElements, converted.b1n_1);
|
|
2002
|
+
// Inline function 'kotlin.collections.buildList' call
|
|
2003
|
+
// Inline function 'kotlin.collections.buildListInternal' call
|
|
2004
|
+
// Inline function 'kotlin.apply' call
|
|
2005
|
+
var this_2 = ArrayList_init_$Create$();
|
|
2006
|
+
this_2.e1(endpointImports);
|
|
2007
|
+
this_2.e1(moduleElements);
|
|
2008
|
+
this_2.x(endpointClass);
|
|
2009
|
+
var tmp$ret$13 = this_2.o5();
|
|
2010
|
+
return sanitizeNames(snakeCaseHandlerAndCallMethods(this, new File(converted.z1m_1, tmp$ret$13)), _get_sanitizationConfig__sns434(this));
|
|
2011
|
+
};
|
|
2012
|
+
protoOf(PythonIrEmitter).xq = function (channel) {
|
|
2013
|
+
return sanitizeNames(convert_4(channel), _get_sanitizationConfig__sns434(this));
|
|
2014
|
+
};
|
|
2015
|
+
protoOf(PythonIrEmitter).q1u = function (endpoint) {
|
|
2016
|
+
// Inline function 'kotlin.collections.distinctBy' call
|
|
2017
|
+
var this_0 = importReferences(endpoint);
|
|
2018
|
+
var set = HashSet_init_$Create$();
|
|
2019
|
+
var list = ArrayList_init_$Create$();
|
|
2020
|
+
var _iterator__ex2g4s = this_0.t();
|
|
2021
|
+
while (_iterator__ex2g4s.u()) {
|
|
2022
|
+
var e = _iterator__ex2g4s.v();
|
|
2023
|
+
var key = e.lu_1;
|
|
2024
|
+
if (set.x(key)) {
|
|
2025
|
+
list.x(e);
|
|
2026
|
+
}
|
|
2027
|
+
}
|
|
2028
|
+
// Inline function 'kotlin.collections.map' call
|
|
2029
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
2030
|
+
var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(list, 10));
|
|
2031
|
+
var _iterator__ex2g4s_0 = list.t();
|
|
2032
|
+
while (_iterator__ex2g4s_0.u()) {
|
|
2033
|
+
var item = _iterator__ex2g4s_0.v();
|
|
2034
|
+
var tmp$ret$2 = import_0('..model.' + item.lu_1, item.lu_1);
|
|
2035
|
+
destination.x(tmp$ret$2);
|
|
2036
|
+
}
|
|
2037
|
+
var modelImports = destination;
|
|
2038
|
+
var endpointImport = import_0('..endpoint.' + endpoint.ep_1.l1(), '*');
|
|
2039
|
+
var endpointName = endpoint.ep_1.l1();
|
|
2040
|
+
var file = flattenEndpointTypeRefs(this, snakeCaseClientFunctions(this, addSelfReceiverToClientFields(this, sanitizeNames(emitEndpointClient.call(this, endpoint), _get_sanitizationConfig__sns434(this)))), endpointName);
|
|
2041
|
+
var subPackageName = plus_1(this.g1y_1, 'client');
|
|
2042
|
+
return new File(Companion_getInstance().m1h(subPackageName.or() + file.t1m_1.x1l()), plus(plus(plus(buildImports(this, '..wirespec'), modelImports), listOf_0(endpointImport)), file.u1m_1));
|
|
2043
|
+
};
|
|
2044
|
+
protoOf(PythonIrEmitter).p1u = function (endpoints, logger) {
|
|
2045
|
+
// Inline function 'kotlin.collections.flatMap' call
|
|
2046
|
+
// Inline function 'kotlin.collections.flatMapTo' call
|
|
2047
|
+
var destination = ArrayList_init_$Create$();
|
|
2048
|
+
var _iterator__ex2g4s = endpoints.t();
|
|
2049
|
+
while (_iterator__ex2g4s.u()) {
|
|
2050
|
+
var element = _iterator__ex2g4s.v();
|
|
2051
|
+
var list = importReferences(element);
|
|
2052
|
+
addAll(destination, list);
|
|
2053
|
+
}
|
|
2054
|
+
// Inline function 'kotlin.collections.distinctBy' call
|
|
2055
|
+
var set = HashSet_init_$Create$();
|
|
2056
|
+
var list_0 = ArrayList_init_$Create$();
|
|
2057
|
+
var _iterator__ex2g4s_0 = destination.t();
|
|
2058
|
+
while (_iterator__ex2g4s_0.u()) {
|
|
2059
|
+
var e = _iterator__ex2g4s_0.v();
|
|
2060
|
+
var key = e.lu_1;
|
|
2061
|
+
if (set.x(key)) {
|
|
2062
|
+
list_0.x(e);
|
|
2063
|
+
}
|
|
2064
|
+
}
|
|
2065
|
+
// Inline function 'kotlin.collections.map' call
|
|
2066
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
2067
|
+
var destination_0 = ArrayList_init_$Create$_0(collectionSizeOrDefault(list_0, 10));
|
|
2068
|
+
var _iterator__ex2g4s_1 = list_0.t();
|
|
2069
|
+
while (_iterator__ex2g4s_1.u()) {
|
|
2070
|
+
var item = _iterator__ex2g4s_1.v();
|
|
2071
|
+
var tmp$ret$5 = import_0('.model.' + item.lu_1, item.lu_1);
|
|
2072
|
+
destination_0.x(tmp$ret$5);
|
|
2073
|
+
}
|
|
2074
|
+
var modelImports = destination_0;
|
|
2075
|
+
// Inline function 'kotlin.collections.map' call
|
|
2076
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
2077
|
+
var destination_1 = ArrayList_init_$Create$_0(collectionSizeOrDefault(endpoints, 10));
|
|
2078
|
+
var _iterator__ex2g4s_2 = endpoints.t();
|
|
2079
|
+
while (_iterator__ex2g4s_2.u()) {
|
|
2080
|
+
var item_0 = _iterator__ex2g4s_2.v();
|
|
2081
|
+
var tmp$ret$8 = import_0('.endpoint.' + item_0.ep_1.l1(), '*');
|
|
2082
|
+
destination_1.x(tmp$ret$8);
|
|
2083
|
+
}
|
|
2084
|
+
var endpointImports = destination_1;
|
|
2085
|
+
// Inline function 'kotlin.collections.map' call
|
|
2086
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
2087
|
+
var destination_2 = ArrayList_init_$Create$_0(collectionSizeOrDefault(endpoints, 10));
|
|
2088
|
+
var _iterator__ex2g4s_3 = endpoints.t();
|
|
2089
|
+
while (_iterator__ex2g4s_3.u()) {
|
|
2090
|
+
var item_1 = _iterator__ex2g4s_3.v();
|
|
2091
|
+
var tmp$ret$11 = import_0('.client.' + item_1.ep_1.l1() + 'Client', item_1.ep_1.l1() + 'Client');
|
|
2092
|
+
destination_2.x(tmp$ret$11);
|
|
2093
|
+
}
|
|
2094
|
+
var clientImports = destination_2;
|
|
2095
|
+
var allImports = plus(plus(modelImports, endpointImports), clientImports);
|
|
2096
|
+
// Inline function 'kotlin.collections.map' call
|
|
2097
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
2098
|
+
var destination_3 = ArrayList_init_$Create$_0(collectionSizeOrDefault(endpoints, 10));
|
|
2099
|
+
var _iterator__ex2g4s_4 = endpoints.t();
|
|
2100
|
+
while (_iterator__ex2g4s_4.u()) {
|
|
2101
|
+
var item_2 = _iterator__ex2g4s_4.v();
|
|
2102
|
+
var tmp$ret$14 = item_2.ep_1.l1();
|
|
2103
|
+
destination_3.x(tmp$ret$14);
|
|
2104
|
+
}
|
|
2105
|
+
var endpointNames = destination_3;
|
|
2106
|
+
// Inline function 'kotlin.let' call
|
|
2107
|
+
// Inline function 'kotlin.collections.fold' call
|
|
2108
|
+
var accumulator = snakeCaseClientFunctions(this, addSelfReceiverToClientFields(this, sanitizeNames(emitClient.call(this, endpoints, logger), _get_sanitizationConfig__sns434(this))));
|
|
2109
|
+
var _iterator__ex2g4s_5 = endpointNames.t();
|
|
2110
|
+
while (_iterator__ex2g4s_5.u()) {
|
|
2111
|
+
var element_0 = _iterator__ex2g4s_5.v();
|
|
2112
|
+
var acc = accumulator;
|
|
2113
|
+
accumulator = flattenEndpointTypeRefs(this, acc, element_0);
|
|
2114
|
+
}
|
|
2115
|
+
var file = accumulator;
|
|
2116
|
+
return new File(Companion_getInstance().m1h(this.g1y_1.or() + file.t1m_1.x1l()), plus(plus(buildImports(this, '.wirespec'), allImports), file.u1m_1));
|
|
2117
|
+
};
|
|
1043
2118
|
function PythonRefinedTypeDefinitionEmitter() {
|
|
1044
2119
|
}
|
|
1045
2120
|
function PythonShared() {
|
|
1046
|
-
this.
|
|
1047
|
-
this.
|
|
2121
|
+
this.z1x_1 = 'shared';
|
|
2122
|
+
this.a1y_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, Generic[T]):\n @property\n @abstractmethod\n def value(self) -> T: 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";
|
|
1048
2123
|
}
|
|
2124
|
+
protoOf(PythonShared).r1w = function () {
|
|
2125
|
+
return this.a1y_1;
|
|
2126
|
+
};
|
|
1049
2127
|
protoOf(PythonShared).toString = function () {
|
|
1050
2128
|
return 'PythonShared';
|
|
1051
2129
|
};
|
|
@@ -1057,7 +2135,6 @@ protoOf(PythonShared).equals = function (other) {
|
|
|
1057
2135
|
return true;
|
|
1058
2136
|
if (!(other instanceof PythonShared))
|
|
1059
2137
|
return false;
|
|
1060
|
-
other instanceof PythonShared || THROW_CCE();
|
|
1061
2138
|
return true;
|
|
1062
2139
|
};
|
|
1063
2140
|
var PythonShared_instance;
|
|
@@ -1066,17 +2143,17 @@ function PythonShared_getInstance() {
|
|
|
1066
2143
|
}
|
|
1067
2144
|
function PythonTypeDefinitionEmitter$emit$lambda(this$0) {
|
|
1068
2145
|
return function (it) {
|
|
1069
|
-
return this$0.
|
|
2146
|
+
return this$0.e1y(it);
|
|
1070
2147
|
};
|
|
1071
2148
|
}
|
|
1072
2149
|
function PythonTypeDefinitionEmitter$emit$lambda_0(this$0) {
|
|
1073
2150
|
return function (it) {
|
|
1074
|
-
return this$0.
|
|
2151
|
+
return this$0.e1y(it);
|
|
1075
2152
|
};
|
|
1076
2153
|
}
|
|
1077
2154
|
function PythonTypeDefinitionEmitter$emit$lambda_1(this$0) {
|
|
1078
2155
|
return function (it) {
|
|
1079
|
-
return Spacer_instance.toString() + this$0.
|
|
2156
|
+
return Spacer_instance.toString() + this$0.wp(it);
|
|
1080
2157
|
};
|
|
1081
2158
|
}
|
|
1082
2159
|
function PythonTypeDefinitionEmitter() {
|
|
@@ -1084,25 +2161,26 @@ function PythonTypeDefinitionEmitter() {
|
|
|
1084
2161
|
function PythonUnionDefinitionEmitter() {
|
|
1085
2162
|
}
|
|
1086
2163
|
//region block: post-declaration
|
|
1087
|
-
protoOf(PythonEmitter).
|
|
1088
|
-
protoOf(PythonEmitter).
|
|
1089
|
-
protoOf(PythonEmitter).
|
|
1090
|
-
protoOf(PythonEmitter).
|
|
1091
|
-
protoOf(PythonEmitter).
|
|
1092
|
-
protoOf(PythonEmitter).
|
|
1093
|
-
protoOf(PythonEmitter).
|
|
1094
|
-
protoOf(PythonEmitter).
|
|
1095
|
-
protoOf(PythonEmitter).
|
|
1096
|
-
protoOf(PythonEmitter).
|
|
1097
|
-
protoOf(PythonEmitter).
|
|
1098
|
-
protoOf(PythonEmitter).
|
|
1099
|
-
protoOf(PythonEmitter).
|
|
1100
|
-
protoOf(PythonEmitter).
|
|
1101
|
-
protoOf(PythonEmitter).
|
|
1102
|
-
protoOf(PythonEmitter).
|
|
1103
|
-
protoOf(PythonEmitter).
|
|
1104
|
-
protoOf(PythonEmitter).
|
|
1105
|
-
protoOf(PythonEmitter).
|
|
2164
|
+
protoOf(PythonEmitter).up = emit_5;
|
|
2165
|
+
protoOf(PythonEmitter).vp = emit_6;
|
|
2166
|
+
protoOf(PythonEmitter).wp = emit_7;
|
|
2167
|
+
protoOf(PythonEmitter).xp = emit_8;
|
|
2168
|
+
protoOf(PythonEmitter).yp = emit_10;
|
|
2169
|
+
protoOf(PythonEmitter).ir = emit_4;
|
|
2170
|
+
protoOf(PythonEmitter).dr = emit_11;
|
|
2171
|
+
protoOf(PythonEmitter).jr = emit_13;
|
|
2172
|
+
protoOf(PythonEmitter).yq = emit_12;
|
|
2173
|
+
protoOf(PythonEmitter).wq = emit_3;
|
|
2174
|
+
protoOf(PythonEmitter).xq = emit_2;
|
|
2175
|
+
protoOf(PythonEmitter).b1y = emit_9;
|
|
2176
|
+
protoOf(PythonEmitter).x1v = emit_14;
|
|
2177
|
+
protoOf(PythonEmitter).c1y = emit_15;
|
|
2178
|
+
protoOf(PythonEmitter).kr = emitValidator;
|
|
2179
|
+
protoOf(PythonEmitter).s1w = sanitize;
|
|
2180
|
+
protoOf(PythonEmitter).a1w = sanitizeKeywords;
|
|
2181
|
+
protoOf(PythonEmitter).d1y = emitType;
|
|
2182
|
+
protoOf(PythonEmitter).e1y = emitReferenceCustomImports;
|
|
2183
|
+
protoOf(PythonIrEmitter).on = emit_1;
|
|
1106
2184
|
//endregion
|
|
1107
2185
|
//region block: init
|
|
1108
2186
|
PythonShared_instance = new PythonShared();
|
|
@@ -1110,7 +2188,7 @@ PythonShared_instance = new PythonShared();
|
|
|
1110
2188
|
//region block: exports
|
|
1111
2189
|
export {
|
|
1112
2190
|
PythonEmitter as PythonEmitter2pjclp0u1gkmn,
|
|
1113
|
-
|
|
2191
|
+
PythonIrEmitter as PythonIrEmittergogj1wcisct7,
|
|
1114
2192
|
};
|
|
1115
2193
|
//endregion
|
|
1116
2194
|
|