def BUILD_MAP(decompiler, length): if sys.version_info < (3, 5): return ast.Dict(()) data = decompiler.pop_items(2 * length) # [key1, value1, key2, value2, ...] it = iter(data) pairs = list(izip(it, it)) # [(key1, value1), (key2, value2), ...] return ast.Dict(tuple(pairs))
def BUILD_CONST_KEY_MAP(decompiler, length): keys = decompiler.stack.pop() assert isinstance(keys, ast.Const) keys = [ ast.Const(key) for key in keys.value ] values = decompiler.pop_items(length) pairs = list(izip(keys, values)) return ast.Dict(pairs)
def BUILD_MAP(decompiler, not_used): # Pushes a new empty dictionary object onto the stack. The argument is ignored and set to zero by the compiler return ast.Dict(())