<s> """<STR_LIT>""" <EOL> import re <EOL> REGEXES = [ <EOL> ( ( '<STR_LIT>' , '<STR_LIT>' ) , '<STR_LIT>' ) , <EOL> ( ( '<STR_LIT>' , '<STR_LIT>' ) , '<STR_LIT>' ) , <EOL> ( ( '<STR_LIT>' , '<STR_LIT>' ) , '<STR_LIT>' ) , <EOL> ( ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> '<STR_LIT>' ) , <EOL> ( None , '<STR_LIT>' ) , <EOL> ( ( '<STR_LIT>' , ) , '<STR_LIT>' ) , <EOL> ( ( '<STR_LIT>' , ) , '<STR_LIT>' ) , <EOL> ( ( '<STR_LIT>' , ) , '<STR_LIT>' ) , <EOL> ( ( '<STR_LIT>' , ) , '<STR_LIT>' ) , <EOL> ( ( '<STR_LIT>' , ) , '<STR_LIT>' ) , <EOL> ( ( '<STR_LIT>' , ) , '<STR_LIT>' ) , <EOL> ( ( '<STR_LIT>' , ) , '<STR_LIT>' ) , <EOL> ( ( '<STR_LIT>' , ) , '<STR_LIT>' ) , <EOL> ( ( '<STR_LIT>' , ) , '<STR_LIT>' ) , <EOL> ( ( '<STR_LIT>' , ) , '<STR_LIT>' ) , <EOL> ( ( '<STR_LIT>' , ) , '<STR_LIT>' ) , <EOL> ( ( '<STR_LIT>' , ) , '<STR_LIT>' ) , <EOL> ( ( '<STR_LIT>' , ) , '<STR_LIT>' ) , <EOL> ( ( '<STR_LIT>' , ) , '<STR_LIT>' ) , <EOL> ] <EOL> class Ops ( object ) : <EOL> total = <NUM_LIT:0> <EOL> calls = <NUM_LIT:0> <EOL> pure_calls = <NUM_LIT:0> <EOL> class OutputInfo ( object ) : <EOL> tracing_no = <NUM_LIT:0> <EOL> tracing_time = <NUM_LIT:0.0> <EOL> backend_no = <NUM_LIT:0> <EOL> backend_time = <NUM_LIT:0.0> <EOL> asm_no = <NUM_LIT:0> <EOL> asm_time = <NUM_LIT:0.0> <EOL> guards = <NUM_LIT:0> <EOL> opt_ops = <NUM_LIT:0> <EOL> opt_guards = <NUM_LIT:0> <EOL> trace_too_long = <NUM_LIT:0> <EOL> bridge_abort = <NUM_LIT:0> <EOL> def __init__ ( self ) : <EOL> self . ops = Ops ( ) <EOL> self . recorded_ops = Ops ( ) <EOL> self . blackholed_ops = Ops ( ) <EOL> def parse_prof ( output ) : <EOL> lines = output . splitlines ( ) <EOL> info = OutputInfo ( ) <EOL> for ( attrs , regexp ) , line in zip ( REGEXES , lines ) : <EOL> m = re . match ( regexp , line ) <EOL> assert m is not None , "<STR_LIT>" % line <EOL> if attrs : <EOL> for i , a in enumerate ( attrs ) : <EOL> v = m . group ( i + <NUM_LIT:1> ) <EOL> if '<STR_LIT:.>' in v : <EOL> v = float ( v ) <EOL> else : <EOL> v = int ( v ) <EOL> if '<STR_LIT:.>' in a : <EOL> before , after = a . split ( '<STR_LIT:.>' ) <EOL> setattr ( getattr ( info , before ) , after , v ) <EOL> else : <EOL> setattr ( info , a , v ) <EOL> return info </s>
