1

I'm an "old" Python programmer (several years) but I'm relatively new to the principle of type hinting in this language.

So as I convert the convert the code of a project to use type hints my linter (flake8) gives me an error that I don't understand. Here is an example of code and the concrete error :

from models.models import MetahubModel
from typing import Tuple

class AttributeModel(MetahubModel):
    ...

    @classmethod
    def add_with_value(
        cls, name: str, value_name: str
    ) -> Tuple[AttributeModel, AttributeValueModel]:
        pass

class AttributeValueModel(MetahubModel):
    ...

The error from the linter is this one : F821:undefined name 'AttributeModel' F821:undefined name 'AttributeValueModel'

Can someone explain me why I get this ? The class is correctly defined, isn't it ?

Thank you for your help

lauevrar77
  • 21
  • 2

0 Answers0