From d213fbcd81ee6b96bb81745f0334b16072586a60 Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Sun, 24 Dec 2023 04:07:50 +0000 Subject: [PATCH] refactor: refactor unnecessary `else` / `elif` when `if` block has a `raise` statement `raise` causes control flow to be disrupted, as it will exit the block. It is recommended to check other conditions using another `if` statement, and get rid of `else` statements as they are unnecessary. --- gui/download2.py | 2 +- gui/login1_sms.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gui/download2.py b/gui/download2.py index dad140f..747f6be 100644 --- a/gui/download2.py +++ b/gui/download2.py @@ -20,7 +20,7 @@ def _async_raise(tid, exctype): res = ctypes.pythonapi.PyThreadState_SetAsyncExc(tid, ctypes.py_object(exctype)) if res == 0: raise ValueError("invalid thread id") - elif res != 1: + if res != 1: ctypes.pythonapi.PyThreadState_SetAsyncExc(tid, None) raise SystemError("PyThreadState_SetAsyncExc failed") diff --git a/gui/login1_sms.py b/gui/login1_sms.py index bbf7975..84b71a1 100644 --- a/gui/login1_sms.py +++ b/gui/login1_sms.py @@ -17,7 +17,7 @@ def _async_raise(tid, exctype): res = ctypes.pythonapi.PyThreadState_SetAsyncExc(tid, ctypes.py_object(exctype)) if res == 0: raise ValueError("invalid thread id") - elif res != 1: + if res != 1: ctypes.pythonapi.PyThreadState_SetAsyncExc(tid, None)