Closed
Description
Running mypy 0.740 with check_untyped_defs = True
gives a false positive
mypy_bug.py:12: error: "Callable[[AbstractBase], Dict[Any, Any]]" has no attribute "values"
when running against the code below:
from abc import ABC, abstractmethod
class AbstractBase(ABC):
@property
@abstractmethod
def SOME_DICT(self) -> dict:
pass
@classmethod
def get_dict_values(cls):
return cls.SOME_DICT.values()
class Implementation(AbstractBase):
SOME_DICT = {"some": "data"}
Mypy thinks that the value of cls.SOME_DICT
on line 12 is Callable[[AbstractBase], Dict[Any, Any]]
, even though it is a property, typehinted to be dict
.
Metadata
Metadata
Assignees
Labels
No labels