Commit d8f0098
committed
scripts(typing[mcp_swap]): narrow claude project node via isinstance
CI's ``uv run mypy .`` flagged
``Returning Any from function declared to return "dict[str, Any] | None"``
at the return of ``_claude_project_node``: ``projects.get(key)`` produces
``Any`` and the existing inner shape guard didn't propagate that
narrowing to the return site.
Replace the post-hoc check with an isinstance-narrowed assignment:
``raw_node`` stays ``Any`` from ``projects.get`` but the
``isinstance(raw_node, dict)`` branch narrows it onto a typed
``node: dict[str, t.Any] | None``. Same runtime behaviour (the
non-None / non-dict path still raises ``RuntimeError``) without
``t.cast``.
This supersedes a transient ``t.cast`` fix on this branch.1 parent 0820805 commit d8f0098
1 file changed
Lines changed: 6 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
275 | 275 | | |
276 | 276 | | |
277 | 277 | | |
278 | | - | |
279 | | - | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
280 | 283 | | |
281 | 284 | | |
282 | 285 | | |
283 | | - | |
| 286 | + | |
284 | 287 | | |
285 | 288 | | |
286 | 289 | | |
| |||
0 commit comments