Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pre-commit.ci] pre-commit autoupdate #972

Merged
merged 3 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/update-strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
data_description = {}
for k, _, typ in const.VALIDATION_TUPLES:
desc = const.DOCS[k]
if len(desc) > 40 and typ != bool and typ != cv.entity_ids:
if len(desc) > 40 and typ not in (bool, cv.entity_ids):
data[k] = k
data_description[k] = desc
else:
Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v5.0.0
hooks:
- id: check-added-large-files
- id: trailing-whitespace
- id: end-of-file-fixer
- id: mixed-line-ending
args: ["--fix=lf"]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.5
rev: v0.8.4
hooks:
- id: ruff
args: ["--fix"]
- repo: https://github.com/psf/black
rev: 24.3.0
rev: 24.10.0
hooks:
- id: black
4 changes: 2 additions & 2 deletions custom_components/adaptive_lighting/adaptation_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ def _split_service_call_data(service_data: ServiceData) -> list[ServiceData]:
if service_datas and (transition := service_data.get(ATTR_TRANSITION)) is not None:
transition /= len(service_datas)

for service_data in service_datas:
service_data[ATTR_TRANSITION] = transition
for _service_data in service_datas:
_service_data[ATTR_TRANSITION] = transition

return service_datas

Expand Down
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
7 changes: 2 additions & 5 deletions tests/test_switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -2112,11 +2112,8 @@ async def test_light_group(
assert events[1].context.id == "testing"
e1 = events[2].data["service_data"][ATTR_ENTITY_ID]
e2 = events[3].data["service_data"][ATTR_ENTITY_ID]
assert (
e1 == "light.light_4"
and e2 == "light.light_5"
or e1 == "light.light_5"
and e2 == "light.light_4"
assert (e1 == "light.light_4" and e2 == "light.light_5") or (
e1 == "light.light_5" and e2 == "light.light_4"
)
assert ":lght:" in events[2].context.id
assert ":lght:" in events[3].context.id
Expand Down
12 changes: 4 additions & 8 deletions webapp/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
Loading