Example #1
0
 def test_saveload(self):
     filename = "tmp_pickle_file"
     obj_init = "Something"
     tools.saveobj(filename, obj_init)
     obj_read = tools.loadobj(filename)
     self.assertEqual(obj_read, obj_init)
     os.remove(filename)
Example #2
0
    def reload(self, path):
        """ Load saved objects from disk
        """
        for name in self.names:
            fullfile = join(_full(path), name+'.p')
            sys.modules[name] = loadobj(fullfile)

        self.check()
Example #3
0
 def reload(self, path):
     """ Load saved objects from disk
     """
     fullpath = self.fullpath(path)
     for obj in self.objects:
         fullfile = join(fullpath, obj+'.p')
         sys.modules[obj] = loadobj(fullfile)
     self.check()
Example #4
0
    def load(self, name, path='.', files=None):
        try:
            fullpath = join(abspath(path), name)
        except:
            raise IOError(path)

        if not files:
            files = []
            files += [fullpath + '/' + 'system.p']
            files += [fullpath + '/' + 'preprocess.p']
            files += [fullpath + '/' + 'solver.p']
            files += [fullpath + '/' + 'postprocess.p']
            files += [fullpath + '/' + 'optimize.p']
            files += [fullpath + '/' + 'workflow.p']

        for file in files:
            key, _ = os.path.splitext(unix.basename(file))
            self.keys.add(key)
            sys.modules[key] = loadobj(file)