Pass 3 of 3 · Deep dive of PHAROSPass 1 · OverviewPass 2 · How it works
Code Observatory / function
_signature
codeintel.parsers.python_parser._signature
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 |
| Symbol | File | Resolved by |
|---|---|---|
| _enter | python_parser.py | same file |
| Symbol | File | Resolved by |
|---|---|---|
| python_parser | python_parser.py | same file |
codeintel.parsers.python_parser._signaturebackend/app/codeintel/parsers/python_parser.py, lines 52–77Open source
def _signature(node: ast.AST) -> str: if isinstance(node, ast.ClassDef): bases = [ast.unparse(b) for b in node.bases] bases += [f"{k.arg}={ast.unparse(k.value)}" for k in node.keywords if k.arg] return f"class {node.name}({', '.join(bases)}):" if bases else f"class {node.name}:" assert isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef)) a = node.args def fmt(arg: ast.arg) -> str: return f"{arg.arg}: {ast.unparse(arg.annotation)}" if arg.annotation else arg.arg params: list[str] = [fmt(x) for x in a.posonlyargs] if a.posonlyargs: params.append("/") params += [fmt(x) for x in a.args] if a.vararg: params.append("*" + fmt(a.vararg)) elif a.kwonlyargs: params.append("*") params += [fmt(x) for x in a.kwonlyargs] if a.kwarg: params.append("**" + fmt(a.kwarg)) ret = f" -> {ast.unparse(node.returns)}" if node.returns else "" prefix = "async def" if isinstance(node, ast.AsyncFunctionDef) else "def" return clip(f"{prefix} {node.name}({', '.join(params)}){ret}:", MAX_SIGNATURE_CHARS)What the index recorded
- Signature
def _signature(node: ast.AST) -> str:- File
backend/app/codeintel/parsers/python_parser.py- Lines
- 52–77
- Parser
- python-ast
- Git blob
63495bcda67d5742151d40ab76540e513f44e088- Call sites
- 6 named, 2 resolved, 4 left unlinked
- Outside this subset
- 1 more edges reach code outside the graph shown here
