Skip to content

Commit d8966d8

Browse files
committed
Autoformat with ruff
1 parent 00d2ffd commit d8966d8

File tree

7 files changed

+15
-12
lines changed

7 files changed

+15
-12
lines changed

advanced/mathematical_optimization/examples/plot_compare_optimizers.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@
2929
method_names.sort(key=lambda x: x[::-1], reverse=True)
3030

3131
for n_dim_index, ((n_dim, n_dim_bench), color) in enumerate(
32-
zip(sorted(results.items()), colors)
32+
zip(sorted(results.items()), colors, strict=True)
3333
):
34-
for (cost_name, cost_bench), symbol in zip(sorted(n_dim_bench.items()), symbols):
34+
for (cost_name, cost_bench), symbol in zip(
35+
sorted(n_dim_bench.items()), symbols, strict=True
36+
):
3537
for (
3638
method_index,
3739
method_name,
@@ -50,7 +52,7 @@
5052
)
5153

5254
# Create a legend for the problem type
53-
for cost_name, symbol in zip(sorted(n_dim_bench.keys()), symbols):
55+
for cost_name, symbol in zip(sorted(n_dim_bench.keys()), symbols, strict=True):
5456
plt.semilogy(
5557
[
5658
-10,
@@ -71,7 +73,7 @@
7173
# Create a second legend for the problem dimensionality
7274
plt.twinx()
7375

74-
for n_dim, color in zip(sorted(results.keys()), colors):
76+
for n_dim, color in zip(sorted(results.keys()), colors, strict=True):
7577
plt.plot(
7678
[
7779
-10,

advanced/mathematical_optimization/examples/plot_gradient_descent.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
import matplotlib.pyplot as plt
1111
import scipy as sp
1212

13-
import sys, os
13+
import sys
14+
import os
1415

1516
sys.path.append(os.path.abspath("helper"))
1617
from cost_functions import (
@@ -245,7 +246,7 @@ def store(X):
245246
)
246247
contours = plt.contour(
247248
log_z,
248-
levels=levels.get(f, None),
249+
levels=levels.get(f),
249250
extent=[x_min, x_max, y_min, y_max],
250251
cmap=plt.cm.gnuplot,
251252
origin="lower",

intro/matplotlib/examples/plot_bar.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818
plt.bar(X, +Y1, facecolor="#9999ff", edgecolor="white")
1919
plt.bar(X, -Y2, facecolor="#ff9999", edgecolor="white")
2020

21-
for x, y in zip(X, Y1):
21+
for x, y in zip(X, Y1, strict=True):
2222
plt.text(x + 0.4, y + 0.05, f"{y:.2f}", ha="center", va="bottom")
2323

24-
for x, y in zip(X, Y2):
24+
for x, y in zip(X, Y2, strict=True):
2525
plt.text(x + 0.4, -y - 0.05, f"{y:.2f}", ha="center", va="top")
2626

2727
plt.xlim(-0.5, n)

intro/matplotlib/examples/plot_polar.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
width = np.pi / 4 * rng.random(N)
1919
bars = plt.bar(theta, radii, width=width, bottom=0.0)
2020

21-
for r, bar in zip(radii, bars):
21+
for r, bar in zip(radii, bars, strict=True):
2222
bar.set_facecolor(plt.cm.jet(r / 10.0))
2323
bar.set_alpha(0.5)
2424

intro/matplotlib/examples/pretty_plots/plot_polar_ext.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
radii = 10 * rng.random(N)
1818
width = np.pi / 4 * rng.random(N)
1919
bars = plt.bar(theta, radii, width=width, bottom=0.0)
20-
for r, bar in zip(radii, bars):
20+
for r, bar in zip(radii, bars, strict=True):
2121
bar.set_facecolor(plt.cm.jet(r / 10.0))
2222
bar.set_alpha(0.5)
2323
plt.gca().set_xticklabels([])

packages/scikit-learn/examples/plot_pca.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
import matplotlib.pyplot as plt
3232

3333
plt.figure(figsize=(6, 5))
34-
for i, c, label in zip(target_ids, "rgbcmykw", iris.target_names):
34+
for i, c, label in zip(target_ids, "rgbcmykw", iris.target_names, strict=False):
3535
plt.scatter(X_pca[y == i, 0], X_pca[y == i, 1], c=c, label=label)
3636
plt.legend()
3737
plt.show()

packages/scikit-learn/examples/plot_tsne.py

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

3939
plt.figure(figsize=(6, 5))
4040
colors = "r", "g", "b", "c", "m", "y", "k", "w", "orange", "purple"
41-
for i, c, label in zip(target_ids, colors, digits.target_names):
41+
for i, c, label in zip(target_ids, colors, digits.target_names, strict=True):
4242
plt.scatter(X_2d[y == i, 0], X_2d[y == i, 1], c=c, label=label)
4343
plt.legend()
4444
plt.show()

0 commit comments

Comments
 (0)