1
- # pylint: disable=bad-continuation
2
- """
3
- The configuration flow module for Dijnet integration.
4
- """
1
+ """The configuration flow module for Dijnet integration."""
5
2
6
3
import logging
7
- from typing import Any , Dict
4
+ from typing import Any , Self
8
5
9
6
import voluptuous as vol
10
7
from homeassistant .config_entries import HANDLERS , ConfigEntry , ConfigFlow , OptionsFlow
21
18
class DijnetOptionsFlowHandler (OptionsFlow ):
22
19
"""Handle Dijnet options."""
23
20
24
- def __init__ (self , config_entry : ConfigEntry ) -> None :
21
+ def __init__ (self : Self , config_entry : ConfigEntry ) -> None :
25
22
"""
26
23
Initialize a new instance of DijnetOptionsFlowHandler class.
27
24
28
- Parameters
29
- ----------
30
- config_entry: homeassistant.config_entries.ConfigEntry
25
+ Args:
26
+ config_entry:
31
27
The config entry of the integration.
32
28
33
- Returns
34
- -------
35
- None
36
29
"""
37
30
self .config_entry = config_entry
38
31
39
- async def async_step_init (self , user_input : Dict [str , Any ] = None ) -> FlowResult :
32
+ async def async_step_init (self : Self , user_input : dict [str , Any ] | None = None ) -> FlowResult :
40
33
"""
41
34
Handles Dijnet configuration init step.
42
35
43
- Parameters
44
- ----------
45
- user_input: Dict[str, Any]
36
+ Args:
37
+ user_input:
46
38
The dictionary contains the settings entered by the user
47
39
on the configuration screen.
40
+
48
41
"""
49
42
data_schema = vol .Schema (
50
43
{
@@ -81,9 +74,7 @@ async def async_step_init(self, user_input: Dict[str, Any] = None) -> FlowResult
81
74
82
75
@HANDLERS .register (DOMAIN )
83
76
class DijnetConfigFlow (ConfigFlow , domain = DOMAIN ):
84
- """
85
- Configuration flow handler for Dijnet integration.
86
- """
77
+ """Configuration flow handler for Dijnet integration."""
87
78
88
79
VERSION = 2
89
80
@@ -93,21 +84,27 @@ def async_get_options_flow(config_entry: ConfigFlow) -> DijnetOptionsFlowHandler
93
84
"""
94
85
Gets the options flow handler for the integration.
95
86
96
- Parameters
97
- ----------
98
- config_entry: homeassistant.config_entries.ConfigEntry
87
+ Args:
88
+ config_entry:
99
89
The config entry of the integration.
100
90
101
- Returns
102
- -------
103
- DijnetOptionsFlowHandler
104
- The options flow handler for the integration.
91
+ Returns:
92
+ The options flow handler for the integration.
93
+
105
94
"""
106
95
return DijnetOptionsFlowHandler (config_entry )
107
96
108
- async def async_step_user (self , user_input : Dict [str , Any ]) -> FlowResult :
97
+ async def async_step_user (self : Self , user_input : dict [str , Any ]) -> FlowResult :
109
98
"""
110
99
Handles the step when integration added from the UI.
100
+
101
+ Args:
102
+ user_input:
103
+ The dictionary contains the settings entered by the user
104
+ on the configuration screen.
105
+
106
+ Returns:
107
+ The result of the flow step.
111
108
"""
112
109
data_schema = vol .Schema (
113
110
{
@@ -148,10 +145,8 @@ async def async_step_user(self, user_input: Dict[str, Any]) -> FlowResult:
148
145
data_schema = data_schema ,
149
146
)
150
147
151
- async def async_step_import (self , import_config : Dict [str , Any ]) -> FlowResult :
152
- """
153
- Handles the yaml configuration import step.
154
- """
148
+ async def async_step_import (self : Self , import_config : dict [str , Any ]) -> FlowResult :
149
+ """Handles the yaml configuration import step."""
155
150
_LOGGER .debug ("Importing Dijnet config from yaml." )
156
151
157
152
await self .async_set_unique_id (import_config [CONF_USERNAME ])
0 commit comments