macro_extractor.py 文件源码

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

项目:skydoc 作者: bazelbuild 项目源码 文件源码
def parse_bzl(self, bzl_file):
    """Extracts documentation for all public macros from the given .bzl file.

    Args:
      bzl_file: The .bzl file to extract macro documentation from.
    """
    try:
      tree = ast.parse(open(bzl_file).read(), bzl_file)
      self._add_file_docs(tree)
      for stmt in tree.body:
        if isinstance(stmt, ast.FunctionDef) and not stmt.name.startswith("_"):
          self._add_macro_doc(stmt)
    except IOError as e:
      # Ignore missing extension
      print("Failed to parse {0}: {1}".format(bzl_file, e.strerror))
      pass
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号