From 67e339c67beb7e1d6e4613536edcfffd0281b23f Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Sat, 13 Aug 2022 18:47:17 +0200 Subject: [PATCH] Fix implicit Optional [t-z] (#76722) --- .../components/tomorrowio/config_flow.py | 12 ++++++++--- homeassistant/components/toon/config_flow.py | 2 +- homeassistant/components/tuya/base.py | 2 +- homeassistant/components/vizio/config_flow.py | 20 ++++++++++++------- .../components/yamaha_musiccast/__init__.py | 2 +- .../components/yamaha_musiccast/number.py | 2 +- 6 files changed, 26 insertions(+), 14 deletions(-) diff --git a/homeassistant/components/tomorrowio/config_flow.py b/homeassistant/components/tomorrowio/config_flow.py index a0fa7b0b34c..71df06394ed 100644 --- a/homeassistant/components/tomorrowio/config_flow.py +++ b/homeassistant/components/tomorrowio/config_flow.py @@ -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: diff --git a/homeassistant/components/toon/config_flow.py b/homeassistant/components/toon/config_flow.py index e86d951069c..5c98e35bead 100644 --- a/homeassistant/components/toon/config_flow.py +++ b/homeassistant/components/toon/config_flow.py @@ -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: diff --git a/homeassistant/components/tuya/base.py b/homeassistant/components/tuya/base.py index 624bfd80cd4..f27101e373d 100644 --- a/homeassistant/components/tuya/base.py +++ b/homeassistant/components/tuya/base.py @@ -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: diff --git a/homeassistant/components/vizio/config_flow.py b/homeassistant/components/vizio/config_flow.py index a80105579fe..54e4ef53fe1 100644 --- a/homeassistant/components/vizio/config_flow.py +++ b/homeassistant/components/vizio/config_flow.py @@ -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. diff --git a/homeassistant/components/yamaha_musiccast/__init__.py b/homeassistant/components/yamaha_musiccast/__init__.py index b8117df056a..639f0b69a41 100644 --- a/homeassistant/components/yamaha_musiccast/__init__.py +++ b/homeassistant/components/yamaha_musiccast/__init__.py @@ -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: diff --git a/homeassistant/components/yamaha_musiccast/number.py b/homeassistant/components/yamaha_musiccast/number.py index 98cda92ffea..105cb0edb3a 100644 --- a/homeassistant/components/yamaha_musiccast/number.py +++ b/homeassistant/components/yamaha_musiccast/number.py @@ -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)