<s> """<STR_LIT>""" <EOL> import re <EOL> PRIORITY = <NUM_LIT:1> <EOL> def smartsplit ( code ) : <EOL> """<STR_LIT>""" <EOL> strings = [ ] <EOL> pos = <NUM_LIT:0> <EOL> while pos < len ( code ) : <EOL> if code [ pos ] == '<STR_LIT:">' : <EOL> word = '<STR_LIT>' <EOL> pos += <NUM_LIT:1> <EOL> while pos < len ( code ) : <EOL> if code [ pos ] == '<STR_LIT:">' : <EOL> break <EOL> if code [ pos ] == '<STR_LIT:\\>' : <EOL> word += '<STR_LIT:\\>' <EOL> pos += <NUM_LIT:1> <EOL> word += code [ pos ] <EOL> pos += <NUM_LIT:1> <EOL> strings . append ( '<STR_LIT>' % word ) <EOL> pos += <NUM_LIT:1> <EOL> return strings <EOL> def detect ( code ) : <EOL> """<STR_LIT>""" <EOL> return ( re . search ( r'<STR_LIT>' , code ) is not None ) <EOL> def unpack ( code ) : <EOL> """<STR_LIT>""" <EOL> if detect ( code ) : <EOL> matches = re . search ( r'<STR_LIT>' , code ) <EOL> if matches : <EOL> variable = matches . group ( <NUM_LIT:1> ) <EOL> dictionary = smartsplit ( matches . group ( <NUM_LIT:2> ) ) <EOL> code = code [ len ( matches . group ( <NUM_LIT:0> ) ) : ] <EOL> for key , value in enumerate ( dictionary ) : <EOL> code = code . replace ( r'<STR_LIT>' % ( variable , key ) , value ) <EOL> return code </s>
