From 4c1140c51705ed2bd4385546d69b10e79e5808cb Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 6 Sep 2026 11:38:40 +0200 Subject: [PATCH] [pre-commit.ci] pre-commit autoupdate (#1229) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [pre-commit.ci] pre-commit autoupdate updates: - [github.com/pre-commit/pre-commit-hooks: v5.0.0 → v6.0.0](https://github.com/pre-commit/pre-commit-hooks/compare/v5.0.0...v6.0.0) - [github.com/astral-sh/ruff-pre-commit: v0.11.13 → v0.16.5](https://github.com/astral-sh/ruff-pre-commit/compare/v0.11.13...v0.16.5) - https://github.com/psf/black → https://github.com/psf/black-pre-commit-mirror - [github.com/psf/black-pre-commit-mirror: 25.1.0 → 26.5.1](https://github.com/psf/black-pre-commit-mirror/compare/25.1.0...26.5.1) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * ci: preserve Ruff lint baseline --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Bas Nijholt --- .pre-commit-config.yaml | 8 ++++---- .ruff.toml | 10 +++++++--- custom_components/adaptive_lighting/switch.py | 2 +- scripts/update-test-matrix.py | 2 +- tests/test_switch.py | 2 +- 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1321a487..b5cd6d52 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v5.0.0 + rev: v6.0.0 hooks: - id: check-added-large-files - id: trailing-whitespace @@ -8,11 +8,11 @@ repos: - id: mixed-line-ending args: ["--fix=lf"] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.11.13 + rev: v0.16.5 hooks: - id: ruff args: ["--fix"] - - repo: https://github.com/psf/black - rev: 25.1.0 + - repo: https://github.com/psf/black-pre-commit-mirror + rev: 26.5.1 hooks: - id: black diff --git a/.ruff.toml b/.ruff.toml index fe94764b..6a2187b0 100644 --- a/.ruff.toml +++ b/.ruff.toml @@ -1,6 +1,6 @@ # The contents of this file is based on https://github.com/home-assistant/core/blob/dev/pyproject.toml -target-version = "py310" +target-version = "py312" [lint] select = ["ALL"] @@ -8,19 +8,23 @@ select = ["ALL"] # by the codebase. The plan is to fix them all (when sensible) and then enable them. ignore = [ "ANN", - "ANN101", # Missing type annotation for {name} in method "ANN401", # Dynamically typed expressions (typing.Any) are disallowed in {name} + "CPY001", # Missing copyright notice at top of file "D401", # First line of docstring should be in imperative mood "E501", # line too long "FBT001", # Boolean positional arg in function definition "FBT002", # Boolean default value in function definition "FIX004", # Line contains HACK, consider resolving the issue - "PD901", # df is a bad variable name. Be kinder to your future self. "PERF203", # `try`-`except` within a loop incurs performance overhead + "PLC0415", # `import` should be at the top-level of a file "PLR0913", # Too many arguments to function call (N > 5) + "PLR0917", # Too many positional arguments "PLR2004", # Magic value used in comparison, consider replacing X with a constant variable + "RUF059", # Unpacked variable is never used "S101", # Use of assert detected "SLF001", # Private member accessed + "UP017", # Use datetime.UTC alias + "UP042", # Replace str, Enum inheritance with StrEnum ] [lint.per-file-ignores] diff --git a/custom_components/adaptive_lighting/switch.py b/custom_components/adaptive_lighting/switch.py index eb62d7b6..d851702b 100644 --- a/custom_components/adaptive_lighting/switch.py +++ b/custom_components/adaptive_lighting/switch.py @@ -3028,7 +3028,7 @@ class AdaptiveLightingManager: class _AsyncSingleShotTimer: - def __init__(self, delay: float, callback: Callable[[], None | Any]) -> None: + def __init__(self, delay: float, callback: Callable[[], Any | None]) -> None: """Initialize the timer.""" self.delay = delay self.callback = callback diff --git a/scripts/update-test-matrix.py b/scripts/update-test-matrix.py index c37b7f25..59b18baa 100755 --- a/scripts/update-test-matrix.py +++ b/scripts/update-test-matrix.py @@ -28,7 +28,7 @@ def get_ha_core_versions() -> list[str]: # Paginate through all tags to ensure we get older versions too while True: url = f"https://api.github.com/repos/home-assistant/core/tags?per_page=100&page={page}" - with urllib.request.urlopen(url) as response: # noqa: S310 + with urllib.request.urlopen(url) as response: tags = json.loads(response.read().decode()) if not tags: diff --git a/tests/test_switch.py b/tests/test_switch.py index aa70332c..0d16f64f 100644 --- a/tests/test_switch.py +++ b/tests/test_switch.py @@ -1697,7 +1697,7 @@ async def test_offset_too_large(hass): which makes the adaptive lighting algorithm fail with a ValueError. """ _, switch = await setup_switch(hass, {CONF_SUNRISE_OFFSET: 3600 * 12}) - with pytest.raises(ValueError, match="sun events.*not in the expected order"): + with pytest.raises(ValueError, match=r"sun events.*not in the expected order"): await switch._update_attrs_and_maybe_adapt_lights( context=switch.create_context("test"), )