@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.
- package/ChangeLog.md +0 -158
- package/lib/builtin.js +818 -0
- package/lib/generator.js +2708 -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 +1169 -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/{src/langs/python/files/setup.py.tmpl → tests/expected/empty/setup.py} +11 -11
- 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 +26 -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 +452 -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 +68 -0
- package/tests/fixtures/multi/libraries/darabonba_Util_0.2.11/main.tea +244 -0
- package/tests/fixtures/multi/libraries/darabonba_Util_0.2.11/util.tea +2 -0
- package/tests/fixtures/multi/main.dara +32 -0
- package/tests/fixtures/multi/model/user.dara +35 -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/{src/langs/python2/files/setup.py.tmpl → tests/output/annotation/setup.py} +19 -24
- 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 +1169 -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 +26 -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/src/generator.js +0 -231
- package/src/langs/common/combinator.js +0 -193
- package/src/langs/common/config.js +0 -60
- package/src/langs/common/enum.js +0 -179
- package/src/langs/common/items.js +0 -551
- package/src/langs/common/package_info.js +0 -53
- package/src/langs/python/combinator.js +0 -1898
- package/src/langs/python/config.js +0 -169
- package/src/langs/python/files/.gitignore.tmpl +0 -5
- package/src/langs/python/files/__init__.py.tmpl +0 -1
- package/src/langs/python/package_info.js +0 -78
- package/src/langs/python2/combinator.js +0 -1770
- package/src/langs/python2/config.js +0 -162
- package/src/langs/python2/files/.gitignore.tmpl +0 -5
- package/src/langs/python2/files/__init__.py.tmpl +0 -1
- package/src/langs/python2/package_info.js +0 -78
- package/src/lib/debug.js +0 -55
- package/src/lib/emitter.js +0 -95
- package/src/lib/helper.js +0 -207
- package/src/resolver/base.js +0 -282
- package/src/resolver/client.js +0 -1013
- package/src/resolver/model.js +0 -159
- 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
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# This file is auto-generated, don't edit it. Thanks.
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
import sys
|
|
5
|
+
from typing import List
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class ExecClient:
|
|
9
|
+
|
|
10
|
+
def __init__(self):
|
|
11
|
+
pass
|
|
12
|
+
|
|
13
|
+
@staticmethod
|
|
14
|
+
def main(
|
|
15
|
+
args: List[str],
|
|
16
|
+
) -> None:
|
|
17
|
+
pass
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
if __name__ == '__main__':
|
|
21
|
+
ExecClient.main(sys.argv[1:])
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.0.0"
|
|
@@ -0,0 +1,64 @@
|
|
|
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 typing import Dict, List
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class Client:
|
|
9
|
+
def __init__(self):
|
|
10
|
+
pass
|
|
11
|
+
|
|
12
|
+
@staticmethod
|
|
13
|
+
def hello() -> None:
|
|
14
|
+
return
|
|
15
|
+
|
|
16
|
+
@staticmethod
|
|
17
|
+
def hello_map() -> Dict[str, str]:
|
|
18
|
+
m = {}
|
|
19
|
+
return DaraCore.merge({
|
|
20
|
+
'key': 'value',
|
|
21
|
+
'key-1': 'value-1',
|
|
22
|
+
'key-2': 'value-2',
|
|
23
|
+
'': 'value-3',
|
|
24
|
+
}, m)
|
|
25
|
+
|
|
26
|
+
@staticmethod
|
|
27
|
+
def hello_array_map() -> List[Dict[str, str]]:
|
|
28
|
+
return [
|
|
29
|
+
{
|
|
30
|
+
'key': 'value'
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
@staticmethod
|
|
35
|
+
def hello_params(
|
|
36
|
+
a: str,
|
|
37
|
+
b: str,
|
|
38
|
+
) -> None:
|
|
39
|
+
Client.hello_interface()
|
|
40
|
+
Client.hello_array_map()
|
|
41
|
+
|
|
42
|
+
@staticmethod
|
|
43
|
+
async def hello_params_async(
|
|
44
|
+
a: str,
|
|
45
|
+
b: str,
|
|
46
|
+
) -> None:
|
|
47
|
+
await Client.hello_interface_async()
|
|
48
|
+
Client.hello_array_map()
|
|
49
|
+
|
|
50
|
+
@staticmethod
|
|
51
|
+
def hello_interface() -> None:
|
|
52
|
+
# interface mode
|
|
53
|
+
raise Exception('Un-implemented')
|
|
54
|
+
|
|
55
|
+
@staticmethod
|
|
56
|
+
async def hello_interface_async() -> None:
|
|
57
|
+
# interface mode
|
|
58
|
+
raise Exception('Un-implemented')
|
|
59
|
+
|
|
60
|
+
def a_params(self) -> None:
|
|
61
|
+
self.hello_params('a', 'b')
|
|
62
|
+
|
|
63
|
+
async def a_params_async(self) -> None:
|
|
64
|
+
await self.hello_params_async('a', 'b')
|
|
@@ -0,0 +1,78 @@
|
|
|
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
|
+
"alibabacloud_import==0.0.1rc1",
|
|
42
|
+
"alibabacloud_local>=0.0.1, <1.0.0"
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
LONG_DESCRIPTION = ''
|
|
46
|
+
if os.path.exists('./README.md'):
|
|
47
|
+
with open("README.md", encoding='utf-8') as fp:
|
|
48
|
+
LONG_DESCRIPTION = fp.read()
|
|
49
|
+
|
|
50
|
+
setup(
|
|
51
|
+
name=NAME,
|
|
52
|
+
version=VERSION,
|
|
53
|
+
description=DESCRIPTION,
|
|
54
|
+
long_description=LONG_DESCRIPTION,
|
|
55
|
+
long_description_content_type='text/markdown',
|
|
56
|
+
author=AUTHOR,
|
|
57
|
+
author_email=AUTHOR_EMAIL,
|
|
58
|
+
license="Apache License 2.0",
|
|
59
|
+
url=URL,
|
|
60
|
+
keywords=["tea","python","tests"],
|
|
61
|
+
packages=find_packages(exclude=["tests*"]),
|
|
62
|
+
include_package_data=True,
|
|
63
|
+
platforms="any",
|
|
64
|
+
install_requires=REQUIRES,
|
|
65
|
+
python_requires=">=3.6",
|
|
66
|
+
classifiers=(
|
|
67
|
+
"Development Status :: 4 - Beta",
|
|
68
|
+
"Intended Audience :: Developers",
|
|
69
|
+
"License :: OSI Approved :: Apache Software License",
|
|
70
|
+
"Programming Language :: Python",
|
|
71
|
+
"Programming Language :: Python :: 3",
|
|
72
|
+
"Programming Language :: Python :: 3.6",
|
|
73
|
+
"Programming Language :: Python :: 3.7",
|
|
74
|
+
"Programming Language :: Python :: 3.8",
|
|
75
|
+
"Programming Language :: Python :: 3.9",
|
|
76
|
+
"Topic :: Software Development"
|
|
77
|
+
)
|
|
78
|
+
)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.0.0"
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# This file is auto-generated, don't edit it. Thanks.
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from Local import models as local_models
|
|
5
|
+
from Source.source_client import SourceClient
|
|
6
|
+
from Source import models as source_models
|
|
7
|
+
from typing import List
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class Client:
|
|
13
|
+
_id: List[str] = None
|
|
14
|
+
_str: str = None
|
|
15
|
+
_model: local_models.Local = None
|
|
16
|
+
|
|
17
|
+
def __init__(self):
|
|
18
|
+
pass
|
|
19
|
+
|
|
20
|
+
@staticmethod
|
|
21
|
+
def sample(
|
|
22
|
+
client: SourceClient,
|
|
23
|
+
) -> None:
|
|
24
|
+
runtime = source_models.RuntimeObject()
|
|
25
|
+
request = source_models.Request(
|
|
26
|
+
accesskey = 'accesskey',
|
|
27
|
+
region = 'region'
|
|
28
|
+
)
|
|
29
|
+
client.print(runtime)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.0.0"
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# This file is auto-generated, don't edit it. Thanks.
|
|
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
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class Client(SourceClient):
|
|
12
|
+
|
|
13
|
+
def __init__(
|
|
14
|
+
self,
|
|
15
|
+
config: source_models.Config,
|
|
16
|
+
):
|
|
17
|
+
super().__init__(config)
|
|
18
|
+
a = {
|
|
19
|
+
'test': 'test'
|
|
20
|
+
}
|
|
21
|
+
c = {
|
|
22
|
+
'test': 'test'
|
|
23
|
+
}
|
|
24
|
+
self._endpoint_rule = 'central'
|
|
25
|
+
self._endpoint_map = DaraCore.merge({
|
|
26
|
+
'ap-northeast-1': 'cusanalytic.aliyuncs.com',
|
|
27
|
+
'ap-south-1': 'cusanalytic.aliyuncs.com',
|
|
28
|
+
'ap-south-2-test': SourceClient.hello()
|
|
29
|
+
}, a, c)
|
|
30
|
+
b = {
|
|
31
|
+
'ap-northeast-1': {
|
|
32
|
+
'ap-south-1': 'cusanalytic.aliyuncs.com'
|
|
33
|
+
},
|
|
34
|
+
'ap-south-2': SourceClient.hello()
|
|
35
|
+
}
|
|
36
|
+
self._endpoint_map.get('ap-northeast-1')
|
|
37
|
+
self._endpoint_map['ap-northeast-1'] = ''
|
|
38
|
+
self._endpoint_map[config.str_value] = 'str'
|
|
39
|
+
self._endpoint_map.get(config.str_value)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.0.0"
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# This file is auto-generated, don't edit it. Thanks.
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
from darabonba.exceptions import DaraException
|
|
5
|
+
from tea_python_tests import models as main_models
|
|
6
|
+
from typing import Dict
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class MainFileException(DaraException):
|
|
10
|
+
def __init__(
|
|
11
|
+
self,
|
|
12
|
+
message: str = None,
|
|
13
|
+
code: str = None,
|
|
14
|
+
stack: str = None,
|
|
15
|
+
size: int = None,
|
|
16
|
+
data: Dict[str, main_models.Model] = None,
|
|
17
|
+
model: main_models.MainFileModel = None,
|
|
18
|
+
):
|
|
19
|
+
super().__init__({
|
|
20
|
+
'message': message,
|
|
21
|
+
'code': code,
|
|
22
|
+
'stack': stack,
|
|
23
|
+
})
|
|
24
|
+
self.name = 'MainFileException'
|
|
25
|
+
self.size = size
|
|
26
|
+
self.data = data
|
|
27
|
+
self.model = model
|
|
28
|
+
|