def _call_function(decompiler, args, star=None, star2=None): tos = decompiler.stack.pop() if isinstance(tos, ast.GenExpr): assert len(args) == 1 and star is None and star2 is None genexpr = tos qual = genexpr.code.quals[0] assert isinstance(qual.iter, ast.Name) assert qual.iter.name in ('.0', '[outmost-iterable]') qual.iter = args[0] return genexpr return ast.CallFunc(tos, args, star, star2)
def CALL_METHOD(decompiler, argc): pop = decompiler.stack.pop args = [] if argc >= 256: kwargc = argc // 256 argc = argc % 256 for i in range(kwargc): v = pop() k = pop() assert isinstance(k, ast.Const) k = k.value # ast.Name(k.value) args.append(ast.Keyword(k, v)) for i in range(argc): args.append(pop()) args.reverse() method = pop() return ast.CallFunc(method, args)