mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-30 22:01:47 +00:00
[numpy] Update NPY201: add np.NAN
to exception (#12292)
Co-authored-by: Micha Reiser <micha@reiser.io>
This commit is contained in:
parent
b6545ce5d6
commit
17e84d5f40
3 changed files with 23 additions and 2 deletions
|
@ -68,3 +68,5 @@ def func():
|
||||||
np.longfloat(12+34j)
|
np.longfloat(12+34j)
|
||||||
|
|
||||||
np.lookfor
|
np.lookfor
|
||||||
|
|
||||||
|
np.NAN
|
||||||
|
|
|
@ -380,8 +380,8 @@ pub(crate) fn numpy_2_0_deprecation(checker: &mut Checker, expr: &Expr) {
|
||||||
guideline: None,
|
guideline: None,
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
["numpy", "NaN"] => Some(Replacement {
|
["numpy", existing @ ("NaN" | "NAN")] => Some(Replacement {
|
||||||
existing: "NaN",
|
existing,
|
||||||
details: Details::AutoImport {
|
details: Details::AutoImport {
|
||||||
path: "numpy",
|
path: "numpy",
|
||||||
name: "nan",
|
name: "nan",
|
||||||
|
|
|
@ -552,6 +552,7 @@ NPY201.py:68:5: NPY201 [*] `np.longfloat` will be removed in NumPy 2.0. Use `num
|
||||||
68 |+ np.longdouble(12+34j)
|
68 |+ np.longdouble(12+34j)
|
||||||
69 69 |
|
69 69 |
|
||||||
70 70 | np.lookfor
|
70 70 | np.lookfor
|
||||||
|
71 71 |
|
||||||
|
|
||||||
NPY201.py:70:5: NPY201 `np.lookfor` will be removed in NumPy 2.0. Search NumPy’s documentation directly.
|
NPY201.py:70:5: NPY201 `np.lookfor` will be removed in NumPy 2.0. Search NumPy’s documentation directly.
|
||||||
|
|
|
|
||||||
|
@ -559,4 +560,22 @@ NPY201.py:70:5: NPY201 `np.lookfor` will be removed in NumPy 2.0. Search NumPy
|
||||||
69 |
|
69 |
|
||||||
70 | np.lookfor
|
70 | np.lookfor
|
||||||
| ^^^^^^^^^^ NPY201
|
| ^^^^^^^^^^ NPY201
|
||||||
|
71 |
|
||||||
|
72 | np.NAN
|
||||||
|
|
|
|
||||||
|
|
||||||
|
NPY201.py:72:5: NPY201 [*] `np.NAN` will be removed in NumPy 2.0. Use `numpy.nan` instead.
|
||||||
|
|
|
||||||
|
70 | np.lookfor
|
||||||
|
71 |
|
||||||
|
72 | np.NAN
|
||||||
|
| ^^^^^^ NPY201
|
||||||
|
|
|
||||||
|
= help: Replace with `numpy.nan`
|
||||||
|
|
||||||
|
ℹ Safe fix
|
||||||
|
69 69 |
|
||||||
|
70 70 | np.lookfor
|
||||||
|
71 71 |
|
||||||
|
72 |- np.NAN
|
||||||
|
72 |+ np.nan
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue