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] 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]