fix: Naprawiono błąd składni f-string w _extract_date_from_text

- Przeniesiono logikę kwartału z inline dict do funkcji _quarter_to_date()
- f-string z dict literal nie jest wspierany w Python 3.11

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Maciej Pienczyn 2026-01-17 17:34:44 +01:00
parent 40116d3321
commit 7a6631881f

View File

@ -2505,7 +2505,7 @@ def _extract_date_from_text(text: str) -> str:
# "I kwartał 2025"
(r'\b(I|II|III|IV)\s*kwarta\w*\s*(20[2-3]\d)',
lambda m: f"{m.group(2)}-{{'I':1,'II':4,'III':7,'IV':10}[m.group(1)]:02d}-01"),
lambda m: _quarter_to_date(m.group(1), m.group(2))),
]
for pattern, formatter in patterns:
@ -2533,6 +2533,13 @@ def _month_to_date(month_name: str, year: str) -> str:
return f"{year}-01-01"
def _quarter_to_date(quarter: str, year: str) -> str:
"""Convert Roman numeral quarter to date string."""
quarters = {'I': '01', 'II': '04', 'III': '07', 'IV': '10'}
month = quarters.get(quarter, '01')
return f"{year}-{month}-01"
def _is_past_event(text: str) -> bool:
"""
Detect if milestone text describes a past event (completed)