# Path: ship/utils/utilfunctions.py
# def formatFloat(value, no_of_dps, ignore_empty_str=True):
# def checkFileType(file_path, ext):
# def isNumeric(s):
# def encodeStr(value):
# def isString(value):
# def isList(value):
# def arrayToString(self, str_array):
# def findSubstringInList(substr, the_list):
# def findMax(val1, val2):
# def fileExtensionWithoutPeriod(filepath, name_only=False):
# def findWholeWord(w):
# def convertRunOptionsToSEDict(options):
# def getSEResolvedFilename(filename, se_vals):
# def enum(*sequential, **named):
#     def __init__(self):
#     def isEmpty(self):
#     def enqueue(self, item):
#     def dequeue(self):
#     def size(self):
#     def __init__(self, max_size=-1):
#     def isEmpty(self):
#     def add(self, item):
#     def pop(self):
#     def peek(self):
#     def size(self):
# class FileQueue(object):
# class LoadStack(object):
# 
# Path: ship/utils/filetools.py
# def getFile(file_path):
# def writeFile(contents, file_path, add_newline=True):
# def finalFolder(path):
# def setFinalFolder(path, folder_name):
# def getFileName(in_path, with_extension=False):
# def directory(in_path):
#     def __init__(self, path, root=None):
#     def _setupVars(self, path):
#     def finalFolder(self):
#     def setFinalFolder(self, folder_name):
#     def absolutePath(self, filename=None, relative_roots=[], normalize=True):
#     def directory(self):
#     def relativePath(self, with_extension=True, filename=None):
#     def filenameAndExtension(self):
#     def setAbsolutePath(self, absolute_path, keep_relative_root=False):
#     def setFilename(self, filename, has_extension=False, keep_extension=False):
#     def pathExists(self, ext=None):
# class PathHolder(object):
#     ABSOLUTE, RELATIVE, DIRECTORY, NAME, EXTENSION, NAME_AND_EXTENSION = range(6)


import os
import logging
from ship.utils import utilfunctions as uf
from ship.utils import filetools as ft

        return contents

    def write(self, filepath=None, overwrite=False):
        """Write the contents of this file to disk.

        Writes out to file in the format required for reading by ISIS/FMP.

        Note:
            If a filepath is not provided and the settings in this objects
            PathHolder class have not been updated you will write over the
            file that was loaded.

        Args:
            filepath=None(str): if a filename is provided it the file will be
                written to that location. If not, the current settings in this
                object path_holder object will be used.
            overwrite=False(bool): if the file already exists it will raise
                an IOError.

        Raises:
            IOError - If unable to write to file.
        """
        if filepath is None:
            filepath = self.path_holder.absolutePath()

        if not overwrite and os.path.exists(filepath):
            raise IOError('filepath %s already exists. Set overwrite=True to ignore this warning.' % filepath)

        contents = self.getPrintableContents()

# Path: ship/utils/utilfunctions.py
# def formatFloat(value, no_of_dps, ignore_empty_str=True):
# def checkFileType(file_path, ext):
# def isNumeric(s):
# def encodeStr(value):
# def isString(value):
# def isList(value):
# def arrayToString(self, str_array):
# def findSubstringInList(substr, the_list):
# def findMax(val1, val2):
# def fileExtensionWithoutPeriod(filepath, name_only=False):
# def findWholeWord(w):
# def convertRunOptionsToSEDict(options):
# def getSEResolvedFilename(filename, se_vals):
# def enum(*sequential, **named):
#     def __init__(self):
#     def isEmpty(self):
#     def enqueue(self, item):
#     def dequeue(self):
#     def size(self):
#     def __init__(self, max_size=-1):
#     def isEmpty(self):
#     def add(self, item):
#     def pop(self):
#     def peek(self):
#     def size(self):
# class FileQueue(object):
# class LoadStack(object):
# 
# Path: ship/utils/filetools.py
# def getFile(file_path):
# def writeFile(contents, file_path, add_newline=True):
# def finalFolder(path):
# def setFinalFolder(path, folder_name):
# def getFileName(in_path, with_extension=False):
# def directory(in_path):
#     def __init__(self, path, root=None):
#     def _setupVars(self, path):
#     def finalFolder(self):
#     def setFinalFolder(self, folder_name):
#     def absolutePath(self, filename=None, relative_roots=[], normalize=True):
#     def directory(self):
#     def relativePath(self, with_extension=True, filename=None):
#     def filenameAndExtension(self):
#     def setAbsolutePath(self, absolute_path, keep_relative_root=False):
#     def setFilename(self, filename, has_extension=False, keep_extension=False):
#     def pathExists(self, ext=None):
# class PathHolder(object):
#     ABSOLUTE, RELATIVE, DIRECTORY, NAME, EXTENSION, NAME_AND_EXTENSION = range(6)


# Path: ship/fmp/ief.py
import os
import logging
from ship.utils import utilfunctions as uf
from ship.utils import filetools as ft


        return contents

    def write(self, filepath=None, overwrite=False):
        """Write the contents of this file to disk.

        Writes out to file in the format required for reading by ISIS/FMP.

        Note:
            If a filepath is not provided and the settings in this objects
            PathHolder class have not been updated you will write over the
            file that was loaded.

        Args:
            filepath=None(str): if a filename is provided it the file will be
                written to that location. If not, the current settings in this
                object path_holder object will be used.
            overwrite=False(bool): if the file already exists it will raise
                an IOError.

        Raises:
            IOError - If unable to write to file.
        """
        if filepath is None:
            filepath = self.path_holder.absolutePath()

        if not overwrite and os.path.exists(filepath):
            raise IOError('filepath %s already exists. Set overwrite=True to ignore this warning.' % filepath)

        contents = self.getPrintableContents()

        ft.writeFile(contents, filepath)