#NEWLINE# def create_tables( name , runSetResults , rows , rowsDiff , outputPath , outputFilePattern , options ) : #NEWLINE# #INDENT# '\n    Create tables and write them to files.\n    @return a list of futures to allow waiting for completion\n    ' #NEWLINE# common_prefix = os . path . commonprefix ( [ r . filename for r in rows ] ) #NEWLINE# common_prefix = common_prefix [ : ( common_prefix . rfind ( '/' ) + 1 ) ] #NEWLINE# for row in rows : #NEWLINE# #INDENT# Row . set_relative_path ( row , common_prefix , outputPath ) #NEWLINE# #UNINDENT# firstBenchmarkName = Util . prettylist ( runSetResults [ 0 ] . attributes [ 'benchmarkname' ] ) #NEWLINE# allBenchmarkNamesEqual = all ( ( ( Util . prettylist ( r . attributes [ 'benchmarkname' ] ) == runSetResult ) for r in runSetResults ) ) #NEWLINE# for r in runSetResults : #NEWLINE# #INDENT# if ( not r . attributes [ 'name' ] ) : #NEWLINE# #INDENT# r . attributes [ 'niceName' ] = r . attributes [ 'benchmarkname' ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if allBenchmarkNamesEqual : #NEWLINE# #INDENT# r . attributes [ 'niceName' ] = r . attributes [ 'name' ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# r . attributes [ 'niceName' ] = [ ( ( Util . prettylist ( r . attributes [ 'benchmarkname' ] ) + '.' ) + Util . prettylist ( r . attributes [ 'name' ] ) ) ] #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# template_values = ( lambda : None ) #NEWLINE# template_values . head = get_table_head ( runSetResults , common_prefix ) #NEWLINE# template_values . run_sets = [ runSetResult . attributes for runSetResult in runSetResults ] #NEWLINE# template_values . columns = [ [ column for column in runSet . columns ] for runSet in runSetResults ] #NEWLINE# template_values . columnTitles = [ [ column . format_title ( ) for column in runSet . columns ] for runSet in runSetResults ] #NEWLINE# template_values . relevant_id_columns = select_relevant_id_columns ( rows ) #NEWLINE# template_values . count_id_columns = template_values . relevant_id_columns . count ( True ) #NEWLINE# template_values . lib_url = options . lib_url #NEWLINE# template_values . base_dir = outputPath #NEWLINE# template_values . version = __version__ #NEWLINE# futures = [ ] #NEWLINE# def write_table( table_type , title , rows , use_local_summary ) : #NEWLINE# #INDENT# if ( not ( options . format == [ 'csv' ] ) ) : #NEWLINE# #INDENT# ( stats , stats_columns ) = get_stats ( rows ) #NEWLINE# if use_local_summary : #NEWLINE# #INDENT# summary = get_summary ( runSetResults ) #NEWLINE# if summary : #NEWLINE# #INDENT# stats . insert ( 1 , summary ) #NEWLINE# #UNINDENT# #UNINDENT# template_values . foot_columns = stats_columns #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# stats = None #NEWLINE# template_values . foot_columns = None #NEWLINE# #UNINDENT# for template_format in ( options . format or TEMPLATE_FORMATS ) : #NEWLINE# #INDENT# if ( outputFilePattern == '-' ) : #NEWLINE# #INDENT# outfile = None #NEWLINE# logging . info ( 'Writing %s to stdout...' , template_format . upper ( ) . ljust ( 4 ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# outfile = os . path . join ( outputPath , outputFilePattern . format ( name = name , type = table_type , ext = template_format ) ) #NEWLINE# logging . info ( 'Writing %s into %s ...' , template_format . upper ( ) . ljust ( 4 ) , outfile ) #NEWLINE# #UNINDENT# this_template_values = dict ( title = title , body = rows , foot = stats ) #NEWLINE# this_template_values . update ( template_values . __dict__ ) #NEWLINE# futures . append ( parallel . submit ( write_table_in_format , template_format , outfile , this_template_values , ( options . show_table and ( template_format == 'html' ) ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# write_table ( 'table' , name , rows , use_local_summary = ( ( not options . correct_only ) and ( not options . common ) ) ) #NEWLINE# if rowsDiff : #NEWLINE# #INDENT# write_table ( 'diff' , ( name + ' differences' ) , rowsDiff , use_local_summary = False ) #NEWLINE# #UNINDENT# return futures