Enable SLF in ruff

This commit is contained in:
Alexander Hess 2026-11-30 22:35:24 +01:00
commit d0326aee4f
Signed by: alexander
GPG key ID: B46EDB4DFC26805D

View file

@ -557,7 +557,7 @@ def do_not_accept_arguments(session: nox.Session, *, raise_error: bool = True) -
def do_not_reuse(session: nox.Session, *, raise_error: bool = True) -> None:
"""Do not reuse a session with the "-r" or "-R" flags."""
if session._runner.venv._reused:
if session._runner.venv._reused: # noqa:SLF001
msg = 'be run without the "-r" and "-R" flags'
if raise_error:
@ -645,8 +645,9 @@ def skip_install(session: nox.Session) -> bool:
"""
# Same logic to skip package installation as in core `nox`
# See: https://github.com/wntrblm/nox/blob/2026.10.20/nox/sessions.py#L905
venv = session._runner.venv
return bool(session._runner.global_config.no_install and venv._reused)
no_install = session._runner.global_config.no_install # noqa:SLF001
venv_reused = session._runner.venv._reused # noqa:SLF001
return bool(no_install and venv_reused)
if MAIN_PYTHON not in SUPPORTED_PYTHONS: