Use assignment expressions 10 (#57791)
This commit is contained in:
parent
9be3278ffa
commit
12d1dfdaf9
10 changed files with 44 additions and 87 deletions
|
@ -11,8 +11,7 @@ from homeassistant.core import State
|
|||
def find_state_attributes(states: list[State], key: str) -> Iterator[Any]:
|
||||
"""Find attributes with matching key from states."""
|
||||
for state in states:
|
||||
value = state.attributes.get(key)
|
||||
if value is not None:
|
||||
if (value := state.attributes.get(key)) is not None:
|
||||
yield value
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue