mirror of
https://github.com/mandiant/capa.git
synced 2026-04-28 11:53:20 -07:00
fix: type: ignore placement for Pydantic alias parameters in freeze/__init__.py
This commit is contained in:
committed by
Willi Ballenthin
parent
aa502d3523
commit
eb0d313264
@@ -387,11 +387,11 @@ def dumps_static(extractor: StaticFeatureExtractor) -> str:
|
||||
bbaddr = Address.from_capa(bb.address)
|
||||
bbfeatures = [
|
||||
BasicBlockFeature(
|
||||
basic_block=bbaddr,
|
||||
basic_block=bbaddr, # type: ignore[call-arg]
|
||||
address=Address.from_capa(addr),
|
||||
feature=feature_from_capa(feature),
|
||||
) # type: ignore
|
||||
# Mypy is unable to recognise `basic_block` as an argument due to alias
|
||||
)
|
||||
# type checkers are unable to recognise `basic_block` as an argument due to alias
|
||||
for feature, addr in extractor.extract_basic_block_features(f, bb)
|
||||
]
|
||||
|
||||
@@ -426,27 +426,27 @@ def dumps_static(extractor: StaticFeatureExtractor) -> str:
|
||||
FunctionFeatures(
|
||||
address=faddr,
|
||||
features=tuple(ffeatures),
|
||||
basic_blocks=basic_blocks,
|
||||
) # type: ignore
|
||||
# Mypy is unable to recognise `basic_blocks` as an argument due to alias
|
||||
basic_blocks=basic_blocks, # type: ignore[call-arg]
|
||||
)
|
||||
# type checkers are unable to recognise `basic_blocks` as an argument due to alias
|
||||
)
|
||||
|
||||
features = StaticFeatures(
|
||||
global_=global_features,
|
||||
global_=global_features, # type: ignore[call-arg]
|
||||
file=tuple(file_features),
|
||||
functions=tuple(function_features),
|
||||
) # type: ignore
|
||||
# Mypy is unable to recognise `global_` as an argument due to alias
|
||||
)
|
||||
# type checkers are unable to recognise `global_` as an argument due to alias
|
||||
|
||||
freeze = Freeze(
|
||||
version=CURRENT_VERSION,
|
||||
base_address=Address.from_capa(extractor.get_base_address()),
|
||||
base_address=Address.from_capa(extractor.get_base_address()), # type: ignore[call-arg]
|
||||
sample_hashes=extractor.get_sample_hashes(),
|
||||
flavor="static",
|
||||
extractor=Extractor(name=extractor.__class__.__name__),
|
||||
features=features,
|
||||
) # type: ignore
|
||||
# Mypy is unable to recognise `base_address` as an argument due to alias
|
||||
)
|
||||
# type checkers are unable to recognise `base_address` as an argument due to alias
|
||||
|
||||
return freeze.model_dump_json()
|
||||
|
||||
@@ -536,11 +536,11 @@ def dumps_dynamic(extractor: DynamicFeatureExtractor) -> str:
|
||||
)
|
||||
|
||||
features = DynamicFeatures(
|
||||
global_=global_features,
|
||||
global_=global_features, # type: ignore[call-arg]
|
||||
file=tuple(file_features),
|
||||
processes=tuple(process_features),
|
||||
) # type: ignore
|
||||
# Mypy is unable to recognise `global_` as an argument due to alias
|
||||
)
|
||||
# type checkers are unable to recognise `global_` as an argument due to alias
|
||||
|
||||
# workaround around mypy issue: https://github.com/python/mypy/issues/1424
|
||||
get_base_addr = getattr(extractor, "get_base_address", None)
|
||||
@@ -548,13 +548,13 @@ def dumps_dynamic(extractor: DynamicFeatureExtractor) -> str:
|
||||
|
||||
freeze = Freeze(
|
||||
version=CURRENT_VERSION,
|
||||
base_address=Address.from_capa(base_addr),
|
||||
base_address=Address.from_capa(base_addr), # type: ignore[call-arg]
|
||||
sample_hashes=extractor.get_sample_hashes(),
|
||||
flavor="dynamic",
|
||||
extractor=Extractor(name=extractor.__class__.__name__),
|
||||
features=features,
|
||||
) # type: ignore
|
||||
# Mypy is unable to recognise `base_address` as an argument due to alias
|
||||
)
|
||||
# type checkers are unable to recognise `base_address` as an argument due to alias
|
||||
|
||||
return freeze.model_dump_json()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user