MCPcopy
hub / github.com/WEIFENG2333/VideoCaptioner / _set_nested

Function _set_nested

videocaptioner/cli/config.py:156–161  ·  view source on GitHub ↗

Set a value in a nested dict using dotted key notation (e.g. 'llm.api_key').

(d: dict, dotted_key: str, value: Any)

Source from the content-addressed store, hash-verified

154
155
156def _set_nested(d: dict, dotted_key: str, value: Any) -> None:
157 """Set a value in a nested dict using dotted key notation (e.g. 'llm.api_key')."""
158 keys = dotted_key.split(".")
159 for key in keys[:-1]:
160 d = d.setdefault(key, {})
161 d[keys[-1]] = value
162
163
164def _get_nested(d: dict, dotted_key: str, default: Any = None) -> Any:

Callers 7

test_set_nestedMethod · 0.90
_setFunction · 0.90
_interactive_initFunction · 0.90
_build_onboarding_configFunction · 0.90
load_env_overridesFunction · 0.85
save_config_valueFunction · 0.85

Calls

no outgoing calls

Tested by 2

test_set_nestedMethod · 0.72