Skip to content

Commit

Permalink
maint: Remove linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
RogerSelwyn committed Dec 16, 2024
1 parent b13564e commit 98ddaef
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 24 deletions.
18 changes: 9 additions & 9 deletions custom_components/homelink/binary_sensor.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Support for HomeLINK sensors."""

from collections.abc import Callable
from typing import Any, List
from typing import Any

from homeassistant.components.binary_sensor import (
BinarySensorDeviceClass,
Expand Down Expand Up @@ -270,10 +270,10 @@ def __init__(
alarm_type: str,
) -> None:
"""Property entity object for HomeLINK sensor."""
self._alerts: List[dict] = []
self._alerts: list[dict] = []
self._status: bool | None = None
self._alarms_devices: List[str | None] | str = []
self._alarms_rooms: List[str | None] | str = []
self._alarms_devices: list[str | None] | str = []
self._alarms_rooms: list[str | None] | str = []
self._dev_reg = device_registry.async_get(hass)
super().__init__(coordinator, hl_property_key, alarm_type)
self._entry = entry
Expand Down Expand Up @@ -375,7 +375,7 @@ def _set_status(self) -> tuple[bool, list[str | None] | str, list[Any] | str]:
alarms_rooms or ALARMS_NONE,
)

def _set_alerts(self) -> List[dict]:
def _set_alerts(self) -> list[dict]:
# Alerts relate to devices on than environment sensor
# so there is no location
return [
Expand All @@ -393,7 +393,7 @@ def _set_alerts(self) -> List[dict]:
if not alert.location
]

def _get_alerts(self) -> List[Alert]:
def _get_alerts(self) -> list[Alert]:
# Retrieve the alert if:
# - Device is environment and the alert is and insight
# - Device is alarm and alert is not environment and not an insight
Expand Down Expand Up @@ -463,7 +463,7 @@ def __init__(
device_key: str,
) -> None:
"""Device entity object for HomeLINK sensor."""
self._alerts: List[dict] = []
self._alerts: list[dict] = []
super().__init__(coordinator, hl_property_key, device_key)
self._entry = entry

Expand Down Expand Up @@ -576,7 +576,7 @@ def _is_data_in_coordinator(self) -> bool:
def _set_status(self) -> bool:
return bool(self._get_alerts())

def _set_alerts(self) -> List[dict]:
def _set_alerts(self) -> list[dict]:
alerts = self._get_alerts()
return [
{
Expand All @@ -592,7 +592,7 @@ def _set_alerts(self) -> List[dict]:
for alert in alerts
]

def _get_alerts(self) -> List[Alert]:
def _get_alerts(self) -> list[Alert]:
# Retrieve the alert if:
# - The alert is a device and is for the entity device
# - The alert location is entity location and there is no serialnumber
Expand Down
6 changes: 3 additions & 3 deletions custom_components/homelink/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import time
from collections.abc import Mapping
from copy import deepcopy
from typing import Any, List, Self
from typing import Any, Self

import aiohttp
import homeassistant.helpers.config_validation as cv
Expand Down Expand Up @@ -173,7 +173,7 @@ def __init__(self, config_entry: ConfigEntry):
self._webhook_id = options.get(CONF_WEBHOOK_ID, None)
self._user_input: dict[str, Any] | None = None
self._webhook_displayed = False
self._property_list: List[str] = []
self._property_list: list[str] = []

async def async_step_init(
self,
Expand Down Expand Up @@ -264,7 +264,7 @@ async def async_step_user(
errors=errors,
)

async def _async_get_properties(self) -> List[str]:
async def _async_get_properties(self) -> list[str]:
# Perform authentication and fail if not possible
# Then retrieve the property list
implementation = (
Expand Down
6 changes: 2 additions & 4 deletions custom_components/homelink/event.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"""Support for HomeLINK events."""

from typing import List

from homeassistant.components.event import DOMAIN as EVENT_DOMAIN
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant, callback
Expand Down Expand Up @@ -126,7 +124,7 @@ class HomeLINKPropertyEvent(HomeLINKEventEntity):
"""Event entity for HomeLINK Property."""

def __init__(
self, entry: HLConfigEntry, hl_property_key: str, eventtypes: List[str]
self, entry: HLConfigEntry, hl_property_key: str, eventtypes: list[str]
) -> None:
"""Property event entity object for HomeLINK sensor."""
super().__init__(entry, hl_property_key, eventtypes, hl_property_key)
Expand All @@ -147,7 +145,7 @@ def __init__(
device_key: str,
device: Device,
gateway_key: str,
eventtypes: List[str],
eventtypes: list[str],
) -> None:
"""Device event entity object for HomeLINK sensor."""
mqtt_key = build_mqtt_device_key(device, device_key, gateway_key)
Expand Down
4 changes: 2 additions & 2 deletions custom_components/homelink/helpers/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import traceback
from copy import deepcopy
from datetime import date, datetime, timedelta
from typing import Any, List
from typing import Any

from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
Expand Down Expand Up @@ -190,7 +190,7 @@ async def _async_get_core_data(self) -> Any:

async def _async_retrieve_readings(
self, hl_property: Property, property_devices: dict[str, Device]
) -> List[PropertyReading]:
) -> list[PropertyReading]:
readings = []
for device in property_devices.values():
if hasattr(device.rel, ATTR_READINGS):
Expand Down
3 changes: 1 addition & 2 deletions custom_components/homelink/helpers/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from abc import abstractmethod
from collections.abc import Callable
from typing import List

from homeassistant.components.event import EventEntity
from homeassistant.core import callback
Expand Down Expand Up @@ -147,7 +146,7 @@ class HomeLINKEventEntity(EventEntity):
_attr_should_poll = False

def __init__(
self, entry: HLConfigEntry, key: str, eventtypes: List[str], mqtt_key: str
self, entry: HLConfigEntry, key: str, eventtypes: list[str], mqtt_key: str
) -> None:
"""Property event entity object for HomeLINK sensor."""
self._key = key
Expand Down
2 changes: 1 addition & 1 deletion custom_components/homelink/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ async def _async_message_handle(


class HomeLINKEnergyReadingSensor(HomeLINKReadingSensor):
"""An energy Reading Sensor"""
"""An energy Reading Sensor."""

@property
def translation_key(self) -> str:
Expand Down
6 changes: 3 additions & 3 deletions tests/helpers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ def check_entity_state(
):
"""Check entity state."""
state = hass.states.get(entity_name)
print("*************************** State")
print(state.state)
print(state.attributes)
# print("*************************** State")
# print(state.state)
# print(state.attributes)
assert state.state == entity_state
if entity_attributes:
# print("*************************** State Attributes")
Expand Down

0 comments on commit 98ddaef

Please sign in to comment.