class documentation

class twisted.internet.task.Clock: (source)

Known subclasses: twisted.internet.testing.MemoryReactorClock

View In Hierarchy

Provide a deterministic, easily-controlled implementation of IReactorTime.callLater. This is commonly useful for writing deterministic unit tests for code which schedules events using this API.

Class Variable rightNow Undocumented
Method __init__ Undocumented
Instance Variable calls Undocumented
Method seconds Pretend to be time.time(). This is used internally when an operation such as IDelayedCall.reset needs to determine a time value relative to the current time.
Method callLater See twisted.internet.interfaces.IReactorTime.callLater.
Method getDelayedCalls See twisted.internet.interfaces.IReactorTime.getDelayedCalls
Method advance Move time on this clock forward by the given amount and run whatever pending calls should be run.
Method pump Advance incrementally by the given set of times.
Method _sortCalls Sort the pending calls according to the time they are scheduled.
rightNow = (source)

Undocumented

(type: float)
def __init__(self): (source)

Undocumented

calls = (source)

Undocumented

(type: list)
def seconds(self): (source)

Pretend to be time.time(). This is used internally when an operation such as IDelayedCall.reset needs to determine a time value relative to the current time.

ReturnsThe time which should be considered the current time. (type: float)
def _sortCalls(self): (source)

Sort the pending calls according to the time they are scheduled.

def callLater(self, delay, callable, *args, **kw): (source)

See twisted.internet.interfaces.IReactorTime.callLater.

ParametersdelayUndocumented
callableUndocumented (type: Callable[..., Any])
argsUndocumented
kwUndocumented
def advance(self, amount): (source)

Move time on this clock forward by the given amount and run whatever pending calls should be run.

ParametersamountThe number of seconds which to advance this clock's time. (type: float)
def pump(self, timings): (source)

Advance incrementally by the given set of times.

ParameterstimingsUndocumented (type: iterable of float)
API Documentation for Twisted, generated by pydoctor 20.12.1 at 2021-02-28 19:53:36.