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
[pycodestyle] Allow dtype comparisons in type-comparison (#9676)
## Summary
Per #9570:
> `dtype` are a bit of a strange beast, but definitely best thought of
as instances, not classes, and they are meant to be comparable not just
to their own class, but also to the corresponding scalar types (e.g.,
`x.dtype == np.float32`) and strings (e.g., `x.dtype == ['i1,i4']`;
basically, `__eq__` always tries to do `dtype(other)`.
This PR thus allows comparisons to `dtype` in preview.
Closes#9570.
## Test Plan
`cargo test`
Copy file name to clipboardexpand all lines: crates/ruff_linter/src/rules/pycodestyle/snapshots/ruff_linter__rules__pycodestyle__tests__preview__E721_E721.py.snap
+7
Original file line number
Diff line number
Diff line change
@@ -129,4 +129,11 @@ E721.py:59:4: E721 Use `is` and `is not` for type comparisons, or `isinstance()`
129
129
61| #: Okay
130
130
|
131
131
132
+
E721.py:140:1: E721Use`is`and`is not`fortypecomparisons, or `isinstance()` forisinstancechecks
0 commit comments