(func: Callable)
| 333 | """ |
| 334 | |
| 335 | def decorator(func: Callable): |
| 336 | @wraps(func) |
| 337 | def wrapper(*args, **kwargs): |
| 338 | sleep_time = backoff_time |
| 339 | attempt = 0 |
| 340 | while max_retries is None or attempt < max_retries: |
| 341 | try: |
| 342 | return func(*args, **kwargs) |
| 343 | except tuple(on_exceptions) as e: |
| 344 | if on_exception_callback is not None: |
| 345 | on_exception_callback(e, sleep_time) |
| 346 | time.sleep(sleep_time) |
| 347 | sleep_time *= backoff_multiplier |
| 348 | attempt += 1 |
| 349 | |
| 350 | return wrapper |
| 351 | |
| 352 | return decorator |
| 353 |
nothing calls this directly
no outgoing calls
no test coverage detected