Changelog
Version 0.2.2
Add new styles for
print_tree
: “indent” and “indent-4”.Improve error message when an unknown style is used in
print_tree
.
Version 0.2.1
Improve and simplify Route:
Handle edge-cases correctly, especially when dealing with 1 of 0 anchors. These used to return incorrect values for e.g.
route.count()
.Merge
Route
andNodesView
classes.Make anchors return a
tuple
instead of anAnchorView
.Make
reversed(route.edges)
return edges in parent-child order for consistency withiter(route.edges)
. In prior versions,reversed(path)
would return edges in child-parent order.
Implement
path.edges
as well to makepath
moreroutelike
.Implement
path.to
as a shortcut to create aRoute
by writingroute = node.path.to(other_node)
.
Version 0.2.0
Add generics
TreeLike
andDownTreeLike
.Add many new functions that accept above generics as parameter.
Change many existing functions to accept above generics above as parameter.
Rename
astree(x)
toas_tree(x)
. Alsoas_tree
will now always return aTreeView
.Remove
convert_tree.register
, but add granular methodschildren.register
,parent.register
.Iteration methods on
tree.nodes
andtree.descendants
now useNone
as index for root (instead of 0).Change how
Mapping
is converted to Tree.children(mapping)
is mostly similar tomapping.items()
. This works well on jsonlike-data.Replace
x.eqv(y)
method byeqv(x, y)
function.TreeAdapter
remains, but some alternative adapters have been removed.TreeAdapter
is hashable if the underlying object is hashable.TreeAdapter.node
has been renamed toTreeAdapter.value
.HeapTree
has become immutable and hashable (by id(heap) and index). The heap itself may remain mutable without a problem.
Version 0.1.1
Make it possible to pass options like
file_format
toto_image
.to_image
returns bytes if no filename is given, not bytesIO.Add function
to_reportlab
. This requires svglib to be installed.Classes can define
_abstracttree_
to override their conversion to tree.
Version 0.1.0
UpTree
is no longer exported by default, although it can still be imported. It has been removed from the documentation and is considered for deletion.Add
AbstractTree.convert(obj)
as a type-aware replacement forastree(obj)
. For instance,DownTree.convert(obj)
can be used ifobj.parent
doesn’t exist.Rename
treeclasses.py
totree.py
Rename
conversions.py
toadapters.py
Don’t special-case
x in node.ancestors
to use identity comparison.to_dot
andto_mermaid
now generate nodes in levelorder (breadth first), instead of preorder (depth-first)
Version 0.0.5
Add
reversed(Route(node_1 ... node_n).edges)
to walk through nodes backwards.Add
BinaryTree
andBinaryDownTree
abstract classes.Add
tree.levels.zigzag()
method to iterate through levels in zigzag-order.