#NEWLINE# def generate( self ) : #NEWLINE# #INDENT# agecurrent = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# agefirst = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# agenonnacked = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# wait_reviewer = [ ] #NEWLINE# wait_submitter = [ ] #NEWLINE# changes = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for project in self . projects : #NEWLINE# #INDENT# query = OperationQuery ( self . client , { #NEWLINE# #INDENT# 'project' : [ project ] , #NEWLINE# 'status' : [ OperationQuery . STATUS_OPEN ] , #NEWLINE# 'branch' : [ self . branch ] , #NEWLINE# 'topic' : [ self . topic ] , #NEWLINE# #UNINDENT# } , patches = OperationQuery . PATCHES_ALL , approvals = True ) #NEWLINE# def querycb( change ) : #NEWLINE# #INDENT# if ( change . status != 'NEW' ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# now = time . time ( ) #NEWLINE# current = change . get_current_patch ( ) #NEWLINE# first = change . get_first_patch ( ) #NEWLINE# nonnacked = change . get_reviewer_not_nacked_patch ( ) #NEWLINE# changes [ change . id ] = change #NEWLINE# if current . is_nacked ( ) : #NEWLINE# #INDENT# wait_submitter . append ( change . id ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# wait_reviewer . append ( change . id ) #NEWLINE# #UNINDENT# agecurrent [ change . id ] = current . get_age ( now ) #NEWLINE# agefirst [ change . id ] = first . get_age ( now ) #NEWLINE# if nonnacked : #NEWLINE# #INDENT# agenonnacked [ change . id ] = nonnacked . get_age ( now ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# agenonnacked [ change . id ] = 0 #NEWLINE# #UNINDENT# #UNINDENT# query . run ( querycb ) #NEWLINE# #UNINDENT# compound = ReportOutputCompound ( ) #NEWLINE# summary = ReportOutputList ( [ ReportOutputColumn ( 'nreviews' , 'Total open reviews' , format = '%d' , mapfunc = ( lambda rep , col , row : ( row [ 0 ] + row [ 1 ] ) ) ) , ReportOutputColumn ( 'waitsubmitter' , 'Waiting on submitter' , format = '%d' , mapfunc = ( lambda rep , col , row : row [ 0 ] ) ) , ReportOutputColumn ( 'waitreviewer' , 'Waiting on reviewer' , format = '%d' , mapfunc = ( lambda rep , col , row : row [ 1 ] ) ) ] , title = 'Review summary' ) #NEWLINE# summary . set_row ( [ len ( wait_submitter ) , len ( wait_reviewer ) ] ) #NEWLINE# compound . add_report ( summary ) #NEWLINE# lastrev = ReportOutputList ( [ ReportOutputColumn ( 'average' , 'Average wait time' , mapfunc = ( lambda rep , col , row : row [ 0 ] ) ) , ReportOutputColumn ( 'median' , 'Median wait time' , mapfunc = ( lambda rep , col , row : row [ 1 ] ) ) , ReportOutputColumn ( 'stale' , ( 'Older than %d days' % self . days ) , format = '%d' , mapfunc = ( lambda rep , col , row : row [ 2 ] ) ) ] , title = 'Summary since current revision' ) #NEWLINE# lastrev . set_row ( [ self . average_age ( wait_reviewer , agecurrent ) , self . median_age ( wait_reviewer , agecurrent ) , self . older_than ( wait_reviewer , agecurrent , self . days ) ] ) #NEWLINE# compound . add_report ( lastrev ) #NEWLINE# firstrev = ReportOutputList ( [ ReportOutputColumn ( 'average' , 'Average wait time' , mapfunc = ( lambda rep , col , row : row [ 0 ] ) ) , ReportOutputColumn ( 'median' , 'Median wait time' , mapfunc = ( lambda rep , col , row : row [ 1 ] ) ) ] , title = 'Summary since first revision' ) #NEWLINE# firstrev . set_row ( [ self . average_age ( wait_reviewer , agefirst ) , self . median_age ( wait_reviewer , agefirst ) ] ) #NEWLINE# compound . add_report ( project ) #NEWLINE# nonnackedrev = ReportOutputList ( [ ReportOutputColumn ( 'average' , 'Average wait time' , mapfunc = ( lambda rep , col , row : row [ 0 ] ) ) , ReportOutputColumn ( 'median' , 'Median wait time' , mapfunc = ( lambda rep , col , row : row [ 1 ] ) ) ] , title = 'Summary since last revision without -1/-2 from reviewer' ) #NEWLINE# nonnackedrev . set_row ( [ self . average_age ( wait_reviewer , agenonnacked ) , self . median_age ( wait_reviewer , agenonnacked ) ] ) #NEWLINE# compound . add_report ( nonnackedrev ) #NEWLINE# def waitlastmap( rep , col , row ) : #NEWLINE# #INDENT# return format_delta ( row . get_current_age ( ) ) #NEWLINE# #UNINDENT# def waitlastsort( rep , col , row ) : #NEWLINE# #INDENT# return row . get_current_age ( ) #NEWLINE# #UNINDENT# waitlastrev = self . new_table ( 'Longest waiting since current revision' ) #NEWLINE# waitlastrev . add_column ( ReportOutputColumn ( 'age' , 'Age' , sortfunc = waitlastsort , mapfunc = waitlastmap ) ) #NEWLINE# waitlastrev . sortcol = 'age' #NEWLINE# waitlastrev . reverse = True #NEWLINE# for change in self . get_longest_changes ( wait_reviewer , changes , agecurrent , 5 ) : #NEWLINE# #INDENT# waitlastrev . add_row ( change ) #NEWLINE# #UNINDENT# compound . add_report ( waitlastrev ) #NEWLINE# def waitfirstmap( rep , col , row ) : #NEWLINE# #INDENT# return format_delta ( row . get_first_age ( ) ) #NEWLINE# #UNINDENT# def waitfirstsort( rep , col , row ) : #NEWLINE# #INDENT# return row . get_first_age ( ) #NEWLINE# #UNINDENT# waitfirstrev = self . new_table ( 'Longest waiting since first revision' ) #NEWLINE# waitfirstrev . add_column ( ReportOutputColumn ( 'age' , 'Age' , sortfunc = waitfirstsort , mapfunc = waitfirstmap ) ) #NEWLINE# waitfirstrev . sortcol = 'age' #NEWLINE# waitfirstrev . reverse = True #NEWLINE# for change in self . get_longest_changes ( wait_reviewer , changes , agefirst , 5 ) : #NEWLINE# #INDENT# waitfirstrev . add_row ( change ) #NEWLINE# #UNINDENT# compound . add_report ( waitfirstrev ) #NEWLINE# def waitnonnackedmap( rep , col , row ) : #NEWLINE# #INDENT# return format_delta ( row . get_reviewer_not_nacked_age ( ) ) #NEWLINE# #UNINDENT# def waitnonnackedsort( rep , col , row ) : #NEWLINE# #INDENT# return row . get_reviewer_not_nacked_age ( ) #NEWLINE# #UNINDENT# waitnonnackedrev = self . new_table ( 'Longest waiting since last revision without -1/-2 from reviewer' ) #NEWLINE# waitnonnackedrev . add_column ( ReportOutputColumn ( 'age' , 'Age' , sortfunc = waitnonnackedsort , mapfunc = waitnonnackedmap ) ) #NEWLINE# waitnonnackedrev . sortcol = 'age' #NEWLINE# waitnonnackedrev . reverse = True #NEWLINE# for change in self . get_longest_changes ( wait_reviewer , changes , agenonnacked , 5 ) : #NEWLINE# #INDENT# waitnonnackedrev . add_row ( change ) #NEWLINE# #UNINDENT# compound . add_report ( waitnonnackedrev ) #NEWLINE# return compound