MCPcopy
hub / github.com/kvcache-ai/ktransformers / get

Method get

kt-kernel/python/cli/config/settings.py:133–152  ·  view source on GitHub ↗

Get a configuration value by dot-separated key. Args: key: Dot-separated key path (e.g., "server.port") default: Default value if key not found Returns: Configuration value or default

(self, key: str, default: Any = None)

Source from the content-addressed store, hash-verified

131 base[key] = value
132
133 def get(self, key: str, default: Any = None) -> Any:
134 """Get a configuration value by dot-separated key.
135
136 Args:
137 key: Dot-separated key path (e.g., "server.port")
138 default: Default value if key not found
139
140 Returns:
141 Configuration value or default
142 """
143 parts = key.split(".")
144 value = self._config
145
146 for part in parts:
147 if isinstance(value, dict) and part in value:
148 value = value[part]
149 else:
150 return default
151
152 return value
153
154 def set(self, key: str, value: Any) -> None:
155 """Set a configuration value by dot-separated key.

Callers 15

_ensure_dirsMethod · 0.95
get_env_varsMethod · 0.95
get_model_pathsMethod · 0.95
add_model_pathMethod · 0.95
remove_model_pathMethod · 0.95
cache_dirMethod · 0.95
weights_dirMethod · 0.95
_env_get_boolFunction · 0.45
_forward_str_envFunction · 0.45
default_build_typeFunction · 0.45
cpu_feature_flagsFunction · 0.45
build_multi_variantsMethod · 0.45

Calls

no outgoing calls

Tested by 3

_required_adapter_dirFunction · 0.36
_base_model_name_or_pathFunction · 0.36
_optional_lora_alphaFunction · 0.36