[pre-commit.ci] pre-commit autoupdate (#9841)

* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.0.282 → v0.0.285](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.282...v0.0.285)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix ruff issues

---------

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:
pre-commit-ci[bot]
2023-08-22 15:22:57 +05:45
committed by GitHub
co-authored by Saugat Pachhai
parent 0342e4f1c3
commit 3783d65dde
12 changed files with 34 additions and 41 deletions
+1 -1
View File
@@ -32,7 +32,7 @@ repos:
hooks:
- id: isort
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.0.282'
rev: 'v0.0.285'
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
+2 -2
View File
@@ -30,8 +30,8 @@ class CmdRemoteAdd(CmdRemote):
with self.config.edit(self.args.level) as conf:
if self.args.name in conf["remote"] and not self.args.force:
raise ConfigError(
"remote '{}' already exists. Use `-f|--force` to "
"overwrite it.".format(self.args.name)
f"remote '{self.args.name}' already exists. Use `-f|--force` to "
"overwrite it."
)
conf["remote"][self.args.name] = {"url": self.args.url}
+1 -1
View File
@@ -196,7 +196,7 @@ class ETagMismatchError(DvcException):
def __init__(self, etag, cached_etag):
super().__init__(
"ETag mismatch detected when copying file to cache! "
"(expected: '{}', actual: '{}')".format(etag, cached_etag)
f"(expected: '{etag}', actual: '{cached_etag}')"
)
+3 -1
View File
@@ -148,7 +148,9 @@ class DvcIgnorePatterns(DvcIgnore):
return bool(self.pattern_list)
CheckIgnoreResult = namedtuple("CheckIgnoreResult", ["file", "match", "patterns"])
CheckIgnoreResult = namedtuple( # noqa: PYI024
"CheckIgnoreResult", ["file", "match", "patterns"]
)
def _no_match(path):
+5 -9
View File
@@ -1142,7 +1142,7 @@ class Output:
if not force and not prompt.confirm(msg.format(self.fs_path)):
raise CollectCacheError( # noqa: B904
"unable to fully collect used cache"
" without cache for directory '{}'".format(self)
f" without cache for directory '{self}'"
)
return None
@@ -1171,19 +1171,15 @@ class Output:
if not self.hash_info:
msg = (
"Output '{}'({}) is missing version info. "
f"Output '{self}'({self.stage}) is missing version info. "
"Cache for it will not be collected. "
"Use `dvc repro` to get your pipeline up to date.".format(
self, self.stage
)
"Use `dvc repro` to get your pipeline up to date."
)
if self.exists:
msg += (
"\n"
"You can also use `dvc commit {stage.addressing}` "
"to associate existing '{out}' with {stage}.".format(
out=self, stage=self.stage
)
f"You can also use `dvc commit {self.stage.addressing}` "
f"to associate existing '{self}' with {self.stage}."
)
logger.warning(msg)
return {}
+1 -1
View File
@@ -8,7 +8,7 @@ from pathspec.util import normalize_file
from dvc.utils import relpath
PatternInfo = namedtuple("PatternInfo", ["patterns", "file_info"])
PatternInfo = namedtuple("PatternInfo", ["patterns", "file_info"]) # noqa: PYI024
def _not_ignore(rule):
+2 -2
View File
@@ -46,8 +46,8 @@ SUPPORTED_IMAGE_EXTENSIONS = ImageRenderer.EXTENSIONS
class PlotMetricTypeError(DvcException):
def __init__(self, file):
super().__init__(
"'{}' - file type error\n"
"Only JSON, YAML, CSV and TSV formats are supported.".format(file)
f"'{file}' - file type error\n"
"Only JSON, YAML, CSV and TSV formats are supported."
)
+1 -1
View File
@@ -98,7 +98,7 @@ class StageNameUnspecified(DvcException):
def __init__(self, file):
super().__init__(
"Stage name not provided."
"Please specify the name as: `{}:stage_name`".format(file.relpath)
f"Please specify the name as: `{file.relpath}:stage_name`"
)
+2 -2
View File
@@ -115,8 +115,8 @@ class TmpDir(pathlib.Path):
def _require(self, name):
if not hasattr(self, name):
raise TypeError(
"Can't use {name} for this temporary dir. "
'Did you forget to use "{name}" fixture?'.format(name=name)
f"Can't use {name} for this temporary dir. "
f'Did you forget to use "{name}" fixture?'
)
# Bootstrapping methods
+2 -5
View File
@@ -113,10 +113,7 @@ def test_init_when_ignored_by_git(tmp_dir, scm, caplog):
with caplog.at_level(logging.ERROR, logger="dvc"):
assert main(["init"]) == 1
assert (
"{dvc_dir} is ignored by your SCM tool. \n"
f"{tmp_dir / DvcRepo.DVC_DIR} is ignored by your SCM tool. \n"
"Make sure that it's tracked, "
"for example, by adding '!.dvc' to .gitignore.".format(
dvc_dir=tmp_dir / DvcRepo.DVC_DIR
)
in caplog.text
"for example, by adding '!.dvc' to .gitignore." in caplog.text
)
+14 -14
View File
@@ -45,10 +45,10 @@ def test_default(mocker, capsys, dvc):
" file\n"
"\n"
"Renamed:\n"
" data{sep}file_old -> data{sep}file_new\n"
f" data{os.path.sep}file_old -> data{os.path.sep}file_new\n"
"\n"
"files summary: 1 added, 1 renamed"
).format(sep=os.path.sep) in capsys.readouterr()[0]
) in capsys.readouterr()[0]
def test_show_hash(mocker, capsys, dvc):
@@ -252,14 +252,14 @@ def test_show_markdown(capsys):
"|--------------|----------------------|\n"
"| added | file |\n"
"| deleted | zoo |\n"
"| deleted | data{sep} |\n"
"| deleted | data{sep}foo |\n"
"| deleted | data{sep}bar |\n"
f"| deleted | data{os.path.sep} |\n"
f"| deleted | data{os.path.sep}foo |\n"
f"| deleted | data{os.path.sep}bar |\n"
"| renamed | file_old -> file_new |\n"
"| modified | file |\n"
"| not in cache | file2 |\n"
"\n"
).format(sep=os.path.sep)
)
def test_show_markdown_with_hash(capsys):
@@ -289,14 +289,14 @@ def test_show_markdown_with_hash(capsys):
"|--------------|--------------------|----------------------|\n"
"| added | 00000000 | file |\n"
"| deleted | 22222 | zoo |\n"
"| deleted | XXXXXXXX | data{sep} |\n"
"| deleted | 11111111 | data{sep}foo |\n"
"| deleted | 00000000 | data{sep}bar |\n"
f"| deleted | XXXXXXXX | data{os.path.sep} |\n"
f"| deleted | 11111111 | data{os.path.sep}foo |\n"
f"| deleted | 00000000 | data{os.path.sep}bar |\n"
"| renamed | 11111111 | file_old -> file_new |\n"
"| modified | AAAAAAAA..BBBBBBBB | file |\n"
"| not in cache | 12345678 | file2 |\n"
"\n"
).format(sep=os.path.sep)
)
def test_show_markdown_hide_missing(capsys):
@@ -321,13 +321,13 @@ def test_show_markdown_hide_missing(capsys):
"|----------|----------------------|\n"
"| added | file |\n"
"| deleted | zoo |\n"
"| deleted | data{sep} |\n"
"| deleted | data{sep}foo |\n"
"| deleted | data{sep}bar |\n"
f"| deleted | data{os.path.sep} |\n"
f"| deleted | data{os.path.sep}foo |\n"
f"| deleted | data{os.path.sep}bar |\n"
"| renamed | file_old -> file_new |\n"
"| modified | file |\n"
"\n"
).format(sep=os.path.sep)
)
def test_hide_missing(mocker, capsys, dvc):
-2
View File
@@ -80,10 +80,8 @@ def test_resolve_output(inp, out, is_dir, expected, mocker):
["dvc.yaml:name", ("dvc.yaml", "name"), None],
[":name", ("dvc.yaml", "name"), None],
["stage.dvc", ("stage.dvc", None), None],
["dvc.yaml:name", ("dvc.yaml", "name"), None],
["../models/stage.dvc", ("../models/stage.dvc", None), "def"],
[":name", ("default", "name"), "default"],
[":name", ("default", "name"), "default"],
["something.dvc:name", ("something.dvc", "name"), None],
["../something.dvc:name", ("../something.dvc", "name"), None],
["file", (None, "file"), None],