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