Back to the room

Pass 3 of 3 · Deep dive of PHAROSPass 1 · OverviewPass 2 · How it works

Code Observatory / function

_file_comment

codeintel.parsers.treesitter_parser._file_comment

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 symbols

Loading

Calls (3)
SymbolFileResolved by
clipbase.pythrough an import
_clean_commenttreesitter_parser.pysame file
_texttreesitter_parser.pysame file
Called by (1)
SymbolFileResolved by
parse_treesittertreesitter_parser.pysame file
Inside (1)
SymbolFileResolved by
treesitter_parsertreesitter_parser.pysame file
codeintel.parsers.treesitter_parser._file_commentbackend/app/codeintel/parsers/treesitter_parser.py, lines 520–541Open source
def _file_comment(root, src: bytes) -> str:    """Leading comment block at the top of a file (package / module docs)."""    comments = []    following = None    for child in root.children:        if child.type in _COMMENT_TYPES:            comments.append(child)            continue        following = child        break    if not comments:        return ""    # A comment glued to the next definition documents that definition, not    # the file — unless it is Go's package doc comment.    if (        following is not None        and following.type != "package_clause"        and following.start_point[0] <= comments[-1].end_point[0] + 1    ):        return ""    text = "\n".join(_text(c, src) for c in comments)    return clip(_clean_comment(text), MAX_DOCSTRING_CHARS)

What the index recorded

Signature
def _file_comment(root, src: bytes) -> str:
File
backend/app/codeintel/parsers/treesitter_parser.py
Lines
520–541
Parser
python-ast
Git blob
bf0c9a8044cadd3452ebf5ffa82b866ae00395a9
Call sites
5 named, 3 resolved, 2 left unlinked

Read it on GitHub at this commit