MCPcopy
hub / github.com/huggingface/smolagents / evaluate_assign

Function evaluate_assign

src/smolagents/local_python_executor.py:770–791  ·  view source on GitHub ↗
(
    assign: ast.Assign,
    state: dict[str, Any],
    static_tools: dict[str, Callable],
    custom_tools: dict[str, Callable],
    authorized_imports: list[str],
)

Source from the content-addressed store, hash-verified

768
769
770def 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
794def set_value(

Callers 1

evaluate_astFunction · 0.85

Calls 3

evaluate_astFunction · 0.85
set_valueFunction · 0.85
appendMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…