Skip to content

Commit f0594a2

Browse files
committed
style: fix ruff issues
1 parent 39995aa commit f0594a2

File tree

5 files changed

+29
-11
lines changed

5 files changed

+29
-11
lines changed

src/mcp/cli/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""FastMCP CLI package."""
2+
# pyright: reportUnknownVariableType=false
23

34
from .cli import app
45

src/mcp/cli/cli.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
"""MCP CLI tools."""
2+
# pyright: reportMissingImports=false
3+
# pyright: reportUnknownMemberType=false
4+
# pyright: reportUnknownVariableType=false
5+
# pyright: reportUntypedFunctionDecorator=false
26

37
import importlib.metadata
48
import importlib.util

src/mcp/client/session.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,12 @@ async def _default_logging_callback(
9696

9797
class ClientSession(
9898
BaseSession[
99-
types.ClientRequest, # SendRequestT
100-
types.ClientNotification, # SendNotificationT
101-
types.ClientResult, # SendResultT
102-
types.ServerRequest, # ReceiveRequestT
103-
Any, # ReceiveResultT,兼容所有服务端返回结果类型
104-
types.ServerNotification, # ReceiveNotificationT
99+
types.ClientRequest, # SendRequestT
100+
types.ClientNotification, # SendNotificationT
101+
types.ClientResult, # SendResultT
102+
types.ServerRequest, # ReceiveRequestT
103+
Any, # ReceiveResultT,兼容所有服务端返回结果类型
104+
types.ServerNotification, # ReceiveNotificationT
105105
]
106106
):
107107
def __init__(

src/mcp/client/websocket.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# pyright: reportMissingImports=false
2+
# pyright: reportUnknownVariableType=false
3+
# pyright: reportUnknownArgumentType=false
4+
# pyright: reportUnknownMemberType=false
5+
16
import json
27
import logging
38
from collections.abc import AsyncGenerator

src/mcp/shared/progress.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
BaseSession,
1111
ReceiveNotificationT,
1212
ReceiveRequestT,
13+
ReceiveResultT,
1314
SendNotificationT,
1415
SendRequestT,
1516
SendResultT,
16-
ReceiveResultT,
1717
)
1818
from mcp.types import ProgressToken
1919

@@ -24,8 +24,12 @@ class Progress(BaseModel):
2424

2525

2626
@dataclass
27-
class ProgressContext(Generic[SendRequestT, SendNotificationT, SendResultT, ReceiveRequestT, ReceiveNotificationT, ReceiveResultT]):
28-
session: BaseSession[SendRequestT, SendNotificationT, SendResultT, ReceiveRequestT, ReceiveResultT, ReceiveNotificationT]
27+
class ProgressContext(
28+
Generic[SendRequestT, SendNotificationT, SendResultT, ReceiveRequestT, ReceiveNotificationT, ReceiveResultT]
29+
):
30+
session: BaseSession[
31+
SendRequestT, SendNotificationT, SendResultT, ReceiveRequestT, ReceiveResultT, ReceiveNotificationT
32+
]
2933
progress_token: ProgressToken
3034
total: float | None
3135
current: float = field(default=0.0, init=False)
@@ -41,12 +45,16 @@ async def progress(self, amount: float, message: str | None = None) -> None:
4145
@contextmanager
4246
def progress(
4347
ctx: RequestContext[
44-
BaseSession[SendRequestT, SendNotificationT, SendResultT, ReceiveRequestT, ReceiveResultT, ReceiveNotificationT],
48+
BaseSession[
49+
SendRequestT, SendNotificationT, SendResultT, ReceiveRequestT, ReceiveResultT, ReceiveNotificationT
50+
],
4551
LifespanContextT,
4652
],
4753
total: float | None = None,
4854
) -> Generator[
49-
ProgressContext[SendRequestT, SendNotificationT, SendResultT, ReceiveRequestT, ReceiveNotificationT, ReceiveResultT],
55+
ProgressContext[
56+
SendRequestT, SendNotificationT, SendResultT, ReceiveRequestT, ReceiveNotificationT, ReceiveResultT
57+
],
5058
None,
5159
]:
5260
if ctx.meta is None or ctx.meta.progressToken is None:

0 commit comments

Comments
 (0)