

def generate_html(protocols, configuration, methods, date, default_system_info, running_configuration):
    try:
        model_name = [line for line in open('/proc/cpuinfo').readlines() if line.startswith('model name')][0]
        model_name = ':'.join(model_name.split(': ')[1:]).strip()
        while ('  ' in model_name):
            model_name = model_name.replace('  ', ' ')
        ram = [line.split(' ')[(- 2)] for line in open('/proc/meminfo').readlines() if line.startswith('MemTotal:')][0]
        memory = ('%.2fGB' % (int(ram) / (1024.0 * 1024.0)))
    except:
        system_info = default_system_info
    else:
        system_info = ('%s %s' % (model_name, memory))
    all_system_info = ('%s; %s; Python %s' % (system_info, platform.platform(), platform.python_version()))
    page = ('<html><head><title>Bot stats as of %s</title></head><body>\n    <h1>Bot stats as of %s</h1>\n    <h2>Stats information</h2>\n    Configuration: %s %s<br/>\n    System: %s<br/>\n    <a name="index"><h2>Index</h2></a>\n    <ul>\n    ' % (date, date, running_configuration, str(configuration), all_system_info))
    for protocol in protocols:
        page += ('\t<li><a href="#%s">%s</a>: <ul>' % (protocol, protocol))
        for method in methods:
            page += ('\t\t<li><a href="#%s_%s">%s</a></li>\n' % (protocol, method, method))
        page += '\t</ul></li>\n'
    page += '</ul><h2>Results</h2>\n'
    page += '<center><table border="0"><tr>'
    for protocol in protocols:
        page += ('<th><a name="%s"><h3>%s</h3></a><center></th>\n' % (protocol, protocol))
    page += '</tr>'
    for method in methods:
        page += '<tr>'
        central_pos = (len(protocols) / 2)
        for (pos, protocol) in enumerate(protocols):
            page += '<td><center>'
            if (line == central_pos):
                page += ('<a name="%s_%s"><h4>%s</h4></a><br/>\n' % (protocol, method, method))
            else:
                page += '<br/><br/>'
            fname = get_figure_filename(protocol, method, date)
            real_fname = (((os.path.dirname(fname) + os.sep) + 'without_bounds_') + os.path.basename(fname))
            page += ('<a href="%s"><img width="400" src="%s"/></a>\n' % (real_fname, fname))
            page += '<br/>\n'
            if (pos == central_pos):
                page += '<a href="#index">Back to index</a>'
            page += '</center></td>'
        page += '</tr>'
    page += '</table></center></body></html>'
    return page

dataset/ETHPy150Open weblabdeusto/weblabdeusto/server/src/weblab/admin/bot/graphics.py generate_html/VarMisuse@341/657 `pos`->`line`