Use assignment expressions 30 (#58714)
This commit is contained in:
parent
7063c05127
commit
84618fa831
24 changed files with 33 additions and 77 deletions
|
@ -130,8 +130,7 @@ class OctoPrintJobPercentageSensor(OctoPrintSensorBase):
|
|||
if not job:
|
||||
return None
|
||||
|
||||
state = job.progress.completion
|
||||
if not state:
|
||||
if not (state := job.progress.completion):
|
||||
return 0
|
||||
|
||||
return round(state, 2)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue