ape.parts.sleep.sleep.TheBigSleep

class ape.parts.sleep.sleep.TheBigSleep(end=None, total=None, interval=1, verbose=True)

A sleeper

The Big Sleep’s constructor

Param:
  • end: a datetime object set for the end of the sleep
  • total: A timedelta set for the length of the sleep
  • interval: seconds between printing status
  • verbose: if True (default), print time-remaining at intervals
__init__(end=None, total=None, interval=1, verbose=True)

The Big Sleep’s constructor

Param:
  • end: a datetime object set for the end of the sleep
  • total: A timedelta set for the length of the sleep
  • interval: seconds between printing status
  • verbose: if True (default), print time-remaining at intervals

Methods

__init__([end, total, interval, verbose]) The Big Sleep’s constructor
emit(*args, **kwargs)
log_error(error[, message]) Logs the error in bold red

Attributes

end end datetime
logger
return:A logging object.
then the stopping-time
timer An EventTimer for the wait decorator
total Timedelta representing relative time in the future to stop
zero A zero timedelta
check_rep()

Checks the paramaters

Raise:ApeError if mis-configured
close()

Closes the timer, sets self.then to 0.

log_error(error, message='')

Logs the error in bold red

Param:
  • error: error type (prefix in red and bold)
  • message: descriptive message (red but not bold)
end

end datetime

Returns:datetime to stop
logger
Returns:A logging object.
minus_one

A -1 timedelta

Returns:timedelta that subtracts one second when added to another
then

the stopping-time

Returns:datetime set to future stop-time
Raise:ApeError if neither end nor total is set
timer

An EventTimer for the wait decorator

Returns:EventTimer with interval set to self.interval
total

Timedelta representing relative time in the future to stop

Returns:timedelta to stop in the future or None
zero

A zero timedelta

Returns:timedelta(0)

Navigation