From 9eecd90afcb7d2797a839ee1279535b667bc494f Mon Sep 17 00:00:00 2001 From: Michael <35783820+mib1185@users.noreply.github.com> Date: Thu, 20 May 2021 17:00:19 +0200 Subject: [PATCH] Add constructor return type in integrations T-Z (#50899) --- homeassistant/components/tado/config_flow.py | 2 +- homeassistant/components/tag/__init__.py | 2 +- homeassistant/components/template/sensor.py | 2 +- .../components/template/template_entity.py | 2 +- .../components/template/trigger_entity.py | 2 +- homeassistant/components/tesla/config_flow.py | 2 +- homeassistant/components/timer/__init__.py | 2 +- homeassistant/components/toon/coordinator.py | 2 +- homeassistant/components/toon/oauth2.py | 2 +- homeassistant/components/tplink/common.py | 2 +- homeassistant/components/tplink/switch.py | 2 +- homeassistant/components/trace/__init__.py | 2 +- homeassistant/components/tuya/config_flow.py | 4 ++-- homeassistant/components/twinkly/light.py | 2 +- .../components/upc_connect/device_tracker.py | 2 +- .../components/upcloud/config_flow.py | 2 +- homeassistant/components/updater/__init__.py | 4 +++- homeassistant/components/vera/__init__.py | 4 +++- .../components/vera/binary_sensor.py | 2 +- homeassistant/components/vera/climate.py | 2 +- homeassistant/components/vera/config_flow.py | 2 +- homeassistant/components/vera/cover.py | 2 +- homeassistant/components/vera/light.py | 2 +- homeassistant/components/vera/lock.py | 4 +++- homeassistant/components/vera/scene.py | 4 +++- homeassistant/components/vera/sensor.py | 2 +- homeassistant/components/vera/switch.py | 2 +- homeassistant/components/verisure/camera.py | 2 +- homeassistant/components/version/sensor.py | 4 ++-- homeassistant/components/wemo/__init__.py | 2 +- homeassistant/components/withings/common.py | 4 ++-- homeassistant/components/wled/__init__.py | 2 +- homeassistant/components/wled/light.py | 4 ++-- homeassistant/components/wled/switch.py | 2 +- .../components/wunderground/sensor.py | 20 +++++++++++-------- homeassistant/components/xbox/api.py | 2 +- homeassistant/components/xbox/base_sensor.py | 4 +++- homeassistant/components/xbox/media_source.py | 2 +- .../components/yamaha/media_player.py | 2 +- homeassistant/components/yeelight/__init__.py | 4 ++-- .../components/zha/core/channels/__init__.py | 2 +- homeassistant/components/zha/core/const.py | 2 +- homeassistant/components/zha/core/device.py | 2 +- homeassistant/components/zha/core/group.py | 4 ++-- homeassistant/components/zha/cover.py | 2 +- homeassistant/components/zha/entity.py | 4 ++-- homeassistant/components/zha/sensor.py | 2 +- homeassistant/components/zone/__init__.py | 2 +- homeassistant/components/zwave_js/services.py | 2 +- 49 files changed, 77 insertions(+), 63 deletions(-) diff --git a/homeassistant/components/tado/config_flow.py b/homeassistant/components/tado/config_flow.py index 7359273e2de..d762329d658 100644 --- a/homeassistant/components/tado/config_flow.py +++ b/homeassistant/components/tado/config_flow.py @@ -106,7 +106,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): class OptionsFlowHandler(config_entries.OptionsFlow): """Handle a option flow for tado.""" - def __init__(self, config_entry: config_entries.ConfigEntry): + def __init__(self, config_entry: config_entries.ConfigEntry) -> None: """Initialize options flow.""" self.config_entry = config_entry diff --git a/homeassistant/components/tag/__init__.py b/homeassistant/components/tag/__init__.py index 6dcf2ec9a4d..4a410c6b30b 100644 --- a/homeassistant/components/tag/__init__.py +++ b/homeassistant/components/tag/__init__.py @@ -41,7 +41,7 @@ UPDATE_FIELDS = { class TagIDExistsError(HomeAssistantError): """Raised when an item is not found.""" - def __init__(self, item_id: str): + def __init__(self, item_id: str) -> None: """Initialize tag ID exists error.""" super().__init__(f"Tag with ID {item_id} already exists.") self.item_id = item_id diff --git a/homeassistant/components/template/sensor.py b/homeassistant/components/template/sensor.py index d470964465a..56e0e11edb0 100644 --- a/homeassistant/components/template/sensor.py +++ b/homeassistant/components/template/sensor.py @@ -224,7 +224,7 @@ class SensorTemplate(TemplateEntity, SensorEntity): device_class: str | None, attribute_templates: dict[str, template.Template], unique_id: str | None, - ): + ) -> None: """Initialize the sensor.""" super().__init__( attribute_templates=attribute_templates, diff --git a/homeassistant/components/template/template_entity.py b/homeassistant/components/template/template_entity.py index 4f72511fe24..522eb7d89ba 100644 --- a/homeassistant/components/template/template_entity.py +++ b/homeassistant/components/template/template_entity.py @@ -33,7 +33,7 @@ class _TemplateAttribute: validator: Callable[[Any], Any] = None, on_update: Callable[[Any], None] | None = None, none_on_template_error: bool | None = False, - ): + ) -> None: """Template attribute.""" self._entity = entity self._attribute = attribute diff --git a/homeassistant/components/template/trigger_entity.py b/homeassistant/components/template/trigger_entity.py index 4ba2a549e63..ee9c60293df 100644 --- a/homeassistant/components/template/trigger_entity.py +++ b/homeassistant/components/template/trigger_entity.py @@ -29,7 +29,7 @@ class TriggerEntity(update_coordinator.CoordinatorEntity): hass: HomeAssistant, coordinator: TriggerUpdateCoordinator, config: dict, - ): + ) -> None: """Initialize the entity.""" super().__init__(coordinator) diff --git a/homeassistant/components/tesla/config_flow.py b/homeassistant/components/tesla/config_flow.py index cbb25f8663b..89dc8d2a2b4 100644 --- a/homeassistant/components/tesla/config_flow.py +++ b/homeassistant/components/tesla/config_flow.py @@ -36,7 +36,7 @@ class TeslaConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): VERSION = 1 - def __init__(self): + def __init__(self) -> None: """Initialize the tesla flow.""" self.username = None self.reauth = False diff --git a/homeassistant/components/timer/__init__.py b/homeassistant/components/timer/__init__.py index ded59a0a6d1..2e92ddf6fd8 100644 --- a/homeassistant/components/timer/__init__.py +++ b/homeassistant/components/timer/__init__.py @@ -188,7 +188,7 @@ class TimerStorageCollection(collection.StorageCollection): class Timer(RestoreEntity): """Representation of a timer.""" - def __init__(self, config: dict): + def __init__(self, config: dict) -> None: """Initialize a timer.""" self._config: dict = config self.editable: bool = True diff --git a/homeassistant/components/toon/coordinator.py b/homeassistant/components/toon/coordinator.py index 069bd58d922..9405de22bf8 100644 --- a/homeassistant/components/toon/coordinator.py +++ b/homeassistant/components/toon/coordinator.py @@ -27,7 +27,7 @@ class ToonDataUpdateCoordinator(DataUpdateCoordinator[Status]): def __init__( self, hass: HomeAssistant, *, entry: ConfigEntry, session: OAuth2Session - ): + ) -> None: """Initialize global Toon data updater.""" self.session = session self.entry = entry diff --git a/homeassistant/components/toon/oauth2.py b/homeassistant/components/toon/oauth2.py index 7539224ebba..64abeb26992 100644 --- a/homeassistant/components/toon/oauth2.py +++ b/homeassistant/components/toon/oauth2.py @@ -58,7 +58,7 @@ class ToonLocalOAuth2Implementation(config_entry_oauth2_flow.LocalOAuth2Implemen name: str, tenant_id: str, issuer: str | None = None, - ): + ) -> None: """Local Toon Oauth Implementation.""" self._name = name self.tenant_id = tenant_id diff --git a/homeassistant/components/tplink/common.py b/homeassistant/components/tplink/common.py index 4129a80f83c..f9ed57d26fb 100644 --- a/homeassistant/components/tplink/common.py +++ b/homeassistant/components/tplink/common.py @@ -32,7 +32,7 @@ class SmartDevices: def __init__( self, lights: list[SmartDevice] = None, switches: list[SmartDevice] = None - ): + ) -> None: """Initialize device holder.""" self._lights = lights or [] self._switches = switches or [] diff --git a/homeassistant/components/tplink/switch.py b/homeassistant/components/tplink/switch.py index ab8b3290b30..011caa463b2 100644 --- a/homeassistant/components/tplink/switch.py +++ b/homeassistant/components/tplink/switch.py @@ -46,7 +46,7 @@ async def async_setup_entry(hass: HomeAssistant, config_entry, async_add_entitie class SmartPlugSwitch(SwitchEntity): """Representation of a TPLink Smart Plug switch.""" - def __init__(self, smartplug: SmartPlug): + def __init__(self, smartplug: SmartPlug) -> None: """Initialize the switch.""" self.smartplug = smartplug self._sysinfo = None diff --git a/homeassistant/components/trace/__init__.py b/homeassistant/components/trace/__init__.py index bf78f754b86..c1113467661 100644 --- a/homeassistant/components/trace/__init__.py +++ b/homeassistant/components/trace/__init__.py @@ -60,7 +60,7 @@ class ActionTrace: config: dict[str, Any], blueprint_inputs: dict[str, Any], context: Context, - ): + ) -> None: """Container for script trace.""" self._trace: dict[str, deque[TraceElement]] | None = None self._config: dict[str, Any] = config diff --git a/homeassistant/components/tuya/config_flow.py b/homeassistant/components/tuya/config_flow.py index 1004a7844aa..ee17715b5e9 100644 --- a/homeassistant/components/tuya/config_flow.py +++ b/homeassistant/components/tuya/config_flow.py @@ -83,7 +83,7 @@ class TuyaConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): VERSION = 1 - def __init__(self): + def __init__(self) -> None: """Initialize flow.""" self._country_code = None self._password = None @@ -151,7 +151,7 @@ class TuyaConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): class OptionsFlowHandler(config_entries.OptionsFlow): """Handle a option flow for Tuya.""" - def __init__(self, config_entry: config_entries.ConfigEntry): + def __init__(self, config_entry: config_entries.ConfigEntry) -> None: """Initialize options flow.""" self.config_entry = config_entry self._conf_devs_id = None diff --git a/homeassistant/components/twinkly/light.py b/homeassistant/components/twinkly/light.py index 0c03ceaf74a..b0f94a1c52f 100644 --- a/homeassistant/components/twinkly/light.py +++ b/homeassistant/components/twinkly/light.py @@ -47,7 +47,7 @@ class TwinklyLight(LightEntity): self, conf: ConfigEntry, hass: HomeAssistant, - ): + ) -> None: """Initialize a TwinklyLight entity.""" self._id = conf.data[CONF_ENTRY_ID] self._hass = hass diff --git a/homeassistant/components/upc_connect/device_tracker.py b/homeassistant/components/upc_connect/device_tracker.py index 2a2a1b3798b..8a03b283236 100644 --- a/homeassistant/components/upc_connect/device_tracker.py +++ b/homeassistant/components/upc_connect/device_tracker.py @@ -54,7 +54,7 @@ async def async_get_scanner(hass, config): class UPCDeviceScanner(DeviceScanner): """This class queries a router running UPC ConnectBox firmware.""" - def __init__(self, connect_box: ConnectBox): + def __init__(self, connect_box: ConnectBox) -> None: """Initialize the scanner.""" self.connect_box: ConnectBox = connect_box diff --git a/homeassistant/components/upcloud/config_flow.py b/homeassistant/components/upcloud/config_flow.py index 3ad5976df1f..1a16a78cfa1 100644 --- a/homeassistant/components/upcloud/config_flow.py +++ b/homeassistant/components/upcloud/config_flow.py @@ -101,7 +101,7 @@ class UpCloudConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): class UpCloudOptionsFlow(config_entries.OptionsFlow): """UpCloud options flow.""" - def __init__(self, config_entry: config_entries.ConfigEntry): + def __init__(self, config_entry: config_entries.ConfigEntry) -> None: """Initialize options flow.""" self.config_entry = config_entry diff --git a/homeassistant/components/updater/__init__.py b/homeassistant/components/updater/__init__.py index 9e3c504e4be..f624cf87eda 100644 --- a/homeassistant/components/updater/__init__.py +++ b/homeassistant/components/updater/__init__.py @@ -44,7 +44,9 @@ RESPONSE_SCHEMA = vol.Schema( class Updater: """Updater class for data exchange.""" - def __init__(self, update_available: bool, newest_version: str, release_notes: str): + def __init__( + self, update_available: bool, newest_version: str, release_notes: str + ) -> None: """Initialize attributes.""" self.update_available = update_available self.release_notes = release_notes diff --git a/homeassistant/components/vera/__init__.py b/homeassistant/components/vera/__init__.py index 9feba3cd08d..bf5eb9182e6 100644 --- a/homeassistant/components/vera/__init__.py +++ b/homeassistant/components/vera/__init__.py @@ -212,7 +212,9 @@ DeviceType = TypeVar("DeviceType", bound=veraApi.VeraDevice) class VeraDevice(Generic[DeviceType], Entity): """Representation of a Vera device entity.""" - def __init__(self, vera_device: DeviceType, controller_data: ControllerData): + def __init__( + self, vera_device: DeviceType, controller_data: ControllerData + ) -> None: """Initialize the device.""" self.vera_device = vera_device self.controller = controller_data.controller diff --git a/homeassistant/components/vera/binary_sensor.py b/homeassistant/components/vera/binary_sensor.py index 1eca4f208f4..f41ce5cfd08 100644 --- a/homeassistant/components/vera/binary_sensor.py +++ b/homeassistant/components/vera/binary_sensor.py @@ -37,7 +37,7 @@ class VeraBinarySensor(VeraDevice[veraApi.VeraBinarySensor], BinarySensorEntity) def __init__( self, vera_device: veraApi.VeraBinarySensor, controller_data: ControllerData - ): + ) -> None: """Initialize the binary_sensor.""" self._state = False VeraDevice.__init__(self, vera_device, controller_data) diff --git a/homeassistant/components/vera/climate.py b/homeassistant/components/vera/climate.py index c4c7cae8f85..cde36dcc623 100644 --- a/homeassistant/components/vera/climate.py +++ b/homeassistant/components/vera/climate.py @@ -56,7 +56,7 @@ class VeraThermostat(VeraDevice[veraApi.VeraThermostat], ClimateEntity): def __init__( self, vera_device: veraApi.VeraThermostat, controller_data: ControllerData - ): + ) -> None: """Initialize the Vera device.""" VeraDevice.__init__(self, vera_device, controller_data) self.entity_id = ENTITY_ID_FORMAT.format(self.vera_id) diff --git a/homeassistant/components/vera/config_flow.py b/homeassistant/components/vera/config_flow.py index a5450cd4a65..ae4fdf8cefa 100644 --- a/homeassistant/components/vera/config_flow.py +++ b/homeassistant/components/vera/config_flow.py @@ -67,7 +67,7 @@ def options_data(user_input: dict) -> dict: class OptionsFlowHandler(config_entries.OptionsFlow): """Options for the component.""" - def __init__(self, config_entry: ConfigEntry): + def __init__(self, config_entry: ConfigEntry) -> None: """Init object.""" self.config_entry = config_entry diff --git a/homeassistant/components/vera/cover.py b/homeassistant/components/vera/cover.py index 248465ed842..62a04d4e6f3 100644 --- a/homeassistant/components/vera/cover.py +++ b/homeassistant/components/vera/cover.py @@ -40,7 +40,7 @@ class VeraCover(VeraDevice[veraApi.VeraCurtain], CoverEntity): def __init__( self, vera_device: veraApi.VeraCurtain, controller_data: ControllerData - ): + ) -> None: """Initialize the Vera device.""" VeraDevice.__init__(self, vera_device, controller_data) self.entity_id = ENTITY_ID_FORMAT.format(self.vera_id) diff --git a/homeassistant/components/vera/light.py b/homeassistant/components/vera/light.py index 5cc19d78164..7f67f065c91 100644 --- a/homeassistant/components/vera/light.py +++ b/homeassistant/components/vera/light.py @@ -44,7 +44,7 @@ class VeraLight(VeraDevice[veraApi.VeraDimmer], LightEntity): def __init__( self, vera_device: veraApi.VeraDimmer, controller_data: ControllerData - ): + ) -> None: """Initialize the light.""" self._state = False self._color = None diff --git a/homeassistant/components/vera/lock.py b/homeassistant/components/vera/lock.py index 2c656cba5de..b99728d0fcf 100644 --- a/homeassistant/components/vera/lock.py +++ b/homeassistant/components/vera/lock.py @@ -41,7 +41,9 @@ async def async_setup_entry( class VeraLock(VeraDevice[veraApi.VeraLock], LockEntity): """Representation of a Vera lock.""" - def __init__(self, vera_device: veraApi.VeraLock, controller_data: ControllerData): + def __init__( + self, vera_device: veraApi.VeraLock, controller_data: ControllerData + ) -> None: """Initialize the Vera device.""" self._state = None VeraDevice.__init__(self, vera_device, controller_data) diff --git a/homeassistant/components/vera/scene.py b/homeassistant/components/vera/scene.py index 543ba3b517b..c1381f488dd 100644 --- a/homeassistant/components/vera/scene.py +++ b/homeassistant/components/vera/scene.py @@ -30,7 +30,9 @@ async def async_setup_entry( class VeraScene(Scene): """Representation of a Vera scene entity.""" - def __init__(self, vera_scene: veraApi.VeraScene, controller_data: ControllerData): + def __init__( + self, vera_scene: veraApi.VeraScene, controller_data: ControllerData + ) -> None: """Initialize the scene.""" self.vera_scene = vera_scene self.controller = controller_data.controller diff --git a/homeassistant/components/vera/sensor.py b/homeassistant/components/vera/sensor.py index e1e95820a2e..878f6ff376d 100644 --- a/homeassistant/components/vera/sensor.py +++ b/homeassistant/components/vera/sensor.py @@ -44,7 +44,7 @@ class VeraSensor(VeraDevice[veraApi.VeraSensor], SensorEntity): def __init__( self, vera_device: veraApi.VeraSensor, controller_data: ControllerData - ): + ) -> None: """Initialize the sensor.""" self.current_value = None self._temperature_units = None diff --git a/homeassistant/components/vera/switch.py b/homeassistant/components/vera/switch.py index 7531819d90d..304441037ec 100644 --- a/homeassistant/components/vera/switch.py +++ b/homeassistant/components/vera/switch.py @@ -40,7 +40,7 @@ class VeraSwitch(VeraDevice[veraApi.VeraSwitch], SwitchEntity): def __init__( self, vera_device: veraApi.VeraSwitch, controller_data: ControllerData - ): + ) -> None: """Initialize the Vera device.""" self._state = False VeraDevice.__init__(self, vera_device, controller_data) diff --git a/homeassistant/components/verisure/camera.py b/homeassistant/components/verisure/camera.py index f52a7a38e59..0dfda45999a 100644 --- a/homeassistant/components/verisure/camera.py +++ b/homeassistant/components/verisure/camera.py @@ -53,7 +53,7 @@ class VerisureSmartcam(CoordinatorEntity, Camera): coordinator: VerisureDataUpdateCoordinator, serial_number: str, directory_path: str, - ): + ) -> None: """Initialize Verisure File Camera component.""" super().__init__(coordinator) Camera.__init__(self) diff --git a/homeassistant/components/version/sensor.py b/homeassistant/components/version/sensor.py index d438f391334..04165ec9db1 100644 --- a/homeassistant/components/version/sensor.py +++ b/homeassistant/components/version/sensor.py @@ -111,7 +111,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= class VersionData: """Get the latest data and update the states.""" - def __init__(self, api: HaVersion): + def __init__(self, api: HaVersion) -> None: """Initialize the data object.""" self.api = api @@ -131,7 +131,7 @@ class VersionData: class VersionSensor(SensorEntity): """Representation of a Home Assistant version sensor.""" - def __init__(self, data: VersionData, name: str): + def __init__(self, data: VersionData, name: str) -> None: """Initialize the Version sensor.""" self.data = data self._name = name diff --git a/homeassistant/components/wemo/__init__.py b/homeassistant/components/wemo/__init__.py index d7569a6329f..cb3beb9b67a 100644 --- a/homeassistant/components/wemo/__init__.py +++ b/homeassistant/components/wemo/__init__.py @@ -131,7 +131,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): class WemoDispatcher: """Dispatch WeMo devices to the correct platform.""" - def __init__(self, config_entry: ConfigEntry): + def __init__(self, config_entry: ConfigEntry) -> None: """Initialize the WemoDispatcher.""" self._config_entry = config_entry self._added_serial_numbers = set() diff --git a/homeassistant/components/withings/common.py b/homeassistant/components/withings/common.py index c2a91275d72..a187786c995 100644 --- a/homeassistant/components/withings/common.py +++ b/homeassistant/components/withings/common.py @@ -480,7 +480,7 @@ class ConfigEntryWithingsApi(AbstractWithingsApi): hass: HomeAssistant, config_entry: ConfigEntry, implementation: AbstractOAuth2Implementation, - ): + ) -> None: """Initialize object.""" self._hass = hass self._config_entry = config_entry @@ -564,7 +564,7 @@ class DataManager: api: ConfigEntryWithingsApi, user_id: int, webhook_config: WebhookConfig, - ): + ) -> None: """Initialize the data manager.""" self._hass = hass self._api = api diff --git a/homeassistant/components/wled/__init__.py b/homeassistant/components/wled/__init__.py index f7b9a69d1de..717bb87e057 100644 --- a/homeassistant/components/wled/__init__.py +++ b/homeassistant/components/wled/__init__.py @@ -102,7 +102,7 @@ class WLEDDataUpdateCoordinator(DataUpdateCoordinator[WLEDDevice]): hass: HomeAssistant, *, host: str, - ): + ) -> None: """Initialize global WLED data updater.""" self.wled = WLED(host, session=async_get_clientsession(hass)) diff --git a/homeassistant/components/wled/light.py b/homeassistant/components/wled/light.py index f6a51e6159a..6c3b11a65e2 100644 --- a/homeassistant/components/wled/light.py +++ b/homeassistant/components/wled/light.py @@ -96,7 +96,7 @@ async def async_setup_entry( class WLEDMasterLight(LightEntity, WLEDDeviceEntity): """Defines a WLED master light.""" - def __init__(self, entry_id: str, coordinator: WLEDDataUpdateCoordinator): + def __init__(self, entry_id: str, coordinator: WLEDDataUpdateCoordinator) -> None: """Initialize WLED master light.""" super().__init__( entry_id=entry_id, @@ -177,7 +177,7 @@ class WLEDSegmentLight(LightEntity, WLEDDeviceEntity): def __init__( self, entry_id: str, coordinator: WLEDDataUpdateCoordinator, segment: int - ): + ) -> None: """Initialize WLED segment light.""" self._rgbw = coordinator.data.info.leds.rgbw self._segment = segment diff --git a/homeassistant/components/wled/switch.py b/homeassistant/components/wled/switch.py index e08998308a6..ebd3f7826e6 100644 --- a/homeassistant/components/wled/switch.py +++ b/homeassistant/components/wled/switch.py @@ -135,7 +135,7 @@ class WLEDSyncSendSwitch(WLEDSwitch): class WLEDSyncReceiveSwitch(WLEDSwitch): """Defines a WLED sync receive switch.""" - def __init__(self, entry_id: str, coordinator: WLEDDataUpdateCoordinator): + def __init__(self, entry_id: str, coordinator: WLEDDataUpdateCoordinator) -> None: """Initialize WLED sync receive switch.""" super().__init__( coordinator=coordinator, diff --git a/homeassistant/components/wunderground/sensor.py b/homeassistant/components/wunderground/sensor.py index 67eab97b4c3..887e2264a70 100644 --- a/homeassistant/components/wunderground/sensor.py +++ b/homeassistant/components/wunderground/sensor.py @@ -74,7 +74,7 @@ class WUSensorConfig: icon: str = "mdi:gauge", extra_state_attributes=None, device_class=None, - ): + ) -> None: """Initialize sensor configuration. :param friendly_name: Friendly name @@ -106,7 +106,7 @@ class WUCurrentConditionsSensorConfig(WUSensorConfig): icon: str | None = "mdi:gauge", unit_of_measurement: str | None = None, device_class=None, - ): + ) -> None: """Initialize current conditions sensor configuration. :param friendly_name: Friendly name of sensor @@ -133,7 +133,9 @@ class WUCurrentConditionsSensorConfig(WUSensorConfig): class WUDailyTextForecastSensorConfig(WUSensorConfig): """Helper for defining sensor configurations for daily text forecasts.""" - def __init__(self, period: int, field: str, unit_of_measurement: str | None = None): + def __init__( + self, period: int, field: str, unit_of_measurement: str | None = None + ) -> None: """Initialize daily text forecast sensor configuration. :param period: forecast period number @@ -170,7 +172,7 @@ class WUDailySimpleForecastSensorConfig(WUSensorConfig): ha_unit: str | None = None, icon=None, device_class=None, - ): + ) -> None: """Initialize daily simple forecast sensor configuration. :param friendly_name: friendly_name of the sensor @@ -213,7 +215,7 @@ class WUDailySimpleForecastSensorConfig(WUSensorConfig): class WUHourlyForecastSensorConfig(WUSensorConfig): """Helper for defining sensor configurations for hourly text forecasts.""" - def __init__(self, period: int, field: int): + def __init__(self, period: int, field: int) -> None: """Initialize hourly forecast sensor configuration. :param period: forecast period number @@ -280,7 +282,7 @@ class WUAlmanacSensorConfig(WUSensorConfig): unit_of_measurement: str, icon: str, device_class=None, - ): + ) -> None: """Initialize almanac sensor configuration. :param friendly_name: Friendly name @@ -303,7 +305,7 @@ class WUAlmanacSensorConfig(WUSensorConfig): class WUAlertsSensorConfig(WUSensorConfig): """Helper for defining field configuration for alerts.""" - def __init__(self, friendly_name: str | Callable): + def __init__(self, friendly_name: str | Callable) -> None: """Initialiize alerts sensor configuration. :param friendly_name: Friendly name @@ -1120,7 +1122,9 @@ async def async_setup_platform( class WUndergroundSensor(SensorEntity): """Implementing the WUnderground sensor.""" - def __init__(self, hass: HomeAssistant, rest, condition, unique_id_base: str): + def __init__( + self, hass: HomeAssistant, rest, condition, unique_id_base: str + ) -> None: """Initialize the sensor.""" self.rest = rest self._condition = condition diff --git a/homeassistant/components/xbox/api.py b/homeassistant/components/xbox/api.py index bb38b235c0c..04714afa33e 100644 --- a/homeassistant/components/xbox/api.py +++ b/homeassistant/components/xbox/api.py @@ -14,7 +14,7 @@ class AsyncConfigEntryAuth(AuthenticationManager): self, websession: ClientSession, oauth_session: config_entry_oauth2_flow.OAuth2Session, - ): + ) -> None: """Initialize xbox auth.""" # Leaving out client credentials as they are handled by Home Assistant super().__init__(websession, "", "", "") diff --git a/homeassistant/components/xbox/base_sensor.py b/homeassistant/components/xbox/base_sensor.py index c149ce74c32..894213fd94c 100644 --- a/homeassistant/components/xbox/base_sensor.py +++ b/homeassistant/components/xbox/base_sensor.py @@ -12,7 +12,9 @@ from .const import DOMAIN class XboxBaseSensorEntity(CoordinatorEntity): """Base Sensor for the Xbox Integration.""" - def __init__(self, coordinator: XboxUpdateCoordinator, xuid: str, attribute: str): + def __init__( + self, coordinator: XboxUpdateCoordinator, xuid: str, attribute: str + ) -> None: """Initialize Xbox binary sensor.""" super().__init__(coordinator) self.xuid = xuid diff --git a/homeassistant/components/xbox/media_source.py b/homeassistant/components/xbox/media_source.py index aeaa233a6ed..06581088823 100644 --- a/homeassistant/components/xbox/media_source.py +++ b/homeassistant/components/xbox/media_source.py @@ -74,7 +74,7 @@ class XboxSource(MediaSource): name: str = "Xbox Game Media" - def __init__(self, hass: HomeAssistant, client: XboxLiveClient): + def __init__(self, hass: HomeAssistant, client: XboxLiveClient) -> None: """Initialize Xbox source.""" super().__init__(DOMAIN) diff --git a/homeassistant/components/yamaha/media_player.py b/homeassistant/components/yamaha/media_player.py index 3f7df115015..3f79be43f6e 100644 --- a/homeassistant/components/yamaha/media_player.py +++ b/homeassistant/components/yamaha/media_player.py @@ -77,7 +77,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend( class YamahaConfigInfo: """Configuration Info for Yamaha Receivers.""" - def __init__(self, config: None, discovery_info: None): + def __init__(self, config: None, discovery_info: None) -> None: """Initialize the Configuration Info for Yamaha Receiver.""" self.name = config.get(CONF_NAME) self.host = config.get(CONF_HOST) diff --git a/homeassistant/components/yeelight/__init__.py b/homeassistant/components/yeelight/__init__.py index 352dddb7705..b18f18b6fa4 100644 --- a/homeassistant/components/yeelight/__init__.py +++ b/homeassistant/components/yeelight/__init__.py @@ -316,7 +316,7 @@ class YeelightScanner: cls._scanner = cls(hass) return cls._scanner - def __init__(self, hass: HomeAssistant): + def __init__(self, hass: HomeAssistant) -> None: """Initialize class.""" self._hass = hass self._seen = {} @@ -573,7 +573,7 @@ class YeelightDevice: class YeelightEntity(Entity): """Represents single Yeelight entity.""" - def __init__(self, device: YeelightDevice, entry: ConfigEntry): + def __init__(self, device: YeelightDevice, entry: ConfigEntry) -> None: """Initialize the entity.""" self._device = device self._unique_id = entry.entry_id diff --git a/homeassistant/components/zha/core/channels/__init__.py b/homeassistant/components/zha/core/channels/__init__.py index e6d2d722f61..3661d3b17d9 100644 --- a/homeassistant/components/zha/core/channels/__init__.py +++ b/homeassistant/components/zha/core/channels/__init__.py @@ -176,7 +176,7 @@ class Channels: class ChannelPool: """All channels of an endpoint.""" - def __init__(self, channels: Channels, ep_id: int): + def __init__(self, channels: Channels, ep_id: int) -> None: """Initialize instance.""" self._all_channels: ChannelsDict = {} self._channels: Channels = channels diff --git a/homeassistant/components/zha/core/const.py b/homeassistant/components/zha/core/const.py index 2110cc9546d..dcc2a080a76 100644 --- a/homeassistant/components/zha/core/const.py +++ b/homeassistant/components/zha/core/const.py @@ -258,7 +258,7 @@ class RadioType(enum.Enum): return radio.name raise ValueError - def __init__(self, description: str, controller_cls: CALLABLE_T): + def __init__(self, description: str, controller_cls: CALLABLE_T) -> None: """Init instance.""" self._desc = description self._ctrl_cls = controller_cls diff --git a/homeassistant/components/zha/core/device.py b/homeassistant/components/zha/core/device.py index 6497a85b8f9..37608287609 100644 --- a/homeassistant/components/zha/core/device.py +++ b/homeassistant/components/zha/core/device.py @@ -91,7 +91,7 @@ class ZHADevice(LogMixin): hass: HomeAssistant, zigpy_device: zha_typing.ZigpyDeviceType, zha_gateway: zha_typing.ZhaGatewayType, - ): + ) -> None: """Initialize the gateway.""" self.hass = hass self._zigpy_device = zigpy_device diff --git a/homeassistant/components/zha/core/group.py b/homeassistant/components/zha/core/group.py index 90dcb6fffc3..c8970b2d393 100644 --- a/homeassistant/components/zha/core/group.py +++ b/homeassistant/components/zha/core/group.py @@ -33,7 +33,7 @@ class ZHAGroupMember(LogMixin): def __init__( self, zha_group: ZhaGroupType, zha_device: ZhaDeviceType, endpoint_id: int - ): + ) -> None: """Initialize the group member.""" self._zha_group: ZhaGroupType = zha_group self._zha_device: ZhaDeviceType = zha_device @@ -116,7 +116,7 @@ class ZHAGroup(LogMixin): hass: HomeAssistant, zha_gateway: ZhaGatewayType, zigpy_group: ZigpyGroupType, - ): + ) -> None: """Initialize the group.""" self.hass: HomeAssistant = hass self._zigpy_group: ZigpyGroupType = zigpy_group diff --git a/homeassistant/components/zha/cover.py b/homeassistant/components/zha/cover.py index 5530cd3e3f5..35080c56921 100644 --- a/homeassistant/components/zha/cover.py +++ b/homeassistant/components/zha/cover.py @@ -183,7 +183,7 @@ class Shade(ZhaEntity, CoverEntity): zha_device: ZhaDeviceType, channels: list[ChannelType], **kwargs, - ): + ) -> None: """Initialize the ZHA light.""" super().__init__(unique_id, zha_device, channels, **kwargs) self._on_off_channel = self.cluster_channels[CHANNEL_ON_OFF] diff --git a/homeassistant/components/zha/entity.py b/homeassistant/components/zha/entity.py index 860183a79b6..a5259deea5d 100644 --- a/homeassistant/components/zha/entity.py +++ b/homeassistant/components/zha/entity.py @@ -40,7 +40,7 @@ UPDATE_GROUP_FROM_CHILD_DELAY = 0.2 class BaseZhaEntity(LogMixin, entity.Entity): """A base class for ZHA entities.""" - def __init__(self, unique_id: str, zha_device: ZhaDeviceType, **kwargs): + def __init__(self, unique_id: str, zha_device: ZhaDeviceType, **kwargs) -> None: """Init ZHA entity.""" self._name: str = "" self._force_update: bool = False @@ -147,7 +147,7 @@ class ZhaEntity(BaseZhaEntity, RestoreEntity): zha_device: ZhaDeviceType, channels: list[ChannelType], **kwargs, - ): + ) -> None: """Init ZHA entity.""" super().__init__(unique_id, zha_device, **kwargs) ieeetail = "".join([f"{o:02x}" for o in zha_device.ieee[:4]]) diff --git a/homeassistant/components/zha/sensor.py b/homeassistant/components/zha/sensor.py index 816db67816a..616e0345828 100644 --- a/homeassistant/components/zha/sensor.py +++ b/homeassistant/components/zha/sensor.py @@ -109,7 +109,7 @@ class Sensor(ZhaEntity, SensorEntity): zha_device: ZhaDeviceType, channels: list[ChannelType], **kwargs, - ): + ) -> None: """Init this sensor.""" super().__init__(unique_id, zha_device, channels, **kwargs) self._channel: ChannelType = channels[0] diff --git a/homeassistant/components/zone/__init__.py b/homeassistant/components/zone/__init__.py index b224c2a47d7..8ab0e9b2703 100644 --- a/homeassistant/components/zone/__init__.py +++ b/homeassistant/components/zone/__init__.py @@ -279,7 +279,7 @@ async def async_unload_entry( class Zone(entity.Entity): """Representation of a Zone.""" - def __init__(self, config: dict): + def __init__(self, config: dict) -> None: """Initialize the zone.""" self._config = config self.editable = True diff --git a/homeassistant/components/zwave_js/services.py b/homeassistant/components/zwave_js/services.py index 16bf9c7eb94..48719063376 100644 --- a/homeassistant/components/zwave_js/services.py +++ b/homeassistant/components/zwave_js/services.py @@ -55,7 +55,7 @@ BITMASK_SCHEMA = vol.All( class ZWaveServices: """Class that holds our services (Zwave Commands) that should be published to hass.""" - def __init__(self, hass: HomeAssistant, ent_reg: EntityRegistry): + def __init__(self, hass: HomeAssistant, ent_reg: EntityRegistry) -> None: """Initialize with hass object.""" self._hass = hass self._ent_reg = ent_reg