',
+ ]
+ for l, line in enumerate(self.lines):
+ lineno: int = l + 1
+ line_buf: str = (
+ f'
{lineno}
'
+ )
+ for c, char in enumerate(line):
+ pos: tuple[int, int] = (lineno, c)
+ closings: list[str] = self.closings.get(pos, [])
+ openings: list[str] = self.openings.get(pos, [])
+ line_buf += "".join(closings + openings)
+ line_buf += char
+ line_buf += "
"
+ lines.append(" " + line_buf)
+ lines.extend(
+ [
+ "
",
+ "",
+ "",
+ ]
+ )
+
+ buf.write("\n".join(lines))
+
+ def wrap(self, node: Locatable, cls: str):
+ if node.location is None:
+ return
+ if node.location.end_lineno is None or node.location.end_col_offset is None:
+ return
+ start_pos: tuple[int, int] = (node.location.lineno, node.location.col_offset)
+ end_pos: tuple[int, int] = (
+ node.location.end_lineno,
+ node.location.end_col_offset,
+ )
+ opening: str = f'