When using flask.abort() (which ultimately throws an exception through Werkzeug), mypy fails because it can't see it will result in an exception:
error: Missing return statement
Is there a way to hint mypy that this will end in an exception so it should regard it as that?
Mypy needs the typing.NoReturn
return type annotation on abort()
to understand the situation. For that you need to install the separate types-Werkzeug
package:
pip install types-Werkzeug