Pass 3 of 3 · Deep dive of PHAROSPass 1 · OverviewPass 2 · How it works
Code Observatory / function
body_excerpt
codeintel.text.body_excerpt
PINNED SOURCE Source and edges from the index at this commit. An execution appears only where one was recorded.
PHAROS at 975a38dMIT license
Around this symbol
Search all symbolsLoading
| Symbol | File | Resolved by |
|---|---|---|
| _after_signature | text.py | same file |
| Symbol | File | Resolved by |
|---|---|---|
| _build_rows | indexer.py | through an import |
| Symbol | File | Resolved by |
|---|---|---|
| text | text.py | same file |
codeintel.text.body_excerptbackend/app/codeintel/text.py, lines 72–87Open source
def body_excerpt(lines: list[str], sym: Symbol, *, max_lines: int | None = None, max_chars: int = SUMMARY_BODY_CHARS) -> str: """The first non-blank lines of a function after its signature (docstring removed). Behaviour that lives only in the body ("run the persistent pre-run hooks") is invisible to a summary of signature and docstring alone. """ max_lines = SUMMARY_BODY_LINES if max_lines is None else max_lines if max_lines <= 0 or sym.kind not in BODY_KINDS: return "" body = lines[sym.start_line - 1:sym.end_line] if sym.kind != "block": body = _after_signature(body, sym.signature) text = _DOCSTRING_RE.sub("", "\n".join(body), count=1) if sym.docstring else "\n".join(body) kept = [line.rstrip() for line in text.splitlines() if line.strip() and not _BRACES_ONLY.match(line)] return "\n".join(kept[:max_lines])[:max_chars]What the index recorded
- Signature
def body_excerpt(lines: list[str], sym: Symbol, *, max_lines: int | None, max_chars: int) -> str:- File
backend/app/codeintel/text.py- Lines
- 72–87
- Parser
- python-ast
- Git blob
74781c9c047d5953611fd7634b2cf29e7661b895- Call sites
- 7 named, 1 resolved, 6 left unlinked
- Outside this subset
- 1 more edges reach code outside the graph shown here
