Skip to content

Commit 540b484

Browse files
fix(session): remove redundant Any cast flagged by pyright
t is typed Any, so t.model_fields["method"].default is already Any; the cast(Any, ...) was redundant and tripped pyright's reportUnnecessaryCast, which fails the pre-commit hook. Drop the cast and the now-unused import.
1 parent 42d5702 commit 540b484

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/mcp/shared/session.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from contextlib import AsyncExitStack
44
from datetime import timedelta
55
from types import TracebackType
6-
from typing import Any, Generic, Protocol, TypeVar, cast, get_args
6+
from typing import Any, Generic, Protocol, TypeVar, get_args
77

88
import anyio
99
import httpx
@@ -175,7 +175,7 @@ def _unpack_union(t: Any) -> None:
175175
for arg in args:
176176
_unpack_union(arg)
177177
elif hasattr(t, "model_fields") and "method" in t.model_fields:
178-
m = cast(Any, t.model_fields["method"].default)
178+
m = t.model_fields["method"].default
179179
if isinstance(m, str):
180180
methods.add(m)
181181

0 commit comments

Comments
 (0)