Skip to content

Commit 9a102c9

Browse files
pre-commit-ci[bot]skshetry
authored andcommitted
[pre-commit.ci] pre-commit autoupdate
updates: - [github.com/astral-sh/ruff-pre-commit: v0.8.4 → v0.9.0](astral-sh/ruff-pre-commit@v0.8.4...v0.9.0)
1 parent aea0e6b commit 9a102c9

File tree

14 files changed

+26
-40
lines changed

14 files changed

+26
-40
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ repos:
2222
- id: sort-simple-yaml
2323
- id: trailing-whitespace
2424
- repo: https://github.com/astral-sh/ruff-pre-commit
25-
rev: 'v0.8.4'
25+
rev: 'v0.9.0'
2626
hooks:
2727
- id: ruff
2828
args: [--fix, --exit-non-zero-on-fix]

dvc/pathspec_math.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,9 @@ def _remove_slash(rule):
2727

2828
def _match_all_level(rule):
2929
if rule[:-1].find("/") >= 0 and not rule.startswith("**/"):
30-
if rule.startswith("/"):
31-
rule = rule[1:]
30+
rule = rule.removeprefix("/")
3231
return False, rule
33-
if rule.startswith("**/"):
34-
rule = rule[3:]
32+
rule = rule.removeprefix("**/")
3533
return True, rule
3634

3735

dvc/repo/experiments/run.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def run( # noqa: C901, PLR0912
9393

9494
for idx, sweep_overrides in enumerate(sweeps):
9595
if hydra_sweep and name_prefix is not None:
96-
kwargs["name"] = f"{name_prefix}-{idx+1}"
96+
kwargs["name"] = f"{name_prefix}-{idx + 1}"
9797
queue_entry = repo.experiments.queue_one(
9898
repo.experiments.celery_queue,
9999
targets=targets,

dvc/testing/benchmarks/fixtures.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,7 @@ def dvc_bin(request, make_dvc_bin):
138138
version = Version(parse(dvc_version).base_version)
139139
if version not in spec:
140140
pytest.skip(
141-
f"Version {dvc_version} "
142-
f"does not satisfy requirement {spec!r}: {reason}"
141+
f"Version {dvc_version} does not satisfy requirement {spec!r}: {reason}"
143142
)
144143
return make_dvc_bin
145144

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,14 +264,14 @@ show-fixes = true
264264

265265
[tool.ruff.lint]
266266
ignore = [
267-
"N818", "S101", "ISC001", "PT007", "RET502", "RET503", "SIM105", "SIM108", "SIM117",
267+
"N818", "S101", "A005", "PT007", "RET502", "RET503", "SIM105", "SIM108", "SIM117",
268268
"TRY003", "TRY300", "PERF203", "PLR2004", "PLW2901", "LOG007",
269269
]
270270
select = [
271271
"F", "E", "W", "C90", "I", "N", "UP", "YTT", "ASYNC", "S", "BLE", "B", "A", "C4", "DTZ", "T10",
272272
"EXE", "ISC", "ICN", "LOG", "G", "INP", "PIE", "T20", "PYI", "PT", "Q", "RSE", "RET",
273273
"SLOT", "SIM", "TID", "TC", "ARG", "PGH", "PLC", "PLE", "PLR", "PLW", "TRY",
274-
"FLY", "PERF", "FURB", "RUF", "RUF027", "RUF029", "RUF034", "RUF036",
274+
"FLY", "PERF", "FURB", "RUF", "RUF027", "RUF029", "RUF036",
275275
]
276276
preview = true
277277
explicit-preview-rules = true

tests/func/experiments/test_set_params.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def test_hydra_sweep_prefix_name(tmp_dir, params_repo, dvc):
133133
db_values = ["mysql", "postgresql"]
134134
param = "+db=" + ",".join(db_values)
135135
dvc.experiments.run(params=[param], queue=True, name=prefix)
136-
expected_names = [f"{prefix}-{i+1}" for i, _ in enumerate(db_values)]
136+
expected_names = [f"{prefix}-{i + 1}" for i, _ in enumerate(db_values)]
137137
exp_names = [entry.name for entry in dvc.experiments.celery_queue.iter_queued()]
138138
for name, expected in zip(exp_names, expected_names):
139139
assert name == expected

tests/func/plots/test_show.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,11 +205,8 @@ def _get_plot_defn(rel_dir: str) -> dict:
205205

206206
dvclive_metrics_dir.gen(
207207
{
208-
"Error.tsv": "step\tError\n" "0\t0.11\n" "1\t0.22\n" "2\t0.44\n",
209-
"Max_Leaf_Nodes.tsv": "step\tMax_Leaf_Nodes\n"
210-
"0\t5\n"
211-
"1\t50\n"
212-
"2\t500\n",
208+
"Error.tsv": "step\tError\n0\t0.11\n1\t0.22\n2\t0.44\n",
209+
"Max_Leaf_Nodes.tsv": "step\tMax_Leaf_Nodes\n0\t5\n1\t50\n2\t500\n",
213210
}
214211
)
215212

tests/func/test_merge_driver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def test_merge_different_output_options(tmp_dir, dvc, caplog):
132132
)
133133

134134
(tmp_dir / "their").write_text(
135-
"outs:\n"
135+
r"outs:\n"
136136
"- md5: f987654321.dir\n"
137137
" hash: md5\n"
138138
" path: path\n"

tests/func/test_repo_index.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,13 @@ def assert_index_equal(first, second, strict=True, ordered=True):
114114
assert len(first) == len(second), "Index have different no. of stages"
115115
assert set(first) == set(second), "Index does not have same stages"
116116
if ordered:
117-
assert list(first) == list(
118-
second
119-
), "Index does not have same sequence of stages"
117+
assert list(first) == list(second), (
118+
"Index does not have same sequence of stages"
119+
)
120120
if strict:
121-
assert set(map(id, first)) == set(
122-
map(id, second)
123-
), "Index is not strictly equal"
121+
assert set(map(id, first)) == set(map(id, second)), (
122+
"Index is not strictly equal"
123+
)
124124

125125

126126
def test_skip_graph_checks(dvc, mocker):

tests/integration/plots/test_plots.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -553,11 +553,8 @@ def test_nested_x_defn_collection(tmp_dir, dvc, scm, capsys):
553553
)
554554
dvclive_metrics_dir.gen(
555555
{
556-
"Error.tsv": "step\tError\n" "0\t0.11\n" "1\t0.22\n" "2\t0.44\n",
557-
"Max_Leaf_Nodes.tsv": "step\tMax_Leaf_Nodes\n"
558-
"0\t5\n"
559-
"1\t50\n"
560-
"2\t500\n",
556+
"Error.tsv": "step\tError\n0\t0.11\n1\t0.22\n2\t0.44\n",
557+
"Max_Leaf_Nodes.tsv": "step\tMax_Leaf_Nodes\n0\t5\n1\t50\n2\t500\n",
561558
}
562559
)
563560
(other_logger_dir / "multiple_metrics.json").dump(

tests/unit/command/test_dataset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def test_add_already_exists(dvc, caplog, mocker):
106106
"missing": "Updating mydataset (s3://bucket/path)\n",
107107
"unchanged": "Nothing to update\n",
108108
"updated": (
109-
"Updating mydataset (s3://bucket/path)\n"
109+
r"Updating mydataset (s3://bucket/path)\n"
110110
"M\tbaz\n"
111111
"A\tfoobar\n"
112112
"D\tfoo\n"

tests/unit/fs/test_dvc_info.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,6 @@ def test_info_on_subrepos(make_tmp_dir, tmp_dir, dvc, scm, dvcfs):
123123

124124
for path in ["subrepo", "subrepo/foo", "subrepo/foobar"]:
125125
info = dvcfs.info(path)
126-
assert info["repo"].root_dir == str(
127-
subrepo
128-
), f"repo root didn't match for {path}"
126+
assert info["repo"].root_dir == str(subrepo), (
127+
f"repo root didn't match for {path}"
128+
)

tests/unit/test_config.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,5 @@ def test_feature_section_supports_arbitrary_values(caplog):
130130
assert "random_key_1" not in data
131131
assert "random_key_2" not in data
132132
assert (
133-
"'feature.random_key_1', 'feature.random_key_2' "
134-
"config options are unsupported"
133+
"'feature.random_key_1', 'feature.random_key_2' config options are unsupported"
135134
) in caplog.text

tests/unit/test_logger.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,7 @@ def test_exception_under_verbose(self, caplog, dt):
104104
logger.exception("")
105105

106106
expected = (
107-
"{red}{datetime}{nc} "
108-
"{red}ERROR{nc}: description\n"
109-
"{stack_trace}".format(
107+
"{red}{datetime}{nc} {red}ERROR{nc}: description\n{stack_trace}".format(
110108
stack_trace=stack_trace,
111109
**colors,
112110
datetime=dt,
@@ -144,9 +142,7 @@ def test_tb_only(self, caplog, dt):
144142
logger.exception("something", extra={"tb_only": True})
145143

146144
expected = (
147-
"{red}{datetime}{nc} "
148-
"{red}ERROR{nc}: something\n"
149-
"{stack_trace}".format(
145+
"{red}{datetime}{nc} {red}ERROR{nc}: something\n{stack_trace}".format(
150146
stack_trace=stack_trace,
151147
**colors,
152148
datetime=dt,

0 commit comments

Comments
 (0)