trame.utils.exec module

class trame.utils.exec.Throttle(fn, ts=1)

Bases: object

Helper class that wrap a function with a given max execution rate. By default the rate is set to execute no more than once a second.

Parameters:
  • fn (function) – the function to call.

  • ts (float) – Number of seconds to wait before the next execution.

property rate

Number of maximum executions per second

property delta_t

Number of seconds to wait between execution