Code styling tweaks to core helpers (#85441)
This commit is contained in:
parent
cf5fca0464
commit
06a35fb7db
22 changed files with 192 additions and 100 deletions
|
@ -371,7 +371,8 @@ def async_extract_referenced_entity_ids(
|
|||
return selected
|
||||
|
||||
for ent_entry in ent_reg.entities.values():
|
||||
# Do not add entities which are hidden or which are config or diagnostic entities
|
||||
# Do not add entities which are hidden or which are config
|
||||
# or diagnostic entities.
|
||||
if ent_entry.entity_category is not None or ent_entry.hidden_by is not None:
|
||||
continue
|
||||
|
||||
|
@ -489,7 +490,10 @@ async def async_get_all_descriptions(
|
|||
# Cache missing descriptions
|
||||
if description is None:
|
||||
domain_yaml = loaded[domain]
|
||||
yaml_description = domain_yaml.get(service, {}) # type: ignore[union-attr]
|
||||
|
||||
yaml_description = domain_yaml.get( # type: ignore[union-attr]
|
||||
service, {}
|
||||
)
|
||||
|
||||
# Don't warn for missing services, because it triggers false
|
||||
# positives for things like scripts, that register as a service
|
||||
|
@ -706,11 +710,14 @@ async def _handle_entity_call(
|
|||
entity.async_set_context(context)
|
||||
|
||||
if isinstance(func, str):
|
||||
result = hass.async_run_job(partial(getattr(entity, func), **data)) # type: ignore[arg-type]
|
||||
result = hass.async_run_job(
|
||||
partial(getattr(entity, func), **data) # type: ignore[arg-type]
|
||||
)
|
||||
else:
|
||||
result = hass.async_run_job(func, entity, data)
|
||||
|
||||
# Guard because callback functions do not return a task when passed to async_run_job.
|
||||
# Guard because callback functions do not return a task when passed to
|
||||
# async_run_job.
|
||||
if result is not None:
|
||||
await result
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue