Skip to content

Commit 634b8f0

Browse files
Kasper Jungeclaude
authored andcommitted
fix: resolve ty type-check errors by fixing _FIELD_COERCIONS type and removing stale ignore comments
The _FIELD_COERCIONS dict was typed as dict[str, object] which made ty think the values were not callable. Changed to dict[str, Callable] to match actual usage. Also removed all unused `ty: ignore[unresolved-import]` directives across UI modules that are no longer needed. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent d277736 commit 634b8f0

7 files changed

Lines changed: 10 additions & 9 deletions

File tree

src/ralphify/_frontmatter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"""
1010

1111
import re
12-
from collections.abc import Iterator
12+
from collections.abc import Callable, Iterator
1313
from pathlib import Path
1414

1515

@@ -23,7 +23,7 @@
2323

2424
# Type coercion for known frontmatter fields.
2525
# To add a new typed field, add an entry here — no other changes needed.
26-
_FIELD_COERCIONS: dict[str, object] = {
26+
_FIELD_COERCIONS: dict[str, Callable[[str], object]] = {
2727
"timeout": int,
2828
"enabled": lambda v: v.lower() in ("true", "yes", "1"),
2929
}

src/ralphify/cli.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"""
77

88
import shutil
9+
import sys
910
import tomllib
1011
import uuid
1112
from pathlib import Path
@@ -486,7 +487,7 @@ def ui(
486487
except ImportError:
487488
rprint("[red]UI deps not installed. Run: pip install ralphify[ui][/red]")
488489
raise typer.Exit(1)
489-
import uvicorn # ty: ignore[unresolved-import]
490+
import uvicorn
490491

491492
rprint(f"[bold]Starting Ralphify UI at http://{host}:{port}[/bold]")
492493
uvicorn.run(create_app(), host=host, port=port)

src/ralphify/ui/api/primitives.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import shutil
66
from pathlib import Path
77

8-
from fastapi import APIRouter, HTTPException # ty: ignore[unresolved-import]
8+
from fastapi import APIRouter, HTTPException
99

1010
from ralphify._frontmatter import (
1111
CHECK_MARKER,

src/ralphify/ui/api/runs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import tomllib
55
from pathlib import Path
66

7-
from fastapi import APIRouter, HTTPException # ty: ignore[unresolved-import]
7+
from fastapi import APIRouter, HTTPException
88

99
from ralphify._frontmatter import PROMPT_MARKER
1010
from ralphify.engine import RunConfig

src/ralphify/ui/api/ws.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import asyncio
55

6-
from fastapi import APIRouter, WebSocket, WebSocketDisconnect # ty: ignore[unresolved-import]
6+
from fastapi import APIRouter, WebSocket, WebSocketDisconnect
77

88
router = APIRouter()
99

src/ralphify/ui/app.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
from contextlib import asynccontextmanager
66
from pathlib import Path
77

8-
from fastapi import FastAPI # ty: ignore[unresolved-import]
9-
from fastapi.staticfiles import StaticFiles # ty: ignore[unresolved-import]
8+
from fastapi import FastAPI
9+
from fastapi.staticfiles import StaticFiles
1010

1111
from ralphify._events import Event
1212
from ralphify.manager import RunManager

src/ralphify/ui/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Pydantic models for the REST API."""
22
from __future__ import annotations
3-
from pydantic import BaseModel # ty: ignore[unresolved-import]
3+
from pydantic import BaseModel
44

55

66
class RunCreate(BaseModel):

0 commit comments

Comments
 (0)