report.py 文件源码

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

项目:caterpillar 作者: chromium 项目源码 文件源码
def process_usage(apis, usage):
  """Populates usage element of an API dictionary with the usages of that API.

  Args:
    apis: Dictionary mapping Chrome Apps API name to polyfill manifest
      dictionaries. This will be modified.
    usage: Usage dictionary mapping API names to
      (filepath, linenum, context, context_linenum) tuples.
  """

  for api_name, api_info in apis.iteritems():
    api_info['usage'] = []
    for uses in usage[api_name].values():
      for filepath, line_num, context, start in uses:
        context = cgi.escape(context)
        context = highlight_relevant_line(context, line_num - start, apis)
        api_info['usage'].append((filepath, line_num, context, start))

    # Sort first by file, then by line number.
    api_info['usage'].sort()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号