#NEWLINE# def _get_field_type_rule( type_list ) : #NEWLINE# #INDENT# " The intent is to resolve type determinations through simplistic\n        rules:\n        Additional Notes to consider:\n        1. Note that type of 'unknown' must not be included within type_list\n        2. empty list = unknown\n        3. one-item list = that item\n        4. 2-3 item list of number types = float\n        5. timestamps include epochs - which look like any integer or float.\n           Because of this a mix of timestamps + floats/integers will be considered\n           a float or integer.\n        Challenge is in handling data quality problems - like the documented\n        case in which a file with 8000 timestamps in the yyyy-mm-dd have 4 records\n        with floats.   These floats should have been kicked out as garbage data -\n        but if the timestamps were epochs then that would not be appropriate.\n    " #NEWLINE# assert ( 'unknown' not in type_list ) #NEWLINE# float_set_2i = set ( [ 'integer' , 'float' ] ) #NEWLINE# float_set_2t = set ( [ 'float' , 'timestamp' ] ) #NEWLINE# float_set_3 = set ( [ 'integer' , 'float' , 'timestamp' ] ) #NEWLINE# integer_set_2t = set ( [ 'integer' , 'timestamp' ] ) #NEWLINE# type_set = set ( type_list ) #NEWLINE# if ( len ( type_list ) == 0 ) : #NEWLINE# #INDENT# return 'unknown' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( len ( type_list ) == 1 ) : #NEWLINE# #INDENT# field_type = type_list [ 0 ] #NEWLINE# return field_type #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( len ( type_list ) == 2 ) : #NEWLINE# #INDENT# if ( not type_set . symmetric_difference ( float_set_2i ) ) : #NEWLINE# #INDENT# return 'float' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( not type_set . symmetric_difference ( float_set_2t ) ) : #NEWLINE# #INDENT# return 'float' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( not type_set . symmetric_difference ( integer_set_2t ) ) : #NEWLINE# #INDENT# return 'integer' #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( len ( type_list ) == 3 ) : #NEWLINE# #INDENT# if ( not type_set . symmetric_difference ( float_set_3 ) ) : #NEWLINE# #INDENT# return 'float' #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# return None