Files
MyAiConfiguration/scripts/benchmarks/tasks/07-preserve-unknown-settings/repo/app/settings_store.py
T
Julian lechnerandClaude Opus 5.5 3480072ed7 test(benchmarks): add A/B task fixtures with hidden checks
Ten small Python tasks, each failing on the fixture and passing with a
reference solution, including workflow expectations for a small change, a
bugfix, and a delegable change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 12:45:40 +02:00

16 lines
497 B
Python

import json
KNOWN = ("theme", "language")
def save_settings(path, updates):
"""Apply updates to the JSON settings file at path."""
try:
with open(path, encoding="utf-8") as stream:
current = json.load(stream)
except FileNotFoundError:
current = {}
merged = {key: updates.get(key, current.get(key)) for key in KNOWN if key in updates or key in current}
with open(path, "w", encoding="utf-8") as stream:
json.dump(merged, stream, indent=2)