From 10250280b364e41adbefda507c70e0202f62b332 Mon Sep 17 00:00:00 2001 From: YashRL Date: Wed, 13 Mar 2024 11:28:25 +0530 Subject: [PATCH 1/2] Optimize scripts/clone_helixlsp_config.py for performance --- scripts/clone_helix_lsp_config.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/scripts/clone_helix_lsp_config.py b/scripts/clone_helix_lsp_config.py index e34828e2..f6ed7236 100755 --- a/scripts/clone_helix_lsp_config.py +++ b/scripts/clone_helix_lsp_config.py @@ -11,7 +11,8 @@ for lsp in lsps.values(): # Margs command and args - lsp["cmd"] = [lsp["command"], *lsp.get("args", [])] + cmd = [lsp["command"], *lsp.get("args", [])] + lsp["cmd"] = cmd del lsp["command"] if "args" in lsp: del lsp["args"] @@ -23,9 +24,9 @@ # Assign languages to LSPs for lang in c.get("language", []): for name in lang.get("language-servers", []): - if lsp := lsps.get(name, {}): - if "languages" not in lsp: - lsp["languages"] = set() - lsp["languages"].add(lang["name"]) + lsp = lsps.get(name, {}) + if "languages" not in lsp: + lsp["languages"] = set() + lsp["languages"].add(lang["name"]) print(lsps) From e76af96b9fda7d25b3a43a89f7f3d417104473bf Mon Sep 17 00:00:00 2001 From: YashRL Date: Wed, 13 Mar 2024 11:35:48 +0530 Subject: [PATCH 2/2] Optimize scripts/debug_vt100_input.py.py for performance --- scripts/debug_vt100_input.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/scripts/debug_vt100_input.py b/scripts/debug_vt100_input.py index e0a6fe4f..3c4efb7d 100755 --- a/scripts/debug_vt100_input.py +++ b/scripts/debug_vt100_input.py @@ -1,21 +1,14 @@ #!/usr/bin/env python """Parse vt100 input and print keys.""" -from __future__ import annotations - import sys -from typing import TYPE_CHECKING - from prompt_toolkit.input.vt100 import raw_mode from euporie.core.io import Vt100Parser from euporie.core.keys import Keys -if TYPE_CHECKING: - from prompt_toolkit.key_binding import KeyPress - -def callback(key_press: KeyPress) -> None: +def callback(key_press): """Run when a key press event is received.""" print(key_press) if key_press.key == Keys.ControlC: @@ -24,7 +17,7 @@ def callback(key_press: KeyPress) -> None: sys.exit(0) -def main() -> None: +def main(): """Run the main event loop.""" print("\x1b[>4;1m") print("\x1b[>1u")