Skip to content

Commit 24f2198

Browse files
Merge pull request #98 from MarkBaggett/master
Add __repr__ method
2 parents 692bb76 + 8ceef84 commit 24f2198

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Registry/Registry.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@ class RegistryValue(object):
107107
def __init__(self, vkrecord):
108108
self._vkrecord = vkrecord
109109

110+
def __repr__(self):
111+
return 'RegistryValue(name="{0}", value="{1}", type="{2}")'.format(self.name(), self.value(), self.value_type_str())
112+
110113
def name(self):
111114
"""
112115
Get the name of the value as a string.
@@ -252,6 +255,10 @@ def __str__(self):
252255
return "Registry Key %s with %d values and %d subkeys" % \
253256
(self.path(), len(self.values()), len(self.subkeys()))
254257

258+
def __repr__(self):
259+
return 'RegistryKey(name="{0}", path="{1}")'.format(self.name(), self.path())
260+
261+
255262
def __getitem__(self, key):
256263
return self.value(key)
257264

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

398+
def __repr__(self):
399+
return 'Registry(hive_name="{0}", hive_type="{1}")'.format(self.hive_name(), self.hive_type())
400+
391401
def hive_name(self):
392402
"""Returns the internal file name"""
393403
return self._regf.hive_name()

0 commit comments

Comments
 (0)