#NEWLINE# @ classmethod #NEWLINE# def format( cls , precision_doc , format = 'str' ) : #NEWLINE# #INDENT# if ( format == 'str' ) : #NEWLINE# #INDENT# return cls . format_str ( precision_doc ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( format == 'json' ) : #NEWLINE# #INDENT# if isinstance ( precision_doc , float ) : #NEWLINE# #INDENT# return round ( precision_doc , 3 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return { cls : round ( precision , 3 ) for ( label , precision ) in precision_doc . items ( ) } #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# raise TypeError ( "Format '{0}' not available for {1}." . format ( format , cls . __name__ ) )