MCPcopy Create free account
hub / github.com/pgadmin-org/pgadmin4 / _get_preference_value

Function _get_preference_value

web/pgadmin/llm/utils.py:265–285  ·  view source on GitHub ↗

Get a preference value, returning None if empty or not set. Args: name: The preference name (e.g., 'anthropic_api_key_file') Returns: The preference value or None if empty/not set.

(name)

Source from the content-addressed store, hash-verified

263
264
265def _get_preference_value(name):
266 """
267 Get a preference value, returning None if empty or not set.
268
269 Args:
270 name: The preference name (e.g., 'anthropic_api_key_file')
271
272 Returns:
273 The preference value or None if empty/not set.
274 """
275 try:
276 pref_module = Preferences.module('ai')
277 if pref_module:
278 pref = pref_module.preference(name)
279 if pref:
280 value = pref.get()
281 if value and str(value).strip():
282 return str(value).strip()
283 except Exception:
284 pass
285 return None
286
287
288def _resolve_pref_url(pref_name, config_default):

Callers 8

_resolve_pref_urlFunction · 0.85
is_pref_api_url_rejectedFunction · 0.85
_resolve_pref_key_fileFunction · 0.85
get_anthropic_modelFunction · 0.85
get_openai_modelFunction · 0.85
get_ollama_modelFunction · 0.85
get_docker_modelFunction · 0.85

Calls 3

moduleMethod · 0.80
preferenceMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected