plotting.py 文件源码

python
阅读 35 收藏 0 点赞 0 评论 0

项目:numba-examples 作者: numba 项目源码 文件源码
def discover_and_make_plots(destination_prefix, github_urlbase):
    with open(os.path.join(os.path.dirname(__file__), 'index.tmpl.html')) as f:
        index_template = Template(f.read())

    benchmark_pages = defaultdict(list)

    index_page = os.path.join(destination_prefix, 'index.html')

    for root, dirs, files in os.walk(destination_prefix):
        output_subdir = os.path.relpath(root, destination_prefix)
        results_filename = os.path.join(root, 'results.json')
        plot_filename = os.path.join(root, 'results.html')
        github_url = github_urlbase + '/' + output_subdir

        if os.path.exists(results_filename):
            print('  Found: %s' % results_filename)
            results = generate_plots(results_filename, plot_filename, github_url=github_url)
            benchmark_pages[os.path.dirname(output_subdir)].append(dict(name=results['name'], path=os.path.join(output_subdir, 'results.html')))

    # Generate index page
    with open(index_page, 'w') as f:
        f.write(index_template.render(sections=benchmark_pages))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号