From a1bdcb2d2043343971e5eb9a7c89e3ab808e10e2 Mon Sep 17 00:00:00 2001 From: Roshanlal Date: Fri, 7 Oct 2022 23:50:58 +0530 Subject: [PATCH] Update telegram_bot.py Refactored nested IF --- src/yolov7_reid/src/telegram_bot.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/yolov7_reid/src/telegram_bot.py b/src/yolov7_reid/src/telegram_bot.py index 5e2af86..566c701 100644 --- a/src/yolov7_reid/src/telegram_bot.py +++ b/src/yolov7_reid/src/telegram_bot.py @@ -82,10 +82,9 @@ def save_id(self,chat_id): with open(self.chat_id_filepath, "w") as f: f.write(chat_id) def load_id(self): - if os.path.exists(self.chat_id_filepath): + if os.path.exists(self.chat_id_filepath) and chat_id == '': with open(self.chat_id_filepath,'r') as f: chat_id = f.readline() - if chat_id == '': - return None + return None return chat_id - return None \ No newline at end of file + return None