#NEWLINE# def restore( self ) : #NEWLINE# #INDENT# '\n        Set the values of whatever attributes are recoverable\n        from the pickle file.\n\n        Populate the attributes (the __dict__) of the EgStore object\n        from     the attributes (the __dict__) of the pickled object.\n\n        If the pickled object has attributes that have been initialized\n        in the EgStore object, then those attributes of the EgStore object\n        will be replaced by the values of the corresponding attributes\n        in the pickled object.\n\n        If the pickled object is missing some attributes that have\n        been initialized in the EgStore object, then those attributes\n        of the EgStore object will retain the values that they were\n        initialized with.\n\n        If the pickled object has some attributes that were not\n        initialized in the EgStore object, then those attributes\n        will be ignored.\n\n        IN SUMMARY:\n\n        After the recover() operation, the EgStore object will have all,\n        and only, the attributes that it had when it was initialized.\n\n        Where possible, those attributes will have values recovered\n        from the pickled object.\n        ' #NEWLINE# if ( not os . path . exists ( self . filename ) ) : #NEWLINE# #INDENT# return self #NEWLINE# #UNINDENT# if ( not os . path . isfile ( self . filename ) ) : #NEWLINE# #INDENT# return self #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# with open ( self . filename , 'rb' ) as f : #NEWLINE# #INDENT# unpickledObject = pickle . load ( f ) #NEWLINE# #UNINDENT# for key in list ( self . __dict__ . keys ( ) ) : #NEWLINE# #INDENT# default = self . __dict__ [ key ] #NEWLINE# self . __dict__ [ key ] = unpickledObject . __dict__ . get ( key , default ) #NEWLINE# #UNINDENT# #UNINDENT# except : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# return self