Update typing 12 (#48073)
This commit is contained in:
parent
6cd6ad6904
commit
a3cd1854f6
75 changed files with 399 additions and 312 deletions
|
@ -1,5 +1,5 @@
|
|||
"""Provides device conditions for sensors."""
|
||||
from typing import Dict, List
|
||||
from __future__ import annotations
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
|
@ -109,9 +109,9 @@ CONDITION_SCHEMA = vol.All(
|
|||
|
||||
async def async_get_conditions(
|
||||
hass: HomeAssistant, device_id: str
|
||||
) -> List[Dict[str, str]]:
|
||||
) -> list[dict[str, str]]:
|
||||
"""List device conditions."""
|
||||
conditions: List[Dict[str, str]] = []
|
||||
conditions: list[dict[str, str]] = []
|
||||
entity_registry = await async_get_registry(hass)
|
||||
entries = [
|
||||
entry
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
"""Helper to test significant sensor state changes."""
|
||||
from typing import Any, Optional, Union
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.const import (
|
||||
ATTR_DEVICE_CLASS,
|
||||
|
@ -19,7 +21,7 @@ def async_check_significant_change(
|
|||
new_state: str,
|
||||
new_attrs: dict,
|
||||
**kwargs: Any,
|
||||
) -> Optional[bool]:
|
||||
) -> bool | None:
|
||||
"""Test if state significantly changed."""
|
||||
device_class = new_attrs.get(ATTR_DEVICE_CLASS)
|
||||
|
||||
|
@ -28,7 +30,7 @@ def async_check_significant_change(
|
|||
|
||||
if device_class == DEVICE_CLASS_TEMPERATURE:
|
||||
if new_attrs.get(ATTR_UNIT_OF_MEASUREMENT) == TEMP_FAHRENHEIT:
|
||||
change: Union[float, int] = 1
|
||||
change: float | int = 1
|
||||
else:
|
||||
change = 0.5
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue