quart-cors
quart-cors copied to clipboard
Lint Failure when using @route_cors
I have the following python code (python 3.10, quart 0.19.3, quart-cors 0.7.0)
@app.route("/example")
@route_cors(
allow_headers=["content-type"],
allow_methods=["GET"],
allow_origin=["*"],
)
async def config():
return jsonify({"type": "example"})
And this emits the following linting/typing error:
Argument of type "() -> Coroutine[Any, Any, Response]" cannot be assigned to parameter of type "(**P@route_cors) -> ResponseReturnValue"
Type "() -> Coroutine[Any, Any, Response]" cannot be assigned to type "(**P@route_cors) -> ResponseReturnValue"
Function return type "Coroutine[Any, Any, Response]" is incompatible with type "ResponseReturnValue"
Type "Coroutine[Any, Any, Response]" cannot be assigned to type "ResponseReturnValue"
"Coroutine[Any, Any, Response]" is incompatible with "Response"
"Coroutine[Any, Any, Response]" is incompatible with "Response"
"Coroutine[Any, Any, Response]" is incompatible with "bytes"
"Coroutine[Any, Any, Response]" is incompatible with "str"
"Coroutine[Any, Any, Response]" is incompatible with "Mapping[str, Any]"
I don't have a good solution for this, see https://github.com/python/mypy/issues/16282