#NEWLINE# def format_value( self , curr , value ) : #NEWLINE# #INDENT# places = self . precision #NEWLINE# q = ( Decimal ( 10 ) ** ( - places ) ) #NEWLINE# ( sign , digits , exp ) = value . quantize ( q ) . as_tuple ( ) #NEWLINE# result = [ ] #NEWLINE# digits = map ( str , digits ) #NEWLINE# ( build , next ) = ( result . append , digits . pop ) #NEWLINE# build ( ( ' ' + i ) ) #NEWLINE# for i in range ( places ) : #NEWLINE# #INDENT# build ( ( next ( ) if digits else '0' ) ) #NEWLINE# #UNINDENT# build ( '.' ) #NEWLINE# if ( not digits ) : #NEWLINE# #INDENT# build ( '0' ) #NEWLINE# #UNINDENT# i = 0 #NEWLINE# while digits : #NEWLINE# #INDENT# build ( next ( ) ) #NEWLINE# i += 1 #NEWLINE# #UNINDENT# if sign : #NEWLINE# #INDENT# build ( '-' ) #NEWLINE# #UNINDENT# return '' . join ( reversed ( result ) )