Skip to content

Commit

Permalink
update some content in README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
HansBug committed Sep 4, 2021
1 parent 58456d6 commit d08086b
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 10 deletions.
30 changes: 21 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
[![Contributors](https://img.shields.io/github/contributors/opendilab/treevalue)](https://github.com/opendilab/treevalue/graphs/contributors)
[![GitHub license](https://img.shields.io/github/license/opendilab/treevalue)](https://github.com/opendilab/treevalue/blob/master/LICENSE)

`TreeValue` is a generalized tree-based data structure mainly developed by [HansBug](https://github.com/HansBug).
`TreeValue` is a generalized tree-based data structure mainly developed by [OpenDILab Contributors](https://github.com/opendilab).

Almost all the operation can be supported in form of trees in a convenient way to simplify the structure processing when the calculation is tree-based.

Expand Down Expand Up @@ -48,35 +48,47 @@ You can easily create a tree value object based on `FastTreeValue`.
from treevalue import FastTreeValue

if __name__ == '__main__':
t = FastTreeValue({'a': 1, 'b': 2, 'x': {'c': 3, 'd': 4}})
t = FastTreeValue({
'a': 1,
'b': 2.3,
'x': {
'c': 'str',
'd': [1, 2, None],
'e': b'bytes',
}
})
print(t)

```

The result should be

```text
<FastTreeValue 0x7fbbe2979f90 keys: ['a', 'b', 'x']>
<FastTreeValue 0x7f6c7df00160 keys: ['a', 'b', 'x']>
├── 'a' --> 1
├── 'b' --> 2
└── 'x' --> <FastTreeValue 0x7fbbe2979a10 keys: ['c', 'd']>
├── 'c' --> 3
└── 'd' --> 4
├── 'b' --> 2.3
└── 'x' --> <FastTreeValue 0x7f6c81150860 keys: ['c', 'd', 'e']>
├── 'c' --> 'str'
├── 'd' --> [1, 2, None]
└── 'e' --> b'bytes'
```

And `t` is structure should be like this

![t_graph](https://opendilab.github.io/treevalue/main/_images/simple_demo.dat.svg)
![](https://opendilab.github.io/treevalue/main/_images/simple_demo.dat.svg)

For more quick start explanation and further usage, take a look at:

* [Quick Start](https://opendilab.github.io/treevalue/main/tutorials/quick_start/index.html)
* [Basic Usage](https://opendilab.github.io/treevalue/main/tutorials/basic_usage/index.html)
* [Advanced Usage](https://opendilab.github.io/treevalue/main/tutorials/advanced_usage/index.html)

## Contributin
## Contribution

We appreciate all contributions to improve treevalue, both logic and system designs. Please refer to CONTRIBUTING.md for more guides.

And users can join our [slack communication channel](https://join.slack.com/t/opendilab/shared_invite/zt-v9tmv4fp-nUBAQEH1_Kuyu_q4plBssQ), or contact the core developer [HansBug](https://github.com/HansBug) for more detailed discussion.

## License

`treevalue` released under the Apache 2.0 license.
10 changes: 9 additions & 1 deletion docs/source/tutorials/quick_start/create_a_tree.demo.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
from treevalue import FastTreeValue

t = FastTreeValue({'a': 1, 'b': 2, 'x': {'c': 3, 'd': 4}})
t = FastTreeValue({
'a': 1,
'b': 2.3,
'x': {
'c': 'str',
'd': [1, 2, None],
'e': b'bytes',
}
})

if __name__ == '__main__':
print(t)
4 changes: 4 additions & 0 deletions docs/source/tutorials/quick_start/simple_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@
for key, value in _module.__dict__.items():
if isinstance(value, TreeValue):
locals()[key] = value

del locals()['key']
del locals()['value']
del locals()['_module']

0 comments on commit d08086b

Please sign in to comment.