Incorporate black suggestions & rearrange imports slightly

This isn't really necessary, but it makes the file look nicer to
my eyes. Let me know if you want me to remove this commit.
This commit is contained in:
Ilya Grigoriev 2021-03-06 17:08:28 -08:00 committed by Fabian Homborg
parent f725cd402d
commit fe70c29c48

View File

@ -23,7 +23,7 @@ from itertools import chain
COMMON_WSL_CMD_PATHS = (
"/mnt/c/Windows/System32",
"/windir/c/Windows/System32",
"/c/Windows/System32"
"/c/Windows/System32",
)
FISH_BIN_PATH = False # will be set later
IS_PY2 = sys.version_info[0] == 2
@ -37,6 +37,21 @@ else:
import socketserver as SocketServer
from urllib.parse import parse_qs
try:
import json
except ImportError:
import simplejson as json
# Disable CLI web browsers
term = os.environ.pop("TERM", None)
# This import must be done with an empty $TERM, otherwise a command-line browser may be started
# which will block the whole process - see https://docs.python.org/3/library/webbrowser.html
import webbrowser
if term:
os.environ["TERM"] = term
def find_executable(exe, paths=()):
final_path = os.environ["PATH"].split(os.pathsep)
@ -81,21 +96,6 @@ def is_chromeos_garcon():
return "garcon-url-handler" in webbrowser.get().name
# Disable CLI web browsers
term = os.environ.pop("TERM", None)
# This import must be done with an empty $TERM, otherwise a command-line browser may be started
# which will block the whole process - see https://docs.python.org/3/library/webbrowser.html
import webbrowser
if term:
os.environ["TERM"] = term
try:
import json
except ImportError:
import simplejson as json
def run_fish_cmd(text):
# Ensure that fish is using UTF-8.
ctype = os.environ.get("LC_ALL", os.environ.get("LC_CTYPE", os.environ.get("LANG")))
@ -992,7 +992,7 @@ class FishConfigHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
vars[name].exported = True
# Do not return history as a variable, it may be so large the browser hangs.
vars.pop('history', None)
vars.pop("history", None)
return [
vars[key].get_json_obj()