Produce a stable chunk ID for a top-level AST statement.
(node: ast.stmt, seen: Dict[str, int])
| 68 | |
| 69 | |
| 70 | def _make_chunk_id(node: ast.stmt, seen: Dict[str, int]) -> str: |
| 71 | """Produce a stable chunk ID for a top-level AST statement.""" |
| 72 | if isinstance(node, _NAMED_TYPES): |
| 73 | base = f"{node.__class__.__name__}:{node.name}" |
| 74 | idx = seen.get(base, 0) |
| 75 | seen[base] = idx + 1 |
| 76 | return base if idx == 0 else f"{base}:{idx}" |
| 77 | return f"stmt:{node.lineno}" |
| 78 | |
| 79 | |
| 80 | def _source_slice(lines: List[str], node: ast.stmt) -> str: |
no outgoing calls