Fix implicit Optional [p-s] (#76721)

This commit is contained in:
Marc Mueller 2022-08-13 18:46:49 +02:00 committed by GitHub
parent 5a046ae7be
commit 5db1fec99e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 20 additions and 8 deletions

View File

@ -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})

View File

@ -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:

View File

@ -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()

View File

@ -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:

View File

@ -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: