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