···165165 )
166166167167 # Extract daily goal (first pending todo)
168168- facet_data["goal"] = next((t["text"] for t in facet_data["todos"] if not t["completed"]), None)
168168+ facet_data["goal"] = next(
169169+ (t["text"] for t in facet_data["todos"] if not t["completed"]), None
170170+ )
169171170172 # Add facet metadata
171173 result["facet_meta"][facet_name] = {
···186188 next_day = (ref_date + timedelta(days=i)).strftime("%Y%m%d")
187189 day_events = get_events(next_day)
188190 for e in day_events:
189189- upcoming_data.append({
190190- "type": "event",
191191- "day": next_day,
192192- "title": e.get("title") or e.get("summary", "Untitled Event"),
193193- "facet": e.get("facet")
194194- })
191191+ upcoming_data.append(
192192+ {
193193+ "type": "event",
194194+ "day": next_day,
195195+ "title": e.get("title") or e.get("summary", "Untitled Event"),
196196+ "facet": e.get("facet"),
197197+ }
198198+ )
195199 for f_name in facet_names:
196200 f_todos = get_todos(next_day, f_name)
197201 if f_todos:
198202 for t in f_todos:
199203 if not t.get("completed") and not t.get("cancelled"):
200200- upcoming_data.append({
201201- "type": "todo",
202202- "day": next_day,
203203- "title": t.get("text"),
204204- "facet": f_name
205205- })
204204+ upcoming_data.append(
205205+ {
206206+ "type": "todo",
207207+ "day": next_day,
208208+ "title": t.get("text"),
209209+ "facet": f_name,
210210+ }
211211+ )
206212 except Exception:
207213 pass
208214 result["upcoming"] = upcoming_data[:5] # Limit to 5 items
+1-3
apps/tokens/routes.py
···247247 segment_list.sort(key=lambda x: x["cost"], reverse=True)
248248249249 # Count attributed segments (excluding [unattributed])
250250- segment_count = sum(
251251- 1 for s in segment_list if s["segment"] != "[unattributed]"
252252- )
250250+ segment_count = sum(1 for s in segment_list if s["segment"] != "[unattributed]")
253251254252 # Calculate cached/reasoning percentages for display annotations
255253 # - cached_tokens are a subset of input_tokens (reduce cost)