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 symbolsLoading
| Symbol | File | Resolved by |
|---|---|---|
| clip | base.py | through an import |
| _clean_comment | treesitter_parser.py | same file |
| _text | treesitter_parser.py | same file |
| Symbol | File | Resolved by |
|---|---|---|
| parse_treesitter | treesitter_parser.py | same file |
| Symbol | File | Resolved by |
|---|---|---|
| treesitter_parser | treesitter_parser.py | same 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
