utils.py 文件源码

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

项目:universe 作者: openai 项目源码 文件源码
def json_splitter(buffer):
    """Attempt to parse a json object from a buffer. If there is at least one
    object, return it and the rest of the buffer, otherwise return None.
    """
    try:
        obj, index = json_decoder.raw_decode(buffer)
        rest = buffer[json.decoder.WHITESPACE.match(buffer, index).end():]
        return obj, rest
    except ValueError:
        return None
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号