(config, var, value, type, track_info)
| 198 | |
| 199 | |
| 200 | def add_object(config, var, value, type, track_info): |
| 201 | key = '' |
| 202 | index = var.find('.') |
| 203 | if index < 0: # last part |
| 204 | if isinstance(config, dict) == False: |
| 205 | line, rec = track_info |
| 206 | raise Exception( |
| 207 | f"We cannot continue with '{rec}' at line '{line}' as a value node will be overridden.\nPlease check your config.") |
| 208 | elif var in config and isinstance(config[var], dict): |
| 209 | line, rec = track_info |
| 210 | raise Exception( |
| 211 | f"We cannot continue with '{rec}' at line '{line}' as an existing YAML map will be overridden.\nPlease check your config." |
| 212 | ) |
| 213 | config[var] = get_value(type, value) |
| 214 | else: |
| 215 | key = var[:index] |
| 216 | if key not in config: |
| 217 | config[key] = {} |
| 218 | |
| 219 | add_object(config[key], var[index + 1:], value, type, track_info) |
| 220 | |
| 221 | |
| 222 | def make_tmp_file_with_renamed_fields(file): |
no test coverage detected