Add ruff rules PIE790, PIE794, PIE807, PIE810 (#113617)

This commit is contained in:
Sid 2024-03-16 22:04:58 +01:00 committed by GitHub
parent cbe2a5883b
commit 0b9c9aff62
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
25 changed files with 29 additions and 47 deletions

View file

@ -774,13 +774,7 @@ class BrSensor(SensorEntity):
self._measured = data.get(MEASURED)
sensor_type = self.entity_description.key
if (
sensor_type.endswith("_1d")
or sensor_type.endswith("_2d")
or sensor_type.endswith("_3d")
or sensor_type.endswith("_4d")
or sensor_type.endswith("_5d")
):
if sensor_type.endswith(("_1d", "_2d", "_3d", "_4d", "_5d")):
# update forecasting sensors:
fcday = 0
if sensor_type.endswith("_2d"):
@ -793,7 +787,7 @@ class BrSensor(SensorEntity):
fcday = 4
# update weather symbol & status text
if sensor_type.startswith(SYMBOL) or sensor_type.startswith(CONDITION):
if sensor_type.startswith((SYMBOL, CONDITION)):
try:
condition = data.get(FORECAST)[fcday].get(CONDITION)
except IndexError: