#NEWLINE# def undo( self , actions = None ) : #NEWLINE# #INDENT# if ( actions is None ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# actions = self . history . pop ( ) #NEWLINE# #UNINDENT# except IndexError : #NEWLINE# #INDENT# log . error ( 'History list is empty.' ) #NEWLINE# return #NEWLINE# #UNINDENT# #UNINDENT# for i in actions : #NEWLINE# #INDENT# log . debug ( '{} -> {}.' . format ( i [ 1 ] , i [ 0 ] ) ) #NEWLINE# if self . simulate : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# os . rename ( self [ 1 ] , i [ 0 ] ) #NEWLINE# #UNINDENT# except Exception as e : #NEWLINE# #INDENT# log . error ( 'Rename Error: {} -> {} ({}).' . format ( i [ 1 ] , i [ 0 ] , e ) ) #NEWLINE# if self . autostop : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# log . info ( 'Undo complete.' )