Improve redis.retry types (#8354)

This commit is contained in:
Nikita Sobolev
2022-07-21 18:51:13 +03:00
committed by GitHub
parent 9fe771f31d
commit 6ae2da64e6

View File

@@ -1,6 +1,11 @@
from collections.abc import Iterable
from collections.abc import Callable, Iterable
from typing import TypeVar
from redis.backoff import AbstractBackoff
_T = TypeVar("_T")
class Retry:
def __init__(self, backoff, retries, supported_errors=...) -> None: ...
def update_supported_errors(self, specified_errors: Iterable[Exception]) -> None: ...
def call_with_retry(self, do, fail): ...
def __init__(self, backoff: AbstractBackoff, retries: int, supported_errors: tuple[type[Exception], ...] = ...) -> None: ...
def update_supported_errors(self, specified_errors: Iterable[type[Exception]]) -> None: ...
def call_with_retry(self, do: Callable[[], _T], fail: Callable[[Exception], object]) -> _T: ...