(
assign: ast.Assign,
state: dict[str, Any],
static_tools: dict[str, Callable],
custom_tools: dict[str, Callable],
authorized_imports: list[str],
)
| 768 | |
| 769 | |
| 770 | def evaluate_assign( |
| 771 | assign: ast.Assign, |
| 772 | state: dict[str, Any], |
| 773 | static_tools: dict[str, Callable], |
| 774 | custom_tools: dict[str, Callable], |
| 775 | authorized_imports: list[str], |
| 776 | ) -> Any: |
| 777 | result = evaluate_ast(assign.value, state, static_tools, custom_tools, authorized_imports) |
| 778 | if len(assign.targets) == 1: |
| 779 | target = assign.targets[0] |
| 780 | set_value(target, result, state, static_tools, custom_tools, authorized_imports) |
| 781 | else: |
| 782 | expanded_values = [] |
| 783 | for tgt in assign.targets: |
| 784 | if isinstance(tgt, ast.Starred): |
| 785 | expanded_values.extend(result) |
| 786 | else: |
| 787 | expanded_values.append(result) |
| 788 | |
| 789 | for tgt, val in zip(assign.targets, expanded_values): |
| 790 | set_value(tgt, val, state, static_tools, custom_tools, authorized_imports) |
| 791 | return result |
| 792 | |
| 793 | |
| 794 | def set_value( |
no test coverage detected
searching dependent graphs…