mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
[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](https://github.com/astral-sh/ruff-pre-commit/compare/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 (सौगात) <[email protected]>
This commit is contained in:
co-authored by
Saugat Pachhai
parent
e455ee69aa
commit
6cc349edb4
@@ -23,7 +23,7 @@ repos:
|
|||||||
- id: sort-simple-yaml
|
- id: sort-simple-yaml
|
||||||
- id: trailing-whitespace
|
- id: trailing-whitespace
|
||||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||||
rev: 'v0.9.9'
|
rev: 'v0.11.4'
|
||||||
hooks:
|
hooks:
|
||||||
- id: ruff
|
- id: ruff
|
||||||
args: [--fix, --exit-non-zero-on-fix]
|
args: [--fix, --exit-non-zero-on-fix]
|
||||||
|
|||||||
+1
-2
@@ -27,8 +27,7 @@ def _postprocess(results):
|
|||||||
}
|
}
|
||||||
processed[rev] = processed[rev] | to_merge
|
processed[rev] = processed[rev] | to_merge
|
||||||
|
|
||||||
if "workspace" in processed:
|
processed.pop("workspace", None)
|
||||||
del processed["workspace"]
|
|
||||||
|
|
||||||
return processed
|
return processed
|
||||||
|
|
||||||
|
|||||||
+12
-12
@@ -104,21 +104,21 @@ class AsciiCanvas:
|
|||||||
if dx == 0:
|
if dx == 0:
|
||||||
y = y0
|
y = y0
|
||||||
else:
|
else:
|
||||||
y = y0 + int(round((x - x0) * dy / float(dx)))
|
y = y0 + round((x - x0) * dy / float(dx))
|
||||||
self.point(x, y, char)
|
self.point(x, y, char)
|
||||||
elif y0 < y1:
|
elif y0 < y1:
|
||||||
for y in range(y0, y1 + 1):
|
for y in range(y0, y1 + 1):
|
||||||
if dy == 0:
|
if dy == 0:
|
||||||
x = x0
|
x = x0
|
||||||
else:
|
else:
|
||||||
x = x0 + int(round((y - y0) * dx / float(dy)))
|
x = x0 + round((y - y0) * dx / float(dy))
|
||||||
self.point(x, y, char)
|
self.point(x, y, char)
|
||||||
else:
|
else:
|
||||||
for y in range(y1, y0 + 1):
|
for y in range(y1, y0 + 1):
|
||||||
if dy == 0:
|
if dy == 0:
|
||||||
x = x0
|
x = x0
|
||||||
else:
|
else:
|
||||||
x = x1 + int(round((y - y1) * dx / float(dy)))
|
x = x1 + round((y - y1) * dx / float(dy))
|
||||||
self.point(x, y, char)
|
self.point(x, y, char)
|
||||||
|
|
||||||
def text(self, x, y, text):
|
def text(self, x, y, text):
|
||||||
@@ -258,8 +258,8 @@ def draw(vertices, edges):
|
|||||||
maxx = max(Xs)
|
maxx = max(Xs)
|
||||||
maxy = max(Ys)
|
maxy = max(Ys)
|
||||||
|
|
||||||
canvas_cols = int(math.ceil(math.ceil(maxx) - math.floor(minx))) + 1
|
canvas_cols = math.ceil(math.ceil(maxx) - math.floor(minx)) + 1
|
||||||
canvas_lines = int(round(maxy - miny))
|
canvas_lines = round(maxy - miny)
|
||||||
|
|
||||||
canvas = AsciiCanvas(canvas_cols, canvas_lines)
|
canvas = AsciiCanvas(canvas_cols, canvas_lines)
|
||||||
|
|
||||||
@@ -270,10 +270,10 @@ def draw(vertices, edges):
|
|||||||
start = edge.view._pts[index - 1]
|
start = edge.view._pts[index - 1]
|
||||||
end = edge.view._pts[index]
|
end = edge.view._pts[index]
|
||||||
|
|
||||||
start_x = int(round(start[0] - minx))
|
start_x = round(start[0] - minx)
|
||||||
start_y = int(round(start[1] - miny))
|
start_y = round(start[1] - miny)
|
||||||
end_x = int(round(end[0] - minx))
|
end_x = round(end[0] - minx)
|
||||||
end_y = int(round(end[1] - miny))
|
end_y = round(end[1] - miny)
|
||||||
|
|
||||||
assert start_x >= 0
|
assert start_x >= 0
|
||||||
assert start_y >= 0
|
assert start_y >= 0
|
||||||
@@ -288,12 +288,12 @@ def draw(vertices, edges):
|
|||||||
y = vertex.view.xy[1]
|
y = vertex.view.xy[1]
|
||||||
|
|
||||||
canvas.box(
|
canvas.box(
|
||||||
int(round(x - minx)),
|
round(x - minx),
|
||||||
int(round(y - miny)),
|
round(y - miny),
|
||||||
vertex.view.w,
|
vertex.view.w,
|
||||||
vertex.view.h,
|
vertex.view.h,
|
||||||
)
|
)
|
||||||
|
|
||||||
canvas.text(int(round(x - minx)) + 1, int(round(y - miny)) + 1, vertex.data)
|
canvas.text(round(x - minx) + 1, round(y - miny) + 1, vertex.data)
|
||||||
|
|
||||||
return canvas.draw()
|
return canvas.draw()
|
||||||
|
|||||||
+1
-1
@@ -36,7 +36,7 @@ def add_logging_level(level_name, level_num, method_name=None):
|
|||||||
self._log(level_num, message, args, **kwargs)
|
self._log(level_num, message, args, **kwargs)
|
||||||
|
|
||||||
def log_to_root(message, *args, **kwargs):
|
def log_to_root(message, *args, **kwargs):
|
||||||
logging.log(level_num, message, *args, **kwargs)
|
logging.log(level_num, message, *args, **kwargs) # noqa: LOG015
|
||||||
|
|
||||||
# getLevelName resolves the numeric log level if already defined,
|
# getLevelName resolves the numeric log level if already defined,
|
||||||
# otherwise returns a string
|
# otherwise returns a string
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ class Meta:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def update_path(meta: "Meta", path: Union[str, int]):
|
def update_path(meta: "Meta", path: Union[str, int]):
|
||||||
dpaths = meta.dpaths[:] + [str(path)]
|
dpaths = [*meta.dpaths, str(path)]
|
||||||
return replace(meta, dpaths=dpaths)
|
return replace(meta, dpaths=dpaths)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
|||||||
@@ -372,7 +372,7 @@ class BaseStashQueue(ABC):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def _stash_commit_deps(self, *args, **kwargs):
|
def _stash_commit_deps(self, *args, **kwargs):
|
||||||
if len(args):
|
if args:
|
||||||
targets = args[0]
|
targets = args[0]
|
||||||
else:
|
else:
|
||||||
targets = kwargs.get("targets")
|
targets = kwargs.get("targets")
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ def test_remove_experiments_by_ref(tmp_dir, scm, dvc, exp_stage, caplog):
|
|||||||
ref_name_list.append(str(ref_info))
|
ref_name_list.append(str(ref_info))
|
||||||
|
|
||||||
with pytest.raises(InvalidArgumentError):
|
with pytest.raises(InvalidArgumentError):
|
||||||
dvc.experiments.remove(ref_name_list[:2] + ["non-exist"])
|
dvc.experiments.remove([*ref_name_list[:2], "non-exist"])
|
||||||
assert scm.get_ref(ref_name_list[0]) is not None
|
assert scm.get_ref(ref_name_list[0]) is not None
|
||||||
assert scm.get_ref(ref_name_list[1]) is not None
|
assert scm.get_ref(ref_name_list[1]) is not None
|
||||||
assert scm.get_ref(ref_name_list[2]) is not None
|
assert scm.get_ref(ref_name_list[2]) is not None
|
||||||
|
|||||||
@@ -759,7 +759,7 @@ def test_repro_dry(tmp_dir, dvc, copy_script):
|
|||||||
|
|
||||||
stages = dvc.reproduce(stage.addressing, dry=True)
|
stages = dvc.reproduce(stage.addressing, dry=True)
|
||||||
|
|
||||||
assert len(stages), 2
|
assert len(stages) == 2
|
||||||
assert not filecmp.cmp("file1", "bar", shallow=False)
|
assert not filecmp.cmp("file1", "bar", shallow=False)
|
||||||
|
|
||||||
ret = main(["repro", "--dry", stage.addressing])
|
ret = main(["repro", "--dry", stage.addressing])
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ def test_get_unused_links(tmp_dir, dvc):
|
|||||||
assert set(dvc.state.get_unused_links(links, dvc.fs)) == set()
|
assert set(dvc.state.get_unused_links(links, dvc.fs)) == set()
|
||||||
assert set(
|
assert set(
|
||||||
dvc.state.get_unused_links(
|
dvc.state.get_unused_links(
|
||||||
(links[:1] + [os.path.join(dvc.root_dir, "not-existing-file")]),
|
([*links[:1], os.path.join(dvc.root_dir, "not-existing-file")]),
|
||||||
dvc.fs,
|
dvc.fs,
|
||||||
)
|
)
|
||||||
) == {"bar"}
|
) == {"bar"}
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ def test_load_from_pipeline_error_on_typ(dvc, typ):
|
|||||||
output.load_from_pipeline(Stage(dvc), ["file1"], typ)
|
output.load_from_pipeline(Stage(dvc), ["file1"], typ)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("key", [3, "list".split()])
|
@pytest.mark.parametrize("key", [3, ["list"]])
|
||||||
def test_load_from_pipeline_illegal_type(dvc, key):
|
def test_load_from_pipeline_illegal_type(dvc, key):
|
||||||
stage = Stage(dvc)
|
stage = Stage(dvc)
|
||||||
with pytest.raises(ValueError, match=f"'{type(key).__name__}' not supported."):
|
with pytest.raises(ValueError, match=f"'{type(key).__name__}' not supported."):
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ def test_context_list():
|
|||||||
_ = context["lst"][3]
|
_ = context["lst"][3]
|
||||||
|
|
||||||
context["lst"].insert(0, "baz")
|
context["lst"].insert(0, "baz")
|
||||||
assert context["lst"] == CtxList(["baz"] + lst[:2])
|
assert context["lst"] == CtxList(["baz", *lst[:2]])
|
||||||
|
|
||||||
|
|
||||||
def test_context_setitem_getitem():
|
def test_context_setitem_getitem():
|
||||||
|
|||||||
Reference in New Issue
Block a user