Skip to content

Commit

Permalink
Improve typing.
Browse files Browse the repository at this point in the history
  • Loading branch information
denpamusic committed Dec 23, 2023
1 parent 9eeca71 commit 15ca339
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions custom_components/plum_ecomax/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from __future__ import annotations

import asyncio
from collections.abc import MutableMapping
from collections.abc import Mapping
import logging
from typing import Any

Expand Down Expand Up @@ -67,7 +67,7 @@


async def validate_input(
connection_type: str, hass: HomeAssistant, data: MutableMapping[str, Any]
connection_type: str, hass: HomeAssistant, data: Mapping[str, Any]
) -> Connection:
"""Validate the user input allows us to connect.
Expand Down Expand Up @@ -97,7 +97,7 @@ def __init__(self) -> None:
self.device_task: asyncio.Task | None = None
self.identify_task: asyncio.Task | None = None
self.modules_task: asyncio.Task | None = None
self.init_info: MutableMapping[str, Any] = {}
self.init_info: dict[str, Any] = {}

async def async_step_user(self, _=None) -> FlowResult:
"""Handle initial step."""
Expand All @@ -107,7 +107,7 @@ async def async_step_user(self, _=None) -> FlowResult:
)

async def async_step_tcp(
self, user_input: MutableMapping[str, Any] | None = None
self, user_input: dict[str, Any] | None = None
) -> FlowResult:
"""Handle TCP connection setup."""
if user_input is None:
Expand Down Expand Up @@ -136,7 +136,7 @@ async def async_step_tcp(
)

async def async_step_serial(
self, user_input: MutableMapping[str, Any] | None = None
self, user_input: dict[str, Any] | None = None
) -> FlowResult:
"""Handle serial connection setup."""
if user_input is None:
Expand Down Expand Up @@ -166,7 +166,7 @@ async def async_step_serial(
step_id="serial", data_schema=STEP_SERIAL_DATA_SCHEMA, errors=errors
)

async def async_step_device(self, user_input=None) -> FlowResult:
async def async_step_device(self, _=None) -> FlowResult:
"""Wait until the device is available."""

async def _wait_for_device() -> None:
Expand Down Expand Up @@ -195,7 +195,7 @@ async def _wait_for_device() -> None:

return self.async_show_progress_done(next_step_id="identify")

async def async_step_identify(self, user_input=None) -> FlowResult:
async def async_step_identify(self, _=None) -> FlowResult:
"""Identify the device."""

async def _identify_device() -> None:
Expand Down Expand Up @@ -241,7 +241,7 @@ async def _identify_device() -> None:

return self.async_show_progress_done(next_step_id="discover")

async def async_step_discover(self, user_input=None) -> FlowResult:
async def async_step_discover(self, _=None) -> FlowResult:
"""Discover connected modules."""

async def _discover_modules() -> None:
Expand Down Expand Up @@ -283,7 +283,7 @@ async def _discover_modules() -> None:

return self.async_show_progress_done(next_step_id="finish")

async def async_step_finish(self, user_input=None) -> FlowResult:
async def async_step_finish(self, _=None) -> FlowResult:
"""Finish integration config."""
if self.connection:
await self.connection.close()
Expand All @@ -292,15 +292,15 @@ async def async_step_finish(self, user_input=None) -> FlowResult:
title=self.init_info[CONF_MODEL], data=self.init_info
)

async def async_step_device_not_found(self, user_input=None) -> FlowResult:
async def async_step_device_not_found(self, _=None) -> FlowResult:
"""Handle issues that need transition await from progress step."""
return self.async_abort(reason="no_devices_found")

async def async_step_unsupported_device(self, user_input=None) -> FlowResult:
async def async_step_unsupported_device(self, _=None) -> FlowResult:
"""Handle issues that need transition await from progress step."""
return self.async_abort(reason="unsupported_device")

async def async_step_discovery_failed(self, user_input=None) -> FlowResult:
async def async_step_discovery_failed(self, _=None) -> FlowResult:
"""Handle issues that need transition await from progress step."""
return self.async_abort(reason="discovery_failed")

Expand Down

0 comments on commit 15ca339

Please sign in to comment.