from opcode import opmap as _opmap
from sys import version_info


PY_3 = version_info.major == 3
PY_COMPATIBLE_MODE_AVAILABLE = False
_AUTO_PRINT_SELF_CHECK_MESSAGE = False


_unsupported_codes = []


def _get_opcode(opname):
    code = _opmap.get(opname)
    if code is None:
        _unsupported_codes.append(code)
    return code


if PY_3:
    POP_TOP = _get_opcode('POP_TOP')
    NOP = _get_opcode('NOP')
    UNARY_POSITIVE = _get_opcode('UNARY_POSITIVE')
    UNARY_NEGATIVE = _get_opcode('UNARY_NEGATIVE')
    UNARY_NOT = _get_opcode('UNARY_NOT')
    UNARY_INVERT = _get_opcode('UNARY_INVERT')
    BINARY_MATRIX_MULTIPLY = _get_opcode('BINARY_MATRIX_MULTIPLY')
    INPLACE_MATRIX_MULTIPLY = _get_opcode('INPLACE_MATRIX_MULTIPLY')
    BINARY_POWER = _get_opcode('BINARY_POWER')
    BINARY_MULTIPLY = _get_opcode('BINARY_MULTIPLY')
    BINARY_MODULO = _get_opcode('BINARY_MODULO')
    BINARY_ADD = _get_opcode('BINARY_ADD')
    BINARY_SUBTRACT = _get_opcode('BINARY_SUBTRACT')
    BINARY_SUBSCR = _get_opcode('BINARY_SUBSCR')
    BINARY_FLOOR_DIVIDE = _get_opcode('BINARY_FLOOR_DIVIDE')
    BINARY_TRUE_DIVIDE = _get_opcode('BINARY_TRUE_DIVIDE')
    INPLACE_FLOOR_DIVIDE = _get_opcode('INPLACE_FLOOR_DIVIDE')
    INPLACE_TRUE_DIVIDE = _get_opcode('INPLACE_TRUE_DIVIDE')
    INPLACE_ADD = _get_opcode('INPLACE_ADD')
    INPLACE_SUBTRACT = _get_opcode('INPLACE_SUBTRACT')
    INPLACE_MULTIPLY = _get_opcode('INPLACE_MULTIPLY')
    INPLACE_MODULO = _get_opcode('INPLACE_MODULO')
    STORE_SUBSCR = _get_opcode('STORE_SUBSCR')
    DELETE_SUBSCR = _get_opcode('DELETE_SUBSCR')
    BINARY_LSHIFT = _get_opcode('BINARY_LSHIFT')
    BINARY_RSHIFT = _get_opcode('BINARY_RSHIFT')
    BINARY_AND = _get_opcode('BINARY_AND')
    BINARY_XOR = _get_opcode('BINARY_XOR')
    BINARY_OR = _get_opcode('BINARY_OR')
    INPLACE_POWER = _get_opcode('INPLACE_POWER')
    PRINT_EXPR = _get_opcode('PRINT_EXPR')
    LOAD_BUILD_CLASS = _get_opcode('LOAD_BUILD_CLASS')
    INPLACE_LSHIFT = _get_opcode('INPLACE_LSHIFT')
    INPLACE_RSHIFT = _get_opcode('INPLACE_RSHIFT')
    INPLACE_AND = _get_opcode('INPLACE_AND')
    INPLACE_XOR = _get_opcode('INPLACE_XOR')
    INPLACE_OR = _get_opcode('INPLACE_OR')
    BREAK_LOOP = _get_opcode('BREAK_LOOP')
    RETURN_VALUE = _get_opcode('RETURN_VALUE')
    IMPORT_STAR = _get_opcode('IMPORT_STAR')
    YIELD_VALUE = _get_opcode('YIELD_VALUE')
    POP_BLOCK = _get_opcode('POP_BLOCK')
    END_FINALLY = _get_opcode('END_FINALLY')
    POP_EXCEPT = _get_opcode('POP_EXCEPT')
    STORE_NAME = _get_opcode('STORE_NAME')
    DELETE_NAME = _get_opcode('DELETE_NAME')
    UNPACK_SEQUENCE = _get_opcode('UNPACK_SEQUENCE')
    UNPACK_EX = _get_opcode('UNPACK_EX')
    STORE_ATTR = _get_opcode('STORE_ATTR')
    DELETE_ATTR = _get_opcode('DELETE_ATTR')
    STORE_GLOBAL = _get_opcode('STORE_GLOBAL')
    DELETE_GLOBAL = _get_opcode('DELETE_GLOBAL')
    LOAD_CONST = _get_opcode('LOAD_CONST')
    LOAD_NAME = _get_opcode('LOAD_NAME')
    BUILD_TUPLE = _get_opcode('BUILD_TUPLE')
    BUILD_LIST = _get_opcode('BUILD_LIST')
    BUILD_SET = _get_opcode('BUILD_SET')
    BUILD_MAP = _get_opcode('BUILD_MAP')
    LOAD_ATTR = _get_opcode('LOAD_ATTR')
    COMPARE_OP = _get_opcode('COMPARE_OP')
    IMPORT_NAME = _get_opcode('IMPORT_NAME')
    IMPORT_FROM = _get_opcode('IMPORT_FROM')
    JUMP_FORWARD = _get_opcode('JUMP_FORWARD')
    JUMP_IF_FALSE_OR_POP = _get_opcode('JUMP_IF_FALSE_OR_POP')
    JUMP_IF_TRUE_OR_POP = _get_opcode('JUMP_IF_TRUE_OR_POP')
    JUMP_ABSOLUTE = _get_opcode('JUMP_ABSOLUTE')
    POP_JUMP_IF_FALSE = _get_opcode('POP_JUMP_IF_FALSE')
    POP_JUMP_IF_TRUE = _get_opcode('POP_JUMP_IF_TRUE')
    LOAD_GLOBAL = _get_opcode('LOAD_GLOBAL')
    CONTINUE_LOOP = _get_opcode('CONTINUE_LOOP')
    SETUP_LOOP = _get_opcode('SETUP_LOOP')
    SETUP_EXCEPT = _get_opcode('SETUP_EXCEPT')
    SETUP_FINALLY = _get_opcode('SETUP_FINALLY')
    LOAD_FAST = _get_opcode('LOAD_FAST')
    STORE_FAST = _get_opcode('STORE_FAST')
    DELETE_FAST = _get_opcode('DELETE_FAST')
    RAISE_VARARGS = _get_opcode('RAISE_VARARGS')
    CALL_FUNCTION = _get_opcode('CALL_FUNCTION')
    MAKE_FUNCTION = _get_opcode('MAKE_FUNCTION')
    BUILD_SLICE = _get_opcode('BUILD_SLICE')
    LOAD_CLOSURE = _get_opcode('LOAD_CLOSURE')
    LOAD_DEREF = _get_opcode('LOAD_DEREF')
    STORE_DEREF = _get_opcode('STORE_DEREF')
    DELETE_DEREF = _get_opcode('DELETE_DEREF')
    CALL_FUNCTION_KW = _get_opcode('CALL_FUNCTIONKW')
    CALL_FUNCTION_EX = _get_opcode('CALL_FUNCTION_EX')
    SETUP_WITH = _get_opcode('SETUP_WITH')
    LIST_APPEND = _get_opcode('LIST_APPEND')
    SET_ADD = _get_opcode('SET_ADD')
    MAP_ADD = _get_opcode('MAP_ADD')
    LOAD_CLASSDEREF = _get_opcode('LOAD_CLASSDEREF')
    EXTENDED_ARG = _get_opcode('EXTENDED_ARG')
    BUILD_LIST_UNPACK = _get_opcode('BUILD_LIST_UNPACK')
    BUILD_MAP_UNPACK = _get_opcode('BUILD_MAP_UNPACK')
    BUILD_MAP_UNPACK_WITH_CALL = _get_opcode('BUILD_MAP_UNPACK_WITH_CALL')
    BUILD_TUPLE_UNPACK = _get_opcode('BUILD_TUPLE_UNPACK')
    BUILD_SET_UNPACK = _get_opcode('BUILD_SET_UNPACK')
    BUILD_CONST_KEY_MAP = _get_opcode('BUILD_CONST_KEY_MAP')
    BUILD_STRING = _get_opcode('BUILD_STRING')
    BUILD_TUPLE_UNPACK_WITH_CALL = _get_opcode('BUILD_TUPLE_UNPACK_WITH_CALL')
    LOAD_METHOD = _get_opcode('LOAD_METHOD')
    CALL_METHOD = _get_opcode('CALL_METHOD')
