Replace unnecessary MappingProxyType annotations in integrations (#143451)
parent
e56f6fafdc
commit
3cf12a4792
|
@ -3,10 +3,10 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from asyncio import timeout
|
||||
from collections.abc import Mapping
|
||||
from http import HTTPStatus
|
||||
import json
|
||||
import logging
|
||||
from types import MappingProxyType
|
||||
from typing import TYPE_CHECKING, Any, cast
|
||||
from uuid import uuid4
|
||||
|
||||
|
@ -260,10 +260,10 @@ async def async_enable_proactive_mode(
|
|||
def extra_significant_check(
|
||||
hass: HomeAssistant,
|
||||
old_state: str,
|
||||
old_attrs: dict[Any, Any] | MappingProxyType[Any, Any],
|
||||
old_attrs: Mapping[Any, Any],
|
||||
old_extra_arg: Any,
|
||||
new_state: str,
|
||||
new_attrs: dict[str, Any] | MappingProxyType[Any, Any],
|
||||
new_attrs: Mapping[Any, Any],
|
||||
new_extra_arg: Any,
|
||||
) -> bool:
|
||||
"""Check if the serialized data has changed."""
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Mapping
|
||||
from functools import partial
|
||||
import logging
|
||||
from types import MappingProxyType
|
||||
|
@ -175,7 +176,7 @@ class AnthropicOptionsFlow(OptionsFlow):
|
|||
|
||||
def anthropic_config_option_schema(
|
||||
hass: HomeAssistant,
|
||||
options: dict[str, Any] | MappingProxyType[str, Any],
|
||||
options: Mapping[str, Any],
|
||||
) -> dict:
|
||||
"""Return a schema for Anthropic completion options."""
|
||||
hass_apis: list[SelectOptionDict] = [
|
||||
|
|
|
@ -2,10 +2,9 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Callable
|
||||
from collections.abc import Callable, Mapping
|
||||
from datetime import datetime, timedelta
|
||||
import logging
|
||||
from types import MappingProxyType
|
||||
from typing import Any
|
||||
|
||||
from pyasuswrt import AsusWrtError
|
||||
|
@ -363,7 +362,7 @@ class AsusWrtRouter:
|
|||
"""Add a function to call when router is closed."""
|
||||
self._on_close.append(func)
|
||||
|
||||
def update_options(self, new_options: MappingProxyType[str, Any]) -> bool:
|
||||
def update_options(self, new_options: Mapping[str, Any]) -> bool:
|
||||
"""Update router options."""
|
||||
req_reload = False
|
||||
for name, new_opt in new_options.items():
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""Axis network device abstraction."""
|
||||
|
||||
from asyncio import timeout
|
||||
from types import MappingProxyType
|
||||
from collections.abc import Mapping
|
||||
from typing import Any
|
||||
|
||||
import axis
|
||||
|
@ -23,7 +23,7 @@ from ..errors import AuthenticationRequired, CannotConnect
|
|||
|
||||
async def get_axis_api(
|
||||
hass: HomeAssistant,
|
||||
config: MappingProxyType[str, Any],
|
||||
config: Mapping[str, Any],
|
||||
) -> axis.AxisDevice:
|
||||
"""Create a Axis device API."""
|
||||
session = get_async_client(hass, verify_ssl=False)
|
||||
|
|
|
@ -3,11 +3,10 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from collections.abc import Callable
|
||||
from collections.abc import Callable, Mapping
|
||||
from datetime import datetime
|
||||
import json
|
||||
import logging
|
||||
from types import MappingProxyType
|
||||
from typing import Any
|
||||
|
||||
from azure.eventhub import EventData, EventDataBatch
|
||||
|
@ -179,7 +178,7 @@ class AzureEventHub:
|
|||
await self.async_send(None)
|
||||
await self._queue.join()
|
||||
|
||||
def update_options(self, new_options: MappingProxyType[str, Any]) -> None:
|
||||
def update_options(self, new_options: Mapping[str, Any]) -> None:
|
||||
"""Update options."""
|
||||
self._send_interval = new_options[CONF_SEND_INTERVAL]
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from collections.abc import Mapping
|
||||
from functools import partial
|
||||
from types import MappingProxyType
|
||||
from typing import Any
|
||||
|
||||
from devolo_home_control_api.exceptions.gateway import GatewayOfflineError
|
||||
|
@ -97,7 +97,7 @@ async def async_remove_config_entry_device(
|
|||
return True
|
||||
|
||||
|
||||
def configure_mydevolo(conf: dict[str, Any] | MappingProxyType[str, Any]) -> Mydevolo:
|
||||
def configure_mydevolo(conf: Mapping[str, Any]) -> Mydevolo:
|
||||
"""Configure mydevolo."""
|
||||
mydevolo = Mydevolo()
|
||||
mydevolo.user = conf[CONF_USERNAME]
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Callable
|
||||
from types import MappingProxyType
|
||||
from collections.abc import Callable, Mapping
|
||||
from typing import Any
|
||||
|
||||
from dynalite_devices_lib.dynalite_devices import (
|
||||
|
@ -50,7 +49,7 @@ class DynaliteBridge:
|
|||
LOGGER.debug("Setting up bridge - host %s", self.host)
|
||||
return await self.dynalite_devices.async_setup()
|
||||
|
||||
def reload_config(self, config: MappingProxyType[str, Any]) -> None:
|
||||
def reload_config(self, config: Mapping[str, Any]) -> None:
|
||||
"""Reconfigure a bridge when config changes."""
|
||||
LOGGER.debug("Reloading bridge - host %s, config %s", self.host, config)
|
||||
self.dynalite_devices.configure(convert_config(config))
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
from types import MappingProxyType
|
||||
from collections.abc import Mapping
|
||||
from typing import Any
|
||||
|
||||
from dynalite_devices_lib import const as dyn_const
|
||||
|
@ -138,9 +138,7 @@ def convert_template(config: dict[str, Any]) -> dict[str, Any]:
|
|||
return convert_with_map(config, my_map)
|
||||
|
||||
|
||||
def convert_config(
|
||||
config: dict[str, Any] | MappingProxyType[str, Any],
|
||||
) -> dict[str, Any]:
|
||||
def convert_config(config: Mapping[str, Any]) -> dict[str, Any]:
|
||||
"""Convert a config dict by replacing component consts with library consts."""
|
||||
my_map = {
|
||||
CONF_NAME: dyn_const.CONF_NAME,
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Mapping
|
||||
import logging
|
||||
from types import MappingProxyType
|
||||
from typing import Any
|
||||
|
||||
from elevenlabs import AsyncElevenLabs
|
||||
|
@ -43,7 +43,7 @@ _LOGGER = logging.getLogger(__name__)
|
|||
PARALLEL_UPDATES = 0
|
||||
|
||||
|
||||
def to_voice_settings(options: MappingProxyType[str, Any]) -> VoiceSettings:
|
||||
def to_voice_settings(options: Mapping[str, Any]) -> VoiceSettings:
|
||||
"""Return voice settings."""
|
||||
return VoiceSettings(
|
||||
stability=options.get(CONF_STABILITY, DEFAULT_STABILITY),
|
||||
|
|
|
@ -5,7 +5,6 @@ from __future__ import annotations
|
|||
import asyncio
|
||||
import logging
|
||||
import re
|
||||
from types import MappingProxyType
|
||||
from typing import Any
|
||||
|
||||
from elkm1_lib.elements import Element
|
||||
|
@ -235,7 +234,7 @@ def _async_find_matching_config_entry(
|
|||
|
||||
async def async_setup_entry(hass: HomeAssistant, entry: ElkM1ConfigEntry) -> bool:
|
||||
"""Set up Elk-M1 Control from a config entry."""
|
||||
conf: MappingProxyType[str, Any] = entry.data
|
||||
conf = entry.data
|
||||
|
||||
host = hostname_from_url(entry.data[CONF_HOST])
|
||||
|
||||
|
|
|
@ -2,13 +2,12 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Callable, ValuesView
|
||||
from collections.abc import Callable, Mapping, ValuesView
|
||||
from dataclasses import dataclass, field
|
||||
from datetime import datetime, timedelta
|
||||
from functools import partial
|
||||
import logging
|
||||
import re
|
||||
from types import MappingProxyType
|
||||
from typing import Any, TypedDict, cast
|
||||
|
||||
from fritzconnection import FritzConnection
|
||||
|
@ -187,7 +186,7 @@ class FritzBoxTools(DataUpdateCoordinator[UpdateCoordinatorDataType]):
|
|||
)
|
||||
|
||||
self._devices: dict[str, FritzDevice] = {}
|
||||
self._options: MappingProxyType[str, Any] | None = None
|
||||
self._options: Mapping[str, Any] | None = None
|
||||
self._unique_id: str | None = None
|
||||
self.connection: FritzConnection = None
|
||||
self.fritz_guest_wifi: FritzGuestWLAN = None
|
||||
|
@ -213,9 +212,7 @@ class FritzBoxTools(DataUpdateCoordinator[UpdateCoordinatorDataType]):
|
|||
str, Callable[[FritzStatus, StateType], Any]
|
||||
] = {}
|
||||
|
||||
async def async_setup(
|
||||
self, options: MappingProxyType[str, Any] | None = None
|
||||
) -> None:
|
||||
async def async_setup(self, options: Mapping[str, Any] | None = None) -> None:
|
||||
"""Wrap up FritzboxTools class setup."""
|
||||
self._options = options
|
||||
await self.hass.async_add_executor_job(self.setup)
|
||||
|
|
|
@ -208,7 +208,7 @@ class GoogleGenerativeAIOptionsFlow(OptionsFlow):
|
|||
|
||||
async def google_generative_ai_config_option_schema(
|
||||
hass: HomeAssistant,
|
||||
options: dict[str, Any] | MappingProxyType[str, Any],
|
||||
options: Mapping[str, Any],
|
||||
genai_client: genai.Client,
|
||||
) -> dict:
|
||||
"""Return a schema for Google Generative AI completion options."""
|
||||
|
|
|
@ -5,7 +5,6 @@ from __future__ import annotations
|
|||
from collections.abc import Callable, Mapping, Sequence
|
||||
import functools
|
||||
import logging
|
||||
from types import MappingProxyType
|
||||
from typing import Any
|
||||
|
||||
from hyperion import client, const
|
||||
|
@ -129,7 +128,7 @@ class HyperionLight(LightEntity):
|
|||
server_id: str,
|
||||
instance_num: int,
|
||||
instance_name: str,
|
||||
options: MappingProxyType[str, Any],
|
||||
options: Mapping[str, Any],
|
||||
hyperion_client: client.HyperionClient,
|
||||
) -> None:
|
||||
"""Initialize the light."""
|
||||
|
|
|
@ -2,11 +2,10 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Callable
|
||||
from collections.abc import Callable, Mapping
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
from random import randrange
|
||||
from types import MappingProxyType
|
||||
from typing import Any, Self
|
||||
|
||||
import metno
|
||||
|
@ -41,7 +40,7 @@ class CannotConnect(HomeAssistantError):
|
|||
class MetWeatherData:
|
||||
"""Keep data for Met.no weather entities."""
|
||||
|
||||
def __init__(self, hass: HomeAssistant, config: MappingProxyType[str, Any]) -> None:
|
||||
def __init__(self, hass: HomeAssistant, config: Mapping[str, Any]) -> None:
|
||||
"""Initialise the weather entity data."""
|
||||
self.hass = hass
|
||||
self._config = config
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
from types import MappingProxyType
|
||||
from collections.abc import Mapping
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from homeassistant.components.weather import (
|
||||
|
@ -82,7 +82,7 @@ async def async_setup_entry(
|
|||
async_add_entities(entities)
|
||||
|
||||
|
||||
def _calculate_unique_id(config: MappingProxyType[str, Any], hourly: bool) -> str:
|
||||
def _calculate_unique_id(config: Mapping[str, Any], hourly: bool) -> str:
|
||||
"""Calculate unique ID."""
|
||||
name_appendix = ""
|
||||
if hourly:
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
"""The met_eireann component."""
|
||||
|
||||
from collections.abc import Mapping
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
from types import MappingProxyType
|
||||
from typing import Any, Self
|
||||
|
||||
import meteireann
|
||||
|
@ -74,7 +74,7 @@ class MetEireannWeatherData:
|
|||
"""Keep data for Met Éireann weather entities."""
|
||||
|
||||
def __init__(
|
||||
self, config: MappingProxyType[str, Any], weather_data: meteireann.WeatherData
|
||||
self, config: Mapping[str, Any], weather_data: meteireann.WeatherData
|
||||
) -> None:
|
||||
"""Initialise the weather entity data."""
|
||||
self._config = config
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""Support for Met Éireann weather service."""
|
||||
|
||||
from collections.abc import Mapping
|
||||
import logging
|
||||
from types import MappingProxyType
|
||||
from typing import Any, cast
|
||||
|
||||
from homeassistant.components.weather import (
|
||||
|
@ -64,7 +64,7 @@ async def async_setup_entry(
|
|||
async_add_entities([MetEireannWeather(coordinator, config_entry.data)])
|
||||
|
||||
|
||||
def _calculate_unique_id(config: MappingProxyType[str, Any], hourly: bool) -> str:
|
||||
def _calculate_unique_id(config: Mapping[str, Any], hourly: bool) -> str:
|
||||
"""Calculate unique ID."""
|
||||
name_appendix = ""
|
||||
if hourly:
|
||||
|
@ -90,7 +90,7 @@ class MetEireannWeather(
|
|||
def __init__(
|
||||
self,
|
||||
coordinator: DataUpdateCoordinator[MetEireannWeatherData],
|
||||
config: MappingProxyType[str, Any],
|
||||
config: Mapping[str, Any],
|
||||
) -> None:
|
||||
"""Initialise the platform with a data instance and site."""
|
||||
super().__init__(coordinator)
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Mapping
|
||||
from http import HTTPStatus
|
||||
from types import MappingProxyType
|
||||
from typing import Any
|
||||
|
||||
import requests
|
||||
|
@ -34,7 +34,7 @@ from .const import CONF_MJPEG_URL, CONF_STILL_IMAGE_URL, DOMAIN, LOGGER
|
|||
|
||||
@callback
|
||||
def async_get_schema(
|
||||
defaults: dict[str, Any] | MappingProxyType[str, Any], show_name: bool = False
|
||||
defaults: Mapping[str, Any], show_name: bool = False
|
||||
) -> vol.Schema:
|
||||
"""Return MJPEG IP Camera schema."""
|
||||
schema = {
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Mapping
|
||||
from contextlib import suppress
|
||||
from types import MappingProxyType
|
||||
from typing import Any
|
||||
|
||||
import aiohttp
|
||||
|
@ -154,7 +154,7 @@ class MotionEyeMjpegCamera(MotionEyeEntity, MjpegCamera):
|
|||
camera: dict[str, Any],
|
||||
client: MotionEyeClient,
|
||||
coordinator: DataUpdateCoordinator,
|
||||
options: MappingProxyType[str, str],
|
||||
options: Mapping[str, str],
|
||||
) -> None:
|
||||
"""Initialize a MJPEG camera."""
|
||||
self._surveillance_username = username
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
from types import MappingProxyType
|
||||
from collections.abc import Mapping
|
||||
from typing import Any
|
||||
|
||||
from motioneye_client.client import MotionEyeClient
|
||||
|
@ -37,7 +37,7 @@ class MotionEyeEntity(CoordinatorEntity):
|
|||
camera: dict[str, Any],
|
||||
client: MotionEyeClient,
|
||||
coordinator: DataUpdateCoordinator,
|
||||
options: MappingProxyType[str, Any],
|
||||
options: Mapping[str, Any],
|
||||
entity_description: EntityDescription | None = None,
|
||||
) -> None:
|
||||
"""Initialize a motionEye entity."""
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Mapping
|
||||
import logging
|
||||
from types import MappingProxyType
|
||||
from typing import Any
|
||||
|
||||
from motioneye_client.client import MotionEyeClient
|
||||
|
@ -60,7 +60,7 @@ class MotionEyeActionSensor(MotionEyeEntity, SensorEntity):
|
|||
camera: dict[str, Any],
|
||||
client: MotionEyeClient,
|
||||
coordinator: DataUpdateCoordinator,
|
||||
options: MappingProxyType[str, str],
|
||||
options: Mapping[str, str],
|
||||
) -> None:
|
||||
"""Initialize an action sensor."""
|
||||
super().__init__(
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
from types import MappingProxyType
|
||||
from collections.abc import Mapping
|
||||
from typing import Any
|
||||
|
||||
from motioneye_client.client import MotionEyeClient
|
||||
|
@ -103,7 +103,7 @@ class MotionEyeSwitch(MotionEyeEntity, SwitchEntity):
|
|||
camera: dict[str, Any],
|
||||
client: MotionEyeClient,
|
||||
coordinator: DataUpdateCoordinator,
|
||||
options: MappingProxyType[str, str],
|
||||
options: Mapping[str, str],
|
||||
entity_description: SwitchEntityDescription,
|
||||
) -> None:
|
||||
"""Initialize the switch."""
|
||||
|
|
|
@ -4,7 +4,6 @@ from __future__ import annotations
|
|||
|
||||
from collections.abc import Mapping
|
||||
import logging
|
||||
from types import MappingProxyType
|
||||
from typing import Any
|
||||
|
||||
from aionut import NUTError, NUTLoginError
|
||||
|
@ -33,7 +32,7 @@ PASSWORD_NOT_CHANGED = "__**password_not_changed**__"
|
|||
|
||||
|
||||
def _base_schema(
|
||||
nut_config: dict[str, Any] | MappingProxyType[str, Any],
|
||||
nut_config: Mapping[str, Any],
|
||||
use_password_not_changed: bool = False,
|
||||
) -> vol.Schema:
|
||||
"""Generate base schema."""
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Mapping
|
||||
from dataclasses import dataclass
|
||||
from datetime import datetime
|
||||
from types import MappingProxyType
|
||||
from typing import Any
|
||||
|
||||
from homeassistant.components.sensor import (
|
||||
|
@ -180,7 +180,7 @@ class NWSSensor(CoordinatorEntity[TimestampDataUpdateCoordinator[None]], SensorE
|
|||
def __init__(
|
||||
self,
|
||||
hass: HomeAssistant,
|
||||
entry_data: MappingProxyType[str, Any],
|
||||
entry_data: Mapping[str, Any],
|
||||
nws_data: NWSData,
|
||||
description: NWSSensorEntityDescription,
|
||||
station: str,
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Mapping
|
||||
from functools import partial
|
||||
from types import MappingProxyType
|
||||
from typing import Any, Required, TypedDict, cast
|
||||
|
||||
import voluptuous as vol
|
||||
|
@ -126,7 +126,7 @@ class ExtraForecast(TypedDict, total=False):
|
|||
short_description: str | None
|
||||
|
||||
|
||||
def _calculate_unique_id(entry_data: MappingProxyType[str, Any], mode: str) -> str:
|
||||
def _calculate_unique_id(entry_data: Mapping[str, Any], mode: str) -> str:
|
||||
"""Calculate unique ID."""
|
||||
latitude = entry_data[CONF_LATITUDE]
|
||||
longitude = entry_data[CONF_LONGITUDE]
|
||||
|
@ -148,7 +148,7 @@ class NWSWeather(CoordinatorWeatherEntity[TimestampDataUpdateCoordinator[None]])
|
|||
|
||||
def __init__(
|
||||
self,
|
||||
entry_data: MappingProxyType[str, Any],
|
||||
entry_data: Mapping[str, Any],
|
||||
nws_data: NWSData,
|
||||
) -> None:
|
||||
"""Initialise the platform with a data instance and station name."""
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from collections.abc import Mapping
|
||||
import logging
|
||||
import sys
|
||||
from types import MappingProxyType
|
||||
|
@ -228,7 +229,7 @@ class OllamaOptionsFlow(OptionsFlow):
|
|||
|
||||
|
||||
def ollama_config_option_schema(
|
||||
hass: HomeAssistant, options: MappingProxyType[str, Any]
|
||||
hass: HomeAssistant, options: Mapping[str, Any]
|
||||
) -> dict:
|
||||
"""Ollama options schema."""
|
||||
hass_apis: list[SelectOptionDict] = [
|
||||
|
|
|
@ -7,7 +7,6 @@ import dataclasses
|
|||
from datetime import timedelta
|
||||
import logging
|
||||
import os
|
||||
from types import MappingProxyType
|
||||
from typing import Any
|
||||
|
||||
from pyownet import protocol
|
||||
|
@ -415,7 +414,7 @@ async def async_setup_entry(
|
|||
def get_entities(
|
||||
onewire_hub: OneWireHub,
|
||||
devices: list[OWDeviceDescription],
|
||||
options: MappingProxyType[str, Any],
|
||||
options: Mapping[str, Any],
|
||||
) -> list[OneWireSensorEntity]:
|
||||
"""Get a list of entities."""
|
||||
entities: list[OneWireSensorEntity] = []
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Mapping
|
||||
import json
|
||||
import logging
|
||||
from types import MappingProxyType
|
||||
|
@ -243,7 +244,7 @@ class OpenAIOptionsFlow(OptionsFlow):
|
|||
|
||||
def openai_config_option_schema(
|
||||
hass: HomeAssistant,
|
||||
options: dict[str, Any] | MappingProxyType[str, Any],
|
||||
options: Mapping[str, Any],
|
||||
) -> VolDictType:
|
||||
"""Return a schema for OpenAI completion options."""
|
||||
hass_apis: list[SelectOptionDict] = [
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Mapping
|
||||
from dataclasses import dataclass
|
||||
import logging
|
||||
from types import MappingProxyType
|
||||
from typing import Any
|
||||
|
||||
from pyotgw import vars as gw_vars
|
||||
|
@ -94,7 +94,7 @@ class OpenThermClimate(OpenThermStatusEntity, ClimateEntity):
|
|||
self,
|
||||
gw_hub: OpenThermGatewayHub,
|
||||
description: OpenThermClimateEntityDescription,
|
||||
options: MappingProxyType[str, Any],
|
||||
options: Mapping[str, Any],
|
||||
) -> None:
|
||||
"""Initialize the entity."""
|
||||
super().__init__(gw_hub, description)
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Mapping
|
||||
import re
|
||||
from types import MappingProxyType
|
||||
from typing import Any
|
||||
|
||||
import sentry_sdk
|
||||
|
@ -120,7 +120,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||
|
||||
def process_before_send(
|
||||
hass: HomeAssistant,
|
||||
options: MappingProxyType[str, Any],
|
||||
options: Mapping[str, Any],
|
||||
channel: str,
|
||||
huuid: str,
|
||||
system_info: dict[str, bool | str],
|
||||
|
|
|
@ -2,10 +2,9 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Iterable
|
||||
from collections.abc import Iterable, Mapping
|
||||
from datetime import datetime, timedelta
|
||||
from ipaddress import IPv4Address, IPv6Address, ip_address
|
||||
from types import MappingProxyType
|
||||
from typing import TYPE_CHECKING, Any, cast
|
||||
|
||||
from aiohttp.web import Request, WebSocketResponse
|
||||
|
@ -546,7 +545,7 @@ def is_rpc_wifi_stations_disabled(
|
|||
return True
|
||||
|
||||
|
||||
def get_http_port(data: MappingProxyType[str, Any]) -> int:
|
||||
def get_http_port(data: Mapping[str, Any]) -> int:
|
||||
"""Get port from config entry data."""
|
||||
return cast(int, data.get(CONF_PORT, DEFAULT_HTTP_PORT))
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""Helper functions for swiss_public_transport."""
|
||||
|
||||
from collections.abc import Mapping
|
||||
from datetime import timedelta
|
||||
from types import MappingProxyType
|
||||
from typing import Any
|
||||
|
||||
from opendata_transport import OpendataTransport
|
||||
|
@ -36,7 +36,7 @@ def dict_duration_to_str_duration(
|
|||
return f"{d['hours']:02d}:{d['minutes']:02d}:{d['seconds']:02d}"
|
||||
|
||||
|
||||
def unique_id_from_config(config: MappingProxyType[str, Any] | dict[str, Any]) -> str:
|
||||
def unique_id_from_config(config: Mapping[str, Any]) -> str:
|
||||
"""Build a unique id from a config entry."""
|
||||
return (
|
||||
f"{config[CONF_START]} {config[CONF_DESTINATION]}"
|
||||
|
|
|
@ -45,7 +45,7 @@ STEP_USER_DATA_SCHEMA = vol.Schema(
|
|||
|
||||
|
||||
async def create_omada_client(
|
||||
hass: HomeAssistant, data: MappingProxyType[str, Any]
|
||||
hass: HomeAssistant, data: Mapping[str, Any]
|
||||
) -> OmadaClient:
|
||||
"""Create a TP-Link Omada client API for the given config entry."""
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from collections.abc import Mapping
|
||||
import ssl
|
||||
from types import MappingProxyType
|
||||
from typing import Any, Literal
|
||||
|
||||
from aiohttp import CookieJar
|
||||
|
@ -27,7 +27,7 @@ from ..errors import AuthenticationRequired, CannotConnect
|
|||
|
||||
async def get_unifi_api(
|
||||
hass: HomeAssistant,
|
||||
config: MappingProxyType[str, Any],
|
||||
config: Mapping[str, Any],
|
||||
) -> aiounifi.Controller:
|
||||
"""Create a aiounifi object and verify authentication."""
|
||||
ssl_context: ssl.SSLContext | Literal[False] = False
|
||||
|
|
Loading…
Reference in New Issue