Add missing type hints for retry.py#3250
Conversation
| backoff, | ||
| retries, | ||
| supported_errors=(ConnectionError, TimeoutError, socket.timeout), | ||
| backoff: AbstractBackoff, |
There was a problem hiding this comment.
Should AbstractBackoff be quoted here, when using if TYPE_CHECKING?
Tbh, it feels cleaner to just import AbstractBackoff always, it should not be a performance penalty.
There was a problem hiding this comment.
You're right, went ahead and quoted it: 1660336
It would be nicer to quote, just to avoid an unnecessary import which would slow down module init time.
| supported_errors=(ConnectionError, TimeoutError, socket.timeout), | ||
| backoff: AbstractBackoff, | ||
| retries: int, | ||
| supported_errors: tuple[type[Exception], ...] = ( |
There was a problem hiding this comment.
We support Python 3.8, where this is not yet available. You can use Tuple[Type[Exception], ...] and import them from typing.
There was a problem hiding this comment.
Ah yes, good catch!
|
|
||
| def update_supported_errors(self, specified_errors: list): | ||
| def update_supported_errors( | ||
| self, specified_errors: Iterable[type[Exception]] |
There was a problem hiding this comment.
Same about supporting Python 3.8.
|
@gerzse Comments should be addressed. |
Thanks @max-muoto ! Getting picky now, but I run
and it complains about |
Add missing type hints in the retry.py file and related tests.
Add missing type hints in the retry.py file and related tests.
Add missing type hints in the retry.py file and related tests. Co-authored-by: Salvatore Mesoraca <salvatore.mesoraca@aiven.io> Signed-off-by: Salvatore Mesoraca <salvatore.mesoraca@aiven.io>
Pull Request check-list
Please make sure to review and check all of these items:
NOTE: these things are not required to open a PR and can be done
afterwards / while the PR is open.
Description of change
Add missing type hints for the
retry.pymodule.