def maximum_function_args(self):
"""Get the maximum number of function arguments appearing in the AST"""
user_func_defs = [node for node in self.all_nodes if isinstance(node, (ast.FunctionDef, ast.Lambda))]
stub_func_defs = [node for node in self.stub_nodes if isinstance(node, (ast.FunctionDef, ast.Lambda))]
# A minimum value of 1 because a default __init__ with one argument function
# is added to classes that doesn't contain one
user_func_max = max([len(node.args.args) for node in user_func_defs] + [1])
stub_func_max = max([len(node.args.args) for node in stub_func_defs] + [1])
return max(user_func_max, stub_func_max)
评论列表
文章目录