<s> import re <EOL> __all__ = ( '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' ) <EOL> RE_FLAGS = { '<STR_LIT:i>' : re . I , '<STR_LIT:l>' : re . L , '<STR_LIT:m>' : re . M , '<STR_LIT:s>' : re . S , '<STR_LIT:u>' : re . U , '<STR_LIT:x>' : re . X } <EOL> def camelcase_to_underscore ( name ) : <EOL> """<STR_LIT>""" <EOL> new_name = u'<STR_LIT>' <EOL> for char in name : <EOL> if char . isupper ( ) : <EOL> char = char . lower ( ) <EOL> new_name += u'<STR_LIT:_>' <EOL> new_name += char <EOL> return new_name <EOL> def process_re_flags ( flags = None ) : <EOL> """<STR_LIT>""" <EOL> if flags : <EOL> old_flags = flags <EOL> flags = None <EOL> for flag in old_flags : <EOL> flag = flag . lower ( ) <EOL> if not flag in RE_FLAGS : <EOL> continue <EOL> flag = RE_FLAGS [ flag ] <EOL> if flags is None : <EOL> flags = flag <EOL> else : <EOL> flags |= flag <EOL> return flags or <NUM_LIT:0> <EOL> def underscore_to_camelcase ( name ) : <EOL> """<STR_LIT>""" <EOL> return name [ <NUM_LIT:0> ] . lower ( ) + name . replace ( '<STR_LIT:_>' , '<STR_LIT:U+0020>' ) . title ( ) . replace ( '<STR_LIT:U+0020>' , '<STR_LIT>' ) [ <NUM_LIT:1> : ] </s>
