1# automatically generated by the FlatBuffers compiler, do not modify 2 3# namespace: NamespaceB 4 5import flatbuffers 6from flatbuffers.compat import import_numpy 7np = import_numpy() 8 9class TableInNestedNS(object): 10 __slots__ = ['_tab'] 11 12 @classmethod 13 def GetRootAs(cls, buf, offset=0): 14 n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) 15 x = TableInNestedNS() 16 x.Init(buf, n + offset) 17 return x 18 19 @classmethod 20 def GetRootAsTableInNestedNS(cls, buf, offset=0): 21 """This method is deprecated. Please switch to GetRootAs.""" 22 return cls.GetRootAs(buf, offset) 23 # TableInNestedNS 24 def Init(self, buf, pos): 25 self._tab = flatbuffers.table.Table(buf, pos) 26 27 # TableInNestedNS 28 def Foo(self): 29 o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) 30 if o != 0: 31 return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) 32 return 0 33 34def Start(builder): builder.StartObject(1) 35def TableInNestedNSStart(builder): 36 """This method is deprecated. Please switch to Start.""" 37 return Start(builder) 38def AddFoo(builder, foo): builder.PrependInt32Slot(0, foo, 0) 39def TableInNestedNSAddFoo(builder, foo): 40 """This method is deprecated. Please switch to AddFoo.""" 41 return AddFoo(builder, foo) 42def End(builder): return builder.EndObject() 43def TableInNestedNSEnd(builder): 44 """This method is deprecated. Please switch to End.""" 45 return End(builder) 46 47class TableInNestedNST(object): 48 49 # TableInNestedNST 50 def __init__(self): 51 self.foo = 0 # type: int 52 53 @classmethod 54 def InitFromBuf(cls, buf, pos): 55 tableInNestedNS = TableInNestedNS() 56 tableInNestedNS.Init(buf, pos) 57 return cls.InitFromObj(tableInNestedNS) 58 59 @classmethod 60 def InitFromObj(cls, tableInNestedNS): 61 x = TableInNestedNST() 62 x._UnPack(tableInNestedNS) 63 return x 64 65 # TableInNestedNST 66 def _UnPack(self, tableInNestedNS): 67 if tableInNestedNS is None: 68 return 69 self.foo = tableInNestedNS.Foo() 70 71 # TableInNestedNST 72 def Pack(self, builder): 73 Start(builder) 74 AddFoo(builder, self.foo) 75 tableInNestedNS = End(builder) 76 return tableInNestedNS 77