from dis import opmap, opname, hasjabs, hasjrel
from pprint import pprint


def main() -> None:
  for opname in opmap:
    if opname not in known_opnames:
     print(f'unknown opname: {opname!r}')

  print('abs jumps:', [opname[op] for op in hasjabs])
  print('rel jumps:', [opname[op] for op in hasjrel])


# Up to date as of python 3.10.
known_opnames = {
  'POP_TOP',
  'ROT_TWO',
  'ROT_THREE',
  'DUP_TOP',
  'DUP_TOP_TWO',
  'ROT_FOUR',
  'NOP',
  'UNARY_POSITIVE',
  'UNARY_NEGATIVE',
  'UNARY_NOT',
  'UNARY_INVERT',
  'BINARY_MATRIX_MULTIPLY',
  'INPLACE_MATRIX_MULTIPLY',
  'BINARY_POWER',
  'BINARY_MULTIPLY',
  'BINARY_MODULO',
  'BINARY_ADD',
  'BINARY_SUBTRACT',
  'BINARY_SUBSCR',
  'BINARY_FLOOR_DIVIDE',
  'BINARY_TRUE_DIVIDE',
  'INPLACE_FLOOR_DIVIDE',
  'INPLACE_TRUE_DIVIDE',
  'GET_LEN',
  'MATCH_MAPPING',
  'MATCH_SEQUENCE',
  'MATCH_KEYS',
  'COPY_DICT_WITHOUT_KEYS',
  'WITH_EXCEPT_START',
  'GET_AITER',
  'GET_ANEXT',
  'BEFORE_ASYNC_WITH',
  'END_ASYNC_FOR',
  'INPLACE_ADD',
  'INPLACE_SUBTRACT',
  'INPLACE_MULTIPLY',
  'INPLACE_MODULO',
  'STORE_SUBSCR',
  'DELETE_SUBSCR',
  'BINARY_LSHIFT',
  'BINARY_RSHIFT',
  'BINARY_AND',
  'BINARY_XOR',
  'BINARY_OR',
  'INPLACE_POWER',
  'GET_ITER',
  'GET_YIELD_FROM_ITER',
  'PRINT_EXPR',
  'LOAD_BUILD_CLASS',
  'YIELD_FROM',
  'GET_AWAITABLE',
  'LOAD_ASSERTION_ERROR',
  'INPLACE_LSHIFT',
  'INPLACE_RSHIFT',
  'INPLACE_AND',
  'INPLACE_XOR',
  'INPLACE_OR',
  'LIST_TO_TUPLE',
  'RETURN_VALUE',
  'IMPORT_STAR',
  'SETUP_ANNOTATIONS',
  'YIELD_VALUE',
  'POP_BLOCK',
  'POP_EXCEPT',
  'STORE_NAME',
  'DELETE_NAME',
  'UNPACK_SEQUENCE',
  'FOR_ITER',
  'UNPACK_EX',
  'STORE_ATTR',
  'DELETE_ATTR',
  'STORE_GLOBAL',
  'DELETE_GLOBAL',
  'ROT_N',
  'LOAD_CONST',
  'LOAD_NAME',
  'BUILD_TUPLE',
  'BUILD_LIST',
  'BUILD_SET',
  'BUILD_MAP',
  'LOAD_ATTR',
  'COMPARE_OP',
  'IMPORT_NAME',
  'IMPORT_FROM',
  'JUMP_FORWARD',
  'JUMP_IF_FALSE_OR_POP',
  'JUMP_IF_TRUE_OR_POP',
  'JUMP_ABSOLUTE',
  'POP_JUMP_IF_FALSE',
  'POP_JUMP_IF_TRUE',
  'LOAD_GLOBAL',
  'IS_OP',
  'CONTAINS_OP',
  'RERAISE',
  'JUMP_IF_NOT_EXC_MATCH',
  'SETUP_FINALLY',
  'LOAD_FAST',
  'STORE_FAST',
  'DELETE_FAST',
  'GEN_START',
  'RAISE_VARARGS',
  'CALL_FUNCTION',
  'MAKE_FUNCTION',
  'BUILD_SLICE',
  'LOAD_CLOSURE',
  'LOAD_DEREF',
  'STORE_DEREF',
  'DELETE_DEREF',
  'CALL_FUNCTION_KW',
  'CALL_FUNCTION_EX',
  'SETUP_WITH',
  'EXTENDED_ARG',
  'LIST_APPEND',
  'SET_ADD',
  'MAP_ADD',
  'LOAD_CLASSDEREF',
  'MATCH_CLASS',
  'SETUP_ASYNC_WITH',
  'FORMAT_VALUE',
  'BUILD_CONST_KEY_MAP',
  'BUILD_STRING',
  'LOAD_METHOD',
  'CALL_METHOD',
  'LIST_EXTEND',
  'SET_UPDATE',
  'DICT_MERGE',
  'DICT_UPDATE',
}

if __name__ == '__main__': main()
