-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
NPY201 rules seem to miss imports for NAN #12195
Comments
Thanks for reporting this. I just checked the numpy release notes and they only mention the deprecation of Do you have a link to documentation saying that In case you're interested to PR a fix. PR is a good example on how to add new NUMPY deprecations. |
not official documentation as much - but numpy/numpy#26741 - and the pr actually removing both the NaN, as well as the NAN alias (https://github.com/numpy/numpy/pull/24376/files - search for It's not in the release notes - but from actually trying it out - it's clear that it's been removed. |
Closed by #12292. |
@charliermarsh i tend to disagree. As mentioned in the PR, the case of Let me know if you'd prefer me to open a new issue for that, though its very closely related to this issue, as i reported both problems together. |
@xmatthias -- You're saying that we should also catch |
yeah essentially exactly that it's deprecated / removed from numpy just as NaN ... just ruff isn't warning it.
Works for me - will open one 👍 |
Thanks! |
mmmh, i realize now (while recreating code for the new issue) that while the import doesn't warn - usage does - so never mind 👍 |
Using the following test file should show multiple deprecation warnings - but only shows one while using ruff 0.5.0 (the latest afaik).
ruff check test_npy.py --preview --select NPY2
In reality, np.NAN is also not valid, so should raise an error, too.
Also, explicit imports (not used through
np.xxx
) seem to be completely ignored ...Neither is
from numpy import NaN, NAN
(onlyfrom numpy import nan
is still valid for numpy2.0).The text was updated successfully, but these errors were encountered: