protoc_utils.py 文件源码

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

项目:artman 作者: googleapis 项目源码 文件源码
def find_protos(proto_paths, excluded_proto_path):
    """Searches along `proto_paths` for .proto files and returns a generator of
    paths"""
    if not isinstance(proto_paths, (types.GeneratorType, collections.MutableSequence)):
        raise ValueError("proto_paths must be a list")
    for path in proto_paths:
        if os.path.isdir(path):
            for root, _, files in os.walk(path):
                for proto in files:
                    is_excluded = _is_proto_excluded(os.path.join(root, proto),
                                                     excluded_proto_path)
                    if os.path.splitext(proto)[1] == '.proto' and not is_excluded:
                        yield os.path.join(root, proto)
        elif os.path.isfile(path) and os.path.splitext(path)[1] == '.proto':
            yield path
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号