From 2ec3920f58855af289b07e54cfafc57e2c299a97 Mon Sep 17 00:00:00 2001 From: NobodySpecial Date: Tue, 30 Apr 2024 17:55:24 +0000 Subject: [PATCH] Optimized conditional Optimized redundant length checking on `color` argument --- color.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/color.py b/color.py index 3eeceeb..902fe79 100755 --- a/color.py +++ b/color.py @@ -102,10 +102,11 @@ def main(): if len(argv) >= 2: color = argv[1] - if color not in ["default", ""] and color[0] not in ["#"]: - colorify = colors[color] - if len(color) > 0 and color[0] in ["#"]: - colorify = lambda char, ix, length: colorify_rgb(char, ix, length, color) + if color not in ["default", ""]: + if color[0] in ["#"]: + colorify = lambda char, ix, length: colorify_rgb(char, ix, length, color) + else: + colorify = colors[color] wm = pyinotify.WatchManager() qubes_app = qubesadmin.Qubes()