<s> """<STR_LIT>""" <EOL> LONG_TYPE = "<STR_LIT>" <EOL> BOOLEAN_TYPE = "<STR_LIT>" <EOL> DOUBLE_TYPE = "<STR_LIT>" <EOL> STRING_TYPE = "<STR_LIT>" <EOL> DATETIME_TYPE = "<STR_LIT>" <EOL> INTERNAL_TYPES = { LONG_TYPE , BOOLEAN_TYPE , DOUBLE_TYPE , STRING_TYPE , DATETIME_TYPE } <EOL> INT_TYPE = "<STR_LIT>" <EOL> FLOAT_TYPE = "<STR_LIT>" <EOL> NUMERIC_TYPES = { LONG_TYPE , DOUBLE_TYPE } <EOL> TYPE_MAP = { k : k for k in INTERNAL_TYPES } <EOL> TYPE_MAP [ INT_TYPE ] = LONG_TYPE <EOL> TYPE_MAP [ FLOAT_TYPE ] = DOUBLE_TYPE <EOL> ALL_TYPES = TYPE_MAP . keys ( ) <EOL> python_type_map = { <EOL> int : LONG_TYPE , <EOL> bool : BOOLEAN_TYPE , <EOL> float : DOUBLE_TYPE , <EOL> str : STRING_TYPE <EOL> } <EOL> reverse_python_type_map = { v : k for k , v in python_type_map . iteritems ( ) } <EOL> def map_type ( s ) : <EOL> """<STR_LIT>""" <EOL> return TYPE_MAP [ s ] <EOL> def parse_string ( s , _type ) : <EOL> """<STR_LIT>""" <EOL> assert _type in reverse_python_type_map <EOL> return reverse_python_type_map [ _type ] ( s ) </s>
