From: Brian Warner Date: Thu, 12 Feb 2009 03:05:15 +0000 (-0700) Subject: figleaf_htmlizer: more rearranging, behavior should still be unchanged X-Git-Tag: allmydata-tahoe-1.3.0~22 X-Git-Url: https://git.rkrishnan.org/%5B/quickstart.html?a=commitdiff_plain;h=125bf09528f5e318e0e9024eae4a68fc8dd896be;p=tahoe-lafs%2Ftahoe-lafs.git figleaf_htmlizer: more rearranging, behavior should still be unchanged --- diff --git a/src/allmydata/util/figleaf_htmlizer.py b/src/allmydata/util/figleaf_htmlizer.py index 85639941..289ebe85 100644 --- a/src/allmydata/util/figleaf_htmlizer.py +++ b/src/allmydata/util/figleaf_htmlizer.py @@ -142,44 +142,16 @@ class Renderer: % (len(pcnts), len(pcnt_90), len(pcnt_75), len(pcnt_50))) - def emit_table(items, show_totals): - index_fp.write('' - '' - '' - '\n') - if show_totals: - index_fp.write('' - '' - '' - '' - '' - '' - '\n' - % (summary_lines, summary_cover, - (summary_lines - summary_cover), - summary_pcnt,)) - - for filename, stuff in items: - (n_lines, n_covered, percent_covered, display_filename) = stuff - html_outfile = self.make_html_filename(display_filename) - - index_fp.write('' - '' - '\n' - % (html_outfile, display_filename, n_lines, - n_covered, (n_lines - n_covered), - percent_covered,)) - - index_fp.write('
Filename# lines# covered# uncovered% covered
totals:%d%d%d%.1f%%
%s%d%d%d%.1f
\n') - # sorted by number of lines that aren't covered index_fp.write('

Sorted by Lines Uncovered

\n') - emit_table(info_dict_items, True) + self.emit_table(index_fp, info_dict_items, True, + summary_lines, summary_cover, summary_pcnt) # sorted by module name index_fp.write('

Sorted by Module Name (alphabetical)

\n') info_dict_items.sort() - emit_table(info_dict_items, False) + self.emit_table(index_fp, info_dict_items, False, + summary_lines, summary_cover, summary_pcnt) index_fp.close() @@ -243,6 +215,37 @@ class Renderer: return (n_lines, n_covered, pcnt, display_filename) + def emit_table(self, index_fp, items, show_totals, + summary_lines, summary_cover, summary_pcnt): + index_fp.write('' + '' + '' + '\n') + if show_totals: + index_fp.write('' + '' + '' + '' + '' + '' + '\n' + % (summary_lines, summary_cover, + (summary_lines - summary_cover), + summary_pcnt,)) + + for filename, stuff in items: + (n_lines, n_covered, percent_covered, display_filename) = stuff + html_outfile = self.make_html_filename(display_filename) + + index_fp.write('' + '' + '\n' + % (html_outfile, display_filename, n_lines, + n_covered, (n_lines - n_covered), + percent_covered,)) + + index_fp.write('
Filename# lines# covered# uncovered% covered
totals:%d%d%d%.1f%%
%s%d%d%d%.1f
\n') + def make_html_filename(self, orig): return orig + ".html"