mirror of
https://github.com/volatilityfoundation/volatility3.git
synced 2026-09-30 13:34:53 +02:00
Refactor check of BasicType
The intention is either a BasicType or a list where each element is only a BasicType (and not a list).
This commit is contained in:
@@ -554,11 +554,15 @@ class Volshell(interfaces.plugins.PluginInterface):
|
||||
del kwargs[argname]
|
||||
|
||||
for keyword, val in kwargs.items():
|
||||
if not isinstance(val, (interfaces.configuration.BasicTypes, list)):
|
||||
if all(isinstance(x, interfaces.configuration.BasicTypes) for x in val):
|
||||
raise TypeError(
|
||||
"Configurable values must be simple types (int, bool, str, bytes)"
|
||||
)
|
||||
BasicType_or_list_of_BasicType = False # excludes list of lists
|
||||
if isinstance(val, interfaces.configuration.BasicTypes):
|
||||
BasicType_or_list_of_BasicType = True
|
||||
if all(isinstance(x, interfaces.configuration.BasicTypes) for x in val):
|
||||
BasicType_or_list_of_BasicType = True
|
||||
if not BasicType_or_list_of_BasicType:
|
||||
raise TypeError(
|
||||
"Configurable values must be simple types (int, bool, str, bytes)"
|
||||
)
|
||||
self.context.config[config_path + "." + keyword] = val
|
||||
|
||||
constructed = clazz(self.context, config_path, **constructor_args)
|
||||
|
||||
Reference in New Issue
Block a user