Use assignment expressions 14 (#57939)

This commit is contained in:
Marc Mueller 2021-10-21 08:26:01 +02:00 committed by GitHub
parent 4eea618cc4
commit c979e89b70
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 31 additions and 70 deletions

View file

@ -307,8 +307,7 @@ class SendKeys(LcnServiceCall):
key_id = int(key) - 1
keys[table_id][key_id] = True
delay_time = service.data[CONF_TIME]
if delay_time != 0:
if (delay_time := service.data[CONF_TIME]) != 0:
hit = pypck.lcn_defs.SendKeyCommand.HIT
if pypck.lcn_defs.SendKeyCommand[service.data[CONF_STATE]] != hit:
raise ValueError(
@ -347,8 +346,7 @@ class LockKeys(LcnServiceCall):
]
table_id = ord(service.data[CONF_TABLE]) - 65
delay_time = service.data[CONF_TIME]
if delay_time != 0:
if (delay_time := service.data[CONF_TIME]) != 0:
if table_id != 0:
raise ValueError(
"Only table A is allowed when locking keys for a specific time."