From 135476b59ffe0e404bb65828ad7cd77495a98e47 Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Wed, 16 Jul 2025 08:11:21 +0200 Subject: [PATCH] More specific types. --- agenda/busy.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/agenda/busy.py b/agenda/busy.py index 72793c3..87ccf1d 100644 --- a/agenda/busy.py +++ b/agenda/busy.py @@ -84,9 +84,9 @@ def get_busy_events( def get_location_for_date( target_date: date, trips: list[Trip], - bookings: list[dict], - accommodations: list[dict], - airports: dict, + bookings: list[StrDict], + accommodations: list[StrDict], + airports: StrDict, ) -> tuple[str | None, pycountry.db.Country | None]: """Get location (city, country) for a specific date using travel history.""" # UK airports that indicate being home @@ -211,17 +211,17 @@ def get_location_for_date( if len(locations) == 1: city, country = locations[0] return (city, country) - + # Multiple locations: use progression through the trip trip_duration = (trip.end - trip.start).days + 1 days_into_trip = (target_date - trip.start).days - + # Simple progression: first half at first location, second half at last location if days_into_trip <= trip_duration // 2: city, country = locations[0] else: city, country = locations[-1] - + return (city, country) # Find most recent flight or accommodation before this date