<s> import sys <EOL> import math <EOL> import xml . etree . ElementTree as et <EOL> def parse_results ( filename ) : <EOL> tree = et . parse ( filename ) <EOL> root = tree . getroot ( ) <EOL> skipped = [ ] <EOL> current_class = old_class = '<STR_LIT>' <EOL> i = <NUM_LIT:1> <EOL> assert i - <NUM_LIT:1> == len ( skipped ) <EOL> for el in root . findall ( '<STR_LIT>' ) : <EOL> cn = el . attrib [ '<STR_LIT>' ] <EOL> for sk in el . findall ( '<STR_LIT>' ) : <EOL> old_class = current_class <EOL> current_class = cn <EOL> name = '<STR_LIT>' . format ( classname = current_class , <EOL> name = el . attrib [ '<STR_LIT:name>' ] ) <EOL> msg = sk . attrib [ '<STR_LIT:message>' ] <EOL> out = '<STR_LIT>' <EOL> if old_class != current_class : <EOL> ndigits = int ( math . log ( i , <NUM_LIT:10> ) + <NUM_LIT:1> ) <EOL> out += ( '<STR_LIT:->' * ( len ( name + msg ) + <NUM_LIT:4> + ndigits ) + '<STR_LIT:\n>' ) <EOL> out += '<STR_LIT>' . format ( i = i , name = name , msg = msg ) <EOL> skipped . append ( out ) <EOL> i += <NUM_LIT:1> <EOL> assert i - <NUM_LIT:1> == len ( skipped ) <EOL> assert i - <NUM_LIT:1> == len ( skipped ) <EOL> assert len ( skipped ) == int ( root . attrib [ '<STR_LIT>' ] ) <EOL> return '<STR_LIT:\n>' . join ( skipped ) <EOL> def main ( args ) : <EOL> print ( '<STR_LIT>' ) <EOL> print ( parse_results ( args . filename ) ) <EOL> return <NUM_LIT:0> <EOL> def parse_args ( ) : <EOL> import argparse <EOL> parser = argparse . ArgumentParser ( ) <EOL> parser . add_argument ( '<STR_LIT:filename>' , help = '<STR_LIT>' ) <EOL> return parser . parse_args ( ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> sys . exit ( main ( parse_args ( ) ) ) </s>
