Subclass of asyncio.Event adding a wait with timeout like threading.Event. wait_timeout() is converted to wait() by async_to_sync.
| 89 | |
| 90 | |
| 91 | class AEvent(asyncio.Event): |
| 92 | """ |
| 93 | Subclass of asyncio.Event adding a wait with timeout like threading.Event. |
| 94 | |
| 95 | wait_timeout() is converted to wait() by async_to_sync. |
| 96 | """ |
| 97 | |
| 98 | async def wait_timeout(self, timeout): |
| 99 | try: |
| 100 | return await asyncio.wait_for(self.wait(), timeout) |
| 101 | except asyncio.TimeoutError: |
| 102 | return False |
| 103 | |
| 104 | |
| 105 | class Queue(queue.Queue): # type: ignore[type-arg] |
no outgoing calls