Enable strict typing for history_stats (#107273)

This commit is contained in:
Marc Mueller 2024-01-08 09:58:07 +01:00 committed by GitHub
parent 3958d89ae6
commit 265f587768
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 1 deletions

View File

@ -193,6 +193,7 @@ homeassistant.components.hardkernel.*
homeassistant.components.hardware.*
homeassistant.components.here_travel_time.*
homeassistant.components.history.*
homeassistant.components.history_stats.*
homeassistant.components.holiday.*
homeassistant.components.homeassistant.exposed_entities
homeassistant.components.homeassistant.triggers.event

View File

@ -3,6 +3,7 @@ from __future__ import annotations
from abc import abstractmethod
import datetime
from typing import Any, TypeVar
import voluptuous as vol
@ -53,8 +54,10 @@ UNITS: dict[str, str] = {
}
ICON = "mdi:chart-line"
_T = TypeVar("_T", bound=dict[str, Any])
def exactly_two_period_keys(conf):
def exactly_two_period_keys(conf: _T) -> _T:
"""Ensure exactly 2 of CONF_PERIOD_KEYS are provided."""
if sum(param in conf for param in CONF_PERIOD_KEYS) != 2:
raise vol.Invalid(

View File

@ -1691,6 +1691,16 @@ disallow_untyped_defs = true
warn_return_any = true
warn_unreachable = true
[mypy-homeassistant.components.history_stats.*]
check_untyped_defs = true
disallow_incomplete_defs = true
disallow_subclassing_any = true
disallow_untyped_calls = true
disallow_untyped_decorators = true
disallow_untyped_defs = true
warn_return_any = true
warn_unreachable = true
[mypy-homeassistant.components.holiday.*]
check_untyped_defs = true
disallow_incomplete_defs = true