Flag all comparisons against builtin types in E721#8491
Flag all comparisons against builtin types in E721#8491charliermarsh merged 5 commits intoastral-sh:mainfrom
Conversation
See astral-sh#8483. Generalised fix on top of astral-sh#8485 Based on the output of `print("\n".join(k for k, v in builtins.__dict__.items() if isinstance(v, type)))`
|
| code | total | + violation | - violation | + fix | - fix |
|---|---|---|---|---|---|
| E721 | 222 | 222 | 0 | 0 | 0 |
|
Nice, thanks -- this looks reasonable to me. |
|
I'm wondering if this should be part of preview. What do you think @zanieb? It doesn't change the intent of the rule, but it will lead to more violations. (And for some of these, there isn't a great workaround right now, since we don't accept |
|
I'd be in favour of only landing this change in stable once #7905 is in stable |
| | "UserWarning" | ||
| | "ValueError" | ||
| | "Warning" | ||
| | "ZeroDivisionError" |
There was a problem hiding this comment.
Let's revert this change (but keep the change in the other matches! below).
|
@hauntsaninja -- Yeah same. That would be equivalent to reverting this change in the |
See #8483. Generalised fix on top of #8485
Based on the output of
print("\n".join(k for k, v in builtins.__dict__.items() if isinstance(v, type)))