From 22f3e364c92776a0f10d1fb12b3dd8e685cb3293 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sun, 22 Feb 2015 08:10:32 -0500 Subject: Remove every last trace of CodeUnit, and bring me a glass of vodka --- coverage/html.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'coverage/html.py') diff --git a/coverage/html.py b/coverage/html.py index 2a9e0d1..9628216 100644 --- a/coverage/html.py +++ b/coverage/html.py @@ -150,20 +150,20 @@ class HtmlReporter(Reporter): with open(fname, "wb") as fout: fout.write(html.encode('ascii', 'xmlcharrefreplace')) - def file_hash(self, source, cu): + def file_hash(self, source, fr): """Compute a hash that changes if the file needs to be re-reported.""" m = Hasher() m.update(source) - self.coverage.data.add_to_hash(cu.filename, m) + self.coverage.data.add_to_hash(fr.filename, m) return m.hexdigest() - def html_file(self, cu, analysis): + def html_file(self, fr, analysis): """Generate an HTML file for one source file.""" - source = cu.source() + source = fr.source() # Find out if the file on disk is already correct. - flat_rootname = cu.flat_rootname() - this_hash = self.file_hash(source.encode('utf-8'), cu) + flat_rootname = fr.flat_rootname() + this_hash = self.file_hash(source.encode('utf-8'), fr) that_hash = self.status.file_hash(flat_rootname) if this_hash == that_hash: # Nothing has changed to require the file to be reported again. @@ -186,7 +186,7 @@ class HtmlReporter(Reporter): lines = [] - for lineno, line in enumerate(cu.source_token_lines(), start=1): + for lineno, line in enumerate(fr.source_token_lines(), start=1): # Figure out how to mark this line. line_class = [] annotate_html = "" @@ -236,7 +236,7 @@ class HtmlReporter(Reporter): template_values = { 'c_exc': c_exc, 'c_mis': c_mis, 'c_par': c_par, 'c_run': c_run, 'arcs': self.arcs, 'extra_css': self.extra_css, - 'cu': cu, 'nums': nums, 'lines': lines, + 'fr': fr, 'nums': nums, 'lines': lines, } html = spaceless(self.source_tmpl.render(template_values)) @@ -248,7 +248,7 @@ class HtmlReporter(Reporter): index_info = { 'nums': nums, 'html_filename': html_filename, - 'name': cu.name, + 'name': fr.name, } self.files.append(index_info) self.status.set_index_info(flat_rootname, index_info) -- cgit v1.2.1 From f6cc3e33810adcdb100a9223971b602bbb46881f Mon Sep 17 00:00:00 2001 From: Jon Chappell Date: Mon, 13 Apr 2015 12:42:46 -0400 Subject: Convert single quoted html output to use double quotes. --- coverage/html.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'coverage/html.py') diff --git a/coverage/html.py b/coverage/html.py index 2a9e0d1..d4a2229 100644 --- a/coverage/html.py +++ b/coverage/html.py @@ -221,7 +221,7 @@ class HtmlReporter(Reporter): else: tok_html = escape(tok_text) or ' ' html.append( - "%s" % (tok_type, tok_html) + '%s' % (tok_type, tok_html) ) lines.append({ -- cgit v1.2.1 From 61a07dc55be8b5c4028ebafe2e603335349358e2 Mon Sep 17 00:00:00 2001 From: Conrad Ho Date: Tue, 14 Apr 2015 03:54:05 +0800 Subject: Ticket299: add time stamp to index.html reports page --- coverage/html.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'coverage/html.py') diff --git a/coverage/html.py b/coverage/html.py index 2a9e0d1..92ca3f1 100644 --- a/coverage/html.py +++ b/coverage/html.py @@ -2,6 +2,7 @@ from __future__ import unicode_literals +import datetime import json import os import re @@ -261,11 +262,14 @@ class HtmlReporter(Reporter): self.totals = sum(f['nums'] for f in self.files) + time_stamp = datetime.datetime.now().strftime('%Y-%m-%d %H:%M') + html = index_tmpl.render({ 'arcs': self.arcs, 'extra_css': self.extra_css, 'files': self.files, 'totals': self.totals, + 'time_stamp': time_stamp, }) self.write_html( -- cgit v1.2.1 From 2a7a4f2161d26eeb898f3deec3f7ce21b0f2f957 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Tue, 21 Apr 2015 21:31:58 -0400 Subject: More work on #299 Add the timestamp to the Python output files also. Move the timestamp to the footer. Add Conrad to AUTHORS, and update the CHANGES file. --- coverage/html.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'coverage/html.py') diff --git a/coverage/html.py b/coverage/html.py index 2748d64..0b2cc25 100644 --- a/coverage/html.py +++ b/coverage/html.py @@ -93,6 +93,7 @@ class HtmlReporter(Reporter): self.status = HtmlStatus() self.extra_css = None self.totals = Numbers() + self.time_stamp = datetime.datetime.now().strftime('%Y-%m-%d %H:%M') def report(self, morfs): """Generate an HTML report for `morfs`. @@ -238,6 +239,7 @@ class HtmlReporter(Reporter): 'c_exc': c_exc, 'c_mis': c_mis, 'c_par': c_par, 'c_run': c_run, 'arcs': self.arcs, 'extra_css': self.extra_css, 'fr': fr, 'nums': nums, 'lines': lines, + 'time_stamp': self.time_stamp, } html = spaceless(self.source_tmpl.render(template_values)) @@ -262,14 +264,12 @@ class HtmlReporter(Reporter): self.totals = sum(f['nums'] for f in self.files) - time_stamp = datetime.datetime.now().strftime('%Y-%m-%d %H:%M') - html = index_tmpl.render({ 'arcs': self.arcs, 'extra_css': self.extra_css, 'files': self.files, 'totals': self.totals, - 'time_stamp': time_stamp, + 'time_stamp': self.time_stamp, }) self.write_html( -- cgit v1.2.1