Skip to content

Commit 2f26efd

Browse files
committed
style(win32): fix import sorting and formatting issues
1 parent 306b28d commit 2f26efd

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

src/mcp/client/stdio/win32.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from anyio.abc import Process
1414
from anyio.streams.file import FileReadStream, FileWriteStream
1515

16+
1617
def get_windows_executable_command(command: str) -> str:
1718
"""
1819
Get the correct executable command normalized for Windows.
@@ -44,15 +45,17 @@ def get_windows_executable_command(command: str) -> str:
4445
# (permissions, broken symlinks, etc.)
4546
return command
4647

48+
4749
class DummyProcess:
4850
"""
49-
A fallback process wrapper for Windows to handle async I/O
51+
A fallback process wrapper for Windows to handle async I/O
5052
when using subprocess.Popen, which provides sync-only FileIO objects.
51-
52-
This wraps stdin and stdout into async-compatible
53+
54+
This wraps stdin and stdout into async-compatible
5355
streams (FileReadStream, FileWriteStream),
5456
so that MCP clients expecting async streams can work properly.
5557
"""
58+
5659
def __init__(self, popen_obj: subprocess.Popen[bytes]):
5760
self.popen: subprocess.Popen[bytes] = popen_obj
5861
self.stdin_raw: IO[bytes] | None = popen_obj.stdin
@@ -79,10 +82,12 @@ def terminate(self):
7982
"""Terminate the subprocess immediately."""
8083
return self.popen.terminate()
8184

85+
8286
# ------------------------
8387
# Updated function
8488
# ------------------------
8589

90+
8691
async def create_windows_process(
8792
command: str,
8893
args: list[str],
@@ -92,9 +97,9 @@ async def create_windows_process(
9297
) -> DummyProcess:
9398
"""
9499
Creates a subprocess in a Windows-compatible way.
95-
96-
On Windows, asyncio.create_subprocess_exec has incomplete support
97-
(NotImplementedError when trying to open subprocesses).
100+
101+
On Windows, asyncio.create_subprocess_exec has incomplete support
102+
(NotImplementedError when trying to open subprocesses).
98103
Therefore, we fallback to subprocess.Popen and wrap it for async usage.
99104
100105
Args:
@@ -118,8 +123,8 @@ async def create_windows_process(
118123
cwd=cwd,
119124
bufsize=0, # Unbuffered output
120125
creationflags=(
121-
subprocess.CREATE_NO_WINDOW
122-
if hasattr(subprocess, "CREATE_NO_WINDOW")
126+
subprocess.CREATE_NO_WINDOW
127+
if hasattr(subprocess, "CREATE_NO_WINDOW")
123128
else 0
124129
),
125130
)

0 commit comments

Comments
 (0)