summaryrefslogtreecommitdiff
path: root/cached/weather_forecast.py
diff options
context:
space:
mode:
authorScott Gasch <[email protected]>2021-11-13 07:06:31 -0800
committerScott Gasch <[email protected]>2021-11-13 07:06:31 -0800
commit957c962294cde93c4c649ed18dedd16df071878d (patch)
tree04207d711c01b33eb73b61782ed18aaa9d5e363d /cached/weather_forecast.py
parente5da1fa6bab9ea6bf4394facbb29f13cdc3daf9a (diff)
Small bugfixes; also, add a new machine to the remote executor pool.
Diffstat (limited to 'cached/weather_forecast.py')
-rw-r--r--cached/weather_forecast.py8
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