litl / backoff

Python library providing function decorators for configurable backoff and retry
MIT License
2.61k stars 148 forks source link

2.2.0 release gives type errors for previously valid usage? #177

Closed salimfadhley closed 2 years ago

salimfadhley commented 2 years ago

Given this codee: @backoff.on_exception(wait_gen=backoff.expo, exception=requests.exceptions.HTTPError, max_tries=10)

We now get these validation errors from mypy:

11: error: Argument "wait_gen" to "on_exception" has incompatible type "Callable[[float, float, Optional[float]], Generator[Optional[float], Any, None]]"; expected "Callable[..., Generator[float, None, None]]"
10: error: Argument 1 to "on_exception" has incompatible type "Callable[[float, float, Optional[float]], Generator[Optional[float], Any, None]]"; expected "Callable[..., Generator[float, None, None]]"
11: error: Argument 1 to "on_exception" has incompatible type "Callable[[float, float, Optional[float]], Generator[Optional[float], Any, None]]"; expected "Callable[..., Generator[float, None, None]]"
11: error: Argument 1 to "on_exception" has incompatible type "Callable[[float, float, Optional[float]], Generator[Optional[float], Any, None]]"; expected "Callable[..., Generator[float, None, None]]"
bgreen-litl commented 2 years ago

Thanks. Fixed and released as backoff v2.2.1