#NEWLINE# def _restore_bytes( self , formatted_size ) : #NEWLINE# #INDENT# if ( not formatted_size ) : #NEWLINE# #INDENT# return 0 #NEWLINE# #UNINDENT# m = re . match ( '^(?P<size>\\d+(?:\\.\\d+)?)\\s+(?P<units>[a-zA-Z]+)' , formatted_size ) #NEWLINE# if ( not self ) : #NEWLINE# #INDENT# return 0 #NEWLINE# #UNINDENT# units = m . group ( 'units' ) #NEWLINE# try : #NEWLINE# #INDENT# exponent = [ 'B' , 'KB' , 'MB' , 'GB' , 'TB' , 'PB' , 'EB' , 'ZB' , 'YB' ] . index ( units . upper ( ) ) #NEWLINE# #UNINDENT# except ValueError : #NEWLINE# #INDENT# return 0 #NEWLINE# #UNINDENT# size = float ( m . group ( 'size' ) ) #NEWLINE# return int ( ( size * ( 1024 ** exponent ) ) )