From aa1133ee8bad47d7d9cc793bca965fef85b619f2 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 25 Aug 2026 06:59:27 +0000 Subject: [PATCH] refactor(schemas): replace hand-rolled loop with a list comprehension in normalize_claim_navigation_hints normalize_claim_navigation_hints built its result with a manual append-in-a-loop instead of a comprehension, despite the loop body being a single conditional expression per item (None passes through, everything else gets stripped, empty strings become None). Behavior-preserving: the comprehension produces the exact same value for every element (None -> None; non-None -> hint.strip() or None). Verification: pytest tests/ -> 322 passed, 21 failed (unchanged from baseline -- the 21 failures are the repo's documented pre-existing environment-only Chromium-sandbox failures, not from this change); ruff check / ruff format --check clean. --- src/frontend_visualqa/schemas.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/frontend_visualqa/schemas.py b/src/frontend_visualqa/schemas.py index 4e08e41..78e393a 100644 --- a/src/frontend_visualqa/schemas.py +++ b/src/frontend_visualqa/schemas.py @@ -213,14 +213,7 @@ def validate_claims(cls, value: list[str]) -> list[str]: def normalize_claim_navigation_hints(cls, value: list[str | None] | None) -> list[str | None] | None: if value is None: return None - normalized: list[str | None] = [] - for hint in value: - if hint is None: - normalized.append(None) - continue - stripped = hint.strip() - normalized.append(stripped or None) - return normalized + return [None if hint is None else (hint.strip() or None) for hint in value] @model_validator(mode="after") def validate_claim_navigation_hint_alignment(self) -> "VerifyVisualClaimsInput":