You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, Y019 is quite conservative: it only suggests using _typeshed.Self if the method is already using a TypeVar. But there are other common mistakes that we could easily look for in another error code, many of which were highlighted by python/typeshed#7070, where users will often hardcode class names in the return type, but they should really be using a TypeVar:
__new__ methods.
__(a)iter__ methods if the class inherits from typing.Iterator or collections.abc.Iterator.
__(a)enter__ methods.
Maybe classmethods that have names starting with from_ (e.g. int.from_bytes, str.from_hex, etc)
Any others?
Some of these might be noisier than others, but I'd like to try it out and see what the signal-to-noise ratio is like.