MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / _fence_mask

Function _fence_mask

scripts/strip-inbody-comments.py:106–120  ·  view source on GitHub ↗

Per-line bitmap; True when the line sits inside a code-verify fence.

(lines: list[str])

Source from the content-addressed store, hash-verified

104
105
106def _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
123def _inbody_comment_spans(src: bytes) -> list[tuple[int, int]]:

Callers 1

_inbody_comment_spansFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected