From 2dd011fb396de59eb0426352ed498f3fe2724d06 Mon Sep 17 00:00:00 2001 From: Tommi Lindfors Date: Thu, 23 Jul 2026 09:58:48 +0200 Subject: [PATCH 1/3] fix(ci): resolve mypy errors blocking main after #31 Separate 2- and 3-tuples in boundary split candidates, and type _load_adapter for the fidelity tests. --- src/lex/fidelity.py | 18 +++++++++--------- tests/test_fidelity_check.py | 4 +++- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/lex/fidelity.py b/src/lex/fidelity.py index e93dac8..ae4e8b2 100644 --- a/src/lex/fidelity.py +++ b/src/lex/fidelity.py @@ -465,21 +465,21 @@ def _candidate_boundary_splits(glued: str) -> list[tuple[str, ...]]: if not prefix.isalpha() or not rest.isalpha(): continue if rest in _BOUNDARY_PROCLITICS: - candidate = (prefix, rest) - if _is_recognized_split(candidate): - out.append(candidate) + pair = (prefix, rest) + if _is_recognized_split(pair): + out.append(pair) for proclitic in _BOUNDARY_PROCLITICS: if not rest.startswith(proclitic): continue rest2 = rest[len(proclitic) :] if rest2 and rest2.isalpha(): - candidate = (prefix, proclitic, rest2) - if _is_recognized_split(candidate): - out.append(candidate) + triple = (prefix, proclitic, rest2) + if _is_recognized_split(triple): + out.append(triple) elif not rest2: - candidate = (prefix, proclitic) - if _is_recognized_split(candidate): - out.append(candidate) + pair = (prefix, proclitic) + if _is_recognized_split(pair): + out.append(pair) seen: set[tuple[str, ...]] = set() unique: list[tuple[str, ...]] = [] diff --git a/tests/test_fidelity_check.py b/tests/test_fidelity_check.py index f612edd..6247557 100644 --- a/tests/test_fidelity_check.py +++ b/tests/test_fidelity_check.py @@ -6,6 +6,8 @@ import sys from pathlib import Path +from typing import Any + from lex.fidelity import ( WORD_COUNT_MARGIN, analyze_law_fidelity, @@ -21,7 +23,7 @@ CODE = Path("countries/lu/laws/code-consommation") -def _load_adapter(): # type: ignore[no-untyped-def] +def _load_adapter() -> Any: path = Path("countries/lu/adapter.py") spec = importlib.util.spec_from_file_location("lu_adapter_word_parity", path) assert spec is not None and spec.loader is not None From 205d32af0d204f6800c66eed79f88cb2c310ad3c Mon Sep 17 00:00:00 2001 From: Tommi Lindfors Date: Thu, 23 Jul 2026 10:03:29 +0200 Subject: [PATCH 2/3] style: organize imports in test_fidelity_check.py for ruff --- tests/test_fidelity_check.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test_fidelity_check.py b/tests/test_fidelity_check.py index 6247557..caea8c0 100644 --- a/tests/test_fidelity_check.py +++ b/tests/test_fidelity_check.py @@ -5,7 +5,6 @@ import importlib.util import sys from pathlib import Path - from typing import Any from lex.fidelity import ( From c360978a9f8ef457077006fb94c57b9cf8c2e0e2 Mon Sep 17 00:00:00 2001 From: Tommi Lindfors Date: Thu, 23 Jul 2026 10:03:44 +0200 Subject: [PATCH 3/3] trigger ci