Назад к задачамПолучайте помощь с лайвкодингом в реальном времени с Sobes Copilot
Junior — Senior
7
Throttle execution frequency of an arbitrary function
Условие задачи
Create a decorator that limits how often a given callable can be invoked. The time window (in seconds) is passed to the decorator as an argument. If the wrapped function is called again before the specified interval has passed, the decorator must raise a CalledTooOftenError. The decorator should be generic, work with any callable, and preserve the original function's signature.
def sample_func():
print('foo')