From 5bb9e29dcf72937a40d99a3c50994f0ea1e936f8 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 29 Sep 2025 17:37:30 +0000 Subject: [PATCH 1/2] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.13.1 → v0.13.2](https://github.com/astral-sh/ruff-pre-commit/compare/v0.13.1...v0.13.2) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7cfbb2b..b34433b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,7 +6,7 @@ repos: - id: trailing-whitespace - id: no-commit-to-branch - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.13.1 + rev: v0.13.2 hooks: - id: ruff-check args: [--fix, --exit-non-zero-on-fix] From 8907ef4ade7b63442858de6455948d150042fb78 Mon Sep 17 00:00:00 2001 From: "Philipp A." Date: Tue, 30 Sep 2025 13:18:17 +0200 Subject: [PATCH 2/2] mypy --- src/fast_array_utils/stats/_is_constant.py | 2 +- tests/test_stats.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/fast_array_utils/stats/_is_constant.py b/src/fast_array_utils/stats/_is_constant.py index ed64151..4df5efd 100644 --- a/src/fast_array_utils/stats/_is_constant.py +++ b/src/fast_array_utils/stats/_is_constant.py @@ -56,7 +56,7 @@ def _is_constant_cs(a: types.CSBase, /, *, axis: Literal[0, 1] | None = None) -> n_row, n_col = a.shape if axis is None: if len(a.data) == n_row * n_col: - return is_constant(cast("NDArray[Any]", a.data)) + return is_constant(a.data) return bool((a.data == 0).all()) shape = (n_row, n_col) if axis == 1 else (n_col, n_row) match axis, a.format: diff --git a/tests/test_stats.py b/tests/test_stats.py index c459475..a33b1d3 100644 --- a/tests/test_stats.py +++ b/tests/test_stats.py @@ -191,7 +191,7 @@ def test_mean(array_type: ArrayType[Array], axis: Literal[0, 1] | None, np_arr: if isinstance(result, types.CupyArray | types.CupyCSMatrix): result = result.get() - expected = np.mean(np_arr, axis=axis) # type: ignore[arg-type] + expected = np.mean(np_arr, axis=axis) np.testing.assert_array_equal(result, expected) @@ -209,8 +209,8 @@ def test_mean_var( if isinstance(mean, types.CupyArray) and isinstance(var, types.CupyArray): mean, var = mean.get(), var.get() - mean_expected = np.mean(np_arr, axis=axis) # type: ignore[arg-type] - var_expected = np.var(np_arr, axis=axis, ddof=1) # type: ignore[arg-type] + mean_expected = np.mean(np_arr, axis=axis) + var_expected = np.var(np_arr, axis=axis, ddof=1) np.testing.assert_array_equal(mean, mean_expected) np.testing.assert_array_almost_equal(var, var_expected) # type: ignore[arg-type]