in rotation.py [0:0]
def load_rotations():
try:
with SAVED_ROTATIONS_PATH.open(mode="rb") as html:
rotations = pickle.load(html)
logger.debug(f"Loading cached rotations from {SAVED_ROTATIONS_PATH}")
if isinstance(rotations, list):
# migrate to dict format with dates
rotations_dict = {}
for rotation in reversed(rotations):
week = get_week(DATE - timedelta(weeks=len(rotations_dict) - 1))
rotations_dict.setdefault(week, rotation)
return rotations_dict
except FileNotFoundError:
logger.debug("Cached rotations not found")
rotations = {}
return rotations