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

Function _input_config_variables

dwave/cloud/cli.py:224–237  ·  view source on GitHub ↗

Update config variables in place with user-provided values.

(config: ConfigParser,
                            profile: str,
                            prompts: dict[str, dict[str, str]])

Source from the content-addressed store, hash-verified

222
223
224def _input_config_variables(config: ConfigParser,
225 profile: str,
226 prompts: dict[str, dict[str, str]]) -> ConfigParser:
227 """Update config variables in place with user-provided values."""
228
229 for var, prompt in prompts.items():
230 default_val = config.get(profile, var, fallback=None)
231 prompt.setdefault('default', default_val)
232 val = default_text_input(**prompt)
233 if val:
234 val = os.path.expandvars(val)
235 if val and val != default_val:
236 config.set(profile, var, val)
237 return config
238
239def _load_config(config_file: str) -> ConfigParser:
240 """Load from config_file, or create new with defaults."""

Callers 1

_config_createFunction · 0.85

Calls 3

default_text_inputFunction · 0.90
setMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected