490
|
1 testYaml = """
|
|
2 enum SomeEnum:
|
|
3 - january
|
|
4 - feb
|
|
5
|
|
6 struct Message0:
|
|
7 a: string
|
|
8
|
|
9 struct Message1:
|
|
10 a: string
|
|
11 b: int32
|
|
12 c: vector<Message0>
|
|
13 d: SomeEnum = january
|
|
14 e: SomeEnum= january
|
|
15 f: SomeEnum=january
|
|
16 g: SomeEnum =january
|
|
17
|
|
18
|
|
19 # github.com/AlDanial/cloc
|
|
20 header2 :
|
|
21 cloc_version : 1.67
|
|
22 elapsed_seconds : int32_t
|
|
23
|
|
24 header :
|
|
25 cloc_version : 1.67
|
|
26 elapsed_seconds : int32_t
|
|
27 cloc_url : vector<map<string,int32>>
|
|
28 n_files : 1
|
|
29 n_lines : 3
|
|
30 files_per_second : 221.393718659277
|
|
31 lines_per_second : 664.181155977831
|
|
32 report_file : IDL.idl.yaml
|
|
33 IDL :
|
|
34 nFiles: 1
|
|
35 blank: 0
|
|
36 comment: 2
|
|
37 code: 1
|
|
38 EnumSUM:
|
|
39 - aaa
|
|
40 - bbb
|
|
41
|
|
42 SUM:
|
|
43 blank: 0
|
|
44 comment: 2
|
|
45 code: 1
|
|
46 nFiles: 1
|
|
47 """
|
|
48
|
|
49 import yaml
|
|
50
|
|
51 b = yaml.load(testYaml)
|
|
52 print(b)
|
|
53
|
|
54 c = {
|
|
55 'enum SomeEnum': ['january', 'feb'],
|
|
56 'struct Message0': {'a': 'string'},
|
|
57 'struct Message1': {
|
|
58 'a': 'string',
|
|
59 'b': 'int32',
|
|
60 'c': 'vector<Message0>',
|
|
61 'd': 'vector<map<string,int32>>',
|
|
62 'e': 'SomeEnum= january',
|
|
63 'f': 'SomeEnum=january',
|
|
64 'g': 'SomeEnum =january'
|
|
65 },
|
|
66 }
|
|
67
|
|
68 print(c) |