diff --git a/custom_components/nyc311/__init__.py b/custom_components/nyc311/__init__.py index 2c01fcc..19508f8 100644 --- a/custom_components/nyc311/__init__.py +++ b/custom_components/nyc311/__init__.py @@ -1,4 +1,5 @@ """The NYC 311 Public Services Calendar integration.""" + from __future__ import annotations from datetime import timedelta diff --git a/custom_components/nyc311/base_device.py b/custom_components/nyc311/base_device.py index 6e6a775..18a47a4 100644 --- a/custom_components/nyc311/base_device.py +++ b/custom_components/nyc311/base_device.py @@ -1,4 +1,5 @@ """Base for NYC311 entities.""" + from __future__ import annotations from homeassistant.core import callback @@ -35,9 +36,7 @@ def __init__( def _get_icon(self, active_exception: bool) -> str: """Get icon for a given service / state.""" - return ( - f"{SERVICE_ICONS[self._calendar_entry.service_profile.service_type]}{'' if active_exception else '-off'}" - ) + return f"{SERVICE_ICONS[self._calendar_entry.service_profile.service_type]}{'' if active_exception else '-off'}" async def async_added_to_hass(self) -> None: """Register callbacks.""" @@ -52,15 +51,13 @@ def _handle_coordinator_update(self) -> None: reason = self._calendar_entry.exception_reason - self._attr_extra_state_attributes.update( - { - "reason": reason if reason else None, - "description": self._calendar_entry.status_profile.description, - "status": self._calendar_entry.status_profile.standardized_type.name.title().replace( - "_", " " - ), - } - ) + self._attr_extra_state_attributes.update({ + "reason": reason if reason else None, + "description": self._calendar_entry.status_profile.description, + "status": self._calendar_entry.status_profile.standardized_type.name.title().replace( + "_", " " + ), + }) # If we use dict() here instead of a comprehension (as pylint requests), the dict won't actually sort. self._attr_extra_state_attributes = ( diff --git a/custom_components/nyc311/binary_sensor.py b/custom_components/nyc311/binary_sensor.py index 02902bf..de36098 100644 --- a/custom_components/nyc311/binary_sensor.py +++ b/custom_components/nyc311/binary_sensor.py @@ -1,4 +1,5 @@ """Binary sensor API entity.""" + from __future__ import annotations from datetime import date, datetime @@ -120,13 +121,11 @@ def update_device_data(self) -> None: else: closure_type = "Exception" - self._attr_extra_state_attributes.update( - { - "service_name": self._calendar_entry.service_profile.name, - "closure_type": closure_type, - "date": self._calendar_entry.date.isoformat(), - } - ) + self._attr_extra_state_attributes.update({ + "service_name": self._calendar_entry.service_profile.name, + "closure_type": closure_type, + "date": self._calendar_entry.date.isoformat(), + }) self._attr_is_on = ( self._calendar_entry.status_profile.standardized_type diff --git a/custom_components/nyc311/calendar.py b/custom_components/nyc311/calendar.py index ff6a3fb..84bbaf5 100644 --- a/custom_components/nyc311/calendar.py +++ b/custom_components/nyc311/calendar.py @@ -1,4 +1,5 @@ """Binary sensor calendar entity.""" + from __future__ import annotations import datetime diff --git a/custom_components/nyc311/config_flow.py b/custom_components/nyc311/config_flow.py index 8b407de..528055e 100644 --- a/custom_components/nyc311/config_flow.py +++ b/custom_components/nyc311/config_flow.py @@ -1,4 +1,5 @@ """Config flow for NYC 311 Public Services Calendar integration.""" + from __future__ import annotations import logging diff --git a/custom_components/nyc311/sensor.py b/custom_components/nyc311/sensor.py index 79a9b55..d74d093 100644 --- a/custom_components/nyc311/sensor.py +++ b/custom_components/nyc311/sensor.py @@ -1,4 +1,5 @@ """Implements 'Next Exception' sensors.""" + from __future__ import annotations import logging @@ -63,11 +64,9 @@ def update_device_data(self) -> None: CalendarType.NEXT_EXCEPTIONS ][self._calendar_entry.service_profile.service_type] - self._attr_extra_state_attributes.update( - { - "closure_type": "Exception", - } - ) + self._attr_extra_state_attributes.update({ + "closure_type": "Exception", + }) self._attr_native_value = self._calendar_entry.date