Skip to content

Commit 6cc349e

Browse files
[pre-commit.ci] pre-commit autoupdate (#10717)
* [pre-commit.ci] pre-commit autoupdate updates: - [github.com/astral-sh/ruff-pre-commit: v0.9.9 → v0.11.4](astral-sh/ruff-pre-commit@v0.9.9...v0.11.4) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix ruff errors --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Saugat Pachhai (सौगात) <suagatchhetri@outlook.com>
1 parent e455ee6 commit 6cc349e

11 files changed

Lines changed: 22 additions & 23 deletions

File tree

.pre-commit-config.yaml

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

dvc/api/show.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ def _postprocess(results):
2727
}
2828
processed[rev] = processed[rev] | to_merge
2929

30-
if "workspace" in processed:
31-
del processed["workspace"]
30+
processed.pop("workspace", None)
3231

3332
return processed
3433

dvc/dagascii.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -104,21 +104,21 @@ def line(self, x0, y0, x1, y1, char): # noqa: C901, PLR0912
104104
if dx == 0:
105105
y = y0
106106
else:
107-
y = y0 + int(round((x - x0) * dy / float(dx)))
107+
y = y0 + round((x - x0) * dy / float(dx))
108108
self.point(x, y, char)
109109
elif y0 < y1:
110110
for y in range(y0, y1 + 1):
111111
if dy == 0:
112112
x = x0
113113
else:
114-
x = x0 + int(round((y - y0) * dx / float(dy)))
114+
x = x0 + round((y - y0) * dx / float(dy))
115115
self.point(x, y, char)
116116
else:
117117
for y in range(y1, y0 + 1):
118118
if dy == 0:
119119
x = x0
120120
else:
121-
x = x1 + int(round((y - y1) * dx / float(dy)))
121+
x = x1 + round((y - y1) * dx / float(dy))
122122
self.point(x, y, char)
123123

124124
def text(self, x, y, text):
@@ -258,8 +258,8 @@ def draw(vertices, edges):
258258
maxx = max(Xs)
259259
maxy = max(Ys)
260260

261-
canvas_cols = int(math.ceil(math.ceil(maxx) - math.floor(minx))) + 1
262-
canvas_lines = int(round(maxy - miny))
261+
canvas_cols = math.ceil(math.ceil(maxx) - math.floor(minx)) + 1
262+
canvas_lines = round(maxy - miny)
263263

264264
canvas = AsciiCanvas(canvas_cols, canvas_lines)
265265

@@ -270,10 +270,10 @@ def draw(vertices, edges):
270270
start = edge.view._pts[index - 1]
271271
end = edge.view._pts[index]
272272

273-
start_x = int(round(start[0] - minx))
274-
start_y = int(round(start[1] - miny))
275-
end_x = int(round(end[0] - minx))
276-
end_y = int(round(end[1] - miny))
273+
start_x = round(start[0] - minx)
274+
start_y = round(start[1] - miny)
275+
end_x = round(end[0] - minx)
276+
end_y = round(end[1] - miny)
277277

278278
assert start_x >= 0
279279
assert start_y >= 0
@@ -288,12 +288,12 @@ def draw(vertices, edges):
288288
y = vertex.view.xy[1]
289289

290290
canvas.box(
291-
int(round(x - minx)),
292-
int(round(y - miny)),
291+
round(x - minx),
292+
round(y - miny),
293293
vertex.view.w,
294294
vertex.view.h,
295295
)
296296

297-
canvas.text(int(round(x - minx)) + 1, int(round(y - miny)) + 1, vertex.data)
297+
canvas.text(round(x - minx) + 1, round(y - miny) + 1, vertex.data)
298298

299299
return canvas.draw()

dvc/logger.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def log_for_level(self, message, *args, **kwargs):
3636
self._log(level_num, message, args, **kwargs)
3737

3838
def log_to_root(message, *args, **kwargs):
39-
logging.log(level_num, message, *args, **kwargs)
39+
logging.log(level_num, message, *args, **kwargs) # noqa: LOG015
4040

4141
# getLevelName resolves the numeric log level if already defined,
4242
# otherwise returns a string

dvc/parsing/context.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ class Meta:
105105

106106
@staticmethod
107107
def update_path(meta: "Meta", path: Union[str, int]):
108-
dpaths = meta.dpaths[:] + [str(path)]
108+
dpaths = [*meta.dpaths, str(path)]
109109
return replace(meta, dpaths=dpaths)
110110

111111
def __str__(self):

dvc/repo/experiments/queue/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ def _stash_exp(
372372
)
373373

374374
def _stash_commit_deps(self, *args, **kwargs):
375-
if len(args):
375+
if args:
376376
targets = args[0]
377377
else:
378378
targets = kwargs.get("targets")

tests/func/experiments/test_remove.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def test_remove_experiments_by_ref(tmp_dir, scm, dvc, exp_stage, caplog):
1818
ref_name_list.append(str(ref_info))
1919

2020
with pytest.raises(InvalidArgumentError):
21-
dvc.experiments.remove(ref_name_list[:2] + ["non-exist"])
21+
dvc.experiments.remove([*ref_name_list[:2], "non-exist"])
2222
assert scm.get_ref(ref_name_list[0]) is not None
2323
assert scm.get_ref(ref_name_list[1]) is not None
2424
assert scm.get_ref(ref_name_list[2]) is not None

tests/func/repro/test_repro.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,7 @@ def test_repro_dry(tmp_dir, dvc, copy_script):
759759

760760
stages = dvc.reproduce(stage.addressing, dry=True)
761761

762-
assert len(stages), 2
762+
assert len(stages) == 2
763763
assert not filecmp.cmp("file1", "bar", shallow=False)
764764

765765
ret = main(["repro", "--dry", stage.addressing])

tests/func/test_state.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def test_get_unused_links(tmp_dir, dvc):
6565
assert set(dvc.state.get_unused_links(links, dvc.fs)) == set()
6666
assert set(
6767
dvc.state.get_unused_links(
68-
(links[:1] + [os.path.join(dvc.root_dir, "not-existing-file")]),
68+
([*links[:1], os.path.join(dvc.root_dir, "not-existing-file")]),
6969
dvc.fs,
7070
)
7171
) == {"bar"}

tests/unit/output/test_load.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def test_load_from_pipeline_error_on_typ(dvc, typ):
9999
output.load_from_pipeline(Stage(dvc), ["file1"], typ)
100100

101101

102-
@pytest.mark.parametrize("key", [3, "list".split()])
102+
@pytest.mark.parametrize("key", [3, ["list"]])
103103
def test_load_from_pipeline_illegal_type(dvc, key):
104104
stage = Stage(dvc)
105105
with pytest.raises(ValueError, match=f"'{type(key).__name__}' not supported."):

0 commit comments

Comments
 (0)