Author: bugman
Date: Thu Dec 18 10:35:22 2014
New Revision: 27124
URL: http://svn.gna.org/viewcvs/relax?rev=27124&view=rev
Log:
Implemented the lib.io.swap_extension() function.
This is confirmed to be fully functional by its four unit tests.
Modified:
trunk/lib/io.py
Modified: trunk/lib/io.py
URL:
http://svn.gna.org/viewcvs/relax/trunk/lib/io.py?rev=27124&r1=27123&r2=27124&view=diff
==============================================================================
--- trunk/lib/io.py (original)
+++ trunk/lib/io.py Thu Dec 18 10:35:22 2014
@@ -539,6 +539,28 @@
return new
+def swap_extension(file=None, ext=None):
+ """Swap one file name extension for another.
+
+ @keyword file: The name of the original file.
+ @type file: str
+ @keyword ext: The new file name extension to use.
+ @type ext: str
+ @return: The name of the file with the new file name extension.
+ @rtype: str
+ """
+
+ # The file root.
+ new_file = file_root(file)
+
+ # Add the new extension.
+ new_file += '.'
+ new_file += ext
+
+ # Return the new file name.
+ return new_file
+
+
def test_binary(binary):
"""Function for testing that the binary string corresponds to a valid
executable file.
_______________________________________________
relax (http://www.nmr-relax.com)
This is the relax-commits mailing list
[email protected]
To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-commits