#NEWLINE# def determine_date_type( values , datemode = 0 ) : #NEWLINE# #INDENT# '\n    Determine if an Excel date column really contains dates... \n    ' #NEWLINE# normal_types_set = set ( ) #NEWLINE# for v in values : #NEWLINE# #INDENT# if ( v == '' ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# v_tuple = xlrd . xldate_as_tuple ( v , datemode ) #NEWLINE# if ( v_tuple == ( 0 , 0 , 0 , 0 , 0 , 0 ) ) : #NEWLINE# #INDENT# normal_types_set . add ( datetime . time ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( v_tuple [ 3 : ] == ( 0 , 0 , 0 ) ) : #NEWLINE# #INDENT# normal_types_set . add ( datetime . date ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( v_tuple [ : 3 ] == ( 0 , 0 , 0 ) ) : #NEWLINE# #INDENT# normal_types_set . add ( datetime . time ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# normal_types_set . add ( datetime . datetime ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# if ( len ( normal_types_set ) == 1 ) : #NEWLINE# #INDENT# return normal_types_set . pop ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( normal_types_set == set ( [ datetime . datetime , datetime . date ] ) ) : #NEWLINE# #INDENT# return datetime . datetime #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( normal_types_set == set ( [ datetime . datetime , datetime . time ] ) ) : #NEWLINE# #INDENT# return unicode #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( normal_types_set == set ( [ datetime . date , datetime . time ] ) ) : #NEWLINE# #INDENT# return unicode