cosapp.tools.views.hierarchy¶
Functions
|
Generates the hierarchical representation of a system tree as a string. |
|
Create content displayed by hierarchy as a list of strings. |
|
Print a hierarchical representation of a system tree. |
- cosapp.tools.views.hierarchy.hierarchy(system: System, depth=None, show_class=False) str[source]¶
Generates the hierarchical representation of a system tree as a string. Used in show_tree, which simply prints out the character string.
Parameters:¶
system [System]: system of interest
depth [int, optional]: max depth of the tree representation
- show_class [bool, optional]: if True, the system type is
shown for every sub-system in the tree. Defaults to False.
Returns:¶
str: hierarchical representation of the system tree.
- cosapp.tools.views.hierarchy.hierarchy_content(system: System, depth=None, show_class=False) List[str][source]¶
Create content displayed by hierarchy as a list of strings.
- cosapp.tools.views.hierarchy.show_tree(system: System, depth=None, show_class=False) None[source]¶
Print a hierarchical representation of a system tree.
Parameters:¶
system [System]: system of interest
depth [int, optional]: max depth of the tree representation
- show_class [bool, optional]: if True, the system type is
shown for every sub-system in the tree. Defaults to False.
Example:¶
>>> head = Head('head') >>> show_tree(head) head └── child1 └── child11 ├── child111 └── : ├── child12 └── child13 └── child2 ├── child21 └── :
>>> show_tree(head, depth=2, show_class=True) head [Head] └── child1 [Child1] ├── child11 [..] ├── child12 [..] └── child13 [..] └── child2 [..] ├── child21 [..] └── :