From 40eb8b91cc2c947226983811cc8b24059062f1c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Tue, 21 Jan 2025 08:58:22 -0100 Subject: [PATCH] Adjust to recommended propcache.api import paths (#136150) --- homeassistant/auth/models.py | 2 +- homeassistant/components/airgradient/update.py | 2 +- .../components/alarm_control_panel/__init__.py | 2 +- homeassistant/components/automation/__init__.py | 2 +- homeassistant/components/backup/agent.py | 2 +- homeassistant/components/binary_sensor/__init__.py | 2 +- homeassistant/components/button/__init__.py | 2 +- homeassistant/components/camera/__init__.py | 2 +- homeassistant/components/climate/__init__.py | 2 +- homeassistant/components/cover/__init__.py | 2 +- homeassistant/components/date/__init__.py | 2 +- homeassistant/components/datetime/__init__.py | 2 +- .../components/device_tracker/config_entry.py | 2 +- homeassistant/components/device_tracker/legacy.py | 2 +- homeassistant/components/dlna_dms/dms.py | 2 +- homeassistant/components/doorbird/device.py | 2 +- homeassistant/components/event/__init__.py | 2 +- homeassistant/components/fan/__init__.py | 2 +- homeassistant/components/ffmpeg/__init__.py | 2 +- homeassistant/components/fints/sensor.py | 2 +- homeassistant/components/frontend/__init__.py | 2 +- homeassistant/components/geo_location/__init__.py | 2 +- homeassistant/components/homekit_controller/climate.py | 2 +- homeassistant/components/homekit_controller/cover.py | 2 +- homeassistant/components/homekit_controller/fan.py | 2 +- .../components/homekit_controller/humidifier.py | 2 +- homeassistant/components/homekit_controller/light.py | 2 +- homeassistant/components/humidifier/__init__.py | 2 +- homeassistant/components/image/__init__.py | 2 +- homeassistant/components/intent/timers.py | 2 +- homeassistant/components/knx/light.py | 2 +- homeassistant/components/lawn_mower/__init__.py | 2 +- homeassistant/components/lifx/coordinator.py | 2 +- homeassistant/components/light/__init__.py | 2 +- homeassistant/components/lock/__init__.py | 2 +- homeassistant/components/logbook/models.py | 2 +- homeassistant/components/matter/entity.py | 2 +- homeassistant/components/media_player/__init__.py | 2 +- homeassistant/components/nibe_heatpump/coordinator.py | 2 +- homeassistant/components/notify/__init__.py | 2 +- homeassistant/components/number/__init__.py | 2 +- .../climate/atlantic_pass_apc_zone_control_zone.py | 2 +- homeassistant/components/recorder/core.py | 2 +- homeassistant/components/recorder/models/state.py | 2 +- homeassistant/components/remote/__init__.py | 2 +- homeassistant/components/roborock/coordinator.py | 2 +- homeassistant/components/script/__init__.py | 2 +- homeassistant/components/select/__init__.py | 2 +- homeassistant/components/sensor/__init__.py | 2 +- homeassistant/components/shelly/coordinator.py | 2 +- homeassistant/components/siren/__init__.py | 2 +- homeassistant/components/switch/__init__.py | 2 +- homeassistant/components/template/template_entity.py | 2 +- homeassistant/components/teslemetry/entity.py | 2 +- homeassistant/components/teslemetry/sensor.py | 2 +- homeassistant/components/text/__init__.py | 2 +- homeassistant/components/thread/dataset_store.py | 2 +- homeassistant/components/time/__init__.py | 2 +- homeassistant/components/todo/__init__.py | 2 +- homeassistant/components/tts/__init__.py | 2 +- homeassistant/components/unifi/device_tracker.py | 2 +- homeassistant/components/update/__init__.py | 2 +- homeassistant/components/vacuum/__init__.py | 2 +- homeassistant/components/water_heater/__init__.py | 2 +- homeassistant/components/weather/__init__.py | 2 +- homeassistant/components/zha/entity.py | 2 +- homeassistant/config_entries.py | 2 +- homeassistant/core.py | 2 +- homeassistant/helpers/area_registry.py | 4 ++-- homeassistant/helpers/device_registry.py | 4 ++-- homeassistant/helpers/entity.py | 2 +- homeassistant/helpers/entity_registry.py | 4 ++-- homeassistant/helpers/frame.py | 2 +- homeassistant/helpers/intent.py | 2 +- homeassistant/helpers/script.py | 2 +- homeassistant/helpers/storage.py | 2 +- homeassistant/helpers/template.py | 2 +- homeassistant/helpers/update_coordinator.py | 2 +- homeassistant/loader.py | 2 +- homeassistant/util/yaml/loader.py | 2 +- pylint/plugins/hass_imports.py | 10 ++++++++-- pyproject.toml | 2 +- tests/helpers/test_entity.py | 2 +- 83 files changed, 93 insertions(+), 87 deletions(-) diff --git a/homeassistant/auth/models.py b/homeassistant/auth/models.py index 6f45dab2b36..7dcccbb1a1e 100644 --- a/homeassistant/auth/models.py +++ b/homeassistant/auth/models.py @@ -11,7 +11,7 @@ import uuid import attr from attr import Attribute from attr.setters import validate -from propcache import cached_property +from propcache.api import cached_property from homeassistant.const import __version__ from homeassistant.data_entry_flow import FlowContext, FlowResult diff --git a/homeassistant/components/airgradient/update.py b/homeassistant/components/airgradient/update.py index 47e71cb4e65..7c040524243 100644 --- a/homeassistant/components/airgradient/update.py +++ b/homeassistant/components/airgradient/update.py @@ -2,7 +2,7 @@ from datetime import timedelta -from propcache import cached_property +from propcache.api import cached_property from homeassistant.components.update import UpdateDeviceClass, UpdateEntity from homeassistant.core import HomeAssistant diff --git a/homeassistant/components/alarm_control_panel/__init__.py b/homeassistant/components/alarm_control_panel/__init__.py index 4c5e201df8f..80a676a40fa 100644 --- a/homeassistant/components/alarm_control_panel/__init__.py +++ b/homeassistant/components/alarm_control_panel/__init__.py @@ -7,7 +7,7 @@ from datetime import timedelta import logging from typing import TYPE_CHECKING, Any, Final, final -from propcache import cached_property +from propcache.api import cached_property import voluptuous as vol from homeassistant.config_entries import ConfigEntry diff --git a/homeassistant/components/automation/__init__.py b/homeassistant/components/automation/__init__.py index 955a6215096..4e6b098ef1e 100644 --- a/homeassistant/components/automation/__init__.py +++ b/homeassistant/components/automation/__init__.py @@ -9,7 +9,7 @@ from dataclasses import dataclass import logging from typing import Any, Protocol, cast -from propcache import cached_property +from propcache.api import cached_property import voluptuous as vol from homeassistant.components import websocket_api diff --git a/homeassistant/components/backup/agent.py b/homeassistant/components/backup/agent.py index 44bc9b298e8..cb03327e941 100644 --- a/homeassistant/components/backup/agent.py +++ b/homeassistant/components/backup/agent.py @@ -7,7 +7,7 @@ from collections.abc import AsyncIterator, Callable, Coroutine from pathlib import Path from typing import Any, Protocol -from propcache import cached_property +from propcache.api import cached_property from homeassistant.core import HomeAssistant, callback from homeassistant.exceptions import HomeAssistantError diff --git a/homeassistant/components/binary_sensor/__init__.py b/homeassistant/components/binary_sensor/__init__.py index f31c3d102b0..7b0c121ac6b 100644 --- a/homeassistant/components/binary_sensor/__init__.py +++ b/homeassistant/components/binary_sensor/__init__.py @@ -7,7 +7,7 @@ from enum import StrEnum import logging from typing import Literal, final -from propcache import cached_property +from propcache.api import cached_property import voluptuous as vol from homeassistant.config_entries import ConfigEntry diff --git a/homeassistant/components/button/__init__.py b/homeassistant/components/button/__init__.py index 14dc09ca33e..c6b90945329 100644 --- a/homeassistant/components/button/__init__.py +++ b/homeassistant/components/button/__init__.py @@ -7,7 +7,7 @@ from enum import StrEnum import logging from typing import final -from propcache import cached_property +from propcache.api import cached_property import voluptuous as vol from homeassistant.config_entries import ConfigEntry diff --git a/homeassistant/components/camera/__init__.py b/homeassistant/components/camera/__init__.py index 16b9fb06dbb..556f8d75fc4 100644 --- a/homeassistant/components/camera/__init__.py +++ b/homeassistant/components/camera/__init__.py @@ -18,7 +18,7 @@ from typing import Any, Final, final from aiohttp import hdrs, web import attr -from propcache import cached_property, under_cached_property +from propcache.api import cached_property, under_cached_property import voluptuous as vol from webrtc_models import RTCIceCandidateInit, RTCIceServer diff --git a/homeassistant/components/climate/__init__.py b/homeassistant/components/climate/__init__.py index ca85979f19a..af64b06ebe6 100644 --- a/homeassistant/components/climate/__init__.py +++ b/homeassistant/components/climate/__init__.py @@ -7,7 +7,7 @@ import functools as ft import logging from typing import Any, Literal, final -from propcache import cached_property +from propcache.api import cached_property import voluptuous as vol from homeassistant.config_entries import ConfigEntry diff --git a/homeassistant/components/cover/__init__.py b/homeassistant/components/cover/__init__.py index c4795e0e7d9..85069b425e3 100644 --- a/homeassistant/components/cover/__init__.py +++ b/homeassistant/components/cover/__init__.py @@ -9,7 +9,7 @@ import functools as ft import logging from typing import Any, final -from propcache import cached_property +from propcache.api import cached_property import voluptuous as vol from homeassistant.config_entries import ConfigEntry diff --git a/homeassistant/components/date/__init__.py b/homeassistant/components/date/__init__.py index 622ec574542..43ce6a9b4c1 100644 --- a/homeassistant/components/date/__init__.py +++ b/homeassistant/components/date/__init__.py @@ -6,7 +6,7 @@ from datetime import date, timedelta import logging from typing import final -from propcache import cached_property +from propcache.api import cached_property import voluptuous as vol from homeassistant.config_entries import ConfigEntry diff --git a/homeassistant/components/datetime/__init__.py b/homeassistant/components/datetime/__init__.py index 8aef34ddcbd..53f85992abc 100644 --- a/homeassistant/components/datetime/__init__.py +++ b/homeassistant/components/datetime/__init__.py @@ -6,7 +6,7 @@ from datetime import UTC, datetime, timedelta import logging from typing import final -from propcache import cached_property +from propcache.api import cached_property import voluptuous as vol from homeassistant.config_entries import ConfigEntry diff --git a/homeassistant/components/device_tracker/config_entry.py b/homeassistant/components/device_tracker/config_entry.py index 50fc3d2d936..db33d5038fc 100644 --- a/homeassistant/components/device_tracker/config_entry.py +++ b/homeassistant/components/device_tracker/config_entry.py @@ -5,7 +5,7 @@ from __future__ import annotations import asyncio from typing import final -from propcache import cached_property +from propcache.api import cached_property from homeassistant.components import zone from homeassistant.config_entries import ConfigEntry diff --git a/homeassistant/components/device_tracker/legacy.py b/homeassistant/components/device_tracker/legacy.py index b1520866bb5..f2f782d3d97 100644 --- a/homeassistant/components/device_tracker/legacy.py +++ b/homeassistant/components/device_tracker/legacy.py @@ -10,7 +10,7 @@ from types import ModuleType from typing import Any, Final, Protocol, final import attr -from propcache import cached_property +from propcache.api import cached_property import voluptuous as vol from homeassistant import util diff --git a/homeassistant/components/dlna_dms/dms.py b/homeassistant/components/dlna_dms/dms.py index 1d0b27696f7..89c53bc2564 100644 --- a/homeassistant/components/dlna_dms/dms.py +++ b/homeassistant/components/dlna_dms/dms.py @@ -16,7 +16,7 @@ from async_upnp_client.const import NotificationSubType from async_upnp_client.exceptions import UpnpActionError, UpnpConnectionError, UpnpError from async_upnp_client.profiles.dlna import ContentDirectoryErrorCode, DmsDevice from didl_lite import didl_lite -from propcache import cached_property +from propcache.api import cached_property from homeassistant.components import ssdp from homeassistant.components.media_player import BrowseError, MediaClass diff --git a/homeassistant/components/doorbird/device.py b/homeassistant/components/doorbird/device.py index eae5bb6804f..f57e7595dbc 100644 --- a/homeassistant/components/doorbird/device.py +++ b/homeassistant/components/doorbird/device.py @@ -15,7 +15,7 @@ from doorbirdpy import ( DoorBirdScheduleEntryOutput, DoorBirdScheduleEntrySchedule, ) -from propcache import cached_property +from propcache.api import cached_property from homeassistant.const import ATTR_ENTITY_ID from homeassistant.core import HomeAssistant diff --git a/homeassistant/components/event/__init__.py b/homeassistant/components/event/__init__.py index 5bdf107f0c3..4ed5a0f1378 100644 --- a/homeassistant/components/event/__init__.py +++ b/homeassistant/components/event/__init__.py @@ -8,7 +8,7 @@ from enum import StrEnum import logging from typing import Any, Self, final -from propcache import cached_property +from propcache.api import cached_property from homeassistant.config_entries import ConfigEntry from homeassistant.core import HomeAssistant diff --git a/homeassistant/components/fan/__init__.py b/homeassistant/components/fan/__init__.py index 863ae705603..b9e20e8dc91 100644 --- a/homeassistant/components/fan/__init__.py +++ b/homeassistant/components/fan/__init__.py @@ -9,7 +9,7 @@ import logging import math from typing import Any, final -from propcache import cached_property +from propcache.api import cached_property import voluptuous as vol from homeassistant.config_entries import ConfigEntry diff --git a/homeassistant/components/ffmpeg/__init__.py b/homeassistant/components/ffmpeg/__init__.py index 99803e9636c..6957702523f 100644 --- a/homeassistant/components/ffmpeg/__init__.py +++ b/homeassistant/components/ffmpeg/__init__.py @@ -7,7 +7,7 @@ import re from haffmpeg.core import HAFFmpeg from haffmpeg.tools import IMAGE_JPEG, FFVersion, ImageFrame -from propcache import cached_property +from propcache.api import cached_property import voluptuous as vol from homeassistant.const import ( diff --git a/homeassistant/components/fints/sensor.py b/homeassistant/components/fints/sensor.py index a1cd565153f..c85f08ba3d0 100644 --- a/homeassistant/components/fints/sensor.py +++ b/homeassistant/components/fints/sensor.py @@ -9,7 +9,7 @@ from typing import Any from fints.client import FinTS3PinTanClient from fints.models import SEPAAccount -from propcache import cached_property +from propcache.api import cached_property import voluptuous as vol from homeassistant.components.sensor import ( diff --git a/homeassistant/components/frontend/__init__.py b/homeassistant/components/frontend/__init__.py index c1098ac19d3..050d57fc358 100644 --- a/homeassistant/components/frontend/__init__.py +++ b/homeassistant/components/frontend/__init__.py @@ -11,7 +11,7 @@ from typing import Any, TypedDict from aiohttp import hdrs, web, web_urldispatcher import jinja2 -from propcache import cached_property +from propcache.api import cached_property import voluptuous as vol from yarl import URL diff --git a/homeassistant/components/geo_location/__init__.py b/homeassistant/components/geo_location/__init__.py index 877471f002a..06b0320c805 100644 --- a/homeassistant/components/geo_location/__init__.py +++ b/homeassistant/components/geo_location/__init__.py @@ -6,7 +6,7 @@ from datetime import timedelta import logging from typing import Any, final -from propcache import cached_property +from propcache.api import cached_property from homeassistant.config_entries import ConfigEntry from homeassistant.const import ATTR_LATITUDE, ATTR_LONGITUDE diff --git a/homeassistant/components/homekit_controller/climate.py b/homeassistant/components/homekit_controller/climate.py index ba5237e6e2d..cbf4ad61c2f 100644 --- a/homeassistant/components/homekit_controller/climate.py +++ b/homeassistant/components/homekit_controller/climate.py @@ -17,7 +17,7 @@ from aiohomekit.model.characteristics import ( ) from aiohomekit.model.services import Service, ServicesTypes from aiohomekit.utils import clamp_enum_to_char -from propcache import cached_property +from propcache.api import cached_property from homeassistant.components.climate import ( ATTR_HVAC_MODE, diff --git a/homeassistant/components/homekit_controller/cover.py b/homeassistant/components/homekit_controller/cover.py index d7480a40a93..4fff32002e2 100644 --- a/homeassistant/components/homekit_controller/cover.py +++ b/homeassistant/components/homekit_controller/cover.py @@ -6,7 +6,7 @@ from typing import Any from aiohomekit.model.characteristics import CharacteristicsTypes from aiohomekit.model.services import Service, ServicesTypes -from propcache import cached_property +from propcache.api import cached_property from homeassistant.components.cover import ( ATTR_POSITION, diff --git a/homeassistant/components/homekit_controller/fan.py b/homeassistant/components/homekit_controller/fan.py index 2ae534099ae..b7f1842392b 100644 --- a/homeassistant/components/homekit_controller/fan.py +++ b/homeassistant/components/homekit_controller/fan.py @@ -6,7 +6,7 @@ from typing import Any from aiohomekit.model.characteristics import CharacteristicsTypes from aiohomekit.model.services import Service, ServicesTypes -from propcache import cached_property +from propcache.api import cached_property from homeassistant.components.fan import ( DIRECTION_FORWARD, diff --git a/homeassistant/components/homekit_controller/humidifier.py b/homeassistant/components/homekit_controller/humidifier.py index f82baab5df7..b2b0e0b1026 100644 --- a/homeassistant/components/homekit_controller/humidifier.py +++ b/homeassistant/components/homekit_controller/humidifier.py @@ -6,7 +6,7 @@ from typing import Any from aiohomekit.model.characteristics import CharacteristicsTypes from aiohomekit.model.services import Service, ServicesTypes -from propcache import cached_property +from propcache.api import cached_property from homeassistant.components.humidifier import ( DEFAULT_MAX_HUMIDITY, diff --git a/homeassistant/components/homekit_controller/light.py b/homeassistant/components/homekit_controller/light.py index 26f10768aa0..b306c440d7b 100644 --- a/homeassistant/components/homekit_controller/light.py +++ b/homeassistant/components/homekit_controller/light.py @@ -6,7 +6,7 @@ from typing import Any from aiohomekit.model.characteristics import CharacteristicsTypes from aiohomekit.model.services import Service, ServicesTypes -from propcache import cached_property +from propcache.api import cached_property from homeassistant.components.light import ( ATTR_BRIGHTNESS, diff --git a/homeassistant/components/humidifier/__init__.py b/homeassistant/components/humidifier/__init__.py index 8c892dca327..de9384edda6 100644 --- a/homeassistant/components/humidifier/__init__.py +++ b/homeassistant/components/humidifier/__init__.py @@ -7,7 +7,7 @@ from enum import StrEnum import logging from typing import Any, final -from propcache import cached_property +from propcache.api import cached_property import voluptuous as vol from homeassistant.config_entries import ConfigEntry diff --git a/homeassistant/components/image/__init__.py b/homeassistant/components/image/__init__.py index dbb5962eabf..1cf2de278d1 100644 --- a/homeassistant/components/image/__init__.py +++ b/homeassistant/components/image/__init__.py @@ -14,7 +14,7 @@ from typing import Final, final from aiohttp import hdrs, web import httpx -from propcache import cached_property +from propcache.api import cached_property import voluptuous as vol from homeassistant.components.http import KEY_AUTHENTICATED, KEY_HASS, HomeAssistantView diff --git a/homeassistant/components/intent/timers.py b/homeassistant/components/intent/timers.py index 84b96492241..ece416d7ef1 100644 --- a/homeassistant/components/intent/timers.py +++ b/homeassistant/components/intent/timers.py @@ -10,7 +10,7 @@ import logging import time from typing import Any -from propcache import cached_property +from propcache.api import cached_property import voluptuous as vol from homeassistant.const import ATTR_DEVICE_ID, ATTR_ID, ATTR_NAME diff --git a/homeassistant/components/knx/light.py b/homeassistant/components/knx/light.py index 8e64b46c890..6115f8be128 100644 --- a/homeassistant/components/knx/light.py +++ b/homeassistant/components/knx/light.py @@ -4,7 +4,7 @@ from __future__ import annotations from typing import Any, cast -from propcache import cached_property +from propcache.api import cached_property from xknx import XKNX from xknx.devices.light import ColorTemperatureType, Light as XknxLight, XYYColor diff --git a/homeassistant/components/lawn_mower/__init__.py b/homeassistant/components/lawn_mower/__init__.py index a8c52b72a81..0680bfc9d71 100644 --- a/homeassistant/components/lawn_mower/__init__.py +++ b/homeassistant/components/lawn_mower/__init__.py @@ -6,7 +6,7 @@ from datetime import timedelta import logging from typing import final -from propcache import cached_property +from propcache.api import cached_property from homeassistant.config_entries import ConfigEntry from homeassistant.core import HomeAssistant diff --git a/homeassistant/components/lifx/coordinator.py b/homeassistant/components/lifx/coordinator.py index 5558828a143..eaaff7e6540 100644 --- a/homeassistant/components/lifx/coordinator.py +++ b/homeassistant/components/lifx/coordinator.py @@ -21,7 +21,7 @@ from aiolifx.aiolifx import ( from aiolifx.connection import LIFXConnection from aiolifx_themes.themes import ThemeLibrary, ThemePainter from awesomeversion import AwesomeVersion -from propcache import cached_property +from propcache.api import cached_property from homeassistant.const import ( SIGNAL_STRENGTH_DECIBELS, diff --git a/homeassistant/components/light/__init__.py b/homeassistant/components/light/__init__.py index 412ee1e6c16..65a89b7d688 100644 --- a/homeassistant/components/light/__init__.py +++ b/homeassistant/components/light/__init__.py @@ -10,7 +10,7 @@ import logging import os from typing import Any, Final, Self, cast, final -from propcache import cached_property +from propcache.api import cached_property import voluptuous as vol from homeassistant.config_entries import ConfigEntry diff --git a/homeassistant/components/lock/__init__.py b/homeassistant/components/lock/__init__.py index 39d5d3c350d..60eb29240cd 100644 --- a/homeassistant/components/lock/__init__.py +++ b/homeassistant/components/lock/__init__.py @@ -9,7 +9,7 @@ import logging import re from typing import TYPE_CHECKING, Any, final -from propcache import cached_property +from propcache.api import cached_property import voluptuous as vol from homeassistant.config_entries import ConfigEntry diff --git a/homeassistant/components/logbook/models.py b/homeassistant/components/logbook/models.py index c33325d7dcb..40b904c1279 100644 --- a/homeassistant/components/logbook/models.py +++ b/homeassistant/components/logbook/models.py @@ -6,7 +6,7 @@ from collections.abc import Callable, Mapping from dataclasses import dataclass from typing import TYPE_CHECKING, Any, Final, NamedTuple, cast -from propcache import cached_property +from propcache.api import cached_property from sqlalchemy.engine.row import Row from homeassistant.components.recorder.filters import Filters diff --git a/homeassistant/components/matter/entity.py b/homeassistant/components/matter/entity.py index 50a0f2b1fee..61c62d8b564 100644 --- a/homeassistant/components/matter/entity.py +++ b/homeassistant/components/matter/entity.py @@ -11,7 +11,7 @@ from chip.clusters import Objects as clusters from chip.clusters.Objects import ClusterAttributeDescriptor, NullValue from matter_server.common.helpers.util import create_attribute_path from matter_server.common.models import EventType, ServerInfoMessage -from propcache import cached_property +from propcache.api import cached_property from homeassistant.core import callback from homeassistant.helpers.device_registry import DeviceInfo diff --git a/homeassistant/components/media_player/__init__.py b/homeassistant/components/media_player/__init__.py index b82cab401c5..e109b0418c9 100644 --- a/homeassistant/components/media_player/__init__.py +++ b/homeassistant/components/media_player/__init__.py @@ -21,7 +21,7 @@ import aiohttp from aiohttp import web from aiohttp.hdrs import CACHE_CONTROL, CONTENT_TYPE from aiohttp.typedefs import LooseHeaders -from propcache import cached_property +from propcache.api import cached_property import voluptuous as vol from yarl import URL diff --git a/homeassistant/components/nibe_heatpump/coordinator.py b/homeassistant/components/nibe_heatpump/coordinator.py index ed6d18f7888..faaac5f165a 100644 --- a/homeassistant/components/nibe_heatpump/coordinator.py +++ b/homeassistant/components/nibe_heatpump/coordinator.py @@ -12,7 +12,7 @@ from nibe.coil import Coil, CoilData from nibe.connection import Connection from nibe.exceptions import CoilNotFoundException, ReadException from nibe.heatpump import HeatPump, Series -from propcache import cached_property +from propcache.api import cached_property from homeassistant.config_entries import ConfigEntry from homeassistant.core import CALLBACK_TYPE, HomeAssistant, callback diff --git a/homeassistant/components/notify/__init__.py b/homeassistant/components/notify/__init__.py index 0b7a25ced3e..7f41817a683 100644 --- a/homeassistant/components/notify/__init__.py +++ b/homeassistant/components/notify/__init__.py @@ -8,7 +8,7 @@ from functools import partial import logging from typing import Any, final, override -from propcache import cached_property +from propcache.api import cached_property import voluptuous as vol import homeassistant.components.persistent_notification as pn diff --git a/homeassistant/components/number/__init__.py b/homeassistant/components/number/__init__.py index 2f5ebcdb44c..3e9d3448af2 100644 --- a/homeassistant/components/number/__init__.py +++ b/homeassistant/components/number/__init__.py @@ -10,7 +10,7 @@ import logging from math import ceil, floor from typing import TYPE_CHECKING, Any, Self, final -from propcache import cached_property +from propcache.api import cached_property import voluptuous as vol from homeassistant.config_entries import ConfigEntry diff --git a/homeassistant/components/overkiz/climate/atlantic_pass_apc_zone_control_zone.py b/homeassistant/components/overkiz/climate/atlantic_pass_apc_zone_control_zone.py index 5ba9dabe038..eff1d5fa130 100644 --- a/homeassistant/components/overkiz/climate/atlantic_pass_apc_zone_control_zone.py +++ b/homeassistant/components/overkiz/climate/atlantic_pass_apc_zone_control_zone.py @@ -5,7 +5,7 @@ from __future__ import annotations from asyncio import sleep from typing import Any, cast -from propcache import cached_property +from propcache.api import cached_property from pyoverkiz.enums import OverkizCommand, OverkizCommandParam, OverkizState from homeassistant.components.climate import ( diff --git a/homeassistant/components/recorder/core.py b/homeassistant/components/recorder/core.py index 5a405061a94..fc8b136f38a 100644 --- a/homeassistant/components/recorder/core.py +++ b/homeassistant/components/recorder/core.py @@ -14,7 +14,7 @@ import threading import time from typing import TYPE_CHECKING, Any, cast -from propcache import cached_property +from propcache.api import cached_property import psutil_home_assistant as ha_psutil from sqlalchemy import create_engine, event as sqlalchemy_event, exc, select, update from sqlalchemy.engine import Engine diff --git a/homeassistant/components/recorder/models/state.py b/homeassistant/components/recorder/models/state.py index d73c204079d..1ceaee633ae 100644 --- a/homeassistant/components/recorder/models/state.py +++ b/homeassistant/components/recorder/models/state.py @@ -6,7 +6,7 @@ from datetime import datetime import logging from typing import TYPE_CHECKING, Any -from propcache import cached_property +from propcache.api import cached_property from sqlalchemy.engine.row import Row from homeassistant.const import ( diff --git a/homeassistant/components/remote/__init__.py b/homeassistant/components/remote/__init__.py index 36e482f0a29..f7d87fbf021 100644 --- a/homeassistant/components/remote/__init__.py +++ b/homeassistant/components/remote/__init__.py @@ -9,7 +9,7 @@ import functools as ft import logging from typing import Any, final -from propcache import cached_property +from propcache.api import cached_property import voluptuous as vol from homeassistant.config_entries import ConfigEntry diff --git a/homeassistant/components/roborock/coordinator.py b/homeassistant/components/roborock/coordinator.py index 443e50642f2..d34ba49da52 100644 --- a/homeassistant/components/roborock/coordinator.py +++ b/homeassistant/components/roborock/coordinator.py @@ -5,7 +5,7 @@ from __future__ import annotations from datetime import timedelta import logging -from propcache import cached_property +from propcache.api import cached_property from roborock import HomeDataRoom from roborock.code_mappings import RoborockCategory from roborock.containers import DeviceData, HomeDataDevice, HomeDataProduct, NetworkInfo diff --git a/homeassistant/components/script/__init__.py b/homeassistant/components/script/__init__.py index c0d79c446bb..14104ad0219 100644 --- a/homeassistant/components/script/__init__.py +++ b/homeassistant/components/script/__init__.py @@ -8,7 +8,7 @@ from dataclasses import dataclass import logging from typing import TYPE_CHECKING, Any, cast -from propcache import cached_property +from propcache.api import cached_property import voluptuous as vol from homeassistant.components import websocket_api diff --git a/homeassistant/components/select/__init__.py b/homeassistant/components/select/__init__.py index 592b746198e..4196106edd2 100644 --- a/homeassistant/components/select/__init__.py +++ b/homeassistant/components/select/__init__.py @@ -6,7 +6,7 @@ from datetime import timedelta import logging from typing import Any, final -from propcache import cached_property +from propcache.api import cached_property import voluptuous as vol from homeassistant.config_entries import ConfigEntry diff --git a/homeassistant/components/sensor/__init__.py b/homeassistant/components/sensor/__init__.py index 37df50b2099..89f39d4fb8c 100644 --- a/homeassistant/components/sensor/__init__.py +++ b/homeassistant/components/sensor/__init__.py @@ -12,7 +12,7 @@ import logging from math import ceil, floor, isfinite, log10 from typing import Any, Final, Self, cast, final, override -from propcache import cached_property +from propcache.api import cached_property from homeassistant.config_entries import ConfigEntry from homeassistant.const import ( # noqa: F401 diff --git a/homeassistant/components/shelly/coordinator.py b/homeassistant/components/shelly/coordinator.py index e6129b5559a..d5071c4e849 100644 --- a/homeassistant/components/shelly/coordinator.py +++ b/homeassistant/components/shelly/coordinator.py @@ -18,7 +18,7 @@ from aioshelly.exceptions import ( RpcCallError, ) from aioshelly.rpc_device import RpcDevice, RpcUpdateType -from propcache import cached_property +from propcache.api import cached_property from homeassistant.components.bluetooth import async_remove_scanner from homeassistant.config_entries import ConfigEntry, ConfigEntryState diff --git a/homeassistant/components/siren/__init__.py b/homeassistant/components/siren/__init__.py index 02b49f5732e..65d7848c618 100644 --- a/homeassistant/components/siren/__init__.py +++ b/homeassistant/components/siren/__init__.py @@ -6,7 +6,7 @@ from datetime import timedelta import logging from typing import Any, TypedDict, cast, final -from propcache import cached_property +from propcache.api import cached_property import voluptuous as vol from homeassistant.config_entries import ConfigEntry diff --git a/homeassistant/components/switch/__init__.py b/homeassistant/components/switch/__init__.py index 61ee2908009..3c173cf5b2a 100644 --- a/homeassistant/components/switch/__init__.py +++ b/homeassistant/components/switch/__init__.py @@ -6,7 +6,7 @@ from datetime import timedelta from enum import StrEnum import logging -from propcache import cached_property +from propcache.api import cached_property import voluptuous as vol from homeassistant.config_entries import ConfigEntry diff --git a/homeassistant/components/template/template_entity.py b/homeassistant/components/template/template_entity.py index f5b84b1ad7a..d025f052732 100644 --- a/homeassistant/components/template/template_entity.py +++ b/homeassistant/components/template/template_entity.py @@ -8,7 +8,7 @@ import itertools import logging from typing import Any, cast -from propcache import under_cached_property +from propcache.api import under_cached_property import voluptuous as vol from homeassistant.components.blueprint import CONF_USE_BLUEPRINT diff --git a/homeassistant/components/teslemetry/entity.py b/homeassistant/components/teslemetry/entity.py index df8406e0ced..82d3db123c3 100644 --- a/homeassistant/components/teslemetry/entity.py +++ b/homeassistant/components/teslemetry/entity.py @@ -3,7 +3,7 @@ from abc import abstractmethod from typing import Any -from propcache import cached_property +from propcache.api import cached_property from tesla_fleet_api import EnergySpecific, VehicleSpecific from tesla_fleet_api.const import Scope from teslemetry_stream import Signal diff --git a/homeassistant/components/teslemetry/sensor.py b/homeassistant/components/teslemetry/sensor.py index 524d8579703..0fb0a6ee0e0 100644 --- a/homeassistant/components/teslemetry/sensor.py +++ b/homeassistant/components/teslemetry/sensor.py @@ -6,7 +6,7 @@ from collections.abc import Callable from dataclasses import dataclass from datetime import timedelta -from propcache import cached_property +from propcache.api import cached_property from teslemetry_stream import Signal from homeassistant.components.sensor import ( diff --git a/homeassistant/components/text/__init__.py b/homeassistant/components/text/__init__.py index d0f5ac7d3b7..27af7e3fe59 100644 --- a/homeassistant/components/text/__init__.py +++ b/homeassistant/components/text/__init__.py @@ -9,7 +9,7 @@ import logging import re from typing import Any, final -from propcache import cached_property +from propcache.api import cached_property import voluptuous as vol from homeassistant.config_entries import ConfigEntry diff --git a/homeassistant/components/thread/dataset_store.py b/homeassistant/components/thread/dataset_store.py index fc95e524181..1b4ae7ba01f 100644 --- a/homeassistant/components/thread/dataset_store.py +++ b/homeassistant/components/thread/dataset_store.py @@ -8,7 +8,7 @@ from datetime import datetime import logging from typing import Any, cast -from propcache import cached_property +from propcache.api import cached_property from python_otbr_api import tlv_parser from python_otbr_api.tlv_parser import MeshcopTLVType diff --git a/homeassistant/components/time/__init__.py b/homeassistant/components/time/__init__.py index 473472356d4..60e55c214fe 100644 --- a/homeassistant/components/time/__init__.py +++ b/homeassistant/components/time/__init__.py @@ -6,7 +6,7 @@ from datetime import time, timedelta import logging from typing import final -from propcache import cached_property +from propcache.api import cached_property import voluptuous as vol from homeassistant.config_entries import ConfigEntry diff --git a/homeassistant/components/todo/__init__.py b/homeassistant/components/todo/__init__.py index e4bc549a16b..937187c1c6f 100644 --- a/homeassistant/components/todo/__init__.py +++ b/homeassistant/components/todo/__init__.py @@ -8,7 +8,7 @@ import datetime import logging from typing import Any, final -from propcache import cached_property +from propcache.api import cached_property import voluptuous as vol from homeassistant.components import frontend, websocket_api diff --git a/homeassistant/components/tts/__init__.py b/homeassistant/components/tts/__init__.py index 0213fd17864..bbe4d334def 100644 --- a/homeassistant/components/tts/__init__.py +++ b/homeassistant/components/tts/__init__.py @@ -21,7 +21,7 @@ from typing import Any, Final, TypedDict, final from aiohttp import web import mutagen from mutagen.id3 import ID3, TextFrame as ID3Text -from propcache import cached_property +from propcache.api import cached_property import voluptuous as vol from homeassistant.components import ffmpeg, websocket_api diff --git a/homeassistant/components/unifi/device_tracker.py b/homeassistant/components/unifi/device_tracker.py index 735f76a73bf..2ac47e67913 100644 --- a/homeassistant/components/unifi/device_tracker.py +++ b/homeassistant/components/unifi/device_tracker.py @@ -16,7 +16,7 @@ from aiounifi.models.api import ApiItemT from aiounifi.models.client import Client from aiounifi.models.device import Device from aiounifi.models.event import Event, EventKey -from propcache import cached_property +from propcache.api import cached_property from homeassistant.components.device_tracker import ( DOMAIN as DEVICE_TRACKER_DOMAIN, diff --git a/homeassistant/components/update/__init__.py b/homeassistant/components/update/__init__.py index a2ecd494920..0ff8c448197 100644 --- a/homeassistant/components/update/__init__.py +++ b/homeassistant/components/update/__init__.py @@ -9,7 +9,7 @@ import logging from typing import Any, Final, final from awesomeversion import AwesomeVersion, AwesomeVersionCompareException -from propcache import cached_property +from propcache.api import cached_property import voluptuous as vol from homeassistant.components import websocket_api diff --git a/homeassistant/components/vacuum/__init__.py b/homeassistant/components/vacuum/__init__.py index 0cafda82786..3b1eee8509c 100644 --- a/homeassistant/components/vacuum/__init__.py +++ b/homeassistant/components/vacuum/__init__.py @@ -9,7 +9,7 @@ from functools import partial import logging from typing import TYPE_CHECKING, Any, final -from propcache import cached_property +from propcache.api import cached_property import voluptuous as vol from homeassistant.config_entries import ConfigEntry diff --git a/homeassistant/components/water_heater/__init__.py b/homeassistant/components/water_heater/__init__.py index 60be340a253..3e1387cb714 100644 --- a/homeassistant/components/water_heater/__init__.py +++ b/homeassistant/components/water_heater/__init__.py @@ -8,7 +8,7 @@ import functools as ft import logging from typing import Any, final -from propcache import cached_property +from propcache.api import cached_property import voluptuous as vol from homeassistant.config_entries import ConfigEntry diff --git a/homeassistant/components/weather/__init__.py b/homeassistant/components/weather/__init__.py index 50d90c59d37..e9436922a4b 100644 --- a/homeassistant/components/weather/__init__.py +++ b/homeassistant/components/weather/__init__.py @@ -20,7 +20,7 @@ from typing import ( final, ) -from propcache import cached_property +from propcache.api import cached_property import voluptuous as vol from homeassistant.config_entries import ConfigEntry diff --git a/homeassistant/components/zha/entity.py b/homeassistant/components/zha/entity.py index 77ba048312a..499721722fa 100644 --- a/homeassistant/components/zha/entity.py +++ b/homeassistant/components/zha/entity.py @@ -8,7 +8,7 @@ from functools import partial import logging from typing import Any -from propcache import cached_property +from propcache.api import cached_property from zha.mixins import LogMixin from homeassistant.const import ATTR_MANUFACTURER, ATTR_MODEL, ATTR_NAME, EntityCategory diff --git a/homeassistant/config_entries.py b/homeassistant/config_entries.py index 5a0f99df5ee..620e4bc8197 100644 --- a/homeassistant/config_entries.py +++ b/homeassistant/config_entries.py @@ -25,7 +25,7 @@ from types import MappingProxyType from typing import TYPE_CHECKING, Any, Self, cast from async_interrupt import interrupt -from propcache import cached_property +from propcache.api import cached_property import voluptuous as vol from . import data_entry_flow, loader diff --git a/homeassistant/core.py b/homeassistant/core.py index 74bcd844823..46ae499e2ca 100644 --- a/homeassistant/core.py +++ b/homeassistant/core.py @@ -41,7 +41,7 @@ from typing import ( overload, ) -from propcache import cached_property, under_cached_property +from propcache.api import cached_property, under_cached_property import voluptuous as vol from . import util diff --git a/homeassistant/helpers/area_registry.py b/homeassistant/helpers/area_registry.py index 9c75af7262d..5601ce4032d 100644 --- a/homeassistant/helpers/area_registry.py +++ b/homeassistant/helpers/area_registry.py @@ -28,9 +28,9 @@ from .typing import UNDEFINED, UndefinedType if TYPE_CHECKING: # mypy cannot workout _cache Protocol with dataclasses - from propcache import cached_property as under_cached_property + from propcache.api import cached_property as under_cached_property else: - from propcache import under_cached_property + from propcache.api import under_cached_property DATA_REGISTRY: HassKey[AreaRegistry] = HassKey("area_registry") diff --git a/homeassistant/helpers/device_registry.py b/homeassistant/helpers/device_registry.py index 2890f607d59..685509cb29d 100644 --- a/homeassistant/helpers/device_registry.py +++ b/homeassistant/helpers/device_registry.py @@ -40,13 +40,13 @@ from .typing import UNDEFINED, UndefinedType if TYPE_CHECKING: # mypy cannot workout _cache Protocol with attrs - from propcache import cached_property as under_cached_property + from propcache.api import cached_property as under_cached_property from homeassistant.config_entries import ConfigEntry from . import entity_registry else: - from propcache import under_cached_property + from propcache.api import under_cached_property _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/helpers/entity.py b/homeassistant/helpers/entity.py index 9e8fe40c6b0..2b9f2d7069e 100644 --- a/homeassistant/helpers/entity.py +++ b/homeassistant/helpers/entity.py @@ -18,7 +18,7 @@ import time from types import FunctionType from typing import TYPE_CHECKING, Any, Final, Literal, NotRequired, TypedDict, final -from propcache import cached_property +from propcache.api import cached_property import voluptuous as vol from homeassistant.const import ( diff --git a/homeassistant/helpers/entity_registry.py b/homeassistant/helpers/entity_registry.py index 3e8c57562b2..7300b148c77 100644 --- a/homeassistant/helpers/entity_registry.py +++ b/homeassistant/helpers/entity_registry.py @@ -65,11 +65,11 @@ from .typing import UNDEFINED, UndefinedType if TYPE_CHECKING: # mypy cannot workout _cache Protocol with attrs - from propcache import cached_property as under_cached_property + from propcache.api import cached_property as under_cached_property from homeassistant.config_entries import ConfigEntry else: - from propcache import under_cached_property + from propcache.api import under_cached_property DATA_REGISTRY: HassKey[EntityRegistry] = HassKey("entity_registry") EVENT_ENTITY_REGISTRY_UPDATED: EventType[EventEntityRegistryUpdatedData] = EventType( diff --git a/homeassistant/helpers/frame.py b/homeassistant/helpers/frame.py index 6d03ae4ffd2..f33f8407e47 100644 --- a/homeassistant/helpers/frame.py +++ b/homeassistant/helpers/frame.py @@ -13,7 +13,7 @@ import sys from types import FrameType from typing import Any, cast -from propcache import cached_property +from propcache.api import cached_property from homeassistant.core import HomeAssistant, async_get_hass_or_none from homeassistant.exceptions import HomeAssistantError diff --git a/homeassistant/helpers/intent.py b/homeassistant/helpers/intent.py index 2874269892c..649819a5f06 100644 --- a/homeassistant/helpers/intent.py +++ b/homeassistant/helpers/intent.py @@ -12,7 +12,7 @@ from itertools import groupby import logging from typing import Any -from propcache import cached_property +from propcache.api import cached_property import voluptuous as vol from homeassistant.components.homeassistant.exposed_entities import async_should_expose diff --git a/homeassistant/helpers/script.py b/homeassistant/helpers/script.py index 1fd0e08988c..bd3babc8793 100644 --- a/homeassistant/helpers/script.py +++ b/homeassistant/helpers/script.py @@ -16,7 +16,7 @@ from types import MappingProxyType from typing import Any, Literal, TypedDict, cast, overload import async_interrupt -from propcache import cached_property +from propcache.api import cached_property import voluptuous as vol from homeassistant import exceptions diff --git a/homeassistant/helpers/storage.py b/homeassistant/helpers/storage.py index 080599f54d8..ac1fe3bb29d 100644 --- a/homeassistant/helpers/storage.py +++ b/homeassistant/helpers/storage.py @@ -13,7 +13,7 @@ import os from pathlib import Path from typing import Any -from propcache import cached_property +from propcache.api import cached_property from homeassistant.const import ( EVENT_HOMEASSISTANT_FINAL_WRITE, diff --git a/homeassistant/helpers/template.py b/homeassistant/helpers/template.py index 21d49df2a67..7bddfdc2f68 100644 --- a/homeassistant/helpers/template.py +++ b/homeassistant/helpers/template.py @@ -44,7 +44,7 @@ from jinja2.sandbox import ImmutableSandboxedEnvironment from jinja2.utils import Namespace from lru import LRU import orjson -from propcache import under_cached_property +from propcache.api import under_cached_property import voluptuous as vol from homeassistant.const import ( diff --git a/homeassistant/helpers/update_coordinator.py b/homeassistant/helpers/update_coordinator.py index 82663d25e1a..943eadff19a 100644 --- a/homeassistant/helpers/update_coordinator.py +++ b/homeassistant/helpers/update_coordinator.py @@ -13,7 +13,7 @@ from typing import Any, Generic, Protocol, TypeVar import urllib.error import aiohttp -from propcache import cached_property +from propcache.api import cached_property import requests from homeassistant import config_entries diff --git a/homeassistant/loader.py b/homeassistant/loader.py index 39dbe20c7c6..92b588dbe15 100644 --- a/homeassistant/loader.py +++ b/homeassistant/loader.py @@ -25,7 +25,7 @@ from awesomeversion import ( AwesomeVersionException, AwesomeVersionStrategy, ) -from propcache import cached_property +from propcache.api import cached_property import voluptuous as vol from . import generated diff --git a/homeassistant/util/yaml/loader.py b/homeassistant/util/yaml/loader.py index 39d38a8f47d..3911d62040b 100644 --- a/homeassistant/util/yaml/loader.py +++ b/homeassistant/util/yaml/loader.py @@ -22,7 +22,7 @@ except ImportError: SafeLoader as FastestAvailableSafeLoader, ) -from propcache import cached_property +from propcache.api import cached_property from homeassistant.exceptions import HomeAssistantError diff --git a/pylint/plugins/hass_imports.py b/pylint/plugins/hass_imports.py index 2fe70fad10d..0d6582535f7 100644 --- a/pylint/plugins/hass_imports.py +++ b/pylint/plugins/hass_imports.py @@ -21,7 +21,7 @@ class ObsoleteImportMatch: _OBSOLETE_IMPORT: dict[str, list[ObsoleteImportMatch]] = { "functools": [ ObsoleteImportMatch( - reason="replaced by propcache.cached_property", + reason="replaced by propcache.api.cached_property", constant=re.compile(r"^cached_property$"), ), ], @@ -33,7 +33,7 @@ _OBSOLETE_IMPORT: dict[str, list[ObsoleteImportMatch]] = { ], "homeassistant.backports.functools": [ ObsoleteImportMatch( - reason="replaced by propcache.cached_property", + reason="replaced by propcache.api.cached_property", constant=re.compile(r"^cached_property$"), ), ], @@ -129,6 +129,12 @@ _OBSOLETE_IMPORT: dict[str, list[ObsoleteImportMatch]] = { constant=re.compile(r"^IMPERIAL_SYSTEM$"), ), ], + "propcache": [ + ObsoleteImportMatch( + reason="importing from propcache.api recommended", + constant=re.compile(r"^(under_)?cached_property$"), + ), + ], } _IGNORE_ROOT_IMPORT = ( diff --git a/pyproject.toml b/pyproject.toml index 5cc7727e136..05b00305b1c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -951,4 +951,4 @@ split-on-trailing-comma = false max-complexity = 25 [tool.ruff.lint.pydocstyle] -property-decorators = ["propcache.cached_property"] +property-decorators = ["propcache.api.cached_property"] diff --git a/tests/helpers/test_entity.py b/tests/helpers/test_entity.py index 2bf441f70fd..5e8c9fc88f7 100644 --- a/tests/helpers/test_entity.py +++ b/tests/helpers/test_entity.py @@ -11,7 +11,7 @@ from typing import Any from unittest.mock import MagicMock, PropertyMock, patch from freezegun.api import FrozenDateTimeFactory -from propcache import cached_property +from propcache.api import cached_property import pytest from syrupy.assertion import SnapshotAssertion import voluptuous as vol