MCPcopy Index your code
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 title = quoteattr('as ' + ', '.join(as_functions))
36 count = len(as_functions)
37 yield 0, f'<div title={title} style="background: #ccffcc">[{count:2}]'
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

Used in the wild real call sites across dependent graphs

searching dependent graphs…