#NEWLINE# def _ensure_hashes( self ) : #NEWLINE# #INDENT# if ( self . _md5 is not None ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# with self . open ( 'rb' ) as f : #NEWLINE# #INDENT# md5 = hashlib . md5 ( ) #NEWLINE# sha1 = hashlib . sha1 ( ) #NEWLINE# sha384 = hashlib . sha384 ( ) #NEWLINE# while 1 : #NEWLINE# #INDENT# chunk = f . read ( 16384 ) #NEWLINE# if ( not self ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# md5 . update ( chunk ) #NEWLINE# sha1 . update ( chunk ) #NEWLINE# sha384 . update ( chunk ) #NEWLINE# #UNINDENT# self . _md5 = md5 . hexdigest ( ) #NEWLINE# self . _sha1 = sha1 . hexdigest ( ) #NEWLINE# self . _integrity = ( 'sha384-' + base64 . b64encode ( sha384 . digest ( ) ) )