Strictly type modbus __init__.py, validator.py (#56378)

* strictly type: __init__.py, validator.py
This commit is contained in:
jan iversen 2021-09-21 13:43:41 +02:00 committed by GitHub
parent 518c99c8b7
commit c7c789f618
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 7 deletions

View file

@ -2,6 +2,7 @@
from __future__ import annotations
import logging
from typing import cast
import voluptuous as vol
@ -46,6 +47,7 @@ from homeassistant.const import (
)
from homeassistant.core import HomeAssistant
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.typing import ConfigType
from .const import (
ATTR_ADDRESS,
@ -378,10 +380,10 @@ SERVICE_STOP_START_SCHEMA = vol.Schema(
def get_hub(hass: HomeAssistant, name: str) -> ModbusHub:
"""Return modbus hub with name."""
return hass.data[DOMAIN][name]
return cast(ModbusHub, hass.data[DOMAIN][name])
async def async_setup(hass, config):
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up Modbus component."""
return await async_modbus_setup(
hass,