Adjust async_step_zeroconf signature for strict typing (#59503)

Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
epenet 2021-11-15 18:05:45 +01:00 committed by GitHub
parent 5cc594682f
commit b3ffc1e183
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 85 additions and 66 deletions

View file

@ -8,7 +8,7 @@ from enum import Enum
import functools
import logging
from types import MappingProxyType, MethodType
from typing import Any, Callable, Optional, cast
from typing import TYPE_CHECKING, Any, Callable, Optional, cast
import weakref
from homeassistant import data_entry_flow, loader
@ -31,6 +31,9 @@ from homeassistant.setup import async_process_deps_reqs, async_setup_component
from homeassistant.util.decorator import Registry
import homeassistant.util.uuid as uuid_util
if TYPE_CHECKING:
from homeassistant.components.zeroconf import ZeroconfServiceInfo
_LOGGER = logging.getLogger(__name__)
SOURCE_DISCOVERY = "discovery"
@ -1369,10 +1372,10 @@ class ConfigFlow(data_entry_flow.FlowHandler):
return await self.async_step_discovery(discovery_info)
async def async_step_zeroconf(
self, discovery_info: DiscoveryInfoType
self, discovery_info: ZeroconfServiceInfo
) -> data_entry_flow.FlowResult:
"""Handle a flow initialized by Zeroconf discovery."""
return await self.async_step_discovery(discovery_info)
return await self.async_step_discovery(cast(dict, discovery_info))
async def async_step_dhcp(
self, discovery_info: DiscoveryInfoType