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 LIST_EXTEND(decompiler, offset): if offset != 1: raise NotImplementedError(offset) items = decompiler.stack.pop() if not isinstance(items, ast.Const): raise NotImplementedError(type(items)) if not isinstance(items.value, tuple): raise NotImplementedError(type(items.value)) lst = decompiler.stack.pop() if not isinstance(lst, ast.List): raise NotImplementedError(type(lst)) values = tuple(ast.Const(v) for v in items.value) lst.nodes = lst.nodes + values return lst
def LOAD_CONST(decompiler, const_value): return ast.Const(const_value)