mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 18:57:06 +00:00
Unpack non-performant any expressions in config flow discovery path (#123124)
This commit is contained in:
parent
02f81ec481
commit
b6de2cd741
@ -1245,10 +1245,10 @@ class ConfigEntriesFlowManager(data_entry_flow.FlowManager[ConfigFlowResult]):
|
|||||||
@callback
|
@callback
|
||||||
def _async_has_other_discovery_flows(self, flow_id: str) -> bool:
|
def _async_has_other_discovery_flows(self, flow_id: str) -> bool:
|
||||||
"""Check if there are any other discovery flows in progress."""
|
"""Check if there are any other discovery flows in progress."""
|
||||||
return any(
|
for flow in self._progress.values():
|
||||||
flow.context["source"] in DISCOVERY_SOURCES and flow.flow_id != flow_id
|
if flow.flow_id != flow_id and flow.context["source"] in DISCOVERY_SOURCES:
|
||||||
for flow in self._progress.values()
|
return True
|
||||||
)
|
return False
|
||||||
|
|
||||||
async def async_init(
|
async def async_init(
|
||||||
self, handler: str, *, context: dict[str, Any] | None = None, data: Any = None
|
self, handler: str, *, context: dict[str, Any] | None = None, data: Any = None
|
||||||
@ -1699,12 +1699,12 @@ class ConfigEntries:
|
|||||||
entries = self._entries.get_entries_for_domain(domain)
|
entries = self._entries.get_entries_for_domain(domain)
|
||||||
if include_ignore and include_disabled:
|
if include_ignore and include_disabled:
|
||||||
return bool(entries)
|
return bool(entries)
|
||||||
return any(
|
for entry in entries:
|
||||||
entry
|
if (include_ignore or entry.source != SOURCE_IGNORE) and (
|
||||||
for entry in entries
|
include_disabled or not entry.disabled_by
|
||||||
if (include_ignore or entry.source != SOURCE_IGNORE)
|
):
|
||||||
and (include_disabled or not entry.disabled_by)
|
return True
|
||||||
)
|
return False
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def async_entries(
|
def async_entries(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user