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)
| 52 | |
| 53 | |
| 54 | def 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 | |
| 75 | def _postprocess_yml_value(value): |
no outgoing calls