diff options
Diffstat (limited to 'cached')
| -rw-r--r-- | cached/weather_forecast.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/cached/weather_forecast.py b/cached/weather_forecast.py index 7855658..d1e7540 100644 --- a/cached/weather_forecast.py +++ b/cached/weather_forecast.py @@ -4,6 +4,7 @@ from dataclasses import dataclass import datetime import logging import os +from typing import Any import urllib.request import astral # type: ignore @@ -50,7 +51,7 @@ class WeatherForecast: @persistent.persistent_autoloaded_singleton() -class CachedDetailedWeatherForecast(object): +class CachedDetailedWeatherForecast(persistent.Persistent): def __init__(self, forecasts = None): if forecasts is not None: self.forecasts = forecasts @@ -131,7 +132,7 @@ class CachedDetailedWeatherForecast(object): @classmethod @overrides - def load(cls): + def load(cls) -> Any: if persistent.was_file_written_within_n_seconds( config.config['weather_forecast_cachefile'], config.config['weather_forecast_stalest_acceptable'].total_seconds(), @@ -143,7 +144,7 @@ class CachedDetailedWeatherForecast(object): return None @overrides - def save(self): + def save(self) -> bool: import pickle with open(config.config['weather_forecast_cachefile'], 'wb') as wf: pickle.dump( @@ -151,3 +152,4 @@ class CachedDetailedWeatherForecast(object): wf, pickle.HIGHEST_PROTOCOL, ) + return True |
