def summary(processors, metrics, context):
<EOL>def display_header(processors, before='<STR_LIT>', after='<STR_LIT>'):<EOL><INDENT>"""<STR_LIT>"""<EOL>print(before, end='<STR_LIT:U+0020>')<EOL>for processor in processors:<EOL><INDENT>processor.display_header()<EOL><DEDENT>print(after)<EOL><DEDENT>def display_separator(processors, before='<STR_LIT>', after='<STR_LIT>'):<EOL><INDENT>"""<STR_LIT>"""<EOL>print(before, end='<STR_LIT:U+0020>')<EOL>for processor in processors:<EOL><INDENT>processor.display_separator()<EOL><DEDENT>print(after)<EOL><DEDENT>def display_metrics(processors, before='<STR_LIT>', after='<STR_LIT>', metrics=[]):<EOL><INDENT>"""<STR_LIT>"""<EOL>print(before, end='<STR_LIT:U+0020>')<EOL>for processor in processors:<EOL><INDENT>processor.display_metrics(metrics)<EOL><DEDENT>print(after)<EOL><DEDENT>summary = {}<EOL>for m in metrics:<EOL><INDENT>lang = metrics[m]['<STR_LIT>']<EOL>has_key = lang in summary<EOL>if not has_key:<EOL><INDENT>summary[lang] = {'<STR_LIT>': <NUM_LIT:0>, '<STR_LIT>': lang}<EOL><DEDENT>summary[lang]['<STR_LIT>'] += <NUM_LIT:1><EOL>for i in metrics[m]:<EOL><INDENT>if i not in ['<STR_LIT>', '<STR_LIT>', '<STR_LIT>']:  <EOL><INDENT>continue<EOL><DEDENT>if not has_key:<EOL><INDENT>summary[lang][i] = <NUM_LIT:0><EOL><DEDENT>summary[lang][i] += metrics[m][i]<EOL><DEDENT><DEDENT>total = {'<STR_LIT>': '<STR_LIT>'}<EOL>for m in summary:<EOL><INDENT>for i in summary[m]:<EOL><INDENT>if i == '<STR_LIT>':<EOL><INDENT>continue<EOL><DEDENT>if i not in total:<EOL><INDENT>total[i] = <NUM_LIT:0><EOL><DEDENT>total[i] += summary[m][i]<EOL><DEDENT><DEDENT>print('<STR_LIT>')<EOL>display_header(processors, '<STR_LIT>', '<STR_LIT>')<EOL>display_separator(processors, '<STR_LIT:->'*<NUM_LIT:5>, '<STR_LIT>')<EOL>for k in sorted(summary.keys(), key=str.lower):<EOL><INDENT>display_metrics(processors, '<STR_LIT>' %<EOL>summary[k]['<STR_LIT>'], '<STR_LIT>', summary[k])<EOL><DEDENT>display_separator(processors, '<STR_LIT:->'*<NUM_LIT:5>, '<STR_LIT>')<EOL>display_metrics(processors, '<STR_LIT>' % total['<STR_LIT>'],<EOL>'<STR_LIT>', total)<EOL>
Print the summary