mirror of
https://github.com/hwchase17/langchain
synced 2024-11-16 06:13:16 +00:00
Fix runnable vistitor for funcs without pos args (#15182)
This commit is contained in:
parent
b4a0d206d9
commit
7e26559256
@ -107,14 +107,20 @@ class IsFunctionArgDict(ast.NodeVisitor):
|
|||||||
self.keys: Set[str] = set()
|
self.keys: Set[str] = set()
|
||||||
|
|
||||||
def visit_Lambda(self, node: ast.Lambda) -> Any:
|
def visit_Lambda(self, node: ast.Lambda) -> Any:
|
||||||
|
if not node.args.args:
|
||||||
|
return
|
||||||
input_arg_name = node.args.args[0].arg
|
input_arg_name = node.args.args[0].arg
|
||||||
IsLocalDict(input_arg_name, self.keys).visit(node.body)
|
IsLocalDict(input_arg_name, self.keys).visit(node.body)
|
||||||
|
|
||||||
def visit_FunctionDef(self, node: ast.FunctionDef) -> Any:
|
def visit_FunctionDef(self, node: ast.FunctionDef) -> Any:
|
||||||
|
if not node.args.args:
|
||||||
|
return
|
||||||
input_arg_name = node.args.args[0].arg
|
input_arg_name = node.args.args[0].arg
|
||||||
IsLocalDict(input_arg_name, self.keys).visit(node)
|
IsLocalDict(input_arg_name, self.keys).visit(node)
|
||||||
|
|
||||||
def visit_AsyncFunctionDef(self, node: ast.AsyncFunctionDef) -> Any:
|
def visit_AsyncFunctionDef(self, node: ast.AsyncFunctionDef) -> Any:
|
||||||
|
if not node.args.args:
|
||||||
|
return
|
||||||
input_arg_name = node.args.args[0].arg
|
input_arg_name = node.args.args[0].arg
|
||||||
IsLocalDict(input_arg_name, self.keys).visit(node)
|
IsLocalDict(input_arg_name, self.keys).visit(node)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user