mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-09-16 05:07:55 +08:00
* first flatbuffer schema * do not lint auto-generated files * add flatbuffers package * add flatbuffer module * wire up /data/X/T route * use flatbuffers for matrix data fetc * clarity and comments * add flatbuffer layout route * clean up obsolete code * fix tests * move flake8 config to setup.cfg * add comments * lint * rework layout routes for fbs * add more type support to fbs * lint * add flatbuffer support for annotations * function name improvements * fix botched merge with master * remove unused import * route cleanup for flatbuffers * rename function for clarity * add missing globals to Jest tests * fix client JS tests * fix routes for Python tests * comments for clarity * non-finite floating point hardening * more non-finite number handling * lint * fix tests for summarizeAnnotations * harden diffexp calculation against FP errors * cleanup unused code * lint * add encoding tests for flatbuffers * application type specified as strings * fix spelling error * improve variable names * add note about documentation gap * rename FBS DataFrame to Matrix
99 lines
3.6 KiB
Python
99 lines
3.6 KiB
Python
# automatically generated by the FlatBuffers compiler, do not modify
|
|
|
|
# namespace: NetEncoding
|
|
|
|
import flatbuffers
|
|
|
|
class Matrix(object):
|
|
__slots__ = ['_tab']
|
|
|
|
@classmethod
|
|
def GetRootAsMatrix(cls, buf, offset):
|
|
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
|
|
x = Matrix()
|
|
x.Init(buf, n + offset)
|
|
return x
|
|
|
|
# Matrix
|
|
def Init(self, buf, pos):
|
|
self._tab = flatbuffers.table.Table(buf, pos)
|
|
|
|
# Matrix
|
|
def NRows(self):
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
|
if o != 0:
|
|
return self._tab.Get(flatbuffers.number_types.Uint32Flags, o + self._tab.Pos)
|
|
return 0
|
|
|
|
# Matrix
|
|
def NCols(self):
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
|
|
if o != 0:
|
|
return self._tab.Get(flatbuffers.number_types.Uint32Flags, o + self._tab.Pos)
|
|
return 0
|
|
|
|
# Matrix
|
|
def Columns(self, j):
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
|
|
if o != 0:
|
|
x = self._tab.Vector(o)
|
|
x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
|
|
x = self._tab.Indirect(x)
|
|
from .Column import Column
|
|
obj = Column()
|
|
obj.Init(self._tab.Bytes, x)
|
|
return obj
|
|
return None
|
|
|
|
# Matrix
|
|
def ColumnsLength(self):
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
|
|
if o != 0:
|
|
return self._tab.VectorLen(o)
|
|
return 0
|
|
|
|
# Matrix
|
|
def ColIndexType(self):
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
|
|
if o != 0:
|
|
return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos)
|
|
return 0
|
|
|
|
# Matrix
|
|
def ColIndex(self):
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
|
|
if o != 0:
|
|
from flatbuffers.table import Table
|
|
obj = Table(bytearray(), 0)
|
|
self._tab.Union(obj, o)
|
|
return obj
|
|
return None
|
|
|
|
# Matrix
|
|
def RowIndexType(self):
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
|
|
if o != 0:
|
|
return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos)
|
|
return 0
|
|
|
|
# Matrix
|
|
def RowIndex(self):
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
|
|
if o != 0:
|
|
from flatbuffers.table import Table
|
|
obj = Table(bytearray(), 0)
|
|
self._tab.Union(obj, o)
|
|
return obj
|
|
return None
|
|
|
|
def MatrixStart(builder): builder.StartObject(7)
|
|
def MatrixAddNRows(builder, nRows): builder.PrependUint32Slot(0, nRows, 0)
|
|
def MatrixAddNCols(builder, nCols): builder.PrependUint32Slot(1, nCols, 0)
|
|
def MatrixAddColumns(builder, columns): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(columns), 0)
|
|
def MatrixStartColumnsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
|
|
def MatrixAddColIndexType(builder, colIndexType): builder.PrependUint8Slot(3, colIndexType, 0)
|
|
def MatrixAddColIndex(builder, colIndex): builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(colIndex), 0)
|
|
def MatrixAddRowIndexType(builder, rowIndexType): builder.PrependUint8Slot(5, rowIndexType, 0)
|
|
def MatrixAddRowIndex(builder, rowIndex): builder.PrependUOffsetTRelativeSlot(6, flatbuffers.number_types.UOffsetTFlags.py_type(rowIndex), 0)
|
|
def MatrixEnd(builder): return builder.EndObject()
|