mailr14400 - in /branches/gui_testing/multi: __init__.py prependStringIO.py processor.py processor_io.py


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

Header


Content

Posted by edward on August 19, 2011 - 12:28:
Author: bugman
Date: Fri Aug 19 12:28:30 2011
New Revision: 14400

URL: http://svn.gna.org/viewcvs/relax?rev=14400&view=rev
Log:
Renamed the prependStringIO module to processor_io in preparation for a 
redesign.


Added:
    branches/gui_testing/multi/processor_io.py
      - copied unchanged from r14398, 
branches/gui_testing/multi/prependStringIO.py
Removed:
    branches/gui_testing/multi/prependStringIO.py
Modified:
    branches/gui_testing/multi/__init__.py
    branches/gui_testing/multi/processor.py

Modified: branches/gui_testing/multi/__init__.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/gui_testing/multi/__init__.py?rev=14400&r1=14399&r2=14400&view=diff
==============================================================================
--- branches/gui_testing/multi/__init__.py (original)
+++ branches/gui_testing/multi/__init__.py Fri Aug 19 12:28:30 2011
@@ -1,6 +1,7 @@
 
###############################################################################
 #                                                                            
 #
 # Copyright (C) 2007 Gary S Thompson (https://gna.org/users/varioustoxins)   
 #
+# Copyright (C) 2011 Edward d'Auvergne                                       
 #
 #                                                                            
 #
 # This file is part of the program relax.                                    
 #
 #                                                                            
 #
@@ -24,7 +25,7 @@
 __all__ = ['commands',
            'mpi4py_processor',
            'multi_processor_base',
-           'prependStringIO',
+           'processor_io',
            'processor',
            'uni_processor']
 

Removed: branches/gui_testing/multi/prependStringIO.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/gui_testing/multi/prependStringIO.py?rev=14399&view=auto
==============================================================================
--- branches/gui_testing/multi/prependStringIO.py (original)
+++ branches/gui_testing/multi/prependStringIO.py (removed)
@@ -1,118 +1,0 @@
-###############################################################################
-#                                                                            
 #
-# Copyright (C) 2007 Gary S Thompson (https://gna.org/users/varioustoxins)   
 #
-#                                                                            
 #
-# This file is part of the program relax.                                    
 #
-#                                                                            
 #
-# relax is free software; you can redistribute it and/or modify              
 #
-# it under the terms of the GNU General Public License as published by       
 #
-# the Free Software Foundation; either version 2 of the License, or          
 #
-# (at your option) any later version.                                        
 #
-#                                                                            
 #
-# relax is distributed in the hope that it will be useful,                   
 #
-# but WITHOUT ANY WARRANTY; without even the implied warranty of             
 #
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              
 #
-# GNU General Public License for more details.                               
 #
-#                                                                            
 #
-# You should have received a copy of the GNU General Public License          
 #
-# along with relax; if not, write to the Free Software                       
 #
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA  
 #
-#                                                                            
 #
-###############################################################################
-
-# Python module imports.
-from StringIO import StringIO
-import sys
-from threading import currentThread
-
-
-class PrependOut:
-    """Class for adding a token to the end of all newlines."""
-
-    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
-        """
-
-        # Execute the base class __init__() method.
-        StringIO.__init__(self)
-
-        # Store the args.
-        self.token = token
-        self.stream = stream
-
-
-    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 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()

Modified: branches/gui_testing/multi/processor.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/gui_testing/multi/processor.py?rev=14400&r1=14399&r2=14400&view=diff
==============================================================================
--- branches/gui_testing/multi/processor.py (original)
+++ branches/gui_testing/multi/processor.py Fri Aug 19 12:28:30 2011
@@ -103,7 +103,7 @@
 import traceback, textwrap
 
 # relax module imports.
-from multi.prependStringIO import PrependStringIO, PrependOut
+from multi.processor_io import PrependStringIO, PrependOut
 from relax_errors import RelaxError
 
 
@@ -754,7 +754,7 @@
                 STDOUT and STDERR are always available in sys.__stdout__ and 
sys.__stderr__.
         @note:  The sys.stdout and sys.stderr streams are not replaced by 
this function but by
                 calling capture_stdio all it does is save replacements to 
self.stdio_capture.
-        @see:   multi.prependStringIO.
+        @see:   multi.processor_io.
         @see:   multi.processor.restore_stdio.
         @see:   multi.processor.capture_stdio.
         @see:   sys.




Related Messages


Powered by MHonArc, Updated Mon Aug 22 15:00:02 2011