(config, new_config)
| 49 | |
| 50 | |
| 51 | def merge_new_config(config, new_config): |
| 52 | if '_BASE_CONFIG_' in new_config: |
| 53 | with open(new_config['_BASE_CONFIG_'], 'r') as f: |
| 54 | try: |
| 55 | yaml_config = yaml.safe_load(f, Loader=yaml.FullLoader) |
| 56 | except: |
| 57 | yaml_config = yaml.safe_load(f) |
| 58 | config.update(EasyDict(yaml_config)) |
| 59 | |
| 60 | for key, val in new_config.items(): |
| 61 | if not isinstance(val, dict): |
| 62 | config[key] = val |
| 63 | continue |
| 64 | if key not in config: |
| 65 | config[key] = EasyDict() |
| 66 | merge_new_config(config[key], val) |
| 67 | |
| 68 | return config |
| 69 | |
| 70 | |
| 71 | def cfg_from_yaml_file(cfg_file, config): |
no test coverage detected