mirror of
https://github.com/volatilityfoundation/volatility3.git
synced 2026-09-28 12:34:53 +02:00
prefer KeysView iterable to lists
This commit is contained in:
@@ -411,18 +411,23 @@ class Version1Format(ISFormatTable):
|
||||
|
||||
@property
|
||||
def symbols(self) -> Iterable[str]:
|
||||
"""Returns an iterator of the symbol names."""
|
||||
return list(self._json_object.get("symbols", {}))
|
||||
"""Returns an iterable (KeysView) of the available symbol names."""
|
||||
return self._json_object.get("symbols", {}).keys()
|
||||
|
||||
@property
|
||||
def enumerations(self) -> Iterable[str]:
|
||||
"""Returns an iterator of the available enumerations."""
|
||||
return list(self._json_object.get("enums", {}))
|
||||
def enumerations(self) -> Iterable[Any]:
|
||||
"""Returns an iterable (KeysView) of the available enumerations."""
|
||||
return self._json_object.get("enums", {}).keys()
|
||||
|
||||
@property
|
||||
def types(self) -> Iterable[str]:
|
||||
"""Returns an iterator of the symbol type names."""
|
||||
return list(self._json_object.get("user_types", {})) + list(self.natives.types)
|
||||
def types(self):
|
||||
"""Returns an iterable (KeysView) of the available symbol type names."""
|
||||
# self.natives.types (set) is generally very small compared to user_types,
|
||||
# so the dict conversion overhead can be neglected
|
||||
return {
|
||||
**self._json_object.get("user_types", {}),
|
||||
**dict.fromkeys(self.natives.types),
|
||||
}.keys()
|
||||
|
||||
def get_type_class(self, name: str) -> Type[interfaces.objects.ObjectInterface]:
|
||||
return self._overrides.get(name, objects.AggregateType)
|
||||
|
||||
Reference in New Issue
Block a user