From 530556015f98097664d02372701efb15442c6949 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Fri, 21 Jul 2023 15:32:27 +0200 Subject: [PATCH] Use walrus in event entity last event attributes (#97005) --- homeassistant/components/event/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/event/__init__.py b/homeassistant/components/event/__init__.py index 6eeab6a32bb..48bb2fd1726 100644 --- a/homeassistant/components/event/__init__.py +++ b/homeassistant/components/event/__init__.py @@ -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