MCPcopy Create free account
hub / github.com/ParzivalHack/PySpector / _make_chunk_id

Function _make_chunk_id

src/pyspector/ast_cache.py:70–77  ·  view source on GitHub ↗

Produce a stable chunk ID for a top-level AST statement.

(node: ast.stmt, seen: Dict[str, int])

Source from the content-addressed store, hash-verified

68
69
70def _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
80def _source_slice(lines: List[str], node: ast.stmt) -> str:

Callers 3

_idsMethod · 0.90
_chunk_hashesMethod · 0.85

Calls

no outgoing calls

Tested by 1

_idsMethod · 0.72