From 8e61255a041cdf7f754549f6786af9a66ed45588 Mon Sep 17 00:00:00 2001 From: Aaron Gyes Date: Sun, 12 Dec 2021 10:23:31 -0800 Subject: [PATCH] LGTM report: for has redundant else, output is always overwrtitten introduced by https://lgtm.com/projects/g/fish-shell/fish-shell/rev/2aec6e58146d2e0bfea2802ec147b26631edaf7d --- share/tools/web_config/webconfig.py | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/share/tools/web_config/webconfig.py b/share/tools/web_config/webconfig.py index b1fd45f1a..e26b8e4b0 100755 --- a/share/tools/web_config/webconfig.py +++ b/share/tools/web_config/webconfig.py @@ -1102,14 +1102,11 @@ class FishConfigHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): return result def do_get_color_for_variable(self, name): - # Return the color with the given name, or the empty string if there is - # none. + "Return the color with the given name, or the empty string if there is none." out, err = run_fish_cmd("echo -n $" + name) return out - def do_set_color_for_variable( - self, name, color - ): + def do_set_color_for_variable(self, name, color): "Sets a color for a fish color name, like 'autosuggestion'" if not name: raise ValueError @@ -1415,12 +1412,8 @@ class FishConfigHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): color = item.get("color") if what: - output = self.do_set_color_for_variable( - what, - color, - ) - else: - output = "Bad request" + output = self.do_set_color_for_variable(what, color) + elif p == "/get_function/": what = postvars.get("what") output = [self.do_get_function(what[0])]