Here are the examples of the python api twisted.internet.error.AlreadyCancelled taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
7 Examples
3
Source : test_internet.py
with MIT License
from autofelix
with MIT License
from autofelix
def test_cancelCancelledDelayedCall(self):
"""
Test that cancelling a DelayedCall which has already been cancelled
raises the appropriate exception.
"""
call = reactor.callLater(0, lambda: None)
call.cancel()
self.assertRaises(error.AlreadyCancelled, call.cancel)
def test_cancelCalledDelayedCallSynchronous(self):
0
Source : base.py
with MIT License
from autofelix
with MIT License
from autofelix
def cancel(self):
"""Unschedule this call
@raise AlreadyCancelled: Raised if this call has already been
unscheduled.
@raise AlreadyCalled: Raised if this call has already been made.
"""
if self.cancelled:
raise error.AlreadyCancelled
elif self.called:
raise error.AlreadyCalled
else:
self.canceller(self)
self.cancelled = 1
if self.debug:
self._repr = repr(self)
del self.func, self.args, self.kw
def reset(self, secondsFromNow):
0
Source : base.py
with MIT License
from autofelix
with MIT License
from autofelix
def reset(self, secondsFromNow):
"""Reschedule this call for a different time
@type secondsFromNow: C{float}
@param secondsFromNow: The number of seconds from the time of the
C{reset} call at which this call will be scheduled.
@raise AlreadyCancelled: Raised if this call has been cancelled.
@raise AlreadyCalled: Raised if this call has already been made.
"""
if self.cancelled:
raise error.AlreadyCancelled
elif self.called:
raise error.AlreadyCalled
else:
newTime = self.seconds() + secondsFromNow
if newTime < self.time:
self.delayed_time = 0
self.time = newTime
self.resetter(self)
else:
self.delayed_time = newTime - self.time
def delay(self, secondsLater):
0
Source : base.py
with MIT License
from autofelix
with MIT License
from autofelix
def delay(self, secondsLater):
"""Reschedule this call for a later time
@type secondsLater: C{float}
@param secondsLater: The number of seconds after the originally
scheduled time for which to reschedule this call.
@raise AlreadyCancelled: Raised if this call has been cancelled.
@raise AlreadyCalled: Raised if this call has already been made.
"""
if self.cancelled:
raise error.AlreadyCancelled
elif self.called:
raise error.AlreadyCalled
else:
self.delayed_time += secondsLater
if self.delayed_time < 0:
self.activate_delay()
self.resetter(self)
def activate_delay(self):
0
Source : policies.py
with MIT License
from autofelix
with MIT License
from autofelix
def setTimeout(self, period):
"""
Change the timeout period
@type period: C{int} or L{None}
@param period: The period, in seconds, to change the timeout to, or
L{None} to disable the timeout.
"""
prev = self.timeOut
self.timeOut = period
if self.__timeoutCall is not None:
if period is None:
try:
self.__timeoutCall.cancel()
except (error.AlreadyCancelled, error.AlreadyCalled):
# Do nothing if the call was already consumed.
pass
self.__timeoutCall = None
else:
self.__timeoutCall.reset(period)
elif period is not None:
self.__timeoutCall = self.callLater(period, self.__timedOut)
return prev
def __timedOut(self):
0
Source : base.py
with MIT License
from fbla-competitive-events
with MIT License
from fbla-competitive-events
def cancel(self):
"""Unschedule this call
@raise AlreadyCancelled: Raised if this call has already been
unscheduled.
@raise AlreadyCalled: Raised if this call has already been made.
"""
if self.cancelled:
raise error.AlreadyCancelled
elif self.called:
raise error.AlreadyCalled
else:
self.canceller(self)
self.cancelled = 1
if self.debug:
self._str = bytes(self)
del self.func, self.args, self.kw
def reset(self, secondsFromNow):
0
Source : base.py
with Apache License 2.0
from lynings
with Apache License 2.0
from lynings
def cancel(self):
"""Unschedule this call
@raise AlreadyCancelled: Raised if this call has already been
unscheduled.
@raise AlreadyCalled: Raised if this call has already been made.
"""
if self.cancelled:
raise error.AlreadyCancelled
elif self.called:
raise error.AlreadyCalled
else:
self.canceller(self)
self.cancelled = 1
if self.debug:
self._str = str(self)
del self.func, self.args, self.kw
def reset(self, secondsFromNow):