Set deadline to absolute value. deadline argument points on the time in the same clock system as loop.time(). If new deadline is in the past the timeout is raised immediately. Please note: it is not POSIX time but a time with undefined starting base, e.g. t
(self, deadline: float)
| 217 | self.update(deadline + delay) |
| 218 | |
| 219 | def update(self, deadline: float) -> None: |
| 220 | """Set deadline to absolute value. |
| 221 | |
| 222 | deadline argument points on the time in the same clock system |
| 223 | as loop.time(). |
| 224 | |
| 225 | If new deadline is in the past the timeout is raised immediately. |
| 226 | |
| 227 | Please note: it is not POSIX time but a time with |
| 228 | undefined starting base, e.g. the time of the system power on. |
| 229 | """ |
| 230 | if self._state == _State.EXIT: |
| 231 | raise RuntimeError("cannot reschedule after exit from context manager") |
| 232 | if self._state == _State.TIMEOUT: |
| 233 | raise RuntimeError("cannot reschedule expired timeout") |
| 234 | if self._timeout_handler is not None: |
| 235 | self._timeout_handler.cancel() |
| 236 | self._deadline = deadline |
| 237 | if self._state != _State.INIT: |
| 238 | self._reschedule() |
| 239 | |
| 240 | def _reschedule(self) -> None: |
| 241 | assert self._state == _State.ENTER |
no test coverage detected