1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 04:50:05 +00:00

Speed up async_get_loaded_integrations (#117851)

* Speed up async_get_loaded_integrations

Use a setcomp and difference to find the components to split
to avoid the loop. A setcomp is inlined in python3.12 so its
much faster

* Speed up async_get_loaded_integrations

Use a setcomp and difference to find the components to split
to avoid the loop. A setcomp is inlined in python3.12 so its
much faster

* simplify

* fix compat

* bootstrap

* fix tests
This commit is contained in:
J. Nick Koston
2024-05-21 03:08:49 -10:00
committed by GitHub
parent 266ce9e268
commit e12d23bd48
5 changed files with 29 additions and 17 deletions

View File

@@ -246,7 +246,7 @@ async def test_send_usage(
assert analytics.preferences[ATTR_BASE]
assert analytics.preferences[ATTR_USAGE]
hass.config.components = ["default_config"]
hass.config.components.add("default_config")
with patch(
"homeassistant.config.load_yaml_config_file",
@@ -280,7 +280,7 @@ async def test_send_usage_with_supervisor(
await analytics.save_preferences({ATTR_BASE: True, ATTR_USAGE: True})
assert analytics.preferences[ATTR_BASE]
assert analytics.preferences[ATTR_USAGE]
hass.config.components = ["default_config"]
hass.config.components.add("default_config")
with (
patch(
@@ -344,7 +344,7 @@ async def test_send_statistics(
await analytics.save_preferences({ATTR_BASE: True, ATTR_STATISTICS: True})
assert analytics.preferences[ATTR_BASE]
assert analytics.preferences[ATTR_STATISTICS]
hass.config.components = ["default_config"]
hass.config.components.add("default_config")
with patch(
"homeassistant.config.load_yaml_config_file",