From 5db1fec99e7397ed8276a8f4b25c012638afc707 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Sat, 13 Aug 2022 18:46:49 +0200 Subject: [PATCH] Fix implicit Optional [p-s] (#76721) --- homeassistant/components/plaato/config_flow.py | 2 +- homeassistant/components/sia/config_flow.py | 14 ++++++++++---- homeassistant/components/sia/hub.py | 2 +- homeassistant/components/solax/config_flow.py | 6 +++++- homeassistant/components/switchbot/config_flow.py | 4 +++- 5 files changed, 20 insertions(+), 8 deletions(-) diff --git a/homeassistant/components/plaato/config_flow.py b/homeassistant/components/plaato/config_flow.py index 637122b1d9c..654150ffa48 100644 --- a/homeassistant/components/plaato/config_flow.py +++ b/homeassistant/components/plaato/config_flow.py @@ -127,7 +127,7 @@ class PlaatoConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): ) async def _show_api_method_form( - self, device_type: PlaatoDeviceType, errors: dict = None + self, device_type: PlaatoDeviceType, errors: dict | None = None ): data_schema = vol.Schema({vol.Optional(CONF_TOKEN, default=""): str}) diff --git a/homeassistant/components/sia/config_flow.py b/homeassistant/components/sia/config_flow.py index df03882e995..516018c43a7 100644 --- a/homeassistant/components/sia/config_flow.py +++ b/homeassistant/components/sia/config_flow.py @@ -105,7 +105,9 @@ class SIAConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): self._data: dict[str, Any] = {} self._options: Mapping[str, Any] = {CONF_ACCOUNTS: {}} - async def async_step_user(self, user_input: dict[str, Any] = None) -> FlowResult: + async def async_step_user( + self, user_input: dict[str, Any] | None = None + ) -> FlowResult: """Handle the initial user step.""" errors: dict[str, str] | None = None if user_input is not None: @@ -117,7 +119,7 @@ class SIAConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): return await self.async_handle_data_and_route(user_input) async def async_step_add_account( - self, user_input: dict[str, Any] = None + self, user_input: dict[str, Any] | None = None ) -> FlowResult: """Handle the additional accounts steps.""" errors: dict[str, str] | None = None @@ -179,7 +181,9 @@ class SIAOptionsFlowHandler(config_entries.OptionsFlow): self.hub: SIAHub | None = None self.accounts_todo: list = [] - async def async_step_init(self, user_input: dict[str, Any] = None) -> FlowResult: + async def async_step_init( + self, user_input: dict[str, Any] | None = None + ) -> FlowResult: """Manage the SIA options.""" self.hub = self.hass.data[DOMAIN][self.config_entry.entry_id] assert self.hub is not None @@ -187,7 +191,9 @@ class SIAOptionsFlowHandler(config_entries.OptionsFlow): self.accounts_todo = [a.account_id for a in self.hub.sia_accounts] return await self.async_step_options() - async def async_step_options(self, user_input: dict[str, Any] = None) -> FlowResult: + async def async_step_options( + self, user_input: dict[str, Any] | None = None + ) -> FlowResult: """Create the options step for a account.""" errors: dict[str, str] | None = None if user_input is not None: diff --git a/homeassistant/components/sia/hub.py b/homeassistant/components/sia/hub.py index 399da14c2ad..2c2fb0d2be9 100644 --- a/homeassistant/components/sia/hub.py +++ b/homeassistant/components/sia/hub.py @@ -68,7 +68,7 @@ class SIAHub: self._hass.bus.async_listen(EVENT_HOMEASSISTANT_STOP, self.async_shutdown) ) - async def async_shutdown(self, _: Event = None) -> None: + async def async_shutdown(self, _: Event | None = None) -> None: """Shutdown the SIA server.""" await self.sia_client.stop() diff --git a/homeassistant/components/solax/config_flow.py b/homeassistant/components/solax/config_flow.py index 56c6989cc7f..e3255a8e377 100644 --- a/homeassistant/components/solax/config_flow.py +++ b/homeassistant/components/solax/config_flow.py @@ -1,4 +1,6 @@ """Config flow for solax integration.""" +from __future__ import annotations + import logging from typing import Any @@ -40,7 +42,9 @@ async def validate_api(data) -> str: class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): """Handle a config flow for Solax.""" - async def async_step_user(self, user_input: dict[str, Any] = None) -> FlowResult: + async def async_step_user( + self, user_input: dict[str, Any] | None = None + ) -> FlowResult: """Handle the initial step.""" errors: dict[str, Any] = {} if user_input is None: diff --git a/homeassistant/components/switchbot/config_flow.py b/homeassistant/components/switchbot/config_flow.py index 0d7e91648f2..af2f43bdaa0 100644 --- a/homeassistant/components/switchbot/config_flow.py +++ b/homeassistant/components/switchbot/config_flow.py @@ -94,7 +94,9 @@ class SwitchbotConfigFlow(ConfigFlow, domain=DOMAIN): }, ) - async def async_step_confirm(self, user_input: dict[str, Any] = None) -> FlowResult: + async def async_step_confirm( + self, user_input: dict[str, Any] | None = None + ) -> FlowResult: """Confirm a single device.""" assert self._discovered_adv is not None if user_input is not None: