Add type hints to async_setup_scanner (#63826)

Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
epenet 2022-01-10 16:13:54 +01:00 committed by GitHub
parent 896885a2c3
commit c6aaa24027
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 63 additions and 14 deletions

View file

@ -1,5 +1,8 @@
"""Tracks devices by sending a ICMP echo request (ping)."""
from __future__ import annotations
import asyncio
from collections.abc import Awaitable, Callable
from datetime import timedelta
import logging
import subprocess
@ -15,8 +18,10 @@ from homeassistant.components.device_tracker.const import (
SCAN_INTERVAL,
SOURCE_TYPE_ROUTER,
)
from homeassistant.core import HomeAssistant
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.event import async_track_point_in_utc_time
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
from homeassistant.util.async_ import gather_with_concurrency
from homeassistant.util.process import kill_subprocess
@ -77,7 +82,12 @@ class HostSubProcess:
return False
async def async_setup_scanner(hass, config, async_see, discovery_info=None):
async def async_setup_scanner(
hass: HomeAssistant,
config: ConfigType,
async_see: Callable[..., Awaitable[None]],
discovery_info: DiscoveryInfoType | None = None,
) -> None:
"""Set up the Host objects and return the update function."""
privileged = hass.data[DOMAIN][PING_PRIVS]