Skip to content

[numpy] Update NPY201: add np.NAN to exception#12292

Merged
MichaReiser merged 3 commits intoastral-sh:mainfrom
xmatthias:fix/npy201_NAN
Jul 12, 2024
Merged

[numpy] Update NPY201: add np.NAN to exception#12292
MichaReiser merged 3 commits intoastral-sh:mainfrom
xmatthias:fix/npy201_NAN

Conversation

@xmatthias
Copy link
Copy Markdown
Contributor

Summary

np.NAN was also deprecated / removed, as reported in #12195.

Personally, i'd also wan't to have warnings for from numpy import nan, NaN, NAN (NAN and NaN shouldn't import as they've been removed) - but that's really out of my league - as there's no similar case at the moment (at least not in the NPY201 section).
Obviously, this would "also" apply to essentially all other cases of deprecations.

Test Plan

Added testcase, manual test


np.lookfor

np.NAN
Copy link
Copy Markdown
Contributor Author

@xmatthias xmatthias Jul 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this could also be moved next to np.NaN - which i'd find more appealing as it'd really belong there - but i found the diff on the .snap file to be rather large - as it changes all subsequent line numbers...

let me know if you'd prefer that

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think either is fine.

@MichaReiser
Copy link
Copy Markdown
Member

Personally, i'd also wan't to have warnings for from numpy import nan, NaN, NAN (NAN and NaN shouldn't import as they've been removed) - but that's really out of my league - as there's no similar case at the moment (at least not in the NPY201 section).

That makes sense. I think that's best tackled as a separate pr

@MichaReiser MichaReiser added the rule Implementing or modifying a lint rule label Jul 12, 2024
@MichaReiser MichaReiser changed the title [numpy] Update NPY201: add np.NAN to exception [numpy] Update NPY201: add np.NAN to exception Jul 12, 2024
@MichaReiser
Copy link
Copy Markdown
Member

Thank you!

@MichaReiser MichaReiser enabled auto-merge (squash) July 12, 2024 12:06
@MichaReiser MichaReiser merged commit 17e84d5 into astral-sh:main Jul 12, 2024
@xmatthias xmatthias deleted the fix/npy201_NAN branch July 12, 2024 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rule Implementing or modifying a lint rule

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants