def CALL_FUNCTION_KW(decompiler, argc): if sys.version_info < (3, 6): return decompiler.CALL_FUNCTION(argc, star2=decompiler.stack.pop()) keys = decompiler.stack.pop() assert isinstance(keys, ast.Const) keys = keys.value values = decompiler.pop_items(argc) assert len(keys) <= len(values) args = values[:-len(keys)] for key, value in izip(keys, values[-len(keys):]): args.append(ast.Keyword(key, value)) return decompiler._call_function(args)
def CALL_FUNCTION(decompiler, argc, star=None, star2=None): pop = decompiler.stack.pop kwarg, posarg = divmod(argc, 256) args = [] for i in xrange(kwarg): arg = pop() key = pop().value args.append(ast.Keyword(key, arg)) for i in xrange(posarg): args.append(pop()) args.reverse() return decompiler._call_function(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)