@darabonba/python-generator 1.2.18 → 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.
Files changed (138) hide show
  1. package/ChangeLog.md +0 -155
  2. package/lib/builtin.js +818 -0
  3. package/lib/generator.js +2704 -0
  4. package/lib/helper.js +422 -0
  5. package/package.json +6 -5
  6. package/src/lib/helper.js +11 -1
  7. package/src/resolver/base.js +3 -1
  8. package/src/resolver/client.js +7 -4
  9. package/src/resolver/model.js +5 -3
  10. package/tests/expected/alias/setup.py +79 -0
  11. package/tests/expected/alias/tea_python_tests/__init__.py +1 -0
  12. package/tests/expected/alias/tea_python_tests/client.py +35 -0
  13. package/tests/expected/annotation/tea_python_tests/__init__.py +1 -0
  14. package/tests/expected/annotation/tea_python_tests/client.py +93 -0
  15. package/tests/expected/annotation/tea_python_tests/models.py +37 -0
  16. package/tests/expected/api/tea_python_tests/__init__.py +1 -0
  17. package/tests/expected/api/tea_python_tests/client.py +106 -0
  18. package/tests/expected/builtin/tea_python_tests/client.py +685 -0
  19. package/tests/expected/comment/tea_python_tests/__init__.py +1 -0
  20. package/tests/expected/comment/tea_python_tests/client.py +288 -0
  21. package/tests/expected/comment/tea_python_tests/models.py +195 -0
  22. package/tests/expected/complex/tea_python_tests/__init__.py +1 -0
  23. package/tests/expected/complex/tea_python_tests/client.py +1168 -0
  24. package/tests/expected/complex/tea_python_tests/exceptions.py +39 -0
  25. package/tests/expected/complex/tea_python_tests/models.py +570 -0
  26. package/tests/expected/const/tea_python_tests/__init__.py +1 -0
  27. package/tests/expected/const/tea_python_tests/client.py +14 -0
  28. package/tests/expected/empty/setup.py +74 -0
  29. package/tests/expected/empty/tea_python_tests/__init__.py +1 -0
  30. package/tests/expected/empty/tea_python_tests/client.py +10 -0
  31. package/tests/expected/exec/tea_python_tests/__init__.py +1 -0
  32. package/tests/expected/exec/tea_python_tests/exec_client.py +21 -0
  33. package/tests/expected/function/tea_python_tests/__init__.py +1 -0
  34. package/tests/expected/function/tea_python_tests/client.py +64 -0
  35. package/tests/expected/import/setup.py +78 -0
  36. package/tests/expected/import/tea_python_tests/__init__.py +1 -0
  37. package/tests/expected/import/tea_python_tests/client.py +29 -0
  38. package/tests/expected/map/tea_python_tests/__init__.py +1 -0
  39. package/tests/expected/map/tea_python_tests/client.py +39 -0
  40. package/tests/expected/model/tea_python_tests/__init__.py +1 -0
  41. package/tests/expected/model/tea_python_tests/client.py +10 -0
  42. package/tests/expected/model/tea_python_tests/exceptions.py +28 -0
  43. package/tests/expected/model/tea_python_tests/models.py +780 -0
  44. package/tests/expected/multi/tea_python_tests/api.py +95 -0
  45. package/tests/expected/multi/tea_python_tests/client.py +40 -0
  46. package/tests/expected/multi/tea_python_tests/lib/util.py +19 -0
  47. package/tests/expected/multi/tea_python_tests/model/user.py +23 -0
  48. package/tests/expected/multi/tea_python_tests/model/user_exceptions.py +83 -0
  49. package/tests/expected/multi/tea_python_tests/model/user_models.py +145 -0
  50. package/tests/expected/python2/function/tea_python_tests/client.py +3 -1
  51. package/tests/expected/python2/model/tea_python_tests/models.py +57 -30
  52. package/tests/expected/python3/function/tea_python_tests/client.py +3 -1
  53. package/tests/expected/python3/model/tea_python_tests/models.py +57 -29
  54. package/tests/expected/statements/tea_python_tests/__init__.py +1 -0
  55. package/tests/expected/statements/tea_python_tests/client.py +86 -0
  56. package/tests/expected/super/tea_python_tests/__init__.py +1 -0
  57. package/tests/expected/super/tea_python_tests/client.py +16 -0
  58. package/tests/expected/typedef/setup.py +77 -0
  59. package/tests/expected/typedef/tea_python_tests/__init__.py +1 -0
  60. package/tests/expected/typedef/tea_python_tests/client.py +74 -0
  61. package/tests/expected/typedef/tea_python_tests/models.py +42 -0
  62. package/tests/fixtures/alias/Darafile +11 -0
  63. package/tests/fixtures/alias/libraries/Alias/Darafile +11 -0
  64. package/tests/fixtures/alias/libraries/Alias-Symbol/Darafile +11 -0
  65. package/tests/fixtures/builtin/Darafile +6 -0
  66. package/tests/fixtures/builtin/main.dara +333 -0
  67. package/tests/fixtures/complex/libraries/import.dara +18 -11
  68. package/tests/fixtures/complex/main.dara +451 -103
  69. package/tests/fixtures/function/main.dara +2 -0
  70. package/tests/fixtures/import/libraries/Darafile +1 -1
  71. package/tests/fixtures/import/pack/Darafile +3 -0
  72. package/tests/fixtures/map/libraries/Darafile +3 -0
  73. package/tests/fixtures/map/libraries/import.dara +4 -0
  74. package/tests/fixtures/map/main.dara +17 -2
  75. package/tests/fixtures/model/.libraries.json +3 -0
  76. package/tests/fixtures/model/Darafile +5 -2
  77. package/tests/fixtures/model/libraries/Darafile +20 -0
  78. package/tests/fixtures/model/libraries/import.dara +27 -0
  79. package/tests/fixtures/model/main.dara +57 -37
  80. package/tests/fixtures/multi/.libraries.json +3 -0
  81. package/tests/fixtures/multi/Darafile +12 -0
  82. package/tests/fixtures/multi/api.dara +20 -0
  83. package/tests/fixtures/multi/lib/util.dara +5 -0
  84. package/tests/fixtures/multi/libraries/darabonba_Util_0.2.11/Teafile +62 -0
  85. package/tests/fixtures/multi/libraries/darabonba_Util_0.2.11/main.tea +244 -0
  86. package/tests/fixtures/multi/main.dara +32 -0
  87. package/tests/fixtures/multi/model/user.dara +33 -0
  88. package/tests/{python3.tests.js → main.tests.js} +107 -65
  89. package/tests/output/alias/setup.py +79 -0
  90. package/tests/output/alias/tea_python_tests/client.py +35 -0
  91. package/tests/output/annotation/setup.py +77 -0
  92. package/tests/output/annotation/tea_python_tests/client.py +93 -0
  93. package/tests/output/annotation/tea_python_tests/models.py +37 -0
  94. package/tests/output/api/setup.py +77 -0
  95. package/tests/output/api/tea_python_tests/client.py +106 -0
  96. package/tests/output/builtin/setup.py +77 -0
  97. package/tests/output/builtin/tea_python_tests/client.py +685 -0
  98. package/tests/output/comment/setup.py +77 -0
  99. package/tests/output/comment/tea_python_tests/client.py +288 -0
  100. package/tests/output/comment/tea_python_tests/models.py +195 -0
  101. package/tests/output/complex/setup.py +77 -0
  102. package/tests/output/complex/tea_python_tests/client.py +1168 -0
  103. package/tests/output/complex/tea_python_tests/exceptions.py +39 -0
  104. package/tests/output/complex/tea_python_tests/models.py +570 -0
  105. package/tests/output/const/setup.py +77 -0
  106. package/tests/output/const/tea_python_tests/client.py +14 -0
  107. package/tests/output/empty/setup.py +77 -0
  108. package/tests/output/empty/tea_python_tests/client.py +10 -0
  109. package/tests/output/exec/setup.py +77 -0
  110. package/tests/output/exec/tea_python_tests/exec_client.py +21 -0
  111. package/tests/output/function/setup.py +77 -0
  112. package/tests/output/function/tea_python_tests/client.py +64 -0
  113. package/tests/output/import/setup.py +78 -0
  114. package/tests/output/import/tea_python_tests/client.py +29 -0
  115. package/tests/output/map/setup.py +77 -0
  116. package/tests/output/map/tea_python_tests/client.py +39 -0
  117. package/tests/output/model/setup.py +77 -0
  118. package/tests/output/model/tea_python_tests/client.py +10 -0
  119. package/tests/output/model/tea_python_tests/exceptions.py +28 -0
  120. package/tests/output/model/tea_python_tests/models.py +780 -0
  121. package/tests/output/multi/setup.py +77 -0
  122. package/tests/output/multi/tea_python_tests/api.py +95 -0
  123. package/tests/output/multi/tea_python_tests/client.py +40 -0
  124. package/tests/output/multi/tea_python_tests/lib/util.py +19 -0
  125. package/tests/output/multi/tea_python_tests/model/user.py +23 -0
  126. package/tests/output/multi/tea_python_tests/model/user_exceptions.py +83 -0
  127. package/tests/output/multi/tea_python_tests/model/user_models.py +145 -0
  128. package/tests/output/statements/setup.py +77 -0
  129. package/tests/output/statements/tea_python_tests/client.py +86 -0
  130. package/tests/output/super/setup.py +77 -0
  131. package/tests/output/super/tea_python_tests/client.py +16 -0
  132. package/tests/output/typedef/setup.py +78 -0
  133. package/tests/output/typedef/tea_python_tests/client.py +74 -0
  134. package/tests/output/typedef/tea_python_tests/models.py +42 -0
  135. package/tests/common.tests.js +0 -244
  136. package/tests/lib.tests.js +0 -269
  137. package/tests/python2.tests.js +0 -283
  138. package/tests/resolver.tests.js +0 -434
@@ -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
+ "alibabacloud_tea_util>=0.3.11, <1.0.0"
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,95 @@
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
+ from tea_python_tests.lib.util import Util
9
+
10
+
11
+
12
+
13
+ class Client:
14
+ def __init__(self):
15
+ pass
16
+
17
+ def test_3(self) -> int:
18
+ _runtime = {
19
+ 'timeouted': 'retry',
20
+ }
21
+ _last_request = None
22
+ _last_response = None
23
+ _retries_attempted = 0
24
+ _context = RetryPolicyContext(
25
+ retries_attempted= _retries_attempted
26
+ )
27
+ while DaraCore.should_retry(_runtime.get('retryOptions'), _context):
28
+ if _retries_attempted > 0:
29
+ _backoff_time = DaraCore.get_backoff_time(_runtime.get('retryOptions'), _context)
30
+ if _backoff_time > 0:
31
+ DaraCore.sleep(_backoff_time)
32
+ _retries_attempted = _retries_attempted + 1
33
+ try:
34
+ _request = DaraRequest()
35
+ _request.protocol = 'https'
36
+ _request.method = 'DELETE'
37
+ _request.pathname = '/'
38
+ _request.headers = {
39
+ 'host': 'test.aliyun.com',
40
+ 'accept': 'application/json'
41
+ }
42
+ _request.query = Util.get_query()
43
+ _last_request = _request
44
+ _response = DaraCore.do_action(_request, _runtime)
45
+ _last_response = _response
46
+ return _response.status_code
47
+ except Exception as e:
48
+ _context = RetryPolicyContext(
49
+ retries_attempted= _retries_attempted,
50
+ http_request = _last_request,
51
+ http_response = _last_response,
52
+ exception = e
53
+ )
54
+ continue
55
+ raise UnretryableException(_context)
56
+
57
+ async def test_3_async(self) -> int:
58
+ _runtime = {
59
+ 'timeouted': 'retry',
60
+ }
61
+ _last_request = None
62
+ _last_response = None
63
+ _retries_attempted = 0
64
+ _context = RetryPolicyContext(
65
+ retries_attempted= _retries_attempted
66
+ )
67
+ while DaraCore.should_retry(_runtime.get('retryOptions'), _context):
68
+ if _retries_attempted > 0:
69
+ _backoff_time = DaraCore.get_backoff_time(_runtime.get('retryOptions'), _context)
70
+ if _backoff_time > 0:
71
+ DaraCore.sleep(_backoff_time)
72
+ _retries_attempted = _retries_attempted + 1
73
+ try:
74
+ _request = DaraRequest()
75
+ _request.protocol = 'https'
76
+ _request.method = 'DELETE'
77
+ _request.pathname = '/'
78
+ _request.headers = {
79
+ 'host': 'test.aliyun.com',
80
+ 'accept': 'application/json'
81
+ }
82
+ _request.query = Util.get_query()
83
+ _last_request = _request
84
+ _response = await DaraCore.async_do_action(_request, _runtime)
85
+ _last_response = _response
86
+ return _response.status_code
87
+ except Exception as e:
88
+ _context = RetryPolicyContext(
89
+ retries_attempted= _retries_attempted,
90
+ http_request = _last_request,
91
+ http_response = _last_response,
92
+ exception = e
93
+ )
94
+ continue
95
+ raise UnretryableException(_context)
@@ -0,0 +1,40 @@
1
+ # -*- coding: utf-8 -*-
2
+ # This file is auto-generated, don't edit it. Thanks.
3
+ from __future__ import annotations
4
+ from tea_python_tests.model import user_models as user_models
5
+ from tea_python_tests.lib.util import Util
6
+ from tea_python_tests.api import Client as APIClient
7
+ from typing import Generator, AsyncGenerator
8
+
9
+
10
+
11
+
12
+ class Client:
13
+ _user: user_models.Info = None
14
+ def __init__(self):
15
+ self._user = user_models.Info(
16
+ name = 'test',
17
+ age = 124,
18
+ max_attemp = 3,
19
+ autoretry = True
20
+ )
21
+
22
+ def test_3(self) -> Generator[str, None, None]:
23
+ it = Util.test_1()
24
+ for test in it:
25
+ yield test
26
+
27
+ async def test_3_async(self) -> AsyncGenerator[str, None, None]:
28
+ it = Util.test_1()
29
+ for test in it:
30
+ yield test
31
+
32
+ def test_4(self) -> int:
33
+ api = APIClient()
34
+ status = api.test_3()
35
+ return status
36
+
37
+ async def test_4_async(self) -> int:
38
+ api = APIClient()
39
+ status = await api.test_3_async()
40
+ return status
@@ -0,0 +1,19 @@
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 Generator, Dict
6
+
7
+
8
+ class Util:
9
+
10
+ def __init__(self):
11
+ pass
12
+
13
+ @staticmethod
14
+ def test_1() -> Generator[str, None, None]:
15
+ raise Exception('Un-implemented')
16
+
17
+ @staticmethod
18
+ def get_query() -> Dict[str, str]:
19
+ raise Exception('Un-implemented')
@@ -0,0 +1,23 @@
1
+ # -*- coding: utf-8 -*-
2
+ # This file is auto-generated, don't edit it. Thanks.
3
+ from __future__ import annotations
4
+ from tea_python_tests.lib.util import Util
5
+ from typing import Generator, AsyncGenerator
6
+
7
+
8
+ class Client:
9
+
10
+ def __init__(self):
11
+ pass
12
+
13
+ @staticmethod
14
+ def test() -> Generator[str, None, None]:
15
+ it = Util.test_1()
16
+ for test in it:
17
+ yield test
18
+
19
+ @staticmethod
20
+ async def test_async() -> AsyncGenerator[str, None, None]:
21
+ it = Util.test_1()
22
+ for test in it:
23
+ yield test
@@ -0,0 +1,83 @@
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
+ import user_models
6
+
7
+
8
+ class ErrException(DaraException):
9
+ def __init__(
10
+ self,
11
+ message: str = None,
12
+ code: str = None,
13
+ stack: str = None,
14
+ msg: str = None,
15
+ ):
16
+ super().__init__({
17
+ 'message': message,
18
+ 'code': code,
19
+ 'stack': stack,
20
+ })
21
+ self.name = 'ErrException'
22
+ self.msg = msg
23
+
24
+ class Err1Exception(user_models.BaseInfo, DaraException):
25
+ def __init__(
26
+ self,
27
+ max_attemp: int = None,
28
+ autoretry: bool = None,
29
+ ignore_ssl: bool = None,
30
+ key: str = None,
31
+ cert: str = None,
32
+ ca: str = None,
33
+ max_attempts: int = None,
34
+ backoff_policy: str = None,
35
+ backoff_period: int = None,
36
+ read_timeout: int = None,
37
+ connect_timeout: int = None,
38
+ http_proxy: str = None,
39
+ https_proxy: str = None,
40
+ no_proxy: str = None,
41
+ max_idle_conns: int = None,
42
+ local_addr: str = None,
43
+ socks_5proxy: str = None,
44
+ socks_5net_work: str = None,
45
+ keep_alive: bool = None,
46
+ msg: str = None,
47
+ ):
48
+ super().__init__(
49
+ max_attemp = max_attemp,
50
+ autoretry = autoretry,
51
+ ignore_ssl = ignore_ssl,
52
+ key = key,
53
+ cert = cert,
54
+ ca = ca,
55
+ max_attempts = max_attempts,
56
+ backoff_policy = backoff_policy,
57
+ backoff_period = backoff_period,
58
+ read_timeout = read_timeout,
59
+ connect_timeout = connect_timeout,
60
+ http_proxy = http_proxy,
61
+ https_proxy = https_proxy,
62
+ no_proxy = no_proxy,
63
+ max_idle_conns = max_idle_conns,
64
+ local_addr = local_addr,
65
+ socks_5proxy = socks_5proxy,
66
+ socks_5net_work = socks_5net_work,
67
+ keep_alive = keep_alive,
68
+ )
69
+ self.name = 'Err1Exception'
70
+ self.msg = msg
71
+
72
+ class Err2Exception(ErrException):
73
+ def __init__(
74
+ self,
75
+ msg: str = None,
76
+ msg_2: str = None,
77
+ ):
78
+ super().__init__(
79
+ msg = msg,
80
+ )
81
+ self.name = 'Err2Exception'
82
+ self.msg_2 = msg_2
83
+
@@ -0,0 +1,145 @@
1
+ # -*- coding: utf-8 -*-
2
+ # This file is auto-generated, don't edit it. Thanks.
3
+ from __future__ import annotations
4
+ from alibabacloud_tea_util import models as darautil_models
5
+
6
+
7
+
8
+
9
+ class BaseInfo(darautil_models.RuntimeOptions):
10
+ def __init__(
11
+ self,
12
+ autoretry: bool = None,
13
+ ignore_ssl: bool = None,
14
+ key: str = None,
15
+ cert: str = None,
16
+ ca: str = None,
17
+ max_attempts: int = None,
18
+ backoff_policy: str = None,
19
+ backoff_period: int = None,
20
+ read_timeout: int = None,
21
+ connect_timeout: int = None,
22
+ http_proxy: str = None,
23
+ https_proxy: str = None,
24
+ no_proxy: str = None,
25
+ max_idle_conns: int = None,
26
+ local_addr: str = None,
27
+ socks_5proxy: str = None,
28
+ socks_5net_work: str = None,
29
+ keep_alive: bool = None,
30
+ max_attemp: int = None,
31
+ ):
32
+ super().__init__(
33
+ autoretry = autoretry,
34
+ ignore_ssl = ignore_ssl,
35
+ key = key,
36
+ cert = cert,
37
+ ca = ca,
38
+ max_attempts = max_attempts,
39
+ backoff_policy = backoff_policy,
40
+ backoff_period = backoff_period,
41
+ read_timeout = read_timeout,
42
+ connect_timeout = connect_timeout,
43
+ http_proxy = http_proxy,
44
+ https_proxy = https_proxy,
45
+ no_proxy = no_proxy,
46
+ max_idle_conns = max_idle_conns,
47
+ local_addr = local_addr,
48
+ socks_5proxy = socks_5proxy,
49
+ socks_5net_work = socks_5net_work,
50
+ keep_alive = keep_alive,
51
+ )
52
+ self.max_attemp = max_attemp
53
+
54
+ def validate(self):
55
+ self.validate_required(self.max_attemp, 'max_attemp')
56
+
57
+ def to_map(self):
58
+ _map = super().to_map()
59
+ if _map is not None:
60
+ return _map
61
+
62
+ result = dict()
63
+ if self.max_attemp is not None:
64
+ result['maxAttemp'] = self.max_attemp
65
+ return result
66
+
67
+ def from_map(self, m: dict = None):
68
+ m = m or dict()
69
+ if m.get('maxAttemp') is not None:
70
+ self.max_attemp = m.get('maxAttemp')
71
+ return self
72
+
73
+ class Info(BaseInfo):
74
+ def __init__(
75
+ self,
76
+ max_attemp: int = None,
77
+ autoretry: bool = None,
78
+ ignore_ssl: bool = None,
79
+ key: str = None,
80
+ cert: str = None,
81
+ ca: str = None,
82
+ max_attempts: int = None,
83
+ backoff_policy: str = None,
84
+ backoff_period: int = None,
85
+ read_timeout: int = None,
86
+ connect_timeout: int = None,
87
+ http_proxy: str = None,
88
+ https_proxy: str = None,
89
+ no_proxy: str = None,
90
+ max_idle_conns: int = None,
91
+ local_addr: str = None,
92
+ socks_5proxy: str = None,
93
+ socks_5net_work: str = None,
94
+ keep_alive: bool = None,
95
+ name: str = None,
96
+ age: int = None,
97
+ ):
98
+ super().__init__(
99
+ max_attemp = max_attemp,
100
+ autoretry = autoretry,
101
+ ignore_ssl = ignore_ssl,
102
+ key = key,
103
+ cert = cert,
104
+ ca = ca,
105
+ max_attempts = max_attempts,
106
+ backoff_policy = backoff_policy,
107
+ backoff_period = backoff_period,
108
+ read_timeout = read_timeout,
109
+ connect_timeout = connect_timeout,
110
+ http_proxy = http_proxy,
111
+ https_proxy = https_proxy,
112
+ no_proxy = no_proxy,
113
+ max_idle_conns = max_idle_conns,
114
+ local_addr = local_addr,
115
+ socks_5proxy = socks_5proxy,
116
+ socks_5net_work = socks_5net_work,
117
+ keep_alive = keep_alive,
118
+ )
119
+ self.name = name
120
+ self.age = age
121
+
122
+ def validate(self):
123
+ self.validate_required(self.name, 'name')
124
+ self.validate_required(self.age, 'age')
125
+
126
+ def to_map(self):
127
+ _map = super().to_map()
128
+ if _map is not None:
129
+ return _map
130
+
131
+ result = dict()
132
+ if self.name is not None:
133
+ result['name'] = self.name
134
+ if self.age is not None:
135
+ result['age'] = self.age
136
+ return result
137
+
138
+ def from_map(self, m: dict = None):
139
+ m = m or dict()
140
+ if m.get('name') is not None:
141
+ self.name = m.get('name')
142
+ if m.get('age') is not None:
143
+ self.age = m.get('age')
144
+ return self
145
+
@@ -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,86 @@
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 DaraException
7
+
8
+
9
+ class Client:
10
+ def __init__(self):
11
+ pass
12
+
13
+ def hello(self) -> None:
14
+ _request = DaraRequest()
15
+ _request.method = 'GET'
16
+ _request.pathname = '/'
17
+ _request.headers = {
18
+ 'host': 'www.test.com'
19
+ }
20
+ if True:
21
+ _request.headers["host"] = 'www.test2.com'
22
+ _last_request = _request
23
+ _response = DaraCore.do_action(_request)
24
+ if True:
25
+ raise DaraException(_request, _response)
26
+ else:
27
+ True
28
+
29
+ self.hello_if()
30
+ not False
31
+ a = None
32
+ a = 'string'
33
+ return
34
+
35
+ async def hello_async(self) -> None:
36
+ _request = DaraRequest()
37
+ _request.method = 'GET'
38
+ _request.pathname = '/'
39
+ _request.headers = {
40
+ 'host': 'www.test.com'
41
+ }
42
+ if True:
43
+ _request.headers["host"] = 'www.test2.com'
44
+ _last_request = _request
45
+ _response = await DaraCore.async_do_action(_request)
46
+ if True:
47
+ raise DaraException(_request, _response)
48
+ else:
49
+ True
50
+
51
+ self.hello_if()
52
+ not False
53
+ a = None
54
+ a = 'string'
55
+ return
56
+
57
+ @staticmethod
58
+ def hello_if() -> None:
59
+ if True:
60
+ pass
61
+ if True:
62
+ pass
63
+ elif True:
64
+ pass
65
+ else:
66
+ pass
67
+
68
+ @staticmethod
69
+ def hello_throw() -> None:
70
+ raise DaraException({})
71
+
72
+ @staticmethod
73
+ def hello_for_break() -> None:
74
+ for item in [ ]:
75
+ break
76
+
77
+ @staticmethod
78
+ def hello_while() -> None:
79
+ while True:
80
+ break
81
+
82
+ @staticmethod
83
+ def hello_declare() -> None:
84
+ hello = 'world'
85
+ hello_null = None
86
+ hello = 'hehe'