Author: bugman Date: Tue Mar 13 04:38:11 2007 New Revision: 3159 URL: http://svn.gna.org/viewcvs/relax?rev=3159&view=rev Log: Rewrote the 'generic_fns.pipes.delete()' function. Modified: 1.3/generic_fns/pipes.py Modified: 1.3/generic_fns/pipes.py URL: http://svn.gna.org/viewcvs/relax/1.3/generic_fns/pipes.py?rev=3159&r1=3158&r2=3159&view=diff ============================================================================== --- 1.3/generic_fns/pipes.py (original) +++ 1.3/generic_fns/pipes.py Tue Mar 13 04:38:11 2007 @@ -74,27 +74,18 @@ def delete(pipe_name=None): - """Function for deleting a data pipe.""" + """Delete a data pipe. + + @param pipe_name: The name of the data pipe to delete. + @type pipe_name: str + """ # Test if the data pipe exists. - if pipe_name != None and not pipe_name in relax_data_store.pipe_names: + if pipe_name != None and not relax_data_store.has_key(pipe_name): raise RelaxNoRunError, pipe_name - # Find out if any data in 'relax_data_store' is assigned to a data pipe. - for name in dir(relax_data_store): - # Get the object. - object = getattr(relax_data_store, name) - - # Skip to the next data structure if the object is not a dictionary. - if not hasattr(object, 'keys'): - continue - - # Delete the data if the object contains the key 'pipe_name'. - if object.has_key(pipe_name): - del(object[pipe_name]) - - # Clean up the data pipes, ie delete any data pipes for which there is no data left. - eliminate_unused_pipes() + # Delete the data pipe. + del relax_data_store[pipe_name] def eliminate_unused_pipes():