deepsite-project / utils /context.py
hotboxxgenn's picture
Rename context.py to utils/context.py
8525489 verified
raw
history blame contribute delete
401 Bytes
import json
from pathlib import Path
CTX_PATH = Path('context.json')
def load_context():
if CTX_PATH.exists():
try:
return json.loads(CTX_PATH.read_text())
except Exception:
return {}
return {}
def save_context(ctx: dict):
try:
CTX_PATH.write_text(json.dumps(ctx, indent=2))
return True
except Exception:
return False