Skip to content

Commit 17a9867

Browse files
committed
style: Apply Ruff formatting to Windows stdio fixes
1 parent d25bafc commit 17a9867

File tree

2 files changed

+5
-17
lines changed

2 files changed

+5
-17
lines changed

src/mcp/client/stdio/__init__.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,7 @@ async def stdio_client(server: StdioServerParameters, errlog: TextIO = sys.stder
115115
process = await _create_platform_compatible_process(
116116
command=command,
117117
args=server.args,
118-
env=(
119-
{**get_default_environment(), **server.env}
120-
if server.env is not None
121-
else get_default_environment()
122-
),
118+
env=({**get_default_environment(), **server.env} if server.env is not None else get_default_environment()),
123119
errlog=errlog,
124120
cwd=server.cwd,
125121
)
@@ -163,9 +159,7 @@ async def stdin_writer():
163159
try:
164160
async with write_stream_reader:
165161
async for session_message in write_stream_reader:
166-
json = session_message.message.model_dump_json(
167-
by_alias=True, exclude_none=True
168-
)
162+
json = session_message.message.model_dump_json(by_alias=True, exclude_none=True)
169163
await process.stdin.send(
170164
(json + "\n").encode(
171165
encoding=server.encoding,
@@ -246,8 +240,6 @@ async def _create_platform_compatible_process(
246240
if sys.platform == "win32":
247241
process = await create_windows_process(command, args, env, errlog, cwd)
248242
else:
249-
process = await anyio.open_process(
250-
[command, *args], env=env, stderr=errlog, cwd=cwd
251-
)
243+
process = await anyio.open_process([command, *args], env=env, stderr=errlog, cwd=cwd)
252244

253245
return process

src/mcp/client/stdio/win32.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,8 @@ def __init__(self, popen_obj: subprocess.Popen[bytes]):
6262
self.stdout_raw = popen_obj.stdout # type: ignore[assignment]
6363
self.stderr = popen_obj.stderr # type: ignore[assignment]
6464

65-
self.stdin = (
66-
FileWriteStream(cast(BinaryIO, self.stdin_raw)) if self.stdin_raw else None
67-
)
68-
self.stdout = (
69-
FileReadStream(cast(BinaryIO, self.stdout_raw)) if self.stdout_raw else None
70-
)
65+
self.stdin = FileWriteStream(cast(BinaryIO, self.stdin_raw)) if self.stdin_raw else None
66+
self.stdout = FileReadStream(cast(BinaryIO, self.stdout_raw)) if self.stdout_raw else None
7167

7268
async def __aenter__(self):
7369
"""Support async context manager entry."""

0 commit comments

Comments
 (0)