primitives.py 文件源码

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

项目:aiozk 作者: tipsi 项目源码 文件源码
def parse(cls, buff, offset):
        """
        Given a buffer and offset, returns the parsed value and new offset.

        Parses the ``size_primitive`` first to determine how many more bytes to
        consume to extract the value.
        """
        size, offset = cls.size_primitive.parse(buff, offset)
        if size == -1:
            return None, offset

        var_struct = struct.Struct("!%ds" % size)

        value = var_struct.unpack_from(buff, offset)[0]
        value = cls.parse_value(value)
        offset += var_struct.size

        return value, offset
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号