mirror of
https://gitee.com/fasiondog/hikyuu.git
synced 2024-12-04 21:07:57 +08:00
133 lines
3.7 KiB
Python
133 lines
3.7 KiB
Python
# automatically generated by the FlatBuffers compiler, do not modify
|
|
|
|
# namespace: flat
|
|
|
|
import flatbuffers
|
|
from flatbuffers.compat import import_numpy
|
|
np = import_numpy()
|
|
|
|
class SpotList(object):
|
|
__slots__ = ['_tab']
|
|
|
|
@classmethod
|
|
def GetRootAs(cls, buf, offset=0):
|
|
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
|
|
x = SpotList()
|
|
x.Init(buf, n + offset)
|
|
return x
|
|
|
|
@classmethod
|
|
def GetRootAsSpotList(cls, buf, offset=0):
|
|
"""This method is deprecated. Please switch to GetRootAs."""
|
|
return cls.GetRootAs(buf, offset)
|
|
# SpotList
|
|
def Init(self, buf, pos):
|
|
self._tab = flatbuffers.table.Table(buf, pos)
|
|
|
|
# SpotList
|
|
def Spot(self, j):
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
|
if o != 0:
|
|
x = self._tab.Vector(o)
|
|
x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
|
|
x = self._tab.Indirect(x)
|
|
from hikyuu.flat.Spot import Spot
|
|
obj = Spot()
|
|
obj.Init(self._tab.Bytes, x)
|
|
return obj
|
|
return None
|
|
|
|
# SpotList
|
|
def SpotLength(self):
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
|
if o != 0:
|
|
return self._tab.VectorLen(o)
|
|
return 0
|
|
|
|
# SpotList
|
|
def SpotIsNone(self):
|
|
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
|
|
return o == 0
|
|
|
|
def SpotListStart(builder):
|
|
builder.StartObject(1)
|
|
|
|
def Start(builder):
|
|
SpotListStart(builder)
|
|
|
|
def SpotListAddSpot(builder, spot):
|
|
builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(spot), 0)
|
|
|
|
def AddSpot(builder, spot):
|
|
SpotListAddSpot(builder, spot)
|
|
|
|
def SpotListStartSpotVector(builder, numElems):
|
|
return builder.StartVector(4, numElems, 4)
|
|
|
|
def StartSpotVector(builder, numElems: int) -> int:
|
|
return SpotListStartSpotVector(builder, numElems)
|
|
|
|
def SpotListEnd(builder):
|
|
return builder.EndObject()
|
|
|
|
def End(builder):
|
|
return SpotListEnd(builder)
|
|
|
|
import hikyuu.flat.Spot
|
|
try:
|
|
from typing import List
|
|
except:
|
|
pass
|
|
|
|
class SpotListT(object):
|
|
|
|
# SpotListT
|
|
def __init__(self):
|
|
self.spot = None # type: List[hikyuu.flat.Spot.SpotT]
|
|
|
|
@classmethod
|
|
def InitFromBuf(cls, buf, pos):
|
|
spotList = SpotList()
|
|
spotList.Init(buf, pos)
|
|
return cls.InitFromObj(spotList)
|
|
|
|
@classmethod
|
|
def InitFromPackedBuf(cls, buf, pos=0):
|
|
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, pos)
|
|
return cls.InitFromBuf(buf, pos+n)
|
|
|
|
@classmethod
|
|
def InitFromObj(cls, spotList):
|
|
x = SpotListT()
|
|
x._UnPack(spotList)
|
|
return x
|
|
|
|
# SpotListT
|
|
def _UnPack(self, spotList):
|
|
if spotList is None:
|
|
return
|
|
if not spotList.SpotIsNone():
|
|
self.spot = []
|
|
for i in range(spotList.SpotLength()):
|
|
if spotList.Spot(i) is None:
|
|
self.spot.append(None)
|
|
else:
|
|
spot_ = hikyuu.flat.Spot.SpotT.InitFromObj(spotList.Spot(i))
|
|
self.spot.append(spot_)
|
|
|
|
# SpotListT
|
|
def Pack(self, builder):
|
|
if self.spot is not None:
|
|
spotlist = []
|
|
for i in range(len(self.spot)):
|
|
spotlist.append(self.spot[i].Pack(builder))
|
|
SpotListStartSpotVector(builder, len(self.spot))
|
|
for i in reversed(range(len(self.spot))):
|
|
builder.PrependUOffsetTRelative(spotlist[i])
|
|
spot = builder.EndVector()
|
|
SpotListStart(builder)
|
|
if self.spot is not None:
|
|
SpotListAddSpot(builder, spot)
|
|
spotList = SpotListEnd(builder)
|
|
return spotList
|