44
55from collections .abc import Mapping
66from datetime import timedelta
7- from typing import Any
7+ from typing import Any , cast
88
99import requests
1010import voluptuous as vol
1111from homeassistant .config_entries import (
1212 ConfigEntry ,
1313 ConfigFlow ,
14+ FlowResult ,
1415 OptionsFlow ,
1516)
1617from homeassistant .const import CONF_NAME
@@ -173,7 +174,7 @@ def async_get_options_flow(config_entry: ConfigEntry) -> OptionsFlow:
173174 async def async_step_user (
174175 self ,
175176 user_input : Mapping [str , object ] | None = None ,
176- ) -> object :
177+ ) -> FlowResult :
177178 """Handle the initial step."""
178179 errors : dict [str , str ] = {}
179180
@@ -220,20 +221,26 @@ async def async_step_user(
220221 str (user_input [CONF_EXCLUSIONS ]).strip (),
221222 ),
222223 }
223- return self .async_create_entry (
224- title = data [CONF_NAME ],
225- data = data ,
226- options = options ,
224+ return cast (
225+ "FlowResult" ,
226+ self .async_create_entry (
227+ title = data [CONF_NAME ],
228+ data = data ,
229+ options = options ,
230+ ),
227231 )
228232
229233 data_schema = _schema_with_defaults (
230234 include_feed_identity = True ,
231235 )
232236
233- return self .async_show_form (
234- step_id = "user" ,
235- data_schema = data_schema ,
236- errors = errors ,
237+ return cast (
238+ "FlowResult" ,
239+ self .async_show_form (
240+ step_id = "user" ,
241+ data_schema = data_schema ,
242+ errors = errors ,
243+ ),
237244 )
238245
239246 @staticmethod
@@ -257,7 +264,7 @@ def __init__(self, config_entry: ConfigEntry) -> None:
257264 async def async_step_init (
258265 self ,
259266 user_input : Mapping [str , object ] | None = None ,
260- ) -> object :
267+ ) -> FlowResult :
261268 """Manage Feedparser options."""
262269 if user_input is not None :
263270 options = {
@@ -269,7 +276,7 @@ async def async_step_init(
269276 CONF_INCLUSIONS : _split_csv (str (user_input [CONF_INCLUSIONS ]).strip ()),
270277 CONF_EXCLUSIONS : _split_csv (str (user_input [CONF_EXCLUSIONS ]).strip ()),
271278 }
272- return self .async_create_entry (title = "" , data = options )
279+ return cast ( "FlowResult" , self .async_create_entry (title = "" , data = options ) )
273280
274281 merged = {** self ._config_entry .data , ** self ._config_entry .options }
275282 data_schema = _schema_with_defaults (
@@ -289,4 +296,7 @@ async def async_step_init(
289296 inclusions = _join_csv (merged .get (CONF_INCLUSIONS , [])),
290297 exclusions = _join_csv (merged .get (CONF_EXCLUSIONS , [])),
291298 )
292- return self .async_show_form (step_id = "init" , data_schema = data_schema )
299+ return cast (
300+ "FlowResult" ,
301+ self .async_show_form (step_id = "init" , data_schema = data_schema ),
302+ )
0 commit comments