Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mar10 committed Oct 9, 2024
1 parent 54dd165 commit c81991a
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 9 deletions.
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
## 0.10.0 (unreleased)

- BREAKING:
- Rename `shadow_attrs` argument to `forward_attrs`
- Enforce that the same object is not added multiple times to one parent
- Rename `shadow_attrs` argument to `forward_attrs`.
- Enforce that the same object is not added multiple times to one parent.
- Rename `GenericNodeData` to `DictWrapper` and remove support for attribut access.
- tree.to_rdf() is now available for Tree (not only TypedTree)
- tree.to_rdf() is now available for Tree (not only TypedTree).
- New method `node.up()` allows method chaining when adding nodes.
- Passes more pyright 'basic' checks.

Expand Down
2 changes: 1 addition & 1 deletion docs/sphinx/ug_objects.rst
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ methods::
This means that two instances of DictWrapper with the same dict content
will have different hash values.

.. info::
.. note::
The `forward_attrs` feature is readonly, so you cannot modify the dict
through the forwarded attributes. You need to access the dict directly for
that.
Expand Down
2 changes: 2 additions & 0 deletions docs/sphinx/ug_search_and_navigate.rst
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ Different traversal methods are supported. ::
# to materialize:
res = list(node.iterator(add_self=True))

.. _iteration-methods:

Available iteration methods (`IterMethod.MODE`)::
PRE_ORDER # Depth-first, pre-order
Expand Down
6 changes: 3 additions & 3 deletions nutree/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -1052,8 +1052,8 @@ def visit(
callback: TraversalCallbackType,
*,
add_self=False,
method=IterMethod.PRE_ORDER,
memo=None,
method: IterMethod = IterMethod.PRE_ORDER,
memo: Any = None,
) -> None | Any:
"""Call `callback(node, memo)` for all subnodes.
Expand Down Expand Up @@ -1162,7 +1162,7 @@ def _iter_zigzag_rtl(self) -> Iterator[Node]:
return self._iter_level(revert=True, toggle=True)

def iterator(
self, method=IterMethod.PRE_ORDER, *, add_self=False
self, method: IterMethod = IterMethod.PRE_ORDER, *, add_self=False
) -> Iterator[Node]:
"""Generator that walks the hierarchy."""
try:
Expand Down
6 changes: 5 additions & 1 deletion nutree/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,11 @@ def calc_height(self) -> int:
return self._root.calc_height()

def visit(
self, callback: TraversalCallbackType, *, method=IterMethod.PRE_ORDER, memo=None
self,
callback: TraversalCallbackType,
*,
method: IterMethod = IterMethod.PRE_ORDER,
memo: Any = None,
) -> Any | None:
"""Call `callback(node, memo)` for all nodes.
Expand Down
2 changes: 1 addition & 1 deletion nutree/typed_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ def filtered(self, predicate: PredicateCallbackType) -> TypedTree:
return super().filtered(predicate=predicate)

def iterator(
self, method=IterMethod.PRE_ORDER, *, add_self=False
self, method: IterMethod = IterMethod.PRE_ORDER, *, add_self=False
) -> Iterator[Node]:
"""Generator that walks the hierarchy."""
return super().iterator(method=method, add_self=add_self)
Expand Down

0 comments on commit c81991a

Please sign in to comment.