From eedb00f33964f4cb4bd8792b8841ec18cfa04b60 Mon Sep 17 00:00:00 2001 From: Jarrod Millman Date: Wed, 3 Jul 2024 09:56:06 -0700 Subject: [PATCH 1/3] Update pre-commits --- .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 35a74b8f4..980f73804 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -32,7 +32,7 @@ repos: args: [--no-pycodestyle, --max-line-length=88] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: 02609a0003fd4903bd7f43852e5dfc82242a96db # frozen: v0.4.9 + rev: 1dc9eb131c2ea4816c708e4d85820d2cc8542683 # frozen: v0.5.0 hooks: - id: ruff args: ["--fix", "--show-fixes", "--exit-non-zero-on-fix"] From 406488494019fb199474fea7f1694e9f0d0347bc Mon Sep 17 00:00:00 2001 From: Jarrod Millman Date: Wed, 3 Jul 2024 09:58:47 -0700 Subject: [PATCH 2/3] Apply ruff fixes --- advanced/scipy_sparse/examples/lobpcg_sakurai.py | 8 ++++---- intro/scipy/examples/solutions/plot_image_blur.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/advanced/scipy_sparse/examples/lobpcg_sakurai.py b/advanced/scipy_sparse/examples/lobpcg_sakurai.py index 1ec24b2af..fc355af75 100644 --- a/advanced/scipy_sparse/examples/lobpcg_sakurai.py +++ b/advanced/scipy_sparse/examples/lobpcg_sakurai.py @@ -49,13 +49,13 @@ def sakurai(n): ) data.append(time.clock() - tt) print("Results by LOBPCG for n=" + str(n)) -print("") +print() print(eigs) -print("") +print() print("Exact eigenvalues") -print("") +print() print(w_ex[:m]) -print("") +print() print("Elapsed time", data[0]) plt.loglog(np.arange(1, n + 1), w_ex, "b.") plt.xlabel(r"Number $i$") diff --git a/intro/scipy/examples/solutions/plot_image_blur.py b/intro/scipy/examples/solutions/plot_image_blur.py index 78d38faa8..19b1d594a 100644 --- a/intro/scipy/examples/solutions/plot_image_blur.py +++ b/intro/scipy/examples/solutions/plot_image_blur.py @@ -31,7 +31,7 @@ # First a 1-D Gaussian t = np.linspace(-10, 10, 30) bump = np.exp(-0.1 * t**2) -bump /= np.trapz(bump) # normalize the integral to 1 +bump /= np.trapezoid(bump) # normalize the integral to 1 # make a 2-D kernel out of it kernel = bump[:, np.newaxis] * bump[np.newaxis, :] From b1546ebb0786695a46486f9f2c08a6c26b409ca8 Mon Sep 17 00:00:00 2001 From: Jarrod Millman Date: Wed, 3 Jul 2024 09:59:25 -0700 Subject: [PATCH 3/3] Ignore ruff fixes --- .git-blame-ignore-revs | 1 + 1 file changed, 1 insertion(+) diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index f1bf47b4e..7c1df0312 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -8,3 +8,4 @@ d6b447cab8c40aa47dc675a0f4349ae254e8b3ce d8966d848af75751823e825eb76c5bbff58f5c07 4902d468c9606836b26b393379df4f49208ea847 1fd0ce6759be32be38bbfab32e83d157a82dfe25 +406488494019fb199474fea7f1694e9f0d0347bc