@darabonba/python-generator 1.2.19 → 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 (129) hide show
  1. package/ChangeLog.md +0 -158
  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/tests/expected/alias/setup.py +79 -0
  7. package/tests/expected/alias/tea_python_tests/__init__.py +1 -0
  8. package/tests/expected/alias/tea_python_tests/client.py +35 -0
  9. package/tests/expected/annotation/tea_python_tests/__init__.py +1 -0
  10. package/tests/expected/annotation/tea_python_tests/client.py +93 -0
  11. package/tests/expected/annotation/tea_python_tests/models.py +37 -0
  12. package/tests/expected/api/tea_python_tests/__init__.py +1 -0
  13. package/tests/expected/api/tea_python_tests/client.py +106 -0
  14. package/tests/expected/builtin/tea_python_tests/client.py +685 -0
  15. package/tests/expected/comment/tea_python_tests/__init__.py +1 -0
  16. package/tests/expected/comment/tea_python_tests/client.py +288 -0
  17. package/tests/expected/comment/tea_python_tests/models.py +195 -0
  18. package/tests/expected/complex/tea_python_tests/__init__.py +1 -0
  19. package/tests/expected/complex/tea_python_tests/client.py +1168 -0
  20. package/tests/expected/complex/tea_python_tests/exceptions.py +39 -0
  21. package/tests/expected/complex/tea_python_tests/models.py +570 -0
  22. package/tests/expected/const/tea_python_tests/__init__.py +1 -0
  23. package/tests/expected/const/tea_python_tests/client.py +14 -0
  24. package/tests/expected/empty/setup.py +74 -0
  25. package/tests/expected/empty/tea_python_tests/__init__.py +1 -0
  26. package/tests/expected/empty/tea_python_tests/client.py +10 -0
  27. package/tests/expected/exec/tea_python_tests/__init__.py +1 -0
  28. package/tests/expected/exec/tea_python_tests/exec_client.py +21 -0
  29. package/tests/expected/function/tea_python_tests/__init__.py +1 -0
  30. package/tests/expected/function/tea_python_tests/client.py +64 -0
  31. package/tests/expected/import/setup.py +78 -0
  32. package/tests/expected/import/tea_python_tests/__init__.py +1 -0
  33. package/tests/expected/import/tea_python_tests/client.py +29 -0
  34. package/tests/expected/map/tea_python_tests/__init__.py +1 -0
  35. package/tests/expected/map/tea_python_tests/client.py +39 -0
  36. package/tests/expected/model/tea_python_tests/__init__.py +1 -0
  37. package/tests/expected/model/tea_python_tests/client.py +10 -0
  38. package/tests/expected/model/tea_python_tests/exceptions.py +28 -0
  39. package/tests/expected/model/tea_python_tests/models.py +780 -0
  40. package/tests/expected/multi/tea_python_tests/api.py +95 -0
  41. package/tests/expected/multi/tea_python_tests/client.py +40 -0
  42. package/tests/expected/multi/tea_python_tests/lib/util.py +19 -0
  43. package/tests/expected/multi/tea_python_tests/model/user.py +23 -0
  44. package/tests/expected/multi/tea_python_tests/model/user_exceptions.py +83 -0
  45. package/tests/expected/multi/tea_python_tests/model/user_models.py +145 -0
  46. package/tests/expected/statements/tea_python_tests/__init__.py +1 -0
  47. package/tests/expected/statements/tea_python_tests/client.py +86 -0
  48. package/tests/expected/super/tea_python_tests/__init__.py +1 -0
  49. package/tests/expected/super/tea_python_tests/client.py +16 -0
  50. package/tests/expected/typedef/setup.py +77 -0
  51. package/tests/expected/typedef/tea_python_tests/__init__.py +1 -0
  52. package/tests/expected/typedef/tea_python_tests/client.py +74 -0
  53. package/tests/expected/typedef/tea_python_tests/models.py +42 -0
  54. package/tests/fixtures/alias/Darafile +11 -0
  55. package/tests/fixtures/alias/libraries/Alias/Darafile +11 -0
  56. package/tests/fixtures/alias/libraries/Alias-Symbol/Darafile +11 -0
  57. package/tests/fixtures/builtin/Darafile +6 -0
  58. package/tests/fixtures/builtin/main.dara +333 -0
  59. package/tests/fixtures/complex/libraries/import.dara +18 -11
  60. package/tests/fixtures/complex/main.dara +451 -103
  61. package/tests/fixtures/import/libraries/Darafile +1 -1
  62. package/tests/fixtures/import/pack/Darafile +3 -0
  63. package/tests/fixtures/map/libraries/Darafile +3 -0
  64. package/tests/fixtures/map/libraries/import.dara +4 -0
  65. package/tests/fixtures/map/main.dara +17 -2
  66. package/tests/fixtures/model/.libraries.json +3 -0
  67. package/tests/fixtures/model/Darafile +5 -2
  68. package/tests/fixtures/model/libraries/Darafile +20 -0
  69. package/tests/fixtures/model/libraries/import.dara +27 -0
  70. package/tests/fixtures/model/main.dara +60 -42
  71. package/tests/fixtures/multi/.libraries.json +3 -0
  72. package/tests/fixtures/multi/Darafile +12 -0
  73. package/tests/fixtures/multi/api.dara +20 -0
  74. package/tests/fixtures/multi/lib/util.dara +5 -0
  75. package/tests/fixtures/multi/libraries/darabonba_Util_0.2.11/Teafile +62 -0
  76. package/tests/fixtures/multi/libraries/darabonba_Util_0.2.11/main.tea +244 -0
  77. package/tests/fixtures/multi/main.dara +32 -0
  78. package/tests/fixtures/multi/model/user.dara +33 -0
  79. package/tests/{python3.tests.js → main.tests.js} +107 -65
  80. package/tests/output/alias/setup.py +79 -0
  81. package/tests/output/alias/tea_python_tests/client.py +35 -0
  82. package/tests/output/annotation/setup.py +77 -0
  83. package/tests/output/annotation/tea_python_tests/client.py +93 -0
  84. package/tests/output/annotation/tea_python_tests/models.py +37 -0
  85. package/tests/output/api/setup.py +77 -0
  86. package/tests/output/api/tea_python_tests/client.py +106 -0
  87. package/tests/output/builtin/setup.py +77 -0
  88. package/tests/output/builtin/tea_python_tests/client.py +685 -0
  89. package/tests/output/comment/setup.py +77 -0
  90. package/tests/output/comment/tea_python_tests/client.py +288 -0
  91. package/tests/output/comment/tea_python_tests/models.py +195 -0
  92. package/tests/output/complex/setup.py +77 -0
  93. package/tests/output/complex/tea_python_tests/client.py +1168 -0
  94. package/tests/output/complex/tea_python_tests/exceptions.py +39 -0
  95. package/tests/output/complex/tea_python_tests/models.py +570 -0
  96. package/tests/output/const/setup.py +77 -0
  97. package/tests/output/const/tea_python_tests/client.py +14 -0
  98. package/tests/output/empty/setup.py +77 -0
  99. package/tests/output/empty/tea_python_tests/client.py +10 -0
  100. package/tests/output/exec/setup.py +77 -0
  101. package/tests/output/exec/tea_python_tests/exec_client.py +21 -0
  102. package/tests/output/function/setup.py +77 -0
  103. package/tests/output/function/tea_python_tests/client.py +64 -0
  104. package/tests/output/import/setup.py +78 -0
  105. package/tests/output/import/tea_python_tests/client.py +29 -0
  106. package/tests/output/map/setup.py +77 -0
  107. package/tests/output/map/tea_python_tests/client.py +39 -0
  108. package/tests/output/model/setup.py +77 -0
  109. package/tests/output/model/tea_python_tests/client.py +10 -0
  110. package/tests/output/model/tea_python_tests/exceptions.py +28 -0
  111. package/tests/output/model/tea_python_tests/models.py +780 -0
  112. package/tests/output/multi/setup.py +77 -0
  113. package/tests/output/multi/tea_python_tests/api.py +95 -0
  114. package/tests/output/multi/tea_python_tests/client.py +40 -0
  115. package/tests/output/multi/tea_python_tests/lib/util.py +19 -0
  116. package/tests/output/multi/tea_python_tests/model/user.py +23 -0
  117. package/tests/output/multi/tea_python_tests/model/user_exceptions.py +83 -0
  118. package/tests/output/multi/tea_python_tests/model/user_models.py +145 -0
  119. package/tests/output/statements/setup.py +77 -0
  120. package/tests/output/statements/tea_python_tests/client.py +86 -0
  121. package/tests/output/super/setup.py +77 -0
  122. package/tests/output/super/tea_python_tests/client.py +16 -0
  123. package/tests/output/typedef/setup.py +78 -0
  124. package/tests/output/typedef/tea_python_tests/client.py +74 -0
  125. package/tests/output/typedef/tea_python_tests/models.py +42 -0
  126. package/tests/common.tests.js +0 -244
  127. package/tests/lib.tests.js +0 -269
  128. package/tests/python2.tests.js +0 -283
  129. package/tests/resolver.tests.js +0 -434
@@ -0,0 +1,685 @@
1
+ # -*- coding: utf-8 -*-
2
+ # This file is auto-generated, don't edit it. Thanks.
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
19
+ from typing import List, Any, BytesIO, StringIO
20
+
21
+
22
+ class Client:
23
+
24
+ def __init__(self):
25
+ pass
26
+
27
+ @staticmethod
28
+ def array_test(
29
+ args: List[str],
30
+ ) -> None:
31
+ if (len(args) > 0) and 'cn-hanghzou' in args:
32
+ index = args.index('cn-hanghzou')
33
+ region_id = args[index]
34
+ all = ','.join(args)
35
+ first = args.pop(0)
36
+ last = args.pop()
37
+ length_1 = args.insert(0, first)
38
+ length_2 = args.insert(last)
39
+ length_3 = length_1 + length_2
40
+ long_str = 'long' + first + last
41
+ full_str = ','.join(args)
42
+ new_arr = [
43
+ 'test'
44
+ ]
45
+ c_arr = new_arr + args
46
+ acs_arr = sorted(new_arr)
47
+ desc_arr = sorted(new_arr, reverse=True)
48
+ ll_arr = acs_arr + desc_arr
49
+ ll_arr.insert(10, 'test')
50
+ ll_arr.remove('test')
51
+
52
+ @staticmethod
53
+ async def array_test_async(
54
+ args: List[str],
55
+ ) -> None:
56
+ if (len(args) > 0) and 'cn-hanghzou' in args:
57
+ index = args.index('cn-hanghzou')
58
+ region_id = args[index]
59
+ all = ','.join(args)
60
+ first = args.pop(0)
61
+ last = args.pop()
62
+ length_1 = args.insert(0, first)
63
+ length_2 = args.insert(last)
64
+ length_3 = length_1 + length_2
65
+ long_str = 'long' + first + last
66
+ full_str = ','.join(args)
67
+ new_arr = [
68
+ 'test'
69
+ ]
70
+ c_arr = new_arr + args
71
+ acs_arr = sorted(new_arr)
72
+ desc_arr = sorted(new_arr, reverse=True)
73
+ ll_arr = acs_arr + desc_arr
74
+ ll_arr.insert(10, 'test')
75
+ ll_arr.remove('test')
76
+
77
+ @staticmethod
78
+ def bytes_test(
79
+ args: List[str],
80
+ ) -> None:
81
+ full_str = ','.join(args)
82
+ data = full_str.encode('utf-8')
83
+ new_full_str = data.decode('utf-8')
84
+ if full_str != new_full_str:
85
+ return
86
+ hex_str = data.hex()
87
+ base_64str = base64.b64encode(data).decode('utf-8')
88
+ length = len(data)
89
+ obj = data.decode('utf-8')
90
+ data_2 = DaraBytes.from_(full_str, 'base64')
91
+
92
+ @staticmethod
93
+ async def bytes_test_async(
94
+ args: List[str],
95
+ ) -> None:
96
+ full_str = ','.join(args)
97
+ data = full_str.encode('utf-8')
98
+ new_full_str = data.decode('utf-8')
99
+ if full_str != new_full_str:
100
+ return
101
+ hex_str = data.hex()
102
+ base_64str = base64.b64encode(data).decode('utf-8')
103
+ length = len(data)
104
+ obj = data.decode('utf-8')
105
+ data_2 = DaraBytes.from_(full_str, 'base64')
106
+
107
+ @staticmethod
108
+ def date_test(
109
+ args: List[str],
110
+ ) -> None:
111
+ date = DaraDate('2023-09-12 17:47:31.916000 +0800 UTC')
112
+ date_str = date.strftime('%Y-%m-%d %H:%M:%S')
113
+ timestamp = date.timestamp()
114
+ yesterday = date.sub('day', 1)
115
+ one_day = date.diff('day', yesterday)
116
+ tomorrow = date.add('day', 1)
117
+ two_day = tomorrow.diff('day', date) + one_day
118
+ hour = date.hour()
119
+ minute = date.minute()
120
+ second = date.second()
121
+ day_of_month = date.day_of_month()
122
+ day_of_week = date.weekday()
123
+ week_of_year = date.week_of_year()
124
+ month = date.month()
125
+ year = date.year()
126
+ utc_date = date.UTC()
127
+
128
+ @staticmethod
129
+ async def date_test_async(
130
+ args: List[str],
131
+ ) -> None:
132
+ date = DaraDate('2023-09-12 17:47:31.916000 +0800 UTC')
133
+ date_str = date.strftime('%Y-%m-%d %H:%M:%S')
134
+ timestamp = date.timestamp()
135
+ yesterday = date.sub('day', 1)
136
+ one_day = date.diff('day', yesterday)
137
+ tomorrow = date.add('day', 1)
138
+ two_day = tomorrow.diff('day', date) + one_day
139
+ hour = date.hour()
140
+ minute = date.minute()
141
+ second = date.second()
142
+ day_of_month = date.day_of_month()
143
+ day_of_week = date.weekday()
144
+ week_of_year = date.week_of_year()
145
+ month = date.month()
146
+ year = date.year()
147
+ utc_date = date.UTC()
148
+
149
+ @staticmethod
150
+ def env_test(
151
+ args: List[str],
152
+ ) -> None:
153
+ es = os.environ.get('TEST')
154
+ ma = os.environ['TEST'] = es + 'test'
155
+
156
+ @staticmethod
157
+ async def env_test_async(
158
+ args: List[str],
159
+ ) -> None:
160
+ es = os.environ.get('TEST')
161
+ ma = os.environ['TEST'] = es + 'test'
162
+
163
+ @staticmethod
164
+ def file_test(
165
+ args: List[str],
166
+ ) -> None:
167
+ if DaraFile.exists('/tmp/test'):
168
+ file = DaraFile('/tmp/test')
169
+ path = file.path()
170
+ length = file.length() + 10
171
+ create_time = file.create_time()
172
+ modify_time = file.modify_time()
173
+ time_long = modify_time.diff('minute', create_time)
174
+ data = file.read(300)
175
+ file.write(DaraBytes.from_('test', 'utf8'))
176
+ rs = DaraFile.create_read_stream('/tmp/test')
177
+ ws = DaraFile.create_write_stream('/tmp/test')
178
+
179
+ @staticmethod
180
+ async def file_test_async(
181
+ args: List[str],
182
+ ) -> None:
183
+ if await DaraFile.exists_async('/tmp/test'):
184
+ file = DaraFile('/tmp/test')
185
+ path = file.path()
186
+ length = await file.length_async() + 10
187
+ create_time = await file.create_time_async()
188
+ modify_time = await file.modify_time_async()
189
+ time_long = modify_time.diff('minute', create_time)
190
+ data = await file.read_async(300)
191
+ await file.write_async(DaraBytes.from_('test', 'utf8'))
192
+ rs = DaraFile.create_read_stream('/tmp/test')
193
+ ws = DaraFile.create_write_stream('/tmp/test')
194
+
195
+ @staticmethod
196
+ def form_test(
197
+ args: List[str],
198
+ ) -> None:
199
+ m = {
200
+ 'key1': 'test1',
201
+ 'key2': 'test2',
202
+ 'key3': 3,
203
+ 'key4': {
204
+ 'key5': 123,
205
+ 'key6': '321'
206
+ }
207
+ }
208
+ form = DaraForm.to_form_string(m)
209
+ form = form + '&key7=23233&key8=' + DaraForm.get_boundary()
210
+ r = DaraForm.to_file_form(m, DaraForm.get_boundary())
211
+
212
+ @staticmethod
213
+ async def form_test_async(
214
+ args: List[str],
215
+ ) -> None:
216
+ m = {
217
+ 'key1': 'test1',
218
+ 'key2': 'test2',
219
+ 'key3': 3,
220
+ 'key4': {
221
+ 'key5': 123,
222
+ 'key6': '321'
223
+ }
224
+ }
225
+ form = DaraForm.to_form_string(m)
226
+ form = form + '&key7=23233&key8=' + DaraForm.get_boundary()
227
+ r = DaraForm.to_file_form(m, DaraForm.get_boundary())
228
+
229
+ @staticmethod
230
+ def json_test(
231
+ args: List[str],
232
+ ) -> None:
233
+ m = {
234
+ 'key1': 'test1',
235
+ 'key2': 'test2',
236
+ 'key3': 3,
237
+ 'key4': {
238
+ 'key5': 123,
239
+ 'key6': '321'
240
+ }
241
+ }
242
+ ms = DaraCore.to_json_string(m)
243
+ ma = json.loads(ms)
244
+ arr_str = '[1,2,3,4]'
245
+ arr = json.loads(arr_str)
246
+
247
+ @staticmethod
248
+ async def json_test_async(
249
+ args: List[str],
250
+ ) -> None:
251
+ m = {
252
+ 'key1': 'test1',
253
+ 'key2': 'test2',
254
+ 'key3': 3,
255
+ 'key4': {
256
+ 'key5': 123,
257
+ 'key6': '321'
258
+ }
259
+ }
260
+ ms = DaraCore.to_json_string(m)
261
+ ma = json.loads(ms)
262
+ arr_str = '[1,2,3,4]'
263
+ arr = json.loads(arr_str)
264
+
265
+ @staticmethod
266
+ def loger_test(
267
+ args: List[str],
268
+ ) -> None:
269
+ logging.log(logging.NOTSET, 'test')
270
+ logging.log(logging.INFO, 'test')
271
+ logging.log(logging.WARNING, 'test')
272
+ logging.log(logging.DEBUG, 'test')
273
+ logging.log(logging.ERROR, 'test')
274
+
275
+ @staticmethod
276
+ async def loger_test_async(
277
+ args: List[str],
278
+ ) -> None:
279
+ logging.log(logging.NOTSET, 'test')
280
+ logging.log(logging.INFO, 'test')
281
+ logging.log(logging.WARNING, 'test')
282
+ logging.log(logging.DEBUG, 'test')
283
+ logging.log(logging.ERROR, 'test')
284
+
285
+ @staticmethod
286
+ def map_test_case(
287
+ args: List[str],
288
+ ) -> None:
289
+ map_test = {
290
+ 'key1': 'value1',
291
+ 'key2': 'value2',
292
+ 'key3': 'value3'
293
+ }
294
+ length = len(map_test)
295
+ num = length + 3
296
+ keys = map_test.keys()
297
+ all_key = ''
298
+ for key in keys:
299
+ all_key = all_key + key
300
+ entries = map_test.items()
301
+ new_key = ''
302
+ new_value = ''
303
+ for k, v in entries:
304
+ new_key = new_key + k
305
+ new_value = new_value + v
306
+ json = json.dumps(map_test)
307
+ map_test_2 = {
308
+ 'key1': 'value4',
309
+ 'key4': 'value5'
310
+ }
311
+ map_test_3 = map_test.update(map_test_2)
312
+ if map_test_3.get('key1') == 'value4':
313
+ return
314
+
315
+ @staticmethod
316
+ async def map_test_case_async(
317
+ args: List[str],
318
+ ) -> None:
319
+ map_test = {
320
+ 'key1': 'value1',
321
+ 'key2': 'value2',
322
+ 'key3': 'value3'
323
+ }
324
+ length = len(map_test)
325
+ num = length + 3
326
+ keys = map_test.keys()
327
+ all_key = ''
328
+ for key in keys:
329
+ all_key = all_key + key
330
+ entries = map_test.items()
331
+ new_key = ''
332
+ new_value = ''
333
+ for k, v in entries:
334
+ new_key = new_key + k
335
+ new_value = new_value + v
336
+ json = json.dumps(map_test)
337
+ map_test_2 = {
338
+ 'key1': 'value4',
339
+ 'key4': 'value5'
340
+ }
341
+ map_test_3 = map_test.update(map_test_2)
342
+ if map_test_3.get('key1') == 'value4':
343
+ return
344
+
345
+ @staticmethod
346
+ def number_test(
347
+ args: List[str],
348
+ ) -> None:
349
+ num = 3.2
350
+ inum = int(num)
351
+ lnum = int(num)
352
+ fnum = float(num)
353
+ dnum = float(num)
354
+ inum = int(inum)
355
+ lnum = int(inum)
356
+ fnum = float(inum)
357
+ dnum = float(inum)
358
+ inum = int(lnum)
359
+ lnum = int(lnum)
360
+ fnum = float(lnum)
361
+ dnum = float(lnum)
362
+ inum = int(fnum)
363
+ lnum = int(fnum)
364
+ fnum = float(fnum)
365
+ dnum = float(fnum)
366
+ inum = int(dnum)
367
+ lnum = int(dnum)
368
+ fnum = float(dnum)
369
+ dnum = float(dnum)
370
+ lnum = inum
371
+ inum = lnum
372
+ random_num = random.random()
373
+ inum = math.floor(inum)
374
+ inum = round(inum)
375
+
376
+ @staticmethod
377
+ async def number_test_async(
378
+ args: List[str],
379
+ ) -> None:
380
+ num = 3.2
381
+ inum = int(num)
382
+ lnum = int(num)
383
+ fnum = float(num)
384
+ dnum = float(num)
385
+ inum = int(inum)
386
+ lnum = int(inum)
387
+ fnum = float(inum)
388
+ dnum = float(inum)
389
+ inum = int(lnum)
390
+ lnum = int(lnum)
391
+ fnum = float(lnum)
392
+ dnum = float(lnum)
393
+ inum = int(fnum)
394
+ lnum = int(fnum)
395
+ fnum = float(fnum)
396
+ dnum = float(fnum)
397
+ inum = int(dnum)
398
+ lnum = int(dnum)
399
+ fnum = float(dnum)
400
+ dnum = float(dnum)
401
+ lnum = inum
402
+ inum = lnum
403
+ random_num = random.random()
404
+ inum = math.floor(inum)
405
+ inum = round(inum)
406
+
407
+ @staticmethod
408
+ def stream_test(
409
+ args: List[str],
410
+ ) -> None:
411
+ if DaraFile.exists('/tmp/test'):
412
+ rs = DaraFile.create_read_stream('/tmp/test')
413
+ ws = DaraFile.create_write_stream('/tmp/test')
414
+ data = rs.read(30)
415
+ ws.write(data)
416
+
417
+ rs.seek(0)
418
+
419
+ data = DaraStream.read_as_bytes(rs)
420
+ obj = DaraStream.read_as_json(rs)
421
+ json_str = DaraStream.read_as_string(rs)
422
+
423
+ @staticmethod
424
+ async def stream_test_async(
425
+ args: List[str],
426
+ ) -> None:
427
+ if await DaraFile.exists_async('/tmp/test'):
428
+ rs = DaraFile.create_read_stream('/tmp/test')
429
+ ws = DaraFile.create_write_stream('/tmp/test')
430
+ data = rs.read(30)
431
+ ws.write(data)
432
+
433
+ rs.seek(0)
434
+
435
+ data = await DaraStream.read_as_bytes_async(rs)
436
+ obj = await DaraStream.read_as_json_async(rs)
437
+ json_str = await DaraStream.read_as_string_async(rs)
438
+
439
+ @staticmethod
440
+ def string_test(
441
+ args: List[str],
442
+ ) -> None:
443
+ full_str = ','.join(args)
444
+ args = full_str.split(',')
445
+ if (len(full_str) > 0) and 'hangzhou' in full_str:
446
+ new_str_1 = full_str.replace('hangzhou', 'beijing')
447
+ if full_str.startswith('cn'):
448
+ new_str_2 = full_str.replace('cn', 'zh', flags=re.IGNORECASE)
449
+ if full_str.startswith('beijing'):
450
+ new_str_3 = full_str.replace('beijing', 'chengdu', 1)
451
+ start = full_str.find('beijing')
452
+ end = start + 7
453
+ region = full_str[start:end]
454
+ lower_region = region.lower()
455
+ upper_region = region.upper()
456
+ if region == 'beijing':
457
+ region = region + ' '
458
+ region = region.strip()
459
+ tb = full_str.encode('utf-8')
460
+ em = 'xxx'
461
+ if not em:
462
+ return
463
+ num = '32.0a'
464
+ inum = int(num) + 3
465
+ lnum = int(num)
466
+ fnum = float(num) + 1
467
+ dnum = float(num) + 1
468
+
469
+ @staticmethod
470
+ async def string_test_async(
471
+ args: List[str],
472
+ ) -> None:
473
+ full_str = ','.join(args)
474
+ args = full_str.split(',')
475
+ if (len(full_str) > 0) and 'hangzhou' in full_str:
476
+ new_str_1 = full_str.replace('hangzhou', 'beijing')
477
+ if full_str.startswith('cn'):
478
+ new_str_2 = full_str.replace('cn', 'zh', flags=re.IGNORECASE)
479
+ if full_str.startswith('beijing'):
480
+ new_str_3 = full_str.replace('beijing', 'chengdu', 1)
481
+ start = full_str.find('beijing')
482
+ end = start + 7
483
+ region = full_str[start:end]
484
+ lower_region = region.lower()
485
+ upper_region = region.upper()
486
+ if region == 'beijing':
487
+ region = region + ' '
488
+ region = region.strip()
489
+ tb = full_str.encode('utf-8')
490
+ em = 'xxx'
491
+ if not em:
492
+ return
493
+ num = '32.0a'
494
+ inum = int(num) + 3
495
+ lnum = int(num)
496
+ fnum = float(num) + 1
497
+ dnum = float(num) + 1
498
+
499
+ @staticmethod
500
+ def url_test(
501
+ args: List[str],
502
+ ) -> None:
503
+ url = DaraURL(args[0])
504
+ path = url.path()
505
+ pathname = url.pathname()
506
+ protocol = url.protocol()
507
+ hostname = url.hostname()
508
+ port = url.port()
509
+ host = url.host()
510
+ hash = url.hash()
511
+ search = url.search()
512
+ href = url.href()
513
+ auth = url.auth()
514
+ url_2 = DaraURL.parse(args[1])
515
+ path = url_2.path()
516
+ new_url = DaraURL.url_encode(args[2])
517
+ new_search = DaraURL.percent_encode(search)
518
+ new_path = DaraURL.path_encode(pathname)
519
+ all = 'test' + path + protocol + hostname + hash + search + href + auth + new_url + new_search + new_path
520
+
521
+ @staticmethod
522
+ async def url_test_async(
523
+ args: List[str],
524
+ ) -> None:
525
+ url = DaraURL(args[0])
526
+ path = url.path()
527
+ pathname = url.pathname()
528
+ protocol = url.protocol()
529
+ hostname = url.hostname()
530
+ port = url.port()
531
+ host = url.host()
532
+ hash = url.hash()
533
+ search = url.search()
534
+ href = url.href()
535
+ auth = url.auth()
536
+ url_2 = DaraURL.parse(args[1])
537
+ path = url_2.path()
538
+ new_url = DaraURL.url_encode(args[2])
539
+ new_search = DaraURL.percent_encode(search)
540
+ new_path = DaraURL.path_encode(pathname)
541
+ all = 'test' + path + protocol + hostname + hash + search + href + auth + new_url + new_search + new_path
542
+
543
+ @staticmethod
544
+ def xml_test(
545
+ args: List[str],
546
+ ) -> None:
547
+ m = {
548
+ 'key1': 'test1',
549
+ 'key2': 'test2',
550
+ 'key3': 3,
551
+ 'key4': {
552
+ 'key5': 123,
553
+ 'key6': '321'
554
+ }
555
+ }
556
+ xml = DaraXML.to_xml(m)
557
+ xml = xml + '<key7>132</key7>'
558
+ resp_map = DaraXML.parse_xml(xml, None)
559
+
560
+ @staticmethod
561
+ async def xml_test_async(
562
+ args: List[str],
563
+ ) -> None:
564
+ m = {
565
+ 'key1': 'test1',
566
+ 'key2': 'test2',
567
+ 'key3': 3,
568
+ 'key4': {
569
+ 'key5': 123,
570
+ 'key6': '321'
571
+ }
572
+ }
573
+ xml = DaraXML.to_xml(m)
574
+ xml = xml + '<key7>132</key7>'
575
+ resp_map = DaraXML.parse_xml(xml, None)
576
+
577
+ @staticmethod
578
+ def return_any() -> Any:
579
+ raise Exception('Un-implemented')
580
+
581
+ @staticmethod
582
+ def main(
583
+ args: List[str],
584
+ ) -> None:
585
+ Client.array_test(args)
586
+ Client.bytes_test(args)
587
+ Client.date_test(args)
588
+ Client.env_test(args)
589
+ Client.file_test(args)
590
+ Client.form_test(args)
591
+ Client.loger_test(args)
592
+ Client.map_test_case(args)
593
+ Client.number_test(args)
594
+ Client.stream_test(args)
595
+ Client.string_test(args)
596
+ Client.url_test(args)
597
+ Client.xml_test(args)
598
+ a = int(args[0]) + 10
599
+ b = str(a) + args[1] + str(Client.return_any())
600
+ c = DaraCore.to_number(b) + DaraCore.to_number(a) + DaraCore.to_number(Client.return_any())
601
+ d = int(b) + int(a) + int(Client.return_any())
602
+ e = int(b) + int(a) + int(Client.return_any())
603
+ f = int(b) + int(a) + int(Client.return_any())
604
+ g = int(b) + int(a) + int(Client.return_any())
605
+ h = int(b) + int(a) + int(Client.return_any())
606
+ i = int(b) + int(a) + int(Client.return_any())
607
+ j = int(b) + int(a) + int(Client.return_any())
608
+ k = int(b) + int(a) + int(Client.return_any())
609
+ l = int(b) + int(a) + int(Client.return_any())
610
+ m = int(b) + int(a) + int(Client.return_any())
611
+ n = float(b) + float(a) + float(Client.return_any())
612
+ o = float(b) + float(a) + float(Client.return_any())
613
+ if bool(args[2]):
614
+ data = bytes(Client.return_any())
615
+ length = len(data)
616
+ test = data
617
+ maps = {
618
+ 'key': 'value'
619
+ }
620
+ obj = maps
621
+ ws = BytesIO(json.dumps(obj).encode('utf-8'))
622
+ rs = StringIO(json.dumps(maps))
623
+ data = rs.read(30)
624
+ if not DaraCore.is_null(data):
625
+ ws.write(data)
626
+
627
+ DaraCore.sleep(a)
628
+ default_val = args[0] or args[1]
629
+ if default_val == b:
630
+ return
631
+
632
+ @staticmethod
633
+ async def main_async(
634
+ args: List[str],
635
+ ) -> None:
636
+ await Client.array_test_async(args)
637
+ await Client.bytes_test_async(args)
638
+ await Client.date_test_async(args)
639
+ await Client.env_test_async(args)
640
+ await Client.file_test_async(args)
641
+ await Client.form_test_async(args)
642
+ await Client.loger_test_async(args)
643
+ await Client.map_test_case_async(args)
644
+ await Client.number_test_async(args)
645
+ await Client.stream_test_async(args)
646
+ await Client.string_test_async(args)
647
+ await Client.url_test_async(args)
648
+ await Client.xml_test_async(args)
649
+ a = int(args[0]) + 10
650
+ b = str(a) + args[1] + str(Client.return_any())
651
+ c = DaraCore.to_number(b) + DaraCore.to_number(a) + DaraCore.to_number(Client.return_any())
652
+ d = int(b) + int(a) + int(Client.return_any())
653
+ e = int(b) + int(a) + int(Client.return_any())
654
+ f = int(b) + int(a) + int(Client.return_any())
655
+ g = int(b) + int(a) + int(Client.return_any())
656
+ h = int(b) + int(a) + int(Client.return_any())
657
+ i = int(b) + int(a) + int(Client.return_any())
658
+ j = int(b) + int(a) + int(Client.return_any())
659
+ k = int(b) + int(a) + int(Client.return_any())
660
+ l = int(b) + int(a) + int(Client.return_any())
661
+ m = int(b) + int(a) + int(Client.return_any())
662
+ n = float(b) + float(a) + float(Client.return_any())
663
+ o = float(b) + float(a) + float(Client.return_any())
664
+ if bool(args[2]):
665
+ data = bytes(Client.return_any())
666
+ length = len(data)
667
+ test = data
668
+ maps = {
669
+ 'key': 'value'
670
+ }
671
+ obj = maps
672
+ ws = BytesIO(json.dumps(obj).encode('utf-8'))
673
+ rs = StringIO(json.dumps(maps))
674
+ data = rs.read(30)
675
+ if not DaraCore.is_null(data):
676
+ ws.write(data)
677
+
678
+ awiat DaraCore.sleep_async(a)
679
+ default_val = args[0] or args[1]
680
+ if default_val == b:
681
+ return
682
+
683
+
684
+ if __name__ == '__main__':
685
+ Client.main(sys.argv[1:])
@@ -0,0 +1 @@
1
+ __version__ = "1.0.0"