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

Function evaluate_attribute

src/smolagents/local_python_executor.py:383–393  ·  view source on GitHub ↗
(
    expression: ast.Attribute,
    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

381
382
383def evaluate_attribute(
384 expression: ast.Attribute,
385 state: dict[str, Any],
386 static_tools: dict[str, Callable],
387 custom_tools: dict[str, Callable],
388 authorized_imports: list[str],
389) -> Any:
390 if expression.attr.startswith("__") and expression.attr.endswith("__"):
391 raise InterpreterError(f"Forbidden access to dunder attribute: {expression.attr}")
392 value = evaluate_ast(expression.value, state, static_tools, custom_tools, authorized_imports)
393 return getattr(value, expression.attr)
394
395
396def evaluate_unaryop(

Callers 1

evaluate_astFunction · 0.85

Calls 2

InterpreterErrorClass · 0.85
evaluate_astFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…