MCPcopy Create free account
hub / github.com/dwavesystems/dwave-cloud-client / _write_config

Function _write_config

dwave/cloud/cli.py:247–261  ·  view source on GitHub ↗

Write config to config_file.

(config: ConfigParser, config_file: str)

Source from the content-addressed store, hash-verified

245 return get_default_config()
246
247def _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
263def _config_create(config_file, profile, ask_full=False, auto_token=False, project=None):
264 """Full/simplified dwave create flows."""

Callers 1

_config_createFunction · 0.85

Calls 2

CLIErrorClass · 0.90
writeMethod · 0.80

Tested by

no test coverage detected