Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C1901 leads to false positives with numpy (as well) #4115

Closed
mmarras opened this issue Apr 26, 2023 · 1 comment
Closed

C1901 leads to false positives with numpy (as well) #4115

mmarras opened this issue Apr 26, 2023 · 1 comment
Labels
bug Something isn't working type-inference Requires more advanced type inference.

Comments

@mmarras
Copy link

mmarras commented Apr 26, 2023

Related to #3517: C1901 leads to false positives with numpy as well.

desc = np.array(("","",""))
np.all(desc == "")  # is valid
np.all(not desc) # is not valid

ruff 0.0263

PLC1901 desc == "" can be simplified to not desc as an empty string is falsey

The statment "can be simplified to not desc" is wrong.

@charliermarsh charliermarsh added bug Something isn't working type-inference Requires more advanced type inference. labels Apr 26, 2023
@charliermarsh
Copy link
Member

We made this rule require explicit opt-in, so closing for now.

@charliermarsh charliermarsh closed this as not planned Won't fix, can't repro, duplicate, stale Jun 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working type-inference Requires more advanced type inference.
Projects
None yet
Development

No branches or pull requests

2 participants