Try and make mypy happy about types

This commit is contained in:
Edward Betts 2024-01-08 15:19:20 +00:00
parent acbad39df7
commit 3d16e30aa8

View file

@ -267,9 +267,13 @@ def find_markets_during_stay(
"""Market events that happen during accommodation stays.""" """Market events that happen during accommodation stays."""
overlapping_markets = [] overlapping_markets = []
for market in markets: for market in markets:
market_date = market.as_date
assert isinstance(market_date, date)
for e in accommodation_events: for e in accommodation_events:
start, end = e.as_date, e.end_as_date
assert start and end and all(isinstance(i, date) for i in (start, end))
# Check if the market date is within the accommodation dates. # Check if the market date is within the accommodation dates.
if e.as_date <= market.as_date <= e.end_as_date: if start <= market_date <= end:
overlapping_markets.append(market) overlapping_markets.append(market)
break # Breaks the inner loop if overlap is found. break # Breaks the inner loop if overlap is found.
return overlapping_markets return overlapping_markets