From d08086bb624e8c20ec1bc07a22e1c784949a7006 Mon Sep 17 00:00:00 2001 From: HansBug Date: Sat, 4 Sep 2021 19:26:59 +0800 Subject: [PATCH] update some content in README.md --- README.md | 30 +++++++++++++------ .../quick_start/create_a_tree.demo.py | 10 ++++++- .../tutorials/quick_start/simple_demo.py | 4 +++ 3 files changed, 34 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index e9b56d0b90..732b2cd969 100644 --- a/README.md +++ b/README.md @@ -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. @@ -48,24 +48,34 @@ 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 - + ├── 'a' --> 1 -├── 'b' --> 2 -└── 'x' --> - ├── 'c' --> 3 - └── 'd' --> 4 +├── 'b' --> 2.3 +└── 'x' --> + ├── '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: @@ -73,10 +83,12 @@ For more quick start explanation and further usage, take a look at: * [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. diff --git a/docs/source/tutorials/quick_start/create_a_tree.demo.py b/docs/source/tutorials/quick_start/create_a_tree.demo.py index 16ac94f6f0..69c125bb82 100644 --- a/docs/source/tutorials/quick_start/create_a_tree.demo.py +++ b/docs/source/tutorials/quick_start/create_a_tree.demo.py @@ -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) diff --git a/docs/source/tutorials/quick_start/simple_demo.py b/docs/source/tutorials/quick_start/simple_demo.py index 0a990e89d8..e58f871fa6 100644 --- a/docs/source/tutorials/quick_start/simple_demo.py +++ b/docs/source/tutorials/quick_start/simple_demo.py @@ -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']