@darabonba/python-generator 1.2.19 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (152) hide show
  1. package/ChangeLog.md +0 -158
  2. package/lib/builtin.js +818 -0
  3. package/lib/generator.js +2708 -0
  4. package/lib/helper.js +422 -0
  5. package/package.json +6 -5
  6. package/tests/expected/alias/setup.py +79 -0
  7. package/tests/expected/alias/tea_python_tests/__init__.py +1 -0
  8. package/tests/expected/alias/tea_python_tests/client.py +35 -0
  9. package/tests/expected/annotation/tea_python_tests/__init__.py +1 -0
  10. package/tests/expected/annotation/tea_python_tests/client.py +93 -0
  11. package/tests/expected/annotation/tea_python_tests/models.py +37 -0
  12. package/tests/expected/api/tea_python_tests/__init__.py +1 -0
  13. package/tests/expected/api/tea_python_tests/client.py +106 -0
  14. package/tests/expected/builtin/tea_python_tests/client.py +685 -0
  15. package/tests/expected/comment/tea_python_tests/__init__.py +1 -0
  16. package/tests/expected/comment/tea_python_tests/client.py +288 -0
  17. package/tests/expected/comment/tea_python_tests/models.py +195 -0
  18. package/tests/expected/complex/tea_python_tests/__init__.py +1 -0
  19. package/tests/expected/complex/tea_python_tests/client.py +1169 -0
  20. package/tests/expected/complex/tea_python_tests/exceptions.py +39 -0
  21. package/tests/expected/complex/tea_python_tests/models.py +570 -0
  22. package/tests/expected/const/tea_python_tests/__init__.py +1 -0
  23. package/tests/expected/const/tea_python_tests/client.py +14 -0
  24. package/{src/langs/python/files/setup.py.tmpl → tests/expected/empty/setup.py} +11 -11
  25. package/tests/expected/empty/tea_python_tests/__init__.py +1 -0
  26. package/tests/expected/empty/tea_python_tests/client.py +10 -0
  27. package/tests/expected/exec/tea_python_tests/__init__.py +1 -0
  28. package/tests/expected/exec/tea_python_tests/exec_client.py +21 -0
  29. package/tests/expected/function/tea_python_tests/__init__.py +1 -0
  30. package/tests/expected/function/tea_python_tests/client.py +64 -0
  31. package/tests/expected/import/setup.py +78 -0
  32. package/tests/expected/import/tea_python_tests/__init__.py +1 -0
  33. package/tests/expected/import/tea_python_tests/client.py +29 -0
  34. package/tests/expected/map/tea_python_tests/__init__.py +1 -0
  35. package/tests/expected/map/tea_python_tests/client.py +39 -0
  36. package/tests/expected/model/tea_python_tests/__init__.py +1 -0
  37. package/tests/expected/model/tea_python_tests/client.py +10 -0
  38. package/tests/expected/model/tea_python_tests/exceptions.py +28 -0
  39. package/tests/expected/model/tea_python_tests/models.py +780 -0
  40. package/tests/expected/multi/tea_python_tests/api.py +95 -0
  41. package/tests/expected/multi/tea_python_tests/client.py +40 -0
  42. package/tests/expected/multi/tea_python_tests/lib/util.py +19 -0
  43. package/tests/expected/multi/tea_python_tests/model/user.py +26 -0
  44. package/tests/expected/multi/tea_python_tests/model/user_exceptions.py +83 -0
  45. package/tests/expected/multi/tea_python_tests/model/user_models.py +145 -0
  46. package/tests/expected/statements/tea_python_tests/__init__.py +1 -0
  47. package/tests/expected/statements/tea_python_tests/client.py +86 -0
  48. package/tests/expected/super/tea_python_tests/__init__.py +1 -0
  49. package/tests/expected/super/tea_python_tests/client.py +16 -0
  50. package/tests/expected/typedef/setup.py +77 -0
  51. package/tests/expected/typedef/tea_python_tests/__init__.py +1 -0
  52. package/tests/expected/typedef/tea_python_tests/client.py +74 -0
  53. package/tests/expected/typedef/tea_python_tests/models.py +42 -0
  54. package/tests/fixtures/alias/Darafile +11 -0
  55. package/tests/fixtures/alias/libraries/Alias/Darafile +11 -0
  56. package/tests/fixtures/alias/libraries/Alias-Symbol/Darafile +11 -0
  57. package/tests/fixtures/builtin/Darafile +6 -0
  58. package/tests/fixtures/builtin/main.dara +333 -0
  59. package/tests/fixtures/complex/libraries/import.dara +18 -11
  60. package/tests/fixtures/complex/main.dara +452 -103
  61. package/tests/fixtures/import/libraries/Darafile +1 -1
  62. package/tests/fixtures/import/pack/Darafile +3 -0
  63. package/tests/fixtures/map/libraries/Darafile +3 -0
  64. package/tests/fixtures/map/libraries/import.dara +4 -0
  65. package/tests/fixtures/map/main.dara +17 -2
  66. package/tests/fixtures/model/.libraries.json +3 -0
  67. package/tests/fixtures/model/Darafile +5 -2
  68. package/tests/fixtures/model/libraries/Darafile +20 -0
  69. package/tests/fixtures/model/libraries/import.dara +27 -0
  70. package/tests/fixtures/model/main.dara +60 -42
  71. package/tests/fixtures/multi/.libraries.json +3 -0
  72. package/tests/fixtures/multi/Darafile +12 -0
  73. package/tests/fixtures/multi/api.dara +20 -0
  74. package/tests/fixtures/multi/lib/util.dara +5 -0
  75. package/tests/fixtures/multi/libraries/darabonba_Util_0.2.11/Teafile +68 -0
  76. package/tests/fixtures/multi/libraries/darabonba_Util_0.2.11/main.tea +244 -0
  77. package/tests/fixtures/multi/libraries/darabonba_Util_0.2.11/util.tea +2 -0
  78. package/tests/fixtures/multi/main.dara +32 -0
  79. package/tests/fixtures/multi/model/user.dara +35 -0
  80. package/tests/{python3.tests.js → main.tests.js} +107 -65
  81. package/tests/output/alias/setup.py +79 -0
  82. package/tests/output/alias/tea_python_tests/client.py +35 -0
  83. package/{src/langs/python2/files/setup.py.tmpl → tests/output/annotation/setup.py} +19 -24
  84. package/tests/output/annotation/tea_python_tests/client.py +93 -0
  85. package/tests/output/annotation/tea_python_tests/models.py +37 -0
  86. package/tests/output/api/setup.py +77 -0
  87. package/tests/output/api/tea_python_tests/client.py +106 -0
  88. package/tests/output/builtin/setup.py +77 -0
  89. package/tests/output/builtin/tea_python_tests/client.py +685 -0
  90. package/tests/output/comment/setup.py +77 -0
  91. package/tests/output/comment/tea_python_tests/client.py +288 -0
  92. package/tests/output/comment/tea_python_tests/models.py +195 -0
  93. package/tests/output/complex/setup.py +77 -0
  94. package/tests/output/complex/tea_python_tests/client.py +1169 -0
  95. package/tests/output/complex/tea_python_tests/exceptions.py +39 -0
  96. package/tests/output/complex/tea_python_tests/models.py +570 -0
  97. package/tests/output/const/setup.py +77 -0
  98. package/tests/output/const/tea_python_tests/client.py +14 -0
  99. package/tests/output/empty/setup.py +77 -0
  100. package/tests/output/empty/tea_python_tests/client.py +10 -0
  101. package/tests/output/exec/setup.py +77 -0
  102. package/tests/output/exec/tea_python_tests/exec_client.py +21 -0
  103. package/tests/output/function/setup.py +77 -0
  104. package/tests/output/function/tea_python_tests/client.py +64 -0
  105. package/tests/output/import/setup.py +78 -0
  106. package/tests/output/import/tea_python_tests/client.py +29 -0
  107. package/tests/output/map/setup.py +77 -0
  108. package/tests/output/map/tea_python_tests/client.py +39 -0
  109. package/tests/output/model/setup.py +77 -0
  110. package/tests/output/model/tea_python_tests/client.py +10 -0
  111. package/tests/output/model/tea_python_tests/exceptions.py +28 -0
  112. package/tests/output/model/tea_python_tests/models.py +780 -0
  113. package/tests/output/multi/setup.py +77 -0
  114. package/tests/output/multi/tea_python_tests/api.py +95 -0
  115. package/tests/output/multi/tea_python_tests/client.py +40 -0
  116. package/tests/output/multi/tea_python_tests/lib/util.py +19 -0
  117. package/tests/output/multi/tea_python_tests/model/user.py +26 -0
  118. package/tests/output/multi/tea_python_tests/model/user_exceptions.py +83 -0
  119. package/tests/output/multi/tea_python_tests/model/user_models.py +145 -0
  120. package/tests/output/statements/setup.py +77 -0
  121. package/tests/output/statements/tea_python_tests/client.py +86 -0
  122. package/tests/output/super/setup.py +77 -0
  123. package/tests/output/super/tea_python_tests/client.py +16 -0
  124. package/tests/output/typedef/setup.py +78 -0
  125. package/tests/output/typedef/tea_python_tests/client.py +74 -0
  126. package/tests/output/typedef/tea_python_tests/models.py +42 -0
  127. package/src/generator.js +0 -231
  128. package/src/langs/common/combinator.js +0 -193
  129. package/src/langs/common/config.js +0 -60
  130. package/src/langs/common/enum.js +0 -179
  131. package/src/langs/common/items.js +0 -551
  132. package/src/langs/common/package_info.js +0 -53
  133. package/src/langs/python/combinator.js +0 -1898
  134. package/src/langs/python/config.js +0 -169
  135. package/src/langs/python/files/.gitignore.tmpl +0 -5
  136. package/src/langs/python/files/__init__.py.tmpl +0 -1
  137. package/src/langs/python/package_info.js +0 -78
  138. package/src/langs/python2/combinator.js +0 -1770
  139. package/src/langs/python2/config.js +0 -162
  140. package/src/langs/python2/files/.gitignore.tmpl +0 -5
  141. package/src/langs/python2/files/__init__.py.tmpl +0 -1
  142. package/src/langs/python2/package_info.js +0 -78
  143. package/src/lib/debug.js +0 -55
  144. package/src/lib/emitter.js +0 -95
  145. package/src/lib/helper.js +0 -207
  146. package/src/resolver/base.js +0 -282
  147. package/src/resolver/client.js +0 -1013
  148. package/src/resolver/model.js +0 -159
  149. package/tests/common.tests.js +0 -244
  150. package/tests/lib.tests.js +0 -269
  151. package/tests/python2.tests.js +0 -283
  152. package/tests/resolver.tests.js +0 -434
@@ -2,104 +2,257 @@ import Source;
2
2
 
3
3
  extends Source;
4
4
 
5
- const version = '2019-01-08';
6
-
5
+ type @protocol = string
6
+ type @pathname = string
7
+ type @Strs = [ string ]
8
+ type @compleList = [[string]]
9
+ type @endpointMap = map[string]string
7
10
  type @configs = [ Source.Config ];
8
11
 
9
- init(config: Source.Config){
10
- super(config);
11
- @configs[0] = config;
12
+ init(sourceConfig: Source.Config){
13
+ super(sourceConfig);
14
+ @configs[0] = sourceConfig;
15
+ var test : Source = new Source(sourceConfig);
16
+ printData(sourceConfig, 'test');
17
+ }
18
+
19
+ exception Err1 = {
20
+ data: map[string]string
21
+ }
22
+
23
+ exception Err2 = {
24
+ accessErrMessage: string
12
25
  }
13
26
 
27
+
14
28
  model ComplexRequest = {
15
29
  accessKey: string,
16
30
  body: readable(name='Body', example='Body', description='Body'),
17
31
  strs: [ string ](name='Strs', example='Strs', description='Strs'),
32
+ mapList: [ map[string]any ](name='mapList', example='mapList', description='mapList', deprecated=false),
18
33
  header: {
19
- content: string(name='Content', example='Content', signed='true', description='Body')
34
+ content: string(name='Content', example='Content
35
+
36
+ test example
37
+ test example11', signed='true', description='The ID of the security group to which you want to assign the instance. Instances in the same security group can communicate with each other. The maximum number of instances that a security group can contain depends on the type of the security group. For more information, see the "Security group limits" section in [Limits](https://help.aliyun.com/document_detail/25412.html#SecurityGroupQuota).
38
+
39
+ >Notice: The network type of the new instance must be the same as that of the security group specified by the `SecurityGroupId` parameter. For example, if the specified security group is of the VPC type, the new instance is also of the VPC type and you must specify `VSwitchId`.
40
+
41
+ If you do not use `LaunchTemplateId` or `LaunchTemplateName` to specify a launch template, you must specify SecurityGroupId. Take note of the following items:
42
+
43
+ * You can set `SecurityGroupId` to specify a single security group or set `SecurityGroupIds.N` to specify one or more security groups. However, you cannot specify both `SecurityGroupId` and `SecurityGroupIds.N`.
44
+ * If `NetworkInterface.N.InstanceType` is set to `Primary`, you cannot specify `SecurityGroupId` or `SecurityGroupIds.N` but can specify `NetworkInterface.N.SecurityGroupId` or `NetworkInterface.N.SecurityGroupIds.N`.', nullable=true, checkBlank=true, sensitive=false)
20
45
  }(description='header', name='header'),
21
- Num: number,
22
46
  configs: {
23
47
  key: string,
24
48
  value: [ string ],
25
49
  extra: map[string] string
26
50
  },
27
- part?: [
28
- {
29
- partNumber?: string(description='PartNumber', name='PartNumber')
30
- }
31
- ](description='Part', name='Part'),
32
- complexList: [[[
33
- {
34
- name?: string(name='Name'),
35
- code?: int32(name='Code'),
36
- }
37
- ]]](name='complexList'),
38
- complexList1: [[map[string]string]],
39
- complexList2: [[[
40
- {
41
- any?: any(name='Name'),
42
- }
43
- ]]](name='ComplexList2'),
51
+ num: number(name='num', nullable=false, checkBlank=false, sensitive=true),
52
+ i64: int64,
53
+ f64: double,
54
+ b: boolean,
55
+ f32: float,
56
+ f64List: [ double ],
57
+ floatList: [ float ],
58
+ booleantList: [ boolean ],
59
+ i32: int32,
60
+ stringList: [ string ],
61
+ intList: [ integer ],
62
+ int32List: [ int32 ],
63
+ int16List: [ int16 ],
64
+ int64List: [ int64 ],
65
+ longList: [ long ],
66
+ uint64List: [ uint64 ],
67
+ uint32List: [ uint32 ],
68
+ uint16List: [ uint16 ],
69
+ u64: uint64,
70
+ u32: uint32,
71
+ u16: uint16,
72
+ obj: object,
73
+ any: any,
74
+ byt: bytes,
75
+ req: $Request,
76
+ resp: $Response,
77
+ map: map[string]string,
78
+ numMap: map[string]number,
79
+ modelMap: map[string]Source.Request,
80
+ request: Source.Request,
81
+ client: Source,
82
+ instance: Source.Request.instance,
44
83
  from: string(name='from', description='test keywords'),
45
84
  self: string(name='self', description='test keywords'),
46
85
  print: string(name='print', description='test keywords'),
47
86
  exec: string(name='exec', description='test keywords'),
87
+ str: string(name='srt', description='test keywords'),
88
+ part?: [
89
+ {
90
+ partNumber?: string(description='PartNumber', name='PartNumber')
91
+ }
92
+ ](description='Part', name='Part', deprecated=true),
48
93
  }
49
94
 
50
- async function hello(request: object, strs: [ string ]): [ string ] {
51
- return array1();
95
+ model Response {
96
+ instance: ComplexRequest.part,
52
97
  }
53
98
 
54
- static async function print(reqeust: $Request, reqs: [ ComplexRequest ], response: $Response, val: map[string]string): Source.Request {
55
- return {};
99
+ async function hello(request: object, strs: [ string ], complexList: [[string]]): [ string ] {
100
+ var a : [[string]] = null;
101
+ return array1();
56
102
  }
57
103
 
58
- api complex1(request: ComplexRequest, client: Source): Source.RuntimeObject {
59
- var x = false;
60
- var y = true;
61
- var z = false;
62
- if (x && y || !z) {
63
- x = y;
64
- }
65
- // to map test.
66
- var req = new Source.Request{};
67
- var m = callToMap(req);
68
-
104
+ static async function print(reqeust: $Request, reqs: [ ComplexRequest ], response: $Response, val: map[string]string): Source.Request;
105
+
106
+ static function intToInt32(a: int32):void;
107
+ api Complex1(request: ComplexRequest, sourceClient: Source): Source.RuntimeObject {
69
108
  var name = 'complex';
70
- var mapVal = {test="ok"};
71
- var version = `/${__module.version}${@pathname}`;
109
+ var read : readable = null;
110
+ var byt : bytes = null;
72
111
  var moduleModelMapVal: map[string] Source.RuntimeObject = {};
73
112
  var moduleMapVal: map[string] Source = {};
74
113
  var modelMapVal: map[string] ComplexRequest = {};
75
114
  var subModelMapVal: map[string] ComplexRequest.header = {};
115
+ var reqMap : map[string]ComplexRequest = null;
116
+ var mapString = {
117
+ str = request.accessKey,
118
+ };
119
+ var inte : integer = 1;
120
+ var a : integer = 1;
121
+ var b : int32 = null;
122
+ b = a;
123
+ var c : int32 = a;
124
+ intToInt32(a);
125
+ var mapVal = {
126
+ read = read,
127
+ test = '{"test":"ok"}',
128
+ b = request.b,
129
+ num = request.num,
130
+ u16 = request.u16,
131
+ u32 = request.u32,
132
+ u64 = request.u64,
133
+ u16List = request.uint16List,
134
+ u32List = request.uint32List,
135
+ u64List = request.uint64List,
136
+ i64List = request.int64List,
137
+ i16List = request.int16List,
138
+ i32List = request.int32List,
139
+ intList = request.intList,
140
+ stringList = request.stringList,
141
+ i32 = request.i32,
142
+ booleantList = request.booleantList,
143
+ floatList = request.floatList,
144
+ float64List = request.f64List,
145
+ f32 = request.f32,
146
+ f64 = request.f64,
147
+ i64 = request.i64,
148
+ };
149
+ var abool = true;
150
+ var req = new ComplexRequest{
151
+ b = false,
152
+ num = 10,
153
+ i32 = a,
154
+ intList = [10,11],
155
+ int16List = [10, 11],
156
+ int32List = [10, 11],
157
+ int64List = [10, 11],
158
+ longList = [10L, 11L],
159
+ floatList = [ 0.1f, 0.2f ],
160
+ stringList = ['10','11'],
161
+ booleantList = [ true, false ],
162
+ };
163
+ var longList : [long] = [
164
+ 432435L
165
+ ];
166
+ var anyList : [any] = [
167
+ 432435L,
168
+ "str",
169
+ true,
170
+ 10,
171
+ 0.1f
172
+ ];
173
+ var floatMap : map[string]float = {
174
+ key1 = 0.1f,
175
+ key2 = 0.2
176
+ };
177
+ var doubleMap : map[string]double = {
178
+ key1 = 0.1d,
179
+ key2 = 0.2d
180
+ };
181
+ var intMap : map[string]integer = {
182
+ key1 = 1,
183
+ key2 = 2
184
+ };
185
+ var longMap : map[string]long = {
186
+ key1 = 1,
187
+ key2 = 2
188
+ };
189
+ var int16Map : map[string]int16 = {
190
+ key1 = 1,
191
+ key2 = 2
192
+ };
193
+ var int32Map : map[string]int32 = {
194
+ key1 = 1,
195
+ key2 = 2
196
+ };
197
+ var int64Map : map[string]int64 = {
198
+ key1 = 1,
199
+ key2 = 2
200
+ };
201
+ var anyMap : map[string]any = {
202
+ key1 = 0.1,
203
+ key2 = 1,
204
+ key3 = 'test',
205
+ key4 = true,
206
+ key5 = ['test', 1, true, ['test']],
207
+ key6 = [
208
+ {
209
+ a = "test",
210
+ b = 1,
211
+ c = true,
212
+ d = ['test'],
213
+ }
214
+ ],
215
+ };
216
+
217
+ for (var itemTmp : anyList) {
218
+ $Logger.info(`${itemTmp}`);
219
+ }
220
+
221
+ for (var item : ["1","2"]) {
222
+ var anyMap : map[string]string = {};
223
+ anyMap[item] = 'test';
224
+ break;
225
+ }
226
+ @Strs = request.strs;
227
+ @protocol = 'test';
228
+ @endpointMap[@protocol];
229
+ @endpointMap['test'] = 'ok';
230
+ request.strs = @Strs;
76
231
  __request.protocol = @protocol;
77
- __request.port = 80;
232
+ __request.port = request.num;
78
233
  __request.method = 'GET';
79
234
  __request.pathname = `/${@pathname}`;
80
- __request.query = Source.query({
235
+ __request.query = {
81
236
  date = '2019',
82
- ...request.header,
83
- ...mapVal
84
- });
85
- __request.body = Source.body();
86
- request.from = 'test';
87
- var from = new ComplexRequest{
88
- from = 'test',
237
+ name = __request.method,
238
+ };
239
+ var tmp = {
240
+ ...__request.query,
241
+ ...__request.headers,
242
+ ...__request,
89
243
  };
90
- Complex3(from);
91
244
  } returns {
92
- if (true && true) {
245
+ if (true && true){
93
246
  return null;
94
- } else if (true || false) {
247
+ } else if(Source.judgeStr("test") || false){
95
248
  return new Source.RuntimeObject{};
96
249
  }
97
- client.print(request, '1');
98
- client.printAsync(request, '1');
99
- hello(request, ["1","2"]);
100
- hello(null, null);
101
- Complex3(null);
250
+ sourceClient.printData(request, '1');
251
+ hello(request, ["1","2"], null);
252
+ hello(null, null, null);
102
253
  return {};
254
+ Complex3(null, 'test');
255
+ return null;
103
256
  } runtime {
104
257
  timeouted = 'retry'
105
258
  }
@@ -107,32 +260,44 @@ api complex1(request: ComplexRequest, client: Source): Source.RuntimeObject {
107
260
  api Complex2(request: ComplexRequest, str: [ string ], val: map[string]string): object {
108
261
  var name = 'complex';
109
262
  var config = new Source.Config{};
110
- var client = new Source(config);
263
+ var sourceClient = new Source(config);
264
+ var configArray : [Source.Config] = [config];
265
+ sourceClient.printData(request, '1');
111
266
  __request.protocol = 'HTTP';
112
267
  __request.port = 80;
113
268
  __request.method = 'GET';
114
269
  __request.pathname = '/';
115
- __request.query = Source.query({
270
+ __request.query = {
116
271
  date = '2019',
117
- version = __module.version,
118
272
  protocol = __request.protocol,
273
+ };
274
+ }
119
275
 
120
- });
121
- __request.body = Source.body();
276
+ api ComplexMap(): map[string]any {
277
+ } runtime {
278
+
122
279
  }
123
280
 
124
- api Complex3(request: ComplexRequest): ComplexRequest {
125
- var name = 'complex';
126
- __request.protocol = TemplateString();
281
+ api Complex3(request: ComplexRequest, name: string): ComplexRequest {
282
+ name = 'complex';
283
+ __request.protocol = templateString();
127
284
  __request.port = 80;
128
285
  __request.method = 'GET';
129
286
  __request.pathname = '/';
130
- __request.query = Source.query({
287
+ __request.body = 'body';
288
+ __request.query = {
131
289
  date = '2019',
132
- });
133
- __request.body = Source.body();
134
- __request.headers.host = 'hello';
290
+ };
291
+ var tmp : ComplexRequest = null;
292
+ tmp = returnModel();
293
+ name = @protocol;
135
294
  } returns {
295
+ var x = false;
296
+ var y = true;
297
+ var z = false;
298
+ if (x && y || !z) {
299
+ x = y;
300
+ }
136
301
  var resp = __response;
137
302
  var req = new Source.Request{
138
303
  accesskey = request.accessKey,
@@ -141,17 +306,80 @@ api Complex3(request: ComplexRequest): ComplexRequest {
141
306
  array0(request);
142
307
  req.accesskey = 'accesskey';
143
308
  req.accesskey = request.accessKey;
144
- Source.parse(ComplexRequest);
309
+ printNull();
310
+ throwsFunc();
311
+ __response.statusCode;
145
312
  Source.array(request, '1');
146
- Source.asyncFunc();
147
313
  return {
148
314
  ...__request.query
149
315
  };
150
316
  }
151
317
 
318
+ static function assignWithArray() throws: void {
319
+ var list : [ string ] = null;
320
+ list = [ "test" ];
321
+
322
+ var str : string = null;
323
+ str = throwsFunc();
324
+ }
325
+
326
+ function mapAcess(): any {
327
+ var tmp : map[string]any = {
328
+ protocol = @endpointMap[@protocol]
329
+ };
330
+ return;
331
+ }
332
+
333
+
334
+ async function exprFunc(): [ string ] {
335
+ if (!true) {
336
+
337
+ }
338
+ var num = 10;
339
+ var req = new ComplexRequest{};
340
+ var mapVal : map[string]any = {
341
+ num = 10,
342
+ client = Source,
343
+ strs = array1(),
344
+ str = `string${num}`,
345
+ str1 = `string${req.accessKey}`,
346
+ };
347
+ return null;
348
+ }
349
+
350
+ static async function printNull(): void {
351
+ try {
352
+ var str = templateString();
353
+ } catch(e) {
354
+
355
+ } finally {
356
+ var final = 'ok';
357
+ }
358
+ }
359
+
360
+ static async function testTryWithComplexReturnType(): Source.Request {
361
+ try {
362
+ var str = templateString();
363
+ } catch(e) {
364
+
365
+ } finally {
366
+ var final = 'ok';
367
+ }
368
+ return null;
369
+ }
370
+
371
+ static async function testTryWithComplexReturnTypeWithOutCat(): Source.Request {
372
+ try {
373
+ var str = templateString();
374
+ } catch(e) {
375
+ var sim = 'a';
376
+ } finally {
377
+ var final = 'ok';
378
+ }
379
+ return null;
380
+ }
381
+
152
382
  static function array0(req: object): [ any ] {
153
- var temp = new Source.Config{};
154
- var anyArr : [Source.Config] = [temp];
155
383
  return [];
156
384
  }
157
385
 
@@ -159,29 +387,93 @@ static function array1(): [ string ] {
159
387
  return ["1"];
160
388
  }
161
389
 
162
- static function array2(): [[ any ]] {
163
- var temp = new Source.Config{};
164
- var anyArr : [Source.Config] = [temp];
165
- return [[anyArr]];
390
+ async function templateString(): string {
391
+ return `/${@protocol}`;
166
392
  }
167
393
 
168
- async function TemplateString(): string {
394
+ function intOp(a: integer): void {
395
+ var b = a;
396
+ var tmp: map[string]integer = {
397
+ first = a
398
+ };
399
+ b++;
400
+ ++b;
401
+ b--;
402
+ --b;
403
+ tmp.a++;
404
+ ++tmp.a;
405
+ tmp.a--;
406
+ --tmp.a;
407
+ }
408
+
409
+ function throwsFunc() throws: string {
169
410
  return `/${@protocol}`;
170
411
  }
171
412
 
172
- async function emptyModel(): void {
173
- new ComplexRequest;
174
- new ComplexRequest.header;
175
- var status = '';
176
- try {
177
- status = 'failed';
178
- } catch(e) {
179
- status = 'catch exception';
180
- } finally {
181
- status = 'ok';
413
+ function throwsFunc1() throws: string {
414
+ return '';
415
+ }
416
+
417
+ function throwsFunc2() throws: void {
418
+ throw {
419
+ code = '',
420
+ };
421
+ }
422
+
423
+ function throwsFunc3() throws: string {
424
+ throw {
425
+ code = '',
426
+ };
427
+ }
428
+
429
+ function getInt(num: int32): int32 {
430
+ return num;
431
+ }
432
+
433
+ function returnFunc(): string {
434
+ var index: int32 = 0;
435
+ var i = getInt(index);
436
+ return null;
437
+ }
438
+
439
+ function returnFunc1(cfg: Source.Config): Source {
440
+ var config = new Source.Config{};
441
+ return new Source(config);
442
+ }
443
+
444
+ function returnFunc2(): map[string]any {
445
+ var tmp = {
446
+ subMap = 'ok',
447
+ };
448
+ var mapVal = {
449
+ test = tmp,
450
+ };
451
+ if (Source.judgeStr("test")) {
452
+ return mapVal['test'];
453
+ } else {
454
+ var body : readable = null;
455
+ return {
456
+ body = body,
457
+ ...tmp
458
+ };
182
459
  }
183
460
  }
184
461
 
462
+ function returnModel(): ComplexRequest {
463
+ return new ComplexRequest{};
464
+ }
465
+
466
+ function emptyFunc(): void;
467
+
468
+ api noReturn(): void {
469
+ }
470
+
471
+ function Error(e: $Error): $Error {
472
+ var tmp : $Error = null;
473
+ var c : class = null;
474
+ return e;
475
+ }
476
+
185
477
  static function arrayAccess(): string {
186
478
  var configs = ['a', 'b', 'c'];
187
479
  var config = configs[0];
@@ -196,14 +488,17 @@ static function arrayAccess2(): string {
196
488
  return config;
197
489
  }
198
490
 
199
- static function arrayAccess3(request: ComplexRequest, index: number): string {
491
+ static function arrayAccess3(request: ComplexRequest): string {
492
+ var req = new Source.Request{};
493
+ arrayAccess4([req]);
200
494
  var configVal = request.configs.value[0];
201
- var val = request.configs.value[index];
202
- var i0 = 0;
203
- val = request.configs.value[i0];
204
495
  return configVal;
205
496
  }
206
497
 
498
+ static function arrayAccess4(requests: [ Source.Request ]): string {
499
+ return '';
500
+ }
501
+
207
502
  static function arrayAssign(config: string): [ string ] {
208
503
  var configs = ['a', 'b', 'c'];
209
504
  configs[3] = config;
@@ -220,8 +515,6 @@ static function arrayAssign2(config: string): [ string ] {
220
515
 
221
516
  static function arrayAssign3(request: ComplexRequest, config: string): void {
222
517
  request.configs.value[0] = config;
223
- var i0 = 0;
224
- request.configs.value[i0] = config;
225
518
  }
226
519
 
227
520
  static function mapAccess(request: ComplexRequest): string {
@@ -229,11 +522,8 @@ static function mapAccess(request: ComplexRequest): string {
229
522
  return configInfo;
230
523
  }
231
524
 
232
- static function mapAccess2(request: Source.Request, key: string): string {
525
+ static function mapAccess2(request: Source.Request): string {
233
526
  var configInfo = request.configs.extra['name'];
234
- var configValue = request.configs.extra[key];
235
- var i0 = key;
236
- configValue = request.configs.extra[i0];
237
527
  return configInfo;
238
528
  }
239
529
 
@@ -246,12 +536,35 @@ static function mapAccess3(): string {
246
536
  return data.configs['value'];
247
537
  }
248
538
 
539
+ static function mapAccess4(request: ComplexRequest): string {
540
+ var key : string = 'name';
541
+ var model = request.modelMap[key];
542
+ var configInfo = request.configs.extra[key];
543
+ return configInfo;
544
+ }
545
+
249
546
  static function mapAssign(request: ComplexRequest, name: string): void {
250
547
  request.configs.extra['name'] = name;
251
- var i0 = 'name';
252
- request.configs.extra[i0] = name;
548
+ var key : string = 'name';
549
+ name = key;
550
+ request.configs.extra[key] = name;
551
+ name = request.configs.extra['name'];
552
+ request.map[key] = name;
553
+ request.numMap[key] = 1;
554
+ }
555
+
556
+ static function arrayimport2(request: [ Source.Request ]): string {
557
+ return '';
253
558
  }
254
559
 
560
+ static async function defaultReturn(): void {
561
+ if (true) {
562
+
563
+ } else {
564
+
565
+ }
566
+ }
567
+
255
568
  static function strFmt(): void {
256
569
  var s = 'strtest';
257
570
  var s1 = ` % 1${s}`;
@@ -268,6 +581,42 @@ static function strFmt(): void {
268
581
  var fs3 = `${} ${s}`;
269
582
  }
270
583
 
271
- static function callToMap(m:map[string]any): map[string]any{
272
- return m;
584
+ async function multiTryCatch(a: number): void {
585
+ try {
586
+ if(a > 0) {
587
+ throw new Err1 {
588
+ name = "str",
589
+ code = "str",
590
+ data = {
591
+ key1 = "str",
592
+ }
593
+ };
594
+ } else if(a == 0) {
595
+ throw new Err2 {
596
+ name = "str",
597
+ code = "str",
598
+ accessErrMessage = "str2",
599
+ };
600
+ } else if(a == -10) {
601
+ throw new Source.Err3 {
602
+ name = "str",
603
+ code = "str",
604
+ };
605
+ } else {
606
+ throw new $Error{
607
+ name = "str",
608
+ code = "str",
609
+ }
610
+ }
611
+ } catch(err: Err1) {
612
+ $Logger.log(err.name);
613
+ } catch(err: Err2) {
614
+ $Logger.log(err.name);
615
+ } catch(err: Source.Err3) {
616
+ $Logger.log(err.name);
617
+ } catch(err) {
618
+ $Logger.log(err.name);
619
+ } finally {
620
+ var final = 'ok';
621
+ }
273
622
  }
@@ -30,7 +30,7 @@
30
30
  "clientName": "source_client"
31
31
  },
32
32
  "releases": {
33
- "python": "alibabacloud_import:0.0.1",
33
+ "python": "alibabacloud_import:0.0.1rc1",
34
34
  "python2": "alibabacloud_import_py2:0.0.1"
35
35
  }
36
36
  }
@@ -3,6 +3,9 @@
3
3
  "name": "local",
4
4
  "version": "0.0.1",
5
5
  "main": "./local.dara",
6
+ "python": {
7
+ "package": "Local"
8
+ },
6
9
  "releases": {
7
10
  "python": "alibabacloud_local:0.0.1",
8
11
  "python2": "alibabacloud_local_py2:0.0.1"