mailr15401 - /1.3/multi/processor_io.py


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

Header


Content

Posted by edward on February 29, 2012 - 10:54:
Author: bugman
Date: Wed Feb 29 10:54:11 2012
New Revision: 15401

URL: http://svn.gna.org/viewcvs/relax?rev=15401&view=rev
Log:
Clean up of the processor IO module.

The now unused IO_filter and PrependStringIO classes have been eliminated and 
the imports all
removed.


Modified:
    1.3/multi/processor_io.py

Modified: 1.3/multi/processor_io.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/multi/processor_io.py?rev=15401&r1=15400&r2=15401&view=diff
==============================================================================
--- 1.3/multi/processor_io.py (original)
+++ 1.3/multi/processor_io.py Wed Feb 29 10:54:11 2012
@@ -21,108 +21,8 @@
 #                                                                            
 #
 
###############################################################################
 
-# Python module imports.
-from StringIO import StringIO
-import sys
-from threading import currentThread
-
-
-class IO_filter:
-    """Mimic and IO stream file object, prepending a token to each line of 
written text."""
-
-    def __init__(self, token, stream):
-        """Set up the class for stream manipulation.
-
-        @param token:   The string to add to the end of all newlines.
-        @type token:    str
-        @param stream:  The IO stream
-        @type stream:   IO stream
-        """
-
-        # Store the args.
-        self.token = token
-        self.stream = stream
-
-
-    def flush(self):
-        """Implement the flush() file method."""
-
-
-    def write(self, string):
-        """Replacement write() method for prepending the token to each line 
of STDOUT and STDERR.
-
-        @param string:  The line of text to write to STDOUT or STDERR.
-        @type string:   str
-        """
-
-        # Append the token to all newline chars.
-        string = string.replace('\n', '\n' + self.token)
-
-        # Write the string to the stream.
-        self.stream.write(string)
-
-        # Flush both STDOUT and STDERR.
-        sys.stdout.flush()
-        sys.stderr.flush()
-
-
-class PrependStringIO(StringIO):
-    """Class for adding a token to the end of all newlines."""
-
-    def __init__(self, token, stream=None):
-        """Set up the class for stream manipulation.
-
-        @param token:   The string to add to the end of all newlines.
-        @type token:    str
-        @param stream:  The IO stream
-        @type stream:   IO stream
-        """
-
-        # Execute the base class __init__() method.
-        StringIO.__init__(self)
-
-        # Store the args.
-        self.token = token
-
-        # Set up the stream.
-        if stream == None:
-            self.stream = self
-        else:
-            self.stream = stream
-
-        # Initialise.
-        self.token_length = len(token)
-        self.first_time = True
-
-
-    def flush(self):
-        """Implement the flush() file method."""
-
-
-    def write(self, string):
-        """Replacement write() method for prepending the token to each line 
of STDOUT and STDERR.
-
-        @param string:  The line of text to write to STDOUT or STDERR.
-        @type string:   str
-        """
-
-        # FIXME: raising an exception here wedges mpi4py
-
-        # Append the token to all newline chars.
-        string = string.replace('\n', '\n' + self.token)
-
-        # Handle the first line of output.
-        if self.first_time == True:
-            string = '\n' + self.token + string
-            self.first_time = False
-
-        # Write the string to the stream.
-        StringIO.write(self.stream, string)
-
-        # Flush both STDOUT and STDERR.
-        sys.stdout.flush()
-        sys.stderr.flush()
-
+# Module docstring.
+"""Module containing classes for IO stream capture on slave processors."""
 
 
 class Redirect_text(object):




Related Messages


Powered by MHonArc, Updated Wed Feb 29 11:20:02 2012