Use assignment expressions 17 (#57963)

Co-authored-by: Tobias Sauerwein <cgtobi@users.noreply.github.com>
This commit is contained in:
Marc Mueller 2021-10-20 17:42:26 +02:00 committed by GitHub
parent 326a302c22
commit 9a58bfdf41
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 30 additions and 56 deletions

View file

@ -147,8 +147,7 @@ class StatisticsSensor(SensorEntity):
@callback
def async_stats_sensor_state_listener(event):
"""Handle the sensor state changes."""
new_state = event.data.get("new_state")
if new_state is None:
if (new_state := event.data.get("new_state")) is None:
return
self._unit_of_measurement = new_state.attributes.get(