LGTM report: for has redundant else, output is always overwrtitten

introduced by 2aec6e5814
This commit is contained in:
Aaron Gyes 2021-12-12 10:23:31 -08:00
parent ff1aea3d96
commit 8e61255a04

View file

@ -1102,14 +1102,11 @@ class FishConfigHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
return result return result
def do_get_color_for_variable(self, name): def do_get_color_for_variable(self, name):
# Return the color with the given name, or the empty string if there is "Return the color with the given name, or the empty string if there is none."
# none.
out, err = run_fish_cmd("echo -n $" + name) out, err = run_fish_cmd("echo -n $" + name)
return out return out
def do_set_color_for_variable( def do_set_color_for_variable(self, name, color):
self, name, color
):
"Sets a color for a fish color name, like 'autosuggestion'" "Sets a color for a fish color name, like 'autosuggestion'"
if not name: if not name:
raise ValueError raise ValueError
@ -1415,12 +1412,8 @@ class FishConfigHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
color = item.get("color") color = item.get("color")
if what: if what:
output = self.do_set_color_for_variable( output = self.do_set_color_for_variable(what, color)
what,
color,
)
else:
output = "Bad request"
elif p == "/get_function/": elif p == "/get_function/":
what = postvars.get("what") what = postvars.get("what")
output = [self.do_get_function(what[0])] output = [self.do_get_function(what[0])]