Skip to content

Commit

Permalink
use proper str type
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-tz committed Dec 4, 2024
1 parent 4103b10 commit 5729fef
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 30 deletions.
30 changes: 1 addition & 29 deletions capa/ida/plugin/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion capa/render/vverbose.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 5729fef

Please sign in to comment.