From 12647bcf64af6baa2cc48cdc3a4dafd1c4d3e7e1 Mon Sep 17 00:00:00 2001 From: Garrett Michael Flynn Date: Fri, 19 Jan 2024 13:32:16 -0800 Subject: [PATCH] Update publisher.py --- src/tqdm_publisher/publisher.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/tqdm_publisher/publisher.py b/src/tqdm_publisher/publisher.py index ab53463..9fe36c5 100644 --- a/src/tqdm_publisher/publisher.py +++ b/src/tqdm_publisher/publisher.py @@ -27,8 +27,7 @@ def subscribe(self, callback): # Unsubscribe from updates def unsubscribe(self, callback_id): - try: - del self.callbacks[callback_id] - return True - except KeyError: - return False \ No newline at end of file + if callback_id not in self.callbacks: + return False + del self.callbacks[callback_id] + return True \ No newline at end of file