From 5729feff01dbef5d4ca8aabc55a920c8ca135c04 Mon Sep 17 00:00:00 2001 From: mr-tz Date: Wed, 4 Dec 2024 17:10:33 +0000 Subject: [PATCH] use proper str type --- capa/ida/plugin/model.py | 30 +----------------------------- capa/render/vverbose.py | 2 +- 2 files changed, 2 insertions(+), 30 deletions(-) diff --git a/capa/ida/plugin/model.py b/capa/ida/plugin/model.py index 0947bead6..532a398f1 100644 --- a/capa/ida/plugin/model.py +++ b/capa/ida/plugin/model.py @@ -553,35 +553,7 @@ def capa_doc_feature_to_display(self, feature: frzf.Feature) -> str: @param feature: capa feature read from doc """ - # Use the specific type from the feature instead of direct string assignment - FeatureType = Union[ - Literal[ - "os", - "arch", - "format", - "match", - "characteristic", - "export", - "import", - "section", - "function name", - "substring", - "regex", - "string", - "class", - "namespace", - "api", - "property", - "number", - "bytes", - "offset", - "mnemonic", - "operand number", - "operand offset", - "basic block", - ] - ] - key: FeatureType = feature.type + key = str(feature.type) value = feature.dict(by_alias=True).get(feature.type) if value: diff --git a/capa/render/vverbose.py b/capa/render/vverbose.py index c021bfbb0..1c2255e32 100644 --- a/capa/render/vverbose.py +++ b/capa/render/vverbose.py @@ -168,7 +168,7 @@ def render_feature( ): console.write(" " * indent) - key = feature.type + key = str(feature.type) value: Optional[str] if isinstance(feature, frzf.BasicBlockFeature): # i don't think it makes sense to have standalone basic block features.