Author: bugman Date: Sun Jun 22 17:46:45 2008 New Revision: 6415 URL: http://svn.gna.org/viewcvs/relax?rev=6415&view=rev Log: Updated the Relax_data_store.__repr__() method. 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=6415&r1=6414&r2=6415&view=diff ============================================================================== --- 1.3/data/__init__.py (original) +++ 1.3/data/__init__.py Sun Jun 22 17:46:45 2008 @@ -25,7 +25,8 @@ # Python module imports. -from re import match +from re import search +from string import split # relax module imports. from pipe_container import PipeContainer @@ -78,28 +79,40 @@ else: text = text + " None\n" - # Objects. + # Data store objects. text = text + "\n" - text = text + "Objects:\n" - for name in dir(self): - if match("^_", name) or name in dict.__dict__ or name == 'add' or name == 'instance': - continue - text = text + " %s: %s\n" % (name, `getattr(self, name)`) + text = text + "Data store objects:\n" + names = self.__class__.__dict__.keys() + names.sort() + for name in names: + # The object. + obj = getattr(self, name) - # Methods. - text = text + "\n" - text = text + "Methods:\n" - text = text + " __reset__, Reset the relax data storage object back to its initial state\n" - text = text + " add, Add a new data pipe container.\n" - + # The text. + if obj == None or type(obj) == str: + text = text + " %s %s: %s\n" % (name, type(obj), obj) + else: + text = text + " %s %s: %s\n" % (name, type(obj), split(obj.__doc__, '\n')[0]) # dict methods. text = text + "\n" text = text + "Inherited dictionary methods:\n" for name in dir(dict): - if match("^_", name): + # Skip special methods. + if search("^_", name): continue - text = text + " %s\n" % name + + # Skip overwritten methods. + if name in self.__class__.__dict__.keys(): + continue + + # The object. + obj = getattr(self, name) + + # The text. + text = text + " %s %s: %s\n" % (name, type(obj), split(obj.__doc__, '\n')[0]) + + # Return the text. return text