#NEWLINE# def restore( path ) : #NEWLINE# #INDENT# "restores state from disk\n\n    :param path: the path to restore from\n    :returns: the object restored, or an empty dict(), if the file doesn't\n        exist\n    " #NEWLINE# if os . path . exists ( path ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# with open ( path , 'r' ) as f : #NEWLINE# #INDENT# return json . load ( f ) #NEWLINE# #UNINDENT# #UNINDENT# except Exception as ex : #NEWLINE# #INDENT# raise DownstreamError ( "Couldn't parse '{0}': {1}" . format ( path , str ( ex ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# return dict ( )