@darabonba/python-generator 1.2.19 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ChangeLog.md +0 -158
- package/lib/builtin.js +818 -0
- package/lib/generator.js +2704 -0
- package/lib/helper.js +422 -0
- package/package.json +6 -5
- package/tests/expected/alias/setup.py +79 -0
- package/tests/expected/alias/tea_python_tests/__init__.py +1 -0
- package/tests/expected/alias/tea_python_tests/client.py +35 -0
- package/tests/expected/annotation/tea_python_tests/__init__.py +1 -0
- package/tests/expected/annotation/tea_python_tests/client.py +93 -0
- package/tests/expected/annotation/tea_python_tests/models.py +37 -0
- package/tests/expected/api/tea_python_tests/__init__.py +1 -0
- package/tests/expected/api/tea_python_tests/client.py +106 -0
- package/tests/expected/builtin/tea_python_tests/client.py +685 -0
- package/tests/expected/comment/tea_python_tests/__init__.py +1 -0
- package/tests/expected/comment/tea_python_tests/client.py +288 -0
- package/tests/expected/comment/tea_python_tests/models.py +195 -0
- package/tests/expected/complex/tea_python_tests/__init__.py +1 -0
- package/tests/expected/complex/tea_python_tests/client.py +1168 -0
- package/tests/expected/complex/tea_python_tests/exceptions.py +39 -0
- package/tests/expected/complex/tea_python_tests/models.py +570 -0
- package/tests/expected/const/tea_python_tests/__init__.py +1 -0
- package/tests/expected/const/tea_python_tests/client.py +14 -0
- package/tests/expected/empty/setup.py +74 -0
- package/tests/expected/empty/tea_python_tests/__init__.py +1 -0
- package/tests/expected/empty/tea_python_tests/client.py +10 -0
- package/tests/expected/exec/tea_python_tests/__init__.py +1 -0
- package/tests/expected/exec/tea_python_tests/exec_client.py +21 -0
- package/tests/expected/function/tea_python_tests/__init__.py +1 -0
- package/tests/expected/function/tea_python_tests/client.py +64 -0
- package/tests/expected/import/setup.py +78 -0
- package/tests/expected/import/tea_python_tests/__init__.py +1 -0
- package/tests/expected/import/tea_python_tests/client.py +29 -0
- package/tests/expected/map/tea_python_tests/__init__.py +1 -0
- package/tests/expected/map/tea_python_tests/client.py +39 -0
- package/tests/expected/model/tea_python_tests/__init__.py +1 -0
- package/tests/expected/model/tea_python_tests/client.py +10 -0
- package/tests/expected/model/tea_python_tests/exceptions.py +28 -0
- package/tests/expected/model/tea_python_tests/models.py +780 -0
- package/tests/expected/multi/tea_python_tests/api.py +95 -0
- package/tests/expected/multi/tea_python_tests/client.py +40 -0
- package/tests/expected/multi/tea_python_tests/lib/util.py +19 -0
- package/tests/expected/multi/tea_python_tests/model/user.py +23 -0
- package/tests/expected/multi/tea_python_tests/model/user_exceptions.py +83 -0
- package/tests/expected/multi/tea_python_tests/model/user_models.py +145 -0
- package/tests/expected/statements/tea_python_tests/__init__.py +1 -0
- package/tests/expected/statements/tea_python_tests/client.py +86 -0
- package/tests/expected/super/tea_python_tests/__init__.py +1 -0
- package/tests/expected/super/tea_python_tests/client.py +16 -0
- package/tests/expected/typedef/setup.py +77 -0
- package/tests/expected/typedef/tea_python_tests/__init__.py +1 -0
- package/tests/expected/typedef/tea_python_tests/client.py +74 -0
- package/tests/expected/typedef/tea_python_tests/models.py +42 -0
- package/tests/fixtures/alias/Darafile +11 -0
- package/tests/fixtures/alias/libraries/Alias/Darafile +11 -0
- package/tests/fixtures/alias/libraries/Alias-Symbol/Darafile +11 -0
- package/tests/fixtures/builtin/Darafile +6 -0
- package/tests/fixtures/builtin/main.dara +333 -0
- package/tests/fixtures/complex/libraries/import.dara +18 -11
- package/tests/fixtures/complex/main.dara +451 -103
- package/tests/fixtures/import/libraries/Darafile +1 -1
- package/tests/fixtures/import/pack/Darafile +3 -0
- package/tests/fixtures/map/libraries/Darafile +3 -0
- package/tests/fixtures/map/libraries/import.dara +4 -0
- package/tests/fixtures/map/main.dara +17 -2
- package/tests/fixtures/model/.libraries.json +3 -0
- package/tests/fixtures/model/Darafile +5 -2
- package/tests/fixtures/model/libraries/Darafile +20 -0
- package/tests/fixtures/model/libraries/import.dara +27 -0
- package/tests/fixtures/model/main.dara +60 -42
- package/tests/fixtures/multi/.libraries.json +3 -0
- package/tests/fixtures/multi/Darafile +12 -0
- package/tests/fixtures/multi/api.dara +20 -0
- package/tests/fixtures/multi/lib/util.dara +5 -0
- package/tests/fixtures/multi/libraries/darabonba_Util_0.2.11/Teafile +62 -0
- package/tests/fixtures/multi/libraries/darabonba_Util_0.2.11/main.tea +244 -0
- package/tests/fixtures/multi/main.dara +32 -0
- package/tests/fixtures/multi/model/user.dara +33 -0
- package/tests/{python3.tests.js → main.tests.js} +107 -65
- package/tests/output/alias/setup.py +79 -0
- package/tests/output/alias/tea_python_tests/client.py +35 -0
- package/tests/output/annotation/setup.py +77 -0
- package/tests/output/annotation/tea_python_tests/client.py +93 -0
- package/tests/output/annotation/tea_python_tests/models.py +37 -0
- package/tests/output/api/setup.py +77 -0
- package/tests/output/api/tea_python_tests/client.py +106 -0
- package/tests/output/builtin/setup.py +77 -0
- package/tests/output/builtin/tea_python_tests/client.py +685 -0
- package/tests/output/comment/setup.py +77 -0
- package/tests/output/comment/tea_python_tests/client.py +288 -0
- package/tests/output/comment/tea_python_tests/models.py +195 -0
- package/tests/output/complex/setup.py +77 -0
- package/tests/output/complex/tea_python_tests/client.py +1168 -0
- package/tests/output/complex/tea_python_tests/exceptions.py +39 -0
- package/tests/output/complex/tea_python_tests/models.py +570 -0
- package/tests/output/const/setup.py +77 -0
- package/tests/output/const/tea_python_tests/client.py +14 -0
- package/tests/output/empty/setup.py +77 -0
- package/tests/output/empty/tea_python_tests/client.py +10 -0
- package/tests/output/exec/setup.py +77 -0
- package/tests/output/exec/tea_python_tests/exec_client.py +21 -0
- package/tests/output/function/setup.py +77 -0
- package/tests/output/function/tea_python_tests/client.py +64 -0
- package/tests/output/import/setup.py +78 -0
- package/tests/output/import/tea_python_tests/client.py +29 -0
- package/tests/output/map/setup.py +77 -0
- package/tests/output/map/tea_python_tests/client.py +39 -0
- package/tests/output/model/setup.py +77 -0
- package/tests/output/model/tea_python_tests/client.py +10 -0
- package/tests/output/model/tea_python_tests/exceptions.py +28 -0
- package/tests/output/model/tea_python_tests/models.py +780 -0
- package/tests/output/multi/setup.py +77 -0
- package/tests/output/multi/tea_python_tests/api.py +95 -0
- package/tests/output/multi/tea_python_tests/client.py +40 -0
- package/tests/output/multi/tea_python_tests/lib/util.py +19 -0
- package/tests/output/multi/tea_python_tests/model/user.py +23 -0
- package/tests/output/multi/tea_python_tests/model/user_exceptions.py +83 -0
- package/tests/output/multi/tea_python_tests/model/user_models.py +145 -0
- package/tests/output/statements/setup.py +77 -0
- package/tests/output/statements/tea_python_tests/client.py +86 -0
- package/tests/output/super/setup.py +77 -0
- package/tests/output/super/tea_python_tests/client.py +16 -0
- package/tests/output/typedef/setup.py +78 -0
- package/tests/output/typedef/tea_python_tests/client.py +74 -0
- package/tests/output/typedef/tea_python_tests/models.py +42 -0
- package/tests/common.tests.js +0 -244
- package/tests/lib.tests.js +0 -269
- package/tests/python2.tests.js +0 -283
- package/tests/resolver.tests.js +0 -434
|
@@ -6,13 +6,13 @@ const assert = require('assert');
|
|
|
6
6
|
|
|
7
7
|
const DSL = require('@darabonba/parser');
|
|
8
8
|
|
|
9
|
-
let Generator = require('../
|
|
9
|
+
let Generator = require('../lib/generator');
|
|
10
10
|
|
|
11
11
|
const lang = 'python';
|
|
12
12
|
|
|
13
|
-
const expectedDir = path.join(__dirname, 'expected/
|
|
13
|
+
const expectedDir = path.join(__dirname, 'expected/');
|
|
14
14
|
const fixturesDir = path.join(__dirname, 'fixtures/');
|
|
15
|
-
const outputDir = path.join(__dirname, '
|
|
15
|
+
const outputDir = path.join(__dirname, 'output/');
|
|
16
16
|
|
|
17
17
|
function check(moduleName, expectedFiles = [], option = {}) {
|
|
18
18
|
const mainFilePath = path.join(fixturesDir, moduleName, 'main.dara') ? path.join(fixturesDir, moduleName, 'main.dara') : path.join(fixturesDir, moduleName, 'main.tea');
|
|
@@ -22,9 +22,11 @@ function check(moduleName, expectedFiles = [], option = {}) {
|
|
|
22
22
|
fs.existsSync(path.join(prefixDir, 'Darafile')) ? path.join(prefixDir, 'Darafile') : path.join(prefixDir, 'Teafile'), 'utf8');
|
|
23
23
|
const pkgInfo = JSON.parse(pkgContent);
|
|
24
24
|
const config = {
|
|
25
|
+
package: 'tea_python_tests',
|
|
25
26
|
outputDir: moduleOutputDir,
|
|
26
27
|
pkgDir: path.join(fixturesDir, moduleName),
|
|
27
28
|
...pkgInfo,
|
|
29
|
+
...pkgInfo[lang],
|
|
28
30
|
...option
|
|
29
31
|
};
|
|
30
32
|
const generator = new Generator(config, lang);
|
|
@@ -41,27 +43,27 @@ function check(moduleName, expectedFiles = [], option = {}) {
|
|
|
41
43
|
}
|
|
42
44
|
|
|
43
45
|
describe('Python Generator', function () {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
|
|
47
|
+
it('multi should ok', function () {
|
|
48
|
+
check('multi', [
|
|
49
|
+
'tea_python_tests/client.py',
|
|
50
|
+
'tea_python_tests/api.py',
|
|
51
|
+
'tea_python_tests/lib/util.py',
|
|
52
|
+
'tea_python_tests/model/user.py',
|
|
53
|
+
'tea_python_tests/model/user_exceptions.py',
|
|
54
|
+
'tea_python_tests/model/user_models.py',
|
|
47
55
|
],
|
|
48
56
|
{
|
|
49
57
|
python: {
|
|
50
58
|
package: 'tea_python_tests',
|
|
51
|
-
clientName: 'client'
|
|
52
|
-
packageInfo: {
|
|
53
|
-
name: 'tea_python_tests',
|
|
54
|
-
desc: 'Generate setup.py',
|
|
55
|
-
github: 'https://github.com/',
|
|
56
|
-
author: 'Alibaba',
|
|
57
|
-
email: 'sdk-team@alibabacloud.com'
|
|
58
|
-
}
|
|
59
|
+
clientName: 'client'
|
|
59
60
|
}
|
|
60
61
|
});
|
|
61
62
|
});
|
|
62
63
|
|
|
63
|
-
|
|
64
|
-
|
|
64
|
+
|
|
65
|
+
it('complex should ok', function () {
|
|
66
|
+
check('complex', [
|
|
65
67
|
'tea_python_tests/client.py',
|
|
66
68
|
'tea_python_tests/models.py'
|
|
67
69
|
],
|
|
@@ -72,23 +74,30 @@ describe('Python Generator', function () {
|
|
|
72
74
|
}
|
|
73
75
|
});
|
|
74
76
|
});
|
|
75
|
-
|
|
76
|
-
it('
|
|
77
|
-
check('
|
|
78
|
-
'tea_python_tests/client.py'
|
|
77
|
+
|
|
78
|
+
it('model should ok', function () {
|
|
79
|
+
check('model', [
|
|
80
|
+
'tea_python_tests/client.py',
|
|
81
|
+
'tea_python_tests/exceptions.py',
|
|
82
|
+
'tea_python_tests/models.py'
|
|
79
83
|
],
|
|
80
84
|
{
|
|
81
85
|
python: {
|
|
82
86
|
package: 'tea_python_tests',
|
|
83
|
-
clientName: 'client'
|
|
87
|
+
clientName: 'client',
|
|
88
|
+
additionalPackage: [
|
|
89
|
+
{
|
|
90
|
+
from: '__future__',
|
|
91
|
+
import: 'annotations'
|
|
92
|
+
}
|
|
93
|
+
]
|
|
84
94
|
}
|
|
85
95
|
});
|
|
86
96
|
});
|
|
87
97
|
|
|
88
|
-
it('
|
|
89
|
-
check('
|
|
90
|
-
'tea_python_tests/client.py'
|
|
91
|
-
'tea_python_tests/models.py'
|
|
98
|
+
it('map should ok', function () {
|
|
99
|
+
check('map', [
|
|
100
|
+
'tea_python_tests/client.py'
|
|
92
101
|
],
|
|
93
102
|
{
|
|
94
103
|
python: {
|
|
@@ -98,12 +107,12 @@ describe('Python Generator', function () {
|
|
|
98
107
|
});
|
|
99
108
|
});
|
|
100
109
|
|
|
101
|
-
it('
|
|
102
|
-
check('
|
|
103
|
-
'tea_python_tests/client.py'
|
|
104
|
-
'tea_python_tests/models.py'
|
|
110
|
+
it('builtin should ok', function () {
|
|
111
|
+
check('builtin', [
|
|
112
|
+
'tea_python_tests/client.py'
|
|
105
113
|
],
|
|
106
114
|
{
|
|
115
|
+
exec: true,
|
|
107
116
|
python: {
|
|
108
117
|
package: 'tea_python_tests',
|
|
109
118
|
clientName: 'client'
|
|
@@ -111,22 +120,22 @@ describe('Python Generator', function () {
|
|
|
111
120
|
});
|
|
112
121
|
});
|
|
113
122
|
|
|
114
|
-
it('
|
|
115
|
-
check('
|
|
116
|
-
'tea_python_tests/
|
|
123
|
+
it('exec should ok', function () {
|
|
124
|
+
check('exec', [
|
|
125
|
+
'tea_python_tests/exec_client.py'
|
|
117
126
|
],
|
|
118
127
|
{
|
|
128
|
+
exec: true,
|
|
119
129
|
python: {
|
|
120
130
|
package: 'tea_python_tests',
|
|
121
|
-
clientName: '
|
|
131
|
+
clientName: 'exec_client'
|
|
122
132
|
}
|
|
123
133
|
});
|
|
124
134
|
});
|
|
125
135
|
|
|
126
|
-
it('
|
|
127
|
-
check('
|
|
128
|
-
'tea_python_tests/client.py'
|
|
129
|
-
'.gitignore'
|
|
136
|
+
it('alias should ok', function () {
|
|
137
|
+
check('alias', [
|
|
138
|
+
'tea_python_tests/client.py'
|
|
130
139
|
],
|
|
131
140
|
{
|
|
132
141
|
python: {
|
|
@@ -143,6 +152,30 @@ describe('Python Generator', function () {
|
|
|
143
152
|
});
|
|
144
153
|
});
|
|
145
154
|
|
|
155
|
+
it('const should ok', function () {
|
|
156
|
+
check('const', [
|
|
157
|
+
'tea_python_tests/client.py'
|
|
158
|
+
],
|
|
159
|
+
{
|
|
160
|
+
python: {
|
|
161
|
+
package: 'tea_python_tests',
|
|
162
|
+
clientName: 'client'
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
it('statements should ok', function () {
|
|
168
|
+
check('statements', [
|
|
169
|
+
'tea_python_tests/client.py'
|
|
170
|
+
],
|
|
171
|
+
{
|
|
172
|
+
python: {
|
|
173
|
+
package: 'tea_python_tests',
|
|
174
|
+
clientName: 'client'
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
});
|
|
178
|
+
|
|
146
179
|
it('function should ok', function () {
|
|
147
180
|
check('function', [
|
|
148
181
|
'tea_python_tests/client.py'
|
|
@@ -153,6 +186,18 @@ describe('Python Generator', function () {
|
|
|
153
186
|
clientName: 'client'
|
|
154
187
|
}
|
|
155
188
|
});
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
it('api should ok', function () {
|
|
192
|
+
check('api', [
|
|
193
|
+
'tea_python_tests/client.py'
|
|
194
|
+
],
|
|
195
|
+
{
|
|
196
|
+
python: {
|
|
197
|
+
package: 'tea_python_tests',
|
|
198
|
+
clientName: 'client'
|
|
199
|
+
}
|
|
200
|
+
});
|
|
156
201
|
});
|
|
157
202
|
|
|
158
203
|
it('import should ok', function () {
|
|
@@ -183,9 +228,12 @@ describe('Python Generator', function () {
|
|
|
183
228
|
assert.deepStrictEqual(output.replace(new RegExp('\\d{2}\\/\\d{2}\\/\\d{4}'), '*'), expected);
|
|
184
229
|
});
|
|
185
230
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
it('add annotation should ok', function () {
|
|
234
|
+
check('annotation', [
|
|
235
|
+
'tea_python_tests/client.py',
|
|
236
|
+
'tea_python_tests/models.py'
|
|
189
237
|
],
|
|
190
238
|
{
|
|
191
239
|
python: {
|
|
@@ -195,37 +243,43 @@ describe('Python Generator', function () {
|
|
|
195
243
|
});
|
|
196
244
|
});
|
|
197
245
|
|
|
198
|
-
it('
|
|
199
|
-
check('
|
|
246
|
+
it('add comments should ok', function () {
|
|
247
|
+
check('comment', [
|
|
200
248
|
'tea_python_tests/client.py',
|
|
201
249
|
'tea_python_tests/models.py'
|
|
202
250
|
],
|
|
203
251
|
{
|
|
204
252
|
python: {
|
|
205
253
|
package: 'tea_python_tests',
|
|
206
|
-
clientName: 'client'
|
|
207
|
-
additionalPackage: [
|
|
208
|
-
{
|
|
209
|
-
from: '__future__',
|
|
210
|
-
import: 'annotations'
|
|
211
|
-
}
|
|
212
|
-
]
|
|
254
|
+
clientName: 'client'
|
|
213
255
|
}
|
|
214
256
|
});
|
|
215
257
|
});
|
|
216
258
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
it('empty should ok', function () {
|
|
262
|
+
check('empty', [
|
|
263
|
+
'tea_python_tests/client.py',
|
|
264
|
+
// '.gitignore'
|
|
220
265
|
],
|
|
221
266
|
{
|
|
222
267
|
python: {
|
|
223
268
|
package: 'tea_python_tests',
|
|
224
|
-
clientName: 'client'
|
|
269
|
+
clientName: 'client',
|
|
270
|
+
packageInfo: {
|
|
271
|
+
name: 'tea_python_tests',
|
|
272
|
+
desc: 'Generate setup.py',
|
|
273
|
+
github: 'https://github.com/',
|
|
274
|
+
author: 'Alibaba',
|
|
275
|
+
email: 'sdk-team@alibabacloud.com'
|
|
276
|
+
}
|
|
225
277
|
}
|
|
226
278
|
});
|
|
227
279
|
});
|
|
228
280
|
|
|
281
|
+
|
|
282
|
+
|
|
229
283
|
it('super should ok', function () {
|
|
230
284
|
check('super', [
|
|
231
285
|
'tea_python_tests/client.py'
|
|
@@ -238,18 +292,6 @@ describe('Python Generator', function () {
|
|
|
238
292
|
});
|
|
239
293
|
});
|
|
240
294
|
|
|
241
|
-
it('exec should ok', function () {
|
|
242
|
-
check('exec', [
|
|
243
|
-
'tea_python_tests/exec_client.py'
|
|
244
|
-
],
|
|
245
|
-
{
|
|
246
|
-
exec: true,
|
|
247
|
-
python: {
|
|
248
|
-
package: 'tea_python_tests',
|
|
249
|
-
clientName: 'exec_client'
|
|
250
|
-
}
|
|
251
|
-
});
|
|
252
|
-
});
|
|
253
295
|
|
|
254
296
|
it('typedef should ok', function () {
|
|
255
297
|
check('typedef', [
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""
|
|
3
|
+
Licensed to the Apache Software Foundation (ASF) under one
|
|
4
|
+
or more contributor license agreements. See the NOTICE file
|
|
5
|
+
distributed with this work for additional information
|
|
6
|
+
regarding copyright ownership. The ASF licenses this file
|
|
7
|
+
to you under the Apache License, Version 2.0 (the
|
|
8
|
+
"License"); you may not use this file except in compliance
|
|
9
|
+
with the License. You may obtain a copy of the License at
|
|
10
|
+
|
|
11
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
|
|
13
|
+
Unless required by applicable law or agreed to in writing,
|
|
14
|
+
software distributed under the License is distributed on an
|
|
15
|
+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
16
|
+
KIND, either express or implied. See the License for the
|
|
17
|
+
specific language governing permissions and limitations
|
|
18
|
+
under the License.
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
import os
|
|
22
|
+
from setuptools import setup, find_packages
|
|
23
|
+
|
|
24
|
+
"""
|
|
25
|
+
setup module for tea_python_tests.
|
|
26
|
+
|
|
27
|
+
Created on *
|
|
28
|
+
|
|
29
|
+
@author: Alibaba
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
PACKAGE = "tea_python_tests"
|
|
33
|
+
NAME = "tea_python_tests"
|
|
34
|
+
DESCRIPTION = ""
|
|
35
|
+
AUTHOR = "Alibaba"
|
|
36
|
+
AUTHOR_EMAIL = "sdk-team@alibabacloud.com"
|
|
37
|
+
URL = "https://github.com/"
|
|
38
|
+
VERSION = __import__(PACKAGE).__version__
|
|
39
|
+
REQUIRES = [
|
|
40
|
+
"darabonba-core>=1.0.0, <2.0.0",
|
|
41
|
+
"source>=0.0.1, <1.0.0",
|
|
42
|
+
"import>=1.1.2, <2.0.0",
|
|
43
|
+
"alibabacloud_tea_util>=0.3.11, <1.0.0"
|
|
44
|
+
]
|
|
45
|
+
|
|
46
|
+
LONG_DESCRIPTION = ''
|
|
47
|
+
if os.path.exists('./README.md'):
|
|
48
|
+
with open("README.md", encoding='utf-8') as fp:
|
|
49
|
+
LONG_DESCRIPTION = fp.read()
|
|
50
|
+
|
|
51
|
+
setup(
|
|
52
|
+
name=NAME,
|
|
53
|
+
version=VERSION,
|
|
54
|
+
description=DESCRIPTION,
|
|
55
|
+
long_description=LONG_DESCRIPTION,
|
|
56
|
+
long_description_content_type='text/markdown',
|
|
57
|
+
author=AUTHOR,
|
|
58
|
+
author_email=AUTHOR_EMAIL,
|
|
59
|
+
license="Apache License 2.0",
|
|
60
|
+
url=URL,
|
|
61
|
+
keywords=["tea","python","tests"],
|
|
62
|
+
packages=find_packages(exclude=["tests*"]),
|
|
63
|
+
include_package_data=True,
|
|
64
|
+
platforms="any",
|
|
65
|
+
install_requires=REQUIRES,
|
|
66
|
+
python_requires=">=3.6",
|
|
67
|
+
classifiers=(
|
|
68
|
+
"Development Status :: 4 - Beta",
|
|
69
|
+
"Intended Audience :: Developers",
|
|
70
|
+
"License :: OSI Approved :: Apache Software License",
|
|
71
|
+
"Programming Language :: Python",
|
|
72
|
+
"Programming Language :: Python :: 3",
|
|
73
|
+
"Programming Language :: Python :: 3.6",
|
|
74
|
+
"Programming Language :: Python :: 3.7",
|
|
75
|
+
"Programming Language :: Python :: 3.8",
|
|
76
|
+
"Programming Language :: Python :: 3.9",
|
|
77
|
+
"Topic :: Software Development"
|
|
78
|
+
)
|
|
79
|
+
)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# This file is auto-generated, don't edit it. Thanks.
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from Import.client import Client as ImportClient
|
|
5
|
+
from Source.client import Client as SourceClient
|
|
6
|
+
from Alias.alias_client import AliasClient
|
|
7
|
+
from alias_source.source_client import SourceClient as AliasSourceSourceClient
|
|
8
|
+
from alias_symbol.client import Client as AliasSymbolClient
|
|
9
|
+
from alias_symbol import models as alias_symbol_models
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class Client:
|
|
15
|
+
|
|
16
|
+
def __init__(self):
|
|
17
|
+
pass
|
|
18
|
+
|
|
19
|
+
@staticmethod
|
|
20
|
+
def empty_model() -> None:
|
|
21
|
+
ImportClient.test()
|
|
22
|
+
SourceClient.test()
|
|
23
|
+
AliasClient.test()
|
|
24
|
+
AliasSourceSourceClient.test()
|
|
25
|
+
AliasSymbolClient.test()
|
|
26
|
+
model = alias_symbol_models.TestModel()
|
|
27
|
+
|
|
28
|
+
@staticmethod
|
|
29
|
+
async def empty_model_async() -> None:
|
|
30
|
+
ImportClient.test()
|
|
31
|
+
await SourceClient.test_async()
|
|
32
|
+
AliasClient.test()
|
|
33
|
+
AliasSourceSourceClient.test()
|
|
34
|
+
AliasSymbolClient.test()
|
|
35
|
+
model = alias_symbol_models.TestModel()
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""
|
|
3
|
+
Licensed to the Apache Software Foundation (ASF) under one
|
|
4
|
+
or more contributor license agreements. See the NOTICE file
|
|
5
|
+
distributed with this work for additional information
|
|
6
|
+
regarding copyright ownership. The ASF licenses this file
|
|
7
|
+
to you under the Apache License, Version 2.0 (the
|
|
8
|
+
"License"); you may not use this file except in compliance
|
|
9
|
+
with the License. You may obtain a copy of the License at
|
|
10
|
+
|
|
11
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
|
|
13
|
+
Unless required by applicable law or agreed to in writing,
|
|
14
|
+
software distributed under the License is distributed on an
|
|
15
|
+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
16
|
+
KIND, either express or implied. See the License for the
|
|
17
|
+
specific language governing permissions and limitations
|
|
18
|
+
under the License.
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
import os
|
|
22
|
+
from setuptools import setup, find_packages
|
|
23
|
+
|
|
24
|
+
"""
|
|
25
|
+
setup module for tea_python_tests.
|
|
26
|
+
|
|
27
|
+
Created on *
|
|
28
|
+
|
|
29
|
+
@author: Alibaba
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
PACKAGE = "tea_python_tests"
|
|
33
|
+
NAME = "tea_python_tests"
|
|
34
|
+
DESCRIPTION = ""
|
|
35
|
+
AUTHOR = "Alibaba"
|
|
36
|
+
AUTHOR_EMAIL = "sdk-team@alibabacloud.com"
|
|
37
|
+
URL = "https://github.com/"
|
|
38
|
+
VERSION = __import__(PACKAGE).__version__
|
|
39
|
+
REQUIRES = [
|
|
40
|
+
"darabonba-core>=1.0.0, <2.0.0",
|
|
41
|
+
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
LONG_DESCRIPTION = ''
|
|
45
|
+
if os.path.exists('./README.md'):
|
|
46
|
+
with open("README.md", encoding='utf-8') as fp:
|
|
47
|
+
LONG_DESCRIPTION = fp.read()
|
|
48
|
+
|
|
49
|
+
setup(
|
|
50
|
+
name=NAME,
|
|
51
|
+
version=VERSION,
|
|
52
|
+
description=DESCRIPTION,
|
|
53
|
+
long_description=LONG_DESCRIPTION,
|
|
54
|
+
long_description_content_type='text/markdown',
|
|
55
|
+
author=AUTHOR,
|
|
56
|
+
author_email=AUTHOR_EMAIL,
|
|
57
|
+
license="Apache License 2.0",
|
|
58
|
+
url=URL,
|
|
59
|
+
keywords=["tea","python","tests"],
|
|
60
|
+
packages=find_packages(exclude=["tests*"]),
|
|
61
|
+
include_package_data=True,
|
|
62
|
+
platforms="any",
|
|
63
|
+
install_requires=REQUIRES,
|
|
64
|
+
python_requires=">=3.6",
|
|
65
|
+
classifiers=(
|
|
66
|
+
"Development Status :: 4 - Beta",
|
|
67
|
+
"Intended Audience :: Developers",
|
|
68
|
+
"License :: OSI Approved :: Apache Software License",
|
|
69
|
+
"Programming Language :: Python",
|
|
70
|
+
"Programming Language :: Python :: 3",
|
|
71
|
+
"Programming Language :: Python :: 3.6",
|
|
72
|
+
"Programming Language :: Python :: 3.7",
|
|
73
|
+
"Programming Language :: Python :: 3.8",
|
|
74
|
+
"Programming Language :: Python :: 3.9",
|
|
75
|
+
"Topic :: Software Development"
|
|
76
|
+
)
|
|
77
|
+
)
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# This file is auto-generated, don't edit it. Thanks.
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from darabonba.core import DaraCore
|
|
5
|
+
from darabonba.exceptions import UnretryableException
|
|
6
|
+
from darabonba.policy.retry import RetryPolicyContext
|
|
7
|
+
from darabonba.request import DaraRequest
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
"""
|
|
11
|
+
* @remarks
|
|
12
|
+
* top annotation
|
|
13
|
+
"""
|
|
14
|
+
class Client:
|
|
15
|
+
_a: str = None
|
|
16
|
+
def __init__(self):
|
|
17
|
+
pass
|
|
18
|
+
|
|
19
|
+
"""
|
|
20
|
+
* @remarks
|
|
21
|
+
* testAPI
|
|
22
|
+
"""
|
|
23
|
+
def test_api(self) -> None:
|
|
24
|
+
_runtime = {
|
|
25
|
+
}
|
|
26
|
+
_last_request = None
|
|
27
|
+
_last_response = None
|
|
28
|
+
_retries_attempted = 0
|
|
29
|
+
_context = RetryPolicyContext(
|
|
30
|
+
retries_attempted= _retries_attempted
|
|
31
|
+
)
|
|
32
|
+
while DaraCore.should_retry(_runtime.get('retryOptions'), _context):
|
|
33
|
+
if _retries_attempted > 0:
|
|
34
|
+
_backoff_time = DaraCore.get_backoff_time(_runtime.get('retryOptions'), _context)
|
|
35
|
+
if _backoff_time > 0:
|
|
36
|
+
DaraCore.sleep(_backoff_time)
|
|
37
|
+
_retries_attempted = _retries_attempted + 1
|
|
38
|
+
try:
|
|
39
|
+
_request = DaraRequest()
|
|
40
|
+
pass
|
|
41
|
+
_last_request = _request
|
|
42
|
+
_response = DaraCore.do_action(_request, _runtime)
|
|
43
|
+
_last_response = _response
|
|
44
|
+
return
|
|
45
|
+
except Exception as e:
|
|
46
|
+
_context = RetryPolicyContext(
|
|
47
|
+
retries_attempted= _retries_attempted,
|
|
48
|
+
http_request = _last_request,
|
|
49
|
+
http_response = _last_response,
|
|
50
|
+
exception = e
|
|
51
|
+
)
|
|
52
|
+
continue
|
|
53
|
+
raise UnretryableException(_context)
|
|
54
|
+
|
|
55
|
+
async def test_api_async(self) -> None:
|
|
56
|
+
_runtime = {
|
|
57
|
+
}
|
|
58
|
+
_last_request = None
|
|
59
|
+
_last_response = None
|
|
60
|
+
_retries_attempted = 0
|
|
61
|
+
_context = RetryPolicyContext(
|
|
62
|
+
retries_attempted= _retries_attempted
|
|
63
|
+
)
|
|
64
|
+
while DaraCore.should_retry(_runtime.get('retryOptions'), _context):
|
|
65
|
+
if _retries_attempted > 0:
|
|
66
|
+
_backoff_time = DaraCore.get_backoff_time(_runtime.get('retryOptions'), _context)
|
|
67
|
+
if _backoff_time > 0:
|
|
68
|
+
DaraCore.sleep(_backoff_time)
|
|
69
|
+
_retries_attempted = _retries_attempted + 1
|
|
70
|
+
try:
|
|
71
|
+
_request = DaraRequest()
|
|
72
|
+
pass
|
|
73
|
+
_last_request = _request
|
|
74
|
+
_response = await DaraCore.async_do_action(_request, _runtime)
|
|
75
|
+
_last_response = _response
|
|
76
|
+
return
|
|
77
|
+
except Exception as e:
|
|
78
|
+
_context = RetryPolicyContext(
|
|
79
|
+
retries_attempted= _retries_attempted,
|
|
80
|
+
http_request = _last_request,
|
|
81
|
+
http_response = _last_response,
|
|
82
|
+
exception = e
|
|
83
|
+
)
|
|
84
|
+
continue
|
|
85
|
+
raise UnretryableException(_context)
|
|
86
|
+
|
|
87
|
+
@staticmethod
|
|
88
|
+
def test_func() -> None:
|
|
89
|
+
pass
|
|
90
|
+
|
|
91
|
+
@staticmethod
|
|
92
|
+
async def test_func_async() -> None:
|
|
93
|
+
pass
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# This file is auto-generated, don't edit it. Thanks.
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from darabonba.model import DaraModel
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
* @remarks
|
|
9
|
+
* TestModel
|
|
10
|
+
"""
|
|
11
|
+
class Test(DaraModel):
|
|
12
|
+
def __init__(
|
|
13
|
+
self,
|
|
14
|
+
test: str = None,
|
|
15
|
+
):
|
|
16
|
+
# Alichange app id
|
|
17
|
+
self.test = test
|
|
18
|
+
|
|
19
|
+
def validate(self):
|
|
20
|
+
self.validate_required(self.test, 'test')
|
|
21
|
+
|
|
22
|
+
def to_map(self):
|
|
23
|
+
_map = super().to_map()
|
|
24
|
+
if _map is not None:
|
|
25
|
+
return _map
|
|
26
|
+
|
|
27
|
+
result = dict()
|
|
28
|
+
if self.test is not None:
|
|
29
|
+
result['test'] = self.test
|
|
30
|
+
return result
|
|
31
|
+
|
|
32
|
+
def from_map(self, m: dict = None):
|
|
33
|
+
m = m or dict()
|
|
34
|
+
if m.get('test') is not None:
|
|
35
|
+
self.test = m.get('test')
|
|
36
|
+
return self
|
|
37
|
+
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""
|
|
3
|
+
Licensed to the Apache Software Foundation (ASF) under one
|
|
4
|
+
or more contributor license agreements. See the NOTICE file
|
|
5
|
+
distributed with this work for additional information
|
|
6
|
+
regarding copyright ownership. The ASF licenses this file
|
|
7
|
+
to you under the Apache License, Version 2.0 (the
|
|
8
|
+
"License"); you may not use this file except in compliance
|
|
9
|
+
with the License. You may obtain a copy of the License at
|
|
10
|
+
|
|
11
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
|
|
13
|
+
Unless required by applicable law or agreed to in writing,
|
|
14
|
+
software distributed under the License is distributed on an
|
|
15
|
+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
16
|
+
KIND, either express or implied. See the License for the
|
|
17
|
+
specific language governing permissions and limitations
|
|
18
|
+
under the License.
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
import os
|
|
22
|
+
from setuptools import setup, find_packages
|
|
23
|
+
|
|
24
|
+
"""
|
|
25
|
+
setup module for tea_python_tests.
|
|
26
|
+
|
|
27
|
+
Created on *
|
|
28
|
+
|
|
29
|
+
@author: Alibaba
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
PACKAGE = "tea_python_tests"
|
|
33
|
+
NAME = "tea_python_tests"
|
|
34
|
+
DESCRIPTION = ""
|
|
35
|
+
AUTHOR = "Alibaba"
|
|
36
|
+
AUTHOR_EMAIL = "sdk-team@alibabacloud.com"
|
|
37
|
+
URL = "https://github.com/"
|
|
38
|
+
VERSION = __import__(PACKAGE).__version__
|
|
39
|
+
REQUIRES = [
|
|
40
|
+
"darabonba-core>=1.0.0, <2.0.0",
|
|
41
|
+
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
LONG_DESCRIPTION = ''
|
|
45
|
+
if os.path.exists('./README.md'):
|
|
46
|
+
with open("README.md", encoding='utf-8') as fp:
|
|
47
|
+
LONG_DESCRIPTION = fp.read()
|
|
48
|
+
|
|
49
|
+
setup(
|
|
50
|
+
name=NAME,
|
|
51
|
+
version=VERSION,
|
|
52
|
+
description=DESCRIPTION,
|
|
53
|
+
long_description=LONG_DESCRIPTION,
|
|
54
|
+
long_description_content_type='text/markdown',
|
|
55
|
+
author=AUTHOR,
|
|
56
|
+
author_email=AUTHOR_EMAIL,
|
|
57
|
+
license="Apache License 2.0",
|
|
58
|
+
url=URL,
|
|
59
|
+
keywords=["tea","python","tests"],
|
|
60
|
+
packages=find_packages(exclude=["tests*"]),
|
|
61
|
+
include_package_data=True,
|
|
62
|
+
platforms="any",
|
|
63
|
+
install_requires=REQUIRES,
|
|
64
|
+
python_requires=">=3.6",
|
|
65
|
+
classifiers=(
|
|
66
|
+
"Development Status :: 4 - Beta",
|
|
67
|
+
"Intended Audience :: Developers",
|
|
68
|
+
"License :: OSI Approved :: Apache Software License",
|
|
69
|
+
"Programming Language :: Python",
|
|
70
|
+
"Programming Language :: Python :: 3",
|
|
71
|
+
"Programming Language :: Python :: 3.6",
|
|
72
|
+
"Programming Language :: Python :: 3.7",
|
|
73
|
+
"Programming Language :: Python :: 3.8",
|
|
74
|
+
"Programming Language :: Python :: 3.9",
|
|
75
|
+
"Topic :: Software Development"
|
|
76
|
+
)
|
|
77
|
+
)
|