diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2eebf73d2..5c85701dc 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -22,7 +22,7 @@ repos: - id: sort-simple-yaml - id: trailing-whitespace - repo: https://github.com/astral-sh/ruff-pre-commit - rev: 'v0.4.1' + rev: 'v0.4.4' hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] diff --git a/dvc/commands/gc.py b/dvc/commands/gc.py index 96a2e1c32..ffed88c7e 100644 --- a/dvc/commands/gc.py +++ b/dvc/commands/gc.py @@ -60,7 +60,7 @@ class CmdGC(CmdBase): msg += " of the current and the following repos:" for repo_path in self.args.repos: - msg += "\n - %s" % os.path.abspath(repo_path) + msg += f"\n - {os.path.abspath(repo_path)}" else: msg += " of the current repo." diff --git a/dvc/fs/dvc.py b/dvc/fs/dvc.py index fefb1ea45..7485d0a6a 100644 --- a/dvc/fs/dvc.py +++ b/dvc/fs/dvc.py @@ -360,7 +360,7 @@ class _DVCFileSystem(AbstractFileSystem): except FileNotFoundError: return False - def ls(self, path, detail=True, dvc_only=False, **kwargs): # noqa: C901 + def ls(self, path, detail=True, dvc_only=False, **kwargs): # noqa: C901, PLR0912 key = self._get_key_from_relative(path) repo, dvc_fs, subkey = self._get_subrepo_info(key) diff --git a/dvc/repo/artifacts.py b/dvc/repo/artifacts.py index bb6584498..dda6c4ef3 100644 --- a/dvc/repo/artifacts.py +++ b/dvc/repo/artifacts.py @@ -267,7 +267,7 @@ class Artifacts: from_infos.append(url) except DvcException: raise - except Exception as exc: # noqa: BLE001 + except Exception as exc: raise DvcException( f"Failed to download artifact '{name}' via Studio" ) from exc @@ -369,7 +369,7 @@ class Artifacts: ) except FileExistsLocallyError: raise - except Exception as exc: # noqa: BLE001 + except Exception as exc: if saved_exc: logger.exception(str(saved_exc), exc_info=saved_exc.__cause__) raise DvcException( diff --git a/dvc/repo/experiments/queue/tempdir.py b/dvc/repo/experiments/queue/tempdir.py index d6490bbd4..fd4e98072 100644 --- a/dvc/repo/experiments/queue/tempdir.py +++ b/dvc/repo/experiments/queue/tempdir.py @@ -125,7 +125,7 @@ class TempDirQueue(WorkspaceQueue): ) except DvcException: raise - except Exception as exc: # noqa: BLE001 + except Exception as exc: raise DvcException(f"Failed to reproduce experiment '{rev[:7]}'") from exc finally: executor.cleanup(infofile) diff --git a/dvc/repo/experiments/queue/workspace.py b/dvc/repo/experiments/queue/workspace.py index b29fdb0ad..05d221bc2 100644 --- a/dvc/repo/experiments/queue/workspace.py +++ b/dvc/repo/experiments/queue/workspace.py @@ -131,7 +131,7 @@ class WorkspaceQueue(BaseStashQueue): ) except DvcException: raise - except Exception as exc: # noqa: BLE001 + except Exception as exc: raise DvcException(f"Failed to reproduce experiment '{rev[:7]}'") from exc finally: executor.cleanup(infofile) diff --git a/dvc/repo/gc.py b/dvc/repo/gc.py index eb660c4ce..ef34e6fc3 100644 --- a/dvc/repo/gc.py +++ b/dvc/repo/gc.py @@ -50,7 +50,7 @@ def _used_obj_ids_not_in_remote( @locked -def gc( # noqa: PLR0913, C901 +def gc( # noqa: C901, PLR0912, PLR0913 self: "Repo", all_branches: bool = False, cloud: bool = False, diff --git a/dvc/repo/metrics/show.py b/dvc/repo/metrics/show.py index d1143453c..62f0d401c 100644 --- a/dvc/repo/metrics/show.py +++ b/dvc/repo/metrics/show.py @@ -224,7 +224,7 @@ def show( on_error=on_error, ) res[rev] = Result(data=result) - except Exception as exc: # noqa: BLE001 + except Exception as exc: if on_error == "raise": raise diff --git a/dvc/repo/params/show.py b/dvc/repo/params/show.py index de69755c9..30bcce228 100644 --- a/dvc/repo/params/show.py +++ b/dvc/repo/params/show.py @@ -191,7 +191,7 @@ def show( on_error=on_error, ) res[rev] = Result(data=params) - except Exception as exc: # noqa: BLE001 + except Exception as exc: if on_error == "raise": raise logger.warning("failed to load params in revision %r, %s", rev, str(exc))