From 3e50d12b01826cebe2a5be9d5a017cb35cf36e62 Mon Sep 17 00:00:00 2001 From: student Date: Tue, 5 May 2020 07:18:46 -0700 Subject: [PATCH] add __repr__ backwards compatible --- Registry/Registry.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Registry/Registry.py b/Registry/Registry.py index a7c8d45..437079a 100644 --- a/Registry/Registry.py +++ b/Registry/Registry.py @@ -108,8 +108,8 @@ def __init__(self, vkrecord): self._vkrecord = vkrecord def __repr__(self): - return f"RegistryValue(name={self.name()}, value={self.value()}, type={self.value_type_str()})" - + return 'RegistryValue(name="{0}", value="{1}", type="{2}")'.format(self.name(), self.value(), self.value_type_str()) + def name(self): """ Get the name of the value as a string. @@ -255,6 +255,9 @@ def __str__(self): return "Registry Key %s with %d values and %d subkeys" % \ (self.path(), len(self.values()), len(self.subkeys())) + def __repr__(self): + return 'RegistryKey(name="{0}", path="{1}")'.format(self.name(), self.path()) + def __repr__(self): return f"RegistryKey(name={self.name()}, path={self.path()})" @@ -395,8 +398,8 @@ def __init__(self, filelikeobject): self._regf = RegistryParse.REGFBlock(self._buf, 0, False) def __repr__(self): - return f"Registry(hive_name={self.hive_name()}, hive_type={self.hive_type()})" - + return 'Registry(hive_name="{0}", hive_type="{1}")'.format(self.hive_name(), self.hive_type()) + def hive_name(self): """Returns the internal file name""" return self._regf.hive_name()