# automatically generated by the FlatBuffers compiler, do not modify

# namespace: tabular

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

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

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

    @classmethod
    def GetRootAsS3File(cls, buf, offset=0):
        """This method is deprecated. Please switch to GetRootAs."""
        return cls.GetRootAs(buf, offset)
    # S3File
    def Init(self, buf, pos):
        self._tab = flatbuffers.table.Table(buf, pos)

    # currently supported only parquet
    # S3File
    def Format(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            return self._tab.String(o + self._tab.Pos)
        return None

    # S3File
    def BucketName(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            return self._tab.String(o + self._tab.Pos)
        return None

    # name includes path
    # S3File
    def FileName(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        if o != 0:
            return self._tab.String(o + self._tab.Pos)
        return None

    # https://arrow.apache.org/docs/format/Columnar.html#ipc-streaming-format
    # serialized as a Arrow schema + single-row Arrow page, if exist
    # A page of partitions including one or more column:type:value per file.
    # We should validate that column exists in table layout and type is valid
    # when importing we should use insert this column value for
    # all the rows in the table
    # S3File
    def Partitions(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        if o != 0:
            a = self._tab.Vector(o)
            return self._tab.Get(flatbuffers.number_types.Uint8Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 1))
        return 0

    # S3File
    def PartitionsAsNumpy(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        if o != 0:
            return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Uint8Flags, o)
        return 0

    # S3File
    def PartitionsLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # S3File
    def PartitionsIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        return o == 0

def Start(builder): builder.StartObject(4)
def S3FileStart(builder):
    """This method is deprecated. Please switch to Start."""
    return Start(builder)
def AddFormat(builder, format): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(format), 0)
def S3FileAddFormat(builder, format):
    """This method is deprecated. Please switch to AddFormat."""
    return AddFormat(builder, format)
def AddBucketName(builder, bucketName): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(bucketName), 0)
def S3FileAddBucketName(builder, bucketName):
    """This method is deprecated. Please switch to AddBucketName."""
    return AddBucketName(builder, bucketName)
def AddFileName(builder, fileName): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(fileName), 0)
def S3FileAddFileName(builder, fileName):
    """This method is deprecated. Please switch to AddFileName."""
    return AddFileName(builder, fileName)
def AddPartitions(builder, partitions): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(partitions), 0)
def S3FileAddPartitions(builder, partitions):
    """This method is deprecated. Please switch to AddPartitions."""
    return AddPartitions(builder, partitions)
def StartPartitionsVector(builder, numElems): return builder.StartVector(1, numElems, 1)
def S3FileStartPartitionsVector(builder, numElems):
    """This method is deprecated. Please switch to Start."""
    return StartPartitionsVector(builder, numElems)
def End(builder): return builder.EndObject()
def S3FileEnd(builder):
    """This method is deprecated. Please switch to End."""
    return End(builder)