mailr7650 - in /1.3: generic_fns/results.py prompt/results.py


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

Header


Content

Posted by edward on October 12, 2008 - 16:30:
Author: bugman
Date: Sun Oct 12 16:30:32 2008
New Revision: 7650

URL: http://svn.gna.org/viewcvs/relax?rev=7650&view=rev
Log:
Removed the 'format' arg from results.write() and results.display().

This is no longer used as the only supported format is now XML.


Modified:
    1.3/generic_fns/results.py
    1.3/prompt/results.py

Modified: 1.3/generic_fns/results.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/generic_fns/results.py?rev=7650&r1=7649&r2=7650&view=diff
==============================================================================
--- 1.3/generic_fns/results.py (original)
+++ 1.3/generic_fns/results.py Sun Oct 12 16:30:32 2008
@@ -61,30 +61,14 @@
         return 'columnar'
 
 
-def display(format='xml'):
-    """Displaying the results/contents of the current data pipe.
-
-    @keyword format:    The format of the displayed results.
-    @type format:       str
-    """
+def display():
+    """Displaying the results/contents of the current data pipe."""
 
     # Test if the current data pipe exists.
     pipes.test()
 
-    # Specific results writing function.
-    if format == 'xml':
-        write_function = ds.to_xml
-    elif format == 'columnar':
-        write_function = get_specific_fn('write_columnar_results', 
pipes.get_type(), raise_error=False)
-    else:
-        raise RelaxError, "Unknown format " + `format` + "."
-
-    # No function.
-    if not write_function:
-        raise RelaxError, "The " + format + " format is not currently 
supported for " + get_string(pipes.get_type()) + "."
-
     # Write the results.
-    write_function(sys.stdout)
+    ds.to_xml(sys.stdout)
 
 
 def read(file='results', directory=None):
@@ -135,7 +119,7 @@
         raise RelaxError, "The format of the results file " + `file_path` + 
" cannot be determined."
 
 
-def write(file="results", directory=None, force=False, format='columnar', 
compress_type=1, verbosity=1):
+def write(file="results", directory=None, force=False, compress_type=1, 
verbosity=1):
     """Create the results file."""
 
     # Test if the current data pipe exists.
@@ -145,23 +129,11 @@
     if directory == 'pipe_name':
         directory = pipes.cdp_name()
 
-    # Specific results writing function.
-    if format == 'xml':
-        write_function = ds.to_xml
-    elif format == 'columnar':
-        write_function = get_specific_fn('write_columnar_results', 
pipes.get_type(), raise_error=False)
-    else:
-        raise RelaxError, "Unknown format " + `format` + "."
-
-    # No function.
-    if not write_function:
-        raise RelaxError, "The " + format + " format is not currently 
supported for " + get_string(pipes.get_type()) + "."
-
     # Open the file for writing.
     results_file = open_write_file(file_name=file, dir=directory, 
force=force, compress_type=compress_type, verbosity=verbosity)
 
     # Write the results.
-    write_function(results_file)
+    ds.to_xml(results_file)
 
     # Close the results file.
     results_file.close()

Modified: 1.3/prompt/results.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/prompt/results.py?rev=7650&r1=7649&r2=7650&view=diff
==============================================================================
--- 1.3/prompt/results.py (original)
+++ 1.3/prompt/results.py Sun Oct 12 16:30:32 2008
@@ -42,23 +42,16 @@
         self.__relax__ = relax
 
 
-    def display(self, format='xml'):
-        """Function for displaying the results.
-
-        Keyword Arguments
-        ~~~~~~~~~~~~~~~~~
-
-        format:  The format of the output.
-        """
+    def display(self):
+        """Function for displaying the results."""
 
         # Function intro text.
         if self.__relax__.interpreter.intro:
-            text = sys.ps3 + "results.display("
-            text = text + "format=" + `format` + ")"
+            text = sys.ps3 + "results.display()"
             print text
 
         # Execute the functional code.
-        results.display(format=format)
+        results.display()
 
 
     def read(self, file='results', dir=None):
@@ -102,7 +95,7 @@
         results.read(file=file, directory=dir)
 
 
-    def write(self, file='results', dir='pipe_name', force=False, 
format='xml', compress_type=1):
+    def write(self, file='results', dir='pipe_name', force=False, 
compress_type=1):
         """Function for writing results to a file.
 
         Keyword Arguments
@@ -114,8 +107,6 @@
         dir:  The directory name.
 
         force:  A flag which if True will cause the results file to be 
overwritten.
-
-        format:  The format of the output.
 
         compress_type:  The type of compression to use when creating the 
file.
 
@@ -145,7 +136,6 @@
             text = text + "file=" + `file`
             text = text + ", dir=" + `dir`
             text = text + ", force=" + `force`
-            text = text + ", format=" + `format`
             text = text + ", compress_type=" + `compress_type` + ")"
             print text
 
@@ -161,13 +151,9 @@
         if type(force) != bool:
             raise RelaxBoolError, ('force flag', force)
 
-        # Format.
-        if type(format) != str:
-            raise RelaxStrError, ('format', format)
-
         # Compression type.
         if type(compress_type) != int:
             raise RelaxIntError, ('compression type', compress_type)
 
         # Execute the functional code.
-        results.write(file=file, directory=dir, force=force, format=format, 
compress_type=compress_type)
+        results.write(file=file, directory=dir, force=force, 
compress_type=compress_type)




Related Messages


Powered by MHonArc, Updated Sun Oct 12 17:20:03 2008