jztools.general#

Classes

Debouncer(delay)

Ensures that a callable is executed only if a given delay has elapsed since the last call.

Exceptions

NotSingleEntry(num_entries)

exception jztools.general.NotSingleEntry(num_entries)#

Bases: Exception

class jztools.general.Debouncer(delay: float)#

Bases: object

Ensures that a callable is executed only if a given delay has elapsed since the last call.

from jztools.general import Debouncer

def fxn():
    print('Executed')

debouncer = Debouncer(5)

debouncer.call(fxn)
debouncer.call(fxn)
Executed
Parameters:

delay – Seconds to wait before permitting the next execution.

__call__(fxn: Callable)#

Call self as a function.