Use walrus in event entity last event attributes (#97005)

pull/97019/head
Franck Nijhof 2023-07-21 15:32:27 +02:00 committed by GitHub
parent b3da2ea9a6
commit 530556015f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -177,8 +177,8 @@ class EventEntity(RestoreEntity):
def state_attributes(self) -> dict[str, Any]:
"""Return the state attributes."""
attributes = {ATTR_EVENT_TYPE: self.__last_event_type}
if self.__last_event_attributes:
attributes |= self.__last_event_attributes
if last_event_attributes := self.__last_event_attributes:
attributes |= last_event_attributes
return attributes
@final