flask-restx icon indicating copy to clipboard operation
flask-restx copied to clipboard

Base type Resource becomes 'Any' due to an unfollowed import

Open Luiz-Cruz opened this issue 2 years ago • 0 comments

Hey Guys, im using mypy in my project and i have a question...

how can i fix the error message: "Base type Resource becomes 'Any' due to an unfollowed import" by the following code?

from flask_restx import Resource
@router.route("/", endpoint="main")
class Seasonality(Resource):
        def post(self)-> str:
               return "Works"

According to the Mypy doc I would have to type the "Resource" but it is a class, and what I get in this class is an object of a class, I tried with Type[Resource] but when I did it this way I get the error invalid base class "Type" [misc]...

I asked the question in an issue of the Mypy Repository, but it was suggested I talk to you guys at flask_restx about your PEP 561 type hints.

Luiz-Cruz avatar Jan 03 '23 22:01 Luiz-Cruz