mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Update typing (4) [u-z] (#63925)
This commit is contained in:
parent
d3b7bd25ef
commit
bcb93d95bb
@ -4,7 +4,7 @@ from __future__ import annotations
|
||||
import dataclasses
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
from typing import Any, Dict
|
||||
from typing import Any
|
||||
|
||||
import requests.exceptions
|
||||
import upcloud_api
|
||||
@ -55,7 +55,7 @@ STATE_MAP = {"error": STATE_PROBLEM, "started": STATE_ON, "stopped": STATE_OFF}
|
||||
|
||||
|
||||
class UpCloudDataUpdateCoordinator(
|
||||
DataUpdateCoordinator[Dict[str, upcloud_api.Server]]
|
||||
DataUpdateCoordinator[dict[str, upcloud_api.Server]]
|
||||
):
|
||||
"""UpCloud data update coordinator."""
|
||||
|
||||
|
@ -4,7 +4,7 @@ from __future__ import annotations
|
||||
from datetime import timedelta
|
||||
from http import HTTPStatus
|
||||
import logging
|
||||
from typing import Any, Dict
|
||||
from typing import Any
|
||||
|
||||
import requests
|
||||
from wallbox import Wallbox
|
||||
@ -37,7 +37,7 @@ PLATFORMS = [Platform.SENSOR, Platform.NUMBER]
|
||||
UPDATE_INTERVAL = 30
|
||||
|
||||
|
||||
class WallboxCoordinator(DataUpdateCoordinator[Dict[str, Any]]):
|
||||
class WallboxCoordinator(DataUpdateCoordinator[dict[str, Any]]):
|
||||
"""Wallbox Coordinator class."""
|
||||
|
||||
def __init__(self, station: str, wallbox: Wallbox, hass: HomeAssistant) -> None:
|
||||
|
@ -5,7 +5,7 @@ import asyncio
|
||||
from concurrent import futures
|
||||
from functools import partial
|
||||
import json
|
||||
from typing import TYPE_CHECKING, Any, Awaitable, Callable, Dict, Final
|
||||
from typing import TYPE_CHECKING, Any, Awaitable, Callable, Final
|
||||
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.json import JSONEncoder
|
||||
@ -15,10 +15,10 @@ if TYPE_CHECKING:
|
||||
|
||||
|
||||
WebSocketCommandHandler = Callable[
|
||||
[HomeAssistant, "ActiveConnection", Dict[str, Any]], None
|
||||
[HomeAssistant, "ActiveConnection", dict[str, Any]], None
|
||||
]
|
||||
AsyncWebSocketCommandHandler = Callable[
|
||||
[HomeAssistant, "ActiveConnection", Dict[str, Any]], Awaitable[None]
|
||||
[HomeAssistant, "ActiveConnection", dict[str, Any]], Awaitable[None]
|
||||
]
|
||||
|
||||
DOMAIN: Final = "websocket_api"
|
||||
|
@ -4,7 +4,7 @@ from __future__ import annotations
|
||||
from collections.abc import Sequence
|
||||
from datetime import datetime
|
||||
import logging
|
||||
from typing import Optional, Tuple
|
||||
from typing import Optional
|
||||
|
||||
import pywemo
|
||||
import voluptuous as vol
|
||||
@ -43,7 +43,7 @@ WEMO_MODEL_DISPATCH = {
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
HostPortTuple = Tuple[str, Optional[int]]
|
||||
HostPortTuple = tuple[str, Optional[int]]
|
||||
|
||||
|
||||
def coerce_host_port(value: str) -> HostPortTuple:
|
||||
|
@ -10,7 +10,7 @@ from enum import Enum, IntEnum
|
||||
from http import HTTPStatus
|
||||
import logging
|
||||
import re
|
||||
from typing import Any, Dict
|
||||
from typing import Any
|
||||
|
||||
from aiohttp.web import Response
|
||||
import requests
|
||||
@ -63,7 +63,7 @@ NOT_AUTHENTICATED_ERROR = re.compile(
|
||||
)
|
||||
DATA_UPDATED_SIGNAL = "withings_entity_state_updated"
|
||||
|
||||
MeasurementData = Dict[Measurement, Any]
|
||||
MeasurementData = dict[Measurement, Any]
|
||||
|
||||
|
||||
class NotAuthenticatedError(HomeAssistantError):
|
||||
@ -588,7 +588,7 @@ class DataManager:
|
||||
update_method=self.async_subscribe_webhook,
|
||||
)
|
||||
self.poll_data_update_coordinator = DataUpdateCoordinator[
|
||||
Dict[MeasureType, Any]
|
||||
dict[MeasureType, Any]
|
||||
](
|
||||
hass,
|
||||
_LOGGER,
|
||||
|
@ -2,7 +2,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from functools import partial
|
||||
from typing import Any, Tuple, cast
|
||||
from typing import Any, cast
|
||||
|
||||
from homeassistant.components.light import (
|
||||
ATTR_BRIGHTNESS,
|
||||
@ -154,7 +154,7 @@ class WLEDSegmentLight(WLEDEntity, LightEntity):
|
||||
def rgbw_color(self) -> tuple[int, int, int, int] | None:
|
||||
"""Return the color value."""
|
||||
return cast(
|
||||
Tuple[int, int, int, int],
|
||||
tuple[int, int, int, int],
|
||||
self.coordinator.data.state.segments[self._segment].color_primary,
|
||||
)
|
||||
|
||||
|
@ -8,7 +8,7 @@ import gzip
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
from typing import Type, Union
|
||||
from typing import Union
|
||||
|
||||
from aiohttp.hdrs import USER_AGENT
|
||||
import requests
|
||||
@ -53,7 +53,7 @@ DEFAULT_NAME = "zamg"
|
||||
MIN_TIME_BETWEEN_UPDATES = timedelta(minutes=10)
|
||||
VIENNA_TIME_ZONE = dt_util.get_time_zone("Europe/Vienna")
|
||||
|
||||
DTypeT = Union[Type[int], Type[float], Type[str]]
|
||||
DTypeT = Union[type[int], type[float], type[str]]
|
||||
|
||||
|
||||
@dataclass
|
||||
|
@ -2,7 +2,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from typing import Any, Dict
|
||||
from typing import Any
|
||||
|
||||
import zigpy.zcl.clusters.closures
|
||||
|
||||
@ -32,7 +32,7 @@ from .. import (
|
||||
typing as zha_typing,
|
||||
)
|
||||
|
||||
ChannelsDict = Dict[str, zha_typing.ChannelType]
|
||||
ChannelsDict = dict[str, zha_typing.ChannelType]
|
||||
|
||||
|
||||
class Channels:
|
||||
|
@ -1,7 +1,7 @@
|
||||
"""Support for Z-Wave controls using the select platform."""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Dict, cast
|
||||
from typing import cast
|
||||
|
||||
from zwave_js_server.client import Client as ZwaveClient
|
||||
from zwave_js_server.const import TARGET_VALUE_PROPERTY, CommandClass
|
||||
@ -150,7 +150,7 @@ class ZwaveMultilevelSwitchSelectEntity(ZWaveBaseEntity, SelectEntity):
|
||||
self._target_value = self.get_zwave_value(TARGET_VALUE_PROPERTY)
|
||||
assert self.info.platform_data_template
|
||||
self._lookup_map = cast(
|
||||
Dict[int, str], self.info.platform_data_template.static_data
|
||||
dict[int, str], self.info.platform_data_template.static_data
|
||||
)
|
||||
|
||||
# Entity class attributes
|
||||
|
Loading…
x
Reference in New Issue
Block a user