def collect_extra_debug_data():
    """
    Print the usual traceback information, followed by a listing of all the
    local variables in each frame.
    """
    data = ''
    try:
        tb = sys.exc_info()[2]
        stack = []

        while tb:
            stack.append(tb.tb_frame)
            tb = tb.tb_next
    finally:
        del tb

    if _debug_software_version:
        data += '%s version: %s\n\n' % \
                (_debug_software_name, _debug_software_version)
    else:
        data += '(Cannot get %s version.)\n\n' % _debug_software_name

    data += 'Locals by frame, innermost last:\n'
    for frame in stack:
        data += '\n\n'
        data += ('Frame %s in %s at line %s\n' % (frame.f_code.co_name,
                                             frame.f_code.co_filename,
                                             frame.f_lineno))
        frame_locals = frame.f_locals
        for inspected in ('self', 'cls'):
            if inspected in frame_locals:
                if hasattr(frame_locals[inspected], '__dict__') and \
                        frame_locals[inspected].__dict__:
                    for (key, value) in frame_locals[inspected].__dict__.items():
                        frame_locals[(inspected, key) % '%s.%s'] = value
        for key, value in frame_locals.items():
            if key == '__builtins__':
                # This is flooding
                continue
            data += ('\t%20s = ' % key)
            #We have to be careful not to cause a new error in our error
            #printer! Calling str() on an unknown object could cause an
            #error we don't want.
            try:
                data += repr(value) + '\n'
            except:
                data += '<ERROR WHILE PRINTING VALUE>\n'
    data += '\n'
    data += '+-----------------------+\n'
    data += '| End of locals display |\n'
    data += '+-----------------------+\n'
    data += '\n'
    return data

# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=78:
dataset/ETHPy150Open ProgVal/Limnoria/src/utils/python.py/collect_extra_debug_data/swapped operands of `%`