Per-line bitmap; True when the line sits inside a code-verify fence.
(lines: list[str])
| 104 | |
| 105 | |
| 106 | def _fence_mask(lines: list[str]) -> list[bool]: |
| 107 | """Per-line bitmap; True when the line sits inside a code-verify fence.""" |
| 108 | mask = [False] * len(lines) |
| 109 | fenced = False |
| 110 | for i, line in enumerate(lines): |
| 111 | if _FENCE_OFF_RE.match(line): |
| 112 | fenced = True |
| 113 | mask[i] = True |
| 114 | continue |
| 115 | if _FENCE_ON_RE.match(line): |
| 116 | fenced = False |
| 117 | mask[i] = True |
| 118 | continue |
| 119 | mask[i] = fenced |
| 120 | return mask |
| 121 | |
| 122 | |
| 123 | def _inbody_comment_spans(src: bytes) -> list[tuple[int, int]]: |
no outgoing calls
no test coverage detected