(self)
| 65 | self.last_activity = time.time() |
| 66 | |
| 67 | async def watch(self): |
| 68 | try: |
| 69 | while True: |
| 70 | await self.can_timeout.wait() |
| 71 | await asyncio.sleep(self.timeout - (time.time() - self.last_activity)) |
| 72 | if self.last_activity + self.timeout < time.time(): |
| 73 | await self.callback() |
| 74 | return |
| 75 | except asyncio.CancelledError: |
| 76 | return |
| 77 | |
| 78 | @contextmanager |
| 79 | def disarm(self): |
no test coverage detected