def txt(self, diff, f):
env = Environment(<EOL>loader=PackageLoader('<STR_LIT>', '<STR_LIT>'),<EOL>trim_blocks=True,<EOL>lstrip_blocks=True<EOL>)<EOL>template = env.get_template('<STR_LIT>')<EOL>def format_row(label, values):<EOL><INDENT>change = format_comma(values['<STR_LIT>'])<EOL>percent_change = '<STR_LIT>'.format(values['<STR_LIT>']) if values['<STR_LIT>'] is not None else '<STR_LIT:->'<EOL>point_change = '<STR_LIT>'.format(values['<STR_LIT>'] * <NUM_LIT:100>) if values['<STR_LIT>'] is not None else '<STR_LIT:->'<EOL>if values['<STR_LIT>'] > <NUM_LIT:0>:<EOL><INDENT>change = '<STR_LIT>' % change<EOL><DEDENT>if values['<STR_LIT>'] is not None and values['<STR_LIT>'] > <NUM_LIT:0>:<EOL><INDENT>percent_change = '<STR_LIT>' % percent_change<EOL><DEDENT>if values['<STR_LIT>'] is not None and values['<STR_LIT>'] > <NUM_LIT:0>:<EOL><INDENT>point_change = '<STR_LIT>' % point_change<EOL><DEDENT>return '<STR_LIT>'.format(change, percent_change, point_change, label)<EOL><DEDENT>context = {<EOL>'<STR_LIT>': diff,<EOL>'<STR_LIT>': self.field_definitions,<EOL>'<STR_LIT>': GLOBAL_ARGUMENTS,<EOL>'<STR_LIT>': format_comma,<EOL>'<STR_LIT>': format_duration,<EOL>'<STR_LIT>': format_percent,<EOL>'<STR_LIT>': format_row<EOL>}<EOL>f.write(template.render(**context).encode('<STR_LIT:utf-8>'))<EOL>
Generate a text report for a diff.