from bigtree import Node, print_tree, get_subtree from exquisite_branch.db import get_db, dict_factory def make_tree(branches): nodes = {} nodes["NEW"] = Node("NEW") for branch in branches: try: id = branch["branch"] parent_id = branch["parent"] content = branch["content"] username = branch["username"] nodes[id] = Node( id, parent=nodes[parent_id], content=content, username=username ) except Exception as e: print(e) nodes["NEW"].hshow(style="rounded") return nodes["NEW"]