(config)
| 82 | settings.reload_settings() |
| 83 | |
| 84 | def _args_override(config): |
| 85 | # update config with runtime args |
| 86 | for key, value in runtime.args.items(): |
| 87 | if hasattr(config, key): |
| 88 | # conversion based on type of config[key] |
| 89 | if isinstance(getattr(config, key), bool): |
| 90 | value = value.lower().strip() == "true" |
| 91 | elif isinstance(getattr(config, key), int): |
| 92 | value = int(value) |
| 93 | elif isinstance(getattr(config, key), float): |
| 94 | value = float(value) |
| 95 | elif isinstance(getattr(config, key), str): |
| 96 | value = str(value) |
| 97 | else: |
| 98 | raise Exception( |
| 99 | f"Unsupported argument type of '{key}': {type(getattr(config, key))}" |
| 100 | ) |
| 101 | |
| 102 | setattr(config, key, value) |
| 103 | |
| 104 | |
| 105 |
no test coverage detected