def skip_field()

in scripts/parser.py [0:0]


def skip_field(stream, wire_type):
    """Advance `stream` past the next field of the given `wire_type`. Returns skipped bytes."""
    if wire_type == 0:       # varint
        _, n = read_varint(stream); return n
    elif wire_type == 1:     # fixed64
        stream.seek(8, io.SEEK_CUR); return 8
    elif wire_type == 2:     # length-delimited
        length, n = read_varint(stream)
        stream.seek(length, io.SEEK_CUR)
        return n + length
    elif wire_type == 5:     # fixed32
        stream.seek(4, io.SEEK_CUR); return 4
    else:
        raise ValueError(f"Unsupported wire type {wire_type}")