(code, varnames=None, names=None, constants=None,
                      cells=None, linestarts=None, line_offset=0)
Iterate over the instructions in a bytecode string.

    Generates a sequence of Instruction namedtuples giving the details of each
    opcode.  Additional information about the code's runtime environment
    (e.g. variable names, constants) can be specified using optional
    arguments.
Iterate over the instructions in a bytecode string.
Iterate over the instructions in a bytecode string .
def _get_instructions_bytes(code, varnames=None, names=None, constants=None,
                      cells=None, linestarts=None, line_offset=0):
    """Iterate over the instructions in a bytecode string.

    Generates a sequence of Instruction namedtuples giving the details of each
    opcode.  Additional information about the code's runtime environment
    (e.g. variable names, constants) can be specified using optional
    arguments.

    """
    labels = findlabels(code)
    starts_line = None
    for offset, op, arg in _unpack_opargs(code):
        if linestarts is not None:
            starts_line = linestarts.get(offset, None)
            if starts_line is not None:
                starts_line += line_offset
        is_jump_target = offset in labels
        argval = None
        argrepr = ''
        if arg is not None:
            #  Set argval to the dereferenced value of the argument when
            #  available, and argrepr to the string representation of argval.
            #    _disassemble_bytes needs the string repr of the
            #    raw name index for LOAD_GLOBAL, LOAD_CONST, etc.
            argval = arg
            if op in hasconst:
                argval, argrepr = _get_const_info(arg, constants)
            elif op in hasname:
                argval, argrepr = _get_name_info(arg, names)
            elif op in hasjabs:
                argval = arg*2
                argrepr = "to " + repr(argval)
            elif op in hasjrel:
                argval = offset + 2 + arg*2
                argrepr = "to " + repr(argval)
            elif op in haslocal:
                argval, argrepr = _get_name_info(arg, varnames)
            elif op in hascompare:
                argval = cmp_op[arg]
                argrepr = argval
            elif op in hasfree:
                argval, argrepr = _get_name_info(arg, cells)
            elif op == FORMAT_VALUE:
                argval, argrepr = FORMAT_VALUE_CONVERTERS[arg & 0x3]
                argval = (argval, bool(arg & 0x4))
                if argval[1]:
                    if argrepr:
                        argrepr += ', '
                    argrepr += 'with format'
            elif op == MAKE_FUNCTION:
                argrepr = ', '.join(s for i, s in enumerate(MAKE_FUNCTION_FLAGS)
                                    if arg & (1<<i))
        yield Instruction(opname[op], op,
                          arg, argval, argrepr,
                          offset, starts_line, is_jump_target)
def _get_instructions_bytes ( code , varnames = None , names = None , constants = None , cells = None , linestarts = None , line_offset = 0 ) : labels = findlabels ( code ) starts_line = None for offset , op , arg in _unpack_opargs ( code ) : if linestarts is not None : starts_line = linestarts . get ( offset , None ) if starts_line is not None : starts_line += line_offset is_jump_target = offset in labels argval = None argrepr = '' if arg is not None : #  Set argval to the dereferenced value of the argument when #  available, and argrepr to the string representation of argval. #    _disassemble_bytes needs the string repr of the #    raw name index for LOAD_GLOBAL, LOAD_CONST, etc. argval = arg if op in hasconst : argval , argrepr = _get_const_info ( arg , constants ) elif op in hasname : argval , argrepr = _get_name_info ( arg , names ) elif op in hasjabs : argval = arg * 2 argrepr = "to " + repr ( argval ) elif op in hasjrel : argval = offset + 2 + arg * 2 argrepr = "to " + repr ( argval ) elif op in haslocal : argval , argrepr = _get_name_info ( arg , varnames ) elif op in hascompare : argval = cmp_op [ arg ] argrepr = argval elif op in hasfree : argval , argrepr = _get_name_info ( arg , cells ) elif op == FORMAT_VALUE : argval , argrepr = FORMAT_VALUE_CONVERTERS [ arg & 0x3 ] argval = ( argval , bool ( arg & 0x4 ) ) if argval [ 1 ] : if argrepr : argrepr += ', ' argrepr += 'with format' elif op == MAKE_FUNCTION : argrepr = ', ' . join ( s for i , s in enumerate ( MAKE_FUNCTION_FLAGS ) if arg & ( 1 << i ) ) yield Instruction ( opname [ op ] , op , arg , argval , argrepr , offset , starts_line , is_jump_target )