Open
Description
Bug Report
Slot definition in a form of __slots__ = []
raise an error:
ex.py:2: error: Need type annotation for "__slots__" (hint: "__slots__: List[<type>] = ...")
To Reproduce
Run mypy
on this code:
class A:
__slots__ = []
Expected Behavior
I expect it to have the same effect as:
class A:
__slots__ = ()
and to produce no errors.
Moreover, mypy
already knows that __slots__
should contain str
items only as shown here:
class A:
__slots__ = [1, 2]
Outputs:
ex.py:2: error: List item 0 has incompatible type "int"; expected "str"
ex.py:2: error: List item 1 has incompatible type "int"; expected "str"
Refs Textualize/rich#1364