From 1e0dcac2cfe73a6fc80684068e312fbd40c91240 Mon Sep 17 00:00:00 2001 From: Stefan Dimitrijevic Date: Mon, 10 Nov 2025 17:52:30 +0100 Subject: [PATCH 1/2] fix command set up for old splitting logic --- linvam/profileexecutor.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/linvam/profileexecutor.py b/linvam/profileexecutor.py index 9d7d561..01a64f8 100644 --- a/linvam/profileexecutor.py +++ b/linvam/profileexecutor.py @@ -20,6 +20,7 @@ KEYS_SPLITTER, save_to_commands_file, is_push_to_listen, get_push_to_listen_hotkey, Command, Config) +COMMAND_NAME_COMMA_SPLIT_REGGEX = r",(?![^\[]*\])" def _expand_optional_brackets(text): """ @@ -227,7 +228,7 @@ def set_profile(self, p_profile): return w_commands = self.m_profile['commands'] for w_command in w_commands: - parts = w_command['name'].strip().lower().split(',') + parts = re.split(COMMAND_NAME_COMMA_SPLIT_REGGEX, w_command['name'].strip().lower()) for part in parts: # Expand optional brackets to create all variations variations = _expand_optional_brackets(part.strip()) @@ -500,7 +501,7 @@ def _get_command_for_executing(self, cmd_name): w_commands = self.m_profile['commands'] command = None for w_command in w_commands: - parts = w_command['name'].split(',') + parts = re.split(COMMAND_NAME_COMMA_SPLIT_REGGEX, w_command['name'].strip().lower()) for part in parts: # Expand optional brackets to match all variations variations = _expand_optional_brackets(part.strip()) From a066747da2c8189932257e042a9ff0e099713f8c Mon Sep 17 00:00:00 2001 From: Stefan Dimitrijevic Date: Mon, 10 Nov 2025 17:57:19 +0100 Subject: [PATCH 2/2] fix pylint --- linvam/profileexecutor.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/linvam/profileexecutor.py b/linvam/profileexecutor.py index 01a64f8..9569d17 100644 --- a/linvam/profileexecutor.py +++ b/linvam/profileexecutor.py @@ -22,6 +22,7 @@ COMMAND_NAME_COMMA_SPLIT_REGGEX = r",(?![^\[]*\])" +# pylint: disable=too-many-locals def _expand_optional_brackets(text): """ Expands optional words in square brackets to create all variations. @@ -30,6 +31,7 @@ def _expand_optional_brackets(text): Examples: "power up [the ship]" -> ["power up the ship", "power up"] "power up [the ship, the engines]" -> ["power up the ship", "power up the engines", "power up"] + # pylint: disable=line-too-long "open [the, a] menu [now]" -> ["open the menu now", "open a menu now", "open the menu", "open a menu", "open menu now", "open menu"] Args: