[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet-python] 05/12: Add '_Key.__repr__()' to eliminate redundant code
From: |
gnunet |
Subject: |
[gnunet-python] 05/12: Add '_Key.__repr__()' to eliminate redundant code in subclasses. |
Date: |
Sun, 12 Apr 2020 23:22:23 +0200 |
This is an automated email from the git hooks/post-receive script.
htgoebel pushed a commit to branch master
in repository gnunet-python.
commit cc1e04b00f7f4f3dc085bcff666548510ef597da
Author: Hartmut Goebel <address@hidden>
AuthorDate: Sat Jan 19 20:33:02 2019 +0100
Add '_Key.__repr__()' to eliminate redundant code in subclasses.
---
gnunet/__init__.py | 7 ++++---
gnunet/crypto.py | 3 ---
2 files changed, 4 insertions(+), 6 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:
def __str__(self):
return strings.data_to_string(self._data)
+ def __repr__(self):
+ cls = self.__class__
+ return "%s.%s(%r)" % (cls.__module__, cls.__name__, str(self))
+
class HashCode(_Key):
__bits__ = 512
-
- def __repr__(self):
- return "gnunet.HashCode('" + str(self) + "')"
diff --git a/gnunet/crypto.py b/gnunet/crypto.py
index 253f46e..5a82c0d 100644
--- a/gnunet/crypto.py
+++ b/gnunet/crypto.py
@@ -4,6 +4,3 @@ import gnunet.strings as strings
class EcdsaPublicKey(_Key):
__bits__ = 256
-
- def __repr__(self):
- return "gnunet.crypto.EcdsaPublicKey('" + str(self) + "')"
--
To stop receiving notification emails like this one, please contact
address@hidden.
- [gnunet-python] branch master updated (bda184f -> a3707a2), gnunet, 2020/04/12
- [gnunet-python] 01/12: Add a small test-suite., gnunet, 2020/04/12
- [gnunet-python] 04/12: Avoid "During handling of the above exception" when re-raising., gnunet, 2020/04/12
- [gnunet-python] 02/12: Extend .gitignore., gnunet, 2020/04/12
- [gnunet-python] 03/12: Simplify initiation of `_Key` and subclasses., gnunet, 2020/04/12
- [gnunet-python] 07/12: Add test-cases for strings.string_to_absolute_time., gnunet, 2020/04/12
- [gnunet-python] 06/12: Use relative imports., gnunet, 2020/04/12
- [gnunet-python] 05/12: Add '_Key.__repr__()' to eliminate redundant code in subclasses.,
gnunet <=
- [gnunet-python] 08/12: Replace spaghetti code by loops., gnunet, 2020/04/12
- [gnunet-python] 09/12: Add test-cases for strings.data_to_string and string_to_data., gnunet, 2020/04/12
- [gnunet-python] 10/12: Mark strings.encTable as private., gnunet, 2020/04/12
- [gnunet-python] 11/12: Use upper-case names for global constant values., gnunet, 2020/04/12
- [gnunet-python] 12/12: Break some very long lines and some other minor code-cleanup., gnunet, 2020/04/12