Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Sep 2, 2024
1 parent 252d2df commit fb00277
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
12 changes: 4 additions & 8 deletions custom_components/adaptive_lighting/color_and_brightness.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,10 @@ def sunrise(self, dt: datetime.date) -> datetime.datetime:
) + self.sunrise_offset
if self.min_sunrise_time is not None:
min_sunrise = self._replace_time(dt, self.min_sunrise_time)
if min_sunrise > sunrise:
sunrise = min_sunrise
sunrise = max(min_sunrise, sunrise)
if self.max_sunrise_time is not None:
max_sunrise = self._replace_time(dt, self.max_sunrise_time)
if max_sunrise < sunrise:
sunrise = max_sunrise
sunrise = min(max_sunrise, sunrise)
return sunrise

def sunset(self, dt: datetime.date) -> datetime.datetime:
Expand All @@ -81,12 +79,10 @@ def sunset(self, dt: datetime.date) -> datetime.datetime:
) + self.sunset_offset
if self.min_sunset_time is not None:
min_sunset = self._replace_time(dt, self.min_sunset_time)
if min_sunset > sunset:
sunset = min_sunset
sunset = max(min_sunset, sunset)
if self.max_sunset_time is not None:
max_sunset = self._replace_time(dt, self.max_sunset_time)
if max_sunset < sunset:
sunset = max_sunset
sunset = min(max_sunset, sunset)
return sunset

def _replace_time(
Expand Down
2 changes: 1 addition & 1 deletion custom_components/adaptive_lighting/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -2552,7 +2552,7 @@ def _off_to_on_state_event_is_from_turn_on(
and id_off_to_on == turn_on_event.context.id
)

async def just_turned_off( # noqa: PLR0911, PLR0912
async def just_turned_off( # noqa: PLR0911
self,
entity_id: str,
) -> bool:
Expand Down

0 comments on commit fb00277

Please sign in to comment.