@darabonba/python-generator 2.0.9 → 2.0.11

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 (157) hide show
  1. package/ChangeLog.md +3 -0
  2. package/lib/builtin.js +12 -3
  3. package/lib/generator.js +234 -235
  4. package/lib/helper.js +230 -5
  5. package/package.json +1 -1
  6. package/tests/expected/alias/setup.py +17 -13
  7. package/tests/expected/alias/tea_python_tests/client.py +6 -6
  8. package/tests/expected/annotation/tea_python_tests/client.py +4 -4
  9. package/tests/expected/annotation/tea_python_tests/models/__init__.py +0 -2
  10. package/tests/expected/annotation/tea_python_tests/models/_test.py +1 -1
  11. package/tests/expected/api/tea_python_tests/client.py +4 -4
  12. package/tests/expected/builtin/tea_python_tests/client.py +18 -16
  13. package/tests/expected/comment/tea_python_tests/client.py +6 -5
  14. package/tests/expected/comment/tea_python_tests/models/__init__.py +0 -2
  15. package/tests/expected/comment/tea_python_tests/models/_test_1.py +2 -1
  16. package/tests/expected/comment/tea_python_tests/models/_test_2.py +1 -1
  17. package/tests/expected/comment/tea_python_tests/models/_test_3.py +1 -1
  18. package/tests/expected/complex/tea_python_tests/client.py +17 -16
  19. package/tests/expected/complex/tea_python_tests/exceptions/__init__.py +0 -2
  20. package/tests/expected/complex/tea_python_tests/exceptions/_err_1.py +2 -1
  21. package/tests/expected/complex/tea_python_tests/exceptions/_err_2.py +1 -1
  22. package/tests/expected/complex/tea_python_tests/models/__init__.py +0 -2
  23. package/tests/expected/complex/tea_python_tests/models/_complex_request.py +7 -6
  24. package/tests/expected/complex/tea_python_tests/models/_response.py +2 -2
  25. package/tests/expected/const/tea_python_tests/client.py +0 -2
  26. package/tests/expected/empty/tea_python_tests/client.py +0 -2
  27. package/tests/expected/exec/tea_python_tests/exec_client.py +3 -2
  28. package/tests/expected/function/tea_python_tests/client.py +2 -1
  29. package/tests/expected/import/setup.py +4 -2
  30. package/tests/expected/import/tea_python_tests/client.py +4 -3
  31. package/tests/expected/map/tea_python_tests/client.py +3 -3
  32. package/tests/expected/model/tea_python_tests/client.py +0 -2
  33. package/tests/expected/model/tea_python_tests/exceptions/__init__.py +0 -2
  34. package/tests/expected/model/tea_python_tests/exceptions/_main_file.py +3 -2
  35. package/tests/expected/model/tea_python_tests/models/__init__.py +0 -2
  36. package/tests/expected/model/tea_python_tests/models/_class.py +1 -1
  37. package/tests/expected/model/tea_python_tests/models/_m.py +2 -2
  38. package/tests/expected/model/tea_python_tests/models/_main_file.py +2 -2
  39. package/tests/expected/model/tea_python_tests/models/_model.py +1 -1
  40. package/tests/expected/model/tea_python_tests/models/_my_model.py +6 -5
  41. package/tests/expected/modelConfig/tea_python_tests/client.py +0 -2
  42. package/tests/expected/modelConfig/tea_python_tests/exceptions/__init__.py +0 -2
  43. package/tests/expected/modelConfig/tea_python_tests/exceptions/_main_file.py +3 -2
  44. package/tests/expected/modelConfig/tea_python_tests/models/__init__.py +0 -2
  45. package/tests/expected/modelConfig/tea_python_tests/models/_class.py +1 -1
  46. package/tests/expected/modelConfig/tea_python_tests/models/_m.py +2 -2
  47. package/tests/expected/modelConfig/tea_python_tests/models/_main_file.py +2 -2
  48. package/tests/expected/modelConfig/tea_python_tests/models/_model.py +1 -1
  49. package/tests/expected/modelConfig/tea_python_tests/models/_my_model.py +6 -5
  50. package/tests/expected/multi/tea_python_tests/api.py +5 -5
  51. package/tests/expected/multi/tea_python_tests/api_models/__init__.py +0 -2
  52. package/tests/expected/multi/tea_python_tests/api_models/_test_model_dir_2.py +1 -1
  53. package/tests/expected/multi/tea_python_tests/client.py +4 -3
  54. package/tests/expected/multi/tea_python_tests/exceptions/__init__.py +0 -2
  55. package/tests/expected/multi/tea_python_tests/exceptions/_err.py +1 -1
  56. package/tests/expected/multi/tea_python_tests/lib/util.py +0 -1
  57. package/tests/expected/multi/tea_python_tests/model/user.py +3 -2
  58. package/tests/expected/multi/tea_python_tests/model/user_exceptions/__init__.py +0 -2
  59. package/tests/expected/multi/tea_python_tests/model/user_exceptions/_err.py +1 -1
  60. package/tests/expected/multi/tea_python_tests/model/user_exceptions/_err_1.py +1 -1
  61. package/tests/expected/multi/tea_python_tests/model/user_exceptions/_err_2.py +1 -1
  62. package/tests/expected/multi/tea_python_tests/model/user_models/__init__.py +0 -2
  63. package/tests/expected/multi/tea_python_tests/model/user_models/_base_info.py +1 -1
  64. package/tests/expected/multi/tea_python_tests/model/user_models/_info.py +1 -1
  65. package/tests/expected/multi/tea_python_tests/models/__init__.py +0 -2
  66. package/tests/expected/multi/tea_python_tests/models/_test_model_dir.py +3 -2
  67. package/tests/expected/statements/tea_python_tests/client.py +3 -3
  68. package/tests/expected/super/tea_python_tests/client.py +2 -2
  69. package/tests/expected/typedef/tea_python_tests/client.py +5 -5
  70. package/tests/expected/typedef/tea_python_tests/models/__init__.py +0 -2
  71. package/tests/expected/typedef/tea_python_tests/models/_m.py +3 -3
  72. package/tests/fixtures/alias/Darafile +5 -4
  73. package/tests/fixtures/complex/libraries/import.dara +11 -0
  74. package/tests/fixtures/complex/main.dara +2 -2
  75. package/tests/main.tests.js +26 -23
  76. package/tests/output/alias/setup.py +15 -11
  77. package/tests/output/alias/tea_python_tests/client.py +6 -6
  78. package/tests/output/annotation/setup.py +6 -4
  79. package/tests/output/annotation/tea_python_tests/client.py +4 -4
  80. package/tests/output/annotation/tea_python_tests/models/__init__.py +0 -2
  81. package/tests/output/annotation/tea_python_tests/models/_test.py +1 -1
  82. package/tests/output/api/setup.py +6 -4
  83. package/tests/output/api/tea_python_tests/client.py +4 -4
  84. package/tests/output/builtin/setup.py +6 -4
  85. package/tests/output/builtin/tea_python_tests/client.py +18 -16
  86. package/tests/output/comment/setup.py +6 -4
  87. package/tests/output/comment/tea_python_tests/client.py +6 -5
  88. package/tests/output/comment/tea_python_tests/models/__init__.py +0 -2
  89. package/tests/output/comment/tea_python_tests/models/_test_1.py +2 -1
  90. package/tests/output/comment/tea_python_tests/models/_test_2.py +1 -1
  91. package/tests/output/comment/tea_python_tests/models/_test_3.py +1 -1
  92. package/tests/output/complex/setup.py +6 -4
  93. package/tests/output/complex/tea_python_tests/client.py +17 -16
  94. package/tests/output/complex/tea_python_tests/exceptions/__init__.py +0 -2
  95. package/tests/output/complex/tea_python_tests/exceptions/_err_1.py +2 -1
  96. package/tests/output/complex/tea_python_tests/exceptions/_err_2.py +1 -1
  97. package/tests/output/complex/tea_python_tests/models/__init__.py +0 -2
  98. package/tests/output/complex/tea_python_tests/models/_complex_request.py +7 -6
  99. package/tests/output/complex/tea_python_tests/models/_response.py +2 -2
  100. package/tests/output/const/setup.py +6 -4
  101. package/tests/output/const/tea_python_tests/client.py +0 -2
  102. package/tests/output/empty/setup.py +6 -4
  103. package/tests/output/empty/tea_python_tests/client.py +0 -2
  104. package/tests/output/exec/setup.py +6 -4
  105. package/tests/output/exec/tea_python_tests/exec_client.py +3 -2
  106. package/tests/output/function/setup.py +6 -4
  107. package/tests/output/function/tea_python_tests/client.py +2 -1
  108. package/tests/output/import/setup.py +5 -3
  109. package/tests/output/import/tea_python_tests/client.py +4 -3
  110. package/tests/output/map/setup.py +6 -4
  111. package/tests/output/map/tea_python_tests/client.py +3 -3
  112. package/tests/output/model/setup.py +6 -4
  113. package/tests/output/model/tea_python_tests/client.py +0 -2
  114. package/tests/output/model/tea_python_tests/exceptions/__init__.py +0 -2
  115. package/tests/output/model/tea_python_tests/exceptions/_main_file.py +3 -2
  116. package/tests/output/model/tea_python_tests/models/__init__.py +0 -2
  117. package/tests/output/model/tea_python_tests/models/_class.py +1 -1
  118. package/tests/output/model/tea_python_tests/models/_m.py +2 -2
  119. package/tests/output/model/tea_python_tests/models/_main_file.py +2 -2
  120. package/tests/output/model/tea_python_tests/models/_model.py +1 -1
  121. package/tests/output/model/tea_python_tests/models/_my_model.py +6 -5
  122. package/tests/output/modelConfig/setup.py +6 -4
  123. package/tests/output/modelConfig/tea_python_tests/client.py +0 -2
  124. package/tests/output/modelConfig/tea_python_tests/exceptions/__init__.py +0 -2
  125. package/tests/output/modelConfig/tea_python_tests/exceptions/_main_file.py +3 -2
  126. package/tests/output/modelConfig/tea_python_tests/models/__init__.py +0 -2
  127. package/tests/output/modelConfig/tea_python_tests/models/_class.py +1 -1
  128. package/tests/output/modelConfig/tea_python_tests/models/_m.py +2 -2
  129. package/tests/output/modelConfig/tea_python_tests/models/_main_file.py +2 -2
  130. package/tests/output/modelConfig/tea_python_tests/models/_model.py +1 -1
  131. package/tests/output/modelConfig/tea_python_tests/models/_my_model.py +6 -5
  132. package/tests/output/multi/setup.py +5 -3
  133. package/tests/output/multi/tea_python_tests/api.py +5 -5
  134. package/tests/output/multi/tea_python_tests/api_models/__init__.py +0 -2
  135. package/tests/output/multi/tea_python_tests/api_models/_test_model_dir_2.py +1 -1
  136. package/tests/output/multi/tea_python_tests/client.py +4 -3
  137. package/tests/output/multi/tea_python_tests/exceptions/__init__.py +0 -2
  138. package/tests/output/multi/tea_python_tests/exceptions/_err.py +1 -1
  139. package/tests/output/multi/tea_python_tests/lib/util.py +0 -1
  140. package/tests/output/multi/tea_python_tests/model/user.py +3 -2
  141. package/tests/output/multi/tea_python_tests/model/user_exceptions/__init__.py +0 -2
  142. package/tests/output/multi/tea_python_tests/model/user_exceptions/_err.py +1 -1
  143. package/tests/output/multi/tea_python_tests/model/user_exceptions/_err_1.py +1 -1
  144. package/tests/output/multi/tea_python_tests/model/user_exceptions/_err_2.py +1 -1
  145. package/tests/output/multi/tea_python_tests/model/user_models/__init__.py +0 -2
  146. package/tests/output/multi/tea_python_tests/model/user_models/_base_info.py +1 -1
  147. package/tests/output/multi/tea_python_tests/model/user_models/_info.py +1 -1
  148. package/tests/output/multi/tea_python_tests/models/__init__.py +0 -2
  149. package/tests/output/multi/tea_python_tests/models/_test_model_dir.py +3 -2
  150. package/tests/output/statements/setup.py +6 -4
  151. package/tests/output/statements/tea_python_tests/client.py +3 -3
  152. package/tests/output/super/setup.py +6 -4
  153. package/tests/output/super/tea_python_tests/client.py +2 -2
  154. package/tests/output/typedef/setup.py +5 -3
  155. package/tests/output/typedef/tea_python_tests/client.py +5 -5
  156. package/tests/output/typedef/tea_python_tests/models/__init__.py +0 -2
  157. package/tests/output/typedef/tea_python_tests/models/_m.py +3 -3
package/lib/helper.js CHANGED
@@ -11,6 +11,23 @@ const keywords = [
11
11
  'lambda', 'nonlocal', 'not', 'or', 'pass',
12
12
  'raise', 'return', 'try', 'while', 'with', 'yield'
13
13
  ];
14
+ // 定义标准库模块列表(Python 3.x常用标准库)
15
+ const standardLibraries = new Set([
16
+ '__future__', 'abc', 'argparse', 'ast', 'asyncio', 'base64', 'bisect',
17
+ 'builtins', 'calendar', 'collections', 'concurrent', 'configparser',
18
+ 'contextlib', 'copy', 'csv', 'datetime', 'decimal', 'difflib',
19
+ 'email', 'enum', 'errno', 'faulthandler', 'fileinput', 'fnmatch',
20
+ 'fractions', 'functools', 'gc', 'glob', 'gzip', 'hashlib', 'heapq',
21
+ 'hmac', 'html', 'http', 'importlib', 'inspect', 'io', 'ipaddress',
22
+ 'itertools', 'json', 'keyword', 'linecache', 'locale', 'logging',
23
+ 'lzma', 'math', 'mimetypes', 'multiprocessing', 'numbers', 'operator',
24
+ 'os', 'pathlib', 'pickle', 'platform', 'pprint', 'queue', 'random',
25
+ 're', 'reprlib', 'secrets', 'shlex', 'shutil', 'signal', 'socket',
26
+ 'sqlite3', 'ssl', 'statistics', 'string', 'subprocess', 'sys',
27
+ 'tarfile', 'tempfile', 'textwrap', 'threading', 'time', 'timeit',
28
+ 'traceback', 'types', 'typing', 'unittest', 'urllib', 'uuid',
29
+ 'warnings', 'weakref', 'xml', 'zipfile', 'zlib'
30
+ ]);
14
31
 
15
32
  const builtinModels = [
16
33
  '$Request', '$Response', '$Error', '$SSEEvent', '$Model',
@@ -192,7 +209,7 @@ function _camelCase(str, split = '_') {
192
209
  // 如果没有下划线,对整个字符串首字母大写
193
210
  str = _upperFirst(str);
194
211
  }
195
-
212
+
196
213
  return str;
197
214
  }
198
215
 
@@ -258,12 +275,12 @@ function _isBuiltinModel(name) {
258
275
  }
259
276
 
260
277
  function _isDefault(expr) {
261
- if(expr.type !== 'call' || expr.left.type !== 'method_call') {
278
+ if (expr.type !== 'call' || expr.left.type !== 'method_call') {
262
279
  return false;
263
280
  }
264
281
  const name = _name(expr.left.id);
265
282
 
266
- if(name !== '$default') {
283
+ if (name !== '$default') {
267
284
  return false;
268
285
  }
269
286
 
@@ -296,7 +313,7 @@ function _type(name) {
296
313
  return 'int';
297
314
  }
298
315
 
299
- if(name === 'float' || name === 'double') {
316
+ if (name === 'float' || name === 'double') {
300
317
  return 'float';
301
318
  }
302
319
 
@@ -395,7 +412,7 @@ function _escape(str) {
395
412
  }
396
413
 
397
414
  function _removeFilesInDirectory(directoryPath) {
398
- if(!fs.existsSync(directoryPath)) {
415
+ if (!fs.existsSync(directoryPath)) {
399
416
  return;
400
417
  }
401
418
  const files = fs.readdirSync(directoryPath);
@@ -412,6 +429,212 @@ function _removeFilesInDirectory(directoryPath) {
412
429
  }
413
430
  }
414
431
 
432
+ /**
433
+ * 按照Python PEP 8标准对imports进行排序
434
+ * @param {Array} imports - import对象数组
435
+ * @returns {Array} 排序后的imports数组
436
+ */
437
+ function _sortImports(imports) {
438
+ function isStandardLibrary(packageName) {
439
+ if (!packageName) { return false; }
440
+
441
+ // 处理子模块,如 os.path -> os
442
+ const rootModule = packageName.split('.')[0];
443
+ return standardLibraries.has(rootModule);
444
+ }
445
+
446
+ function isThirdPartyLibrary(packageName) {
447
+ if (!packageName) { return false; }
448
+
449
+ // 不是标准库且不是相对导入(不以.开头)
450
+ return !isStandardLibrary(packageName) && !packageName.startsWith('.');
451
+ }
452
+
453
+ function isLocalImport(packageName) {
454
+ if (!packageName) { return false; }
455
+
456
+ // 以.开头的相对导入,或者看起来像本地模块的导入
457
+ return packageName.startsWith('.') ||
458
+ (!isStandardLibrary(packageName) && !isThirdPartyLibrary(packageName));
459
+ }
460
+
461
+ function getImportPriority(importObj) {
462
+ const { packageName, className } = importObj;
463
+
464
+ // 1. __future__ imports (最高优先级)
465
+ if (packageName === '__future__') {
466
+ return 1;
467
+ }
468
+
469
+ // 2. 标准库 import 语句
470
+ if (!packageName && isStandardLibrary(className)) {
471
+ return 2;
472
+ }
473
+
474
+ // 3. 标准库 from...import 语句
475
+ if (packageName && isStandardLibrary(packageName)) {
476
+ return 3;
477
+ }
478
+
479
+ // 4. 第三方库 import 语句
480
+ if (!packageName && isThirdPartyLibrary(className)) {
481
+ return 4;
482
+ }
483
+
484
+ // 5. 第三方库 from...import 语句
485
+ if (packageName && isThirdPartyLibrary(packageName)) {
486
+ return 5;
487
+ }
488
+
489
+ // 6. 本地/相对 import 语句
490
+ if (!packageName && isLocalImport(className)) {
491
+ return 6;
492
+ }
493
+
494
+ // 7. 本地/相对 from...import 语句
495
+ if (packageName && isLocalImport(packageName)) {
496
+ return 7;
497
+ }
498
+
499
+ // 8. 其他情况
500
+ return 8;
501
+ }
502
+
503
+
504
+ // 生成排序键
505
+ function getSortKey(importObj) {
506
+ const { packageName, className } = importObj;
507
+ const priority = getImportPriority(importObj);
508
+
509
+ // 构建排序键:优先级 + 包名 + 类名
510
+ const sortPackage = packageName || '';
511
+ const sortClass = className || '';
512
+
513
+ return `${priority.toString().padStart(2, '0')}_${sortPackage}_${sortClass}`;
514
+ }
515
+
516
+ //合并同一包的from imports
517
+ function mergeFromImportsByPackage(imports) {
518
+ const packageGroups = new Map();
519
+ const nonFromImports = [];
520
+
521
+ for (const importObj of imports) {
522
+ if (importObj.packageName) {
523
+ if (!packageGroups.has(importObj.packageName)) {
524
+ packageGroups.set(importObj.packageName, []);
525
+ }
526
+ packageGroups.get(importObj.packageName).push(importObj);
527
+ } else {
528
+ nonFromImports.push(importObj);
529
+ }
530
+ }
531
+
532
+ const mergedImports = [...nonFromImports];
533
+ for (const [packageName, packageImports] of packageGroups) {
534
+ if (packageImports.length === 1) {
535
+ mergedImports.push(packageImports[0]);
536
+ } else {
537
+ const canMerge = packageImports.every(imp => !imp.aliasName);
538
+
539
+ if (canMerge) {
540
+ const classNames = packageImports.map(imp => imp.className).sort();
541
+ mergedImports.push({
542
+ packageName: packageName,
543
+ className: classNames.join(', '),
544
+ aliasName: '',
545
+ _isMerged: true
546
+ });
547
+ } else {
548
+ mergedImports.push(...packageImports);
549
+ }
550
+ }
551
+ }
552
+
553
+ return mergedImports;
554
+ }
555
+
556
+
557
+ const importMap = new Map();
558
+ for (const importObj of imports) {
559
+ const key = `${importObj.packageName}|${importObj.className}|${importObj.aliasName}`;
560
+
561
+ if (importMap.has(key)) {
562
+ continue;
563
+ }
564
+ importMap.set(key, importObj);
565
+ }
566
+
567
+
568
+ const mergedImports = mergeFromImportsByPackage(Array.from(importMap.values()));
569
+
570
+ // 对imports进行排序
571
+ const sortedImports = [...mergedImports].sort((a, b) => {
572
+ const keyA = getSortKey(a);
573
+ const keyB = getSortKey(b);
574
+ return keyA.localeCompare(keyB);
575
+ });
576
+
577
+ return sortedImports;
578
+ }
579
+
580
+ // 辅助函数:将排序后的导入转换为Python代码字符串
581
+ function _importsToString(sortedImports) {
582
+ const lines = [];
583
+ let lastPriority = -1;
584
+
585
+ // 内部函数需要访问外部的getImportPriority
586
+ function getImportPriority(importObj) {
587
+ const { packageName, className } = importObj;
588
+
589
+ function isStandardLibrary(packageName) {
590
+ if (!packageName) { return false; }
591
+ const rootModule = packageName.split('.')[0];
592
+ return standardLibraries.has(rootModule);
593
+ }
594
+
595
+ if (packageName === '__future__') { return 1; }
596
+ if (!packageName && isStandardLibrary(className)) { return 2; }
597
+ if (packageName && isStandardLibrary(packageName)) { return 3; }
598
+ if (!packageName && !isStandardLibrary(className)) { return 4; }
599
+ if (packageName && !isStandardLibrary(packageName)) { return 5; }
600
+ return 6;
601
+ }
602
+
603
+ sortedImports.forEach(importObj => {
604
+ const { packageName, className, aliasName } = importObj;
605
+ const currentPriority = getImportPriority(importObj);
606
+
607
+ // 在不同优先级组之间添加空行
608
+ if (lastPriority !== -1 && currentPriority !== lastPriority) {
609
+ lines.push('');
610
+ }
611
+
612
+ // 生成import语句
613
+ let importLine;
614
+ if (packageName) {
615
+ // from...import 语句
616
+ if (aliasName) {
617
+ importLine = `from ${packageName} import ${className} as ${aliasName}`;
618
+ } else {
619
+ importLine = `from ${packageName} import ${className}`;
620
+ }
621
+ } else {
622
+ // import 语句
623
+ if (aliasName) {
624
+ importLine = `import ${className} as ${aliasName}`;
625
+ } else {
626
+ importLine = `import ${className}`;
627
+ }
628
+ }
629
+
630
+ lines.push(importLine);
631
+ lastPriority = currentPriority;
632
+ });
633
+
634
+ return lines.join('\n');
635
+ }
636
+
637
+
415
638
  module.exports = {
416
639
  _removeFilesInDirectory,
417
640
  _name,
@@ -433,6 +656,8 @@ module.exports = {
433
656
  _type,
434
657
  _getImport,
435
658
  _adaptedQuotes,
659
+ _sortImports,
660
+ _importsToString,
436
661
  CORE,
437
662
  REQUEST,
438
663
  RESPONSE,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@darabonba/python-generator",
3
- "version": "2.0.9",
3
+ "version": "2.0.11",
4
4
  "description": "The darabonba generator for Python",
5
5
  "main": "lib/generator.js",
6
6
  "directories": {
@@ -22,25 +22,27 @@ import os
22
22
  from setuptools import setup, find_packages
23
23
 
24
24
  """
25
- setup module for tea_python_tests.
25
+ setup module for tea-python-tests.
26
26
 
27
27
  Created on *
28
28
 
29
- @author: Alibaba
29
+ @author: AlibabaCloud SDK Team
30
30
  """
31
31
 
32
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/"
33
+ NAME = "tea-python-tests"
34
+ DESCRIPTION = "Generate setup.py"
35
+ AUTHOR = "AlibabaCloud SDK Team"
36
+ AUTHOR_EMAIL = "sdkteam@alibabacloud.com"
37
+ URL = "https://github.com/dara"
38
38
  VERSION = __import__(PACKAGE).__version__
39
39
  REQUIRES = [
40
- "alibabacloud-tea>=1.0.0",
41
- "source==0.0.1",
42
- "import==1.1.2",
43
- "alibabacloud_tea_util==0.3.11"
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
+ "xxx1>=0.0.1, <1.0.0",
45
+ "xxx2>=0.0.1, <1.0.0"
44
46
  ]
45
47
 
46
48
  LONG_DESCRIPTION = ''
@@ -63,17 +65,19 @@ setup(
63
65
  include_package_data=True,
64
66
  platforms="any",
65
67
  install_requires=REQUIRES,
66
- python_requires=">=3.6",
68
+ python_requires=">=3.7",
67
69
  classifiers=(
68
70
  "Development Status :: 4 - Beta",
69
71
  "Intended Audience :: Developers",
70
72
  "License :: OSI Approved :: Apache Software License",
71
73
  "Programming Language :: Python",
72
74
  "Programming Language :: Python :: 3",
73
- "Programming Language :: Python :: 3.6",
74
75
  "Programming Language :: Python :: 3.7",
75
76
  "Programming Language :: Python :: 3.8",
76
77
  "Programming Language :: Python :: 3.9",
78
+ "Programming Language :: Python :: 3.10",
79
+ "Programming Language :: Python :: 3.11",
80
+ "Programming Language :: Python :: 3.12",
77
81
  "Topic :: Software Development"
78
82
  )
79
83
  )
@@ -1,13 +1,13 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  # This file is auto-generated, don't edit it. Thanks.
3
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
4
 
5
+ from alias_source.source_client import SourceClient as AliasSourceSourceClient
6
+ from alias_symbol import models as alias_symbol_models
7
+ from alias_symbol.client import Client as AliasSymbolClient
8
+ from Alias.alias_client import AliasClient
9
+ from Import.client import Client as ImportClient
10
+ from Source.client import Client as SourceClient
11
11
 
12
12
 
13
13
 
@@ -1,11 +1,11 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  # This file is auto-generated, don't edit it. Thanks.
3
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
4
 
5
+ from darabonba.core import DaraCore
6
+ from darabonba.exceptions import UnretryableException
7
+ from darabonba.policy.retry import RetryPolicyContext
8
+ from darabonba.request import DaraRequest
9
9
 
10
10
  """
11
11
  * @remarks
@@ -2,8 +2,6 @@
2
2
  # This file is auto-generated, don't edit it. Thanks.
3
3
  from __future__ import annotations
4
4
 
5
-
6
-
7
5
  from ._test import Test
8
6
 
9
7
  __all__ = [
@@ -1,8 +1,8 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  # This file is auto-generated, don't edit it. Thanks.
3
3
  from __future__ import annotations
4
- from darabonba.model import DaraModel
5
4
 
5
+ from darabonba.model import DaraModel
6
6
 
7
7
  """
8
8
  * @remarks
@@ -1,11 +1,11 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  # This file is auto-generated, don't edit it. Thanks.
3
3
  from __future__ import annotations
4
- from darabonba.core import DaraCore
5
- from darabonba.request import DaraRequest
6
- from darabonba.exceptions import UnretryableException
7
- from darabonba.policy.retry import RetryPolicyContext
8
4
 
5
+ from darabonba.core import DaraCore
6
+ from darabonba.exceptions import UnretryableException
7
+ from darabonba.policy.retry import RetryPolicyContext
8
+ from darabonba.request import DaraRequest
9
9
 
10
10
  class Client:
11
11
  def __init__(self):
@@ -1,23 +1,25 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  # This file is auto-generated, don't edit it. Thanks.
3
3
  from __future__ import annotations
4
- import base64
5
- from darabonba.utils.bytes import Bytes as DaraBytes
6
- from darabonba.date import Date as DaraDate
7
- import os
8
- from darabonba.file import File as DaraFile
9
- from darabonba.utils.form import Form as DaraForm
10
- from darabonba.core import DaraCore as DaraCore
11
- import json
12
- import logging
13
- import random
14
- import math
15
- from darabonba.utils.stream import Stream as DaraStream
16
- from darabonba.url import Url as DaraURL
17
- from darabonba.utils.xml import XML as DaraXML
18
- import sys
4
+
5
+ import base64
6
+ import json
7
+ import logging
8
+ import math
9
+ import os
10
+ import random
11
+ import sys
12
+
19
13
  from typing import List, Any
20
14
 
15
+ from darabonba.core import DaraCore as DaraCore
16
+ from darabonba.date import Date as DaraDate
17
+ from darabonba.file import File as DaraFile
18
+ from darabonba.url import Url as DaraURL
19
+ from darabonba.utils.bytes import Bytes as DaraBytes
20
+ from darabonba.utils.form import Form as DaraForm
21
+ from darabonba.utils.stream import Stream as DaraStream
22
+ from darabonba.utils.xml import XML as DaraXML
21
23
 
22
24
  class Client:
23
25
 
@@ -675,7 +677,7 @@ class Client:
675
677
  if not DaraCore.is_null(data):
676
678
  ws.write(data)
677
679
 
678
- awiat DaraCore.sleep_async(a)
680
+ await DaraCore.sleep_async(a)
679
681
  default_val = args[0] or args[1]
680
682
  if default_val == b:
681
683
  return
@@ -1,13 +1,14 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  # This file is auto-generated, don't edit it. Thanks.
3
3
  from __future__ import annotations
4
- from tea_python_tests import models as main_models
5
- from darabonba.core import DaraCore
6
- from darabonba.exceptions import UnretryableException
7
- from darabonba.policy.retry import RetryPolicyContext
8
- from darabonba.request import DaraRequest
4
+
9
5
  from typing import List, Dict, BinaryIO, Any
10
6
 
7
+ from darabonba.core import DaraCore
8
+ from darabonba.exceptions import UnretryableException
9
+ from darabonba.policy.retry import RetryPolicyContext
10
+ from darabonba.request import DaraRequest
11
+ from tea_python_tests import models as main_models
11
12
 
12
13
  # top comment
13
14
  """
@@ -2,8 +2,6 @@
2
2
  # This file is auto-generated, don't edit it. Thanks.
3
3
  from __future__ import annotations
4
4
 
5
-
6
-
7
5
  from ._test_1 import Test1
8
6
  from ._test_2 import Test2
9
7
  from ._test_3 import Test3
@@ -1,9 +1,10 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  # This file is auto-generated, don't edit it. Thanks.
3
3
  from __future__ import annotations
4
- from darabonba.model import DaraModel
4
+
5
5
  from typing import List
6
6
 
7
+ from darabonba.model import DaraModel
7
8
 
8
9
  # import comment
9
10
 
@@ -1,8 +1,8 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  # This file is auto-generated, don't edit it. Thanks.
3
3
  from __future__ import annotations
4
- from darabonba.model import DaraModel
5
4
 
5
+ from darabonba.model import DaraModel
6
6
 
7
7
  """
8
8
  * @remarks
@@ -1,8 +1,8 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  # This file is auto-generated, don't edit it. Thanks.
3
3
  from __future__ import annotations
4
- from darabonba.model import DaraModel
5
4
 
5
+ from darabonba.model import DaraModel
6
6
 
7
7
  """
8
8
  * @remarks
@@ -1,20 +1,21 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  # This file is auto-generated, don't edit it. Thanks.
3
3
  from __future__ import annotations
4
- from Source.source_client import SourceClient
5
- from Source import models as source_models
6
- from darabonba.core import DaraCore
7
- from tea_python_tests import models as main_models
8
- from darabonba.exceptions import UnretryableException
9
- from darabonba.policy.retry import RetryPolicyContext
10
- from darabonba.request import DaraRequest
11
- import logging
12
- from darabonba.response import DaraResponse
13
- from darabonba.exceptions import DaraException
14
- from tea_python_tests import exceptions as main_exceptions
15
- from Source import exceptions as source_exceptions
4
+
5
+ import logging
6
+
16
7
  from typing import List, Dict, Any
17
8
 
9
+ from darabonba.core import DaraCore
10
+ from darabonba.exceptions import DaraException, UnretryableException
11
+ from darabonba.policy.retry import RetryPolicyContext
12
+ from darabonba.request import DaraRequest
13
+ from darabonba.response import DaraResponse
14
+ from Source import exceptions as source_exceptions
15
+ from Source import models as source_models
16
+ from Source.source_client import SourceClient
17
+ from tea_python_tests import exceptions as main_exceptions
18
+ from tea_python_tests import models as main_models
18
19
 
19
20
  class Client(SourceClient):
20
21
  _protocol: str = None
@@ -226,7 +227,7 @@ class Client(SourceClient):
226
227
  return
227
228
  elif SourceClient.judge_str('test') or False:
228
229
  return source_models.RuntimeObject()
229
- source_client.print_data(DaraCore.to_map(request), '1')
230
+ source_client.print_data_async(DaraCore.to_map(request), '1')
230
231
  self.hello(DaraCore.to_map(request), [
231
232
  '1',
232
233
  '2'
@@ -441,7 +442,7 @@ class Client(SourceClient):
441
442
  return
442
443
  elif SourceClient.judge_str('test') or False:
443
444
  return source_models.RuntimeObject()
444
- source_client.print_data(DaraCore.to_map(request), '1')
445
+ await source_client.print_data_async_async(DaraCore.to_map(request), '1')
445
446
  await self.hello_async(DaraCore.to_map(request), [
446
447
  '1',
447
448
  '2'
@@ -476,7 +477,7 @@ class Client(SourceClient):
476
477
  config_array = [
477
478
  config
478
479
  ]
479
- source_client.print_data(DaraCore.to_map(request), '1')
480
+ source_client.print_data_sse(DaraCore.to_map(request), '1')
480
481
  _request.protocol = 'HTTP'
481
482
  _request.port = 80
482
483
  _request.method = 'GET'
@@ -503,7 +504,7 @@ class Client(SourceClient):
503
504
  config_array = [
504
505
  config
505
506
  ]
506
- source_client.print_data(DaraCore.to_map(request), '1')
507
+ source_client.print_data_sse_async(DaraCore.to_map(request), '1')
507
508
  _request.protocol = 'HTTP'
508
509
  _request.port = 80
509
510
  _request.method = 'GET'
@@ -2,8 +2,6 @@
2
2
  # This file is auto-generated, don't edit it. Thanks.
3
3
  from __future__ import annotations
4
4
 
5
-
6
-
7
5
  from ._err_1 import Err1Exception
8
6
  from ._err_2 import Err2Exception
9
7
 
@@ -1,9 +1,10 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  # This file is auto-generated, don't edit it. Thanks.
3
3
  from __future__ import annotations
4
- from darabonba.exceptions import DaraException
4
+
5
5
  from typing import Dict
6
6
 
7
+ from darabonba.exceptions import DaraException
7
8
 
8
9
  class Err1Exception(DaraException):
9
10
  def __init__(
@@ -1,8 +1,8 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  # This file is auto-generated, don't edit it. Thanks.
3
3
  from __future__ import annotations
4
- from darabonba.exceptions import DaraException
5
4
 
5
+ from darabonba.exceptions import DaraException
6
6
 
7
7
  class Err2Exception(DaraException):
8
8
  def __init__(
@@ -2,8 +2,6 @@
2
2
  # This file is auto-generated, don't edit it. Thanks.
3
3
  from __future__ import annotations
4
4
 
5
-
6
-
7
5
  from ._complex_request import ComplexRequest
8
6
  from ._response import Response
9
7
  from ._complex_request import ComplexRequestHeader
@@ -1,14 +1,15 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  # This file is auto-generated, don't edit it. Thanks.
3
3
  from __future__ import annotations
4
- from darabonba.model import DaraModel
5
- from tea_python_tests import models as main_models
6
- from darabonba.request import DaraRequest
7
- from darabonba.response import DaraResponse
8
- from Source import models as source_models
9
- from Source.source_client import SourceClient
4
+
10
5
  from typing import BinaryIO, List, Dict, Any
11
6
 
7
+ from darabonba.model import DaraModel
8
+ from darabonba.request import DaraRequest
9
+ from darabonba.response import DaraResponse
10
+ from Source import models as source_models
11
+ from Source.source_client import SourceClient
12
+ from tea_python_tests import models as main_models
12
13
 
13
14
  class ComplexRequest(DaraModel):
14
15
  def __init__(