X-Git-Url: https://wannabe.guru.org/gitweb/?a=blobdiff_plain;f=cached%2Fweather_forecast.py;h=78556586204dff83ac51926795ad9beff682d4cb;hb=acacd9d2e942d084631e99e94ee430fd26ae9893;hp=a413d9f424b3c76d0839a44695310516dee2cdf4;hpb=351e77c767c9084aa486eedbdc9902c635b06261;p=python_utils.git diff --git a/cached/weather_forecast.py b/cached/weather_forecast.py index a413d9f..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 @@ -27,7 +28,7 @@ cfg = config.add_commandline_args( cfg.add_argument( '--weather_forecast_cachefile', type=str, - default=f'{os.environ["HOME"]}/.weather_forecast_cache', + default=f'{os.environ["HOME"]}/cache/.weather_forecast_cache', metavar='FILENAME', help='File in which to cache weather data' ) @@ -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: