MCPcopy Create free account
hub / github.com/DragonisCV/RAM / dict2str

Function dict2str

ram/utils/options.py:54–72  ·  view source on GitHub ↗

dict to string for printing options. Args: opt (dict): Option dict. indent_level (int): Indent level. Default: 1. Return: (str): Option string for printing.

(opt, indent_level=1)

Source from the content-addressed store, hash-verified

52
53
54def dict2str(opt, indent_level=1):
55 """dict to string for printing options.
56
57 Args:
58 opt (dict): Option dict.
59 indent_level (int): Indent level. Default: 1.
60
61 Return:
62 (str): Option string for printing.
63 """
64 msg = '\n'
65 for k, v in opt.items():
66 if isinstance(v, dict):
67 msg += ' ' * (indent_level * 2) + k + ':['
68 msg += dict2str(v, indent_level + 1)
69 msg += ' ' * (indent_level * 2) + ']\n'
70 else:
71 msg += ' ' * (indent_level * 2) + k + ': ' + str(v) + '\n'
72 return msg
73
74
75def _postprocess_yml_value(value):

Callers 3

setup_environmentMethod · 0.90
train_pipelineFunction · 0.90
test_pipelineFunction · 0.90

Calls

no outgoing calls

Tested by 1

test_pipelineFunction · 0.72