

def tree_lines(self):
    (yield self.name)
    for label in self.labels:
        (yield ('   ' + label))
    children = sorted(self.children, key=(lambda c: c.sort_by))
    last = (children[(- 1)] if children else None)
    for child in children:
        prefix = ('`--' if (child is last) else '+--')
        for line in child.tree_lines():
            (yield (prefix + line))
            prefix = ('   ' if (child is last) else '|  ')

dataset/ETHPy150Open PyTables/PyTables/tables/scripts/pttree.py PrettyTree.tree_lines/original