@@ -30,7 +30,74 @@ pip install potc-treevalue
3030
3131## Quick Start
3232
33- (Need to be completed.)
33+ After ` potc-treevalue ` is installed, you can convert the ` treevalue ` objects into executable source code without any additional operations.
34+
35+ We can create a python script which is named ` test_simple.py `
36+
37+ ``` python
38+ from potc import transvars
39+ from treevalue import FastTreeValue, raw
40+
41+ from potc_treevalue.plugin import __rules__
42+
43+ r = raw({' a' : 1 , ' b' : 2 , ' c' : [3 , 4 ]})
44+ t = FastTreeValue({
45+ ' a' : 1 , ' b' : ' this is a string' ,
46+ ' c' : [], ' d' : {
47+ ' x' : raw({' a' : 1 , ' b' : (None , Ellipsis )}),
48+ ' y' : {3 , 4 , 5 }
49+ }
50+ })
51+ st = t._detach()
52+ if __name__ == ' __main__' :
53+ _code = transvars(
54+ {' t' : t, ' st' : t._detach(), ' r' : r},
55+ trans = [__rules__],
56+ reformat = ' pep8'
57+ )
58+ print (_code)
59+
60+ ```
61+
62+ The output result should be like this
63+
64+ ```
65+ from treevalue import FastTreeValue, raw
66+ from treevalue.tree.common import create_storage
67+
68+ __all__ = ['r', 'st', 't']
69+ r = raw({'a': 1, 'b': 2, 'c': [3, 4]})
70+ st = create_storage({
71+ 'a': 1,
72+ 'b': 'this is a string',
73+ 'c': [],
74+ 'd': {
75+ 'x': raw({
76+ 'a': 1,
77+ 'b': (None, ...)
78+ }),
79+ 'y': {3, 4, 5}
80+ }
81+ })
82+ t = FastTreeValue({
83+ 'a': 1,
84+ 'b': 'this is a string',
85+ 'c': [],
86+ 'd': {
87+ 'x': raw({
88+ 'a': 1,
89+ 'b': (None, ...)
90+ }),
91+ 'y': {3, 4, 5}
92+ }
93+ })
94+ ```
95+
96+ And, you can use the following CLI command to get the same output results as above.
97+
98+ ``` shell
99+ potc export -v ' test_simple.t' -v ' test_simple.st' -v ' test_simple.r'
100+ ```
34101
35102
36103# Contributing
0 commit comments