mailr3106 - /1.3/data/__init__.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on March 08, 2007 - 05:47:
Author: bugman
Date: Thu Mar  8 05:46:36 2007
New Revision: 3106

URL: http://svn.gna.org/viewcvs/relax?rev=3106&view=rev
Log:
Rewrote the __repr__() method of the relax data storage object.


Modified:
    1.3/data/__init__.py

Modified: 1.3/data/__init__.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/data/__init__.py?rev=3106&r1=3105&r2=3106&view=diff
==============================================================================
--- 1.3/data/__init__.py (original)
+++ 1.3/data/__init__.py Thu Mar  8 05:46:36 2007
@@ -59,12 +59,42 @@
 
 
     def __repr__(self):
-        text = "The data class containing all permanent program data.\n"
-        text = text + "The class contains the following objects:\n"
+        """The string representation of the object.
+
+        Rather than using the standard Python conventions (either the string 
representation of the
+        value or the "<...desc...>" notation), a rich-formatted description 
of the object is given.
+        """
+
+        # Intro text.
+        text = "The relax data storage object.\n"
+
+        # The data pipes.
+        text = text + "\n"
+        text = text + "Data pipes:\n"
+        pipes = self.keys()
+        if pipes:
+            for pipe in pipes:
+                text = text + "  %s\n" % `pipe`
+        else:
+            text = text + "  None\n"
+
+        # Objects.
+        text = text + "\n"
+        text = text + "Objects:\n"
         for name in dir(self):
             if match("^_", name):
                 continue
-            text = text + "  " + name + ", " + `type(getattr(self, name))` + 
"\n"
+            if name in DictType.__dict__:
+                continue
+            text = text + "  %s, %s\n" % (name, `type(getattr(self, name))`)
+
+        # DictType methods.
+        text = text + "\n"
+        text = text + "Dictionary type methods:\n"
+        for name in dir(DictType):
+            if match("^_", name):
+                continue
+            text = text + "  %s, %s\n" % (name, `type(getattr(self, name))`)
         return text
 
 




Related Messages


Powered by MHonArc, Updated Thu Mar 08 06:00:07 2007