<s> """<STR_LIT>""" <EOL> import re <EOL> import time <EOL> from django import forms <EOL> HIVE_IDENTIFER_REGEX = re . compile ( "<STR_LIT>" ) <EOL> DL_FORMATS = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> SELECTION_SOURCE = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , ] <EOL> AGGREGATIONS = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> JOIN_TYPES = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> SORT_OPTIONS = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> RELATION_OPS_UNARY = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> RELATION_OPS = [ '<STR_LIT:=>' , '<STR_LIT>' , '<STR_LIT:<>' , '<STR_LIT>' , '<STR_LIT:>>' , '<STR_LIT>' ] + RELATION_OPS_UNARY <EOL> TERMINATORS = [ <EOL> ( r'<STR_LIT>' , r"<STR_LIT>" , <NUM_LIT:1> ) , <EOL> ( r'<STR_LIT>' , r"<STR_LIT>" , <NUM_LIT:2> ) , <EOL> ( r'<STR_LIT>' , r"<STR_LIT>" , <NUM_LIT:3> ) , <EOL> ( r'<STR_LIT:\t>' , r"<STR_LIT>" , <NUM_LIT:9> ) , <EOL> ( '<STR_LIT:U+002C>' , "<STR_LIT>" , <NUM_LIT> ) , <EOL> ( '<STR_LIT:U+0020>' , "<STR_LIT>" , <NUM_LIT:32> ) , <EOL> ] <EOL> def timing ( fn ) : <EOL> def decorator ( * args , ** kwargs ) : <EOL> time1 = time . time ( ) <EOL> ret = fn ( * args , ** kwargs ) <EOL> time2 = time . time ( ) <EOL> print '<STR_LIT>' % ( fn . func_name , ( time2 - time1 ) * <NUM_LIT> ) <EOL> return ret <EOL> return decorator <EOL> def to_choices ( x ) : <EOL> """<STR_LIT>""" <EOL> return [ ( y , y ) for y in x ] <EOL> def apply_natural_sort ( collection , key = None ) : <EOL> """<STR_LIT>""" <EOL> convert = lambda text : int ( text ) if text . isdigit ( ) else text <EOL> def tokenize_and_convert ( item , key = None ) : <EOL> if key : <EOL> item = item [ key ] <EOL> return [ convert ( c ) for c in re . split ( '<STR_LIT>' , item ) ] <EOL> return sorted ( collection , key = lambda i : tokenize_and_convert ( i , key = key ) ) <EOL> class HiveIdentifierField ( forms . RegexField ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , * args , ** kwargs ) : <EOL> kwargs [ '<STR_LIT>' ] = HIVE_IDENTIFER_REGEX <EOL> super ( HiveIdentifierField , self ) . __init__ ( * args , ** kwargs ) </s>
