Treevalue support of potc.
Project description
potc-treevalue
Potc support for treevalue module.
Installation
You can simply install it with pip
command line from the official PyPI site.
pip install potc-treevalue
Quick Start
After potc-treevalue
is installed, you can convert the treevalue
objects into executable source code without any additional operations.
We can create a python script which is named test_simple.py
from potc import transvars
from treevalue import FastTreeValue, raw
r = raw({'a': 1, 'b': 2, 'c': [3, 4]})
t = FastTreeValue({
'a': 1, 'b': 'this is a string',
'c': [], 'd': {
'x': raw({'a': 1, 'b': (None, Ellipsis)}),
'y': {3, 4, 5}
}
})
st = t._detach()
if __name__ == '__main__':
_code = transvars(
{'t': t, 'st': t._detach(), 'r': r},
reformat='pep8'
)
print(_code)
The output result should be like this
from treevalue import FastTreeValue, raw
from treevalue.tree.common import create_storage
__all__ = ['r', 'st', 't']
r = raw({'a': 1, 'b': 2, 'c': [3, 4]})
st = create_storage({
'a': 1,
'b': 'this is a string',
'c': [],
'd': {
'x': raw({
'a': 1,
'b': (None, ...)
}),
'y': {3, 4, 5}
}
})
t = FastTreeValue({
'a': 1,
'b': 'this is a string',
'c': [],
'd': {
'x': raw({
'a': 1,
'b': (None, ...)
}),
'y': {3, 4, 5}
}
})
And, you can use the following CLI command to get the same output results as above.
potc export -v 'test_simple.t' -v 'test_simple.st' -v 'test_simple.r'
Contributing
We appreciate all contributions to improve potc
and potc-treevalue
, both logic and system designs. Please refer to CONTRIBUTING.md for more guides.
License
potc-treevalue
released under the Apache 2.0 license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for potc_treevalue-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 576080e5b66c0c91ade6a5f01cc606b4c3da9591baab8473bf23c3b1e901f045 |
|
MD5 | da2955d0ab31d28f882b4eb0625dc5e9 |
|
BLAKE2b-256 | 4ae56bd6e625dcbf5a497ee2eb9b2b8ce0aa3ae2fccce90513ba12d82adefe56 |