misc linting

This commit is contained in:
Matthew Ryan Dillon 2025-08-30 11:40:56 -04:00
parent b832ee42a6
commit 2a3538ac9e

View file

@ -17,7 +17,6 @@ eastern = zoneinfo.ZoneInfo("America/New_York")
app = FastAPI() app = FastAPI()
# Initialize caches for 15 minutes
weather_cache = TTLCache(maxsize=100, ttl=900) # 15 minutes weather_cache = TTLCache(maxsize=100, ttl=900) # 15 minutes
pollen_cache = TTLCache(maxsize=100, ttl=900) # 15 minutes pollen_cache = TTLCache(maxsize=100, ttl=900) # 15 minutes
@ -93,7 +92,6 @@ def fallback_handler(func):
@fallback_handler @fallback_handler
async def fetch_pollen(zipcode): async def fetch_pollen(zipcode):
# Check the cache first
if zipcode in pollen_cache: if zipcode in pollen_cache:
return pollen_cache[zipcode] return pollen_cache[zipcode]
@ -127,14 +125,12 @@ async def fetch_pollen(zipcode):
], ],
} }
] ]
# Cache the result
pollen_cache[zipcode] = result pollen_cache[zipcode] = result
return result return result
@fallback_handler @fallback_handler
async def fetch_weather(lat, lon, weather_api_key): async def fetch_weather(lat, lon, weather_api_key):
# Check the cache first
cache_key = (lat, lon) cache_key = (lat, lon)
if cache_key in weather_cache: if cache_key in weather_cache:
return weather_cache[cache_key] return weather_cache[cache_key]
@ -170,7 +166,6 @@ async def fetch_weather(lat, lon, weather_api_key):
], ],
} }
] ]
# Cache the result
weather_cache[cache_key] = result weather_cache[cache_key] = result
return result return result