Skip to content

Commit 16b341e

Browse files
committed
add docs
1 parent 198ac5d commit 16b341e

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77
## [0.6.0] - 2022-11-13
88
### Added
99
- BaseNode: Rollback functionality to original state when there is error setting parent and children (backwards-compatible).
10-
- BaseNode and DAGNode: Type hints
10+
- BaseNode and DAGNode: Type hints.
1111
- BNode: Node class for Binary Tree.
1212
- BTree Constructor: From list.
1313
- BNode Iterator: Level-Order Iterator.
14+
- Add Tips and Tricks to documentation (List Directory).
1415

1516
### Fixed
1617
- DAGNode: Fix issue of duplicated parent constructor creating duplicated children.

docs/source/others/list_dir.md

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# List Directory
2+
3+
To list directories recursively using bigtree, we can use the `glob` built-in Python package to extract a list of paths.
4+
5+
```python
6+
import glob
7+
from bigtree import list_to_tree, print_tree
8+
9+
# Get all directories recursively
10+
path_list = []
11+
for f in glob.glob("./**/*.py", recursive=True):
12+
path_list.append(f)
13+
14+
# Construct tree
15+
root = list_to_tree(path_list)
16+
17+
# View tree
18+
print_tree(root, max_depth=3)
19+
```

docs/source/others/tips.rst

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
|:bulb:| Tips and Tricks
22
===================================
33

4+
.. include:: list_dir.md
5+
:parser: myst_parser.sphinx_
6+
47
.. include:: nodes.md
58
:parser: myst_parser.sphinx_
69

0 commit comments

Comments
 (0)