aboutsummaryrefslogtreecommitdiff
path: root/gnunet/__init__.py
diff options
context:
space:
mode:
authorHartmut Goebel <h.goebel@crazy-compilers.com>2019-01-19 20:33:02 +0100
committerHartmut Goebel <h.goebel@crazy-compilers.com>2019-01-19 20:33:02 +0100
commitcc1e04b00f7f4f3dc085bcff666548510ef597da (patch)
treed34fbc4037ad5dacc44ba6bbaf81aac617b70e1b /gnunet/__init__.py
parent602cde1ebff40544c66ae769426825b5fc400167 (diff)
downloadgnunet-python-cc1e04b00f7f4f3dc085bcff666548510ef597da.tar.gz
gnunet-python-cc1e04b00f7f4f3dc085bcff666548510ef597da.zip
Add '_Key.__repr__()' to eliminate redundant code in subclasses.
Diffstat (limited to 'gnunet/__init__.py')
-rw-r--r--gnunet/__init__.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/gnunet/__init__.py b/gnunet/__init__.py
index 5bae6f0..4ba5bd7 100644
--- a/gnunet/__init__.py
+++ b/gnunet/__init__.py
@@ -28,9 +28,10 @@ class _Key:
28 def __str__(self): 28 def __str__(self):
29 return strings.data_to_string(self._data) 29 return strings.data_to_string(self._data)
30 30
31 def __repr__(self):
32 cls = self.__class__
33 return "%s.%s(%r)" % (cls.__module__, cls.__name__, str(self))
34
31 35
32class HashCode(_Key): 36class HashCode(_Key):
33 __bits__ = 512 37 __bits__ = 512
34
35 def __repr__(self):
36 return "gnunet.HashCode('" + str(self) + "')"