From 06aea6b97cad8246d211437fcb3795cb68b203fd Mon Sep 17 00:00:00 2001 From: Yacine Elhamer Date: Tue, 27 Jun 2023 11:32:21 +0100 Subject: [PATCH] fix mypy and codestyle issues --- capa/features/extractors/cape/extractor.py | 1 + capa/main.py | 3 ++- scripts/show-features.py | 1 - 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/capa/features/extractors/cape/extractor.py b/capa/features/extractors/cape/extractor.py index 2bd6a4ba..614a6564 100644 --- a/capa/features/extractors/cape/extractor.py +++ b/capa/features/extractors/cape/extractor.py @@ -26,6 +26,7 @@ class CapeExtractor(DynamicFeatureExtractor): self.behavior = behavior self.global_features = capa.features.extractors.cape.global_.extract_features(self.static) + def extract_global_features(self) -> Iterator[Tuple[Feature, Address]]: yield from self.global_features diff --git a/capa/main.py b/capa/main.py index ead475c0..80a6036d 100644 --- a/capa/main.py +++ b/capa/main.py @@ -21,7 +21,7 @@ import textwrap import itertools import contextlib import collections -from typing import Any, Dict, List, Tuple, Callable, cast, Union +from typing import Any, Dict, List, Tuple, Union, Callable, cast import halo import tqdm @@ -786,6 +786,7 @@ def collect_metadata( sha1 = hashlib.sha1() sha256 = hashlib.sha256() + assert isinstance(extractor, StaticFeatureExtractor) with open(sample_path, "rb") as f: buf = f.read() diff --git a/scripts/show-features.py b/scripts/show-features.py index 967d5f06..8aa40c5d 100644 --- a/scripts/show-features.py +++ b/scripts/show-features.py @@ -84,7 +84,6 @@ from capa.helpers import get_auto_format, log_unsupported_runtime_error from capa.features.common import FORMAT_AUTO, FORMAT_FREEZE, DYNAMIC_FORMATS, is_global_feature from capa.features.extractors.base_extractor import FeatureExtractor, StaticFeatureExtractor, DynamicFeatureExtractor - logger = logging.getLogger("capa.show-features")