Skip to content

Update pre-commit linters #809

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,27 @@ repos:
- id: trailing-whitespace

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

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

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

- repo: https://github.com/pre-commit/mirrors-mypy
rev: "d4911cfb7f1010759fde68da196036feeb25b99d" # frozen: v1.11.2
rev: "f56614daa94d5cd733d3b7004c5df9caad267b4a" # frozen: v1.13.0
hooks:
- id: mypy
additional_dependencies:
Expand Down
3 changes: 1 addition & 2 deletions advanced/advanced_numpy/examples/wavreader.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,5 @@
f.close()

print(
"Sample rate: %d, channels: %d"
% (wav_header["sample_rate"][0], wav_header["num_channels"][0])
f"Sample rate: {wav_header['sample_rate'][0]}, channels: {wav_header['num_channels'][0]}"
)
3 changes: 1 addition & 2 deletions advanced/debugging/to_debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ def compare_optimizers(optimizers):
print("Benching 1D root-finder optimizers from scipy.optimize:")
for optimizer in OPTIMIZERS:
print(
"% 20s: % 8i total function calls"
% (optimizer.__name__, bench_optimizer(optimizer, param_grid))
f"{optimizer.__name__:>20s}: {bench_optimizer(optimizer, param_grid):>8d} total function calls"
)


Expand Down
3 changes: 1 addition & 2 deletions advanced/debugging/to_debug_solution.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ def compare_optimizers(optimizers):
print("Benching 1D root-finder optimizers from scipy.optimize:")
for optimizer in OPTIMIZERS:
print(
"% 20s: % 8i total function calls"
% (optimizer.__name__, bench_optimizer(optimizer, param_grid))
f"{optimizer.__name__:>20s}: {bench_optimizer(optimizer, param_grid):>8d} total function calls"
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ def mk_costs(ndim=2):

# Normalize across methods
x0_mean = np.mean(all_bench)
for method_name in function_bench:
function_bench[method_name][-1] /= x0_mean
for _, values in function_bench.items():
values[-1] /= x0_mean
this_dim_benchs[cost_name] = function_bench
gradient_less_benchs[ndim] = this_dim_benchs
print(80 * "_")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
],
"o",
color=color,
label="# dim: %i" % n_dim,
label=f"# dim: {n_dim}",
)
plt.legend(
loc=(0.47, 0.07),
Expand Down
2 changes: 1 addition & 1 deletion advanced/scipy_sparse/examples/pyamg_with_lobpcg.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

for i in range(K):
plt.subplot(3, 3, i + 1)
plt.title("Eigenvector %d" % i)
plt.title(f"Eigenvector {i}")
plt.pcolor(V[:, i].reshape(N, N))
plt.axis("equal")
plt.axis("off")
Expand Down
2 changes: 1 addition & 1 deletion packages/scikit-learn/examples/plot_bias_variance.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def generating_func(x, rng=None, error=0.5):
plt.legend(loc="best")
plt.xlabel("number of train samples")
plt.ylabel("explained variance")
plt.title("Learning curve (degree=%i)" % d)
plt.title(f"Learning curve (degree={d})")
plt.tight_layout()


Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ Pillow
pooch
ipython
pickleshare
pre-commit==4.0
pre-commit==4.0.1
requests
sphinxcontrib-jquery
Loading