From 35453bc49e13ab0d1932abfef38291dba9afaab7 Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Sun, 14 Jan 2024 14:18:37 +0000 Subject: [PATCH] refactor: refactor unnecessary `else` / `elif` when `if` block has a `continue` statement The use of `else` or `elif` becomes redundant and can be dropped if the last statement under the leading `if` / `elif` block is a `continue` statement. In the case of an `elif` after `continue`, it can be written as a separate `if` block. For `else` blocks after `continue`, the statements can be shifted out of `else`. Please refer to the examples below for reference. Refactoring the code this way can improve code-readability and make it easier to maintain. --- src/iSponsorBlockTV/config_setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/iSponsorBlockTV/config_setup.py b/src/iSponsorBlockTV/config_setup.py index f0b77ae..a4f61b8 100644 --- a/src/iSponsorBlockTV/config_setup.py +++ b/src/iSponsorBlockTV/config_setup.py @@ -145,7 +145,7 @@ def main(config, debug: bool) -> None: channel_info["name"] = input("Enter the channel name: ") channel_whitelist.append(channel_info) continue - elif choice == "6": + if choice == "6": continue channel_info["id"] = results[int(choice)][0]