MCPcopy Create free account
hub / github.com/Graphify-Labs/graphify / _python_collect_assignment_targets

Function _python_collect_assignment_targets

graphify/extractors/engine.py:3414–3427  ·  view source on GitHub ↗

Identifiers bound as `pattern` targets under a Python AST subtree. Recurses through `pattern_list` / `tuple_pattern` / `list_pattern` so tuple unpacking (`a, b = ...`, `for a, b in ...`) contributes every bound name.

(node, source: bytes, out: set[str])

Source from the content-addressed store, hash-verified

3412
3413
3414def _python_collect_assignment_targets(node, source: bytes, out: set[str]) -> None:
3415 """Identifiers bound as `pattern` targets under a Python AST subtree.
3416
3417 Recurses through `pattern_list` / `tuple_pattern` / `list_pattern` so tuple
3418 unpacking (`a, b = ...`, `for a, b in ...`) contributes every bound name.
3419 """
3420 if node is None:
3421 return
3422 if node.type == "identifier":
3423 out.add(_read_text(node, source))
3424 return
3425 if node.type in ("pattern_list", "tuple_pattern", "list_pattern"):
3426 for c in node.children:
3427 _python_collect_assignment_targets(c, source, out)
3428
3429
3430def _python_import_bound_names(node, source: bytes) -> list[str]:

Callers 3

_python_untouched_paramsFunction · 0.85
walkFunction · 0.85
poisonFunction · 0.85

Calls 1

_read_textFunction · 0.90

Tested by

no test coverage detected