Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose typing hints as they are part of the API #205

Open
eccles opened this issue Jul 19, 2023 · 0 comments
Open

Expose typing hints as they are part of the API #205

eccles opened this issue Jul 19, 2023 · 0 comments

Comments

@eccles
Copy link

eccles commented Jul 19, 2023

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 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant