@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,106 @@
|
|
|
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.request import DaraRequest
|
|
6
|
+
from darabonba.exceptions import UnretryableException
|
|
7
|
+
from darabonba.policy.retry import RetryPolicyContext
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class Client:
|
|
11
|
+
def __init__(self):
|
|
12
|
+
pass
|
|
13
|
+
|
|
14
|
+
def hello(self) -> None:
|
|
15
|
+
_request = DaraRequest()
|
|
16
|
+
_request.method = 'GET'
|
|
17
|
+
_request.pathname = '/'
|
|
18
|
+
_request.headers = {
|
|
19
|
+
'host': 'www.test.com'
|
|
20
|
+
}
|
|
21
|
+
_last_request = _request
|
|
22
|
+
_response = DaraCore.do_action(_request)
|
|
23
|
+
return
|
|
24
|
+
|
|
25
|
+
async def hello_async(self) -> None:
|
|
26
|
+
_request = DaraRequest()
|
|
27
|
+
_request.method = 'GET'
|
|
28
|
+
_request.pathname = '/'
|
|
29
|
+
_request.headers = {
|
|
30
|
+
'host': 'www.test.com'
|
|
31
|
+
}
|
|
32
|
+
_last_request = _request
|
|
33
|
+
_response = await DaraCore.async_do_action(_request)
|
|
34
|
+
return
|
|
35
|
+
|
|
36
|
+
def hello_runtime(self) -> None:
|
|
37
|
+
_runtime = {
|
|
38
|
+
}
|
|
39
|
+
_last_request = None
|
|
40
|
+
_last_response = None
|
|
41
|
+
_retries_attempted = 0
|
|
42
|
+
_context = RetryPolicyContext(
|
|
43
|
+
retries_attempted= _retries_attempted
|
|
44
|
+
)
|
|
45
|
+
while DaraCore.should_retry(_runtime.get('retryOptions'), _context):
|
|
46
|
+
if _retries_attempted > 0:
|
|
47
|
+
_backoff_time = DaraCore.get_backoff_time(_runtime.get('retryOptions'), _context)
|
|
48
|
+
if _backoff_time > 0:
|
|
49
|
+
DaraCore.sleep(_backoff_time)
|
|
50
|
+
_retries_attempted = _retries_attempted + 1
|
|
51
|
+
try:
|
|
52
|
+
_request = DaraRequest()
|
|
53
|
+
_request.method = 'GET'
|
|
54
|
+
_request.pathname = '/'
|
|
55
|
+
_request.headers = {
|
|
56
|
+
'host': 'www.test.com'
|
|
57
|
+
}
|
|
58
|
+
_last_request = _request
|
|
59
|
+
_response = DaraCore.do_action(_request, _runtime)
|
|
60
|
+
_last_response = _response
|
|
61
|
+
return
|
|
62
|
+
except Exception as e:
|
|
63
|
+
_context = RetryPolicyContext(
|
|
64
|
+
retries_attempted= _retries_attempted,
|
|
65
|
+
http_request = _last_request,
|
|
66
|
+
http_response = _last_response,
|
|
67
|
+
exception = e
|
|
68
|
+
)
|
|
69
|
+
continue
|
|
70
|
+
raise UnretryableException(_context)
|
|
71
|
+
|
|
72
|
+
async def hello_runtime_async(self) -> None:
|
|
73
|
+
_runtime = {
|
|
74
|
+
}
|
|
75
|
+
_last_request = None
|
|
76
|
+
_last_response = None
|
|
77
|
+
_retries_attempted = 0
|
|
78
|
+
_context = RetryPolicyContext(
|
|
79
|
+
retries_attempted= _retries_attempted
|
|
80
|
+
)
|
|
81
|
+
while DaraCore.should_retry(_runtime.get('retryOptions'), _context):
|
|
82
|
+
if _retries_attempted > 0:
|
|
83
|
+
_backoff_time = DaraCore.get_backoff_time(_runtime.get('retryOptions'), _context)
|
|
84
|
+
if _backoff_time > 0:
|
|
85
|
+
DaraCore.sleep(_backoff_time)
|
|
86
|
+
_retries_attempted = _retries_attempted + 1
|
|
87
|
+
try:
|
|
88
|
+
_request = DaraRequest()
|
|
89
|
+
_request.method = 'GET'
|
|
90
|
+
_request.pathname = '/'
|
|
91
|
+
_request.headers = {
|
|
92
|
+
'host': 'www.test.com'
|
|
93
|
+
}
|
|
94
|
+
_last_request = _request
|
|
95
|
+
_response = await DaraCore.async_do_action(_request, _runtime)
|
|
96
|
+
_last_response = _response
|
|
97
|
+
return
|
|
98
|
+
except Exception as e:
|
|
99
|
+
_context = RetryPolicyContext(
|
|
100
|
+
retries_attempted= _retries_attempted,
|
|
101
|
+
http_request = _last_request,
|
|
102
|
+
http_response = _last_response,
|
|
103
|
+
exception = e
|
|
104
|
+
)
|
|
105
|
+
continue
|
|
106
|
+
raise UnretryableException(_context)
|
|
@@ -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
|
+
)
|