From e4c15e86ac0c0ad702b61a709f8bf07be87d7712 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 21 Sep 2026 20:42:05 +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/pre-commit/pre-commit-hooks: v5.0.0 → v6.0.0](https://github.com/pre-commit/pre-commit-hooks/compare/v5.0.0...v6.0.0) - [github.com/astral-sh/ruff-pre-commit: v0.8.3 → v0.16.8](https://github.com/astral-sh/ruff-pre-commit/compare/v0.8.3...v0.16.8) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d2433f5..1e0e766 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v5.0.0 + rev: v6.0.0 hooks: - id: check-added-large-files - id: check-builtin-literals @@ -12,7 +12,7 @@ repos: - id: end-of-file-fixer - id: mixed-line-ending - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.8.3 + rev: v0.16.8 hooks: - id: ruff args: From 3778e2c16e22cdc17b09a38927c75a6c2c4ae0af Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 21 Sep 2026 20:42:15 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- README.md | 2 +- sage/kernel_estimator.py | 2 +- sage/utils.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 47c686d..7a3a2aa 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ model = ... imputer = sage.MarginalImputer(model, x[:128]) # Set up an estimator -estimator = sage.PermutationEstimator(imputer, 'mse') +estimator = sage.PermutationEstimator(imputer, "mse") # Calculate SAGE values sage_values = estimator(x, y) diff --git a/sage/kernel_estimator.py b/sage/kernel_estimator.py index 0df49b4..064d371 100644 --- a/sage/kernel_estimator.py +++ b/sage/kernel_estimator.py @@ -4,7 +4,7 @@ from sage import core, utils -def calculate_A(num_features): # noqa:N802 +def calculate_A(num_features): # ruff: ignore[invalid-function-name] """Calculate A parameter's exact form.""" p_coaccur = ( np.sum( diff --git a/sage/utils.py b/sage/utils.py index 4e340b2..506a927 100644 --- a/sage/utils.py +++ b/sage/utils.py @@ -36,8 +36,8 @@ def model_conversion(model): model.eval() device = next(model.parameters()).device - return ( - lambda x: model(torch.tensor(x, dtype=torch.float32, device=device)) + return lambda x: ( + model(torch.tensor(x, dtype=torch.float32, device=device)) .cpu() .data.numpy() )