hass-core/homeassistant/helpers
J. Nick Koston 475c20d529
Always do thread safety check when writing state (#118886)
* Always do thread safety check when writing state

Refactor the 3 most common places where the thread safety check
for the event loop to be inline to make the check fast enough
that we can keep it long term. While code review catches most
of the thread safety issues in core, some of them still make
it through, and new ones keep getting added. Its not possible
to catch them all with manual code review, so its worth the
tiny overhead to check each time.

Previously the check was limited to custom components
because they were the most common source of thread
safety issues.

* Always do thread safety check when writing state

Refactor the 3 most common places where the thread safety check
for the event loop to be inline to make the check fast enough
that we can keep it long term. While code review catches most
of the thread safety issues in core, some of them still make
it through, and new ones keep getting added. Its not possible
to catch them all with manual code review, so its worth the
tiny overhead to check each time.

Previously the check was limited to custom components
because they were the most common source of thread
safety issues.

* async_fire is more common than expected with ccs

* fix mock

* fix hass mocking
2024-06-05 23:41:55 -04:00
..
backports Switch to using the AsyncResolver with aiohttp (#114529) 2024-04-05 23:15:51 -04:00
service_info Use PEP 695 for simple type aliases (#117633) 2024-05-17 14:42:21 +02:00
__init__.py Add empty line after module docstring [helpers + other] (#112707) 2024-03-08 10:36:11 -05:00
aiohttp_client.py Use HassKey for helpers (1) (#117012) 2024-05-07 11:25:16 -05:00
area_registry.py Speed up registry indices (#117897) 2024-05-22 14:07:39 -04:00
category_registry.py Use PEP 695 for simple type aliases (#117633) 2024-05-17 14:42:21 +02:00
check_config.py Replace pylint broad-except with Ruff BLE001 (#116250) 2024-05-07 14:00:27 +02:00
collection.py Use PEP 695 misc (2) (#117814) 2024-05-21 09:45:57 +02:00
condition.py Improve annotation styling (#118032) 2024-05-24 15:05:53 +02:00
config_entry_flow.py Use PEP 695 for class annotations (4) (#117778) 2024-05-20 10:44:52 +02:00
config_entry_oauth2_flow.py Add lock to token validity check (#117912) 2024-05-22 14:10:23 -04:00
config_validation.py Add async_get_hass_or_none (#118164) 2024-05-26 13:38:46 +02:00
data_entry_flow.py Update typing extensions to 4.11.0 (#114985) 2024-04-06 14:23:32 +02:00
debounce.py Use PEP 695 for covariant class annotations (#117780) 2024-05-20 10:55:44 +02:00
deprecation.py Add async_get_hass_or_none (#118164) 2024-05-26 13:38:46 +02:00
device_registry.py Add error message to device registry helper (#118676) 2024-06-03 09:58:02 +02:00
discovery.py Turn on thread safety checks in async_dispatcher_send (#116867) 2024-05-05 16:29:43 -04:00
discovery_flow.py Enable Ruff RET502 (#115139) 2024-05-21 22:19:33 +02:00
dispatcher.py Small speed up to connecting dispatchers (#118342) 2024-05-28 16:49:58 -10:00
entity.py Always do thread safety check when writing state (#118886) 2024-06-05 23:41:55 -04:00
entity_component.py Improve config entry has already been setup error message (#117091) 2024-05-08 14:16:08 -05:00
entity_platform.py Use del instead of pop in the entity platform remove (#118337) 2024-05-28 15:26:22 -10:00
entity_registry.py Don't report entities with invalid unique id when loading the entity registry (#118290) 2024-05-29 08:32:39 +02:00
entity_values.py Align max expected entities constant between modules (#118102) 2024-05-27 14:06:16 -10:00
entityfilter.py Add cache to more complex entity filters (#118344) 2024-05-28 23:07:50 -04:00
event.py Add types to event tracker data (#118010) 2024-05-24 10:09:39 -04:00
floor_registry.py Use PEP 695 for simple type aliases (#117633) 2024-05-17 14:42:21 +02:00
frame.py Always do thread safety check when writing state (#118886) 2024-06-05 23:41:55 -04:00
group.py Add empty line after module docstring [helpers + other] (#112707) 2024-03-08 10:36:11 -05:00
http.py Use PEP 695 for simple type aliases (#117633) 2024-05-17 14:42:21 +02:00
httpx_client.py Improve callable annotations (#118024) 2024-05-24 10:24:09 +02:00
icon.py Remove translation and icon component path functions (#118214) 2024-05-27 10:35:52 +02:00
importlib.py Use HassKey for importlib helper (#117116) 2024-05-08 17:42:28 -05:00
instance_id.py Replace pylint broad-except with Ruff BLE001 (#116250) 2024-05-07 14:00:27 +02:00
integration_platform.py Use HassKey for helpers (2) (#117013) 2024-05-07 11:24:13 -05:00
intent.py Add Conversation command to timers (#118325) 2024-05-28 20:33:31 -05:00
issue_registry.py Migrate issue registry to use singleton helper (#117848) 2024-05-22 14:13:19 -04:00
json.py Add empty line after module docstring [helpers + other] (#112707) 2024-03-08 10:36:11 -05:00
label_registry.py Use PEP 695 for simple type aliases (#117633) 2024-05-17 14:42:21 +02:00
llm.py Include script description in LLM exposed entities (#118749) 2024-06-04 11:18:07 -04:00
location.py Add empty line after module docstring [helpers + other] (#112707) 2024-03-08 10:36:11 -05:00
network.py Add strict connection for cloud (#115814) 2024-04-24 09:57:38 +02:00
normalized_name_base_registry.py Use PEP 695 for class annotations (4) (#117778) 2024-05-20 10:44:52 +02:00
ratelimit.py Use PEP 695 for function annotations (2) (#117659) 2024-05-18 11:44:39 +02:00
recorder.py Use HassKey for helpers (2) (#117013) 2024-05-07 11:24:13 -05:00
redact.py Use PEP 695 for function annotations (2) (#117659) 2024-05-18 11:44:39 +02:00
registry.py Speed up registry indices (#117897) 2024-05-22 14:07:39 -04:00
reload.py Add first batch of Ruff PYI rules (#115100) 2024-04-07 11:30:50 -10:00
restore_state.py Replace pop calls with del where the result is discarded in restore_state (#118339) 2024-05-28 23:14:40 -04:00
schema_config_entry_flow.py Replace pylint protected-access with Ruff SLF001 (#115735) 2024-05-06 20:33:26 +02:00
script.py Improve script disallowed recursion logging (#118151) 2024-05-26 12:58:34 +02:00
script_variables.py Add empty line after module docstring [helpers + other] (#112707) 2024-03-08 10:36:11 -05:00
selector.py Add allow_negative configuration option to DurationSelector (#116134) 2024-05-30 17:42:34 +02:00
sensor.py Add empty line after module docstring [helpers + other] (#112707) 2024-03-08 10:36:11 -05:00
service.py Include script description in LLM exposed entities (#118749) 2024-06-04 11:18:07 -04:00
signal.py Use HassKey for helpers (2) (#117013) 2024-05-07 11:24:13 -05:00
significant_change.py Use PEP 695 for simple type aliases (#117633) 2024-05-17 14:42:21 +02:00
singleton.py Use PEP 695 for decorator typing with type aliases (2) (#117663) 2024-05-18 11:41:46 +02:00
start.py Improve annotation styling (#118032) 2024-05-24 15:05:53 +02:00
state.py Add empty line after module docstring [helpers + other] (#112707) 2024-03-08 10:36:11 -05:00
storage.py Migrate issue registry to use singleton helper (#117848) 2024-05-22 14:13:19 -04:00
sun.py Use PEP 695 for simple type aliases (#117633) 2024-05-17 14:42:21 +02:00
system_info.py Fix blocking I/O in the event loop to get MacOS system_info (#117290) 2024-05-12 08:16:21 -04:00
temperature.py Add empty line after module docstring [helpers + other] (#112707) 2024-03-08 10:36:11 -05:00
template.py Speed up template result parsing (#118168) 2024-05-26 13:09:12 +02:00
trace.py Use PEP 695 for function annotations (2) (#117659) 2024-05-18 11:44:39 +02:00
translation.py Remove translation and icon component path functions (#118214) 2024-05-27 10:35:52 +02:00
trigger.py Allow templates for enabling automation triggers (#114458) 2024-05-14 14:44:21 +02:00
trigger_template_entity.py Add empty line after module docstring [helpers + other] (#112707) 2024-03-08 10:36:11 -05:00
typing.py Use PEP 695 for simple type aliases (#117633) 2024-05-17 14:42:21 +02:00
update_coordinator.py Use PEP 695 misc (2) (#117814) 2024-05-21 09:45:57 +02:00