| 42 | |
| 43 | |
| 44 | class AsyncEventContextManager(Generic[T], AbstractAsyncContextManager): |
| 45 | def __init__(self, future: "asyncio.Future[T]") -> None: |
| 46 | self._event = AsyncEventInfo[T](future) |
| 47 | |
| 48 | async def __aenter__(self) -> AsyncEventInfo[T]: |
| 49 | return self._event |
| 50 | |
| 51 | async def __aexit__( |
| 52 | self, |
| 53 | exc_type: Optional[Type[BaseException]], |
| 54 | exc_val: Optional[BaseException], |
| 55 | exc_tb: Optional[TracebackType], |
| 56 | ) -> None: |
| 57 | if exc_val: |
| 58 | self._event._cancel() |
| 59 | else: |
| 60 | await self._event.value |
| 61 | |
| 62 | |
| 63 | class AsyncBase(ImplWrapper): |
no outgoing calls
no test coverage detected