#NEWLINE# def delete( self ) : #NEWLINE# #INDENT# if ( ( not self . writers ) and ( not self . readers ) ) : #NEWLINE# #INDENT# self . verified = False #NEWLINE# self . moved_verified_blob = False #NEWLINE# def delete_from_file_system( ) : #NEWLINE# #INDENT# if os . path . isfile ( self . file_path ) : #NEWLINE# #INDENT# os . remove ( self . file_path ) #NEWLINE# #UNINDENT# #UNINDENT# d = threads . deferToThread ( delete_from_file_system ) #NEWLINE# def log_error( err ) : #NEWLINE# #INDENT# log . warning ( 'An error occurred deleting %s: %s' , str ( self . file_path ) , err . getErrorMessage ( ) ) #NEWLINE# return err #NEWLINE# #UNINDENT# d . addErrback ( log_error ) #NEWLINE# return d #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return defer . fail ( Failure ( ValueError ( 'File is currently being read or written and cannot be deleted' ) ) )