@@ -0,0 +1,1354 @@
+# coding=utf-8%0A#-------------------------------------------------------------------------------%0A%0A#Author: Alexandre Manhaes Savio %3Calexsavio@gmail.com%3E%0A#Grupo de Inteligencia Computational %3Cwww.ehu.es/ccwintco%3E%0A#Universidad del Pais Vasco UPV/EHU%0A#%0A#2013, Alexandre Manhaes Savio%0A#Use this at your own risk!%0A#-------------------------------------------------------------------------------%0A%0Aimport os%0Aimport shelve%0Aimport logging%0A%0Afrom .filenames import (get_extension,%0A                        add_extension_if_needed)%0A%0Alog = logging.getLogger(__name__)%0A%0A%0Adef save_variables_to_shelve(file_path, variables):%0A    %22%22%22%0A%0A    Parameters%0A    ----------%0A    file_path: str%0A%0A    variables: dict%0A        Dictionary with objects. Object name -%3E object%0A%0A    Notes%0A    -----%0A        Before calling this function, create a varlist this way:%0A%0A        shelfvars = %5B%5D%0A        for v in varnames:%0A            shelfvars.append(eval(v))%0A%0A        #to_restore variables from shelf%0A        my_shelf = shelve.open(filename)%0A        for key in my_shelf:%0A           globals()%5Bkey%5D=my_shelf%5Bkey%5D%0A        my_shelf.close()%0A    %22%22%22%0A    mashelf = shelve.open(file_path, 'n')%0A%0A    for vn in variables.keys():%0A        try:%0A            mashelf%5Bvn%5D = variables%5Bvn%5D%0A        except:%0A            log.exception('Error shelving variable %7B0%7D'.format(vn))%0A            raise%0A%0A    mashelf.close()%0A%0A%0A

Add storage