Skip to content

Commit 0bb963e

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent a3ad1cf commit 0bb963e

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

custom_components/adaptive_lighting/color_and_brightness.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,10 @@ def sunrise(self, dt: datetime.date) -> datetime.datetime:
6464
) + self.sunrise_offset
6565
if self.min_sunrise_time is not None:
6666
min_sunrise = self._replace_time(dt, self.min_sunrise_time)
67-
if min_sunrise > sunrise:
68-
sunrise = min_sunrise
67+
sunrise = max(min_sunrise, sunrise)
6968
if self.max_sunrise_time is not None:
7069
max_sunrise = self._replace_time(dt, self.max_sunrise_time)
71-
if max_sunrise < sunrise:
72-
sunrise = max_sunrise
70+
sunrise = min(max_sunrise, sunrise)
7371
return sunrise
7472

7573
def sunset(self, dt: datetime.date) -> datetime.datetime:
@@ -81,12 +79,10 @@ def sunset(self, dt: datetime.date) -> datetime.datetime:
8179
) + self.sunset_offset
8280
if self.min_sunset_time is not None:
8381
min_sunset = self._replace_time(dt, self.min_sunset_time)
84-
if min_sunset > sunset:
85-
sunset = min_sunset
82+
sunset = max(min_sunset, sunset)
8683
if self.max_sunset_time is not None:
8784
max_sunset = self._replace_time(dt, self.max_sunset_time)
88-
if max_sunset < sunset:
89-
sunset = max_sunset
85+
sunset = min(max_sunset, sunset)
9086
return sunset
9187

9288
def _replace_time(

custom_components/adaptive_lighting/switch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2552,7 +2552,7 @@ def _off_to_on_state_event_is_from_turn_on(
25522552
and id_off_to_on == turn_on_event.context.id
25532553
)
25542554

2555-
async def just_turned_off( # noqa: PLR0911, PLR0912
2555+
async def just_turned_off( # noqa: PLR0911
25562556
self,
25572557
entity_id: str,
25582558
) -> bool:

0 commit comments

Comments
 (0)