Skip to content

Commit dc63022

Browse files
Varun SharmaCopilot
andcommitted
fix: resolve pyright and coverage CI failures
- Add pragma no cover to version-conditional imports (Python 3.10 compat) - Add type: ignore for pyright false positives (isinstance in loop, duck-type assignment) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 4943417 commit dc63022

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/mcp/server/experimental/task_support.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ async def run(self) -> AsyncIterator[None]:
8080
...
8181
"""
8282
async with create_mcp_task_group() as tg:
83-
self._task_group = tg
83+
self._task_group = tg # type: ignore[assignment]
8484
try:
8585
yield
8686
finally:

src/mcp/shared/_task_group.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import anyio
1919
from anyio.abc import TaskGroup
2020

21-
if sys.version_info < (3, 11):
21+
if sys.version_info < (3, 11): # pragma: no cover
2222
from exceptiongroup import BaseExceptionGroup
2323

2424

@@ -28,7 +28,7 @@ def collapse_exception_group(exc: BaseExceptionGroup) -> BaseException: # type:
2828
If the group (and any nested groups) each contain exactly one exception,
2929
return the innermost real exception. Otherwise return *exc* unchanged.
3030
"""
31-
while isinstance(exc, BaseExceptionGroup) and len(exc.exceptions) == 1:
31+
while isinstance(exc, BaseExceptionGroup) and len(exc.exceptions) == 1: # type: ignore[reportUnnecessaryIsInstance]
3232
exc = exc.exceptions[0] # type: ignore[assignment]
3333
return exc
3434

tests/shared/test_task_group.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
create_mcp_task_group,
1313
)
1414

15-
if sys.version_info < (3, 11):
15+
if sys.version_info < (3, 11): # pragma: no cover
1616
from exceptiongroup import BaseExceptionGroup, ExceptionGroup
1717

1818
# ---------------------------------------------------------------------------

0 commit comments

Comments
 (0)