ruff
248231e9 - [`flake8-simplify`] Avoid redundant `bool` wrappers in `SIM208` fixes (#30457)

Commit
1 day ago
[`flake8-simplify`] Avoid redundant `bool` wrappers in `SIM208` fixes (#30457) ## Summary Closes #30414. Outside a boolean context, the `SIM208` fix rewrites `not not x` to `bool(x)`. It did this even when the operand is already a `bool`, so `not not x in y` became `bool(x in y)` and `not not bool(x)` became `bool(bool(x))`. The fix now leaves out the wrapper when the operand always evaluates to a `bool` ## Notes to reviewers I wrote the original `SIM208` implementation in #1666 (under my work account then), which is why I picked this one up. #30417 attempted the same issue but was closed. This PR differs from it in two ways: - it does not treat every comparison as a `bool` (see above), - it does not include the unrelated `F401` change. --------- Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
Author
Parents
Loading