Simplify overloads of async_get_device_and_config_entry helpers (#188429)

This commit is contained in:
Artur Pragacz
2026-10-26 12:43:50 +01:00
committed by GitHub
parent 3ae5df755f
commit 54082283cf
2 changed files with 5 additions and 8 deletions
+2 -2
View File
@@ -4932,8 +4932,8 @@ def async_get_device_and_config_entry_for_domain(
device_id: str,
*,
domain: str,
include_child_devices: Literal[True] = True,
include_main_devices: Literal[True] = True,
include_child_devices: bool = True,
include_main_devices: bool = True,
) -> tuple[AnyDeviceEntry | None, ConfigEntry | None]: ...
+3 -6
View File
@@ -1487,8 +1487,8 @@ def async_get_device_and_config_entry(
domain: str,
device_id: str,
*,
include_child_devices: Literal[True] = True,
include_main_devices: Literal[True] = True,
include_child_devices: bool = True,
include_main_devices: bool = True,
) -> tuple[device_registry.AnyDeviceEntry, ConfigEntry]: ...
@@ -1511,10 +1511,7 @@ def async_get_device_and_config_entry(
as does a composite-device id, because both the splits of a composite and the
restored composite itself are main devices.
"""
device: device_registry.AnyDeviceEntry | None
config_entry: ConfigEntry | None
# The flags are plain bools here, which matches none of the Literal overloads
device, config_entry = device_registry.async_get_device_and_config_entry_for_domain( # type: ignore[call-overload]
device, config_entry = device_registry.async_get_device_and_config_entry_for_domain(
hass,
device_id,
domain=domain,