Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions volatility3/framework/interfaces/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
import collections
import collections.abc
import contextlib
import dataclasses
import logging
from typing import Any, Dict, List, Mapping, NamedTuple, Optional
from typing import Any, Dict, List, Mapping, Optional

from volatility3.framework import constants, interfaces

Expand Down Expand Up @@ -52,7 +53,8 @@ def __eq__(self, other):
return dict(self) == dict(other)


class ObjectInformation(NamedTuple):
@dataclasses.dataclass
class ObjectInformation:
"""Contains common information useful/pertinent only to an individual
object (like an instance)

Expand All @@ -71,12 +73,12 @@ class ObjectInformation(NamedTuple):
size: Optional[int] = None

def __getitem__(self, key):
if key in self._fields:
if key in self:
return getattr(self, key)
raise KeyError(f"NamedTuple does not have a key {key}")
raise KeyError(f"No {key} present in ObjectInformation")

def __contains__(self, key):
return key in self._fields
return key in [field.name for field in dataclasses.fields(self)]


class ObjectInterface(metaclass=abc.ABCMeta):
Expand Down
Loading