[codeface] [PATCH v2 03/24] Add __str__ for PersonInfo for better debugging

  • From: Claus Hunsen <hunsen@xxxxxxxxxxxxxxxxx>
  • To: codeface@xxxxxxxxxxxxx
  • Date: Thu, 1 Dec 2016 17:10:57 +0100

For better debugging in IDEs such as PyCharm, the __str__ method for the
PersonInfo class provides a proper character string for the variables
view.

The string representing a person is "Name <email>".

Signed-off-by: Claus Hunsen <hunsen@xxxxxxxxxxxxxxxxx>
Acked-by: Wolfgang Mauerer <wolfgang.mauerer@xxxxxxxxxxxxxxxxx>
---
 codeface/cluster/PersonInfo.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/codeface/cluster/PersonInfo.py b/codeface/cluster/PersonInfo.py
index fe4229a..497085f 100644
--- a/codeface/cluster/PersonInfo.py
+++ b/codeface/cluster/PersonInfo.py
@@ -168,6 +168,9 @@ class PersonInfo:
         #a given ID
         self.file_links_recieved_by_id = {}
 
+    def __str__(self):
+        return self.name + " <" + self.email + ">"
+
     def setID(self, ID):
         self.ID = ID
     def getID(self):
-- 
2.10.2


Other related posts:

  • » [codeface] [PATCH v2 03/24] Add __str__ for PersonInfo for better debugging - Claus Hunsen