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

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

updates:
- [github.com/charliermarsh/ruff-pre-commit: v0.0.254 → v0.0.257](https://github.com/charliermarsh/ruff-pre-commit/compare/v0.0.254...v0.0.257)
- [github.com/codespell-project/codespell: v2.2.2 → v2.2.4](https://github.com/codespell-project/codespell/compare/v2.2.2...v2.2.4)

* pre-commit: fix ruff errors

* pre-commit: fix flake8

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: David de la Iglesia Castro <[email protected]>
This commit is contained in:
pre-commit-ci[bot]
2023-03-23 13:05:31 +00:00
committed by GitHub
co-authored by David de la Iglesia Castro
parent f8bbf20b77
commit 48b56c83dc
15 changed files with 28 additions and 29 deletions
+2 -2
View File
@@ -43,11 +43,11 @@ repos:
hooks:
- id: isort
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: 'v0.0.254'
rev: 'v0.0.257'
hooks:
- id: ruff
- repo: https://github.com/codespell-project/codespell
rev: v2.2.2
rev: v2.2.4
hooks:
- id: codespell
additional_dependencies: ["tomli"]
+1 -1
View File
@@ -39,7 +39,7 @@ class CmdCheckIgnore(CmdBase):
target = input()
except (KeyboardInterrupt, EOFError):
break
if target == "":
if not target:
break
if not self._check_one_file(target):
ret = 0
+1 -1
View File
@@ -84,7 +84,7 @@ class CmdPlots(CmdBase):
if html_template_path and not os.path.isabs(html_template_path):
assert self.repo.dvc_dir
html_template_path = os.path.join(self.repo.dvc_dir, html_template_path)
return html_template_path # noqa: RET504
return html_template_path
def run(self) -> int: # noqa: C901, PLR0911, PLR0912
from pathlib import Path
+2 -2
View File
@@ -62,9 +62,9 @@ def ByUrl(mapping): # noqa: N802
parsed = urlparse(data["url"])
# Windows absolute paths should really have scheme == "" (local)
if os.name == "nt" and len(parsed.scheme) == 1 and parsed.netloc == "":
if os.name == "nt" and len(parsed.scheme) == 1 and not parsed.netloc:
return schemas[""](data)
if parsed.netloc == "":
if not parsed.netloc:
return schemas[""](data)
if parsed.scheme not in schemas:
raise Invalid(f"Unsupported URL type {parsed.scheme}://")
+1 -1
View File
@@ -366,7 +366,7 @@ def get_lockfile_schema(d):
def migrate_lock_v1_to_v2(d, version_info):
stages = {k: v for k, v in d.items()}
stages = dict(d)
for key in stages:
d.pop(key)
+1 -1
View File
@@ -139,7 +139,7 @@ def _get_supported_remotes():
def get_fs_type(path):
partition = {}
for part in psutil.disk_partitions(all=True):
if part.fstype != "":
if part.fstype:
try:
mountpoint = pathlib.Path(part.mountpoint).resolve()
partition[mountpoint] = part.fstype + " on " + part.device
-1
View File
@@ -56,7 +56,6 @@ def _verify_field(file2datapoints: Dict[str, List], filename: str, field: str):
datapoint = first(file2datapoints[filename])
if field not in datapoint:
raise FieldNotFoundError(field, datapoint.keys())
return
def _get_xs(properties: Dict, file2datapoints: Dict[str, List[Dict]]):
+1 -1
View File
@@ -620,7 +620,7 @@ def test_run_env(tmp_dir, dvc, scm, mocker):
)
dvc.experiments.run()
assert (tmp_dir / "DVC_EXP_BASELINE_REV").read_text().strip() == baseline
assert (tmp_dir / "DVC_EXP_NAME").read_text().strip() != ""
assert (tmp_dir / "DVC_EXP_NAME").read_text().strip()
assert (tmp_dir / "STUDIO_REPO_URL").read_text().strip() == "REPO_URL"
dvc.experiments.run(name="foo")
+5 -5
View File
@@ -166,7 +166,7 @@ def test_when_params_is_omitted_in_interactive_mode(tmp_dir, scm, dvc):
}
}
assert not (tmp_dir / "dvc.lock").exists()
assert (tmp_dir / "script.py").read_text() == ""
assert not (tmp_dir / "script.py").read_text()
assert (tmp_dir / "data").is_dir()
scm._reset()
assert scm.is_tracked("dvc.yaml")
@@ -194,7 +194,7 @@ def test_init_interactive_params_validation(tmp_dir, dvc, capsys):
}
}
}
assert (tmp_dir / "script.py").read_text() == ""
assert not (tmp_dir / "script.py").read_text()
assert (tmp_dir / "data").is_dir()
out, err = capsys.readouterr()
@@ -226,7 +226,7 @@ def test_init_with_no_defaults_interactive(tmp_dir, dvc):
}
}
}
assert (tmp_dir / "script.py").read_text() == ""
assert not (tmp_dir / "script.py").read_text()
assert (tmp_dir / "data").is_dir()
@@ -275,7 +275,7 @@ def test_init_default(tmp_dir, scm, dvc, interactive, overrides, inp, capsys):
}
}
assert not (tmp_dir / "dvc.lock").exists()
assert (tmp_dir / "script.py").read_text() == ""
assert not (tmp_dir / "script.py").read_text()
assert (tmp_dir / "data").is_dir()
scm._reset()
assert scm.is_tracked("dvc.yaml")
@@ -345,7 +345,7 @@ def test_init_interactive_live(tmp_dir, scm, dvc, interactive, overrides, inp, c
}
}
assert not (tmp_dir / "dvc.lock").exists()
assert (tmp_dir / "script.py").read_text() == ""
assert not (tmp_dir / "script.py").read_text()
assert (tmp_dir / "data").is_dir()
scm._reset()
assert scm.is_tracked("dvc.yaml")
+1 -1
View File
@@ -217,7 +217,7 @@ def test_get_url_positive(tmp_dir, erepo_dir, caplog, local_cloud):
caplog.clear()
with caplog.at_level(logging.ERROR, logger="dvc"):
assert main(["get", os.fspath(erepo_dir), "foo", "--show-url"]) == 0
assert caplog.text == ""
assert not caplog.text
def test_get_url_not_existing(tmp_dir, erepo_dir, caplog):
+1 -1
View File
@@ -65,7 +65,7 @@ def test_init_quiet_should_not_display_welcome_screen(tmp_dir, scm, caplog):
ret = main(["init", "--quiet"])
assert ret == 0
assert caplog.text == ""
assert not caplog.text
def test_allow_init_dvc_subdir(tmp_dir, scm, monkeypatch):
+1 -1
View File
@@ -27,7 +27,7 @@ def test_unlock_lock_failed(tmp_dir, dvc, request, mocker):
# repro of a stage) in with. We should see LockError exception here.
with lock:
lock.unlock()
lock_ext.lock() # imitate an exernal process had time to lock it
lock_ext.lock() # imitate an external process had time to lock it
request.addfinalizer(lock_ext.unlock)
with pytest.raises(LockError):
lock.lock()
+2 -2
View File
@@ -200,13 +200,13 @@ class TestColorFormatter:
formatter.format(debug_record)
captured = capsys.readouterr()
assert captured.out == ""
assert not captured.out
# when the message is actually visible
with caplog.at_level(logging.INFO, logger="dvc"):
logger.info("some info")
captured = capsys.readouterr()
assert captured.out == ""
assert not captured.out
def test_handlers():
+7 -7
View File
@@ -9,8 +9,8 @@ def test_quiet_logging(caplog, capsys):
for _ in Tqdm(range(10)):
pass
out_err = capsys.readouterr()
assert out_err.out == ""
assert out_err.err == ""
assert not out_err.out
assert not out_err.err
def test_quiet_logging_disable_false(caplog, capsys, mocker):
@@ -20,8 +20,8 @@ def test_quiet_logging_disable_false(caplog, capsys, mocker):
for _ in Tqdm(range(10), disable=False):
pass
out_err = capsys.readouterr()
assert out_err.out == ""
assert out_err.err == ""
assert not out_err.out
assert not out_err.err
def test_quiet_notty(caplog, capsys):
@@ -29,11 +29,11 @@ def test_quiet_notty(caplog, capsys):
for _ in Tqdm(range(10)):
pass
out_err = capsys.readouterr()
assert out_err.out == ""
assert not out_err.out
if env2bool("DVC_IGNORE_ISATTY"):
assert "0/10" in out_err.err
else:
assert out_err.err == ""
assert not out_err.err
def test_default(caplog, capsys, mocker):
@@ -44,5 +44,5 @@ def test_default(caplog, capsys, mocker):
pass
out_err = capsys.readouterr()
assert out_err.out == ""
assert not out_err.out
assert "0/10" in out_err.err
+2 -2
View File
@@ -34,8 +34,8 @@ def test_get_summary():
del stats["modified"]
assert get_summary(stats.items()) == "3 files added"
assert get_summary([]) == ""
assert get_summary([("x", 0), ("y", [])]) == ""
assert not get_summary([])
assert not get_summary([("x", 0), ("y", [])])
assert get_summary([("x", 1), ("y", [])]) == "1 file x"