Skip to content

Commit

Permalink
Merge pull request #98 from MarkBaggett/master
Browse files Browse the repository at this point in the history
Add __repr__ method
  • Loading branch information
williballenthin authored May 5, 2020
2 parents 692bb76 + 8ceef84 commit 24f2198
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Registry/Registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ class RegistryValue(object):
def __init__(self, vkrecord):
self._vkrecord = vkrecord

def __repr__(self):
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 @@ -252,6 +255,10 @@ 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 __getitem__(self, key):
return self.value(key)

Expand Down Expand Up @@ -388,6 +395,9 @@ def __init__(self, filelikeobject):
self._buf = f.read()
self._regf = RegistryParse.REGFBlock(self._buf, 0, False)

def __repr__(self):
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 24f2198

Please sign in to comment.