dsrf_report_processor.py 文件源码

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

项目:dsrf 作者: ddexnet 项目源码 文件源码
def read_blocks_from_queue(self):
    """Returns a generator of the blocks in the queue.

    Override this method if you wish to change the queue (blocks transformation)
    form.

    Yields:
      Each yield is a single block object (block_pb2.Block).
    """
    message_lines = []
    for line in sys.stdin:
      if constants.QUEUE_DELIMITER in line:
        block = block_pb2.Block()
        try:
          block.ParseFromString('\n'.join(message_lines))
        except message_mod.DecodeError:
          sys.stderr.write(
              'ERROR: Can not read protocol buffer from queue. Is '
              'human_readable perhaps set to true? I am not a human. '
              'Aborting...\n')
          sys.exit(-1)

        yield block
        message_lines = []
      else:
        message_lines.append(line.rstrip('\n'))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号