| 73 | |
| 74 | |
| 75 | def _postprocess_yml_value(value): |
| 76 | # None |
| 77 | if value == '~' or value.lower() == 'none': |
| 78 | return None |
| 79 | # bool |
| 80 | if value.lower() == 'true': |
| 81 | return True |
| 82 | elif value.lower() == 'false': |
| 83 | return False |
| 84 | # !!float number |
| 85 | if value.startswith('!!float'): |
| 86 | return float(value.replace('!!float', '')) |
| 87 | # number |
| 88 | if value.isdigit(): |
| 89 | return int(value) |
| 90 | elif value.replace('.', '', 1).isdigit() and value.count('.') < 2: |
| 91 | return float(value) |
| 92 | # list |
| 93 | if value.startswith('['): |
| 94 | return eval(value) |
| 95 | # str |
| 96 | return value |
| 97 | |
| 98 | def _merge_from_base(opt, opt_path): |
| 99 | def _merge_a_into_b(opt_a, opt_b): |