MCPcopy Create free account
hub / github.com/numpy/numpy / FunctionHtmlFormatter

Class FunctionHtmlFormatter

tools/c_coverage/c_coverage_report.py:25–42  ·  view source on GitHub ↗

Custom HTML formatter to insert extra information with the lines.

Source from the content-addressed store, hash-verified

23
24
25class FunctionHtmlFormatter(HtmlFormatter):
26 """Custom HTML formatter to insert extra information with the lines."""
27 def __init__(self, lines, **kwargs):
28 HtmlFormatter.__init__(self, **kwargs)
29 self.lines = lines
30
31 def wrap(self, source, outfile):
32 for i, (c, t) in enumerate(HtmlFormatter.wrap(self, source, outfile)):
33 as_functions = self.lines.get(i-1, None)
34 if as_functions is not None:
35 yield 0, ('<div title=%s style="background: #ccffcc">[%2d]' %
36 (quoteattr('as ' + ', '.join(as_functions)),
37 len(as_functions)))
38 else:
39 yield 0, ' '
40 yield c, t
41 if as_functions is not None:
42 yield 0, '</div>'
43
44
45class SourceFile:

Callers 1

write_htmlMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected