Skip to content

Commit

Permalink
Simplify multiple isinstance
Browse files Browse the repository at this point in the history
  • Loading branch information
albertvillanova committed Mar 6, 2025
1 parent e7a73b6 commit 7b0b494
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/smolagents/local_python_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -640,13 +640,7 @@ def evaluate_call(
custom_tools: Dict[str, Callable],
authorized_imports: List[str],
) -> Any:
if not (
isinstance(call.func, ast.Call)
or isinstance(call.func, ast.Lambda)
or isinstance(call.func, ast.Attribute)
or isinstance(call.func, ast.Name)
or isinstance(call.func, ast.Subscript)
):
if not isinstance(call.func, (ast.Call, ast.Lambda, ast.Attribute, ast.Name, ast.Subscript)):
raise InterpreterError(f"This is not a correct function: {call.func}).")

func, func_name = None, None
Expand Down

0 comments on commit 7b0b494

Please sign in to comment.