Skip to content

Commit

Permalink
fixed linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
toggm committed Nov 19, 2024
1 parent a06f4a1 commit 82ec4bb
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion custom_components/askoheat/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ def _prepare_str(value: object) -> list[int]:
byte_list = str_value.encode("utf-8")
size = int(len(byte_list) / 2)
result = []
for index in range(0, size):
for index in range(size):
b = byte_list[index * 2 : index * 2 + 1]
result.append(int.from_bytes(b, "little"))
return result
Expand Down
14 changes: 8 additions & 6 deletions custom_components/askoheat/api_desc.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,21 @@
from abc import ABC
from dataclasses import dataclass, field
from enum import IntEnum, StrEnum
from typing import TYPE_CHECKING, Callable, TypeVar

import numpy
from typing import TYPE_CHECKING, TypeVar

if TYPE_CHECKING:
from collections.abc import Callable

import numpy as np

from custom_components.askoheat.model import (
AskoheatBinarySensorEntityDescription,
AskoheatNumberEntityDescription,
AskoheatSelectEntityDescription,
AskoheatSensorEntityDescription,
AskoheatSwitchEntityDescription,
AskoheatTimeEntityDescription,
AskoheatSelectEntityDescription,
AskoheatTextEntityDescription,
AskoheatTimeEntityDescription,
)


Expand Down Expand Up @@ -90,7 +92,7 @@ class StrEnumInputDescriptor[E](StringRegisterInputDescriptor):
class IntEnumInputDescriptor[E2](ByteRegisterInputDescriptor):
"""Input register representing a int based enum value."""

factory: Callable[[numpy.byte], E2]
factory: Callable[[np.byte], E2]
values: list[E2]


Expand Down
8 changes: 4 additions & 4 deletions custom_components/askoheat/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def __init__(
)
self.entity_description = entity_description
self.translation_key = (
entity_description.translation_key or entity_description.key.value # type: ignore
entity_description.translation_key or entity_description.key.value # type: ignore # noqa: PGH003
)

async def async_added_to_hass(self) -> None:
Expand All @@ -61,10 +61,10 @@ def _handle_coordinator_update(self) -> None:
icon_state = self._attr_state
if hasattr(self, "_attr_is_on"):
icon_state = self._attr_is_on # type: ignore # noqa: PGH003
if descr.icon_by_state is not None and icon_state in descr.icon_by_state: # type: ignore
self._attr_icon = descr.icon_by_state.get(icon_state) # type: ignore
if descr.icon_by_state is not None and icon_state in descr.icon_by_state: # type: ignore # noqa: PGH003
self._attr_icon = descr.icon_by_state.get(icon_state) # type: ignore # noqa: PGH003
else:
self._attr_icon = descr.icon # type: ignore
self._attr_icon = descr.icon # type: ignore # noqa: PGH003

super()._handle_coordinator_update()
self.async_write_ha_state()
2 changes: 1 addition & 1 deletion custom_components/askoheat/select.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Askoheat time entity."""

from functools import cached_property
import platform

from homeassistant.components.select import ENTITY_ID_FORMAT, SelectEntity
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.entity_platform import AddEntitiesCallback
Expand Down
3 changes: 0 additions & 3 deletions custom_components/askoheat/text.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"""Askoheat time entity."""

from datetime import time

from homeassistant.components.text import ENTITY_ID_FORMAT, TextEntity
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.entity_platform import AddEntitiesCallback
Expand All @@ -12,7 +10,6 @@
from custom_components.askoheat.coordinator import AskoheatDataUpdateCoordinator
from custom_components.askoheat.model import (
AskoheatTextEntityDescription,
AskoheatTimeEntityDescription,
)

from .data import AskoheatConfigEntry
Expand Down

0 comments on commit 82ec4bb

Please sign in to comment.