<s> """<STR_LIT>""" <EOL> from . compat import str <EOL> import locale <EOL> import re <EOL> CLEANER = re . compile ( r'<STR_LIT>' ) <EOL> RE_INT = re . compile ( r'<STR_LIT>' ) <EOL> def clean_text ( value ) : <EOL> """<STR_LIT>""" <EOL> return CLEANER . sub ( '<STR_LIT>' , value ) <EOL> def convert_to_int ( value ) : <EOL> """<STR_LIT>""" <EOL> if not value : <EOL> return None <EOL> value = value . strip ( '<STR_LIT>' ) <EOL> try : <EOL> return int ( value ) <EOL> except ( TypeError , ValueError ) : <EOL> return None <EOL> def normalize_locale ( value ) : <EOL> value = value . replace ( '<STR_LIT:->' , '<STR_LIT:_>' ) <EOL> the_locale = locale . normalize ( value ) <EOL> if the_locale != value : <EOL> try : <EOL> return str ( the_locale . split ( '<STR_LIT:.>' ) [ <NUM_LIT:0> ] ) <EOL> except IndexError : <EOL> pass <EOL> return None </s>
