fix: resolve mypy redundant-cast errors while keeping pyright happy

Use cast(list[Any], x) with type: ignore[redundant-cast] comments to
satisfy both mypy (which considers casting Any redundant) and pyright
strict mode (which needs explicit casts to narrow Unknown types).

Also fix evaluator decorator check_name type annotation to be
explicitly str, resolving mypy str|Any|None mismatch.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
alliscode
2026-03-20 15:25:07 -07:00
co-authored by Copilot
parent 45527eed29
commit b0a15914bf
2 changed files with 6 additions and 6 deletions
@@ -313,7 +313,7 @@ def _extract_per_evaluator(run: Any) -> dict[str, dict[str, int]]:
if per_testing_criteria is None:
return per_eval
try:
items = cast(list[Any], per_testing_criteria) if isinstance(per_testing_criteria, list) else []
items = cast(list[Any], per_testing_criteria) if isinstance(per_testing_criteria, list) else [] # type: ignore[redundant-cast]
for item in items:
name: str = str(getattr(item, "name", None) or getattr(item, "testing_criteria", "unknown"))
counts = _extract_result_counts(item)