<s> """<STR_LIT>""" <EOL> __author__ = '<STR_LIT>' <EOL> import datetime <EOL> import sys <EOL> import time <EOL> import gflags <EOL> from pylib import app <EOL> FLAGS = gflags . FLAGS <EOL> gflags . DEFINE_integer ( <EOL> '<STR_LIT>' , <NUM_LIT:2> , <EOL> '<STR_LIT>' ) <EOL> def main ( unused_argv ) : <EOL> current_trx = None <EOL> current_ts = None <EOL> prev_ts = None <EOL> query = [ ] <EOL> for line in sys . stdin : <EOL> if line . startswith ( '<STR_LIT>' ) : <EOL> ts_line = sys . stdin . next ( ) <EOL> v = ts_line . split ( ) <EOL> if '<STR_LIT>' in v : <EOL> trx = v [ <NUM_LIT:8> ] <EOL> date = datetime . datetime . strptime ( ts_line [ <NUM_LIT:1> : <NUM_LIT:16> ] , '<STR_LIT>' ) <EOL> exec_time = int ( <EOL> [ i for i in v if i . startswith ( '<STR_LIT>' ) ] [ <NUM_LIT:0> ] . split ( '<STR_LIT:=>' ) [ <NUM_LIT:1> ] ) <EOL> ts = int ( time . mktime ( date . timetuple ( ) ) ) + exec_time <EOL> if trx != current_trx : <EOL> if current_trx : <EOL> diff = current_ts - prev_ts <EOL> if diff > FLAGS . cutoff_seconds : <EOL> query = '<STR_LIT>' . join ( query ) <EOL> print '<STR_LIT>' % ( <EOL> current_ts , current_trx , diff , len ( query ) ) <EOL> print <EOL> print query <EOL> print '<STR_LIT:*>' * <NUM_LIT> <EOL> print <EOL> else : <EOL> current_ts = ts <EOL> prev_ts = current_ts <EOL> query = [ ] <EOL> query . append ( line ) <EOL> query . append ( ts_line ) <EOL> current_trx = trx <EOL> current_ts = ts <EOL> else : <EOL> query . append ( line ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> app . run ( ) </s>
