From 173b87e675948cb3237c0ac15f7e4eac4695a0e6 Mon Sep 17 00:00:00 2001 From: Yuval Aboulafia Date: Fri, 3 Sep 2021 12:07:53 +0300 Subject: [PATCH] Clean holiday attributes code in Jewish calendar (#55080) * Clean repetitive code in jewish calendar * do not return none * fix holiday --- homeassistant/components/jewish_calendar/sensor.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/jewish_calendar/sensor.py b/homeassistant/components/jewish_calendar/sensor.py index 4e90dd00058..824eba46973 100644 --- a/homeassistant/components/jewish_calendar/sensor.py +++ b/homeassistant/components/jewish_calendar/sensor.py @@ -230,9 +230,11 @@ class JewishCalendarSensor(SensorEntity): # Compute the weekly portion based on the upcoming shabbat. return after_tzais_date.upcoming_shabbat.parasha if self.entity_description.key == "holiday": - self._holiday_attrs["id"] = after_shkia_date.holiday_name - self._holiday_attrs["type"] = after_shkia_date.holiday_type.name - self._holiday_attrs["type_id"] = after_shkia_date.holiday_type.value + self._holiday_attrs = { + "id": after_shkia_date.holiday_name, + "type": after_shkia_date.holiday_type.name, + "type_id": after_shkia_date.holiday_type.value, + } return after_shkia_date.holiday_description if self.entity_description.key == "omer_count": return after_shkia_date.omer_day