From 053aa5d2d210e0de6de402631c04c407d1c5b6f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn-Michael=20Miehe?= Date: Wed, 22 Nov 2023 19:34:38 +0100 Subject: [PATCH] minor refactoring --- api/advent22_api/core/depends.py | 4 ++-- api/advent22_api/core/helpers.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/api/advent22_api/core/depends.py b/api/advent22_api/core/depends.py index 96a52ef..b95eea8 100644 --- a/api/advent22_api/core/depends.py +++ b/api/advent22_api/core/depends.py @@ -1,4 +1,5 @@ import re +from collections import defaultdict from dataclasses import dataclass from datetime import date from io import BytesIO @@ -71,9 +72,8 @@ async def get_all_parts( *rnd.sample(days, solution_length % num_days), ] - result: dict[int, str] = {} + result: defaultdict[int, str] = defaultdict(str) for day, letter in zip(solution_days, cfg.solution.clean): - result[day] = result.get(day, "") result[day] += letter result |= {missed_day: "" for missed_day in set(days) - set(result.keys())} diff --git a/api/advent22_api/core/helpers.py b/api/advent22_api/core/helpers.py index e33db43..78675d1 100644 --- a/api/advent22_api/core/helpers.py +++ b/api/advent22_api/core/helpers.py @@ -171,7 +171,7 @@ class EventDates: @property def next(self) -> date | None: """Datum des nächsten Ereignisses""" - return self.get_next(today=datetime.today().date()) + return self.get_next(today=date.today()) @property def last(self) -> date: