From 995debcded55817348cc640cac8ea07ca12bd57c 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/annotate.py | 10 +++++----- coverage/html.py | 18 ++++++++--------- coverage/htmlfiles/pyfile.html | 4 ++-- coverage/report.py | 44 +++++++++++++++++++++--------------------- coverage/results.py | 6 +++--- coverage/summary.py | 14 +++++++------- coverage/xmlreport.py | 6 +++--- 7 files changed, 51 insertions(+), 51 deletions(-) (limited to 'coverage') diff --git a/coverage/annotate.py b/coverage/annotate.py index 3487feb6..b77df4ec 100644 --- a/coverage/annotate.py +++ b/coverage/annotate.py @@ -41,10 +41,10 @@ class AnnotateReporter(Reporter): """ self.report_files(self.annotate_file, morfs, directory) - def annotate_file(self, cu, analysis): + def annotate_file(self, fr, analysis): """Annotate a single file. - `cu` is the CodeUnit for the file to annotate. + `fr` is the FileReporter for the file to annotate. """ statements = sorted(analysis.statements) @@ -52,18 +52,18 @@ class AnnotateReporter(Reporter): excluded = sorted(analysis.excluded) if self.directory: - dest_file = os.path.join(self.directory, cu.flat_rootname()) + dest_file = os.path.join(self.directory, fr.flat_rootname()) if dest_file.endswith("_py"): dest_file = dest_file[:-3] + ".py" dest_file += ",cover" else: - dest_file = cu.filename + ",cover" + dest_file = fr.filename + ",cover" with open(dest_file, 'w') as dest: i = 0 j = 0 covered = True - source = cu.source() + source = fr.source() for lineno, line in enumerate(source.splitlines(True), start=1): while i < len(statements) and statements[i] < lineno: i += 1 diff --git a/coverage/html.py b/coverage/html.py index 2a9e0d11..96282161 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) diff --git a/coverage/htmlfiles/pyfile.html b/coverage/htmlfiles/pyfile.html index 38dfb47b..f9d898aa 100644 --- a/coverage/htmlfiles/pyfile.html +++ b/coverage/htmlfiles/pyfile.html @@ -5,7 +5,7 @@ {# IE8 rounds line-height incorrectly, and adding this emulateIE7 line makes it right! #} {# http://social.msdn.microsoft.com/Forums/en-US/iewebdevelopment/thread/7684445e-f080-4d8f-8529-132763348e21 #} - Coverage for {{cu.name|escape}}: {{nums.pc_covered_str}}% + Coverage for {{fr.name|escape}}: {{nums.pc_covered_str}}% {% if extra_css %} @@ -22,7 +22,7 @@