diff --git a/homeassistant/components/alexa/state_report.py b/homeassistant/components/alexa/state_report.py index 20e3ef1d7c7..e3181ee1405 100644 --- a/homeassistant/components/alexa/state_report.py +++ b/homeassistant/components/alexa/state_report.py @@ -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.""" diff --git a/homeassistant/components/anthropic/config_flow.py b/homeassistant/components/anthropic/config_flow.py index 1b6289efe7c..ebad206af61 100644 --- a/homeassistant/components/anthropic/config_flow.py +++ b/homeassistant/components/anthropic/config_flow.py @@ -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] = [ diff --git a/homeassistant/components/asuswrt/router.py b/homeassistant/components/asuswrt/router.py index 330c4bcfb67..a34f191b7a7 100644 --- a/homeassistant/components/asuswrt/router.py +++ b/homeassistant/components/asuswrt/router.py @@ -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(): diff --git a/homeassistant/components/axis/hub/api.py b/homeassistant/components/axis/hub/api.py index 8e5d7533631..f33e925929c 100644 --- a/homeassistant/components/axis/hub/api.py +++ b/homeassistant/components/axis/hub/api.py @@ -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) diff --git a/homeassistant/components/azure_event_hub/__init__.py b/homeassistant/components/azure_event_hub/__init__.py index abe6cdfe15f..6a035e664d4 100644 --- a/homeassistant/components/azure_event_hub/__init__.py +++ b/homeassistant/components/azure_event_hub/__init__.py @@ -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] diff --git a/homeassistant/components/devolo_home_control/__init__.py b/homeassistant/components/devolo_home_control/__init__.py index e86b7b753c8..b8dc948913f 100644 --- a/homeassistant/components/devolo_home_control/__init__.py +++ b/homeassistant/components/devolo_home_control/__init__.py @@ -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] diff --git a/homeassistant/components/dynalite/bridge.py b/homeassistant/components/dynalite/bridge.py index 0e491281619..162d1167e81 100644 --- a/homeassistant/components/dynalite/bridge.py +++ b/homeassistant/components/dynalite/bridge.py @@ -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)) diff --git a/homeassistant/components/dynalite/convert_config.py b/homeassistant/components/dynalite/convert_config.py index 00edc26f1ab..e37ce93ece4 100644 --- a/homeassistant/components/dynalite/convert_config.py +++ b/homeassistant/components/dynalite/convert_config.py @@ -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, diff --git a/homeassistant/components/elevenlabs/tts.py b/homeassistant/components/elevenlabs/tts.py index efcadb3f440..61850837075 100644 --- a/homeassistant/components/elevenlabs/tts.py +++ b/homeassistant/components/elevenlabs/tts.py @@ -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), diff --git a/homeassistant/components/elkm1/__init__.py b/homeassistant/components/elkm1/__init__.py index 4bf51b99de1..0fe2df09bc5 100644 --- a/homeassistant/components/elkm1/__init__.py +++ b/homeassistant/components/elkm1/__init__.py @@ -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]) diff --git a/homeassistant/components/fritz/coordinator.py b/homeassistant/components/fritz/coordinator.py index c0121ed9aa1..9199692f564 100644 --- a/homeassistant/components/fritz/coordinator.py +++ b/homeassistant/components/fritz/coordinator.py @@ -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) diff --git a/homeassistant/components/google_generative_ai_conversation/config_flow.py b/homeassistant/components/google_generative_ai_conversation/config_flow.py index ec476d940d1..551f9b0c9de 100644 --- a/homeassistant/components/google_generative_ai_conversation/config_flow.py +++ b/homeassistant/components/google_generative_ai_conversation/config_flow.py @@ -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.""" diff --git a/homeassistant/components/hyperion/light.py b/homeassistant/components/hyperion/light.py index f8932a682ab..d0c129a5f4a 100644 --- a/homeassistant/components/hyperion/light.py +++ b/homeassistant/components/hyperion/light.py @@ -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.""" diff --git a/homeassistant/components/met/coordinator.py b/homeassistant/components/met/coordinator.py index de27da7a07f..8b6243d9daf 100644 --- a/homeassistant/components/met/coordinator.py +++ b/homeassistant/components/met/coordinator.py @@ -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 diff --git a/homeassistant/components/met/weather.py b/homeassistant/components/met/weather.py index c4f9c8e6885..8d8317607be 100644 --- a/homeassistant/components/met/weather.py +++ b/homeassistant/components/met/weather.py @@ -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: diff --git a/homeassistant/components/met_eireann/__init__.py b/homeassistant/components/met_eireann/__init__.py index 01917707bf7..62d7d21134c 100644 --- a/homeassistant/components/met_eireann/__init__.py +++ b/homeassistant/components/met_eireann/__init__.py @@ -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 diff --git a/homeassistant/components/met_eireann/weather.py b/homeassistant/components/met_eireann/weather.py index 72706ccb70f..97bbd952740 100644 --- a/homeassistant/components/met_eireann/weather.py +++ b/homeassistant/components/met_eireann/weather.py @@ -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) diff --git a/homeassistant/components/mjpeg/config_flow.py b/homeassistant/components/mjpeg/config_flow.py index e0150f8c461..a0efb56c224 100644 --- a/homeassistant/components/mjpeg/config_flow.py +++ b/homeassistant/components/mjpeg/config_flow.py @@ -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 = { diff --git a/homeassistant/components/motioneye/camera.py b/homeassistant/components/motioneye/camera.py index 159956277a8..adf380bf9eb 100644 --- a/homeassistant/components/motioneye/camera.py +++ b/homeassistant/components/motioneye/camera.py @@ -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 diff --git a/homeassistant/components/motioneye/entity.py b/homeassistant/components/motioneye/entity.py index 49739f2fca3..e279533f080 100644 --- a/homeassistant/components/motioneye/entity.py +++ b/homeassistant/components/motioneye/entity.py @@ -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.""" diff --git a/homeassistant/components/motioneye/sensor.py b/homeassistant/components/motioneye/sensor.py index c160b77c16a..c8d05c6bb4d 100644 --- a/homeassistant/components/motioneye/sensor.py +++ b/homeassistant/components/motioneye/sensor.py @@ -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__( diff --git a/homeassistant/components/motioneye/switch.py b/homeassistant/components/motioneye/switch.py index 89d3b8a8727..afa0b9481d1 100644 --- a/homeassistant/components/motioneye/switch.py +++ b/homeassistant/components/motioneye/switch.py @@ -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.""" diff --git a/homeassistant/components/nut/config_flow.py b/homeassistant/components/nut/config_flow.py index aad596f6dfb..69281e852a8 100644 --- a/homeassistant/components/nut/config_flow.py +++ b/homeassistant/components/nut/config_flow.py @@ -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.""" diff --git a/homeassistant/components/nws/sensor.py b/homeassistant/components/nws/sensor.py index 8a7631d8381..348d9ade7a3 100644 --- a/homeassistant/components/nws/sensor.py +++ b/homeassistant/components/nws/sensor.py @@ -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, diff --git a/homeassistant/components/nws/weather.py b/homeassistant/components/nws/weather.py index c90c67edcb7..c44869939ff 100644 --- a/homeassistant/components/nws/weather.py +++ b/homeassistant/components/nws/weather.py @@ -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.""" diff --git a/homeassistant/components/ollama/config_flow.py b/homeassistant/components/ollama/config_flow.py index 7379ea17ba6..7cbc90e3479 100644 --- a/homeassistant/components/ollama/config_flow.py +++ b/homeassistant/components/ollama/config_flow.py @@ -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] = [ diff --git a/homeassistant/components/onewire/sensor.py b/homeassistant/components/onewire/sensor.py index 5e1c7d35bd6..7039dc09858 100644 --- a/homeassistant/components/onewire/sensor.py +++ b/homeassistant/components/onewire/sensor.py @@ -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] = [] diff --git a/homeassistant/components/openai_conversation/config_flow.py b/homeassistant/components/openai_conversation/config_flow.py index 5c8ab674bef..fbe64492b3c 100644 --- a/homeassistant/components/openai_conversation/config_flow.py +++ b/homeassistant/components/openai_conversation/config_flow.py @@ -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] = [ diff --git a/homeassistant/components/opentherm_gw/climate.py b/homeassistant/components/opentherm_gw/climate.py index c69151c293a..68463e764f2 100644 --- a/homeassistant/components/opentherm_gw/climate.py +++ b/homeassistant/components/opentherm_gw/climate.py @@ -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) diff --git a/homeassistant/components/sentry/__init__.py b/homeassistant/components/sentry/__init__.py index 904d493a863..5b89518c616 100644 --- a/homeassistant/components/sentry/__init__.py +++ b/homeassistant/components/sentry/__init__.py @@ -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], diff --git a/homeassistant/components/shelly/utils.py b/homeassistant/components/shelly/utils.py index 9284afdd567..0c8048d34e4 100644 --- a/homeassistant/components/shelly/utils.py +++ b/homeassistant/components/shelly/utils.py @@ -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)) diff --git a/homeassistant/components/swiss_public_transport/helper.py b/homeassistant/components/swiss_public_transport/helper.py index e41901337f4..72dc1afab8a 100644 --- a/homeassistant/components/swiss_public_transport/helper.py +++ b/homeassistant/components/swiss_public_transport/helper.py @@ -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]}" diff --git a/homeassistant/components/tplink_omada/config_flow.py b/homeassistant/components/tplink_omada/config_flow.py index eeeddb62495..791d0ee8451 100644 --- a/homeassistant/components/tplink_omada/config_flow.py +++ b/homeassistant/components/tplink_omada/config_flow.py @@ -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.""" diff --git a/homeassistant/components/unifi/hub/api.py b/homeassistant/components/unifi/hub/api.py index acdd941dd15..8cfe06c1b55 100644 --- a/homeassistant/components/unifi/hub/api.py +++ b/homeassistant/components/unifi/hub/api.py @@ -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