def saveResultObjects (objects, fileName, *options) : """ save a list or dictionary of Results objects it is o.k. if the list or dictionary is itself a list or dictionary of OPTIONS: long - save the long attribute list """ if type(objects) == type([]) : if type(objects[0]) == type([]) : obj = [ [o.convert(*options) for o in resultsList] for resultsList in objects] elif type(objects[0]) == type({}) : obj = [] for resultsList in objects : object = {} else : obj = [o.convert(*options) for o in objects] elif type(objects) == type({}) : obj = {} for rkey in objects : if type(objects[rkey]) == type({}) : obj[rkey] = {} for key in objects[rkey] : obj[rkey][key] = object[rkey][key].convert(*options) elif type(objects[rkey]) == type([]) : obj[rkey] = [ object.convert(*options) for object in objects[rkey] ] else : obj[rkey] = objects[rkey].convert(*options) else : raise ValueError, 'expected either a list or dictionary' myio.save(obj, fileName)
def save(self, fileName, *options): if "short" in options: attributes = self[0][0].shortAttrList else: attributes = self[0][0].longAttrList resultsList = [[convert(results, attributes) for results in res] for res in self] myio.save(resultsList, fileName)
def save(self, fileName, *options) : if 'short' in options : attributes = self[0][0].shortAttrList else : attributes = self[0][0].longAttrList resultsList = [[convert(results, attributes) for results in res] for res in self] myio.save(resultsList, fileName)
def save(self, fileName, *options) : """ save Results to a file only attributes given in the attribute list are saved OPTIONS:: 'long' - use long attribute list 'short' - use short attribute list using the short attribute list won't allow you to reconstruct the Results object afterwards, only the statistics that characterize the results. """ resultsList = self.convert(*options) myio.save(resultsList, fileName)