Function
evaluate_lambda
(
lambda_expression: ast.Lambda,
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
| 440 | |
| 441 | |
| 442 | def evaluate_lambda( |
| 443 | lambda_expression: ast.Lambda, |
| 444 | state: Dict[str, Any], |
| 445 | static_tools: Dict[str, Callable], |
| 446 | custom_tools: Dict[str, Callable], |
| 447 | authorized_imports: List[str], |
| 448 | ) -> Callable: |
| 449 | args = [arg.arg for arg in lambda_expression.args.args] |
| 450 | |
| 451 | def lambda_func(*values: Any) -> Any: |
| 452 | new_state = state.copy() |
| 453 | for arg, value in zip(args, values): |
| 454 | new_state[arg] = value |
| 455 | return evaluate_ast( |
| 456 | lambda_expression.body, |
| 457 | new_state, |
| 458 | static_tools, |
| 459 | custom_tools, |
| 460 | authorized_imports, |
| 461 | ) |
| 462 | |
| 463 | return lambda_func |
| 464 | |
| 465 | |
| 466 | def evaluate_while( |
Tested by
no test coverage detected