---
source: crates/ruff_linter/src/rules/numpy/mod.rs
snapshot_kind: text
---
NPY201_3.py:4:5: NPY201 [*] `np.DTypePromotionError` will be removed in NumPy 2.0. Use `numpy.exceptions.DTypePromotionError` instead.
  |
2 |     import numpy as np
3 | 
4 |     np.DTypePromotionError
  |     ^^^^^^^^^^^^^^^^^^^^^^ NPY201
5 | 
6 |     np.ModuleDeprecationWarning
  |
  = help: Replace with `numpy.exceptions.DTypePromotionError`

ℹ Safe fix
  1 |+from numpy.exceptions import DTypePromotionError
1 2 | def func():
2 3 |     import numpy as np
3 4 | 
4   |-    np.DTypePromotionError
  5 |+    DTypePromotionError
5 6 | 
6 7 |     np.ModuleDeprecationWarning
7 8 | 

NPY201_3.py:6:5: NPY201 [*] `np.ModuleDeprecationWarning` will be removed in NumPy 2.0. Use `numpy.exceptions.ModuleDeprecationWarning` instead.
  |
4 |     np.DTypePromotionError
5 | 
6 |     np.ModuleDeprecationWarning
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^ NPY201
7 | 
8 |     np.RankWarning
  |
  = help: Replace with `numpy.exceptions.ModuleDeprecationWarning`

ℹ Safe fix
  1 |+from numpy.exceptions import ModuleDeprecationWarning
1 2 | def func():
2 3 |     import numpy as np
3 4 | 
4 5 |     np.DTypePromotionError
5 6 | 
6   |-    np.ModuleDeprecationWarning
  7 |+    ModuleDeprecationWarning
7 8 | 
8 9 |     np.RankWarning
9 10 | 

NPY201_3.py:8:5: NPY201 [*] `np.RankWarning` will be removed in NumPy 2.0. Use `numpy.exceptions.RankWarning` on NumPy 2.0, or ignore this warning on earlier versions.
   |
 6 |     np.ModuleDeprecationWarning
 7 | 
 8 |     np.RankWarning
   |     ^^^^^^^^^^^^^^ NPY201
 9 | 
10 |     np.TooHardError
   |
   = help: Replace with `numpy.exceptions.RankWarning` (requires NumPy 2.0 or greater)

ℹ Unsafe fix
   1  |+from numpy.exceptions import RankWarning
1  2  | def func():
2  3  |     import numpy as np
3  4  | 
--------------------------------------------------------------------------------
5  6  | 
6  7  |     np.ModuleDeprecationWarning
7  8  | 
8     |-    np.RankWarning
   9  |+    RankWarning
9  10 | 
10 11 |     np.TooHardError
11 12 | 

NPY201_3.py:10:5: NPY201 [*] `np.TooHardError` will be removed in NumPy 2.0. Use `numpy.exceptions.TooHardError` instead.
   |
 8 |     np.RankWarning
 9 | 
10 |     np.TooHardError
   |     ^^^^^^^^^^^^^^^ NPY201
11 | 
12 |     np.VisibleDeprecationWarning
   |
   = help: Replace with `numpy.exceptions.TooHardError`

ℹ Safe fix
   1  |+from numpy.exceptions import TooHardError
1  2  | def func():
2  3  |     import numpy as np
3  4  | 
--------------------------------------------------------------------------------
7  8  | 
8  9  |     np.RankWarning
9  10 | 
10    |-    np.TooHardError
   11 |+    TooHardError
11 12 | 
12 13 |     np.VisibleDeprecationWarning
13 14 | 

NPY201_3.py:12:5: NPY201 [*] `np.VisibleDeprecationWarning` will be removed in NumPy 2.0. Use `numpy.exceptions.VisibleDeprecationWarning` instead.
   |
10 |     np.TooHardError
11 | 
12 |     np.VisibleDeprecationWarning
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ NPY201
13 | 
14 |     np.chararray
   |
   = help: Replace with `numpy.exceptions.VisibleDeprecationWarning`

ℹ Safe fix
   1  |+from numpy.exceptions import VisibleDeprecationWarning
1  2  | def func():
2  3  |     import numpy as np
3  4  | 
--------------------------------------------------------------------------------
9  10 | 
10 11 |     np.TooHardError
11 12 | 
12    |-    np.VisibleDeprecationWarning
   13 |+    VisibleDeprecationWarning
13 14 | 
14 15 |     np.chararray
15 16 | 

NPY201_3.py:14:5: NPY201 [*] `np.chararray` will be removed in NumPy 2.0. Use `numpy.char.chararray` instead.
   |
12 |     np.VisibleDeprecationWarning
13 | 
14 |     np.chararray
   |     ^^^^^^^^^^^^ NPY201
15 | 
16 |     np.format_parser
   |
   = help: Replace with `numpy.char.chararray`

ℹ Safe fix
   1  |+from numpy.char import chararray
1  2  | def func():
2  3  |     import numpy as np
3  4  | 
--------------------------------------------------------------------------------
11 12 | 
12 13 |     np.VisibleDeprecationWarning
13 14 | 
14    |-    np.chararray
   15 |+    chararray
15 16 | 
16 17 |     np.format_parser

NPY201_3.py:16:5: NPY201 [*] `np.format_parser` will be removed in NumPy 2.0. Use `numpy.rec.format_parser` instead.
   |
14 |     np.chararray
15 | 
16 |     np.format_parser
   |     ^^^^^^^^^^^^^^^^ NPY201
   |
   = help: Replace with `numpy.rec.format_parser`

ℹ Safe fix
   1  |+from numpy.rec import format_parser
1  2  | def func():
2  3  |     import numpy as np
3  4  | 
--------------------------------------------------------------------------------
13 14 | 
14 15 |     np.chararray
15 16 | 
16    |-    np.format_parser
   17 |+    format_parser
