Skip to content

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

Open
@eccles

Description

@eccles

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 ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions