Adjust to recommended propcache.api import paths (#136150)

pull/136113/head^2
Ville Skyttä 2025-01-21 08:58:22 -01:00 committed by GitHub
parent 57b17472d7
commit 40eb8b91cc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
83 changed files with 93 additions and 87 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 (

View File

@ -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 (

View File

@ -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

View File

@ -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

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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,

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 (

View File

@ -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

View File

@ -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 (

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 (

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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,

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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")

View File

@ -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__)

View File

@ -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 (

View File

@ -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(

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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,

View File

@ -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 (

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 = (

View File

@ -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"]

View File

@ -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