Skip to content

Commit 86e8707

Browse files
Update pre-commit linters (#809)
1 parent ca0fc81 commit 86e8707

File tree

9 files changed

+13
-16
lines changed

9 files changed

+13
-16
lines changed

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,27 +19,27 @@ repos:
1919
- id: trailing-whitespace
2020

2121
- repo: https://github.com/rbubley/mirrors-prettier
22-
rev: 1463d990e0801964764a375260dca598513f3be5 # frozen: v3.3.3
22+
rev: bc7af46104f0f5368b95878decf720f9f00c2559 # frozen: v3.4.2
2323
hooks:
2424
- id: prettier
2525
files: \.(md|rst|yml|yaml)
2626
args: [--prose-wrap=preserve]
2727

2828
- repo: https://github.com/MarcoGorelli/cython-lint
29-
rev: 9247866fce7128f2c0eaf4a09f437880397d4689 # frozen: v0.16.2
29+
rev: 1ac5158c1b0f405350517c218f03d3a21bbb381c # frozen: v0.16.6
3030
hooks:
3131
- id: cython-lint
3232
args: [--no-pycodestyle, --max-line-length=88]
3333

3434
- repo: https://github.com/astral-sh/ruff-pre-commit
35-
rev: 75b98813cfb7e663870a28c74366a1e99d7bfe79 # frozen: v0.6.9
35+
rev: 8b76f04e7e5a9cd259e9d1db7799599355f97cdf # frozen: v0.8.2
3636
hooks:
3737
- id: ruff
3838
args: ["--fix", "--show-fixes", "--exit-non-zero-on-fix"]
3939
- id: ruff-format
4040

4141
- repo: https://github.com/pre-commit/mirrors-mypy
42-
rev: "d4911cfb7f1010759fde68da196036feeb25b99d" # frozen: v1.11.2
42+
rev: "f56614daa94d5cd733d3b7004c5df9caad267b4a" # frozen: v1.13.0
4343
hooks:
4444
- id: mypy
4545
additional_dependencies:

advanced/advanced_numpy/examples/wavreader.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,5 @@
4646
f.close()
4747

4848
print(
49-
"Sample rate: %d, channels: %d"
50-
% (wav_header["sample_rate"][0], wav_header["num_channels"][0])
49+
f"Sample rate: {wav_header['sample_rate'][0]}, channels: {wav_header['num_channels'][0]}"
5150
)

advanced/debugging/to_debug.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,7 @@ def compare_optimizers(optimizers):
6161
print("Benching 1D root-finder optimizers from scipy.optimize:")
6262
for optimizer in OPTIMIZERS:
6363
print(
64-
"% 20s: % 8i total function calls"
65-
% (optimizer.__name__, bench_optimizer(optimizer, param_grid))
64+
f"{optimizer.__name__:>20s}: {bench_optimizer(optimizer, param_grid):>8d} total function calls"
6665
)
6766

6867

advanced/debugging/to_debug_solution.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,7 @@ def compare_optimizers(optimizers):
6161
print("Benching 1D root-finder optimizers from scipy.optimize:")
6262
for optimizer in OPTIMIZERS:
6363
print(
64-
"% 20s: % 8i total function calls"
65-
% (optimizer.__name__, bench_optimizer(optimizer, param_grid))
64+
f"{optimizer.__name__:>20s}: {bench_optimizer(optimizer, param_grid):>8d} total function calls"
6665
)
6766

6867

advanced/mathematical_optimization/examples/helper/compare_optimizers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,8 @@ def mk_costs(ndim=2):
183183

184184
# Normalize across methods
185185
x0_mean = np.mean(all_bench)
186-
for method_name in function_bench:
187-
function_bench[method_name][-1] /= x0_mean
186+
for _, values in function_bench.items():
187+
values[-1] /= x0_mean
188188
this_dim_benchs[cost_name] = function_bench
189189
gradient_less_benchs[ndim] = this_dim_benchs
190190
print(80 * "_")

advanced/mathematical_optimization/examples/plot_compare_optimizers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
],
8787
"o",
8888
color=color,
89-
label="# dim: %i" % n_dim,
89+
label=f"# dim: {n_dim}",
9090
)
9191
plt.legend(
9292
loc=(0.47, 0.07),

advanced/scipy_sparse/examples/pyamg_with_lobpcg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
for i in range(K):
3838
plt.subplot(3, 3, i + 1)
39-
plt.title("Eigenvector %d" % i)
39+
plt.title(f"Eigenvector {i}")
4040
plt.pcolor(V[:, i].reshape(N, N))
4141
plt.axis("equal")
4242
plt.axis("off")

packages/scikit-learn/examples/plot_bias_variance.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def generating_func(x, rng=None, error=0.5):
139139
plt.legend(loc="best")
140140
plt.xlabel("number of train samples")
141141
plt.ylabel("explained variance")
142-
plt.title("Learning curve (degree=%i)" % d)
142+
plt.title(f"Learning curve (degree={d})")
143143
plt.tight_layout()
144144

145145

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ Pillow
1818
pooch
1919
ipython
2020
pickleshare
21-
pre-commit==4.0
21+
pre-commit==4.0.1
2222
requests
2323
sphinxcontrib-jquery

0 commit comments

Comments
 (0)