<s> from scaffold . modules . errors import ReplaceError <EOL> new_route_string = """<STR_LIT>""" <EOL> js_src_string = """<STR_LIT>""" <EOL> menu_string = """<STR_LIT>""" <EOL> test_script_string = """<STR_LIT>""" <EOL> conf_js_string = """<STR_LIT>""" <EOL> def replace_string ( resource , resources , file , string_to_insert_after , new_string ) : <EOL> new_string = new_string . format ( resources = resources , resource = resource , Resource = resource . title ( ) , Resources = resources . title ( ) ) <EOL> with open ( file , '<STR_LIT>' , encoding = "<STR_LIT:utf-8>" ) as old_file : <EOL> filedata = old_file . read ( ) <EOL> if string_to_insert_after in filedata : <EOL> new_filedata = filedata . replace ( <EOL> string_to_insert_after , new_string , <NUM_LIT:1> ) <EOL> with open ( file , '<STR_LIT:w>' , encoding = "<STR_LIT:utf-8>" ) as new_file : <EOL> new_file . write ( new_filedata ) <EOL> print ( "<STR_LIT>" , file ) <EOL> else : <EOL> error_msg = """<STR_LIT>""" . format ( string_to_insert_after = string_to_insert_after , new_string = new_string , <EOL> file = file ) <EOL> raise ReplaceError ( error_msg ) </s>
