Skip to content
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
1 change: 1 addition & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ bb473f6ff4a23e4fd5205eacdef713db15decadf
67c4efab4e3ec1dc16c18b9ab8c5cd5f375040e0
8d00b416689c428b2bafdaad61ed3ec660ca06c2
d6b447cab8c40aa47dc675a0f4349ae254e8b3ce
d8966d848af75751823e825eb76c5bbff58f5c07
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@
method_names.sort(key=lambda x: x[::-1], reverse=True)

for n_dim_index, ((n_dim, n_dim_bench), color) in enumerate(
zip(sorted(results.items()), colors)
zip(sorted(results.items()), colors, strict=True)
):
for (cost_name, cost_bench), symbol in zip(sorted(n_dim_bench.items()), symbols):
for (cost_name, cost_bench), symbol in zip(
sorted(n_dim_bench.items()), symbols, strict=True
):
for (
method_index,
method_name,
Expand All @@ -50,7 +52,7 @@
)

# Create a legend for the problem type
for cost_name, symbol in zip(sorted(n_dim_bench.keys()), symbols):
for cost_name, symbol in zip(sorted(n_dim_bench.keys()), symbols, strict=True):
plt.semilogy(
[
-10,
Expand All @@ -71,7 +73,7 @@
# Create a second legend for the problem dimensionality
plt.twinx()

for n_dim, color in zip(sorted(results.keys()), colors):
for n_dim, color in zip(sorted(results.keys()), colors, strict=True):
plt.plot(
[
-10,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
import matplotlib.pyplot as plt
import scipy as sp

import sys, os
import sys
import os

sys.path.append(os.path.abspath("helper"))
from cost_functions import (
Expand Down Expand Up @@ -245,7 +246,7 @@ def store(X):
)
contours = plt.contour(
log_z,
levels=levels.get(f, None),
levels=levels.get(f),
extent=[x_min, x_max, y_min, y_max],
cmap=plt.cm.gnuplot,
origin="lower",
Expand Down
4 changes: 2 additions & 2 deletions intro/matplotlib/examples/plot_bar.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
plt.bar(X, +Y1, facecolor="#9999ff", edgecolor="white")
plt.bar(X, -Y2, facecolor="#ff9999", edgecolor="white")

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

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

plt.xlim(-0.5, n)
Expand Down
2 changes: 1 addition & 1 deletion intro/matplotlib/examples/plot_polar.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
width = np.pi / 4 * rng.random(N)
bars = plt.bar(theta, radii, width=width, bottom=0.0)

for r, bar in zip(radii, bars):
for r, bar in zip(radii, bars, strict=True):
bar.set_facecolor(plt.cm.jet(r / 10.0))
bar.set_alpha(0.5)

Expand Down
2 changes: 1 addition & 1 deletion intro/matplotlib/examples/pretty_plots/plot_polar_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
radii = 10 * rng.random(N)
width = np.pi / 4 * rng.random(N)
bars = plt.bar(theta, radii, width=width, bottom=0.0)
for r, bar in zip(radii, bars):
for r, bar in zip(radii, bars, strict=True):
bar.set_facecolor(plt.cm.jet(r / 10.0))
bar.set_alpha(0.5)
plt.gca().set_xticklabels([])
Expand Down
2 changes: 1 addition & 1 deletion packages/scikit-learn/examples/plot_pca.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import matplotlib.pyplot as plt

plt.figure(figsize=(6, 5))
for i, c, label in zip(target_ids, "rgbcmykw", iris.target_names):
for i, c, label in zip(target_ids, "rgbcmykw", iris.target_names, strict=False):
plt.scatter(X_pca[y == i, 0], X_pca[y == i, 1], c=c, label=label)
plt.legend()
plt.show()
2 changes: 1 addition & 1 deletion packages/scikit-learn/examples/plot_tsne.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

plt.figure(figsize=(6, 5))
colors = "r", "g", "b", "c", "m", "y", "k", "w", "orange", "purple"
for i, c, label in zip(target_ids, colors, digits.target_names):
for i, c, label in zip(target_ids, colors, digits.target_names, strict=True):
plt.scatter(X_2d[y == i, 0], X_2d[y == i, 1], c=c, label=label)
plt.legend()
plt.show()
54 changes: 42 additions & 12 deletions ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,48 @@ target-version = "py310"

[lint]
select = [
"UP", # pyupgrade
"C4", # flake8-comprehensions
"E713", # use 'key not in list'
"NPY201", # NumPy 2 compatibility
"PIE", # flake8-pie
"PGH003", # forbid blanket 'type: ignore' comments
"PLR0402", # useless import alias
"SIM101", # merge 'isinstance' calls
"SIM109", # use a tuple for multiple comparisons
"SIM110", # convert loop to 'any'
"SIM118", # use 'key in dict'
"SIM2", # simplify boolean comparisons
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"E", # pycodestyle-error
"EM", # flake8-errmsg
"EXE", # flake8-executable
"FURB", # refurb
"NPY", # NumPy specific rules
"PD", # pandas-vet
"PGH", # pygrep-hooks
"PIE", # flake8-pie
"PL", # pylint
# "PTH", # flake8-use-pathlib
"PYI", # flake8-pyi
# "RET", # flake8-return
"RUF", # ruff-specific
"SIM", # flake8-simplify
"SIM2", # simplify boolean comparisons
"UP", # pyupgrade
"YTT" # flake8-2020
]
ignore = [
"B006", # Do not use mutable data structures for argument defaults
"B007", # Loop control variable {name} not used within loop body
"B018", # Found useless expression. Either assign it to a variable or remove it.
"E402", # Module level import not at top of file
"E501", # Line too long
"E741", # Ambiguous variable name
"E721", # Do not compare types, use `isinstance()`
"E731", # Do not assign a `lambda` expression, use a `def`
"EM101", # Exception must not use a string literal, assign to variable first
"EM102", # Exception must not use an f-string literal, assign to variable first
"ISC001", # Conflicts with formatter
"NPY002", # Replace legacy np.random.{method_name} call with np.random.Generator
"PD002", # inplace=True should be avoided; it has inconsistent behavior
"PLR", # pylint-refactor
"PLR09", # Too many <...>
"PLR2004", # Magic value used in comparison
"PLW0127", # Self-assignment of variable {name}
"PLW2901", # Outer {outer_kind} variable {name} overwritten by inner {inner_kind} target
"RUF005", # Consider {expression} instead of concatenation
"RUF015", # Prefer next({iterable}) over single element slice
"SIM115" # Use context handler for opening files
]

[format]
Expand Down