1
mirror of https://github.com/home-assistant/core synced 2024-09-09 12:51:22 +02:00

Add async_get_options_flow type hints (hvv) (#73433)

This commit is contained in:
epenet 2022-06-13 13:53:47 +02:00 committed by GitHub
parent 657e7f9a4c
commit c195d462cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,8 @@
"""Config flow for HVV integration."""
from __future__ import annotations
import logging
from typing import Any
from pygti.auth import GTI_DEFAULT_HOST
from pygti.exceptions import CannotConnect, InvalidAuth
@ -122,7 +125,9 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
@staticmethod
@callback
def async_get_options_flow(config_entry):
def async_get_options_flow(
config_entry: config_entries.ConfigEntry,
) -> OptionsFlowHandler:
"""Get options flow."""
return OptionsFlowHandler(config_entry)
@ -130,12 +135,11 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
class OptionsFlowHandler(config_entries.OptionsFlow):
"""Options flow handler."""
def __init__(self, config_entry):
def __init__(self, config_entry: config_entries.ConfigEntry) -> None:
"""Initialize HVV Departures options flow."""
self.config_entry = config_entry
self.options = dict(config_entry.options)
self.departure_filters = {}
self.hub = None
self.departure_filters: dict[str, Any] = {}
async def async_step_init(self, user_input=None):
"""Manage the options."""
@ -143,10 +147,10 @@ class OptionsFlowHandler(config_entries.OptionsFlow):
if not self.departure_filters:
departure_list = {}
self.hub = self.hass.data[DOMAIN][self.config_entry.entry_id]
hub: GTIHub = self.hass.data[DOMAIN][self.config_entry.entry_id]
try:
departure_list = await self.hub.gti.departureList(
departure_list = await hub.gti.departureList(
{
"station": self.config_entry.data[CONF_STATION],
"time": {"date": "heute", "time": "jetzt"},