mirror of
https://github.com/volatilityfoundation/volatility3.git
synced 2026-09-05 01:07:38 +02:00
Improve style to use default iterators rather than explicit ones.
This commit is contained in:
@@ -28,7 +28,7 @@ class Volshell(interfaces.plugins.PluginInterface):
|
||||
config = self.config
|
||||
layer_name = self.config['primary']
|
||||
kvo = context.memory[layer_name].config.get('kernel_virtual_offset')
|
||||
members = lambda x: list(sorted(x.vol.members.keys()))
|
||||
members = lambda x: list(sorted(x.vol.members))
|
||||
|
||||
# Determine locals
|
||||
curframe = inspect.currentframe()
|
||||
|
||||
@@ -617,7 +617,7 @@ class Struct(interfaces.objects.ObjectInterface):
|
||||
|
||||
def __dir__(self) -> typing.Iterable[str]:
|
||||
"""Returns a complete list of members when dir is called"""
|
||||
return list(super().__dir__()) + list(self.vol.members.keys())
|
||||
return list(super().__dir__()) + list(self.vol.members)
|
||||
|
||||
def write(self, value):
|
||||
raise TypeError("Structs cannot be written to directly, individual members must be written instead")
|
||||
|
||||
@@ -49,7 +49,7 @@ class SymbolSpace(interfaces.symbols.SymbolSpaceInterface, validity.ValidityRout
|
||||
|
||||
def get_symbols_by_type(self, type_name: str) -> typing.Iterable[str]:
|
||||
"""Returns all symbols based on the type of the symbol"""
|
||||
for table in self._dict.keys():
|
||||
for table in self._dict:
|
||||
for symbol_name in self._dict[table].get_symbols_by_type(type_name):
|
||||
yield table + constants.BANG + symbol_name
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ class IntermediateSymbolTable(interfaces.symbols.SymbolTableInterface):
|
||||
changes have been made) than the consumer (in this case, the file reader).
|
||||
"""
|
||||
supported, age, revision = [int(x) for x in version.split(".")]
|
||||
supported_versions = [x for x in versions.keys() if x[0] == supported and x[1] >= age]
|
||||
supported_versions = [x for x in versions if x[0] == supported and x[1] >= age]
|
||||
if not supported_versions:
|
||||
raise ValueError(
|
||||
"No Intermediate Format interface versions support file interface version: {}".format(version))
|
||||
@@ -258,17 +258,17 @@ class Version1Format(ISFormatTable):
|
||||
@property
|
||||
def symbols(self) -> typing.Iterable[str]:
|
||||
"""Returns an iterator of the symbol names"""
|
||||
return self._json_object.get('symbols', {}).keys()
|
||||
return list(self._json_object.get('symbols', {}))
|
||||
|
||||
@property
|
||||
def enumerations(self) -> typing.Iterable[str]:
|
||||
"""Returns an iterator of the available enumerations"""
|
||||
return self._json_object.get('enums', {}).keys()
|
||||
return list(self._json_object.get('enums', {}))
|
||||
|
||||
@property
|
||||
def types(self) -> typing.Iterable[str]:
|
||||
"""Returns an iterator of the symbol type names"""
|
||||
return list(self._json_object.get('user_types', {}).keys()) + list(self.natives.types)
|
||||
return list(self._json_object.get('user_types', {})) + list(self.natives.types)
|
||||
|
||||
def get_type_class(self, name: str) -> typing.Type[interfaces.objects.ObjectInterface]:
|
||||
return self._overrides.get(name, objects.Struct)
|
||||
|
||||
Reference in New Issue
Block a user