Fix runnable vistitor for funcs without pos args (#15182)

This commit is contained in:
Nuno Campos 2023-12-26 12:42:24 -08:00 committed by GitHub
parent b4a0d206d9
commit 7e26559256
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -107,14 +107,20 @@ class IsFunctionArgDict(ast.NodeVisitor):
self.keys: Set[str] = set()
def visit_Lambda(self, node: ast.Lambda) -> Any:
if not node.args.args:
return
input_arg_name = node.args.args[0].arg
IsLocalDict(input_arg_name, self.keys).visit(node.body)
def visit_FunctionDef(self, node: ast.FunctionDef) -> Any:
if not node.args.args:
return
input_arg_name = node.args.args[0].arg
IsLocalDict(input_arg_name, self.keys).visit(node)
def visit_AsyncFunctionDef(self, node: ast.AsyncFunctionDef) -> Any:
if not node.args.args:
return
input_arg_name = node.args.args[0].arg
IsLocalDict(input_arg_name, self.keys).visit(node)