From 25a8aff12f1fc6b3e59c9a09df5b1ed113dbadb0 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Tue, 23 Sep 2025 01:11:55 +0200 Subject: [PATCH 1/2] Remove support for nmp as import alias for numpy --- doc/whatsnew/fragments/10583.breaking | 3 +++ pylint/checkers/base/comparison_checker.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 doc/whatsnew/fragments/10583.breaking diff --git a/doc/whatsnew/fragments/10583.breaking b/doc/whatsnew/fragments/10583.breaking new file mode 100644 index 0000000000..4d61ed63a5 --- /dev/null +++ b/doc/whatsnew/fragments/10583.breaking @@ -0,0 +1,3 @@ +Removed support for ``nmp`` as import alias for ``numpy``. Use ``np`` or ``numpy`` instead. + +Refs #10583 diff --git a/pylint/checkers/base/comparison_checker.py b/pylint/checkers/base/comparison_checker.py index 2bde5475b4..2c1ad7c0a4 100644 --- a/pylint/checkers/base/comparison_checker.py +++ b/pylint/checkers/base/comparison_checker.py @@ -157,7 +157,7 @@ def _is_float_nan(node: nodes.NodeNG) -> bool: def _is_numpy_nan(node: nodes.NodeNG) -> bool: match node: case nodes.Attribute(attrname="NaN", expr=nodes.Name(name=name)): - return name in {"numpy", "nmp", "np"} + return name in {"numpy", "np"} return False def _is_nan(node: nodes.NodeNG) -> bool: From 90d86adf3eaf4568a54bdd054960af5fe30f1174 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Tue, 23 Sep 2025 22:09:51 +0200 Subject: [PATCH 2/2] Update doc/whatsnew/fragments/10583.breaking Co-authored-by: Pierre Sassoulas --- doc/whatsnew/fragments/10583.breaking | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/whatsnew/fragments/10583.breaking b/doc/whatsnew/fragments/10583.breaking index 4d61ed63a5..3c17d99780 100644 --- a/doc/whatsnew/fragments/10583.breaking +++ b/doc/whatsnew/fragments/10583.breaking @@ -1,3 +1,3 @@ -Removed support for ``nmp`` as import alias for ``numpy``. Use ``np`` or ``numpy`` instead. +Removed support for ``nmp.NaN`` alias for ``numpy.NaN`` being recognized in ':ref:`nan-comparison`'. Use ``np`` or ``numpy`` instead. Refs #10583