minor refactoring

This commit is contained in:
Jörn-Michael Miehe 2023-11-22 19:34:38 +01:00
parent ae9ca16aaa
commit 053aa5d2d2
2 changed files with 3 additions and 3 deletions

View file

@ -1,4 +1,5 @@
import re import re
from collections import defaultdict
from dataclasses import dataclass from dataclasses import dataclass
from datetime import date from datetime import date
from io import BytesIO from io import BytesIO
@ -71,9 +72,8 @@ async def get_all_parts(
*rnd.sample(days, solution_length % num_days), *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): for day, letter in zip(solution_days, cfg.solution.clean):
result[day] = result.get(day, "")
result[day] += letter result[day] += letter
result |= {missed_day: "" for missed_day in set(days) - set(result.keys())} result |= {missed_day: "" for missed_day in set(days) - set(result.keys())}

View file

@ -171,7 +171,7 @@ class EventDates:
@property @property
def next(self) -> date | None: def next(self) -> date | None:
"""Datum des nächsten Ereignisses""" """Datum des nächsten Ereignisses"""
return self.get_next(today=datetime.today().date()) return self.get_next(today=date.today())
@property @property
def last(self) -> date: def last(self) -> date: