From ad22f32b0efc94bfe3114b6dd7cba048e425f00a Mon Sep 17 00:00:00 2001 From: NichtJens Date: Tue, 16 Jan 2024 00:05:57 +0100 Subject: [PATCH] removed useless try/except/raise block --- client/client_example.py | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/client/client_example.py b/client/client_example.py index b04d141..ab954d6 100644 --- a/client/client_example.py +++ b/client/client_example.py @@ -126,20 +126,18 @@ class BrokerClient: self.stop(stop_pulseid=current_pulseid) raise NameError("Ctrl-c is called") signal.signal(signal.SIGINT, signal_handler) - try: - while True: - current_pulseid = get_current_pulseid() - if current_pulseid >= stop_pulseid: - break - time.sleep(0.1) - progress = (current_pulseid-self.start_pulseid) / (stop_pulseid-self.start_pulseid) - block = int(round(20*progress)) - text = "\r[{0}] {1}% Run: {2}".format( "#"*block + "-"*(20-block), int(progress*100), last_known_run+1) - sys.stdout.write(text) - sys.stdout.flush() - print() - self.stop(stop_pulseid=stop_pulseid) - except: - raise + while True: + current_pulseid = get_current_pulseid() + if current_pulseid >= stop_pulseid: + break + time.sleep(0.1) + progress = (current_pulseid-self.start_pulseid) / (stop_pulseid-self.start_pulseid) + block = int(round(20*progress)) + text = "\r[{0}] {1}% Run: {2}".format( "#"*block + "-"*(20-block), int(progress*100), last_known_run+1) + sys.stdout.write(text) + sys.stdout.flush() + print() + + self.stop(stop_pulseid=stop_pulseid)