@click.command()<EOL>@click.argument('<STR_LIT>', type=click.Path(exists=True),<EOL>metavar='<STR_LIT>')<EOL>@click.argument('<STR_LIT>', nargs=-<NUM_LIT:1>,<EOL>type=click.Path(exists=True), metavar='<STR_LIT>')<EOL>@click.option('<STR_LIT>', type=click.Choice(['<STR_LIT>', '<STR_LIT>', '<STR_LIT>']),<EOL>default='<STR_LIT>', show_default=True,<EOL>help='<STR_LIT>')<EOL>@click.option('<STR_LIT>', '<STR_LIT>', '<STR_LIT>', type=click.Path(),<EOL>help='<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>')<EOL>@click.option('<STR_LIT>', '<STR_LIT>', default='<STR_LIT:utf-8>', show_default=True,<EOL>help='<STR_LIT>')<EOL>@click.option('<STR_LIT>', '<STR_LIT>', is_flag=True,<EOL>help='<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>')<EOL>@click.option('<STR_LIT>', default=False,<EOL>help='<STR_LIT>'<EOL>'<STR_LIT>')<EOL>@click.option('<STR_LIT>', is_flag=True,<EOL>help='<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>')<EOL>@click.option('<STR_LIT>', '<STR_LIT>', default=<NUM_LIT:0>, count=True,<EOL>help='<STR_LIT>')<EOL>@click.option('<STR_LIT>', '<STR_LIT>', is_flag=True,<EOL>help='<STR_LIT>')<EOL>def main(pattern_filename, input_filenames, pattern_format,<EOL>output_filename,<EOL>encoding, words, by_line, slow, verbose, quiet):
set_log_level(verbose, quiet)<EOL>if slow:<EOL><INDENT>by_line = True<EOL><DEDENT>by_line = True <EOL>LOGGER.info('<STR_LIT>'.format(pattern_filename,<EOL>input_filenames,<EOL>output_filename))<EOL>if not input_filenames:<EOL><INDENT>input_filenames = ('<STR_LIT:->',)<EOL><DEDENT>if not output_filename:<EOL><INDENT>output_filename = '<STR_LIT:->'<EOL><DEDENT>trie, boundaries = build_trie(pattern_filename, pattern_format, encoding, words)<EOL>if not slow:<EOL><INDENT>warn_prefix_values(trie)<EOL><DEDENT>LOGGER.info('<STR_LIT>'.format(output_filename))<EOL>with open_file(output_filename, '<STR_LIT:wb>') as output_file:<EOL><INDENT>for input_filename in input_filenames:<EOL><INDENT>with open_file(input_filename) as input_file:<EOL><INDENT>LOGGER.info('<STR_LIT>'.format(input_filename))<EOL>if by_line:<EOL><INDENT>num_lines = <NUM_LIT:0><EOL>for line in input_file:<EOL><INDENT>line = line.decode(encoding).rstrip('<STR_LIT:\n>')<EOL>line = rewrite_str_with_trie(line, trie, boundaries, slow)<EOL>output_file.write((line + '<STR_LIT:\n>').encode(encoding))<EOL>num_lines += <NUM_LIT:1><EOL><DEDENT>LOGGER.info('<STR_LIT>'.format(num_lines))<EOL><DEDENT>else:<EOL><INDENT>raise NotImplementedError<EOL><DEDENT><DEDENT><DEDENT><DEDENT>
Search and replace on INPUT_FILE(s) (or standard input), with
matching on fixed strings.