(code)
return labels
Detect all offsets in a byte code which are jump targets.

    Return the list of offsets.
Detect all offsets in a byte code which are jump targets.
Detect all offsets in a byte code which are jump targets .
def findlabels(code):
    """Detect all offsets in a byte code which are jump targets.

    Return the list of offsets.

    """
    labels = []
    for offset, op, arg in _unpack_opargs(code):
        if arg is not None:
            if op in hasjrel:
                label = offset + 2 + arg*2
            elif op in hasjabs:
                label = arg*2
            else:
                continue
            if label not in labels:
                labels.append(label)
    return labels
def findlabels ( code ) : labels = [ ] for offset , op , arg in _unpack_opargs ( code ) : if arg is not None : if op in hasjrel : label = offset + 2 + arg * 2 elif op in hasjabs : label = arg * 2 else : continue if label not in labels : labels . append ( label ) return labels