From c8d47085ee7d335df555d524a11a63b24bc45208 Mon Sep 17 00:00:00 2001 From: Willi Ballenthin Date: Wed, 22 Apr 2026 22:27:51 +0300 Subject: [PATCH] fix: remove unused imports from cache-ruleset.py, detect-binexport2-capabilities.py, show-capabilities-by-function.py Removes capa.engine, capa.helpers, capa.features, and capa.features.insn imports that were never referenced in each script. Adds missing capa.loader import to show-capabilities-by-function.py which was already being used. --- CHANGELOG.md | 1 + scripts/cache-ruleset.py | 3 --- scripts/detect-binexport2-capabilities.py | 3 --- scripts/show-capabilities-by-function.py | 4 +--- 4 files changed, 2 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a140e098..0f0e39dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,7 @@ - fix: Scopes.from_dict uses cls instead of self so subclasses return the correct type @williballenthin - fix: correct wrong dict key in VMRay _compute_monitor_threads assertion (used thread_id instead of process_id) @williballenthin - fix: replace assert with isinstance guard in get_callee for invalid MethodSpec tokens @williballenthin +- fix: remove unused imports of capa.engine, capa.helpers, and capa.features from cache-ruleset.py, detect-binexport2-capabilities.py, and show-capabilities-by-function.py @williballenthin (SURF-92) - fix: remove dead except ValueError clause in capa2sarif.py so JSONDecodeError is caught by the specific handler @williballenthin (SURF-91) - fix: dedent bulk-process.py main() body so explicit argv argument is used instead of silently ignored @williballenthin (SURF-90) - fix: guard statistics.quantiles/mean in compare-backends.py report() against empty duration lists @williballenthin (SURF-89) diff --git a/scripts/cache-ruleset.py b/scripts/cache-ruleset.py index a6fe9074..0ed48d47 100644 --- a/scripts/cache-ruleset.py +++ b/scripts/cache-ruleset.py @@ -29,10 +29,7 @@ from pathlib import Path import capa.main import capa.rules -import capa.engine -import capa.helpers import capa.rules.cache -import capa.features.insn logger = logging.getLogger("cache-ruleset") diff --git a/scripts/detect-binexport2-capabilities.py b/scripts/detect-binexport2-capabilities.py index 22615786..583216ad 100644 --- a/scripts/detect-binexport2-capabilities.py +++ b/scripts/detect-binexport2-capabilities.py @@ -39,10 +39,7 @@ import argparse import capa.main import capa.rules -import capa.engine import capa.loader -import capa.helpers -import capa.features import capa.exceptions import capa.render.proto import capa.render.verbose diff --git a/scripts/show-capabilities-by-function.py b/scripts/show-capabilities-by-function.py index 1c69302e..188d1917 100644 --- a/scripts/show-capabilities-by-function.py +++ b/scripts/show-capabilities-by-function.py @@ -64,9 +64,7 @@ import colorama import capa.main import capa.rules -import capa.engine -import capa.helpers -import capa.features +import capa.loader import capa.exceptions import capa.render.utils as rutils import capa.render.verbose