def make_html(instream, outstream, title): p = parser.parser() printer = html_printer.printer(outstream) html_printer.prelude(outstream, title) j = p.parse(instream, sys.argv[1]) amapper = abbreviation.mapper() for i in j: for k in i.results: amapper.analyse_result(k) remapper = abbreviation.remapper(amapper.shorts) peo = person.analyser() for i in j: for k in i.results: remapper.fix_result(k) peo.analyse_result(k) for i in j: printer.print_comp(i) print >>outstream, "\n" print >>outstream, "<h1>Per-person summary</h1>\n<p>Note: you can click the table headings for different sortings</p>" pp = html_printer.personlist_printer(peo.people.values(), True, outstream) pp.print_people()
def main(argv): parser = optparse.OptionParser("usage: %prog [options] input-file.csv") parser.add_option("-o", "--output-format", dest="output_format", choices=["graph-html", "jim-html", "jim-text"], default="jim-text") parser.add_option("--print-summary", dest="print_summary", action="store_true") (options, args) = parser.parse_args(argv[1:]) if len(args) != 1: parser.error("wrong number of arguments") return 1 input_csv_filename = args[0] output_stream = sys.stdout output_module = {"jim-text": jim_printer, "graph-html": html_printer, "jim-html": jim_html_printer}[options.output_format] printer = output_module.printer(output_stream) parsed = list(parse(csv.reader(open(input_csv_filename, "r")))) output_module.prelude(output_stream, "Results") for i in parsed: printer.print_comp(i) if options.print_summary: peo = person.analyser() for i in parsed: for k in i.results: peo.analyse_result(k) pp = output_module.personlist_printer(peo.people.values(), True, output_stream) pp.print_people() return 0