Use assignment expressions 29 (#58713)

This commit is contained in:
Marc Mueller 2021-10-30 16:31:43 +02:00 committed by GitHub
parent 887d04be60
commit b1d49b3b66
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 27 additions and 62 deletions

View file

@ -111,8 +111,7 @@ class AcerSwitch(SwitchEntity):
"""Write msg, obtain answer and format output."""
# answers are formatted as ***\answer\r***
awns = self._write_read(msg)
match = re.search(r"\r(.+)\r", awns)
if match:
if match := re.search(r"\r(.+)\r", awns):
return match.group(1)
return STATE_UNKNOWN