backoff
backoff copied to clipboard
Expose typing hints as they are part of the API
Just recently upgraded to 2.2.1 from 1.11 and pyright gave me lots of type hint errors.
/home/builder/archivist/confirmer.py
/home/builder/archivist/confirmer.py:84:15 - error: Argument of type "(details: dict[str, Any]) -> NoReturn" cannot be assigned to parameter "on_giveup" of type "_Handler | Iterable[_Handler]" in function "on_predicate"
Type "(details: dict[str, Any]) -> NoReturn" cannot be assigned to type "_Handler | Iterable[_Handler]"
Type "(details: dict[str, Any]) -> NoReturn" cannot be assigned to type "_Handler"
Parameter 1: type "Details" cannot be assigned to type "dict[str, Any]"
"Details" is incompatible with "dict[str, Any]"
"function" is incompatible with protocol "Iterable[_Handler]"
"_iter_" is not present (reportGeneralTypeIssues)
/home/builder/archivist/confirmer.py:122:15 - error: Argument of type "(details: dict[str, Any]) -> NoReturn" cannot be assigned to parameter "on_giveup" of type "_Handler | Iterable[_Handler]" in function "on_predicate"
Type "(details: dict[str, Any]) -> NoReturn" cannot be assigned to type "_Handler | Iterable[_Handler]"
Type "(details: dict[str, Any]) -> NoReturn" cannot be assigned to type "_Handler"
Parameter 1: type "Details" cannot be assigned to type "dict[str, Any]"
"Details" is incompatible with "dict[str, Any]"
"function" is incompatible with protocol "Iterable[_Handler]"
"_iter_" is not present (reportGeneralTypeIssues)
In order to fix this I had to import a private directory viz:
from backoff._typing import Details
Surely type hints are part of the API and should not be private ?