8000 Apply ruff/flake8-implicit-str-concat rule ISC001 · scikit-learn/scikit-learn@5ed38f9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5ed38f9

Browse files
Apply ruff/flake8-implicit-str-concat rule ISC001
ISC001 Implicitly concatenated string literals on one line
1 parent 43d440f commit 5ed38f9

File tree

15 files changed

+20
-20
lines changed

15 files changed

+20
-20
lines changed

examples/mixture/plot_concentration_prior.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def plot_results(ax1, ax2, estimator, X, y, title, plot_title=False):
103103
# mean_precision_prior= 0.8 to minimize the influence of the prior
104104
estimators = [
105105
(
106-
"Finite mixture with a Dirichlet distribution\nprior and " r"$\gamma_0=$",
106+
r"Finite mixture with a Dirichlet distribution\nprior and $\gamma_0=$",
107107
BayesianGaussianMixture(
108108
weight_concentration_prior_type="dirichlet_distribution",
109109
n_components=2 * n_components,

maint_tools/sort_whats_new.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def entry_sort_key(s):
2323

2424
for entry in re.split("\n(?=- )", text.strip()):
2525
modules = re.findall(
26-
r":(?:func|meth|mod|class):" r"`(?:[^<`]*<|~)?(?:sklearn.)?([a-z]\w+)", entry
26+
r":(?:func|meth|mod|class):`(?:[^<`]*<|~)?(?:sklearn.)?([a-z]\w+)", entry
2727
)
2828
modules = set(modules)
2929
if len(modules) > 1:

sklearn/compose/tests/test_target.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def test_transform_target_regressor_error():
3636
)
3737
with pytest.raises(
3838
TypeError,
39-
match=r"fit\(\) got an unexpected " "keyword argument 'sample_weight'",
39+
match=r"fit\(\) got an unexpected keyword argument 'sample_weight'",
4040
):
4141
regr.fit(X, y, sample_weight=sample_weight)
4242

sklearn/datasets/_twenty_newsgroups.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def strip_newsgroup_header(text):
115115

116116

117117
_QUOTE_RE = re.compile(
118-
r"(writes in|writes:|wrote:|says:|said:" r"|^In article|^Quoted from|^\||^>)"
118+
r"(writes in|writes:|wrote:|says:|said:|^In article|^Quoted from|^\||^>)"
119119
)
120120

121121

sklearn/datasets/tests/test_samples_generator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ def test_make_moons_unbalanced():
689689

690690
with pytest.raises(
691691
ValueError,
692-
match=r"`n_samples` can be either an int " r"or a two-element tuple.",
692+
match=r"`n_samples` can be either an int or a two-element tuple.",
693693
):
694694
make_moons(n_samples=(10,))
695695

sklearn/decomposition/tests/test_fastica.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ def test_fastica_errors():
367367
with pytest.raises(ValueError, match=r"alpha must be in \[1,2\]"):
368368
fastica(X, fun_args={"alpha": 0})
369369
with pytest.raises(
370-
ValueError, match="w_init has invalid shape.+" r"should be \(3L?, 3L?\)"
370+
ValueError, match=r"w_init has invalid shape.+should be \(3L?, 3L?\)"
371371
):
372372
fastica(X, w_init=w_init)
373373

sklearn/inspection/_plot/tests/test_plot_partial_dependence.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1186,9 +1186,9 @@ def test_plot_partial_dependence_lines_kw(
11861186
)
11871187

11881188
line = disp.lines_[0, 0, -1]
1189-
assert line.get_color() == expected_colors[0], (
1190-
f"{line.get_color()}!={expected_colors[0]}\n" f"{line_kw} and {pd_line_kw}"
1191-
)
1189+
assert (
1190+
line.get_color() == expected_colors[0]
1191+
), f"{line.get_color()}!={expected_colors[0]}\n{line_kw} and {pd_line_kw}"
11921192
if pd_line_kw is not None:
11931193
if "linestyle" in pd_line_kw:
11941194
assert line.get_linestyle() == pd_line_kw["linestyle"]

sklearn/linear_model/tests/test_ridge.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ def test_ridge_regression_convergence_fail():
524524
rng = np.random.RandomState(0)
525525
y = rng.randn(5)
526526
X = rng.randn(5, 10)
527-
warning_message = r"sparse_cg did not converge after" r" [0-9]+ iterations."
527+
warning_message = r"sparse_cg did not converge after [0-9]+ iterations."
528528
with pytest.warns(ConvergenceWarning, match=warning_message):
529529
ridge_regression(
530530
X, y, alpha=1.0, solver="sparse_cg", tol=0.0, max_iter=None, verbose=1

sklearn/metrics/cluster/tests/test_supervised.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
def test_error_messages_on_wrong_input():
4141
for score_func in score_funcs:
4242
expected = (
43-
r"Found input variables with inconsistent numbers " r"of samples: \[2, 3\]"
43+
r"Found input variables with inconsistent numbers of samples: \[2, 3\]"
4444
)
4545
with pytest.raises(ValueError, match=expected):
4646
score_func([0, 1], [1, 1, 1])

sklearn/metrics/tests/test_common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1788,7 +1788,7 @@ def test_metrics_pos_label_error_str(metric, y_pred_threshold, dtype_y_str):
17881788
"pass pos_label explicit"
17891789
)
17901790
err_msg_pos_label_1 = (
1791-
r"pos_label=1 is not a valid label. It should be one of " r"\['eggs', 'spam'\]"
1791+
r"pos_label=1 is not a valid label. It should be one of \['eggs', 'spam'\]"
17921792
)
17931793

17941794
pos_label_default = signature(metric).parameters["pos_label"].default

0 commit comments

Comments
 (0)
0