class Status: def __init__(self): self.progress = -1 def on_change(self, status: dict) -> bool: if status == {}: self.progress = -1 if "progress" in status.keys(): progress = status["progress"]['value'] if self.progress < 0 or progress - self.progress >= 10: self.progress = progress print("-------------------------------------------") for key in status.keys(): value = status[key]['value'] unit = status[key]['unit'] if isinstance(value, float): print(f"{key} : {value:0.6f}{unit}") else: print(f"{key} : {value}{unit}") return True