MCPcopy Create free account
hub / github.com/FastLED/FastLED / _read_source_signature

Function _read_source_signature

ci/tools/check_noexcept.py:194–222  ·  view source on GitHub ↗

Return display line and full source signature for an AST match.

(filepath: str, line_num: int)

Source from the content-addressed store, hash-verified

192
193
194def _read_source_signature(filepath: str, line_num: int) -> tuple[str, str]:
195 """Return display line and full source signature for an AST match."""
196 full_path = PROJECT_ROOT / filepath
197 if not full_path.exists():
198 return "", ""
199
200 lines = full_path.read_text(encoding="utf-8", errors="replace").splitlines()
201 if line_num < 1 or line_num > len(lines):
202 return "", ""
203
204 display_line = lines[line_num - 1].strip()
205 signature_lines: list[str] = []
206 paren_depth = 0
207 found_open = False
208
209 for idx in range(line_num - 1, min(line_num + 39, len(lines))):
210 raw = lines[idx].rstrip()
211 signature_lines.append(raw)
212 code = raw.split("//", 1)[0]
213 for ch in code:
214 if ch == "(":
215 paren_depth += 1
216 found_open = True
217 elif ch == ")":
218 paren_depth -= 1
219 elif ch in (";", "{") and found_open and paren_depth == 0:
220 return display_line, "\n".join(signature_lines)
221
222 return display_line, "\n".join(signature_lines)
223
224
225def _signature_is_exempt(signature: str) -> bool:

Callers 1

_run_clang_queryFunction · 0.85

Calls 1

appendMethod · 0.45

Tested by

no test coverage detected