# automatically generated by the FlatBuffers compiler, do not modify

# namespace: isp

import flatbuffers
from flatbuffers.compat import import_numpy
np = import_numpy()

class Dict(object):
    __slots__ = ['_tab']

    @classmethod
    def GetRootAsDict(cls, buf, offset):
        n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
        x = Dict()
        x.Init(buf, n + offset)
        return x

    @classmethod
    def DictBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
        return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x49\x53\x50\x46", size_prefixed=size_prefixed)

    # Dict
    def Init(self, buf, pos):
        self._tab = flatbuffers.table.Table(buf, pos)

    # Dict
    def Keys(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            a = self._tab.Vector(o)
            return self._tab.String(a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
        return ""

    # Dict
    def KeysLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # Dict
    def KeysIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        return o == 0

    # Dict
    def Values(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            x = self._tab.Vector(o)
            x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
            x = self._tab.Indirect(x)
            from communications.isp.Tensor import Tensor
            obj = Tensor()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # Dict
    def ValuesLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # Dict
    def ValuesIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        return o == 0

def DictStart(builder): builder.StartObject(2)
def DictAddKeys(builder, keys): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(keys), 0)
def DictStartKeysVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def DictAddValues(builder, values): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(values), 0)
def DictStartValuesVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def DictEnd(builder): return builder.EndObject()
