#NEWLINE# def _is_identical( self , chunk_data , path ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# fp = open ( path , 'rb' ) #NEWLINE# #UNINDENT# except IOError : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# with fp : #NEWLINE# #INDENT# for chunk in chunk_data : #NEWLINE# #INDENT# to_read = chunk [ 'bytes' ] #NEWLINE# md5sum = md5 ( ) #NEWLINE# while to_read : #NEWLINE# #INDENT# data = fp . read ( min ( 65536 , to_read ) ) #NEWLINE# if ( not data ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# md5sum . update ( data ) #NEWLINE# to_read -= len ( data ) #NEWLINE# #UNINDENT# if ( md5sum . hexdigest ( ) != chunk [ 'hash' ] ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# #UNINDENT# return ( not fp . read ( 1 ) )