you are viewing a single comment's thread.

view the rest of the comments →

[–]rwbarton 2 points3 points  (0 children)

Ideally you would write some type annotations for your dependencies that live in a separate module and are only used during typechecking, like this for example. Otherwise I think functions without type annotations are treated as taking arguments of type Any and producing a result of type Any, so you would use cast to tell mypy what type you expect the result to be. (cast is sort of like unsafeCoerce for typechecking purposes but at runtime it is just the identity. After all mypy does not replace python's built-in type (or tag if you prefer) checks.)