Add async_get_options_flow type hints (mqtt) (#73434)

This commit is contained in:
epenet 2022-06-13 13:35:50 +02:00 committed by GitHub
parent 42ed0fd47b
commit f846cd033f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,4 +1,6 @@
"""Config flow for MQTT.""" """Config flow for MQTT."""
from __future__ import annotations
from collections import OrderedDict from collections import OrderedDict
import queue import queue
@ -15,6 +17,7 @@ from homeassistant.const import (
CONF_PROTOCOL, CONF_PROTOCOL,
CONF_USERNAME, CONF_USERNAME,
) )
from homeassistant.core import callback
from homeassistant.data_entry_flow import FlowResult from homeassistant.data_entry_flow import FlowResult
from .client import MqttClientSetup from .client import MqttClientSetup
@ -45,7 +48,10 @@ class FlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
_hassio_discovery = None _hassio_discovery = None
@staticmethod @staticmethod
def async_get_options_flow(config_entry): @callback
def async_get_options_flow(
config_entry: config_entries.ConfigEntry,
) -> MQTTOptionsFlowHandler:
"""Get the options flow for this handler.""" """Get the options flow for this handler."""
return MQTTOptionsFlowHandler(config_entry) return MQTTOptionsFlowHandler(config_entry)
@ -136,10 +142,10 @@ class FlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
class MQTTOptionsFlowHandler(config_entries.OptionsFlow): class MQTTOptionsFlowHandler(config_entries.OptionsFlow):
"""Handle MQTT options.""" """Handle MQTT options."""
def __init__(self, config_entry): def __init__(self, config_entry: config_entries.ConfigEntry) -> None:
"""Initialize MQTT options flow.""" """Initialize MQTT options flow."""
self.config_entry = config_entry self.config_entry = config_entry
self.broker_config = {} self.broker_config: dict[str, str | int] = {}
self.options = dict(config_entry.options) self.options = dict(config_entry.options)
async def async_step_init(self, user_input=None): async def async_step_init(self, user_input=None):