|
|
|
|
|
|
|
|
|
import flatbuffers |
|
from flatbuffers.compat import import_numpy |
|
np = import_numpy() |
|
|
|
class Label(object): |
|
__slots__ = ['_tab'] |
|
|
|
@classmethod |
|
def GetRootAsLabel(cls, buf, offset): |
|
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) |
|
x = Label() |
|
x.Init(buf, n + offset) |
|
return x |
|
|
|
@classmethod |
|
def LabelBufferHasIdentifier(cls, buf, offset, size_prefixed=False): |
|
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x43\x32\x20", size_prefixed=size_prefixed) |
|
|
|
|
|
def Init(self, buf, pos): |
|
self._tab = flatbuffers.table.Table(buf, pos) |
|
|
|
|
|
def BoiseType(self): |
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) |
|
if o != 0: |
|
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) |
|
return 0 |
|
|
|
|
|
def MentionType(self): |
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) |
|
if o != 0: |
|
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) |
|
return 0 |
|
|
|
|
|
def CollectionId(self): |
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) |
|
if o != 0: |
|
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) |
|
return 0 |
|
|
|
def LabelStart(builder): builder.StartObject(3) |
|
def LabelAddBoiseType(builder, boiseType): builder.PrependInt32Slot(0, boiseType, 0) |
|
def LabelAddMentionType(builder, mentionType): builder.PrependInt32Slot(1, mentionType, 0) |
|
def LabelAddCollectionId(builder, collectionId): builder.PrependInt32Slot(2, collectionId, 0) |
|
def LabelEnd(builder): return builder.EndObject() |
|
|