def callLater(self, when, what, *a, **kw): """ See L{twisted.internet.interfaces.IReactorTime.callLater}. """ dc = base.DelayedCall(self.seconds() + when, what, a, kw, lambda c: None, lambda c: None, self.seconds) heapq.heappush(self.calls, (dc.getTime(), dc)) return dc
def callLater(self, when, what, *a, **kw): """ See L{twisted.internet.interfaces.IReactorTime.callLater}. """ dc = base.DelayedCall(self.seconds() + when, what, a, kw, self.calls.remove, lambda c: None, self.seconds) self.calls.append(dc) self.calls.sort(lambda a, b: cmp(a.getTime(), b.getTime())) return dc
def callLater(self, delay, callable: Callable[..., Any], *args, **kw): """ See L{twisted.internet.interfaces.IReactorTime.callLater}. """ dc = base.DelayedCall(self.seconds() + delay, callable, args, kw, self.calls.remove, lambda c: None, self.seconds) self.calls.append(dc) self._sortCalls() return dc
def callLater(self, when, what, *a, **kw): """ See L{twisted.internet.interfaces.IReactorTime.callLater}. """ dc = base.DelayedCall(self.seconds() + when, what, a, kw, self._cancelCallLater, lambda c: None, self.seconds) self._new_calls.append(dc) return dc
def callLater(self, when, what, *a, **kw): """ Copied from twisted.internet.task.Clock, r20480. Fixes the bug where the wrong DelayedCall would sometimes be returned. """ dc = base.DelayedCall(self.seconds() + when, what, a, kw, self.calls.remove, lambda c: None, self.seconds) self.calls.append(dc) self.calls.sort(lambda a, b: cmp(a.getTime(), b.getTime())) return dc
def testDelayedCallSecondsOverride(self): """ Test that the C{seconds} argument to DelayedCall gets used instead of the default timing function, if it is not None. """ def seconds(): return 10 dc = base.DelayedCall(5, lambda: None, (), {}, lambda dc: None, lambda dc: None, seconds) self.assertEqual(dc.getTime(), 5) dc.reset(3) self.assertEqual(dc.getTime(), 13)
def callLater(n, f, *a, **kw): c = base.DelayedCall(self.currentTime + n, f, a, kw, canceller, resetter, seconds) self.sched.append(c) return c