mirror of
https://github.com/volatilityfoundation/volatility3.git
synced 2026-09-28 04:24:53 +02:00
Move context, tidy up object model and add memory to test_rig.
This commit is contained in:
@@ -10,9 +10,16 @@ class ValidityRoutines(object):
|
||||
def type_check(self, value, valid_type):
|
||||
"""Checks that value is an instance of valid_type, and returns value if it is, or throws a TypeError otherwise"""
|
||||
if not isinstance(value, valid_type):
|
||||
raise TypeError(self.__class__.__name__ + " expected " + valid_type.__class__.__name__ + ", not " + type(value))
|
||||
print(repr(valid_type), repr(type(value).__name__))
|
||||
raise TypeError(self.__class__.__name__ + " expected " + valid_type.__name__ + ", not " + type(value).__name__)
|
||||
return value
|
||||
|
||||
def class_check(self, klass, valid_class):
|
||||
"""Checks that value is an instance of valid_type, and returns value if it is, or throws a TypeError otherwise"""
|
||||
if not issubclass(klass, valid_class):
|
||||
raise TypeError(self.__class__.__name__ + " expected " + valid_class.__name__ + ", not " + klass.__name__)
|
||||
return klass
|
||||
|
||||
def confirm(self, assertion, error):
|
||||
"""Acts like an assertion, but will not be disabled when __debug__ is disabled"""
|
||||
if not assertion:
|
||||
|
||||
Reference in New Issue
Block a user