This is an automated email from the ASF dual-hosted git repository.
ruifengz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/master by this push:
new e4bbafdd3d39 [SPARK-54922][PYTHON][FOLLOWUP] Ignore ununsed-ignore
because we support both numpy 1 and 2
e4bbafdd3d39 is described below
commit e4bbafdd3d39b79072a7b36f9246dd0c933fd348
Author: Tian Gao <[email protected]>
AuthorDate: Mon Jan 19 08:41:34 2026 +0800
[SPARK-54922][PYTHON][FOLLOWUP] Ignore ununsed-ignore because we support
both numpy 1 and 2
### What changes were proposed in this pull request?
Added `unused-ignore` to `np.set_printoptions`.
### Why are the changes needed?
We support both numpy 1 and 2. CI uses 1 so `mypy` is happy that we ignored
this. However, locally we are probably using the latest version and the unused
type ignore became an error. We should make mypy work locally too.
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
Locally confirmed that mypy is happy about these.
### Was this patch authored or co-authored using generative AI tooling?
No
Closes #53839 from gaogaotiantian/fix-numpy-typehint.
Authored-by: Tian Gao <[email protected]>
Signed-off-by: Ruifeng Zheng <[email protected]>
---
python/pyspark/core/rdd.py | 2 +-
python/pyspark/pandas/indexes/base.py | 2 +-
python/pyspark/pandas/indexing.py | 2 +-
python/pyspark/pandas/namespace.py | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/python/pyspark/core/rdd.py b/python/pyspark/core/rdd.py
index 4ad5b112a0f9..ad961698c8c5 100644
--- a/python/pyspark/core/rdd.py
+++ b/python/pyspark/core/rdd.py
@@ -5389,7 +5389,7 @@ def _test() -> None:
if Version(np.__version__) >= Version("2"):
# `legacy="1.25"` only available in `nump>=2`
- np.set_printoptions(legacy="1.25") # type: ignore[arg-type]
+ np.set_printoptions(legacy="1.25") # type: ignore[arg-type,
unused-ignore]
except (ModuleNotFoundError, TypeError):
pass
diff --git a/python/pyspark/pandas/indexes/base.py
b/python/pyspark/pandas/indexes/base.py
index 17cb3bf3f74a..a7890e26f995 100644
--- a/python/pyspark/pandas/indexes/base.py
+++ b/python/pyspark/pandas/indexes/base.py
@@ -2658,7 +2658,7 @@ def _test() -> None:
# Numpy 2.0+ changed its string format,
# adding type information to numeric scalars.
# `legacy="1.25"` only available in `nump>=2`
- np.set_printoptions(legacy="1.25") # type: ignore[arg-type]
+ np.set_printoptions(legacy="1.25") # type: ignore[arg-type,
unused-ignore]
globs = pyspark.pandas.indexes.base.__dict__.copy()
globs["ps"] = pyspark.pandas
diff --git a/python/pyspark/pandas/indexing.py
b/python/pyspark/pandas/indexing.py
index d1ab273ef4f5..5d9d1bc7eea6 100644
--- a/python/pyspark/pandas/indexing.py
+++ b/python/pyspark/pandas/indexing.py
@@ -1850,7 +1850,7 @@ def _test() -> None:
# Numpy 2.0+ changed its string format,
# adding type information to numeric scalars.
# `legacy="1.25"` only available in `nump>=2`
- np.set_printoptions(legacy="1.25") # type: ignore[arg-type]
+ np.set_printoptions(legacy="1.25") # type: ignore[arg-type,
unused-ignore]
globs = pyspark.pandas.indexing.__dict__.copy()
globs["ps"] = pyspark.pandas
diff --git a/python/pyspark/pandas/namespace.py
b/python/pyspark/pandas/namespace.py
index a5f2b5ee4f6a..094a16e1a12c 100644
--- a/python/pyspark/pandas/namespace.py
+++ b/python/pyspark/pandas/namespace.py
@@ -3886,7 +3886,7 @@ def _test() -> None:
# Numpy 2.0+ changed its string format,
# adding type information to numeric scalars.
# `legacy="1.25"` only available in `nump>=2`
- np.set_printoptions(legacy="1.25") # type: ignore[arg-type]
+ np.set_printoptions(legacy="1.25") # type: ignore[arg-type,
unused-ignore]
globs = pyspark.pandas.namespace.__dict__.copy()
globs["ps"] = pyspark.pandas
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]