X7ROOT File Manager
Current Path:
/usr/lib64/python2.7/site-packages/coverage
usr
/
lib64
/
python2.7
/
site-packages
/
coverage
/
📁
..
📄
__init__.py
(4.4 KB)
📄
__init__.pyc
(2.29 KB)
📄
__init__.pyo
(2.29 KB)
📄
__main__.py
(100 B)
📄
__main__.pyc
(308 B)
📄
__main__.pyo
(308 B)
📄
annotate.py
(2.92 KB)
📄
annotate.pyc
(3.1 KB)
📄
annotate.pyo
(3.1 KB)
📄
backward.py
(3.97 KB)
📄
backward.pyc
(4.3 KB)
📄
backward.pyo
(4.3 KB)
📄
bytecode.py
(2.27 KB)
📄
bytecode.pyc
(3.29 KB)
📄
bytecode.pyo
(3.29 KB)
📄
cmdline.py
(24.16 KB)
📄
cmdline.pyc
(20.01 KB)
📄
cmdline.pyo
(19.96 KB)
📄
codeunit.py
(4.34 KB)
📄
codeunit.pyc
(5.19 KB)
📄
codeunit.pyo
(5.19 KB)
📄
collector.py
(12.7 KB)
📄
collector.pyc
(9.14 KB)
📄
collector.pyo
(9.08 KB)
📄
config.py
(6.86 KB)
📄
config.pyc
(7.67 KB)
📄
config.pyo
(7.67 KB)
📄
control.py
(26.58 KB)
📄
control.pyc
(21.95 KB)
📄
control.pyo
(21.95 KB)
📄
data.py
(8.63 KB)
📄
data.pyc
(9.65 KB)
📄
data.pyo
(9.65 KB)
📄
execfile.py
(4.78 KB)
📄
execfile.pyc
(3.45 KB)
📄
execfile.pyo
(3.45 KB)
📄
files.py
(9.8 KB)
📄
files.pyc
(10.62 KB)
📄
files.pyo
(10.62 KB)
📄
html.py
(11.84 KB)
📄
html.pyc
(11.24 KB)
📄
html.pyo
(11.15 KB)
📁
htmlfiles
📄
misc.py
(4.08 KB)
📄
misc.pyc
(6.13 KB)
📄
misc.pyo
(6.13 KB)
📄
parser.py
(23.65 KB)
📄
parser.pyc
(17.16 KB)
📄
parser.pyo
(17 KB)
📄
phystokens.py
(7.07 KB)
📄
phystokens.pyc
(5.3 KB)
📄
phystokens.pyo
(5.24 KB)
📄
report.py
(2.96 KB)
📄
report.pyc
(2.86 KB)
📄
report.pyo
(2.86 KB)
📄
results.py
(8.86 KB)
📄
results.pyc
(9.29 KB)
📄
results.pyo
(9.23 KB)
📄
summary.py
(2.9 KB)
📄
summary.pyc
(2.88 KB)
📄
summary.pyo
(2.88 KB)
📄
templite.py
(5.57 KB)
📄
templite.pyc
(4.8 KB)
📄
templite.pyo
(4.61 KB)
📄
tracer.so
(15.91 KB)
📄
version.py
(336 B)
📄
version.pyc
(361 B)
📄
version.pyo
(361 B)
📄
xmlreport.py
(5.57 KB)
📄
xmlreport.pyc
(4.86 KB)
📄
xmlreport.pyo
(4.86 KB)
Editing: annotate.py
"""Source file annotation for Coverage.""" import os, re from coverage.report import Reporter class AnnotateReporter(Reporter): """Generate annotated source files showing line coverage. This reporter creates annotated copies of the measured source files. Each .py file is copied as a .py,cover file, with a left-hand margin annotating each line:: > def h(x): - if 0: #pragma: no cover - pass > if x == 1: ! a = 1 > else: > a = 2 > h(2) Executed lines use '>', lines not executed use '!', lines excluded from consideration use '-'. """ def __init__(self, coverage, config): super(AnnotateReporter, self).__init__(coverage, config) self.directory = None blank_re = re.compile(r"\s*(#|$)") else_re = re.compile(r"\s*else\s*:\s*(#|$)") def report(self, morfs, directory=None): """Run the report. See `coverage.report()` for arguments. """ self.report_files(self.annotate_file, morfs, directory) def annotate_file(self, cu, analysis): """Annotate a single file. `cu` is the CodeUnit for the file to annotate. """ if not cu.relative: return filename = cu.filename source = cu.source_file() if self.directory: dest_file = os.path.join(self.directory, cu.flat_rootname()) dest_file += ".py,cover" else: dest_file = filename + ",cover" dest = open(dest_file, 'w') statements = analysis.statements missing = analysis.missing excluded = analysis.excluded lineno = 0 i = 0 j = 0 covered = True while True: line = source.readline() if line == '': break lineno += 1 while i < len(statements) and statements[i] < lineno: i += 1 while j < len(missing) and missing[j] < lineno: j += 1 if i < len(statements) and statements[i] == lineno: covered = j >= len(missing) or missing[j] > lineno if self.blank_re.match(line): dest.write(' ') elif self.else_re.match(line): # Special logic for lines containing only 'else:'. if i >= len(statements) and j >= len(missing): dest.write('! ') elif i >= len(statements) or j >= len(missing): dest.write('> ') elif statements[i] == missing[j]: dest.write('! ') else: dest.write('> ') elif lineno in excluded: dest.write('- ') elif covered: dest.write('> ') else: dest.write('! ') dest.write(line) source.close() dest.close()
Upload File
Create Folder