#NEWLINE# def main( argv = None ) : #NEWLINE# #INDENT# '\n    Handles command line arguments and gets things started.\n\n    :param argv: List of arguments, as if specified on the command-line.\n                 If None, ``sys.argv[1:]`` is used instead.\n    :type argv: list of str\n    ' #NEWLINE# parser = argparse . ArgumentParser ( description = 'Creates an experiment summary TSV file from a list of JSON                     files generated by run_experiment.' , formatter_class = argparse . ArgumentDefaultsHelpFormatter , conflict_handler = 'resolve' ) #NEWLINE# parser . add_argument ( 'summary_file' , help = 'TSV file to store summary of results.' ) #NEWLINE# parser . add_argument ( 'json_file' , help = 'JSON results file generated by run_experiment.' , nargs = '+' ) #NEWLINE# parser . add_argument ( '-a' , '--ablation' , action = 'store_true' , default = False , help = 'The results files are from an ablation run.' ) #NEWLINE# parser . add_argument ( '--version' , action = 'version' , version = '%(prog)s {0}' . format ( __version__ ) ) #NEWLINE# args = parser . parse_args ( argv ) #NEWLINE# logging . captureWarnings ( True ) #NEWLINE# logging . basicConfig ( format = ( '%(asctime)s - %(name)s - %(levelname)s - ' + '%(message)s' ) ) #NEWLINE# file_mode = ( 'w' if ( sys . version_info >= ( 3 , 0 ) ) else 'wb' ) #NEWLINE# with open ( args . summary_file , file_mode ) as output_file : #NEWLINE# #INDENT# _write_summary_file ( args . json_file , output_file , ablation = int ( args . ablation ) )