From fba7c6cacdc2b88b69cb08933469b291dec36da3 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 23 Apr 2023 22:02:21 -0500 Subject: [PATCH] Remove deprecated async_get_registry (#91928) Deprecated in 2021 via #46265, report was added a year ago in #72088 --- homeassistant/helpers/area_registry.py | 15 --------------- homeassistant/helpers/device_registry.py | 14 -------------- homeassistant/helpers/entity_registry.py | 15 --------------- 3 files changed, 44 deletions(-) diff --git a/homeassistant/helpers/area_registry.py b/homeassistant/helpers/area_registry.py index 48746b339dc..499e548ce90 100644 --- a/homeassistant/helpers/area_registry.py +++ b/homeassistant/helpers/area_registry.py @@ -8,11 +8,9 @@ from typing import Any, cast import attr from homeassistant.core import HomeAssistant, callback -from homeassistant.loader import bind_hass from homeassistant.util import slugify from . import device_registry as dr, entity_registry as er -from .frame import report from .storage import Store from .typing import UNDEFINED, UndefinedType @@ -282,19 +280,6 @@ async def async_load(hass: HomeAssistant) -> None: await hass.data[DATA_REGISTRY].async_load() -@bind_hass -async def async_get_registry(hass: HomeAssistant) -> AreaRegistry: - """Get area registry. - - This is deprecated and will be removed in the future. Use async_get instead. - """ - report( - "uses deprecated `async_get_registry` to access area registry, use async_get" - " instead" - ) - return async_get(hass) - - def normalize_area_name(area_name: str) -> str: """Normalize an area name by removing whitespace and case folding.""" return area_name.casefold().replace(" ", "") diff --git a/homeassistant/helpers/device_registry.py b/homeassistant/helpers/device_registry.py index b72a1878651..29e64639722 100644 --- a/homeassistant/helpers/device_registry.py +++ b/homeassistant/helpers/device_registry.py @@ -13,7 +13,6 @@ from homeassistant.backports.enum import StrEnum from homeassistant.const import EVENT_HOMEASSISTANT_STARTED, EVENT_HOMEASSISTANT_STOP from homeassistant.core import Event, HomeAssistant, callback from homeassistant.exceptions import HomeAssistantError, RequiredParameterMissing -from homeassistant.loader import bind_hass from homeassistant.util.json import format_unserializable_data import homeassistant.util.uuid as uuid_util @@ -749,19 +748,6 @@ async def async_load(hass: HomeAssistant) -> None: await hass.data[DATA_REGISTRY].async_load() -@bind_hass -async def async_get_registry(hass: HomeAssistant) -> DeviceRegistry: - """Get device registry. - - This is deprecated and will be removed in the future. Use async_get instead. - """ - report( - "uses deprecated `async_get_registry` to access device registry, use async_get" - " instead" - ) - return async_get(hass) - - @callback def async_entries_for_area(registry: DeviceRegistry, area_id: str) -> list[DeviceEntry]: """Return entries that match an area.""" diff --git a/homeassistant/helpers/entity_registry.py b/homeassistant/helpers/entity_registry.py index 9a30e20a8e8..3ed0ff8d472 100644 --- a/homeassistant/helpers/entity_registry.py +++ b/homeassistant/helpers/entity_registry.py @@ -42,13 +42,11 @@ from homeassistant.core import ( valid_entity_id, ) from homeassistant.exceptions import MaxLengthExceeded -from homeassistant.loader import bind_hass from homeassistant.util import slugify, uuid as uuid_util from homeassistant.util.json import format_unserializable_data from . import device_registry as dr, storage from .device_registry import EVENT_DEVICE_REGISTRY_UPDATED -from .frame import report from .json import JSON_DUMP, find_paths_unserializable_data from .typing import UNDEFINED, UndefinedType @@ -1097,19 +1095,6 @@ async def async_load(hass: HomeAssistant) -> None: await hass.data[DATA_REGISTRY].async_load() -@bind_hass -async def async_get_registry(hass: HomeAssistant) -> EntityRegistry: - """Get entity registry. - - This is deprecated and will be removed in the future. Use async_get instead. - """ - report( - "uses deprecated `async_get_registry` to access entity registry, use async_get" - " instead" - ) - return async_get(hass) - - @callback def async_entries_for_device( registry: EntityRegistry, device_id: str, include_disabled_entities: bool = False