duck.utils.timer

Timer Utility module for scheduling callables.

Module Contents

Classes

OverlappingTimer

This Timer Utility stops all running threads scheduled with the use of this class and then runs the new schedule in a new thread.

SharedOverlappingTimer

This Timer Utility stop all running threads scheduled with the use of this class and then runs the new schedule in a new thread.

Timer

Timer Utility for callables scheduling.

TimerThreadPool

API

class duck.utils.timer.OverlappingTimer[source]

This Timer Utility stops all running threads scheduled with the use of this class and then runs the new schedule in a new thread.

NOTE: This only share threads from an initialized object.

Initialization

static _schedule(function: callable, seconds: int) None[source]
static _schedule_interval(function: callable, seconds: int) None[source]
get_running_thread()[source]

Get the latest thread that was created when using any of the methods (schedule or schedule_interval).

WARNING:# If the latest thread is done running, None will be returned

schedule(function: callable, seconds: int)[source]
schedule_interval(function: callable, seconds: int)[source]
class duck.utils.timer.SharedOverlappingTimer[source]

This Timer Utility stop all running threads scheduled with the use of this class and then runs the new schedule in a new thread.

NOTE: This shares all threads from this class

static _schedule(function: callable, seconds: int) None[source]
static _schedule_interval(function: callable, seconds: int) None[source]
all_threads: list[threading.Thread]

[]

List of all threads scheduled.

get_running_thread()[source]

Get the latest thread that was created when using any of the methods (schedule or schedule_interval).

WARNING: If the latest thread is done running, None will be returned

schedule(function: callable, seconds: int)[source]
schedule_interval(function: callable, seconds: int)[source]
class duck.utils.timer.Timer[source]

Timer Utility for callables scheduling.

classmethod _schedule(function: callable, seconds: int)[source]
classmethod _schedule_interval(function: callable, seconds: int)[source]
all_threads: list[threading.Thread]

[]

List of all alive or dead threads scheduled.

classmethod schedule(function: callable, seconds: int)[source]
classmethod schedule_interval(function: callable, seconds: int)[source]
class duck.utils.timer.TimerThreadPool[source]
all: list

[]

List of all threads added through the use of any `Timerˋ class.