#NEWLINE# def crosscat_code_to_value( bdb , generator_id , M_c , colno , code ) : #NEWLINE# #INDENT# stattype = core . bayesdb_generator_column_stattype ( bdb , generator_id , colno ) #NEWLINE# if ( stattype == 'categorical' ) : #NEWLINE# #INDENT# if math . isnan ( code ) : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# cc_colno = crosscat_cc_colno ( bdb , generator_id , colno ) #NEWLINE# key = unicode ( int ( code ) ) #NEWLINE# return M_c [ 'column_metadata' ] [ cc_colno ] [ 'value_to_code' ] [ key ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( stattype in ( 'cyclic' , 'numerical' ) ) : #NEWLINE# #INDENT# if math . isnan ( code ) : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# return code #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise KeyError