From d7a62a33007c505861461c83f95178db46450dfd Mon Sep 17 00:00:00 2001 From: Raymond Li Date: Tue, 11 Aug 2026 00:13:33 -0400 Subject: [PATCH 1/5] Fix flake8 F824 unused nonlocal declarations flake8 7.2.0 (pyflakes 3.3.2) flags nonlocal names that are only read and never assigned in their scope. Drop the unused names from the declarations in _update_timing and _prompt_for_upgrade. --- nexus/Freqlog/Freqlog.py | 3 +-- nexus/__main__.py | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/nexus/Freqlog/Freqlog.py b/nexus/Freqlog/Freqlog.py index e671a16..4f662d1 100644 --- a/nexus/Freqlog/Freqlog.py +++ b/nexus/Freqlog/Freqlog.py @@ -127,8 +127,7 @@ def _log_and_reset_word(min_length: int = 2) -> None: def _update_timing(): """Must be called after adding a key to word and before self.q.task_done()""" - nonlocal word_start_time, word_end_time, last_key_was_disallowed, chars_since_last_bs, \ - avg_char_time_after_last_bs + nonlocal word_start_time, word_end_time, avg_char_time_after_last_bs if not word_start_time: word_start_time = time_pressed elif chars_since_last_bs > 1 and avg_char_time_after_last_bs: diff --git a/nexus/__main__.py b/nexus/__main__.py index cf7a2b7..22f615e 100644 --- a/nexus/__main__.py +++ b/nexus/__main__.py @@ -250,7 +250,6 @@ def main(): def _prompt_for_upgrade(db_version: Version) -> None: """Prompt user to upgrade""" - nonlocal args logging.warning( f"You are running version {__version__} of nexus, but your database is on version {db_version}.") if not args.upgrade: From 663079a8f98a5c0bf9c9047e709a2aade377c891 Mon Sep 17 00:00:00 2001 From: Raymond Li Date: Tue, 11 Aug 2026 00:14:03 -0400 Subject: [PATCH 2/5] Stop the event listener on shutdown stop_logging() only deleted the listener, which never unblocked the blocking start() call, so the listener thread hung and prevented a clean exit. Call listener.stop() (new in vinput 1.3.0) and join the listener thread before freeing it. --- nexus/Freqlog/Freqlog.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/nexus/Freqlog/Freqlog.py b/nexus/Freqlog/Freqlog.py index 4f662d1..ae73be2 100644 --- a/nexus/Freqlog/Freqlog.py +++ b/nexus/Freqlog/Freqlog.py @@ -392,6 +392,12 @@ def stop_logging(self) -> None: # FIXME: find out why this runs twice on one Ct self.killed = True logging.warning("Stopping freqlog") if self.listener: + # stop() unblocks the listener's blocking start() call so its thread can + # return; without it the listener thread would hang and prevent a clean + # shutdown. Wait for the thread to exit before freeing the listener. + self.listener.stop() + if self.listener_thread.is_alive(): + self.listener_thread.join() del self.listener self.listener = None self.is_logging = False From fd699215a5aad2fea6a8bfdbc718d98fb944cf62 Mon Sep 17 00:00:00 2001 From: Raymond Li Date: Tue, 11 Aug 2026 00:16:51 -0400 Subject: [PATCH 3/5] Fix SIGINT handler so stop_logging is actually called Signal handlers are invoked with (signum, frame); the one-arg lambda raised TypeError before ever calling stop_logging, so Ctrl-C never stopped the listener. Accept and ignore both arguments. --- nexus/__main__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nexus/__main__.py b/nexus/__main__.py index 22f615e..c05f19b 100644 --- a/nexus/__main__.py +++ b/nexus/__main__.py @@ -351,7 +351,8 @@ def _prompt_for_password(new: bool, desc: str = "") -> str: for mod in args.modifier_keys: logging.debug(' - ' + str(mod)) setattr(mods, mod, True) - signal.signal(signal.SIGINT, lambda _: freqlog.stop_logging()) + # Signal handlers are called with (signum, frame); accept and ignore both. + signal.signal(signal.SIGINT, lambda *_: freqlog.stop_logging()) freqlog.start_logging(args.new_word_threshold, args.chord_char_threshold, args.allowed_chars, args.allowed_first_chars, mods) case "checkword": # Check if word is banned From 876f9d4fb474c63e37efbc9cbc0bf35c2c6ff0c5 Mon Sep 17 00:00:00 2001 From: Raymond Li Date: Tue, 11 Aug 2026 00:17:44 -0400 Subject: [PATCH 4/5] Require vinput >= 1.3.0 for listener stop support --- requirements.txt | 8 ++++---- setup.cfg | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/requirements.txt b/requirements.txt index 1f973c6..bbb669d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ charachorder.py~=0.5.2 cryptography~=45.0 -pyinstaller~=5.13 -PySide6~=6.5 -requests~=2.32.1 +pyinstaller~=6.14.1 +PySide6~=6.9.1 +requests~=2.32.4 setuptools~=80.7 -vinput~=0.2.0 +vinput~=1.3.0 diff --git a/setup.cfg b/setup.cfg index 7f6fff1..888bc34 100644 --- a/setup.cfg +++ b/setup.cfg @@ -60,7 +60,7 @@ packages = find: python_requires = >=3.11 install_requires = setuptools - vinput + vinput>=1.3.0 [options.entry_points] console_scripts = From b0fde7e512f398ab45d77086a25ce8f14a860dc0 Mon Sep 17 00:00:00 2001 From: Raymond Li Date: Tue, 11 Aug 2026 00:18:06 -0400 Subject: [PATCH 5/5] Bump deps --- test-requirements.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test-requirements.txt b/test-requirements.txt index 1eb2737..73c70f4 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,4 +1,4 @@ -flake8~=6.1 -pytest~=7.4 -pytest-cov~=4.1 -pre-commit~=3.3 +flake8~=7.2.0 +pytest~=8.4.1 +pytest-cov~=6.2.1 +pre-commit~=4.2.0