diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e7b8b253..e032e91e 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: v4.4.0 + rev: v4.5.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.0.284 + rev: v0.0.292 hooks: - id: ruff args: ["--fix"] - repo: https://github.com/psf/black - rev: 23.7.0 + rev: 23.9.1 hooks: - id: black diff --git a/custom_components/adaptive_lighting/color_and_brightness.py b/custom_components/adaptive_lighting/color_and_brightness.py index 2968fcc0..9441e9e6 100644 --- a/custom_components/adaptive_lighting/color_and_brightness.py +++ b/custom_components/adaptive_lighting/color_and_brightness.py @@ -186,10 +186,10 @@ class SunEvents: def closest_event(self, dt: datetime.datetime) -> tuple[str, float]: """Get the closest sunset or sunrise event.""" (prev_event, prev_ts), (next_event, next_ts) = self.prev_and_next_events(dt) - if prev_event == SUN_EVENT_SUNRISE or next_event == SUN_EVENT_SUNRISE: + if SUN_EVENT_SUNRISE in (prev_event, next_event): ts_event = prev_ts if prev_event == SUN_EVENT_SUNRISE else next_ts return SUN_EVENT_SUNRISE, ts_event - if prev_event == SUN_EVENT_SUNSET or next_event == SUN_EVENT_SUNSET: + if SUN_EVENT_SUNSET in (prev_event, next_event): ts_event = prev_ts if prev_event == SUN_EVENT_SUNSET else next_ts return SUN_EVENT_SUNSET, ts_event msg = "No sunrise or sunset event found."