kcl-lib 0.9.1__cp39-none-win_amd64.whl → 0.9.3__cp39-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.

kcl_lib/api/service.py CHANGED
@@ -1,6 +1,49 @@
1
1
  import kcl_lib
2
2
  import kcl_lib.plugin as plugin
3
- from .spec_pb2 import *
3
+ from .spec_pb2 import (
4
+ Ping_Args,
5
+ Ping_Result,
6
+ GetVersion_Args,
7
+ GetVersion_Result,
8
+ ParseFile_Args,
9
+ ParseFile_Result,
10
+ ParseProgram_Args,
11
+ ParseProgram_Result,
12
+ LoadPackage_Args,
13
+ LoadPackage_Result,
14
+ ListOptions_Result,
15
+ ExecProgram_Args,
16
+ ExecProgram_Result,
17
+ BuildProgram_Args,
18
+ BuildProgram_Result,
19
+ ExecArtifact_Args,
20
+ FormatCode_Args,
21
+ FormatCode_Result,
22
+ FormatPath_Args,
23
+ FormatPath_Result,
24
+ LintPath_Args,
25
+ LintPath_Result,
26
+ OverrideFile_Args,
27
+ OverrideFile_Result,
28
+ ListVariables_Args,
29
+ ListVariables_Result,
30
+ GetSchemaTypeMapping_Args,
31
+ GetSchemaTypeMapping_Result,
32
+ ValidateCode_Args,
33
+ ValidateCode_Result,
34
+ ListDepFiles_Args,
35
+ ListDepFiles_Result,
36
+ LoadSettingsFiles_Args,
37
+ LoadSettingsFiles_Result,
38
+ Rename_Args,
39
+ Rename_Result,
40
+ RenameCode_Args,
41
+ RenameCode_Result,
42
+ Test_Args,
43
+ Test_Result,
44
+ UpdateDependencies_Args,
45
+ UpdateDependencies_Result,
46
+ )
4
47
  from google.protobuf import message as _message
5
48
 
6
49
 
@@ -27,9 +70,75 @@ class API:
27
70
  return self.call("KclvmService.Ping", args)
28
71
 
29
72
  def parse_program(self, args: ParseProgram_Args) -> ParseProgram_Result:
73
+ """Parse KCL program with entry files and return the AST JSON string.
74
+
75
+ ## Example
76
+
77
+ The content of `schema.k` is
78
+
79
+ ```python
80
+ schema AppConfig:
81
+ replicas: int
82
+
83
+ app: AppConfig {
84
+ replicas: 2
85
+ }
86
+ ```
87
+
88
+ Python Code
89
+
90
+ ```python
91
+ import kcl_lib.api as api
92
+
93
+ args = api.ParseProgram_Args(paths=["schema.k"])
94
+ api = api.API()
95
+ result = api.parse_program(args)
96
+ assert len(result.paths) == 1
97
+ assert len(result.errors) == 0
98
+ ```
99
+ """
30
100
  return self.call("KclvmService.ParseProgram", args)
31
101
 
32
102
  def exec_program(self, args: ExecProgram_Args) -> ExecProgram_Result:
103
+ """Execute KCL file with arguments and return the JSON/YAML result.
104
+
105
+ ## Examples
106
+
107
+ The content of `schema.k` is
108
+
109
+ ```python
110
+ schema AppConfig:
111
+ replicas: int
112
+
113
+ app: AppConfig {
114
+ replicas: 2
115
+ }
116
+ ```
117
+
118
+ Python Code
119
+
120
+ ```python
121
+ import kcl_lib.api as api
122
+
123
+ args = api.ExecProgram_Args(k_filename_list=["schema.k"])
124
+ api = api.API()
125
+ result = api.exec_program(args)
126
+ ```
127
+
128
+ A case with the file not found error
129
+
130
+ ```python
131
+ import kcl_lib.api as api
132
+
133
+ try:
134
+ args = api.ExecProgram_Args(k_filename_list=["file_not_found"])
135
+ api = api.API()
136
+ result = api.exec_program(args)
137
+ assert False
138
+ except Exception as err:
139
+ assert "Cannot find the kcl file" in str(err)
140
+ ```
141
+ """
33
142
  return self.call("KclvmService.ExecProgram", args)
34
143
 
35
144
  def build_program(self, args: BuildProgram_Args) -> BuildProgram_Result:
@@ -39,61 +148,554 @@ class API:
39
148
  return self.call("KclvmService.ExecArtifact", args)
40
149
 
41
150
  def parse_file(self, args: ParseFile_Args) -> ParseFile_Result:
151
+ """Parse KCL single file to Module AST JSON string with import dependencies and parse errors.
152
+
153
+ ## Example
154
+
155
+ The content of `schema.k` is
156
+
157
+ ```python
158
+ schema AppConfig:
159
+ replicas: int
160
+
161
+ app: AppConfig {
162
+ replicas: 2
163
+ }
164
+ ```
165
+
166
+ Python Code
167
+
168
+ ```python
169
+ import kcl_lib.api as api
170
+
171
+ args = api.ParseProgram_Args(paths=[TEST_FILE])
172
+ api = api.API()
173
+ result = api.parse_program(args)
174
+ assert len(result.paths) == 1
175
+ assert len(result.errors) == 0
176
+ ```
177
+ """
42
178
  return self.call("KclvmService.ParseFile", args)
43
179
 
44
180
  def parse_program(self, args: ParseProgram_Args) -> ParseProgram_Result:
181
+ """Parse KCL program with entry files and return the AST JSON string.
182
+
183
+ ## Example
184
+
185
+ The content of `schema.k` is
186
+
187
+ ```python
188
+ schema AppConfig:
189
+ replicas: int
190
+
191
+ app: AppConfig {
192
+ replicas: 2
193
+ }
194
+ ```
195
+
196
+ Python Code
197
+
198
+ ```python
199
+ import kcl_lib.api as api
200
+
201
+ args = api.ParseProgram_Args(paths=["schema.k"])
202
+ api = api.API()
203
+ result = api.parse_program(args)
204
+ assert len(result.paths) == 1
205
+ assert len(result.errors) == 0
206
+ ```
207
+ """
45
208
  return self.call("KclvmService.ParseProgram", args)
46
209
 
47
210
  def load_package(self, args: LoadPackage_Args) -> LoadPackage_Result:
211
+ """load_package provides users with the ability to parse KCL program and semantic model information including symbols, types, definitions, etc.
212
+
213
+ ## Example
214
+
215
+ The content of `schema.k` is
216
+
217
+ ```python
218
+ schema AppConfig:
219
+ replicas: int
220
+
221
+ app: AppConfig {
222
+ replicas: 2
223
+ }
224
+ ```
225
+
226
+ Python Code
227
+
228
+ ```python
229
+ import kcl_lib.api as api
230
+
231
+ args = api.LoadPackage_Args(
232
+ parse_args=api.ParseProgram_Args(paths=["schema.k"]), resolve_ast=True
233
+ )
234
+ api = api.API()
235
+ result = api.load_package(args)
236
+ assert list(result.symbols.values())[0].ty.schema_name == "AppConfig"
237
+ ```
238
+ """
48
239
  return self.call("KclvmService.LoadPackage", args)
49
240
 
50
241
  def list_options(self, args: ParseProgram_Args) -> ListOptions_Result:
242
+ """list_options provides users with the ability to parse KCL program and get all option information.
243
+
244
+ ## Example
245
+
246
+ The content of `options.k` is
247
+
248
+ ```python
249
+ a = option("key1")
250
+ b = option("key2", required=True)
251
+ c = {
252
+ metadata.key = option("metadata-key")
253
+ }
254
+ ```
255
+
256
+ Python Code
257
+
258
+ ```python
259
+ import kcl_lib.api as api
260
+
261
+ args = api.ParseProgram_Args(paths=["options.k"])
262
+ api = api.API()
263
+ result = api.list_options(args)
264
+ assert len(result.options) == 3
265
+ assert result.options[0].name == "key1"
266
+ assert result.options[1].name == "key2"
267
+ assert result.options[2].name == "metadata-key"
268
+ ```
269
+ """
51
270
  return self.call("KclvmService.ListOptions", args)
52
271
 
53
272
  def list_variables(self, args: ListVariables_Args) -> ListVariables_Result:
273
+ """list_variables provides users with the ability to parse KCL program and get all variables by specs.
274
+
275
+ ## Example
276
+
277
+ The content of `schema.k` is
278
+
279
+ ```python
280
+ schema AppConfig:
281
+ replicas: int
282
+
283
+ app: AppConfig {
284
+ replicas: 2
285
+ }
286
+ ```
287
+
288
+ Python Code
289
+
290
+ ```python
291
+ import kcl_lib.api as api
292
+
293
+ args = api.ListVariables_Args(files=[TEST_FILE])
294
+ api = api.API()
295
+ result = api.list_variables(args)
296
+ assert result.variables["app"].variables[0].value == "AppConfig {replicas: 2}"
297
+ ```
298
+ """
54
299
  return self.call("KclvmService.ListVariables", args)
55
300
 
56
301
  def format_code(self, args: FormatCode_Args) -> FormatCode_Result:
302
+ """Format the code source.
303
+
304
+ <details><summary>Example</summary>
305
+ <p>
306
+
307
+ Python Code
308
+
309
+ ```python
310
+ import kcl_lib.api as api
311
+
312
+ source_code = \"\"\"schema Person:
313
+ name: str
314
+ age: int
315
+
316
+ check:
317
+ 0 < age < 120
318
+ \"\"\"
319
+ args = api.FormatCode_Args(source=source_code)
320
+ api_instance = api.API()
321
+ result = api_instance.format_code(args)
322
+ assert (
323
+ result.formatted.decode()
324
+ == \"\"\"schema Person:
325
+ name: str
326
+ age: int
327
+
328
+ check:
329
+ 0 < age < 120
330
+
331
+ \"\"\"
332
+ )
333
+ ```
334
+ """
57
335
  return self.call("KclvmService.FormatCode", args)
58
336
 
59
337
  def format_path(self, args: FormatPath_Args) -> FormatPath_Result:
338
+ """Format KCL file or directory path contains KCL files and returns the changed file paths.
339
+
340
+ ## Example
341
+
342
+ The content of `format_path.k` is
343
+
344
+ ```python
345
+ schema Person:
346
+ name: str
347
+ age: int
348
+
349
+ check:
350
+ 0 < age < 120
351
+ ```
352
+
353
+ Python Code
354
+
355
+ ```python
356
+ import kcl_lib.api as api
357
+
358
+ args = api.FormatPath_Args(path="format_path.k")
359
+ api_instance = api.API()
360
+ result = api_instance.format_path(args)
361
+ print(result)
362
+ ```
363
+ """
60
364
  return self.call("KclvmService.FormatPath", args)
61
365
 
62
366
  def lint_path(self, args: LintPath_Args) -> LintPath_Result:
367
+ """Lint files and return error messages including errors and warnings.
368
+
369
+ ## Example
370
+
371
+ The content of `lint_path.k` is
372
+
373
+ ```python
374
+ import math
375
+
376
+ a = 1
377
+ ```
378
+
379
+ Python Code
380
+
381
+ ```python
382
+ import kcl_lib.api as api
383
+
384
+ args = api.LintPath_Args(paths=["lint_path.k"])
385
+ api_instance = api.API()
386
+ result = api_instance.lint_path(args)
387
+ ```
388
+ """
63
389
  return self.call("KclvmService.LintPath", args)
64
390
 
65
391
  def override_file(self, args: OverrideFile_Args) -> OverrideFile_Result:
392
+ """Override KCL file with arguments. See [https://www.kcl-lang.io/docs/user_docs/guides/automation](https://www.kcl-lang.io/docs/user_docs/guides/automation) for more override spec guide.
393
+
394
+ ## Example
395
+
396
+ The content of `main.k` is
397
+
398
+ ```python
399
+ a = 1
400
+
401
+ b = {
402
+ "a": 1
403
+ "b": 2
404
+ }
405
+ ```
406
+
407
+ Python Code
408
+
409
+ ```python
410
+ import kcl_lib.api as api
411
+ import pathlib
412
+
413
+ test_file = "main.k"
414
+ args = api.OverrideFile_Args(
415
+ file=test_file,
416
+ specs=["b.a=2"],
417
+ )
418
+ api = api.API()
419
+ result = api.override_file(args)
420
+ assert len(result.parse_errors) == 0
421
+ assert result.result == True
422
+ assert pathlib.Path(test_file).read_text() == \"\"\"a = 1
423
+ b = {
424
+ "a": 2
425
+ "b": 2
426
+ }
427
+ \"\"\"
428
+ ```
429
+ """
66
430
  return self.call("KclvmService.OverrideFile", args)
67
431
 
68
432
  def get_schema_type_mapping(
69
433
  self,
70
434
  args: GetSchemaTypeMapping_Args,
71
435
  ) -> GetSchemaTypeMapping_Result:
436
+ """Get schema type mapping defined in the program.
437
+
438
+ ## Example
439
+
440
+ The content of `schema.k` is
441
+
442
+ ```python
443
+ schema AppConfig:
444
+ replicas: int
445
+
446
+ app: AppConfig {
447
+ replicas: 2
448
+ }
449
+ ```
450
+
451
+ Python Code
452
+
453
+ ```python
454
+ import kcl_lib.api as api
455
+
456
+ exec_args = api.ExecProgram_Args(k_filename_list=["schema.k"])
457
+ args = api.GetSchemaTypeMapping_Args(exec_args=exec_args)
458
+ api = api.API()
459
+ result = api.get_schema_type_mapping(args)
460
+ assert result.schema_type_mapping["app"].properties["replicas"].type == "int"
461
+ ```
462
+ """
72
463
  return self.call("KclvmService.GetSchemaTypeMapping", args)
73
464
 
74
465
  def validate_code(self, args: ValidateCode_Args) -> ValidateCode_Result:
466
+ """Validate code using schema and JSON/YAML data strings.
467
+
468
+ ## Example
469
+ Python Code
470
+
471
+ ```python
472
+ import kcl_lib.api as api
473
+
474
+ code = \"\"\"
475
+ schema Person:
476
+ name: str
477
+ age: int
478
+
479
+ check:
480
+ 0 < age < 120
481
+ \"\"\"
482
+ data = '{"name": "Alice", "age": 10}'
483
+ args = api.ValidateCode_Args(code=code, data=data, format="json")
484
+ api_instance = api.API()
485
+ result = api_instance.validate_code(args)
486
+ assert result.success == True
487
+ assert result.err_message == ""
488
+ ```
489
+ """
75
490
  return self.call("KclvmService.ValidateCode", args)
76
491
 
77
492
  def load_settings_files(
78
493
  self,
79
494
  args: LoadSettingsFiles_Args,
80
495
  ) -> LoadSettingsFiles_Result:
496
+ """Load the setting file config defined in `kcl.yaml`
497
+
498
+ ## Example
499
+
500
+ The content of `kcl.yaml` is
501
+
502
+ ```yaml
503
+ kcl_cli_configs:
504
+ strict_range_check: true
505
+ kcl_options:
506
+ - key: key
507
+ value: value
508
+ ```
509
+
510
+ Python Code
511
+
512
+ ```python
513
+ import kcl_lib.api as api
514
+
515
+ args = api.LoadSettingsFiles_Args(
516
+ work_dir=".", files=["kcl.yaml"]
517
+ )
518
+ api_instance = api.API()
519
+ result = api_instance.load_settings_files(args)
520
+ assert result.kcl_cli_configs.files == []
521
+ assert result.kcl_cli_configs.strict_range_check == True
522
+ assert (
523
+ result.kcl_options[0].key == "key" and result.kcl_options[0].value == '"value"'
524
+ )
525
+ ```
526
+ """
81
527
  return self.call("KclvmService.LoadSettingsFiles", args)
82
528
 
83
529
  def rename(self, args: Rename_Args) -> Rename_Result:
530
+ """Rename all the occurrences of the target symbol in the files. This API will rewrite files if they contain symbols to be renamed. Return the file paths that got changed.
531
+
532
+ ## Example
533
+
534
+ The content of `main.k` is
535
+
536
+ ```python
537
+ a = 1
538
+ b = a
539
+ ```
540
+
541
+ Python Code
542
+
543
+ ```python
544
+ import kcl_lib.api as api
545
+
546
+ args = api.Rename_Args(
547
+ package_root=".",
548
+ symbol_path="a",
549
+ file_paths=["main.k"],
550
+ new_name="a2",
551
+ )
552
+ api_instance = api.API()
553
+ result = api_instance.rename(args)
554
+ ```
555
+ """
84
556
  return self.call("KclvmService.Rename", args)
85
557
 
86
558
  def rename_code(self, args: RenameCode_Args) -> RenameCode_Result:
559
+ """Rename all the occurrences of the target symbol and return the modified code if any code has been changed. This API won't rewrite files but return the changed code.
560
+
561
+ ## Example
562
+
563
+ Python Code
564
+
565
+ ```python
566
+ import kcl_lib.api as api
567
+
568
+ args = api.RenameCode_Args(
569
+ package_root="/mock/path",
570
+ symbol_path="a",
571
+ source_codes={"/mock/path/main.k": "a = 1"},
572
+ new_name="a2",
573
+ )
574
+ api_instance = api.API()
575
+ result = api_instance.rename_code(args)
576
+ assert result.changed_codes["/mock/path/main.k"] == "a2 = 1"
577
+ ```
578
+ """
87
579
  return self.call("KclvmService.RenameCode", args)
88
580
 
89
581
  def test(self, args: Test_Args) -> Test_Result:
582
+ """Test KCL packages with test arguments.
583
+
584
+ ## Example
585
+
586
+ Python Code
587
+
588
+ ```python
589
+ import kcl_lib.api as api
590
+ args = api.Test_Args(
591
+ pkg_list=["path/to/testing/pkg/..."],
592
+ )
593
+ api_instance = api.API()
594
+ result = api_instance.test(args)
595
+ ```
596
+ """
90
597
  return self.call("KclvmService.Test", args)
91
598
 
92
- def test(self, args: UpdateDependencies_Args) -> UpdateDependencies_Result:
599
+ def update_dependencies(
600
+ self, args: UpdateDependencies_Args
601
+ ) -> UpdateDependencies_Result:
602
+ """Download and update dependencies defined in the `kcl.mod` file and return the external package name and location list.
603
+
604
+ ## Examples
605
+
606
+ The content of `module/kcl.mod` is
607
+
608
+ ```yaml
609
+ [package]
610
+ name = "mod_update"
611
+ edition = "0.0.1"
612
+ version = "0.0.1"
613
+
614
+ [dependencies]
615
+ helloworld = { oci = "oci://ghcr.io/kcl-lang/helloworld", tag = "0.1.0" }
616
+ flask = { git = "https://github.com/kcl-lang/flask-demo-kcl-manifests", commit = "ade147b" }
617
+ ```
618
+
619
+ Python Code
620
+
621
+ ```python
622
+ import kcl_lib.api as api
623
+
624
+ args = api.UpdateDependencies_Args(
625
+ manifest_path="module"
626
+ )
627
+ api_instance = api.API()
628
+ result = api_instance.update_dependencies(args)
629
+ pkg_names = [pkg.pkg_name for pkg in result.external_pkgs]
630
+ assert len(pkg_names) == 2
631
+ assert "helloworld" in pkg_names
632
+ assert "flask" in pkg_names
633
+ ```
634
+
635
+ Call `exec_program` with external dependencies
636
+
637
+ The content of `module/kcl.mod` is
638
+
639
+ ```yaml
640
+ [package]
641
+ name = "mod_update"
642
+ edition = "0.0.1"
643
+ version = "0.0.1"
644
+
645
+ [dependencies]
646
+ helloworld = { oci = "oci://ghcr.io/kcl-lang/helloworld", tag = "0.1.0" }
647
+ flask = { git = "https://github.com/kcl-lang/flask-demo-kcl-manifests", commit = "ade147b" }
648
+ ```
649
+
650
+ The content of `module/main.k` is
651
+
652
+ ```python
653
+ import helloworld
654
+ import flask
655
+
656
+ a = helloworld.The_first_kcl_program
657
+ ```
658
+
659
+ Python Code
660
+
661
+ ```python
662
+ import kcl_lib.api as api
663
+
664
+ args = api.UpdateDependencies_Args(
665
+ manifest_path="module"
666
+ )
667
+ api_instance = api.API()
668
+ result = api_instance.update_dependencies(args)
669
+ exec_args = api.ExecProgram_Args(
670
+ k_filename_list=["module/main.k"],
671
+ external_pkgs=result.external_pkgs,
672
+ )
673
+ result = api_instance.exec_program(exec_args)
674
+ assert result.yaml_result == "a: Hello World!"
675
+ ```
676
+ """
93
677
  return self.call("KclvmService.UpdateDependencies", args)
94
678
 
679
+ def get_version(self) -> GetVersion_Result:
680
+ """Return the KCL service version information.
681
+
682
+ ## Example
683
+
684
+ Python Code
685
+
686
+ ```python
687
+ import kcl_lib.api as api
688
+
689
+ api_instance = api.API()
690
+ result = api_instance.get_version()
691
+ print(result.version_info)
692
+ ```
693
+ """
694
+ return self.call("KclvmService.GetVersion", GetVersion_Args())
695
+
95
696
  # Helper method to perform the call
96
697
  def call(self, name: str, args):
698
+ """Call KCL API with the API name and argument protobuf bytes."""
97
699
  # Serialize arguments using pickle or json
98
700
  args_serialized = args.SerializeToString()
99
701
 
@@ -112,89 +714,93 @@ class API:
112
714
  def create_method_req_message(self, method: str) -> _message.Message:
113
715
  if method in ["Ping", "KclvmService.Ping"]:
114
716
  return Ping_Args()
115
- if method in ["ExecProgram", "KclvmService.ExecProgram"]:
717
+ elif method in ["ExecProgram", "KclvmService.ExecProgram"]:
116
718
  return ExecProgram_Args()
117
- if method in ["BuildProgram", "KclvmService.BuildProgram"]:
719
+ elif method in ["BuildProgram", "KclvmService.BuildProgram"]:
118
720
  return BuildProgram_Args()
119
- if method in ["ExecArtifact", "KclvmService.ExecArtifact"]:
721
+ elif method in ["ExecArtifact", "KclvmService.ExecArtifact"]:
120
722
  return ExecArtifact_Args()
121
- if method in ["ParseFile", "KclvmService.ParseFile"]:
723
+ elif method in ["ParseFile", "KclvmService.ParseFile"]:
122
724
  return ParseFile_Args()
123
- if method in ["ParseProgram", "KclvmService.ParseProgram"]:
725
+ elif method in ["ParseProgram", "KclvmService.ParseProgram"]:
124
726
  return ParseProgram_Args()
125
- if method in ["LoadPackage", "KclvmService.LoadPackage"]:
727
+ elif method in ["LoadPackage", "KclvmService.LoadPackage"]:
126
728
  return LoadPackage_Args()
127
- if method in ["ListOptions", "KclvmService.ListOptions"]:
729
+ elif method in ["ListOptions", "KclvmService.ListOptions"]:
128
730
  return ParseProgram_Args()
129
- if method in ["ListVariables", "KclvmService.ListVariables"]:
731
+ elif method in ["ListVariables", "KclvmService.ListVariables"]:
130
732
  return ListVariables_Args()
131
- if method in ["FormatCode", "KclvmService.FormatCode"]:
733
+ elif method in ["FormatCode", "KclvmService.FormatCode"]:
132
734
  return FormatCode_Args()
133
- if method in ["FormatPath", "KclvmService.FormatPath"]:
735
+ elif method in ["FormatPath", "KclvmService.FormatPath"]:
134
736
  return FormatPath_Args()
135
- if method in ["LintPath", "KclvmService.LintPath"]:
737
+ elif method in ["LintPath", "KclvmService.LintPath"]:
136
738
  return LintPath_Args()
137
- if method in ["OverrideFile", "KclvmService.OverrideFile"]:
739
+ elif method in ["OverrideFile", "KclvmService.OverrideFile"]:
138
740
  return OverrideFile_Args()
139
- if method in ["GetSchemaTypeMapping", "KclvmService.GetSchemaTypeMapping"]:
741
+ elif method in ["GetSchemaTypeMapping", "KclvmService.GetSchemaTypeMapping"]:
140
742
  return GetSchemaTypeMapping_Args()
141
- if method in ["ValidateCode", "KclvmService.ValidateCode"]:
743
+ elif method in ["ValidateCode", "KclvmService.ValidateCode"]:
142
744
  return ValidateCode_Args()
143
- if method in ["ListDepFiles", "KclvmService.ListDepFiles"]:
745
+ elif method in ["ListDepFiles", "KclvmService.ListDepFiles"]:
144
746
  return ListDepFiles_Args()
145
- if method in ["LoadSettingsFiles", "KclvmService.LoadSettingsFiles"]:
747
+ elif method in ["LoadSettingsFiles", "KclvmService.LoadSettingsFiles"]:
146
748
  return LoadSettingsFiles_Args()
147
- if method in ["Rename", "KclvmService.Rename"]:
749
+ elif method in ["Rename", "KclvmService.Rename"]:
148
750
  return Rename_Args()
149
- if method in ["RenameCode", "KclvmService.RenameCode"]:
751
+ elif method in ["RenameCode", "KclvmService.RenameCode"]:
150
752
  return RenameCode_Args()
151
- if method in ["Test", "KclvmService.Test"]:
753
+ elif method in ["Test", "KclvmService.Test"]:
152
754
  return Test_Args()
153
- if method in ["UpdateDependencies", "KclvmService.UpdateDependencies"]:
755
+ elif method in ["UpdateDependencies", "KclvmService.UpdateDependencies"]:
154
756
  return UpdateDependencies_Args()
757
+ elif method in ["GetVersion", "KclvmService.GetVersion"]:
758
+ return GetVersion_Args()
155
759
  raise Exception(f"unknown method: {method}")
156
760
 
157
761
  def create_method_resp_message(self, method: str) -> _message.Message:
158
762
  if method in ["Ping", "KclvmService.Ping"]:
159
763
  return Ping_Result()
160
- if method in ["ExecProgram", "KclvmService.ExecProgram"]:
764
+ elif method in ["ExecProgram", "KclvmService.ExecProgram"]:
161
765
  return ExecProgram_Result()
162
- if method in ["BuildProgram", "KclvmService.BuildProgram"]:
766
+ elif method in ["BuildProgram", "KclvmService.BuildProgram"]:
163
767
  return BuildProgram_Result()
164
- if method in ["ExecArtifact", "KclvmService.ExecArtifact"]:
768
+ elif method in ["ExecArtifact", "KclvmService.ExecArtifact"]:
165
769
  return ExecProgram_Result()
166
- if method in ["ParseFile", "KclvmService.ParseFile"]:
770
+ elif method in ["ParseFile", "KclvmService.ParseFile"]:
167
771
  return ParseFile_Result()
168
- if method in ["ParseProgram", "KclvmService.ParseProgram"]:
772
+ elif method in ["ParseProgram", "KclvmService.ParseProgram"]:
169
773
  return ParseProgram_Result()
170
- if method in ["LoadPackage", "KclvmService.LoadPackage"]:
774
+ elif method in ["LoadPackage", "KclvmService.LoadPackage"]:
171
775
  return LoadPackage_Result()
172
- if method in ["ListOptions", "KclvmService.ListOptions"]:
776
+ elif method in ["ListOptions", "KclvmService.ListOptions"]:
173
777
  return ListOptions_Result()
174
- if method in ["ListVariables", "KclvmService.ListVariables"]:
778
+ elif method in ["ListVariables", "KclvmService.ListVariables"]:
175
779
  return ListVariables_Result()
176
- if method in ["FormatCode", "KclvmService.FormatCode"]:
780
+ elif method in ["FormatCode", "KclvmService.FormatCode"]:
177
781
  return FormatCode_Result()
178
- if method in ["FormatPath", "KclvmService.FormatPath"]:
782
+ elif method in ["FormatPath", "KclvmService.FormatPath"]:
179
783
  return FormatPath_Result()
180
- if method in ["LintPath", "KclvmService.LintPath"]:
784
+ elif method in ["LintPath", "KclvmService.LintPath"]:
181
785
  return LintPath_Result()
182
- if method in ["OverrideFile", "KclvmService.OverrideFile"]:
786
+ elif method in ["OverrideFile", "KclvmService.OverrideFile"]:
183
787
  return OverrideFile_Result()
184
- if method in ["GetSchemaTypeMapping", "KclvmService.GetSchemaTypeMapping"]:
788
+ elif method in ["GetSchemaTypeMapping", "KclvmService.GetSchemaTypeMapping"]:
185
789
  return GetSchemaTypeMapping_Result()
186
- if method in ["ValidateCode", "KclvmService.ValidateCode"]:
790
+ elif method in ["ValidateCode", "KclvmService.ValidateCode"]:
187
791
  return ValidateCode_Result()
188
- if method in ["ListDepFiles", "KclvmService.ListDepFiles"]:
792
+ elif method in ["ListDepFiles", "KclvmService.ListDepFiles"]:
189
793
  return ListDepFiles_Result()
190
- if method in ["LoadSettingsFiles", "KclvmService.LoadSettingsFiles"]:
794
+ elif method in ["LoadSettingsFiles", "KclvmService.LoadSettingsFiles"]:
191
795
  return LoadSettingsFiles_Result()
192
- if method in ["Rename", "KclvmService.Rename"]:
796
+ elif method in ["Rename", "KclvmService.Rename"]:
193
797
  return Rename_Result()
194
- if method in ["RenameCode", "KclvmService.RenameCode"]:
798
+ elif method in ["RenameCode", "KclvmService.RenameCode"]:
195
799
  return RenameCode_Result()
196
- if method in ["Test", "KclvmService.Test"]:
800
+ elif method in ["Test", "KclvmService.Test"]:
197
801
  return Test_Result()
198
- if method in ["UpdateDependencies", "KclvmService.UpdateDependencies"]:
802
+ elif method in ["UpdateDependencies", "KclvmService.UpdateDependencies"]:
199
803
  return UpdateDependencies_Result()
804
+ elif method in ["GetVersion", "KclvmService.GetVersion"]:
805
+ return GetVersion_Result()
200
806
  raise Exception(f"unknown method: {method}")