(enabled: bool)
| 1007 | used.add(key) |
| 1008 | else: |
| 1009 | next_lines.append(line) |
| 1010 | |
| 1011 | missing = [key for key in EDITABLE_ENV_KEYS if key in updates and key not in used] |
| 1012 | if missing and next_lines and next_lines[-1].strip(): |
| 1013 | next_lines.append("") |
| 1014 | for key in missing: |
| 1015 | next_lines.append(f"{key}={_serialize_env_value(updates[key])}") |
| 1016 | |
| 1017 | ENV_PATH.write_text("\n".join(next_lines).rstrip() + "\n", encoding="utf-8") |
| 1018 | |
| 1019 | |
| 1020 | def save_settings(values: Dict[str, Any]) -> Dict[str, Any]: |
| 1021 | updates: Dict[str, str] = {} |
| 1022 | for key, value in (values or {}).items(): |
| 1023 | normalized_key = str(key or "").strip() |
| 1024 | if normalized_key not in EDITABLE_ENV_KEYS: |
| 1025 | continue |
| 1026 | text = str(value or "").strip() |
| 1027 | if text == "***": |
| 1028 | continue |
| 1029 | updates[normalized_key] = text |
| 1030 | |
| 1031 | if not updates: |
| 1032 | return settings() |
no outgoing calls
no test coverage detected