Skip to content

Commit 122c043

Browse files
committed
Move image and link entry generation outside of the loop
1 parent f92956f commit 122c043

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

custom_components/feedparser/sensor.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -191,14 +191,14 @@ def _generate_sensor_entry(
191191
else:
192192
sensor_entry[key] = value
193193

194-
if "image" in self._inclusions and "image" not in sensor_entry:
195-
sensor_entry["image"] = self._process_image(feed_entry)
196-
if (
197-
"link" in self._inclusions
198-
and "link" not in sensor_entry
199-
and (processed_link := self._process_link(feed_entry))
200-
):
201-
sensor_entry["link"] = processed_link
194+
if "image" in self._inclusions and "image" not in sensor_entry:
195+
sensor_entry["image"] = self._process_image(feed_entry)
196+
if (
197+
"link" in self._inclusions
198+
and "link" not in sensor_entry
199+
and (processed_link := self._process_link(feed_entry))
200+
):
201+
sensor_entry["link"] = processed_link
202202
_LOGGER.debug("Feed %s: Generated sensor entry: %s", self.name, sensor_entry)
203203
return sensor_entry
204204

0 commit comments

Comments
 (0)