MCPcopy
hub / github.com/eudicots/Cactus / get_or_prompt

Function get_or_prompt

cactus/utils/helpers.py:79–92  ·  view source on GitHub ↗

:param config: The configuration object to get the value from :param key: The configuration key to retrieve :type key: str :param prompt_fn: The prompt function to use to prompt the value :param args: Extra arguments for the prompt function :param kwargs: Extra keyword argum

(config, key, prompt_fn, *args, **kwargs)

Source from the content-addressed store, hash-verified

77
78
79def get_or_prompt(config, key, prompt_fn, *args, **kwargs):
80 """
81 :param config: The configuration object to get the value from
82 :param key: The configuration key to retrieve
83 :type key: str
84 :param prompt_fn: The prompt function to use to prompt the value
85 :param args: Extra arguments for the prompt function
86 :param kwargs: Extra keyword arguments for hte prompt function
87 """
88 value = config.get(key)
89 if value is None:
90 value = prompt_fn(*args, **kwargs)
91 config.set(key, value)
92 return value

Callers 1

configureMethod · 0.90

Calls 2

getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected