from __future__ import annotations import re _TEST_NEG_RE = re.compile( r"(?:не\s+про\s+тест|без\s+тест|кроме\s+тест|про\s+прод\s+код|только\s+прод|production\s+code)", re.IGNORECASE, ) class NegationDetector: def detect(self, text: str) -> set[str]: lowered = (text or "").lower() negations: set[str] = set() if _TEST_NEG_RE.search(lowered): negations.add("tests") return negations