From a32f2cc0f8e9dd6c43c6c94733213520934e2336 Mon Sep 17 00:00:00 2001 From: Willi Ballenthin Date: Thu, 13 Jul 2023 04:19:09 +0200 Subject: [PATCH 1/2] tests: fix type error --- tests/test_binja_features.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_binja_features.py b/tests/test_binja_features.py index 5819e0dc..c96b8c0c 100644 --- a/tests/test_binja_features.py +++ b/tests/test_binja_features.py @@ -59,7 +59,7 @@ def test_binja_feature_counts(sample, scope, feature, expected): def test_standalone_binja_backend(): CD = Path(__file__).resolve().parent test_path = CD / ".." / "tests" / "data" / "Practical Malware Analysis Lab 01-01.exe_" - assert capa.main.main([test_path, "-b", capa.main.BACKEND_BINJA]) == 0 + assert capa.main.main([str(test_path), "-b", capa.main.BACKEND_BINJA]) == 0 @pytest.mark.skipif(binja_present is False, reason="Skip binja tests if the binaryninja Python API is not installed") From acaf6c1272c85b866dd5bb79bd221265e59c6854 Mon Sep 17 00:00:00 2001 From: Willi Ballenthin Date: Thu, 13 Jul 2023 04:25:01 +0200 Subject: [PATCH 2/2] main: add type hints for main --- capa/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/capa/main.py b/capa/main.py index 81b3c2d0..6138698a 100644 --- a/capa/main.py +++ b/capa/main.py @@ -20,7 +20,7 @@ import textwrap import itertools import contextlib import collections -from typing import Any, Dict, List, Tuple, Callable +from typing import Any, Dict, List, Tuple, Callable, Optional from pathlib import Path import halo @@ -1060,7 +1060,7 @@ def handle_common_args(args): args.signatures = sigs_path -def main(argv=None): +def main(argv: Optional[List[str]] = None): if sys.version_info < (3, 8): raise UnsupportedRuntimeError("This version of capa can only be used with Python 3.8+")