Add type hints to get_scanner/async_get_scanner (#63836)

Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
epenet 2022-01-10 23:42:39 +01:00 committed by GitHub
parent d76d9f9e42
commit caff3e0630
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 116 additions and 24 deletions

View file

@ -1,4 +1,6 @@
"""Support for Xiaomi Mi routers."""
from __future__ import annotations
from http import HTTPStatus
import logging
@ -11,7 +13,9 @@ from homeassistant.components.device_tracker import (
DeviceScanner,
)
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_USERNAME
from homeassistant.core import HomeAssistant
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.typing import ConfigType
_LOGGER = logging.getLogger(__name__)
@ -24,7 +28,7 @@ PLATFORM_SCHEMA = PARENT_PLATFORM_SCHEMA.extend(
)
def get_scanner(hass, config):
def get_scanner(hass: HomeAssistant, config: ConfigType) -> DeviceScanner | None:
"""Validate the configuration and return a Xiaomi Device Scanner."""
scanner = XiaomiDeviceScanner(config[DOMAIN])