From ff6c5feb6c33ac04c2810904eac1df854bb8efcc Mon Sep 17 00:00:00 2001 From: aidankhogg Date: Fri, 19 Sep 2025 14:52:32 +0100 Subject: [PATCH] Deduplicate optional dependency imports in regex detectors --- src/redactable/detectors/regexes.py | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/redactable/detectors/regexes.py b/src/redactable/detectors/regexes.py index 88c7526..69b8d70 100644 --- a/src/redactable/detectors/regexes.py +++ b/src/redactable/detectors/regexes.py @@ -86,11 +86,6 @@ def detect(self, text: str) -> Iterable[Finding]: extras={"luhn_valid": ok, "brand": brand}, ) -try: - import phonenumbers # type: ignore -except Exception: # pragma: no cover - phonenumbers = None - # -------------------------------------------------------------------- # Simple phone regex fallback RE_PHONE = re.compile( @@ -278,13 +273,6 @@ def detect(self, text: str) -> Iterable[Finding]: extras=extras, ) -try: - from stdnum import iban as std_iban # type: ignore - from stdnum.gb import nhs as std_nhs # type: ignore - from stdnum.us import ssn as std_us_ssn # type: ignore -except Exception: # pragma: no cover - std_iban = std_nhs = std_us_ssn = None - # -------------------------------------------------------------------- # Regex patterns RE_NHS = re.compile(r"\b(\d{3})[\s-]?(\d{3})[\s-]?(\d{4})\b")