#NEWLINE# def _int_or_float( s ) : #NEWLINE# #INDENT# '\n    Converts an a string to an int if possible, or to a float.\n\n    If the string is neither a string or a float a value error is raised.\n    ' #NEWLINE# if isinstance ( s , float ) : #NEWLINE# #INDENT# return s #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# return int ( s ) #NEWLINE# #UNINDENT# except ( ValueError , TypeError ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# return float ( s ) #NEWLINE# #UNINDENT# except ( ValueError , TypeError ) as exc : #NEWLINE# #INDENT# raise ValueError ( * exc . args )