mirror of
https://code.lenaisten.de/Lenaisten/advent22.git
synced 2024-11-22 15:53:01 +00:00
minor refactoring
This commit is contained in:
parent
ae9ca16aaa
commit
053aa5d2d2
2 changed files with 3 additions and 3 deletions
|
@ -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())}
|
||||||
|
|
|
@ -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:
|
||||||
|
|
Loading…
Reference in a new issue