#NEWLINE# def format_value_utype( val , encoding , colormap , time_format , float_precision , nullval , **_ ) : #NEWLINE# #INDENT# def format_field_value( v ) : #NEWLINE# #INDENT# if ( v is None ) : #NEWLINE# #INDENT# return colorme ( nullval , colormap , 'error' ) #NEWLINE# #UNINDENT# return format_value ( type ( v ) , v , encoding = encoding , colormap = colormap , time_format = time_format , float_precision = float_precision , nullval = nullval , quote = True ) #NEWLINE# #UNINDENT# def format_field_name( name ) : #NEWLINE# #INDENT# return format_value_text ( name , encoding = encoding , colormap = colormap , quote = False ) #NEWLINE# #UNINDENT# subs = [ ( format_field_name ( k ) , format_field_value ( v ) ) for ( k , v ) in val . _asdict ( ) . items ( ) ] #NEWLINE# bval = ( ( '{' + ', ' . join ( ( ( ( k . strval + ': ' ) + v . strval ) for ( k , v ) in subs ) ) ) + '}' ) #NEWLINE# ( lb , comma , colon , rb ) = [ ( ( colormap [ 'collection' ] + s ) + colormap [ 'reset' ] ) for s in ( '{' , ', ' , ': ' , '}' ) ] #NEWLINE# coloredval = ( ( lb + comma . join ( ( ( ( k . coloredval + colon ) + v . coloredval ) for ( k , v ) in subs ) ) ) + rb ) #NEWLINE# displaywidth = ( ( 4 * len ( subs ) ) + sum ( ( ( k . displaywidth + v . displaywidth ) for ( k , v ) in subs ) ) ) #NEWLINE# return FormattedValue ( bval , coloredval , displaywidth )