<s> """<STR_LIT>""" <EOL> import re <EOL> _filename = None <EOL> _contents = None <EOL> line_re = re . compile ( ur '<STR_LIT>' ) <EOL> try : <EOL> with open ( "<STR_LIT>" ) as out : <EOL> output_lines = out . readlines ( ) <EOL> except IOError : <EOL> print ( "<STR_LIT>" ) <EOL> exit ( <NUM_LIT:1> ) <EOL> for line in output_lines : <EOL> match = re . match ( line_re , line ) <EOL> if match : <EOL> newfilename = match . group ( <NUM_LIT:1> ) <EOL> errortype = match . group ( <NUM_LIT:2> ) <EOL> if errortype . lower ( ) in [ "<STR_LIT>" , "<STR_LIT>" ] : <EOL> print ( "<STR_LIT>" + line ) <EOL> else : <EOL> if newfilename != _filename : <EOL> if _filename : <EOL> with open ( _filename , "<STR_LIT:w>" ) as _file : <EOL> _file . write ( _contents ) <EOL> _filename = newfilename <EOL> with open ( _filename ) as _file : <EOL> _contents = _file . read ( ) <EOL> _contents = _contents . replace ( match . group ( <NUM_LIT:3> ) , match . group ( <NUM_LIT:4> ) ) <EOL> else : <EOL> print ( "<STR_LIT>" + line ) </s>
