kcl-lib 0.10.0b2__cp38-none-win_amd64.whl → 0.10.2__cp38-none-win_amd64.whl
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.
Potentially problematic release.
This version of kcl-lib might be problematic. Click here for more details.
|
Binary file
|
kcl_lib/api/service.py
CHANGED
|
@@ -50,14 +50,15 @@ from google.protobuf import message as _message
|
|
|
50
50
|
class API:
|
|
51
51
|
"""KCL APIs
|
|
52
52
|
|
|
53
|
-
Examples
|
|
54
|
-
|
|
53
|
+
## Examples
|
|
54
|
+
|
|
55
|
+
Python Code
|
|
56
|
+
|
|
55
57
|
```python
|
|
56
58
|
import kcl_lib.api as api
|
|
57
|
-
# Call the `exec_program` method with appropriate arguments
|
|
58
59
|
args = api.ExecProgram_Args(k_filename_list=["a.k"])
|
|
59
|
-
# Usage
|
|
60
60
|
api = api.API()
|
|
61
|
+
|
|
61
62
|
result = api.exec_program(args)
|
|
62
63
|
print(result.yaml_result)
|
|
63
64
|
```
|
|
@@ -78,10 +79,9 @@ class API:
|
|
|
78
79
|
|
|
79
80
|
```python
|
|
80
81
|
schema AppConfig:
|
|
81
|
-
|
|
82
|
-
|
|
82
|
+
replicas: int
|
|
83
83
|
app: AppConfig {
|
|
84
|
-
|
|
84
|
+
replicas: 2
|
|
85
85
|
}
|
|
86
86
|
```
|
|
87
87
|
|
|
@@ -109,7 +109,6 @@ class API:
|
|
|
109
109
|
```python
|
|
110
110
|
schema AppConfig:
|
|
111
111
|
replicas: int
|
|
112
|
-
|
|
113
112
|
app: AppConfig {
|
|
114
113
|
replicas: 2
|
|
115
114
|
}
|
|
@@ -129,7 +128,6 @@ class API:
|
|
|
129
128
|
|
|
130
129
|
```python
|
|
131
130
|
import kcl_lib.api as api
|
|
132
|
-
|
|
133
131
|
try:
|
|
134
132
|
args = api.ExecProgram_Args(k_filename_list=["file_not_found"])
|
|
135
133
|
api = api.API()
|
|
@@ -141,12 +139,6 @@ class API:
|
|
|
141
139
|
"""
|
|
142
140
|
return self.call("KclvmService.ExecProgram", args)
|
|
143
141
|
|
|
144
|
-
def build_program(self, args: BuildProgram_Args) -> BuildProgram_Result:
|
|
145
|
-
return self.call("KclvmService.BuildProgram", args)
|
|
146
|
-
|
|
147
|
-
def exec_artifact(self, args: ExecArtifact_Args) -> ExecProgram_Result:
|
|
148
|
-
return self.call("KclvmService.ExecArtifact", args)
|
|
149
|
-
|
|
150
142
|
def parse_file(self, args: ParseFile_Args) -> ParseFile_Result:
|
|
151
143
|
"""Parse KCL single file to Module AST JSON string with import dependencies and parse errors.
|
|
152
144
|
|
|
@@ -157,7 +149,6 @@ class API:
|
|
|
157
149
|
```python
|
|
158
150
|
schema AppConfig:
|
|
159
151
|
replicas: int
|
|
160
|
-
|
|
161
152
|
app: AppConfig {
|
|
162
153
|
replicas: 2
|
|
163
154
|
}
|
|
@@ -187,7 +178,6 @@ class API:
|
|
|
187
178
|
```python
|
|
188
179
|
schema AppConfig:
|
|
189
180
|
replicas: int
|
|
190
|
-
|
|
191
181
|
app: AppConfig {
|
|
192
182
|
replicas: 2
|
|
193
183
|
}
|
|
@@ -217,7 +207,6 @@ class API:
|
|
|
217
207
|
```python
|
|
218
208
|
schema AppConfig:
|
|
219
209
|
replicas: int
|
|
220
|
-
|
|
221
210
|
app: AppConfig {
|
|
222
211
|
replicas: 2
|
|
223
212
|
}
|
|
@@ -227,7 +216,6 @@ class API:
|
|
|
227
216
|
|
|
228
217
|
```python
|
|
229
218
|
import kcl_lib.api as api
|
|
230
|
-
|
|
231
219
|
args = api.LoadPackage_Args(
|
|
232
220
|
parse_args=api.ParseProgram_Args(paths=["schema.k"]), resolve_ast=True
|
|
233
221
|
)
|
|
@@ -279,7 +267,6 @@ class API:
|
|
|
279
267
|
```python
|
|
280
268
|
schema AppConfig:
|
|
281
269
|
replicas: int
|
|
282
|
-
|
|
283
270
|
app: AppConfig {
|
|
284
271
|
replicas: 2
|
|
285
272
|
}
|
|
@@ -300,35 +287,18 @@ class API:
|
|
|
300
287
|
def format_code(self, args: FormatCode_Args) -> FormatCode_Result:
|
|
301
288
|
"""Format the code source.
|
|
302
289
|
|
|
303
|
-
|
|
304
|
-
<p>
|
|
290
|
+
## Example
|
|
305
291
|
|
|
306
292
|
Python Code
|
|
307
293
|
|
|
308
294
|
```python
|
|
309
295
|
import kcl_lib.api as api
|
|
310
|
-
|
|
311
|
-
source_code = \"\"\"schema Person:
|
|
312
|
-
name: str
|
|
313
|
-
age: int
|
|
314
|
-
|
|
315
|
-
check:
|
|
316
|
-
0 < age < 120
|
|
317
|
-
\"\"\"
|
|
296
|
+
source_code = "a = 1"
|
|
318
297
|
args = api.FormatCode_Args(source=source_code)
|
|
319
298
|
api_instance = api.API()
|
|
320
|
-
result = api_instance.format_code(args)
|
|
321
|
-
assert (
|
|
322
|
-
result.formatted.decode()
|
|
323
|
-
== \"\"\"schema Person:
|
|
324
|
-
name: str
|
|
325
|
-
age: int
|
|
326
|
-
|
|
327
|
-
check:
|
|
328
|
-
0 < age < 120
|
|
329
299
|
|
|
330
|
-
|
|
331
|
-
)
|
|
300
|
+
result = api_instance.format_code(args)
|
|
301
|
+
assert result.formatted.decode(), "a = 1"
|
|
332
302
|
```
|
|
333
303
|
"""
|
|
334
304
|
return self.call("KclvmService.FormatCode", args)
|
|
@@ -344,7 +314,6 @@ class API:
|
|
|
344
314
|
schema Person:
|
|
345
315
|
name: str
|
|
346
316
|
age: int
|
|
347
|
-
|
|
348
317
|
check:
|
|
349
318
|
0 < age < 120
|
|
350
319
|
```
|
|
@@ -372,7 +341,6 @@ class API:
|
|
|
372
341
|
```python
|
|
373
342
|
import math
|
|
374
343
|
|
|
375
|
-
a = 1
|
|
376
344
|
```
|
|
377
345
|
|
|
378
346
|
Python Code
|
|
@@ -396,7 +364,6 @@ class API:
|
|
|
396
364
|
|
|
397
365
|
```python
|
|
398
366
|
a = 1
|
|
399
|
-
|
|
400
367
|
b = {
|
|
401
368
|
"a": 1
|
|
402
369
|
"b": 2
|
|
@@ -441,7 +408,6 @@ class API:
|
|
|
441
408
|
```python
|
|
442
409
|
schema AppConfig:
|
|
443
410
|
replicas: int
|
|
444
|
-
|
|
445
411
|
app: AppConfig {
|
|
446
412
|
replicas: 2
|
|
447
413
|
}
|
|
@@ -474,7 +440,6 @@ class API:
|
|
|
474
440
|
schema Person:
|
|
475
441
|
name: str
|
|
476
442
|
age: int
|
|
477
|
-
|
|
478
443
|
check:
|
|
479
444
|
0 < age < 120
|
|
480
445
|
\"\"\"
|
|
@@ -510,7 +475,6 @@ class API:
|
|
|
510
475
|
|
|
511
476
|
```python
|
|
512
477
|
import kcl_lib.api as api
|
|
513
|
-
|
|
514
478
|
args = api.LoadSettingsFiles_Args(
|
|
515
479
|
work_dir=".", files=["kcl.yaml"]
|
|
516
480
|
)
|
|
@@ -530,9 +494,10 @@ class API:
|
|
|
530
494
|
|
|
531
495
|
## Example
|
|
532
496
|
|
|
533
|
-
The content of
|
|
497
|
+
The content of main.k is
|
|
534
498
|
|
|
535
499
|
```python
|
|
500
|
+
|
|
536
501
|
a = 1
|
|
537
502
|
b = a
|
|
538
503
|
```
|
|
@@ -541,7 +506,6 @@ class API:
|
|
|
541
506
|
|
|
542
507
|
```python
|
|
543
508
|
import kcl_lib.api as api
|
|
544
|
-
|
|
545
509
|
args = api.Rename_Args(
|
|
546
510
|
package_root=".",
|
|
547
511
|
symbol_path="a",
|
|
@@ -563,7 +527,6 @@ class API:
|
|
|
563
527
|
|
|
564
528
|
```python
|
|
565
529
|
import kcl_lib.api as api
|
|
566
|
-
|
|
567
530
|
args = api.RenameCode_Args(
|
|
568
531
|
package_root="/mock/path",
|
|
569
532
|
symbol_path="a",
|
|
@@ -619,7 +582,6 @@ class API:
|
|
|
619
582
|
|
|
620
583
|
```python
|
|
621
584
|
import kcl_lib.api as api
|
|
622
|
-
|
|
623
585
|
args = api.UpdateDependencies_Args(
|
|
624
586
|
manifest_path="module"
|
|
625
587
|
)
|
|
@@ -651,7 +613,6 @@ class API:
|
|
|
651
613
|
```python
|
|
652
614
|
import helloworld
|
|
653
615
|
import flask
|
|
654
|
-
|
|
655
616
|
a = helloworld.The_first_kcl_program
|
|
656
617
|
```
|
|
657
618
|
|
|
@@ -659,7 +620,6 @@ class API:
|
|
|
659
620
|
|
|
660
621
|
```python
|
|
661
622
|
import kcl_lib.api as api
|
|
662
|
-
|
|
663
623
|
args = api.UpdateDependencies_Args(
|
|
664
624
|
manifest_path="module"
|
|
665
625
|
)
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
kcl_lib-0.10.
|
|
2
|
-
kcl_lib-0.10.
|
|
3
|
-
kcl_lib/api/service.py,sha256=
|
|
1
|
+
kcl_lib-0.10.2.dist-info/METADATA,sha256=RiXx70ivqJPTex3C81eGzo8-HH_jQNq6HldpeMPkdOA,12715
|
|
2
|
+
kcl_lib-0.10.2.dist-info/WHEEL,sha256=NHoUGL5pvT0j-_WkoqCg7drk-8v6Pu-HANDKM-553D8,94
|
|
3
|
+
kcl_lib/api/service.py,sha256=Xh32TIKNrWzXJ9G-whGMSh_LMYjYcFiCTmFGswZoLy8,23642
|
|
4
4
|
kcl_lib/api/spec_pb2.py,sha256=Q-p6KrdDXkslZkpLEgRnhbd0D85Lycds9d2umc8zqPs,28370
|
|
5
5
|
kcl_lib/api/spec_pb2.pyi,sha256=N_FjBZVpe_uaQX5U09l-i8i1EYyn0u8Irvqf9oyevYM,40667
|
|
6
6
|
kcl_lib/api/__init__.py,sha256=NKelBIJzxUdJdSeSSNYS9ydpd4vf8k7Yf1mLqeoQecg,3002
|
|
7
7
|
kcl_lib/plugin/plugin.py,sha256=myBXT9NXmYp5lXHADUW96nmG3THSSQlpgWMOOxVjl3c,2587
|
|
8
8
|
kcl_lib/plugin/__init__.py,sha256=oWZbsj-_zmxLIcWpTWgGitEFCtiZphZUs2A3cazs720,128
|
|
9
9
|
kcl_lib/__init__.py,sha256=l3Vex1HIfcckzc9d23poK8cntz2zAnchQM4l6qbXluM,25
|
|
10
|
-
kcl_lib/_kcl_lib.cp38-win_amd64.pyd,sha256=
|
|
11
|
-
kcl_lib-0.10.
|
|
10
|
+
kcl_lib/_kcl_lib.cp38-win_amd64.pyd,sha256=AYCIlXvOp8k5lK9gPNn3wz6-ghIbleEWcRhC2hUcT14,19401216
|
|
11
|
+
kcl_lib-0.10.2.dist-info/RECORD,,
|