# Path: ship/utils/fileloaders/fileloader.py
# class FileLoader(object):
#     def __init__(self):
#     def loadFile(self, filepath, arg_dict={}):
# 
# 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: integration_tests/utils.py
# def softAssertion(var, value, testEqual=True):
# def softAssertionIn(var, value, testIn=True):


import os
import copy
from ship.utils.fileloaders import fileloader
from ship.utils import filetools as ft
from integration_tests import utils
                     os.path.join(cwd, 'asread/model1'),
                     os.path.join(cwd, 'asread/model1/tuflow'),
                     os.path.join(cwd, 'asread/model1/tuflow/runs'),
                     os.path.join(cwd, 'asread/model1/tuflow/model')
                    ]
        try:
            for n in need_dirs:
                if not os.path.isdir(n):
                    os.mkdir(n)
        except IOError:
            print ('\t Could not make test directeries - aborting test')
            print ('\nFail!\n')

        tuflow = copy.deepcopy(self.tuflow)
        new_root = os.path.normpath(need_dirs[4])       # ending 'runs'
        root_compare = os.path.normpath(need_dirs[3])   # ending 'tuflow'
        tuflow.root = new_root
        contents = {}
        for ckey, cval in tuflow.control_files.items():
            if not ckey in contents.keys():
                contents[ckey] = {}
            temp = cval.getPrintableContents()
            for tkey, tval in temp.items():
#                 print ('root compare: ' + root_compare)
#                 print ('tkey:         ' + tkey)
                utils.softAssertionIn(root_compare, tkey)
                contents[ckey][tkey] = tval
        
        for ctype, c in contents.items():
            for pkey, val in c.items():

# Path: ship/utils/fileloaders/fileloader.py
# class FileLoader(object):
#     def __init__(self):
#     def loadFile(self, filepath, arg_dict={}):
# 
# 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: integration_tests/utils.py
# def softAssertion(var, value, testEqual=True):
# def softAssertionIn(var, value, testIn=True):


# Path: integration_tests/test_tuflowload.py
import os
import copy
from ship.utils.fileloaders import fileloader
from ship.utils import filetools as ft
from integration_tests import utils

                     os.path.join(cwd, 'asread/model1'),
                     os.path.join(cwd, 'asread/model1/tuflow'),
                     os.path.join(cwd, 'asread/model1/tuflow/runs'),
                     os.path.join(cwd, 'asread/model1/tuflow/model')
                    ]
        try:
            for n in need_dirs:
                if not os.path.isdir(n):
                    os.mkdir(n)
        except IOError:
            print ('\t Could not make test directeries - aborting test')
            print ('\nFail!\n')

        tuflow = copy.deepcopy(self.tuflow)
        new_root = os.path.normpath(need_dirs[4])       # ending 'runs'
        root_compare = os.path.normpath(need_dirs[3])   # ending 'tuflow'
        tuflow.root = new_root
        contents = {}
        for ckey, cval in tuflow.control_files.items():
            if not ckey in contents.keys():
                contents[ckey] = {}
            temp = cval.getPrintableContents()
            for tkey, tval in temp.items():
#                 print ('root compare: ' + root_compare)
#                 print ('tkey:         ' + tkey)
                utils.softAssertionIn(root_compare, tkey)
                contents[ckey][tkey] = tval
        
        for ctype, c in contents.items():
            for pkey, val in c.items():

                ft.writeFile(val, pkey)