Format terminal¶
Utility functions for formatting prints to terminal¶
Functions to build strings for terminal prints
- orion.core.utils.format_terminal.format_algorithm(experiment)[source]¶
Render a string for algorithm section
- orion.core.utils.format_terminal.format_commandline(experiment)[source]¶
Render a string for commandline section
- orion.core.utils.format_terminal.format_config(experiment)[source]¶
Render a string for config section
- orion.core.utils.format_terminal.format_dict(dictionary, depth=0, width=4, templates=None)[source]¶
Render a dict on multiple lines
- Parameters
- dictionary: dict
The dictionary to render
- depth: int
Tab added at the beginning of every lines
- width: int
Size of the tab added to each line, multiplied by the depth of the object in the dict of dicts.
- templates: dict
Templates for empty_leaf, leaf and dict_node. Default is empty_leaf=”{tab}{key}” leaf=”{tab}{key}: {value}n” dict_node=”{tab}{key}:n{value}n”
Examples
>>> print(format_dict({1: {2: 3, 3: 4}, 2: {3: 4, 4: {5: 6}}})) 1: 2: 3 3: 4 2: 3: 4 4: 5: 6 >>> templates = {'leaf': '{tab}{key}={value}\n', 'dict_node': '{tab}{key}:\n{value}\n'} >>> print(format_dict({1: {2: 3, 3: 4}, 2: {3: 4, 4: {5: 6}}}, templates=templates)) 1: 2=3 3=4 2: 3=4 4: 5=6
- orion.core.utils.format_terminal.format_identification(experiment)[source]¶
Render a string for identification section
- orion.core.utils.format_terminal.format_info(experiment)[source]¶
Render a string for all info of experiment
- orion.core.utils.format_terminal.format_list(a_list, depth=0, width=4, templates=None)[source]¶
Render a list on multiple lines
- Parameters
- a_list: list
The list to render
- depth: int
Tab added at the beginning of every lines
- width: int
Size of the tab added to each line, multiplied by the depth of the object in the list of lists.
- templates: dict
Templates for list, item and list_node. Default is list=”{tab}[n{items}n{tab}]” item=”{tab}{item}n” list_node=”{item}n”
Examples
>>> print(format_list([1, [2, 3], 4, [5, 6, 7, 8]])) [ 1 [ 2 3 ] 4 [ 5 6 7 8 ] ] >>> templates = {} >>> templates['list'] = '{tab}\n{items}\n{tab}' >>> templates['item'] = '{tab}- {item}\n' >>> templates['list_node'] = '{tab}{item}\n' >>> print(format_list([1, [2, 3], 4, [5, 6, 7, 8]], width=2, templates=templates)) - 1
2
3
4
5
6
7
8
- orion.core.utils.format_terminal.format_metadata(experiment)[source]¶
Render a string for metadata section
- orion.core.utils.format_terminal.format_refers(experiment)[source]¶
Render a string for refers section
- orion.core.utils.format_terminal.format_space(experiment)[source]¶
Render a string for space section
- orion.core.utils.format_terminal.format_stats(experiment)[source]¶
Render a string for stat section
- Parameters
- experiment: `orion.core.worker.experiment.Experiment`
- templates: dict
templates for the title and stats. See
format_title
for more info.