DetachHead / basedpyright

pyright fork with various type checking improvements, improved vscode support and pylance features built into the language server
https://docs.basedpyright.com
Other
1.25k stars 26 forks source link

Don't report reportUnannotatedClassAttribute for class `__slots__` attribute #860

Open ashb opened 3 weeks ago

ashb commented 3 weeks ago

For example:

class TaskInstanceOperations:
    __slots__ = ["client"]

This issues a report of

  1. Type annotation for attribute __slots__ is required because this class is not decorated with @final [reportUnannotatedClassAttribute]

I don't think I've ever seen slots annotated before, and I don't think I should have to -- it is special in python and must be Iterable[str] else it will yield a type error.

DetachHead commented 3 weeks ago

i considered that but then i realised __slots__ aren’t even checked to make sure they’re iterable let alone a valid subtype so i decided to just leave it for now until i get around to addressing #181