diff options
Diffstat (limited to 'cached')
| -rw-r--r-- | cached/weather_data.py | 11 | ||||
| -rw-r--r-- | cached/weather_forecast.py | 3 |
2 files changed, 11 insertions, 3 deletions
diff --git a/cached/weather_data.py b/cached/weather_data.py index d2bf787..45b6e6e 100644 --- a/cached/weather_data.py +++ b/cached/weather_data.py @@ -5,9 +5,11 @@ import datetime import json import logging import os -from typing import List +from typing import Any, List import urllib.request +from overrides import overrides + import argparse_utils import config import datetime_utils @@ -179,7 +181,8 @@ class CachedWeatherData(persistent.Persistent): ) @classmethod - def load(cls): + @overrides + def load(cls) -> Any: if persistent.was_file_written_within_n_seconds( config.config['weather_data_cachefile'], config.config['weather_data_stalest_acceptable'].total_seconds(), @@ -190,7 +193,8 @@ class CachedWeatherData(persistent.Persistent): return cls(weather_data) return None - def save(self): + @overrides + def save(self) -> bool: import pickle with open(config.config['weather_data_cachefile'], 'wb') as wf: pickle.dump( @@ -198,3 +202,4 @@ class CachedWeatherData(persistent.Persistent): wf, pickle.HIGHEST_PROTOCOL, ) + return True diff --git a/cached/weather_forecast.py b/cached/weather_forecast.py index 2509f43..7855658 100644 --- a/cached/weather_forecast.py +++ b/cached/weather_forecast.py @@ -9,6 +9,7 @@ import urllib.request import astral # type: ignore from astral.sun import sun # type: ignore from bs4 import BeautifulSoup # type: ignore +from overrides import overrides import pytz import argparse_utils @@ -129,6 +130,7 @@ class CachedDetailedWeatherForecast(object): ) @classmethod + @overrides def load(cls): if persistent.was_file_written_within_n_seconds( config.config['weather_forecast_cachefile'], @@ -140,6 +142,7 @@ class CachedDetailedWeatherForecast(object): return cls(weather_data) return None + @overrides def save(self): import pickle with open(config.config['weather_forecast_cachefile'], 'wb') as wf: |
