Skip to content

Commit df6df0e

Browse files
committed
Remove pragma: no branch from Protocol stubs
No longer needed now that exclude_also inherits coverage.py's built-in default pattern which handles ... stubs including branch arcs.
1 parent aec97fb commit df6df0e

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

src/mcp/shared/_stream_protocols.py

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,35 +15,33 @@
1515
T_contra = TypeVar("T_contra", contravariant=True)
1616

1717

18-
# coverage branch tracking reports missing arcs on Protocol stub methods
19-
# (def -> exit) because they are never called at runtime.
20-
class ReadStream(Protocol[T_co]): # pragma: no branch
18+
class ReadStream(Protocol[T_co]):
2119
"""Protocol for reading items from a stream.
2220
2321
Consumers that need the sender's context should use
2422
``getattr(stream, 'last_context', None)``.
2523
"""
2624

27-
async def receive(self) -> T_co: ... # pragma: no branch
28-
async def aclose(self) -> None: ... # pragma: no branch
29-
def __aiter__(self) -> ReadStream[T_co]: ... # pragma: no branch
30-
async def __anext__(self) -> T_co: ... # pragma: no branch
31-
async def __aenter__(self) -> Self: ... # pragma: no branch
32-
async def __aexit__( # pragma: no branch
25+
async def receive(self) -> T_co: ...
26+
async def aclose(self) -> None: ...
27+
def __aiter__(self) -> ReadStream[T_co]: ...
28+
async def __anext__(self) -> T_co: ...
29+
async def __aenter__(self) -> Self: ...
30+
async def __aexit__(
3331
self,
3432
exc_type: type[BaseException] | None,
3533
exc_val: BaseException | None,
3634
exc_tb: TracebackType | None,
3735
) -> bool | None: ...
3836

3937

40-
class WriteStream(Protocol[T_contra]): # pragma: no branch
38+
class WriteStream(Protocol[T_contra]):
4139
"""Protocol for writing items to a stream."""
4240

43-
async def send(self, item: T_contra, /) -> None: ... # pragma: no branch
44-
async def aclose(self) -> None: ... # pragma: no branch
45-
async def __aenter__(self) -> Self: ... # pragma: no branch
46-
async def __aexit__( # pragma: no branch
41+
async def send(self, item: T_contra, /) -> None: ...
42+
async def aclose(self) -> None: ...
43+
async def __aenter__(self) -> Self: ...
44+
async def __aexit__(
4745
self,
4846
exc_type: type[BaseException] | None,
4947
exc_val: BaseException | None,

0 commit comments

Comments
 (0)