Remove checks for DeviceEntryDisabler and DeviceEntryType enum (#130367)

This commit is contained in:
epenet 2024-11-15 12:33:47 +01:00 committed by GitHub
parent de1905a529
commit b24931c775
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -38,7 +38,6 @@ from .deprecation import (
check_if_deprecated_constant,
dir_with_deprecated_constants,
)
from .frame import report
from .json import JSON_DUMP, find_paths_unserializable_data, json_bytes, json_fragment
from .registry import BaseRegistry, BaseRegistryItems, RegistryIndexType
from .singleton import singleton
@ -827,17 +826,6 @@ class DeviceRegistry(BaseRegistry[dict[str, list[dict[str, Any]]]]):
else:
via_device_id = UNDEFINED
if isinstance(entry_type, str) and not isinstance(entry_type, DeviceEntryType):
report( # type: ignore[unreachable]
(
"uses str for device registry entry_type. This is deprecated and"
" will stop working in Home Assistant 2022.3, it should be updated"
" to use DeviceEntryType instead"
),
error_if_core=False,
)
entry_type = DeviceEntryType(entry_type)
device = self.async_update_device(
device.id,
allow_collisions=True,
@ -924,19 +912,6 @@ class DeviceRegistry(BaseRegistry[dict[str, list[dict[str, Any]]]]):
"Cannot define both merge_identifiers and new_identifiers"
)
if isinstance(disabled_by, str) and not isinstance(
disabled_by, DeviceEntryDisabler
):
report( # type: ignore[unreachable]
(
"uses str for device registry disabled_by. This is deprecated and"
" will stop working in Home Assistant 2022.3, it should be updated"
" to use DeviceEntryDisabler instead"
),
error_if_core=False,
)
disabled_by = DeviceEntryDisabler(disabled_by)
if (
suggested_area is not None
and suggested_area is not UNDEFINED