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])
| 3412 | |
| 3413 | |
| 3414 | def _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 | |
| 3430 | def _python_import_bound_names(node, source: bytes) -> list[str]: |
no test coverage detected