Remove unused entity_id argument in logbook context augmenter (#71829)

This commit is contained in:
J. Nick Koston 2022-05-13 16:17:41 -04:00 committed by GitHub
parent 2a2a7a62c5
commit 535ae56fe7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -413,7 +413,7 @@ def _humanify(
if icon := _row_attributes_extract(row, ICON_JSON_EXTRACT): if icon := _row_attributes_extract(row, ICON_JSON_EXTRACT):
data[LOGBOOK_ENTRY_ICON] = icon data[LOGBOOK_ENTRY_ICON] = icon
context_augmenter.augment(data, entity_id, row) context_augmenter.augment(data, row)
yield data yield data
elif event_type in external_events: elif event_type in external_events:
@ -421,7 +421,7 @@ def _humanify(
data = describe_event(event_cache.get(row)) data = describe_event(event_cache.get(row))
data[LOGBOOK_ENTRY_WHEN] = format_time(row) data[LOGBOOK_ENTRY_WHEN] = format_time(row)
data[LOGBOOK_ENTRY_DOMAIN] = domain data[LOGBOOK_ENTRY_DOMAIN] = domain
context_augmenter.augment(data, data.get(ATTR_ENTITY_ID), row) context_augmenter.augment(data, row)
yield data yield data
elif event_type == EVENT_LOGBOOK_ENTRY: elif event_type == EVENT_LOGBOOK_ENTRY:
@ -441,7 +441,7 @@ def _humanify(
LOGBOOK_ENTRY_DOMAIN: domain, LOGBOOK_ENTRY_DOMAIN: domain,
LOGBOOK_ENTRY_ENTITY_ID: entity_id, LOGBOOK_ENTRY_ENTITY_ID: entity_id,
} }
context_augmenter.augment(data, entity_id, row) context_augmenter.augment(data, row)
yield data yield data
@ -562,7 +562,7 @@ class ContextAugmenter:
self.external_events = external_events self.external_events = external_events
self.event_cache = event_cache self.event_cache = event_cache
def augment(self, data: dict[str, Any], entity_id: str | None, row: Row) -> None: def augment(self, data: dict[str, Any], row: Row) -> None:
"""Augment data from the row and cache.""" """Augment data from the row and cache."""
if context_user_id := row.context_user_id: if context_user_id := row.context_user_id:
data[CONTEXT_USER_ID] = context_user_id data[CONTEXT_USER_ID] = context_user_id