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
RouteandNodesViewclasses.Make anchors return a
tupleinstead 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.edgesas well to makepathmoreroutelike.Implement
path.toas a shortcut to create aRouteby writingroute = node.path.to(other_node).
Version 0.2.0
Add generics
TreeLikeandDownTreeLike.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_treewill now always return aTreeView.Remove
convert_tree.register, but add granular methodschildren.register,parent.register.Iteration methods on
tree.nodesandtree.descendantsnow useNoneas index for root (instead of 0).Change how
Mappingis 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.TreeAdapterremains, but some alternative adapters have been removed.TreeAdapteris hashable if the underlying object is hashable.TreeAdapter.nodehas been renamed toTreeAdapter.value.HeapTreehas 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_formattoto_image.to_imagereturns 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
UpTreeis 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.parentdoesn’t exist.Rename
treeclasses.pytotree.pyRename
conversions.pytoadapters.pyDon’t special-case
x in node.ancestorsto use identity comparison.to_dotandto_mermaidnow 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
BinaryTreeandBinaryDownTreeabstract classes.Add
tree.levels.zigzag()method to iterate through levels in zigzag-order.