from __future__ import annotations import re import unicodedata from dataclasses import dataclass from difflib import SequenceMatcher from pathlib import Path from .models import FailureReport _REMOVAL_INTENT = re.compile( r"\b(?:entfern\w*|lösch\w*|loesch\w*|weglass\w*|streichen|" r"remove\w*|delet\w*|omit\w*|drop\w*|ohne|without)\b|" r"\b(?:darf|soll|muss)\b.{0,50}\b(?:nicht|nie|niemals)\b|" r"\b(?:must|should)\s+not\b|\bdo\s+not\b", re.IGNORECASE | re.DOTALL, ) _NEGATED_REMOVAL = re.compile( r"\b(?:nicht|nie|niemals)\s+(?:entfern\w*|lösch\w*|loesch\w*|weglass\w*)\b|" r"\b(?:do\s+not|don't|never)\s+(?:remove\w*|delet\w*|omit\w*|drop\w*)\b", re.IGNORECASE, ) _ONLY_REMOVAL = re.compile( r"\b(?:einfach\s+)?nur\b.{0,120}\b(?:entfern\w*|lösch\w*|loesch\w*|" r"weglass\w*|streichen)\b|" r"\b(?:just|only)\b.{0,120}\b(?:remove\w*|delet\w*|omit\w*|drop\w*)\b", re.IGNORECASE | re.DOTALL, ) _QUOTED_FRAGMENT = re.compile( r'"(?P[^"\n]{1,500})"|' r"'(?P[^'\n]{1,500})'|" r"`(?P[^`\n]{1,500})`|" r"„(?P[^”\n]{1,500})”" ) _TECHNICAL_IDENTIFIER = re.compile( r"\b(?:[A-Za-z_][A-Za-z0-9_]*\.)?[A-Za-z_][A-Za-z0-9_]*_[A-Za-z0-9_]+\b" ) _QUESTION_KEY = re.compile(r"['\"]question['\"]\s*=>", re.IGNORECASE) _SQL_HEREDOC = re.compile( r"['\"]sql['\"]\s*=>\s*<<<(?P['\"]?)(?P