Write config to config_file.
(config: ConfigParser, config_file: str)
| 245 | return get_default_config() |
| 246 | |
| 247 | def _write_config(config: ConfigParser, config_file: str): |
| 248 | """Write config to config_file.""" |
| 249 | |
| 250 | config_base = os.path.dirname(config_file) |
| 251 | if config_base and not os.path.exists(config_base): |
| 252 | try: |
| 253 | os.makedirs(config_base) |
| 254 | except Exception as e: |
| 255 | raise CLIError(f"Error creating configuration path: {e!r}", code=1) |
| 256 | |
| 257 | try: |
| 258 | with open(config_file, 'w') as fp: |
| 259 | config.write(fp) |
| 260 | except Exception as e: |
| 261 | raise CLIError(f"Error writing to configuration file: {e!r}", code=2) |
| 262 | |
| 263 | def _config_create(config_file, profile, ask_full=False, auto_token=False, project=None): |
| 264 | """Full/simplified dwave create flows.""" |
no test coverage detected