From c541954a801d6cf32d0eae4f1927cfc836c7f059 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 11 Feb 2026 07:45:58 +0000 Subject: [PATCH] fix: resolve ruff v0.15.0 linter errors - PYI034: Use `Self` return type for `__enter__` in SCMContext - PLW0108: Replace unnecessary lambda with direct `bool` reference https://claude.ai/code/session_01M18n2k6KLenwMRANgSFMXc --- dvc/repo/scm_context.py | 4 +++- tests/unit/command/test_help.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/dvc/repo/scm_context.py b/dvc/repo/scm_context.py index 7435f6378b..61b8e85805 100644 --- a/dvc/repo/scm_context.py +++ b/dvc/repo/scm_context.py @@ -10,6 +10,8 @@ from dvc.utils.collections import ensure_list if TYPE_CHECKING: + from typing_extensions import Self + from dvc.repo import Repo from dvc.scm import Base @@ -131,7 +133,7 @@ def __call__( self.files_to_track = set() - def __enter__(self) -> "SCMContext": + def __enter__(self) -> "Self": self._cm = self() return self._cm.__enter__() diff --git a/tests/unit/command/test_help.py b/tests/unit/command/test_help.py index 488cb63f4d..b483036b56 100644 --- a/tests/unit/command/test_help.py +++ b/tests/unit/command/test_help.py @@ -47,7 +47,7 @@ def test_help(caplog, capsys, command_tuples): out, err = capsys.readouterr() # validate metavars are all in lowercase - usage = "\n".join(takewhile(lambda o: bool(o), out.splitlines())) + usage = "\n".join(takewhile(bool, out.splitlines())) message = ( "metavars not lowercased, you are likely missing formatter_class=XXX "