<s> from optparse import OptionParser <EOL> COURSES_PATH = "<STR_LIT>" <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> parser = OptionParser ( ) <EOL> parser . add_option ( "<STR_LIT>" , "<STR_LIT>" , dest = "<STR_LIT:filename>" , <EOL> help = "<STR_LIT>" ) <EOL> parser . add_option ( "<STR_LIT>" , "<STR_LIT>" , <EOL> action = "<STR_LIT:store>" , dest = "<STR_LIT>" , <EOL> help = "<STR_LIT>" ) <EOL> parser . add_option ( "<STR_LIT>" , "<STR_LIT>" , <EOL> action = "<STR_LIT:store>" , dest = "<STR_LIT:port>" , <EOL> help = "<STR_LIT>" ) <EOL> parser . add_option ( "<STR_LIT>" , "<STR_LIT>" , <EOL> action = "<STR_LIT:store>" , dest = "<STR_LIT:name>" , <EOL> help = "<STR_LIT>" ) <EOL> ( options , args ) = parser . parse_args ( ) <EOL> if not ( options . filename and options . template and options . port and options . name ) : <EOL> parser . print_usage ( ) <EOL> with open ( options . template , "<STR_LIT:r>" ) as templatefile : <EOL> template = templatefile . read ( ) <EOL> render = template . replace ( "<STR_LIT>" , options . name ) <EOL> render = render . replace ( "<STR_LIT>" , options . port ) <EOL> render = render . replace ( "<STR_LIT>" , COURSES_PATH ) <EOL> with open ( options . filename , "<STR_LIT:w>" ) as conffile : <EOL> conffile . write ( render ) </s>
