style: Fix linting issues in my_models.py

This commit is contained in:
Paul Gauthier (aider) 2024-12-13 12:31:03 -08:00
parent 8217ee1bbb
commit ec11ae7c40

View file

@ -6,7 +6,7 @@ from collections import defaultdict
from pathlib import Path from pathlib import Path
# Get the analytics file path # Get the analytics file path
analytics_path = Path.home() / '.aider' / 'analytics.jsonl' analytics_path = Path.home() / ".aider" / "analytics.jsonl"
# Dictionary to store model stats # Dictionary to store model stats
model_stats = defaultdict(int) model_stats = defaultdict(int)
@ -17,10 +17,10 @@ with open(analytics_path) as f:
try: try:
event = json.loads(line) event = json.loads(line)
# Check if this is a message_send event # Check if this is a message_send event
if event['event'] == 'message_send': if event["event"] == "message_send":
properties = event['properties'] properties = event["properties"]
main_model = properties.get('main_model') main_model = properties.get("main_model")
total_tokens = properties.get('total_tokens', 0) total_tokens = properties.get("total_tokens", 0)
if main_model: if main_model:
model_stats[main_model] += total_tokens model_stats[main_model] += total_tokens
except json.JSONDecodeError: except json.JSONDecodeError: