pyiron_contrib.protocol.utils.pptree module

pyiron_contrib.protocol.utils.pptree.count_paths(node)[source]

Counts the entries in a nested dectionaries :param node: (dict) the nested dictionary

Returns: (int) the number of total leaf nodes

pyiron_contrib.protocol.utils.pptree.print_tree(current_node, indent='', last='downup', name='root', file=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>)[source]

Prints a nested dictionary in pretty tree This code is adapted version found in “https://github.com/clemtoy/pptree/blob/master/pptree/pptree.py

Parameters
  • current_node – (dict) as nested dictonaries, its keys will be converted to string in order to print the tree

  • indent – (str) optional indentation

  • last – (str) “downdown”, “upup”, “downup” or “updown” the direction of the last shape (default: “downup”)

  • name – (str) the name of the root node

  • file – (file) location where to print the output (default: sys.stdout)

Returns: