77import collections
88import collections .abc
99import contextlib
10+ import dataclasses
1011import logging
11- from typing import Any , Dict , List , Mapping , NamedTuple , Optional
12+ from typing import Any , Dict , List , Mapping , Optional
1213
1314from volatility3 .framework import constants , interfaces
1415
@@ -52,7 +53,8 @@ def __eq__(self, other):
5253 return dict (self ) == dict (other )
5354
5455
55- class ObjectInformation (NamedTuple ):
56+ @dataclasses .dataclass
57+ class ObjectInformation :
5658 """Contains common information useful/pertinent only to an individual
5759 object (like an instance)
5860
@@ -71,12 +73,12 @@ class ObjectInformation(NamedTuple):
7173 size : Optional [int ] = None
7274
7375 def __getitem__ (self , key ):
74- if key in self . _fields :
76+ if key in self :
7577 return getattr (self , key )
76- raise KeyError (f"NamedTuple does not have a key { key } " )
78+ raise KeyError (f"No { key } present in ObjectInformation " )
7779
7880 def __contains__ (self , key ):
79- return key in self . _fields
81+ return key in [ field . name for field in dataclasses . fields ( self )]
8082
8183
8284class ObjectInterface (metaclass = abc .ABCMeta ):
0 commit comments