#NEWLINE# def bin_to_int( bits , signed = False ) : #NEWLINE# #INDENT# number = 0 #NEWLINE# bias = 0 #NEWLINE# if ( signed and ( _bit_values [ bits [ 0 ] ] == 1 ) ) : #NEWLINE# #INDENT# bits = bits [ 1 : ] #NEWLINE# bias = ( 1 << len ( bits ) ) #NEWLINE# #UNINDENT# for b in bits : #NEWLINE# #INDENT# number <<= 1 #NEWLINE# number |= _bit_values [ b ] #NEWLINE# #UNINDENT# return ( number - bias )