@darabonba/python-generator 2.0.12 → 2.0.14
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 +3 -0
- package/lib/generator.js +51 -51
- package/lib/helper.js +45 -3
- package/package.json +1 -1
- package/tests/expected/complex/tea_python_tests/client.py +7 -5
- package/tests/expected/function/tea_python_tests/client.py +12 -0
- package/tests/expected/model/tea_python_tests/models/_my_model.py +36 -0
- package/tests/expected/websocket/tea_python_tests/client.py +20 -0
- package/tests/fixtures/complex/Darafile +5 -0
- package/tests/fixtures/complex/libraries/Darafile +4 -1
- package/tests/fixtures/complex/libraries/import.dara +1 -0
- package/tests/fixtures/complex/main.dara +1 -0
- package/tests/fixtures/function/Darafile +7 -1
- package/tests/fixtures/function/main.dara +8 -0
- package/tests/fixtures/model/Darafile +8 -0
- package/tests/fixtures/model/main.dara +4 -0
- package/tests/fixtures/websocket/.libraries.json +3 -0
- package/tests/fixtures/websocket/Darafile +9 -0
- package/tests/fixtures/websocket/libraries/alibabacloud_OpenApiV2_0.1.27/Teafile +21 -0
- package/tests/fixtures/websocket/libraries/alibabacloud_OpenApiV2_0.1.27/main.tea +1 -0
- package/tests/fixtures/websocket/libraries/alibabacloud_OpenApiV2_0.1.27/utils.dara +1 -0
- package/tests/fixtures/websocket/libraries/alibabacloud_OpenApiV2_0.1.27/websocketUtils.dara +9 -0
- package/tests/fixtures/websocket/main.dara +8 -0
- package/tests/main.tests.js +10 -0
- package/tests/output/alias/setup.py +0 -83
- package/tests/output/alias/tea_python_tests/client.py +0 -35
- package/tests/output/annotation/setup.py +0 -79
- package/tests/output/annotation/tea_python_tests/__init__.py +0 -1
- package/tests/output/annotation/tea_python_tests/client.py +0 -93
- package/tests/output/annotation/tea_python_tests/models/__init__.py +0 -9
- package/tests/output/annotation/tea_python_tests/models/_test.py +0 -38
- package/tests/output/api/setup.py +0 -79
- package/tests/output/api/tea_python_tests/__init__.py +0 -1
- package/tests/output/api/tea_python_tests/client.py +0 -106
- package/tests/output/builtin/setup.py +0 -79
- package/tests/output/builtin/tea_python_tests/__init__.py +0 -1
- package/tests/output/builtin/tea_python_tests/client.py +0 -687
- package/tests/output/comment/setup.py +0 -79
- package/tests/output/comment/tea_python_tests/__init__.py +0 -1
- package/tests/output/comment/tea_python_tests/client.py +0 -289
- package/tests/output/comment/tea_python_tests/models/__init__.py +0 -13
- package/tests/output/comment/tea_python_tests/models/_test_1.py +0 -103
- package/tests/output/comment/tea_python_tests/models/_test_2.py +0 -58
- package/tests/output/comment/tea_python_tests/models/_test_3.py +0 -64
- package/tests/output/complex/setup.py +0 -79
- package/tests/output/complex/tea_python_tests/__init__.py +0 -1
- package/tests/output/complex/tea_python_tests/client.py +0 -1170
- package/tests/output/complex/tea_python_tests/exceptions/__init__.py +0 -11
- package/tests/output/complex/tea_python_tests/exceptions/_err_1.py +0 -24
- package/tests/output/complex/tea_python_tests/exceptions/_err_2.py +0 -22
- package/tests/output/complex/tea_python_tests/models/__init__.py +0 -17
- package/tests/output/complex/tea_python_tests/models/_complex_request.py +0 -574
- package/tests/output/complex/tea_python_tests/models/_response.py +0 -34
- package/tests/output/const/setup.py +0 -79
- package/tests/output/const/tea_python_tests/__init__.py +0 -1
- package/tests/output/const/tea_python_tests/client.py +0 -12
- package/tests/output/empty/setup.py +0 -79
- package/tests/output/empty/tea_python_tests/__init__.py +0 -1
- package/tests/output/empty/tea_python_tests/client.py +0 -8
- package/tests/output/exec/setup.py +0 -79
- package/tests/output/exec/tea_python_tests/__init__.py +0 -1
- package/tests/output/exec/tea_python_tests/exec_client.py +0 -22
- package/tests/output/function/setup.py +0 -79
- package/tests/output/function/tea_python_tests/__init__.py +0 -1
- package/tests/output/function/tea_python_tests/client.py +0 -65
- package/tests/output/import/setup.py +0 -80
- package/tests/output/import/tea_python_tests/__init__.py +0 -1
- package/tests/output/import/tea_python_tests/client.py +0 -30
- package/tests/output/map/setup.py +0 -79
- package/tests/output/map/tea_python_tests/__init__.py +0 -1
- package/tests/output/map/tea_python_tests/client.py +0 -39
- package/tests/output/model/setup.py +0 -79
- package/tests/output/model/tea_python_tests/__init__.py +0 -1
- package/tests/output/model/tea_python_tests/client.py +0 -8
- package/tests/output/model/tea_python_tests/exceptions/__init__.py +0 -9
- package/tests/output/model/tea_python_tests/exceptions/_main_file.py +0 -29
- package/tests/output/model/tea_python_tests/models/__init__.py +0 -31
- package/tests/output/model/tea_python_tests/models/_class.py +0 -23
- package/tests/output/model/tea_python_tests/models/_m.py +0 -56
- package/tests/output/model/tea_python_tests/models/_main_file.py +0 -73
- package/tests/output/model/tea_python_tests/models/_model.py +0 -33
- package/tests/output/model/tea_python_tests/models/_my_model.py +0 -750
- package/tests/output/modelConfig/setup.py +0 -79
- package/tests/output/modelConfig/tea_python_tests/__init__.py +0 -1
- package/tests/output/modelConfig/tea_python_tests/client.py +0 -8
- package/tests/output/modelConfig/tea_python_tests/exceptions/__init__.py +0 -9
- package/tests/output/modelConfig/tea_python_tests/exceptions/_main_file.py +0 -29
- package/tests/output/modelConfig/tea_python_tests/models/__init__.py +0 -31
- package/tests/output/modelConfig/tea_python_tests/models/_class.py +0 -23
- package/tests/output/modelConfig/tea_python_tests/models/_m.py +0 -56
- package/tests/output/modelConfig/tea_python_tests/models/_main_file.py +0 -73
- package/tests/output/modelConfig/tea_python_tests/models/_model.py +0 -33
- package/tests/output/modelConfig/tea_python_tests/models/_my_model.py +0 -750
- package/tests/output/multi/setup.py +0 -79
- package/tests/output/multi/tea_python_tests/__init__.py +0 -1
- package/tests/output/multi/tea_python_tests/api.py +0 -93
- package/tests/output/multi/tea_python_tests/api_models/__init__.py +0 -9
- package/tests/output/multi/tea_python_tests/api_models/_test_model_dir_2.py +0 -35
- package/tests/output/multi/tea_python_tests/client.py +0 -39
- package/tests/output/multi/tea_python_tests/exceptions/__init__.py +0 -11
- package/tests/output/multi/tea_python_tests/exceptions/_err.py +0 -38
- package/tests/output/multi/tea_python_tests/lib/util.py +0 -18
- package/tests/output/multi/tea_python_tests/model/user.py +0 -27
- package/tests/output/multi/tea_python_tests/model/user_exceptions/__init__.py +0 -13
- package/tests/output/multi/tea_python_tests/model/user_exceptions/_err.py +0 -22
- package/tests/output/multi/tea_python_tests/model/user_exceptions/_err_1.py +0 -54
- package/tests/output/multi/tea_python_tests/model/user_exceptions/_err_2.py +0 -18
- package/tests/output/multi/tea_python_tests/model/user_models/__init__.py +0 -11
- package/tests/output/multi/tea_python_tests/model/user_models/_base_info.py +0 -73
- package/tests/output/multi/tea_python_tests/model/user_models/_info.py +0 -82
- package/tests/output/multi/tea_python_tests/models/__init__.py +0 -11
- package/tests/output/multi/tea_python_tests/models/_test_model_dir.py +0 -84
- package/tests/output/statements/setup.py +0 -79
- package/tests/output/statements/tea_python_tests/__init__.py +0 -1
- package/tests/output/statements/tea_python_tests/client.py +0 -86
- package/tests/output/super/setup.py +0 -79
- package/tests/output/super/tea_python_tests/__init__.py +0 -1
- package/tests/output/super/tea_python_tests/client.py +0 -16
- package/tests/output/typedef/setup.py +0 -80
- package/tests/output/typedef/tea_python_tests/__init__.py +0 -1
- package/tests/output/typedef/tea_python_tests/client.py +0 -74
- package/tests/output/typedef/tea_python_tests/models/__init__.py +0 -9
- package/tests/output/typedef/tea_python_tests/models/_m.py +0 -45
- /package/tests/{output/alias → expected/websocket}/tea_python_tests/__init__.py +0 -0
|
@@ -1,79 +0,0 @@
|
|
|
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 13/08/2025
|
|
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.7",
|
|
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.7",
|
|
72
|
-
"Programming Language :: Python :: 3.8",
|
|
73
|
-
"Programming Language :: Python :: 3.9",
|
|
74
|
-
"Programming Language :: Python :: 3.10",
|
|
75
|
-
"Programming Language :: Python :: 3.11",
|
|
76
|
-
"Programming Language :: Python :: 3.12",
|
|
77
|
-
"Topic :: Software Development"
|
|
78
|
-
)
|
|
79
|
-
)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "1.0.0"
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
# This file is auto-generated, don't edit it. Thanks.
|
|
3
|
-
from __future__ import annotations
|
|
4
|
-
|
|
5
|
-
from typing import Dict
|
|
6
|
-
|
|
7
|
-
from darabonba.exceptions import DaraException
|
|
8
|
-
from tea_python_tests import models as main_models
|
|
9
|
-
|
|
10
|
-
class MainFileException(DaraException):
|
|
11
|
-
def __init__(
|
|
12
|
-
self, *,
|
|
13
|
-
message: str = None,
|
|
14
|
-
code: str = None,
|
|
15
|
-
stack: str = None,
|
|
16
|
-
size: int = None,
|
|
17
|
-
data: Dict[str, main_models.Model] = None,
|
|
18
|
-
model: main_models.MainFileModel = None,
|
|
19
|
-
):
|
|
20
|
-
super().__init__({
|
|
21
|
-
'message': message,
|
|
22
|
-
'code': code,
|
|
23
|
-
'stack': stack,
|
|
24
|
-
})
|
|
25
|
-
self.name = 'MainFileException'
|
|
26
|
-
self.size = size
|
|
27
|
-
self.data = data
|
|
28
|
-
self.model = model
|
|
29
|
-
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
# This file is auto-generated, don't edit it. Thanks.
|
|
3
|
-
from __future__ import annotations
|
|
4
|
-
|
|
5
|
-
from ._m import M
|
|
6
|
-
from ._class import Class
|
|
7
|
-
from ._model import Model
|
|
8
|
-
from ._my_model import MyModel
|
|
9
|
-
from ._m import MSubM
|
|
10
|
-
from ._main_file import MainFileModelModel
|
|
11
|
-
from ._main_file import MainFileModel
|
|
12
|
-
from ._my_model import MyModelModelModel
|
|
13
|
-
from ._my_model import MyModelModel
|
|
14
|
-
from ._my_model import MyModelSubmodelModel
|
|
15
|
-
from ._my_model import MyModelSubmodel
|
|
16
|
-
from ._my_model import MyModelSubarraymodel
|
|
17
|
-
|
|
18
|
-
__all__ = [
|
|
19
|
-
M,
|
|
20
|
-
Class,
|
|
21
|
-
Model,
|
|
22
|
-
MyModel,
|
|
23
|
-
MSubM,
|
|
24
|
-
MainFileModelModel,
|
|
25
|
-
MainFileModel,
|
|
26
|
-
MyModelModelModel,
|
|
27
|
-
MyModelModel,
|
|
28
|
-
MyModelSubmodelModel,
|
|
29
|
-
MyModelSubmodel,
|
|
30
|
-
MyModelSubarraymodel
|
|
31
|
-
]
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
# This file is auto-generated, don't edit it. Thanks.
|
|
3
|
-
from __future__ import annotations
|
|
4
|
-
|
|
5
|
-
from darabonba.model import DaraModel
|
|
6
|
-
|
|
7
|
-
class Class(DaraModel):
|
|
8
|
-
def __init__(self):
|
|
9
|
-
pass
|
|
10
|
-
def validate(self):
|
|
11
|
-
pass
|
|
12
|
-
|
|
13
|
-
def to_map(self):
|
|
14
|
-
result = dict()
|
|
15
|
-
_map = super().to_map()
|
|
16
|
-
if _map is not None:
|
|
17
|
-
result = _map
|
|
18
|
-
return result
|
|
19
|
-
|
|
20
|
-
def from_map(self, m: dict = None):
|
|
21
|
-
m = m or dict()
|
|
22
|
-
return self
|
|
23
|
-
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
# This file is auto-generated, don't edit it. Thanks.
|
|
3
|
-
from __future__ import annotations
|
|
4
|
-
|
|
5
|
-
from darabonba.model import DaraModel
|
|
6
|
-
from tea_python_tests import models as main_models
|
|
7
|
-
|
|
8
|
-
class M(DaraModel):
|
|
9
|
-
def __init__(
|
|
10
|
-
self, *,
|
|
11
|
-
sub_m: main_models.MSubM = None,
|
|
12
|
-
):
|
|
13
|
-
self.sub_m = sub_m
|
|
14
|
-
|
|
15
|
-
def validate(self):
|
|
16
|
-
self.validate_required(self.sub_m, 'sub_m')
|
|
17
|
-
if self.sub_m:
|
|
18
|
-
self.sub_m.validate()
|
|
19
|
-
|
|
20
|
-
def to_map(self):
|
|
21
|
-
result = dict()
|
|
22
|
-
_map = super().to_map()
|
|
23
|
-
if _map is not None:
|
|
24
|
-
result = _map
|
|
25
|
-
if self.sub_m is not None:
|
|
26
|
-
result['subM'] = self.sub_m.to_map()
|
|
27
|
-
|
|
28
|
-
return result
|
|
29
|
-
|
|
30
|
-
def from_map(self, m: dict = None):
|
|
31
|
-
m = m or dict()
|
|
32
|
-
if m.get('subM') is not None:
|
|
33
|
-
temp_model = main_models.MSubM()
|
|
34
|
-
self.sub_m = temp_model.from_map(m.get('subM'))
|
|
35
|
-
|
|
36
|
-
return self
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
class MSubM(DaraModel):
|
|
41
|
-
def __init__(self):
|
|
42
|
-
pass
|
|
43
|
-
def validate(self):
|
|
44
|
-
pass
|
|
45
|
-
|
|
46
|
-
def to_map(self):
|
|
47
|
-
result = dict()
|
|
48
|
-
_map = super().to_map()
|
|
49
|
-
if _map is not None:
|
|
50
|
-
result = _map
|
|
51
|
-
return result
|
|
52
|
-
|
|
53
|
-
def from_map(self, m: dict = None):
|
|
54
|
-
m = m or dict()
|
|
55
|
-
return self
|
|
56
|
-
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
# This file is auto-generated, don't edit it. Thanks.
|
|
3
|
-
from __future__ import annotations
|
|
4
|
-
|
|
5
|
-
from darabonba.model import DaraModel
|
|
6
|
-
from tea_python_tests import models as main_models
|
|
7
|
-
|
|
8
|
-
class MainFileModel(DaraModel):
|
|
9
|
-
def __init__(
|
|
10
|
-
self, *,
|
|
11
|
-
str: str = None,
|
|
12
|
-
model: main_models.MainFileModelModel = None,
|
|
13
|
-
):
|
|
14
|
-
self.str = str
|
|
15
|
-
self.model = model
|
|
16
|
-
|
|
17
|
-
def validate(self):
|
|
18
|
-
self.validate_required(self.str, 'str')
|
|
19
|
-
self.validate_required(self.model, 'model')
|
|
20
|
-
if self.model:
|
|
21
|
-
self.model.validate()
|
|
22
|
-
|
|
23
|
-
def to_map(self):
|
|
24
|
-
result = dict()
|
|
25
|
-
_map = super().to_map()
|
|
26
|
-
if _map is not None:
|
|
27
|
-
result = _map
|
|
28
|
-
if self.str is not None:
|
|
29
|
-
result['str'] = self.str
|
|
30
|
-
|
|
31
|
-
if self.model is not None:
|
|
32
|
-
result['model'] = self.model.to_map()
|
|
33
|
-
|
|
34
|
-
return result
|
|
35
|
-
|
|
36
|
-
def from_map(self, m: dict = None):
|
|
37
|
-
m = m or dict()
|
|
38
|
-
if m.get('str') is not None:
|
|
39
|
-
self.str = m.get('str')
|
|
40
|
-
|
|
41
|
-
if m.get('model') is not None:
|
|
42
|
-
temp_model = main_models.MainFileModelModel()
|
|
43
|
-
self.model = temp_model.from_map(m.get('model'))
|
|
44
|
-
|
|
45
|
-
return self
|
|
46
|
-
|
|
47
|
-
class MainFileModelModel(DaraModel):
|
|
48
|
-
def __init__(
|
|
49
|
-
self, *,
|
|
50
|
-
str: str = None,
|
|
51
|
-
):
|
|
52
|
-
self.str = str
|
|
53
|
-
|
|
54
|
-
def validate(self):
|
|
55
|
-
self.validate_required(self.str, 'str')
|
|
56
|
-
|
|
57
|
-
def to_map(self):
|
|
58
|
-
result = dict()
|
|
59
|
-
_map = super().to_map()
|
|
60
|
-
if _map is not None:
|
|
61
|
-
result = _map
|
|
62
|
-
if self.str is not None:
|
|
63
|
-
result['str'] = self.str
|
|
64
|
-
|
|
65
|
-
return result
|
|
66
|
-
|
|
67
|
-
def from_map(self, m: dict = None):
|
|
68
|
-
m = m or dict()
|
|
69
|
-
if m.get('str') is not None:
|
|
70
|
-
self.str = m.get('str')
|
|
71
|
-
|
|
72
|
-
return self
|
|
73
|
-
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
# This file is auto-generated, don't edit it. Thanks.
|
|
3
|
-
from __future__ import annotations
|
|
4
|
-
|
|
5
|
-
from darabonba.model import DaraModel
|
|
6
|
-
|
|
7
|
-
class Model(DaraModel):
|
|
8
|
-
def __init__(
|
|
9
|
-
self, *,
|
|
10
|
-
str: str = None,
|
|
11
|
-
):
|
|
12
|
-
self.str = str
|
|
13
|
-
|
|
14
|
-
def validate(self):
|
|
15
|
-
self.validate_required(self.str, 'str')
|
|
16
|
-
|
|
17
|
-
def to_map(self):
|
|
18
|
-
result = dict()
|
|
19
|
-
_map = super().to_map()
|
|
20
|
-
if _map is not None:
|
|
21
|
-
result = _map
|
|
22
|
-
if self.str is not None:
|
|
23
|
-
result['str'] = self.str
|
|
24
|
-
|
|
25
|
-
return result
|
|
26
|
-
|
|
27
|
-
def from_map(self, m: dict = None):
|
|
28
|
-
m = m or dict()
|
|
29
|
-
if m.get('str') is not None:
|
|
30
|
-
self.str = m.get('str')
|
|
31
|
-
|
|
32
|
-
return self
|
|
33
|
-
|