mirror of https://github.com/home-assistant/core
Enable strict typing for history_stats (#107273)
This commit is contained in:
parent
3958d89ae6
commit
265f587768
|
@ -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
|
||||
|
|
|
@ -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(
|
||||
|
|
10
mypy.ini
10
mypy.ini
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue