scripts: add type-related assert statements

This commit is contained in:
Yacine Elhamer
2023-06-26 21:06:35 +01:00
parent 3f5d08aedb
commit c74c8871f8
2 changed files with 4 additions and 2 deletions

View File

@@ -70,7 +70,7 @@ import capa.render.result_document as rd
from capa.helpers import get_file_taste
from capa.features.common import FORMAT_AUTO
from capa.features.freeze import Address
from capa.features.extractors.base_extractor import FeatureExtractor
from capa.features.extractors.base_extractor import StaticFeatureExtractor
logger = logging.getLogger("capa.show-capabilities-by-function")
@@ -167,9 +167,10 @@ def main(argv=None):
should_save_workspace = os.environ.get("CAPA_SAVE_WORKSPACE") not in ("0", "no", "NO", "n", None)
try:
extractor: FeatureExtractor = capa.main.get_extractor(
extractor = capa.main.get_extractor(
args.sample, args.format, args.os, args.backend, sig_paths, should_save_workspace
)
assert isinstance(extractor, StaticFeatureExtractor)
except capa.exceptions.UnsupportedFormatError:
capa.helpers.log_unsupported_format_error()
return -1