|
15 | 15 | T_contra = TypeVar("T_contra", contravariant=True) |
16 | 16 |
|
17 | 17 |
|
18 | | -class ReadStream(Protocol[T_co]): |
| 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 |
19 | 21 | """Protocol for reading items from a stream. |
20 | 22 |
|
21 | 23 | Consumers that need the sender's context should use |
22 | 24 | ``getattr(stream, 'last_context', None)``. |
23 | 25 | """ |
24 | 26 |
|
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__( |
| 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 |
31 | 33 | self, |
32 | 34 | exc_type: type[BaseException] | None, |
33 | 35 | exc_val: BaseException | None, |
34 | 36 | exc_tb: TracebackType | None, |
35 | 37 | ) -> bool | None: ... |
36 | 38 |
|
37 | 39 |
|
38 | | -class WriteStream(Protocol[T_contra]): |
| 40 | +class WriteStream(Protocol[T_contra]): # pragma: no branch |
39 | 41 | """Protocol for writing items to a stream.""" |
40 | 42 |
|
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__( |
| 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 |
45 | 47 | self, |
46 | 48 | exc_type: type[BaseException] | None, |
47 | 49 | exc_val: BaseException | None, |
|
0 commit comments