Author: bugman Date: Tue Mar 13 04:41:54 2007 New Revision: 3163 URL: http://svn.gna.org/viewcvs/relax?rev=3163&view=rev Log: Removed the functions not used by relax from the 'generic_fns.pipes' module. The functions 'eliminate_unused_pipes()' and 'list_of_pipes()' have been deleted as they are not used anywhere within relax. The unit test for the 'eliminate_unused_pipes()' has also been deleted. Modified: 1.3/generic_fns/pipes.py 1.3/test_suite/unit_tests/generic_fns/test_pipes.py Modified: 1.3/generic_fns/pipes.py URL: http://svn.gna.org/viewcvs/relax/1.3/generic_fns/pipes.py?rev=3163&r1=3162&r2=3163&view=diff ============================================================================== --- 1.3/generic_fns/pipes.py (original) +++ 1.3/generic_fns/pipes.py Tue Mar 13 04:41:54 2007 @@ -19,9 +19,6 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # # ############################################################################### - -# Python module imports. -from copy import deepcopy # relax module imports. from data import Data @@ -96,53 +93,3 @@ # Set the current data pipe to None if it is the deleted data pipe. if relax_data_store.current_pipe == pipe_name: relax_data_store.current_pipe = None - - -def eliminate_unused_pipes(): - """Function for eliminating any data pipes for which there is no data.""" - - # An array of data pipes to retain. - keep_pipes = [] - - # Find out if any data in 'relax_data_store' is assigned to a data pipe. - for name in dir(relax_data_store): - # Skip to the next data structure if the object is not a dictionary. - object = getattr(relax_data_store, name) - if not hasattr(object, 'keys'): - continue - - # Add the keys to 'keep_pipes'. - for key in object.keys(): - if not key in keep_pipes: - keep_pipes.append(key) - - # Delete the data pipes in 'relax_data_store.pipe_names' and 'relax_data_store.pipe_types' which are not in 'keep_pipes'. - for pipe in relax_data_store.pipe_names: - if not pipe in keep_pipes: - # Index. - index = relax_data_store.pipe_names.index(pipe) - - # Remove from pipe_names. - relax_data_store.pipe_names.remove(pipe) - - # Remove from pipe_types. - temp = relax_data_store.pipe_types.pop(index) - - -def list_of_pipes(pipe): - """Function for creating a list of data pipes.""" - - # All data pipes. - if pipe == None: - pipes = deepcopy(relax_data_store.pipe_names) - - # Single data pipe. - elif type(pipe) == str: - pipes = [pipe] - - # List of data pipes. - else: - pipes = pipe - - # Return the list. - return pipes Modified: 1.3/test_suite/unit_tests/generic_fns/test_pipes.py URL: http://svn.gna.org/viewcvs/relax/1.3/test_suite/unit_tests/generic_fns/test_pipes.py?rev=3163&r1=3162&r2=3163&view=diff ============================================================================== --- 1.3/test_suite/unit_tests/generic_fns/test_pipes.py (original) +++ 1.3/test_suite/unit_tests/generic_fns/test_pipes.py Tue Mar 13 04:41:54 2007 @@ -118,22 +118,3 @@ # Assert that a RelaxNoRunError occurs when the data pipe does not exist. self.assertRaises(RelaxNoRunError, pipes.delete, 'x') - - - def test_unused_cleanup(self): - """Test the removal of empty data pipes. - - The function tests is generic_fns.pipes.eliminate_unused_pipes(). - """ - - # The name of the empty pipe. - name = 'empty' - - # Execute the cleanup function. - pipes.eliminate_unused_pipes() - - # Test that the data pipe no longer exists. - self.assert_(not relax_data_store.has_key(name)) - - # Test that the current pipe is None (as the current pipe was the empty pipe). - self.assertEqual(relax_data_store.current_pipe, None)