Skip to content

Commit

Permalink
add __repr__ backwards compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkBaggett committed May 5, 2020
1 parent a7bd535 commit 3e50d12
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions Registry/Registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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()})"

Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 3e50d12

Please sign in to comment.