1
mirror of https://github.com/home-assistant/core synced 2024-08-02 23:40:32 +02:00

Fix implicit Optional [t-z] (#76722)

This commit is contained in:
Marc Mueller 2022-08-13 18:47:17 +02:00 committed by GitHub
parent 5db1fec99e
commit 67e339c67b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 26 additions and 14 deletions

View File

@ -45,7 +45,9 @@ _LOGGER = logging.getLogger(__name__)
def _get_config_schema(
hass: core.HomeAssistant, source: str | None, input_dict: dict[str, Any] = None
hass: core.HomeAssistant,
source: str | None,
input_dict: dict[str, Any] | None = None,
) -> vol.Schema:
"""
Return schema defaults for init step based on user input/config dict.
@ -99,7 +101,9 @@ class TomorrowioOptionsConfigFlow(config_entries.OptionsFlow):
"""Initialize Tomorrow.io options flow."""
self._config_entry = config_entry
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 Tomorrow.io options."""
if user_input is not None:
return self.async_create_entry(title="", data=user_input)
@ -134,7 +138,9 @@ class TomorrowioConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
"""Get the options flow for this handler."""
return TomorrowioOptionsConfigFlow(config_entry)
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 = {}
if user_input is not None:

View File

@ -64,7 +64,7 @@ class ToonFlowHandler(AbstractOAuth2FlowHandler, domain=DOMAIN):
return await self.async_step_user()
async def async_step_agreement(
self, user_input: dict[str, Any] = None
self, user_input: dict[str, Any] | None = None
) -> FlowResult:
"""Select Toon agreement to add."""
if len(self.agreements) == 1:

View File

@ -189,7 +189,7 @@ class TuyaEntity(Entity):
dpcodes: str | DPCode | tuple[DPCode, ...] | None,
*,
prefer_function: bool = False,
dptype: DPType = None,
dptype: DPType | None = None,
) -> DPCode | EnumTypeData | IntegerTypeData | None:
"""Find a matching DP code available on for this device."""
if dpcodes is None:

View File

@ -49,7 +49,7 @@ from .const import (
_LOGGER = logging.getLogger(__name__)
def _get_config_schema(input_dict: dict[str, Any] = None) -> vol.Schema:
def _get_config_schema(input_dict: dict[str, Any] | None = None) -> vol.Schema:
"""
Return schema defaults for init step based on user input/config dict.
@ -81,7 +81,7 @@ def _get_config_schema(input_dict: dict[str, Any] = None) -> vol.Schema:
)
def _get_pairing_schema(input_dict: dict[str, Any] = None) -> vol.Schema:
def _get_pairing_schema(input_dict: dict[str, Any] | None = None) -> vol.Schema:
"""
Return schema defaults for pairing data based on user input.
@ -112,7 +112,9 @@ class VizioOptionsConfigFlow(config_entries.OptionsFlow):
"""Initialize vizio options flow."""
self.config_entry = config_entry
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 vizio options."""
if user_input is not None:
if user_input.get(CONF_APPS_TO_INCLUDE_OR_EXCLUDE):
@ -204,7 +206,9 @@ class VizioConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
return self.async_create_entry(title=input_dict[CONF_NAME], data=input_dict)
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 a flow initialized by the user."""
errors = {}
@ -381,7 +385,9 @@ class VizioConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
}
)
async def async_step_pair_tv(self, user_input: dict[str, Any] = None) -> FlowResult:
async def async_step_pair_tv(
self, user_input: dict[str, Any] | None = None
) -> FlowResult:
"""
Start pairing process for TV.
@ -460,7 +466,7 @@ class VizioConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
)
async def async_step_pairing_complete(
self, user_input: dict[str, Any] = None
self, user_input: dict[str, Any] | None = None
) -> FlowResult:
"""
Complete non-import sourced config flow.
@ -470,7 +476,7 @@ class VizioConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
return await self._pairing_complete("pairing_complete")
async def async_step_pairing_complete_import(
self, user_input: dict[str, Any] = None
self, user_input: dict[str, Any] | None = None
) -> FlowResult:
"""
Complete import sourced config flow.

View File

@ -216,7 +216,7 @@ class MusicCastCapabilityEntity(MusicCastDeviceEntity):
self,
coordinator: MusicCastDataUpdateCoordinator,
capability: Capability,
zone_id: str = None,
zone_id: str | None = None,
) -> None:
"""Initialize a capability based entity."""
if zone_id is not None:

View File

@ -42,7 +42,7 @@ class NumberCapability(MusicCastCapabilityEntity, NumberEntity):
self,
coordinator: MusicCastDataUpdateCoordinator,
capability: NumberSetter,
zone_id: str = None,
zone_id: str | None = None,
) -> None:
"""Initialize the number entity."""
super().__init__(coordinator, capability, zone_id)