summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRichard A Hofer <rofer@google.com>2021-01-28 15:35:37 -0500
committerGitHub <noreply@github.com>2021-01-28 12:35:37 -0800
commit13d9e35858fe8c96f7244bf0e4b66af2b24b59f3 (patch)
tree55075d6b8bd9f20d89ce3eaeb9a7a84814b33f60 /tests
parent6effe431bbdef0580b6552a3246f7ec6b3751a2c (diff)
downloadflatbuffers-13d9e35858fe8c96f7244bf0e4b66af2b24b59f3.tar.gz
flatbuffers-13d9e35858fe8c96f7244bf0e4b66af2b24b59f3.tar.bz2
flatbuffers-13d9e35858fe8c96f7244bf0e4b66af2b24b59f3.zip
Better python generated code naming (#6336)
* Remove a lot of redundancy from the Python generated code. Update tutorial to reflect new Python generated code. * Add aliases for newly deprecated Python generated methods. This should help with backwards compatibility. * Fix incorrect names in deprecated comments.
Diffstat (limited to 'tests')
-rw-r--r--tests/MyGame/Example/ArrayTable.py28
-rw-r--r--tests/MyGame/Example/Monster.py529
-rw-r--r--tests/MyGame/Example/Referrable.py28
-rw-r--r--tests/MyGame/Example/Stat.py42
-rw-r--r--tests/MyGame/Example/TestSimpleTableWithEnum.py28
-rw-r--r--tests/MyGame/Example/TypeAliases.py119
-rw-r--r--tests/MyGame/Example2/Monster.py21
-rw-r--r--tests/MyGame/InParentNamespace.py21
-rw-r--r--tests/MyGame/MonsterExtra.py105
-rwxr-xr-xtests/PythonTest.sh1
-rw-r--r--tests/namespace_test/NamespaceA/NamespaceB/TableInNestedNS.py28
-rw-r--r--tests/namespace_test/NamespaceA/SecondTableInA.py28
-rw-r--r--tests/namespace_test/NamespaceA/TableInFirstNS.py56
-rw-r--r--tests/namespace_test/NamespaceC/TableInC.py35
-rw-r--r--tests/py_test.py276
15 files changed, 903 insertions, 442 deletions
diff --git a/tests/MyGame/Example/ArrayTable.py b/tests/MyGame/Example/ArrayTable.py
index af66ac42..5ca8dad6 100644
--- a/tests/MyGame/Example/ArrayTable.py
+++ b/tests/MyGame/Example/ArrayTable.py
@@ -10,13 +10,17 @@ class ArrayTable(object):
__slots__ = ['_tab']
@classmethod
- def GetRootAsArrayTable(cls, buf, offset=0):
+ def GetRootAs(cls, buf, offset=0):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x = ArrayTable()
x.Init(buf, n + offset)
return x
@classmethod
+ def GetRootAsArrayTable(cls, buf, offset=0):
+ """This method is deprecated. Please switch to GetRootAs."""
+ return cls.GetRootAs(buf, offset)
+ @classmethod
def ArrayTableBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x41\x52\x52\x54", size_prefixed=size_prefixed)
@@ -35,10 +39,18 @@ class ArrayTable(object):
return obj
return None
-def ArrayTableStart(builder): builder.StartObject(1)
-def ArrayTableAddA(builder, a): builder.PrependStructSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(a), 0)
-def ArrayTableEnd(builder): return builder.EndObject()
-
+def Start(builder): builder.StartObject(1)
+def ArrayTableStart(builder):
+ """This method is deprecated. Please switch to Start."""
+ return Start(builder)
+def AddA(builder, a): builder.PrependStructSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(a), 0)
+def ArrayTableAddA(builder, a):
+ """This method is deprecated. Please switch to AddA."""
+ return AddA(builder, a)
+def End(builder): return builder.EndObject()
+def ArrayTableEnd(builder):
+ """This method is deprecated. Please switch to End."""
+ return End(builder)
import MyGame.Example.ArrayStruct
try:
from typing import Optional
@@ -72,9 +84,9 @@ class ArrayTableT(object):
# ArrayTableT
def Pack(self, builder):
- ArrayTableStart(builder)
+ Start(builder)
if self.a is not None:
a = self.a.Pack(builder)
- ArrayTableAddA(builder, a)
- arrayTable = ArrayTableEnd(builder)
+ AddA(builder, a)
+ arrayTable = End(builder)
return arrayTable
diff --git a/tests/MyGame/Example/Monster.py b/tests/MyGame/Example/Monster.py
index 7ebf6974..33f69a5a 100644
--- a/tests/MyGame/Example/Monster.py
+++ b/tests/MyGame/Example/Monster.py
@@ -11,13 +11,17 @@ class Monster(object):
__slots__ = ['_tab']
@classmethod
- def GetRootAsMonster(cls, buf, offset=0):
+ def GetRootAs(cls, buf, offset=0):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x = Monster()
x.Init(buf, n + offset)
return x
@classmethod
+ def GetRootAsMonster(cls, buf, offset=0):
+ """This method is deprecated. Please switch to GetRootAs."""
+ return cls.GetRootAs(buf, offset)
+ @classmethod
def MonsterBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x4D\x4F\x4E\x53", size_prefixed=size_prefixed)
@@ -210,7 +214,7 @@ class Monster(object):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(30))
if o != 0:
from MyGame.Example.Monster import Monster
- return Monster.GetRootAsMonster(self._tab.Bytes, self._tab.Vector(o))
+ return Monster.GetRootAs(self._tab.Bytes, self._tab.Vector(o))
return 0
# Monster
@@ -747,7 +751,7 @@ class Monster(object):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(102))
if o != 0:
from MyGame.Example.Monster import Monster
- return Monster.GetRootAsMonster(self._tab.Bytes, self._tab.Vector(o))
+ return Monster.GetRootAs(self._tab.Bytes, self._tab.Vector(o))
return 0
# Monster
@@ -787,89 +791,314 @@ class Monster(object):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(104))
return o == 0
-def MonsterStart(builder): builder.StartObject(51)
-def MonsterAddPos(builder, pos): builder.PrependStructSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(pos), 0)
-def MonsterAddMana(builder, mana): builder.PrependInt16Slot(1, mana, 150)
-def MonsterAddHp(builder, hp): builder.PrependInt16Slot(2, hp, 100)
-def MonsterAddName(builder, name): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(name), 0)
-def MonsterAddInventory(builder, inventory): builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(inventory), 0)
-def MonsterStartInventoryVector(builder, numElems): return builder.StartVector(1, numElems, 1)
-def MonsterAddColor(builder, color): builder.PrependUint8Slot(6, color, 8)
-def MonsterAddTestType(builder, testType): builder.PrependUint8Slot(7, testType, 0)
-def MonsterAddTest(builder, test): builder.PrependUOffsetTRelativeSlot(8, flatbuffers.number_types.UOffsetTFlags.py_type(test), 0)
-def MonsterAddTest4(builder, test4): builder.PrependUOffsetTRelativeSlot(9, flatbuffers.number_types.UOffsetTFlags.py_type(test4), 0)
-def MonsterStartTest4Vector(builder, numElems): return builder.StartVector(4, numElems, 2)
-def MonsterAddTestarrayofstring(builder, testarrayofstring): builder.PrependUOffsetTRelativeSlot(10, flatbuffers.number_types.UOffsetTFlags.py_type(testarrayofstring), 0)
-def MonsterStartTestarrayofstringVector(builder, numElems): return builder.StartVector(4, numElems, 4)
-def MonsterAddTestarrayoftables(builder, testarrayoftables): builder.PrependUOffsetTRelativeSlot(11, flatbuffers.number_types.UOffsetTFlags.py_type(testarrayoftables), 0)
-def MonsterStartTestarrayoftablesVector(builder, numElems): return builder.StartVector(4, numElems, 4)
-def MonsterAddEnemy(builder, enemy): builder.PrependUOffsetTRelativeSlot(12, flatbuffers.number_types.UOffsetTFlags.py_type(enemy), 0)
-def MonsterAddTestnestedflatbuffer(builder, testnestedflatbuffer): builder.PrependUOffsetTRelativeSlot(13, flatbuffers.number_types.UOffsetTFlags.py_type(testnestedflatbuffer), 0)
-def MonsterStartTestnestedflatbufferVector(builder, numElems): return builder.StartVector(1, numElems, 1)
-def MonsterMakeTestnestedflatbufferVectorFromBytes(builder, bytes):
+def Start(builder): builder.StartObject(51)
+def MonsterStart(builder):
+ """This method is deprecated. Please switch to Start."""
+ return Start(builder)
+def AddPos(builder, pos): builder.PrependStructSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(pos), 0)
+def MonsterAddPos(builder, pos):
+ """This method is deprecated. Please switch to AddPos."""
+ return AddPos(builder, pos)
+def AddMana(builder, mana): builder.PrependInt16Slot(1, mana, 150)
+def MonsterAddMana(builder, mana):
+ """This method is deprecated. Please switch to AddMana."""
+ return AddMana(builder, mana)
+def AddHp(builder, hp): builder.PrependInt16Slot(2, hp, 100)
+def MonsterAddHp(builder, hp):
+ """This method is deprecated. Please switch to AddHp."""
+ return AddHp(builder, hp)
+def AddName(builder, name): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(name), 0)
+def MonsterAddName(builder, name):
+ """This method is deprecated. Please switch to AddName."""
+ return AddName(builder, name)
+def AddInventory(builder, inventory): builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(inventory), 0)
+def MonsterAddInventory(builder, inventory):
+ """This method is deprecated. Please switch to AddInventory."""
+ return AddInventory(builder, inventory)
+def StartInventoryVector(builder, numElems): return builder.StartVector(1, numElems, 1)
+def MonsterStartInventoryVector(builder, numElems):
+ """This method is deprecated. Please switch to Start."""
+ return StartInventoryVector(builder, numElems)
+def AddColor(builder, color): builder.PrependUint8Slot(6, color, 8)
+def MonsterAddColor(builder, color):
+ """This method is deprecated. Please switch to AddColor."""
+ return AddColor(builder, color)
+def AddTestType(builder, testType): builder.PrependUint8Slot(7, testType, 0)
+def MonsterAddTestType(builder, testType):
+ """This method is deprecated. Please switch to AddTestType."""
+ return AddTestType(builder, testType)
+def AddTest(builder, test): builder.PrependUOffsetTRelativeSlot(8, flatbuffers.number_types.UOffsetTFlags.py_type(test), 0)
+def MonsterAddTest(builder, test):
+ """This method is deprecated. Please switch to AddTest."""
+ return AddTest(builder, test)
+def AddTest4(builder, test4): builder.PrependUOffsetTRelativeSlot(9, flatbuffers.number_types.UOffsetTFlags.py_type(test4), 0)
+def MonsterAddTest4(builder, test4):
+ """This method is deprecated. Please switch to AddTest4."""
+ return AddTest4(builder, test4)
+def StartTest4Vector(builder, numElems): return builder.StartVector(4, numElems, 2)
+def MonsterStartTest4Vector(builder, numElems):
+ """This method is deprecated. Please switch to Start."""
+ return StartTest4Vector(builder, numElems)
+def AddTestarrayofstring(builder, testarrayofstring): builder.PrependUOffsetTRelativeSlot(10, flatbuffers.number_types.UOffsetTFlags.py_type(testarrayofstring), 0)
+def MonsterAddTestarrayofstring(builder, testarrayofstring):
+ """This method is deprecated. Please switch to AddTestarrayofstring."""
+ return AddTestarrayofstring(builder, testarrayofstring)
+def StartTestarrayofstringVector(builder, numElems): return builder.StartVector(4, numElems, 4)
+def MonsterStartTestarrayofstringVector(builder, numElems):
+ """This method is deprecated. Please switch to Start."""
+ return StartTestarrayofstringVector(builder, numElems)
+def AddTestarrayoftables(builder, testarrayoftables): builder.PrependUOffsetTRelativeSlot(11, flatbuffers.number_types.UOffsetTFlags.py_type(testarrayoftables), 0)
+def MonsterAddTestarrayoftables(builder, testarrayoftables):
+ """This method is deprecated. Please switch to AddTestarrayoftables."""
+ return AddTestarrayoftables(builder, testarrayoftables)
+def StartTestarrayoftablesVector(builder, numElems): return builder.StartVector(4, numElems, 4)
+def MonsterStartTestarrayoftablesVector(builder, numElems):
+ """This method is deprecated. Please switch to Start."""
+ return StartTestarrayoftablesVector(builder, numElems)
+def AddEnemy(builder, enemy): builder.PrependUOffsetTRelativeSlot(12, flatbuffers.number_types.UOffsetTFlags.py_type(enemy), 0)
+def MonsterAddEnemy(builder, enemy):
+ """This method is deprecated. Please switch to AddEnemy."""
+ return AddEnemy(builder, enemy)
+def AddTestnestedflatbuffer(builder, testnestedflatbuffer): builder.PrependUOffsetTRelativeSlot(13, flatbuffers.number_types.UOffsetTFlags.py_type(testnestedflatbuffer), 0)
+def MonsterAddTestnestedflatbuffer(builder, testnestedflatbuffer):
+ """This method is deprecated. Please switch to AddTestnestedflatbuffer."""
+ return AddTestnestedflatbuffer(builder, testnestedflatbuffer)
+def StartTestnestedflatbufferVector(builder, numElems): return builder.StartVector(1, numElems, 1)
+def MonsterStartTestnestedflatbufferVector(builder, numElems):
+ """This method is deprecated. Please switch to Start."""
+ return StartTestnestedflatbufferVector(builder, numElems)
+def MakeVectorFromBytes(builder, bytes):
builder.StartVector(1, len(bytes), 1)
builder.head = builder.head - len(bytes)
builder.Bytes[builder.head : builder.head + len(bytes)] = bytes
return builder.EndVector()
-def MonsterAddTestempty(builder, testempty): builder.PrependUOffsetTRelativeSlot(14, flatbuffers.number_types.UOffsetTFlags.py_type(testempty), 0)
-def MonsterAddTestbool(builder, testbool): builder.PrependBoolSlot(15, testbool, 0)
-def MonsterAddTesthashs32Fnv1(builder, testhashs32Fnv1): builder.PrependInt32Slot(16, testhashs32Fnv1, 0)
-def MonsterAddTesthashu32Fnv1(builder, testhashu32Fnv1): builder.PrependUint32Slot(17, testhashu32Fnv1, 0)
-def MonsterAddTesthashs64Fnv1(builder, testhashs64Fnv1): builder.PrependInt64Slot(18, testhashs64Fnv1, 0)
-def MonsterAddTesthashu64Fnv1(builder, testhashu64Fnv1): builder.PrependUint64Slot(19, testhashu64Fnv1, 0)
-def MonsterAddTesthashs32Fnv1a(builder, testhashs32Fnv1a): builder.PrependInt32Slot(20, testhashs32Fnv1a, 0)
-def MonsterAddTesthashu32Fnv1a(builder, testhashu32Fnv1a): builder.PrependUint32Slot(21, testhashu32Fnv1a, 0)
-def MonsterAddTesthashs64Fnv1a(builder, testhashs64Fnv1a): builder.PrependInt64Slot(22, testhashs64Fnv1a, 0)
-def MonsterAddTesthashu64Fnv1a(builder, testhashu64Fnv1a): builder.PrependUint64Slot(23, testhashu64Fnv1a, 0)
-def MonsterAddTestarrayofbools(builder, testarrayofbools): builder.PrependUOffsetTRelativeSlot(24, flatbuffers.number_types.UOffsetTFlags.py_type(testarrayofbools), 0)
-def MonsterStartTestarrayofboolsVector(builder, numElems): return builder.StartVector(1, numElems, 1)
-def MonsterAddTestf(builder, testf): builder.PrependFloat32Slot(25, testf, 3.14159)
-def MonsterAddTestf2(builder, testf2): builder.PrependFloat32Slot(26, testf2, 3.0)
-def MonsterAddTestf3(builder, testf3): builder.PrependFloat32Slot(27, testf3, 0.0)
-def MonsterAddTestarrayofstring2(builder, testarrayofstring2): builder.PrependUOffsetTRelativeSlot(28, flatbuffers.number_types.UOffsetTFlags.py_type(testarrayofstring2), 0)
-def MonsterStartTestarrayofstring2Vector(builder, numElems): return builder.StartVector(4, numElems, 4)
-def MonsterAddTestarrayofsortedstruct(builder, testarrayofsortedstruct): builder.PrependUOffsetTRelativeSlot(29, flatbuffers.number_types.UOffsetTFlags.py_type(testarrayofsortedstruct), 0)
-def MonsterStartTestarrayofsortedstructVector(builder, numElems): return builder.StartVector(8, numElems, 4)
-def MonsterAddFlex(builder, flex): builder.PrependUOffsetTRelativeSlot(30, flatbuffers.number_types.UOffsetTFlags.py_type(flex), 0)
-def MonsterStartFlexVector(builder, numElems): return builder.StartVector(1, numElems, 1)
-def MonsterAddTest5(builder, test5): builder.PrependUOffsetTRelativeSlot(31, flatbuffers.number_types.UOffsetTFlags.py_type(test5), 0)
-def MonsterStartTest5Vector(builder, numElems): return builder.StartVector(4, numElems, 2)
-def MonsterAddVectorOfLongs(builder, vectorOfLongs): builder.PrependUOffsetTRelativeSlot(32, flatbuffers.number_types.UOffsetTFlags.py_type(vectorOfLongs), 0)
-def MonsterStartVectorOfLongsVector(builder, numElems): return builder.StartVector(8, numElems, 8)
-def MonsterAddVectorOfDoubles(builder, vectorOfDoubles): builder.PrependUOffsetTRelativeSlot(33, flatbuffers.number_types.UOffsetTFlags.py_type(vectorOfDoubles), 0)
-def MonsterStartVectorOfDoublesVector(builder, numElems): return builder.StartVector(8, numElems, 8)
-def MonsterAddParentNamespaceTest(builder, parentNamespaceTest): builder.PrependUOffsetTRelativeSlot(34, flatbuffers.number_types.UOffsetTFlags.py_type(parentNamespaceTest), 0)
-def MonsterAddVectorOfReferrables(builder, vectorOfReferrables): builder.PrependUOffsetTRelativeSlot(35, flatbuffers.number_types.UOffsetTFlags.py_type(vectorOfReferrables), 0)
-def MonsterStartVectorOfReferrablesVector(builder, numElems): return builder.StartVector(4, numElems, 4)
-def MonsterAddSingleWeakReference(builder, singleWeakReference): builder.PrependUint64Slot(36, singleWeakReference, 0)
-def MonsterAddVectorOfWeakReferences(builder, vectorOfWeakReferences): builder.PrependUOffsetTRelativeSlot(37, flatbuffers.number_types.UOffsetTFlags.py_type(vectorOfWeakReferences), 0)
-def MonsterStartVectorOfWeakReferencesVector(builder, numElems): return builder.StartVector(8, numElems, 8)
-def MonsterAddVectorOfStrongReferrables(builder, vectorOfStrongReferrables): builder.PrependUOffsetTRelativeSlot(38, flatbuffers.number_types.UOffsetTFlags.py_type(vectorOfStrongReferrables), 0)
-def MonsterStartVectorOfStrongReferrablesVector(builder, numElems): return builder.StartVector(4, numElems, 4)
-def MonsterAddCoOwningReference(builder, coOwningReference): builder.PrependUint64Slot(39, coOwningReference, 0)
-def MonsterAddVectorOfCoOwningReferences(builder, vectorOfCoOwningReferences): builder.PrependUOffsetTRelativeSlot(40, flatbuffers.number_types.UOffsetTFlags.py_type(vectorOfCoOwningReferences), 0)
-def MonsterStartVectorOfCoOwningReferencesVector(builder, numElems): return builder.StartVector(8, numElems, 8)
-def MonsterAddNonOwningReference(builder, nonOwningReference): builder.PrependUint64Slot(41, nonOwningReference, 0)
-def MonsterAddVectorOfNonOwningReferences(builder, vectorOfNonOwningReferences): builder.PrependUOffsetTRelativeSlot(42, flatbuffers.number_types.UOffsetTFlags.py_type(vectorOfNonOwningReferences), 0)
-def MonsterStartVectorOfNonOwningReferencesVector(builder, numElems): return builder.StartVector(8, numElems, 8)
-def MonsterAddAnyUniqueType(builder, anyUniqueType): builder.PrependUint8Slot(43, anyUniqueType, 0)
-def MonsterAddAnyUnique(builder, anyUnique): builder.PrependUOffsetTRelativeSlot(44, flatbuffers.number_types.UOffsetTFlags.py_type(anyUnique), 0)
-def MonsterAddAnyAmbiguousType(builder, anyAmbiguousType): builder.PrependUint8Slot(45, anyAmbiguousType, 0)
-def MonsterAddAnyAmbiguous(builder, anyAmbiguous): builder.PrependUOffsetTRelativeSlot(46, flatbuffers.number_types.UOffsetTFlags.py_type(anyAmbiguous), 0)
-def MonsterAddVectorOfEnums(builder, vectorOfEnums): builder.PrependUOffsetTRelativeSlot(47, flatbuffers.number_types.UOffsetTFlags.py_type(vectorOfEnums), 0)
-def MonsterStartVectorOfEnumsVector(builder, numElems): return builder.StartVector(1, numElems, 1)
-def MonsterAddSignedEnum(builder, signedEnum): builder.PrependInt8Slot(48, signedEnum, -1)
-def MonsterAddTestrequirednestedflatbuffer(builder, testrequirednestedflatbuffer): builder.PrependUOffsetTRelativeSlot(49, flatbuffers.number_types.UOffsetTFlags.py_type(testrequirednestedflatbuffer), 0)
-def MonsterStartTestrequirednestedflatbufferVector(builder, numElems): return builder.StartVector(1, numElems, 1)
-def MonsterMakeTestrequirednestedflatbufferVectorFromBytes(builder, bytes):
+def MakeTestnestedflatbufferVectorFromBytes(builder, bytes):
builder.StartVector(1, len(bytes), 1)
builder.head = builder.head - len(bytes)
builder.Bytes[builder.head : builder.head + len(bytes)] = bytes
return builder.EndVector()
-def MonsterAddScalarKeySortedTables(builder, scalarKeySortedTables): builder.PrependUOffsetTRelativeSlot(50, flatbuffers.number_types.UOffsetTFlags.py_type(scalarKeySortedTables), 0)
-def MonsterStartScalarKeySortedTablesVector(builder, numElems): return builder.StartVector(4, numElems, 4)
-def MonsterEnd(builder): return builder.EndObject()
-
+def AddTestempty(builder, testempty): builder.PrependUOffsetTRelativeSlot(14, flatbuffers.number_types.UOffsetTFlags.py_type(testempty), 0)
+def MonsterAddTestempty(builder, testempty):
+ """This method is deprecated. Please switch to AddTestempty."""
+ return AddTestempty(builder, testempty)
+def AddTestbool(builder, testbool): builder.PrependBoolSlot(15, testbool, 0)
+def MonsterAddTestbool(builder, testbool):
+ """This method is deprecated. Please switch to AddTestbool."""
+ return AddTestbool(builder, testbool)
+def AddTesthashs32Fnv1(builder, testhashs32Fnv1): builder.PrependInt32Slot(16, testhashs32Fnv1, 0)
+def MonsterAddTesthashs32Fnv1(builder, testhashs32Fnv1):
+ """This method is deprecated. Please switch to AddTesthashs32Fnv1."""
+ return AddTesthashs32Fnv1(builder, testhashs32Fnv1)
+def AddTesthashu32Fnv1(builder, testhashu32Fnv1): builder.PrependUint32Slot(17, testhashu32Fnv1, 0)
+def MonsterAddTesthashu32Fnv1(builder, testhashu32Fnv1):
+ """This method is deprecated. Please switch to AddTesthashu32Fnv1."""
+ return AddTesthashu32Fnv1(builder, testhashu32Fnv1)
+def AddTesthashs64Fnv1(builder, testhashs64Fnv1): builder.PrependInt64Slot(18, testhashs64Fnv1, 0)
+def MonsterAddTesthashs64Fnv1(builder, testhashs64Fnv1):
+ """This method is deprecated. Please switch to AddTesthashs64Fnv1."""
+ return AddTesthashs64Fnv1(builder, testhashs64Fnv1)
+def AddTesthashu64Fnv1(builder, testhashu64Fnv1): builder.PrependUint64Slot(19, testhashu64Fnv1, 0)
+def MonsterAddTesthashu64Fnv1(builder, testhashu64Fnv1):
+ """This method is deprecated. Please switch to AddTesthashu64Fnv1."""
+ return AddTesthashu64Fnv1(builder, testhashu64Fnv1)
+def AddTesthashs32Fnv1a(builder, testhashs32Fnv1a): builder.PrependInt32Slot(20, testhashs32Fnv1a, 0)
+def MonsterAddTesthashs32Fnv1a(builder, testhashs32Fnv1a):
+ """This method is deprecated. Please switch to AddTesthashs32Fnv1a."""
+ return AddTesthashs32Fnv1a(builder, testhashs32Fnv1a)
+def AddTesthashu32Fnv1a(builder, testhashu32Fnv1a): builder.PrependUint32Slot(21, testhashu32Fnv1a, 0)
+def MonsterAddTesthashu32Fnv1a(builder, testhashu32Fnv1a):
+ """This method is deprecated. Please switch to AddTesthashu32Fnv1a."""
+ return AddTesthashu32Fnv1a(builder, testhashu32Fnv1a)
+def AddTesthashs64Fnv1a(builder, testhashs64Fnv1a): builder.PrependInt64Slot(22, testhashs64Fnv1a, 0)
+def MonsterAddTesthashs64Fnv1a(builder, testhashs64Fnv1a):
+ """This method is deprecated. Please switch to AddTesthashs64Fnv1a."""
+ return AddTesthashs64Fnv1a(builder, testhashs64Fnv1a)
+def AddTesthashu64Fnv1a(builder, testhashu64Fnv1a): builder.PrependUint64Slot(23, testhashu64Fnv1a, 0)
+def MonsterAddTesthashu64Fnv1a(builder, testhashu64Fnv1a):
+ """This method is deprecated. Please switch to AddTesthashu64Fnv1a."""
+ return AddTesthashu64Fnv1a(builder, testhashu64Fnv1a)
+def AddTestarrayofbools(builder, testarrayofbools): builder.PrependUOffsetTRelativeSlot(24, flatbuffers.number_types.UOffsetTFlags.py_type(testarrayofbools), 0)
+def MonsterAddTestarrayofbools(builder, testarrayofbools):
+ """This method is deprecated. Please switch to AddTestarrayofbools."""
+ return AddTestarrayofbools(builder, testarrayofbools)
+def StartTestarrayofboolsVector(builder, numElems): return builder.StartVector(1, numElems, 1)
+def MonsterStartTestarrayofboolsVector(builder, numElems):
+ """This method is deprecated. Please switch to Start."""
+ return StartTestarrayofboolsVector(builder, numElems)
+def AddTestf(builder, testf): builder.PrependFloat32Slot(25, testf, 3.14159)
+def MonsterAddTestf(builder, testf):
+ """This method is deprecated. Please switch to AddTestf."""
+ return AddTestf(builder, testf)
+def AddTestf2(builder, testf2): builder.PrependFloat32Slot(26, testf2, 3.0)
+def MonsterAddTestf2(builder, testf2):
+ """This method is deprecated. Please switch to AddTestf2."""
+ return AddTestf2(builder, testf2)
+def AddTestf3(builder, testf3): builder.PrependFloat32Slot(27, testf3, 0.0)
+def MonsterAddTestf3(builder, testf3):
+ """This method is deprecated. Please switch to AddTestf3."""
+ return AddTestf3(builder, testf3)
+def AddTestarrayofstring2(builder, testarrayofstring2): builder.PrependUOffsetTRelativeSlot(28, flatbuffers.number_types.UOffsetTFlags.py_type(testarrayofstring2), 0)
+def MonsterAddTestarrayofstring2(builder, testarrayofstring2):
+ """This method is deprecated. Please switch to AddTestarrayofstring2."""
+ return AddTestarrayofstring2(builder, testarrayofstring2)
+def StartTestarrayofstring2Vector(builder, numElems): return builder.StartVector(4, numElems, 4)
+def MonsterStartTestarrayofstring2Vector(builder, numElems):
+ """This method is deprecated. Please switch to Start."""
+ return StartTestarrayofstring2Vector(builder, numElems)
+def AddTestarrayofsortedstruct(builder, testarrayofsortedstruct): builder.PrependUOffsetTRelativeSlot(29, flatbuffers.number_types.UOffsetTFlags.py_type(testarrayofsortedstruct), 0)
+def MonsterAddTestarrayofsortedstruct(builder, testarrayofsortedstruct):
+ """This method is deprecated. Please switch to AddTestarrayofsortedstruct."""
+ return AddTestarrayofsortedstruct(builder, testarrayofsortedstruct)
+def StartTestarrayofsortedstructVector(builder, numElems): return builder.StartVector(8, numElems, 4)
+def MonsterStartTestarrayofsortedstructVector(builder, numElems):
+ """This method is deprecated. Please switch to Start."""
+ return StartTestarrayofsortedstructVector(builder, numElems)
+def AddFlex(builder, flex): builder.PrependUOffsetTRelativeSlot(30, flatbuffers.number_types.UOffsetTFlags.py_type(flex), 0)
+def MonsterAddFlex(builder, flex):
+ """This method is deprecated. Please switch to AddFlex."""
+ return AddFlex(builder, flex)
+def StartFlexVector(builder, numElems): return builder.StartVector(1, numElems, 1)
+def MonsterStartFlexVector(builder, numElems):
+ """This method is deprecated. Please switch to Start."""
+ return StartFlexVector(builder, numElems)
+def AddTest5(builder, test5): builder.PrependUOffsetTRelativeSlot(31, flatbuffers.number_types.UOffsetTFlags.py_type(test5), 0)
+def MonsterAddTest5(builder, test5):
+ """This method is deprecated. Please switch to AddTest5."""
+ return AddTest5(builder, test5)
+def StartTest5Vector(builder, numElems): return builder.StartVector(4, numElems, 2)
+def MonsterStartTest5Vector(builder, numElems):
+ """This method is deprecated. Please switch to Start."""
+ return StartTest5Vector(builder, numElems)
+def AddVectorOfLongs(builder, vectorOfLongs): builder.PrependUOffsetTRelativeSlot(32, flatbuffers.number_types.UOffsetTFlags.py_type(vectorOfLongs), 0)
+def MonsterAddVectorOfLongs(builder, vectorOfLongs):
+ """This method is deprecated. Please switch to AddVectorOfLongs."""
+ return AddVectorOfLongs(builder, vectorOfLongs)
+def StartVectorOfLongsVector(builder, numElems): return builder.StartVector(8, numElems, 8)
+def MonsterStartVectorOfLongsVector(builder, numElems):
+ """This method is deprecated. Please switch to Start."""
+ return StartVectorOfLongsVector(builder, numElems)
+def AddVectorOfDoubles(builder, vectorOfDoubles): builder.PrependUOffsetTRelativeSlot(33, flatbuffers.number_types.UOffsetTFlags.py_type(vectorOfDoubles), 0)
+def MonsterAddVectorOfDoubles(builder, vectorOfDoubles):
+ """This method is deprecated. Please switch to AddVectorOfDoubles."""
+ return AddVectorOfDoubles(builder, vectorOfDoubles)
+def StartVectorOfDoublesVector(builder, numElems): return builder.StartVector(8, numElems, 8)
+def MonsterStartVectorOfDoublesVector(builder, numElems):
+ """This method is deprecated. Please switch to Start."""
+ return StartVectorOfDoublesVector(builder, numElems)
+def AddParentNamespaceTest(builder, parentNamespaceTest): builder.PrependUOffsetTRelativeSlot(34, flatbuffers.number_types.UOffsetTFlags.py_type(parentNamespaceTest), 0)
+def MonsterAddParentNamespaceTest(builder, parentNamespaceTest):
+ """This method is deprecated. Please switch to AddParentNamespaceTest."""
+ return AddParentNamespaceTest(builder, parentNamespaceTest)
+def AddVectorOfReferrables(builder, vectorOfReferrables): builder.PrependUOffsetTRelativeSlot(35, flatbuffers.number_types.UOffsetTFlags.py_type(vectorOfReferrables), 0)
+def MonsterAddVectorOfReferrables(builder, vectorOfReferrables):
+ """This method is deprecated. Please switch to AddVectorOfReferrables."""
+ return AddVectorOfReferrables(builder, vectorOfReferrables)
+def StartVectorOfReferrablesVector(builder, numElems): return builder.StartVector(4, numElems, 4)
+def MonsterStartVectorOfReferrablesVector(builder, numElems):
+ """This method is deprecated. Please switch to Start."""
+ return StartVectorOfReferrablesVector(builder, numElems)
+def AddSingleWeakReference(builder, singleWeakReference): builder.PrependUint64Slot(36, singleWeakReference, 0)
+def MonsterAddSingleWeakReference(builder, singleWeakReference):
+ """This method is deprecated. Please switch to AddSingleWeakReference."""
+ return AddSingleWeakReference(builder, singleWeakReference)
+def AddVectorOfWeakReferences(builder, vectorOfWeakReferences): builder.PrependUOffsetTRelativeSlot(37, flatbuffers.number_types.UOffsetTFlags.py_type(vectorOfWeakReferences), 0)
+def MonsterAddVectorOfWeakReferences(builder, vectorOfWeakReferences):
+ """This method is deprecated. Please switch to AddVectorOfWeakReferences."""
+ return AddVectorOfWeakReferences(builder, vectorOfWeakReferences)
+def StartVectorOfWeakReferencesVector(builder, numElems): return builder.StartVector(8, numElems, 8)
+def MonsterStartVectorOfWeakReferencesVector(builder, numElems):
+ """This method is deprecated. Please switch to Start."""
+ return StartVectorOfWeakReferencesVector(builder, numElems)
+def AddVectorOfStrongReferrables(builder, vectorOfStrongReferrables): builder.PrependUOffsetTRelativeSlot(38, flatbuffers.number_types.UOffsetTFlags.py_type(vectorOfStrongReferrables), 0)
+def MonsterAddVectorOfStrongReferrables(builder, vectorOfStrongReferrables):
+ """This method is deprecated. Please switch to AddVectorOfStrongReferrables."""
+ return AddVectorOfStrongReferrables(builder, vectorOfStrongReferrables)
+def StartVectorOfStrongReferrablesVector(builder, numElems): return builder.StartVector(4, numElems, 4)
+def MonsterStartVectorOfStrongReferrablesVector(builder, numElems):
+ """This method is deprecated. Please switch to Start."""
+ return StartVectorOfStrongReferrablesVector(builder, numElems)
+def AddCoOwningReference(builder, coOwningReference): builder.PrependUint64Slot(39, coOwningReference, 0)
+def MonsterAddCoOwningReference(builder, coOwningReference):
+ """This method is deprecated. Please switch to AddCoOwningReference."""
+ return AddCoOwningReference(builder, coOwningReference)
+def AddVectorOfCoOwningReferences(builder, vectorOfCoOwningReferences): builder.PrependUOffsetTRelativeSlot(40, flatbuffers.number_types.UOffsetTFlags.py_type(vectorOfCoOwningReferences), 0)
+def MonsterAddVectorOfCoOwningReferences(builder, vectorOfCoOwningReferences):
+ """This method is deprecated. Please switch to AddVectorOfCoOwningReferences."""
+ return AddVectorOfCoOwningReferences(builder, vectorOfCoOwningReferences)
+def StartVectorOfCoOwningReferencesVector(builder, numElems): return builder.StartVector(8, numElems, 8)
+def MonsterStartVectorOfCoOwningReferencesVector(builder, numElems):
+ """This method is deprecated. Please switch to Start."""
+ return StartVectorOfCoOwningReferencesVector(builder, numElems)
+def AddNonOwningReference(builder, nonOwningReference): builder.PrependUint64Slot(41, nonOwningReference, 0)
+def MonsterAddNonOwningReference(builder, nonOwningReference):
+ """This method is deprecated. Please switch to AddNonOwningReference."""
+ return AddNonOwningReference(builder, nonOwningReference)
+def AddVectorOfNonOwningReferences(builder, vectorOfNonOwningReferences): builder.PrependUOffsetTRelativeSlot(42, flatbuffers.number_types.UOffsetTFlags.py_type(vectorOfNonOwningReferences), 0)
+def MonsterAddVectorOfNonOwningReferences(builder, vectorOfNonOwningReferences):
+ """This method is deprecated. Please switch to AddVectorOfNonOwningReferences."""
+ return AddVectorOfNonOwningReferences(builder, vectorOfNonOwningReferences)
+def StartVectorOfNonOwningReferencesVector(builder, numElems): return builder.StartVector(8, numElems, 8)
+def MonsterStartVectorOfNonOwningReferencesVector(builder, numElems):
+ """This method is deprecated. Please switch to Start."""
+ return StartVectorOfNonOwningReferencesVector(builder, numElems)
+def AddAnyUniqueType(builder, anyUniqueType): builder.PrependUint8Slot(43, anyUniqueType, 0)
+def MonsterAddAnyUniqueType(builder, anyUniqueType):
+ """This method is deprecated. Please switch to AddAnyUniqueType."""
+ return AddAnyUniqueType(builder, anyUniqueType)
+def AddAnyUnique(builder, anyUnique): builder.PrependUOffsetTRelativeSlot(44, flatbuffers.number_types.UOffsetTFlags.py_type(anyUnique), 0)
+def MonsterAddAnyUnique(builder, anyUnique):
+ """This method is deprecated. Please switch to AddAnyUnique."""
+ return AddAnyUnique(builder, anyUnique)
+def AddAnyAmbiguousType(builder, anyAmbiguousType): builder.PrependUint8Slot(45, anyAmbiguousType, 0)
+def MonsterAddAnyAmbiguousType(builder, anyAmbiguousType):
+ """This method is deprecated. Please switch to AddAnyAmbiguousType."""
+ return AddAnyAmbiguousType(builder, anyAmbiguousType)
+def AddAnyAmbiguous(builder, anyAmbiguous): builder.PrependUOffsetTRelativeSlot(46, flatbuffers.number_types.UOffsetTFlags.py_type(anyAmbiguous), 0)
+def MonsterAddAnyAmbiguous(builder, anyAmbiguous):
+ """This method is deprecated. Please switch to AddAnyAmbiguous."""
+ return AddAnyAmbiguous(builder, anyAmbiguous)
+def AddVectorOfEnums(builder, vectorOfEnums): builder.PrependUOffsetTRelativeSlot(47, flatbuffers.number_types.UOffsetTFlags.py_type(vectorOfEnums), 0)
+def MonsterAddVectorOfEnums(builder, vectorOfEnums):
+ """This method is deprecated. Please switch to AddVectorOfEnums."""
+ return AddVectorOfEnums(builder, vectorOfEnums)
+def StartVectorOfEnumsVector(builder, numElems): return builder.StartVector(1, numElems, 1)
+def MonsterStartVectorOfEnumsVector(builder, numElems):
+ """This method is deprecated. Please switch to Start."""
+ return StartVectorOfEnumsVector(builder, numElems)
+def AddSignedEnum(builder, signedEnum): builder.PrependInt8Slot(48, signedEnum, -1)
+def MonsterAddSignedEnum(builder, signedEnum):
+ """This method is deprecated. Please switch to AddSignedEnum."""
+ return AddSignedEnum(builder, signedEnum)
+def AddTestrequirednestedflatbuffer(builder, testrequirednestedflatbuffer): builder.PrependUOffsetTRelativeSlot(49, flatbuffers.number_types.UOffsetTFlags.py_type(testrequirednestedflatbuffer), 0)
+def MonsterAddTestrequirednestedflatbuffer(builder, testrequirednestedflatbuffer):
+ """This method is deprecated. Please switch to AddTestrequirednestedflatbuffer."""
+ return AddTestrequirednestedflatbuffer(builder, testrequirednestedflatbuffer)
+def StartTestrequirednestedflatbufferVector(builder, numElems): return builder.StartVector(1, numElems, 1)
+def MonsterStartTestrequirednestedflatbufferVector(builder, numElems):
+ """This method is deprecated. Please switch to Start."""
+ return StartTestrequirednestedflatbufferVector(builder, numElems)
+def MakeVectorFromBytes(builder, bytes):
+ builder.StartVector(1, len(bytes), 1)
+ builder.head = builder.head - len(bytes)
+ builder.Bytes[builder.head : builder.head + len(bytes)] = bytes
+ return builder.EndVector()
+def MakeTestrequirednestedflatbufferVectorFromBytes(builder, bytes):
+ builder.StartVector(1, len(bytes), 1)
+ builder.head = builder.head - len(bytes)
+ builder.Bytes[builder.head : builder.head + len(bytes)] = bytes
+ return builder.EndVector()
+def AddScalarKeySortedTables(builder, scalarKeySortedTables): builder.PrependUOffsetTRelativeSlot(50, flatbuffers.number_types.UOffsetTFlags.py_type(scalarKeySortedTables), 0)
+def MonsterAddScalarKeySortedTables(builder, scalarKeySortedTables):
+ """This method is deprecated. Please switch to AddScalarKeySortedTables."""
+ return AddScalarKeySortedTables(builder, scalarKeySortedTables)
+def StartScalarKeySortedTablesVector(builder, numElems): return builder.StartVector(4, numElems, 4)
+def MonsterStartScalarKeySortedTablesVector(builder, numElems):
+ """This method is deprecated. Please switch to Start."""
+ return StartScalarKeySortedTablesVector(builder, numElems)
+def End(builder): return builder.EndObject()
+def MonsterEnd(builder):
+ """This method is deprecated. Please switch to End."""
+ return End(builder)
import MyGame.Example.Ability
import MyGame.Example.Any
import MyGame.Example.AnyAmbiguousAliases
@@ -1141,14 +1370,14 @@ class MonsterT(object):
if np is not None and type(self.inventory) is np.ndarray:
inventory = builder.CreateNumpyVector(self.inventory)
else:
- MonsterStartInventoryVector(builder, len(self.inventory))
+ StartInventoryVector(builder, len(self.inventory))
for i in reversed(range(len(self.inventory))):
builder.PrependUint8(self.inventory[i])
inventory = builder.EndVector()
if self.test is not None:
test = self.test.Pack(builder)
if self.test4 is not None:
- MonsterStartTest4Vector(builder, len(self.test4))
+ StartTest4Vector(builder, len(self.test4))
for i in reversed(range(len(self.test4))):
self.test4[i].Pack(builder)
test4 = builder.EndVector()
@@ -1156,7 +1385,7 @@ class MonsterT(object):
testarrayofstringlist = []
for i in range(len(self.testarrayofstring)):
testarrayofstringlist.append(builder.CreateString(self.testarrayofstring[i]))
- MonsterStartTestarrayofstringVector(builder, len(self.testarrayofstring))
+ StartTestarrayofstringVector(builder, len(self.testarrayofstring))
for i in reversed(range(len(self.testarrayofstring))):
builder.PrependUOffsetTRelative(testarrayofstringlist[i])
testarrayofstring = builder.EndVector()
@@ -1164,7 +1393,7 @@ class MonsterT(object):
testarrayoftableslist = []
for i in range(len(self.testarrayoftables)):
testarrayoftableslist.append(self.testarrayoftables[i].Pack(builder))
- MonsterStartTestarrayoftablesVector(builder, len(self.testarrayoftables))
+ StartTestarrayoftablesVector(builder, len(self.testarrayoftables))
for i in reversed(range(len(self.testarrayoftables))):
builder.PrependUOffsetTRelative(testarrayoftableslist[i])
testarrayoftables = builder.EndVector()
@@ -1174,7 +1403,7 @@ class MonsterT(object):
if np is not None and type(self.testnestedflatbuffer) is np.ndarray:
testnestedflatbuffer = builder.CreateNumpyVector(self.testnestedflatbuffer)
else:
- MonsterStartTestnestedflatbufferVector(builder, len(self.testnestedflatbuffer))
+ StartTestnestedflatbufferVector(builder, len(self.testnestedflatbuffer))
for i in reversed(range(len(self.testnestedflatbuffer))):
builder.PrependUint8(self.testnestedflatbuffer[i])
testnestedflatbuffer = builder.EndVector()
@@ -1184,7 +1413,7 @@ class MonsterT(object):
if np is not None and type(self.testarrayofbools) is np.ndarray:
testarrayofbools = builder.CreateNumpyVector(self.testarrayofbools)
else:
- MonsterStartTestarrayofboolsVector(builder, len(self.testarrayofbools))
+ StartTestarrayofboolsVector(builder, len(self.testarrayofbools))
for i in reversed(range(len(self.testarrayofbools))):
builder.PrependBool(self.testarrayofbools[i])
testarrayofbools = builder.EndVector()
@@ -1192,12 +1421,12 @@ class MonsterT(object):
testarrayofstring2list = []
for i in range(len(self.testarrayofstring2)):
testarrayofstring2list.append(builder.CreateString(self.testarrayofstring2[i]))
- MonsterStartTestarrayofstring2Vector(builder, len(self.testarrayofstring2))
+ StartTestarrayofstring2Vector(builder, len(self.testarrayofstring2))
for i in reversed(range(len(self.testarrayofstring2))):
builder.PrependUOffsetTRelative(testarrayofstring2list[i])
testarrayofstring2 = builder.EndVector()
if self.testarrayofsortedstruct is not None:
- MonsterStartTestarrayofsortedstructVector(builder, len(self.testarrayofsortedstruct))
+ StartTestarrayofsortedstructVector(builder, len(self.testarrayofsortedstruct))
for i in reversed(range(len(self.testarrayofsortedstruct))):
self.testarrayofsortedstruct[i].Pack(builder)
testarrayofsortedstruct = builder.EndVector()
@@ -1205,12 +1434,12 @@ class MonsterT(object):
if np is not None and type(self.flex) is np.ndarray:
flex = builder.CreateNumpyVector(self.flex)
else:
- MonsterStartFlexVector(builder, len(self.flex))
+ StartFlexVector(builder, len(self.flex))
for i in reversed(range(len(self.flex))):
builder.PrependUint8(self.flex[i])
flex = builder.EndVector()
if self.test5 is not None:
- MonsterStartTest5Vector(builder, len(self.test5))
+ StartTest5Vector(builder, len(self.test5))
for i in reversed(range(len(self.test5))):
self.test5[i].Pack(builder)
test5 = builder.EndVector()
@@ -1218,7 +1447,7 @@ class MonsterT(object):
if np is not None and type(self.vectorOfLongs) is np.ndarray:
vectorOfLongs = builder.CreateNumpyVector(self.vectorOfLongs)
else:
- MonsterStartVectorOfLongsVector(builder, len(self.vectorOfLongs))
+ StartVectorOfLongsVector(builder, len(self.vectorOfLongs))
for i in reversed(range(len(self.vectorOfLongs))):
builder.PrependInt64(self.vectorOfLongs[i])
vectorOfLongs = builder.EndVector()
@@ -1226,7 +1455,7 @@ class MonsterT(object):
if np is not None and type(self.vectorOfDoubles) is np.ndarray:
vectorOfDoubles = builder.CreateNumpyVector(self.vectorOfDoubles)
else:
- MonsterStartVectorOfDoublesVector(builder, len(self.vectorOfDoubles))
+ StartVectorOfDoublesVector(builder, len(self.vectorOfDoubles))
for i in reversed(range(len(self.vectorOfDoubles))):
builder.PrependFloat64(self.vectorOfDoubles[i])
vectorOfDoubles = builder.EndVector()
@@ -1236,7 +1465,7 @@ class MonsterT(object):
vectorOfReferrableslist = []
for i in range(len(self.vectorOfReferrables)):
vectorOfReferrableslist.append(self.vectorOfReferrables[i].Pack(builder))
- MonsterStartVectorOfReferrablesVector(builder, len(self.vectorOfReferrables))
+ StartVectorOfReferrablesVector(builder, len(self.vectorOfReferrables))
for i in reversed(range(len(self.vectorOfReferrables))):
builder.PrependUOffsetTRelative(vectorOfReferrableslist[i])
vectorOfReferrables = builder.EndVector()
@@ -1244,7 +1473,7 @@ class MonsterT(object):
if np is not None and type(self.vectorOfWeakReferences) is np.ndarray:
vectorOfWeakReferences = builder.CreateNumpyVector(self.vectorOfWeakReferences)
else:
- MonsterStartVectorOfWeakReferencesVector(builder, len(self.vectorOfWeakReferences))
+ StartVectorOfWeakReferencesVector(builder, len(self.vectorOfWeakReferences))
for i in reversed(range(len(self.vectorOfWeakReferences))):
builder.PrependUint64(self.vectorOfWeakReferences[i])
vectorOfWeakReferences = builder.EndVector()
@@ -1252,7 +1481,7 @@ class MonsterT(object):
vectorOfStrongReferrableslist = []
for i in range(len(self.vectorOfStrongReferrables)):
vectorOfStrongReferrableslist.append(self.vectorOfStrongReferrables[i].Pack(builder))
- MonsterStartVectorOfStrongReferrablesVector(builder, len(self.vectorOfStrongReferrables))
+ StartVectorOfStrongReferrablesVector(builder, len(self.vectorOfStrongReferrables))
for i in reversed(range(len(self.vectorOfStrongReferrables))):
builder.PrependUOffsetTRelative(vectorOfStrongReferrableslist[i])
vectorOfStrongReferrables = builder.EndVector()
@@ -1260,7 +1489,7 @@ class MonsterT(object):
if np is not None and type(self.vectorOfCoOwningReferences) is np.ndarray:
vectorOfCoOwningReferences = builder.CreateNumpyVector(self.vectorOfCoOwningReferences)
else:
- MonsterStartVectorOfCoOwningReferencesVector(builder, len(self.vectorOfCoOwningReferences))
+ StartVectorOfCoOwningReferencesVector(builder, len(self.vectorOfCoOwningReferences))
for i in reversed(range(len(self.vectorOfCoOwningReferences))):
builder.PrependUint64(self.vectorOfCoOwningReferences[i])
vectorOfCoOwningReferences = builder.EndVector()
@@ -1268,7 +1497,7 @@ class MonsterT(object):
if np is not None and type(self.vectorOfNonOwningReferences) is np.ndarray:
vectorOfNonOwningReferences = builder.CreateNumpyVector(self.vectorOfNonOwningReferences)
else:
- MonsterStartVectorOfNonOwningReferencesVector(builder, len(self.vectorOfNonOwningReferences))
+ StartVectorOfNonOwningReferencesVector(builder, len(self.vectorOfNonOwningReferences))
for i in reversed(range(len(self.vectorOfNonOwningReferences))):
builder.PrependUint64(self.vectorOfNonOwningReferences[i])
vectorOfNonOwningReferences = builder.EndVector()
@@ -1280,7 +1509,7 @@ class MonsterT(object):
if np is not None and type(self.vectorOfEnums) is np.ndarray:
vectorOfEnums = builder.CreateNumpyVector(self.vectorOfEnums)
else:
- MonsterStartVectorOfEnumsVector(builder, len(self.vectorOfEnums))
+ StartVectorOfEnumsVector(builder, len(self.vectorOfEnums))
for i in reversed(range(len(self.vectorOfEnums))):
builder.PrependUint8(self.vectorOfEnums[i])
vectorOfEnums = builder.EndVector()
@@ -1288,7 +1517,7 @@ class MonsterT(object):
if np is not None and type(self.testrequirednestedflatbuffer) is np.ndarray:
testrequirednestedflatbuffer = builder.CreateNumpyVector(self.testrequirednestedflatbuffer)
else:
- MonsterStartTestrequirednestedflatbufferVector(builder, len(self.testrequirednestedflatbuffer))
+ StartTestrequirednestedflatbufferVector(builder, len(self.testrequirednestedflatbuffer))
for i in reversed(range(len(self.testrequirednestedflatbuffer))):
builder.PrependUint8(self.testrequirednestedflatbuffer[i])
testrequirednestedflatbuffer = builder.EndVector()
@@ -1296,89 +1525,89 @@ class MonsterT(object):
scalarKeySortedTableslist = []
for i in range(len(self.scalarKeySortedTables)):
scalarKeySortedTableslist.append(self.scalarKeySortedTables[i].Pack(builder))
- MonsterStartScalarKeySortedTablesVector(builder, len(self.scalarKeySortedTables))
+ StartScalarKeySortedTablesVector(builder, len(self.scalarKeySortedTables))
for i in reversed(range(len(self.scalarKeySortedTables))):
builder.PrependUOffsetTRelative(scalarKeySortedTableslist[i])
scalarKeySortedTables = builder.EndVector()
- MonsterStart(builder)
+ Start(builder)
if self.pos is not None:
pos = self.pos.Pack(builder)
- MonsterAddPos(builder, pos)
- MonsterAddMana(builder, self.mana)
- MonsterAddHp(builder, self.hp)
+ AddPos(builder, pos)
+ AddMana(builder, self.mana)
+ AddHp(builder, self.hp)
if self.name is not None:
- MonsterAddName(builder, name)
+ AddName(builder, name)
if self.inventory is not None:
- MonsterAddInventory(builder, inventory)
- MonsterAddColor(builder, self.color)
- MonsterAddTestType(builder, self.testType)
+ AddInventory(builder, inventory)
+ AddColor(builder, self.color)
+ AddTestType(builder, self.testType)
if self.test is not None:
- MonsterAddTest(builder, test)
+ AddTest(builder, test)
if self.test4 is not None:
- MonsterAddTest4(builder, test4)
+ AddTest4(builder, test4)
if self.testarrayofstring is not None:
- MonsterAddTestarrayofstring(builder, testarrayofstring)
+ AddTestarrayofstring(builder, testarrayofstring)
if self.testarrayoftables is not None:
- MonsterAddTestarrayoftables(builder, testarrayoftables)
+ AddTestarrayoftables(builder, testarrayoftables)
if self.enemy is not None:
- MonsterAddEnemy(builder, enemy)
+ AddEnemy(builder, enemy)
if self.testnestedflatbuffer is not None:
- MonsterAddTestnestedflatbuffer(builder, testnestedflatbuffer)
+ AddTestnestedflatbuffer(builder, testnestedflatbuffer)
if self.testempty is not None:
- MonsterAddTestempty(builder, testempty)
- MonsterAddTestbool(builder, self.testbool)
- MonsterAddTesthashs32Fnv1(builder, self.testhashs32Fnv1)
- MonsterAddTesthashu32Fnv1(builder, self.testhashu32Fnv1)
- MonsterAddTesthashs64Fnv1(builder, self.testhashs64Fnv1)
- MonsterAddTesthashu64Fnv1(builder, self.testhashu64Fnv1)
- MonsterAddTesthashs32Fnv1a(builder, self.testhashs32Fnv1a)
- MonsterAddTesthashu32Fnv1a(builder, self.testhashu32Fnv1a)
- MonsterAddTesthashs64Fnv1a(builder, self.testhashs64Fnv1a)
- MonsterAddTesthashu64Fnv1a(builder, self.testhashu64Fnv1a)
+ AddTestempty(builder, testempty)
+ AddTestbool(builder, self.testbool)
+ AddTesthashs32Fnv1(builder, self.testhashs32Fnv1)
+ AddTesthashu32Fnv1(builder, self.testhashu32Fnv1)
+ AddTesthashs64Fnv1(builder, self.testhashs64Fnv1)
+ AddTesthashu64Fnv1(builder, self.testhashu64Fnv1)
+ AddTesthashs32Fnv1a(builder, self.testhashs32Fnv1a)
+ AddTesthashu32Fnv1a(builder, self.testhashu32Fnv1a)
+ AddTesthashs64Fnv1a(builder, self.testhashs64Fnv1a)
+ AddTesthashu64Fnv1a(builder, self.testhashu64Fnv1a)
if self.testarrayofbools is not None:
- MonsterAddTestarrayofbools(builder, testarrayofbools)
- MonsterAddTestf(builder, self.testf)
- MonsterAddTestf2(builder, self.testf2)
- MonsterAddTestf3(builder, self.testf3)
+ AddTestarrayofbools(builder, testarrayofbools)
+ AddTestf(builder, self.testf)
+ AddTestf2(builder, self.testf2)
+ AddTestf3(builder, self.testf3)
if self.testarrayofstring2 is not None:
- MonsterAddTestarrayofstring2(builder, testarrayofstring2)
+ AddTestarrayofstring2(builder, testarrayofstring2)
if self.testarrayofsortedstruct is not None:
- MonsterAddTestarrayofsortedstruct(builder, testarrayofsortedstruct)
+ AddTestarrayofsortedstruct(builder, testarrayofsortedstruct)
if self.flex is not None:
- MonsterAddFlex(builder, flex)
+ AddFlex(builder, flex)
if self.test5 is not None:
- MonsterAddTest5(builder, test5)
+ AddTest5(builder, test5)
if self.vectorOfLongs is not None:
- MonsterAddVectorOfLongs(builder, vectorOfLongs)
+ AddVectorOfLongs(builder, vectorOfLongs)
if self.vectorOfDoubles is not None:
- MonsterAddVectorOfDoubles(builder, vectorOfDoubles)
+ AddVectorOfDoubles(builder, vectorOfDoubles)
if self.parentNamespaceTest is not None:
- MonsterAddParentNamespaceTest(builder, parentNamespaceTest)
+ AddParentNamespaceTest(builder, parentNamespaceTest)
if self.vectorOfReferrables is not None:
- MonsterAddVectorOfReferrables(builder, vectorOfReferrables)
- MonsterAddSingleWeakReference(builder, self.singleWeakReference)
+ AddVectorOfReferrables(builder, vectorOfReferrables)
+ AddSingleWeakReference(builder, self.singleWeakReference)
if self.vectorOfWeakReferences is not None:
- MonsterAddVectorOfWeakReferences(builder, vectorOfWeakReferences)
+ AddVectorOfWeakReferences(builder, vectorOfWeakReferences)
if self.vectorOfStrongReferrables is not None:
- MonsterAddVectorOfStrongReferrables(builder, vectorOfStrongReferrables)
- MonsterAddCoOwningReference(builder, self.coOwningReference)
+ AddVectorOfStrongReferrables(builder, vectorOfStrongReferrables)
+ AddCoOwningReference(builder, self.coOwningReference)
if self.vectorOfCoOwningReferences is not None:
- MonsterAddVectorOfCoOwningReferences(builder, vectorOfCoOwningReferences)
- MonsterAddNonOwningReference(builder, self.nonOwningReference)
+ AddVectorOfCoOwningReferences(builder, vectorOfCoOwningReferences)
+ AddNonOwningReference(builder, self.nonOwningReference)
if self.vectorOfNonOwningReferences is not None:
- MonsterAddVectorOfNonOwningReferences(builder, vectorOfNonOwningReferences)
- MonsterAddAnyUniqueType(builder, self.anyUniqueType)
+ AddVectorOfNonOwningReferences(builder, vectorOfNonOwningReferences)
+ AddAnyUniqueType(builder, self.anyUniqueType)
if self.anyUnique is not None:
- MonsterAddAnyUnique(builder, anyUnique)
- MonsterAddAnyAmbiguousType(builder, self.anyAmbiguousType)
+ AddAnyUnique(builder, anyUnique)
+ AddAnyAmbiguousType(builder, self.anyAmbiguousType)
if self.anyAmbiguous is not None:
- MonsterAddAnyAmbiguous(builder, anyAmbiguous)
+ AddAnyAmbiguous(builder, anyAmbiguous)
if self.vectorOfEnums is not None:
- MonsterAddVectorOfEnums(builder, vectorOfEnums)
- MonsterAddSignedEnum(builder, self.signedEnum)
+ AddVectorOfEnums(builder, vectorOfEnums)
+ AddSignedEnum(builder, self.signedEnum)
if self.testrequirednestedflatbuffer is not None:
- MonsterAddTestrequirednestedflatbuffer(builder, testrequirednestedflatbuffer)
+ AddTestrequirednestedflatbuffer(builder, testrequirednestedflatbuffer)
if self.scalarKeySortedTables is not None:
- MonsterAddScalarKeySortedTables(builder, scalarKeySortedTables)
- monster = MonsterEnd(builder)
+ AddScalarKeySortedTables(builder, scalarKeySortedTables)
+ monster = End(builder)
return monster
diff --git a/tests/MyGame/Example/Referrable.py b/tests/MyGame/Example/Referrable.py
index 80e67f25..d751c273 100644
--- a/tests/MyGame/Example/Referrable.py
+++ b/tests/MyGame/Example/Referrable.py
@@ -10,13 +10,17 @@ class Referrable(object):
__slots__ = ['_tab']
@classmethod
- def GetRootAsReferrable(cls, buf, offset=0):
+ def GetRootAs(cls, buf, offset=0):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x = Referrable()
x.Init(buf, n + offset)
return x
@classmethod
+ def GetRootAsReferrable(cls, buf, offset=0):
+ """This method is deprecated. Please switch to GetRootAs."""
+ return cls.GetRootAs(buf, offset)
+ @classmethod
def ReferrableBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x4D\x4F\x4E\x53", size_prefixed=size_prefixed)
@@ -31,10 +35,18 @@ class Referrable(object):
return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos)
return 0
-def ReferrableStart(builder): builder.StartObject(1)
-def ReferrableAddId(builder, id): builder.PrependUint64Slot(0, id, 0)
-def ReferrableEnd(builder): return builder.EndObject()
-
+def Start(builder): builder.StartObject(1)
+def ReferrableStart(builder):
+ """This method is deprecated. Please switch to Start."""
+ return Start(builder)
+def AddId(builder, id): builder.PrependUint64Slot(0, id, 0)
+def ReferrableAddId(builder, id):
+ """This method is deprecated. Please switch to AddId."""
+ return AddId(builder, id)
+def End(builder): return builder.EndObject()
+def ReferrableEnd(builder):
+ """This method is deprecated. Please switch to End."""
+ return End(builder)
class ReferrableT(object):
@@ -62,7 +74,7 @@ class ReferrableT(object):
# ReferrableT
def Pack(self, builder):
- ReferrableStart(builder)
- ReferrableAddId(builder, self.id)
- referrable = ReferrableEnd(builder)
+ Start(builder)
+ AddId(builder, self.id)
+ referrable = End(builder)
return referrable
diff --git a/tests/MyGame/Example/Stat.py b/tests/MyGame/Example/Stat.py
index 508beb1b..aae8b32d 100644
--- a/tests/MyGame/Example/Stat.py
+++ b/tests/MyGame/Example/Stat.py
@@ -10,13 +10,17 @@ class Stat(object):
__slots__ = ['_tab']
@classmethod
- def GetRootAsStat(cls, buf, offset=0):
+ def GetRootAs(cls, buf, offset=0):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x = Stat()
x.Init(buf, n + offset)
return x
@classmethod
+ def GetRootAsStat(cls, buf, offset=0):
+ """This method is deprecated. Please switch to GetRootAs."""
+ return cls.GetRootAs(buf, offset)
+ @classmethod
def StatBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x4D\x4F\x4E\x53", size_prefixed=size_prefixed)
@@ -45,12 +49,26 @@ class Stat(object):
return self._tab.Get(flatbuffers.number_types.Uint16Flags, o + self._tab.Pos)
return 0
-def StatStart(builder): builder.StartObject(3)
-def StatAddId(builder, id): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(id), 0)
-def StatAddVal(builder, val): builder.PrependInt64Slot(1, val, 0)
-def StatAddCount(builder, count): builder.PrependUint16Slot(2, count, 0)
-def StatEnd(builder): return builder.EndObject()
-
+def Start(builder): builder.StartObject(3)
+def StatStart(builder):
+ """This method is deprecated. Please switch to Start."""
+ return Start(builder)
+def AddId(builder, id): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(id), 0)
+def StatAddId(builder, id):
+ """This method is deprecated. Please switch to AddId."""
+ return AddId(builder, id)
+def AddVal(builder, val): builder.PrependInt64Slot(1, val, 0)
+def StatAddVal(builder, val):
+ """This method is deprecated. Please switch to AddVal."""
+ return AddVal(builder, val)
+def AddCount(builder, count): builder.PrependUint16Slot(2, count, 0)
+def StatAddCount(builder, count):
+ """This method is deprecated. Please switch to AddCount."""
+ return AddCount(builder, count)
+def End(builder): return builder.EndObject()
+def StatEnd(builder):
+ """This method is deprecated. Please switch to End."""
+ return End(builder)
class StatT(object):
@@ -84,10 +102,10 @@ class StatT(object):
def Pack(self, builder):
if self.id is not None:
id = builder.CreateString(self.id)
- StatStart(builder)
+ Start(builder)
if self.id is not None:
- StatAddId(builder, id)
- StatAddVal(builder, self.val)
- StatAddCount(builder, self.count)
- stat = StatEnd(builder)
+ AddId(builder, id)
+ AddVal(builder, self.val)
+ AddCount(builder, self.count)
+ stat = End(builder)
return stat
diff --git a/tests/MyGame/Example/TestSimpleTableWithEnum.py b/tests/MyGame/Example/TestSimpleTableWithEnum.py
index 639b74e1..1e1e904a 100644
--- a/tests/MyGame/Example/TestSimpleTableWithEnum.py
+++ b/tests/MyGame/Example/TestSimpleTableWithEnum.py
@@ -10,13 +10,17 @@ class TestSimpleTableWithEnum(object):
__slots__ = ['_tab']
@classmethod
- def GetRootAsTestSimpleTableWithEnum(cls, buf, offset=0):
+ def GetRootAs(cls, buf, offset=0):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x = TestSimpleTableWithEnum()
x.Init(buf, n + offset)
return x
@classmethod
+ def GetRootAsTestSimpleTableWithEnum(cls, buf, offset=0):
+ """This method is deprecated. Please switch to GetRootAs."""
+ return cls.GetRootAs(buf, offset)
+ @classmethod
def TestSimpleTableWithEnumBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x4D\x4F\x4E\x53", size_prefixed=size_prefixed)
@@ -31,10 +35,18 @@ class TestSimpleTableWithEnum(object):
return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos)
return 2
-def TestSimpleTableWithEnumStart(builder): builder.StartObject(1)
-def TestSimpleTableWithEnumAddColor(builder, color): builder.PrependUint8Slot(0, color, 2)
-def TestSimpleTableWithEnumEnd(builder): return builder.EndObject()
-
+def Start(builder): builder.StartObject(1)
+def TestSimpleTableWithEnumStart(builder):
+ """This method is deprecated. Please switch to Start."""
+ return Start(builder)
+def AddColor(builder, color): builder.PrependUint8Slot(0, color, 2)
+def TestSimpleTableWithEnumAddColor(builder, color):
+ """This method is deprecated. Please switch to AddColor."""
+ return AddColor(builder, color)
+def End(builder): return builder.EndObject()
+def TestSimpleTableWithEnumEnd(builder):
+ """This method is deprecated. Please switch to End."""
+ return End(builder)
class TestSimpleTableWithEnumT(object):
@@ -62,7 +74,7 @@ class TestSimpleTableWithEnumT(object):
# TestSimpleTableWithEnumT
def Pack(self, builder):
- TestSimpleTableWithEnumStart(builder)
- TestSimpleTableWithEnumAddColor(builder, self.color)
- testSimpleTableWithEnum = TestSimpleTableWithEnumEnd(builder)
+ Start(builder)
+ AddColor(builder, self.color)
+ testSimpleTableWithEnum = End(builder)
return testSimpleTableWithEnum
diff --git a/tests/MyGame/Example/TypeAliases.py b/tests/MyGame/Example/TypeAliases.py
index 5eb352cd..29089754 100644
--- a/tests/MyGame/Example/TypeAliases.py
+++ b/tests/MyGame/Example/TypeAliases.py
@@ -10,13 +10,17 @@ class TypeAliases(object):
__slots__ = ['_tab']
@classmethod
- def GetRootAsTypeAliases(cls, buf, offset=0):
+ def GetRootAs(cls, buf, offset=0):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x = TypeAliases()
x.Init(buf, n + offset)
return x
@classmethod
+ def GetRootAsTypeAliases(cls, buf, offset=0):
+ """This method is deprecated. Please switch to GetRootAs."""
+ return cls.GetRootAs(buf, offset)
+ @classmethod
def TypeAliasesBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x4D\x4F\x4E\x53", size_prefixed=size_prefixed)
@@ -148,23 +152,70 @@ class TypeAliases(object):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(26))
return o == 0
-def TypeAliasesStart(builder): builder.StartObject(12)
-def TypeAliasesAddI8(builder, i8): builder.PrependInt8Slot(0, i8, 0)
-def TypeAliasesAddU8(builder, u8): builder.PrependUint8Slot(1, u8, 0)
-def TypeAliasesAddI16(builder, i16): builder.PrependInt16Slot(2, i16, 0)
-def TypeAliasesAddU16(builder, u16): builder.PrependUint16Slot(3, u16, 0)
-def TypeAliasesAddI32(builder, i32): builder.PrependInt32Slot(4, i32, 0)
-def TypeAliasesAddU32(builder, u32): builder.PrependUint32Slot(5, u32, 0)
-def TypeAliasesAddI64(builder, i64): builder.PrependInt64Slot(6, i64, 0)
-def TypeAliasesAddU64(builder, u64): builder.PrependUint64Slot(7, u64, 0)
-def TypeAliasesAddF32(builder, f32): builder.PrependFloat32Slot(8, f32, 0.0)
-def TypeAliasesAddF64(builder, f64): builder.PrependFloat64Slot(9, f64, 0.0)
-def TypeAliasesAddV8(builder, v8): builder.PrependUOffsetTRelativeSlot(10, flatbuffers.number_types.UOffsetTFlags.py_type(v8), 0)
-def TypeAliasesStartV8Vector(builder, numElems): return builder.StartVector(1, numElems, 1)
-def TypeAliasesAddVf64(builder, vf64): builder.PrependUOffsetTRelativeSlot(11, flatbuffers.number_types.UOffsetTFlags.py_type(vf64), 0)
-def TypeAliasesStartVf64Vector(builder, numElems): return builder.StartVector(8, numElems, 8)
-def TypeAliasesEnd(builder): return builder.EndObject()
-
+def Start(builder): builder.StartObject(12)
+def TypeAliasesStart(builder):
+ """This method is deprecated. Please switch to Start."""
+ return Start(builder)
+def AddI8(builder, i8): builder.PrependInt8Slot(0, i8, 0)
+def TypeAliasesAddI8(builder, i8):
+ """This method is deprecated. Please switch to AddI8."""
+ return AddI8(builder, i8)
+def AddU8(builder, u8): builder.PrependUint8Slot(1, u8, 0)
+def TypeAliasesAddU8(builder, u8):
+ """This method is deprecated. Please switch to AddU8."""
+ return AddU8(builder, u8)
+def AddI16(builder, i16): builder.PrependInt16Slot(2, i16, 0)
+def TypeAliasesAddI16(builder, i16):
+ """This method is deprecated. Please switch to AddI16."""
+ return AddI16(builder, i16)
+def AddU16(builder, u16): builder.PrependUint16Slot(3, u16, 0)
+def TypeAliasesAddU16(builder, u16):
+ """This method is deprecated. Please switch to AddU16."""
+ return AddU16(builder, u16)
+def AddI32(builder, i32): builder.PrependInt32Slot(4, i32, 0)
+def TypeAliasesAddI32(builder, i32):
+ """This method is deprecated. Please switch to AddI32."""
+ return AddI32(builder, i32)
+def AddU32(builder, u32): builder.PrependUint32Slot(5, u32, 0)
+def TypeAliasesAddU32(builder, u32):
+ """This method is deprecated. Please switch to AddU32."""
+ return AddU32(builder, u32)
+def AddI64(builder, i64): builder.PrependInt64Slot(6, i64, 0)
+def TypeAliasesAddI64(builder, i64):
+ """This method is deprecated. Please switch to AddI64."""
+ return AddI64(builder, i64)
+def AddU64(builder, u64): builder.PrependUint64Slot(7, u64, 0)
+def TypeAliasesAddU64(builder, u64):
+ """This method is deprecated. Please switch to AddU64."""
+ return AddU64(builder, u64)
+def AddF32(builder, f32): builder.PrependFloat32Slot(8, f32, 0.0)
+def TypeAliasesAddF32(builder, f32):
+ """This method is deprecated. Please switch to AddF32."""
+ return AddF32(builder, f32)
+def AddF64(builder, f64): builder.PrependFloat64Slot(9, f64, 0.0)
+def TypeAliasesAddF64(builder, f64):
+ """This method is deprecated. Please switch to AddF64."""
+ return AddF64(builder, f64)
+def AddV8(builder, v8): builder.PrependUOffsetTRelativeSlot(10, flatbuffers.number_types.UOffsetTFlags.py_type(v8), 0)
+def TypeAliasesAddV8(builder, v8):
+ """This method is deprecated. Please switch to AddV8."""
+ return AddV8(builder, v8)
+def StartV8Vector(builder, numElems): return builder.StartVector(1, numElems, 1)
+def TypeAliasesStartV8Vector(builder, numElems):
+ """This method is deprecated. Please switch to Start."""
+ return StartV8Vector(builder, numElems)
+def AddVf64(builder, vf64): builder.PrependUOffsetTRelativeSlot(11, flatbuffers.number_types.UOffsetTFlags.py_type(vf64), 0)
+def TypeAliasesAddVf64(builder, vf64):
+ """This method is deprecated. Please switch to AddVf64."""
+ return AddVf64(builder, vf64)
+def StartVf64Vector(builder, numElems): return builder.StartVector(8, numElems, 8)
+def TypeAliasesStartVf64Vector(builder, numElems):
+ """This method is deprecated. Please switch to Start."""
+ return StartVf64Vector(builder, numElems)
+def End(builder): return builder.EndObject()
+def TypeAliasesEnd(builder):
+ """This method is deprecated. Please switch to End."""
+ return End(builder)
try:
from typing import List
except:
@@ -234,7 +285,7 @@ class TypeAliasesT(object):
if np is not None and type(self.v8) is np.ndarray:
v8 = builder.CreateNumpyVector(self.v8)
else:
- TypeAliasesStartV8Vector(builder, len(self.v8))
+ StartV8Vector(builder, len(self.v8))
for i in reversed(range(len(self.v8))):
builder.PrependByte(self.v8[i])
v8 = builder.EndVector()
@@ -242,24 +293,24 @@ class TypeAliasesT(object):
if np is not None and type(self.vf64) is np.ndarray:
vf64 = builder.CreateNumpyVector(self.vf64)
else:
- TypeAliasesStartVf64Vector(builder, len(self.vf64))
+ StartVf64Vector(builder, len(self.vf64))
for i in reversed(range(len(self.vf64))):
builder.PrependFloat64(self.vf64[i])
vf64 = builder.EndVector()
- TypeAliasesStart(builder)
- TypeAliasesAddI8(builder, self.i8)
- TypeAliasesAddU8(builder, self.u8)
- TypeAliasesAddI16(builder, self.i16)
- TypeAliasesAddU16(builder, self.u16)
- TypeAliasesAddI32(builder, self.i32)
- TypeAliasesAddU32(builder, self.u32)
- TypeAliasesAddI64(builder, self.i64)
- TypeAliasesAddU64(builder, self.u64)
- TypeAliasesAddF32(builder, self.f32)
- TypeAliasesAddF64(builder, self.f64)
+ Start(builder)
+ AddI8(builder, self.i8)
+ AddU8(builder, self.u8)
+ AddI16(builder, self.i16)
+ AddU16(builder, self.u16)
+ AddI32(builder, self.i32)
+ AddU32(builder, self.u32)
+ AddI64(builder, self.i64)
+ AddU64(builder, self.u64)
+ AddF32(builder, self.f32)
+ AddF64(builder, self.f64)
if self.v8 is not None:
- TypeAliasesAddV8(builder, v8)
+ AddV8(builder, v8)
if self.vf64 is not None:
- TypeAliasesAddVf64(builder, vf64)
- typeAliases = TypeAliasesEnd(builder)
+ AddVf64(builder, vf64)
+ typeAliases = End(builder)
return typeAliases
diff --git a/tests/MyGame/Example2/Monster.py b/tests/MyGame/Example2/Monster.py
index 718f1e4b..f1cafe6a 100644
--- a/tests/MyGame/Example2/Monster.py
+++ b/tests/MyGame/Example2/Monster.py
@@ -10,13 +10,17 @@ class Monster(object):
__slots__ = ['_tab']
@classmethod
- def GetRootAsMonster(cls, buf, offset=0):
+ def GetRootAs(cls, buf, offset=0):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x = Monster()
x.Init(buf, n + offset)
return x
@classmethod
+ def GetRootAsMonster(cls, buf, offset=0):
+ """This method is deprecated. Please switch to GetRootAs."""
+ return cls.GetRootAs(buf, offset)
+ @classmethod
def MonsterBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x4D\x4F\x4E\x53", size_prefixed=size_prefixed)
@@ -24,9 +28,14 @@ class Monster(object):
def Init(self, buf, pos):
self._tab = flatbuffers.table.Table(buf, pos)
-def MonsterStart(builder): builder.StartObject(0)
-def MonsterEnd(builder): return builder.EndObject()
-
+def Start(builder): builder.StartObject(0)
+def MonsterStart(builder):
+ """This method is deprecated. Please switch to Start."""
+ return Start(builder)
+def End(builder): return builder.EndObject()
+def MonsterEnd(builder):
+ """This method is deprecated. Please switch to End."""
+ return End(builder)
class MonsterT(object):
@@ -53,6 +62,6 @@ class MonsterT(object):
# MonsterT
def Pack(self, builder):
- MonsterStart(builder)
- monster = MonsterEnd(builder)
+ Start(builder)
+ monster = End(builder)
return monster
diff --git a/tests/MyGame/InParentNamespace.py b/tests/MyGame/InParentNamespace.py
index 117f651e..b76a37b4 100644
--- a/tests/MyGame/InParentNamespace.py
+++ b/tests/MyGame/InParentNamespace.py
@@ -10,13 +10,17 @@ class InParentNamespace(object):
__slots__ = ['_tab']
@classmethod
- def GetRootAsInParentNamespace(cls, buf, offset=0):
+ def GetRootAs(cls, buf, offset=0):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x = InParentNamespace()
x.Init(buf, n + offset)
return x
@classmethod
+ def GetRootAsInParentNamespace(cls, buf, offset=0):
+ """This method is deprecated. Please switch to GetRootAs."""
+ return cls.GetRootAs(buf, offset)
+ @classmethod
def InParentNamespaceBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x4D\x4F\x4E\x53", size_prefixed=size_prefixed)
@@ -24,9 +28,14 @@ class InParentNamespace(object):
def Init(self, buf, pos):
self._tab = flatbuffers.table.Table(buf, pos)
-def InParentNamespaceStart(builder): builder.StartObject(0)
-def InParentNamespaceEnd(builder): return builder.EndObject()
-
+def Start(builder): builder.StartObject(0)
+def InParentNamespaceStart(builder):
+ """This method is deprecated. Please switch to Start."""
+ return Start(builder)
+def End(builder): return builder.EndObject()
+def InParentNamespaceEnd(builder):
+ """This method is deprecated. Please switch to End."""
+ return End(builder)
class InParentNamespaceT(object):
@@ -53,6 +62,6 @@ class InParentNamespaceT(object):
# InParentNamespaceT
def Pack(self, builder):
- InParentNamespaceStart(builder)
- inParentNamespace = InParentNamespaceEnd(builder)
+ Start(builder)
+ inParentNamespace = End(builder)
return inParentNamespace
diff --git a/tests/MyGame/MonsterExtra.py b/tests/MyGame/MonsterExtra.py
index da7986a6..f3624401 100644
--- a/tests/MyGame/MonsterExtra.py
+++ b/tests/MyGame/MonsterExtra.py
@@ -10,13 +10,17 @@ class MonsterExtra(object):
__slots__ = ['_tab']
@classmethod
- def GetRootAsMonsterExtra(cls, buf, offset=0):
+ def GetRootAs(cls, buf, offset=0):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x = MonsterExtra()
x.Init(buf, n + offset)
return x
@classmethod
+ def GetRootAsMonsterExtra(cls, buf, offset=0):
+ """This method is deprecated. Please switch to GetRootAs."""
+ return cls.GetRootAs(buf, offset)
+ @classmethod
def MonsterExtraBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x4D\x4F\x4E\x45", size_prefixed=size_prefixed)
@@ -134,21 +138,62 @@ class MonsterExtra(object):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22))
return o == 0
-def MonsterExtraStart(builder): builder.StartObject(11)
-def MonsterExtraAddD0(builder, d0): builder.PrependFloat64Slot(0, d0, float('nan'))
-def MonsterExtraAddD1(builder, d1): builder.PrependFloat64Slot(1, d1, float('nan'))
-def MonsterExtraAddD2(builder, d2): builder.PrependFloat64Slot(2, d2, float('inf'))
-def MonsterExtraAddD3(builder, d3): builder.PrependFloat64Slot(3, d3, float('-inf'))
-def MonsterExtraAddF0(builder, f0): builder.PrependFloat32Slot(4, f0, float('nan'))
-def MonsterExtraAddF1(builder, f1): builder.PrependFloat32Slot(5, f1, float('nan'))
-def MonsterExtraAddF2(builder, f2): builder.PrependFloat32Slot(6, f2, float('inf'))
-def MonsterExtraAddF3(builder, f3): builder.PrependFloat32Slot(7, f3, float('-inf'))
-def MonsterExtraAddDvec(builder, dvec): builder.PrependUOffsetTRelativeSlot(8, flatbuffers.number_types.UOffsetTFlags.py_type(dvec), 0)
-def MonsterExtraStartDvecVector(builder, numElems): return builder.StartVector(8, numElems, 8)
-def MonsterExtraAddFvec(builder, fvec): builder.PrependUOffsetTRelativeSlot(9, flatbuffers.number_types.UOffsetTFlags.py_type(fvec), 0)
-def MonsterExtraStartFvecVector(builder, numElems): return builder.StartVector(4, numElems, 4)
-def MonsterExtraEnd(builder): return builder.EndObject()
-
+def Start(builder): builder.StartObject(11)
+def MonsterExtraStart(builder):
+ """This method is deprecated. Please switch to Start."""
+ return Start(builder)
+def AddD0(builder, d0): builder.PrependFloat64Slot(0, d0, float('nan'))
+def MonsterExtraAddD0(builder, d0):
+ """This method is deprecated. Please switch to AddD0."""
+ return AddD0(builder, d0)
+def AddD1(builder, d1): builder.PrependFloat64Slot(1, d1, float('nan'))
+def MonsterExtraAddD1(builder, d1):
+ """This method is deprecated. Please switch to AddD1."""
+ return AddD1(builder, d1)
+def AddD2(builder, d2): builder.PrependFloat64Slot(2, d2, float('inf'))
+def MonsterExtraAddD2(builder, d2):
+ """This method is deprecated. Please switch to AddD2."""
+ return AddD2(builder, d2)
+def AddD3(builder, d3): builder.PrependFloat64Slot(3, d3, float('-inf'))
+def MonsterExtraAddD3(builder, d3):
+ """This method is deprecated. Please switch to AddD3."""
+ return AddD3(builder, d3)
+def AddF0(builder, f0): builder.PrependFloat32Slot(4, f0, float('nan'))
+def MonsterExtraAddF0(builder, f0):
+ """This method is deprecated. Please switch to AddF0."""
+ return AddF0(builder, f0)
+def AddF1(builder, f1): builder.PrependFloat32Slot(5, f1, float('nan'))
+def MonsterExtraAddF1(builder, f1):
+ """This method is deprecated. Please switch to AddF1."""
+ return AddF1(builder, f1)
+def AddF2(builder, f2): builder.PrependFloat32Slot(6, f2, float('inf'))
+def MonsterExtraAddF2(builder, f2):
+ """This method is deprecated. Please switch to AddF2."""
+ return AddF2(builder, f2)
+def AddF3(builder, f3): builder.PrependFloat32Slot(7, f3, float('-inf'))
+def MonsterExtraAddF3(builder, f3):
+ """This method is deprecated. Please switch to AddF3."""
+ return AddF3(builder, f3)
+def AddDvec(builder, dvec): builder.PrependUOffsetTRelativeSlot(8, flatbuffers.number_types.UOffsetTFlags.py_type(dvec), 0)
+def MonsterExtraAddDvec(builder, dvec):
+ """This method is deprecated. Please switch to AddDvec."""
+ return AddDvec(builder, dvec)
+def StartDvecVector(builder, numElems): return builder.StartVector(8, numElems, 8)
+def MonsterExtraStartDvecVector(builder, numElems):
+ """This method is deprecated. Please switch to Start."""
+ return StartDvecVector(builder, numElems)
+def AddFvec(builder, fvec): builder.PrependUOffsetTRelativeSlot(9, flatbuffers.number_types.UOffsetTFlags.py_type(fvec), 0)
+def MonsterExtraAddFvec(builder, fvec):
+ """This method is deprecated. Please switch to AddFvec."""
+ return AddFvec(builder, fvec)
+def StartFvecVector(builder, numElems): return builder.StartVector(4, numElems, 4)
+def MonsterExtraStartFvecVector(builder, numElems):
+ """This method is deprecated. Please switch to Start."""
+ return StartFvecVector(builder, numElems)
+def End(builder): return builder.EndObject()
+def MonsterExtraEnd(builder):
+ """This method is deprecated. Please switch to End."""
+ return End(builder)
try:
from typing import List
except:
@@ -214,7 +259,7 @@ class MonsterExtraT(object):
if np is not None and type(self.dvec) is np.ndarray:
dvec = builder.CreateNumpyVector(self.dvec)
else:
- MonsterExtraStartDvecVector(builder, len(self.dvec))
+ StartDvecVector(builder, len(self.dvec))
for i in reversed(range(len(self.dvec))):
builder.PrependFloat64(self.dvec[i])
dvec = builder.EndVector()
@@ -222,22 +267,22 @@ class MonsterExtraT(object):
if np is not None and type(self.fvec) is np.ndarray:
fvec = builder.CreateNumpyVector(self.fvec)
else:
- MonsterExtraStartFvecVector(builder, len(self.fvec))
+ StartFvecVector(builder, len(self.fvec))
for i in reversed(range(len(self.fvec))):
builder.PrependFloat32(self.fvec[i])
fvec = builder.EndVector()
- MonsterExtraStart(builder)
- MonsterExtraAddD0(builder, self.d0)
- MonsterExtraAddD1(builder, self.d1)
- MonsterExtraAddD2(builder, self.d2)
- MonsterExtraAddD3(builder, self.d3)
- MonsterExtraAddF0(builder, self.f0)
- MonsterExtraAddF1(builder, self.f1)
- MonsterExtraAddF2(builder, self.f2)
- MonsterExtraAddF3(builder, self.f3)
+ Start(builder)
+ AddD0(builder, self.d0)
+ AddD1(builder, self.d1)
+ AddD2(builder, self.d2)
+ AddD3(builder, self.d3)
+ AddF0(builder, self.f0)
+ AddF1(builder, self.f1)
+ AddF2(builder, self.f2)
+ AddF3(builder, self.f3)
if self.dvec is not None:
- MonsterExtraAddDvec(builder, dvec)
+ AddDvec(builder, dvec)
if self.fvec is not None:
- MonsterExtraAddFvec(builder, fvec)
- monsterExtra = MonsterExtraEnd(builder)
+ AddFvec(builder, fvec)
+ monsterExtra = End(builder)
return monsterExtra
diff --git a/tests/PythonTest.sh b/tests/PythonTest.sh
index ebe49bf3..b387ec1b 100755
--- a/tests/PythonTest.sh
+++ b/tests/PythonTest.sh
@@ -21,6 +21,7 @@ runtime_library_dir=${test_dir}/../python
# Emit Python code for the example schema in the test dir:
${test_dir}/../flatc -p -o ${gen_code_path} -I include_test monster_test.fbs --gen-object-api
+${test_dir}/../flatc -p -o ${gen_code_path} -I include_test monster_extra.fbs --gen-object-api
# Syntax: run_tests <interpreter> <benchmark vtable dedupes>
# <benchmark read count> <benchmark build count>
diff --git a/tests/namespace_test/NamespaceA/NamespaceB/TableInNestedNS.py b/tests/namespace_test/NamespaceA/NamespaceB/TableInNestedNS.py
index 19b87e1d..7a4ff9d7 100644
--- a/tests/namespace_test/NamespaceA/NamespaceB/TableInNestedNS.py
+++ b/tests/namespace_test/NamespaceA/NamespaceB/TableInNestedNS.py
@@ -10,12 +10,16 @@ class TableInNestedNS(object):
__slots__ = ['_tab']
@classmethod
- def GetRootAsTableInNestedNS(cls, buf, offset=0):
+ def GetRootAs(cls, buf, offset=0):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x = TableInNestedNS()
x.Init(buf, n + offset)
return x
+ @classmethod
+ def GetRootAsTableInNestedNS(cls, buf, offset=0):
+ """This method is deprecated. Please switch to GetRootAs."""
+ return cls.GetRootAs(buf, offset)
# TableInNestedNS
def Init(self, buf, pos):
self._tab = flatbuffers.table.Table(buf, pos)
@@ -27,10 +31,18 @@ class TableInNestedNS(object):
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
return 0
-def TableInNestedNSStart(builder): builder.StartObject(1)
-def TableInNestedNSAddFoo(builder, foo): builder.PrependInt32Slot(0, foo, 0)
-def TableInNestedNSEnd(builder): return builder.EndObject()
-
+def Start(builder): builder.StartObject(1)
+def TableInNestedNSStart(builder):
+ """This method is deprecated. Please switch to Start."""
+ return Start(builder)
+def AddFoo(builder, foo): builder.PrependInt32Slot(0, foo, 0)
+def TableInNestedNSAddFoo(builder, foo):
+ """This method is deprecated. Please switch to AddFoo."""
+ return AddFoo(builder, foo)
+def End(builder): return builder.EndObject()
+def TableInNestedNSEnd(builder):
+ """This method is deprecated. Please switch to End."""
+ return End(builder)
class TableInNestedNST(object):
@@ -58,7 +70,7 @@ class TableInNestedNST(object):
# TableInNestedNST
def Pack(self, builder):
- TableInNestedNSStart(builder)
- TableInNestedNSAddFoo(builder, self.foo)
- tableInNestedNS = TableInNestedNSEnd(builder)
+ Start(builder)
+ AddFoo(builder, self.foo)
+ tableInNestedNS = End(builder)
return tableInNestedNS
diff --git a/tests/namespace_test/NamespaceA/SecondTableInA.py b/tests/namespace_test/NamespaceA/SecondTableInA.py
index ade8fdbe..f97cf062 100644
--- a/tests/namespace_test/NamespaceA/SecondTableInA.py
+++ b/tests/namespace_test/NamespaceA/SecondTableInA.py
@@ -10,12 +10,16 @@ class SecondTableInA(object):
__slots__ = ['_tab']
@classmethod
- def GetRootAsSecondTableInA(cls, buf, offset=0):
+ def GetRootAs(cls, buf, offset=0):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x = SecondTableInA()
x.Init(buf, n + offset)
return x
+ @classmethod
+ def GetRootAsSecondTableInA(cls, buf, offset=0):
+ """This method is deprecated. Please switch to GetRootAs."""
+ return cls.GetRootAs(buf, offset)
# SecondTableInA
def Init(self, buf, pos):
self._tab = flatbuffers.table.Table(buf, pos)
@@ -30,10 +34,18 @@ class SecondTableInA(object):
return obj
return None
-def SecondTableInAStart(builder): builder.StartObject(1)
-def SecondTableInAAddReferToC(builder, referToC): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(referToC), 0)
-def SecondTableInAEnd(builder): return builder.EndObject()
-
+def Start(builder): builder.StartObject(1)
+def SecondTableInAStart(builder):
+ """This method is deprecated. Please switch to Start."""
+ return Start(builder)
+def AddReferToC(builder, referToC): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(referToC), 0)
+def SecondTableInAAddReferToC(builder, referToC):
+ """This method is deprecated. Please switch to AddReferToC."""
+ return AddReferToC(builder, referToC)
+def End(builder): return builder.EndObject()
+def SecondTableInAEnd(builder):
+ """This method is deprecated. Please switch to End."""
+ return End(builder)
try:
from typing import Optional
except:
@@ -68,8 +80,8 @@ class SecondTableInAT(object):
def Pack(self, builder):
if self.referToC is not None:
referToC = self.referToC.Pack(builder)
- SecondTableInAStart(builder)
+ Start(builder)
if self.referToC is not None:
- SecondTableInAAddReferToC(builder, referToC)
- secondTableInA = SecondTableInAEnd(builder)
+ AddReferToC(builder, referToC)
+ secondTableInA = End(builder)
return secondTableInA
diff --git a/tests/namespace_test/NamespaceA/TableInFirstNS.py b/tests/namespace_test/NamespaceA/TableInFirstNS.py
index abaac47c..d2c7e4aa 100644
--- a/tests/namespace_test/NamespaceA/TableInFirstNS.py
+++ b/tests/namespace_test/NamespaceA/TableInFirstNS.py
@@ -10,12 +10,16 @@ class TableInFirstNS(object):
__slots__ = ['_tab']
@classmethod
- def GetRootAsTableInFirstNS(cls, buf, offset=0):
+ def GetRootAs(cls, buf, offset=0):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x = TableInFirstNS()
x.Init(buf, n + offset)
return x
+ @classmethod
+ def GetRootAsTableInFirstNS(cls, buf, offset=0):
+ """This method is deprecated. Please switch to GetRootAs."""
+ return cls.GetRootAs(buf, offset)
# TableInFirstNS
def Init(self, buf, pos):
self._tab = flatbuffers.table.Table(buf, pos)
@@ -64,14 +68,34 @@ class TableInFirstNS(object):
return obj
return None
-def TableInFirstNSStart(builder): builder.StartObject(5)
-def TableInFirstNSAddFooTable(builder, fooTable): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(fooTable), 0)
-def TableInFirstNSAddFooEnum(builder, fooEnum): builder.PrependInt8Slot(1, fooEnum, 0)
-def TableInFirstNSAddFooUnionType(builder, fooUnionType): builder.PrependUint8Slot(2, fooUnionType, 0)
-def TableInFirstNSAddFooUnion(builder, fooUnion): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(fooUnion), 0)
-def TableInFirstNSAddFooStruct(builder, fooStruct): builder.PrependStructSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(fooStruct), 0)
-def TableInFirstNSEnd(builder): return builder.EndObject()
-
+def Start(builder): builder.StartObject(5)
+def TableInFirstNSStart(builder):
+ """This method is deprecated. Please switch to Start."""
+ return Start(builder)
+def AddFooTable(builder, fooTable): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(fooTable), 0)
+def TableInFirstNSAddFooTable(builder, fooTable):
+ """This method is deprecated. Please switch to AddFooTable."""
+ return AddFooTable(builder, fooTable)
+def AddFooEnum(builder, fooEnum): builder.PrependInt8Slot(1, fooEnum, 0)
+def TableInFirstNSAddFooEnum(builder, fooEnum):
+ """This method is deprecated. Please switch to AddFooEnum."""
+ return AddFooEnum(builder, fooEnum)
+def AddFooUnionType(builder, fooUnionType): builder.PrependUint8Slot(2, fooUnionType, 0)
+def TableInFirstNSAddFooUnionType(builder, fooUnionType):
+ """This method is deprecated. Please switch to AddFooUnionType."""
+ return AddFooUnionType(builder, fooUnionType)
+def AddFooUnion(builder, fooUnion): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(fooUnion), 0)
+def TableInFirstNSAddFooUnion(builder, fooUnion):
+ """This method is deprecated. Please switch to AddFooUnion."""
+ return AddFooUnion(builder, fooUnion)
+def AddFooStruct(builder, fooStruct): builder.PrependStructSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(fooStruct), 0)
+def TableInFirstNSAddFooStruct(builder, fooStruct):
+ """This method is deprecated. Please switch to AddFooStruct."""
+ return AddFooStruct(builder, fooStruct)
+def End(builder): return builder.EndObject()
+def TableInFirstNSEnd(builder):
+ """This method is deprecated. Please switch to End."""
+ return End(builder)
try:
from typing import Optional, Union
except:
@@ -117,15 +141,15 @@ class TableInFirstNST(object):
fooTable = self.fooTable.Pack(builder)
if self.fooUnion is not None:
fooUnion = self.fooUnion.Pack(builder)
- TableInFirstNSStart(builder)
+ Start(builder)
if self.fooTable is not None:
- TableInFirstNSAddFooTable(builder, fooTable)
- TableInFirstNSAddFooEnum(builder, self.fooEnum)
- TableInFirstNSAddFooUnionType(builder, self.fooUnionType)
+ AddFooTable(builder, fooTable)
+ AddFooEnum(builder, self.fooEnum)
+ AddFooUnionType(builder, self.fooUnionType)
if self.fooUnion is not None:
- TableInFirstNSAddFooUnion(builder, fooUnion)
+ AddFooUnion(builder, fooUnion)
if self.fooStruct is not None:
fooStruct = self.fooStruct.Pack(builder)
- TableInFirstNSAddFooStruct(builder, fooStruct)
- tableInFirstNS = TableInFirstNSEnd(builder)
+ AddFooStruct(builder, fooStruct)
+ tableInFirstNS = End(builder)
return tableInFirstNS
diff --git a/tests/namespace_test/NamespaceC/TableInC.py b/tests/namespace_test/NamespaceC/TableInC.py
index 1abb5e36..b8d3b94f 100644
--- a/tests/namespace_test/NamespaceC/TableInC.py
+++ b/tests/namespace_test/NamespaceC/TableInC.py
@@ -10,12 +10,16 @@ class TableInC(object):
__slots__ = ['_tab']
@classmethod
- def GetRootAsTableInC(cls, buf, offset=0):
+ def GetRootAs(cls, buf, offset=0):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x = TableInC()
x.Init(buf, n + offset)
return x
+ @classmethod
+ def GetRootAsTableInC(cls, buf, offset=0):
+ """This method is deprecated. Please switch to GetRootAs."""
+ return cls.GetRootAs(buf, offset)
# TableInC
def Init(self, buf, pos):
self._tab = flatbuffers.table.Table(buf, pos)
@@ -40,11 +44,22 @@ class TableInC(object):
return obj
return None
-def TableInCStart(builder): builder.StartObject(2)
-def TableInCAddReferToA1(builder, referToA1): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(referToA1), 0)
-def TableInCAddReferToA2(builder, referToA2): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(referToA2), 0)
-def TableInCEnd(builder): return builder.EndObject()
-
+def Start(builder): builder.StartObject(2)
+def TableInCStart(builder):
+ """This method is deprecated. Please switch to Start."""
+ return Start(builder)
+def AddReferToA1(builder, referToA1): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(referToA1), 0)
+def TableInCAddReferToA1(builder, referToA1):
+ """This method is deprecated. Please switch to AddReferToA1."""
+ return AddReferToA1(builder, referToA1)
+def AddReferToA2(builder, referToA2): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(referToA2), 0)
+def TableInCAddReferToA2(builder, referToA2):
+ """This method is deprecated. Please switch to AddReferToA2."""
+ return AddReferToA2(builder, referToA2)
+def End(builder): return builder.EndObject()
+def TableInCEnd(builder):
+ """This method is deprecated. Please switch to End."""
+ return End(builder)
try:
from typing import Optional
except:
@@ -84,10 +99,10 @@ class TableInCT(object):
referToA1 = self.referToA1.Pack(builder)
if self.referToA2 is not None:
referToA2 = self.referToA2.Pack(builder)
- TableInCStart(builder)
+ Start(builder)
if self.referToA1 is not None:
- TableInCAddReferToA1(builder, referToA1)
+ AddReferToA1(builder, referToA1)
if self.referToA2 is not None:
- TableInCAddReferToA2(builder, referToA2)
- tableInC = TableInCEnd(builder)
+ AddReferToA2(builder, referToA2)
+ tableInC = End(builder)
return tableInC
diff --git a/tests/py_test.py b/tests/py_test.py
index 4ea8fe51..a5d40fa5 100644
--- a/tests/py_test.py
+++ b/tests/py_test.py
@@ -95,7 +95,7 @@ class TestObjectBasedAPI(unittest.TestCase):
buf, off = make_monster_from_generated_code()
# Turns a buffer into Python object (T class).
- monster1 = MyGame.Example.Monster.Monster.GetRootAsMonster(buf, off)
+ monster1 = MyGame.Example.Monster.Monster.GetRootAs(buf, off)
monsterT1 = MyGame.Example.Monster.MonsterT.InitFromObj(monster1)
for sizePrefix in [True, False]:
@@ -108,7 +108,7 @@ class TestObjectBasedAPI(unittest.TestCase):
CheckReadBuffer(b1.Bytes, b1.Head(), sizePrefix)
# Deserializes the buffer into Python object again.
- monster2 = MyGame.Example.Monster.Monster.GetRootAsMonster(b1.Bytes,
+ monster2 = MyGame.Example.Monster.Monster.GetRootAs(b1.Bytes,
b1.Head())
# Re-serializes the data into a buffer for one more time.
monsterT2 = MyGame.Example.Monster.MonsterT.InitFromObj(monster2)
@@ -127,19 +127,19 @@ class TestObjectBasedAPI(unittest.TestCase):
object. '''
# Creates a flatbuffer with default values.
b1 = flatbuffers.Builder(0)
- MyGame.Example.Monster.MonsterStart(b1)
- gen_mon = MyGame.Example.Monster.MonsterEnd(b1)
+ MyGame.Example.Monster.Start(b1)
+ gen_mon = MyGame.Example.Monster.End(b1)
b1.Finish(gen_mon)
# Converts the flatbuffer into the object class.
- monster1 = MyGame.Example.Monster.Monster.GetRootAsMonster(b1.Bytes,
+ monster1 = MyGame.Example.Monster.Monster.GetRootAs(b1.Bytes,
b1.Head())
monsterT1 = MyGame.Example.Monster.MonsterT.InitFromObj(monster1)
# Packs the object class into another flatbuffer.
b2 = flatbuffers.Builder(0)
b2.Finish(monsterT1.Pack(b2))
- monster2 = MyGame.Example.Monster.Monster.GetRootAsMonster(b2.Bytes,
+ monster2 = MyGame.Example.Monster.Monster.GetRootAs(b2.Bytes,
b2.Head())
# Checks the default values.
self.assertTrue(monster2.Pos() is None)
@@ -250,7 +250,7 @@ class TestAllMutableCodePathsOfExampleSchema(unittest.TestCase):
# Creates an empty monster flatbuffer, and loads it into the object
# class for future tests.
b = flatbuffers.Builder(0)
- MyGame.Example.Monster.MonsterStart(b)
+ MyGame.Example.Monster.Start(b)
self.monsterT = self._create_and_load_object_class(b)
def _pack_and_load_buf_class(self, monsterT):
@@ -258,16 +258,16 @@ class TestAllMutableCodePathsOfExampleSchema(unittest.TestCase):
class.'''
b = flatbuffers.Builder(0)
b.Finish(monsterT.Pack(b))
- monster = MyGame.Example.Monster.Monster.GetRootAsMonster(b.Bytes,
+ monster = MyGame.Example.Monster.Monster.GetRootAs(b.Bytes,
b.Head())
return monster
def _create_and_load_object_class(self, b):
''' Finishs the creation of a monster flatbuffer and loads it into an
object class.'''
- gen_mon = MyGame.Example.Monster.MonsterEnd(b)
+ gen_mon = MyGame.Example.Monster.End(b)
b.Finish(gen_mon)
- monster = MyGame.Example.Monster.Monster.GetRootAsMonster(b.Bytes,
+ monster = MyGame.Example.Monster.Monster.GetRootAs(b.Bytes,
b.Head())
monsterT = MyGame.Example.Monster.MonsterT()
monsterT.InitFromObj(monster)
@@ -548,7 +548,7 @@ def CheckReadBuffer(buf, offset, sizePrefix=False, file_identifier=None):
asserter(MyGame.Example.Monster.Monster.MonsterBufferHasIdentifier(buf, offset))
else:
asserter(not MyGame.Example.Monster.Monster.MonsterBufferHasIdentifier(buf, offset))
- monster = MyGame.Example.Monster.Monster.GetRootAsMonster(buf, offset)
+ monster = MyGame.Example.Monster.Monster.GetRootAs(buf, offset)
asserter(monster.Hp() == 80)
asserter(monster.Mana() == 150)
@@ -1550,7 +1550,7 @@ def make_monster_from_generated_code(sizePrefix = False, file_identifier=None):
test2 = b.CreateString("test2")
fred = b.CreateString("Fred")
- MyGame.Example.Monster.MonsterStartInventoryVector(b, 5)
+ MyGame.Example.Monster.StartInventoryVector(b, 5)
b.PrependByte(4)
b.PrependByte(3)
b.PrependByte(2)
@@ -1558,21 +1558,21 @@ def make_monster_from_generated_code(sizePrefix = False, file_identifier=None):
b.PrependByte(0)
inv = b.EndVector()
- MyGame.Example.Monster.MonsterStart(b)
- MyGame.Example.Monster.MonsterAddName(b, fred)
- mon2 = MyGame.Example.Monster.MonsterEnd(b)
+ MyGame.Example.Monster.Start(b)
+ MyGame.Example.Monster.AddName(b, fred)
+ mon2 = MyGame.Example.Monster.End(b)
- MyGame.Example.Monster.MonsterStartTest4Vector(b, 2)
+ MyGame.Example.Monster.StartTest4Vector(b, 2)
MyGame.Example.Test.CreateTest(b, 10, 20)
MyGame.Example.Test.CreateTest(b, 30, 40)
test4 = b.EndVector()
- MyGame.Example.Monster.MonsterStartTestarrayofstringVector(b, 2)
+ MyGame.Example.Monster.StartTestarrayofstringVector(b, 2)
b.PrependUOffsetTRelative(test2)
b.PrependUOffsetTRelative(test1)
testArrayOfString = b.EndVector()
- MyGame.Example.Monster.MonsterStartVectorOfLongsVector(b, 5)
+ MyGame.Example.Monster.StartVectorOfLongsVector(b, 5)
b.PrependInt64(100000000)
b.PrependInt64(1000000)
b.PrependInt64(10000)
@@ -1580,27 +1580,27 @@ def make_monster_from_generated_code(sizePrefix = False, file_identifier=None):
b.PrependInt64(1)
VectorOfLongs = b.EndVector()
- MyGame.Example.Monster.MonsterStartVectorOfDoublesVector(b, 3)
+ MyGame.Example.Monster.StartVectorOfDoublesVector(b, 3)
b.PrependFloat64(1.7976931348623157e+308)
b.PrependFloat64(0)
b.PrependFloat64(-1.7976931348623157e+308)
VectorOfDoubles = b.EndVector()
- MyGame.Example.Monster.MonsterStart(b)
+ MyGame.Example.Monster.Start(b)
pos = MyGame.Example.Vec3.CreateVec3(b, 1.0, 2.0, 3.0, 3.0, 2, 5, 6)
- MyGame.Example.Monster.MonsterAddPos(b, pos)
-
- MyGame.Example.Monster.MonsterAddHp(b, 80)
- MyGame.Example.Monster.MonsterAddName(b, string)
- MyGame.Example.Monster.MonsterAddInventory(b, inv)
- MyGame.Example.Monster.MonsterAddTestType(b, 1)
- MyGame.Example.Monster.MonsterAddTest(b, mon2)
- MyGame.Example.Monster.MonsterAddTest4(b, test4)
- MyGame.Example.Monster.MonsterAddTestarrayofstring(b, testArrayOfString)
- MyGame.Example.Monster.MonsterAddVectorOfLongs(b, VectorOfLongs)
- MyGame.Example.Monster.MonsterAddVectorOfDoubles(b, VectorOfDoubles)
- mon = MyGame.Example.Monster.MonsterEnd(b)
+ MyGame.Example.Monster.AddPos(b, pos)
+
+ MyGame.Example.Monster.AddHp(b, 80)
+ MyGame.Example.Monster.AddName(b, string)
+ MyGame.Example.Monster.AddInventory(b, inv)
+ MyGame.Example.Monster.AddTestType(b, 1)
+ MyGame.Example.Monster.AddTest(b, mon2)
+ MyGame.Example.Monster.AddTest4(b, test4)
+ MyGame.Example.Monster.AddTestarrayofstring(b, testArrayOfString)
+ MyGame.Example.Monster.AddVectorOfLongs(b, VectorOfLongs)
+ MyGame.Example.Monster.AddVectorOfDoubles(b, VectorOfDoubles)
+ mon = MyGame.Example.Monster.End(b)
if sizePrefix:
b.FinishSizePrefixed(mon, file_identifier)
@@ -1650,11 +1650,11 @@ class TestAllCodePathsOfExampleSchema(unittest.TestCase):
super(TestAllCodePathsOfExampleSchema, self).setUp(*args, **kwargs)
b = flatbuffers.Builder(0)
- MyGame.Example.Monster.MonsterStart(b)
- gen_mon = MyGame.Example.Monster.MonsterEnd(b)
+ MyGame.Example.Monster.Start(b)
+ gen_mon = MyGame.Example.Monster.End(b)
b.Finish(gen_mon)
- self.mon = MyGame.Example.Monster.Monster.GetRootAsMonster(b.Bytes,
+ self.mon = MyGame.Example.Monster.Monster.GetRootAs(b.Bytes,
b.Head())
def test_default_monster_pos(self):
@@ -1662,12 +1662,12 @@ class TestAllCodePathsOfExampleSchema(unittest.TestCase):
def test_nondefault_monster_mana(self):
b = flatbuffers.Builder(0)
- MyGame.Example.Monster.MonsterStart(b)
- MyGame.Example.Monster.MonsterAddMana(b, 50)
- mon = MyGame.Example.Monster.MonsterEnd(b)
+ MyGame.Example.Monster.Start(b)
+ MyGame.Example.Monster.AddMana(b, 50)
+ mon = MyGame.Example.Monster.End(b)
b.Finish(mon)
- got_mon = MyGame.Example.Monster.Monster.GetRootAsMonster(b.Bytes,
+ got_mon = MyGame.Example.Monster.Monster.GetRootAs(b.Bytes,
b.Head())
self.assertEqual(50, got_mon.Mana())
@@ -1686,13 +1686,13 @@ class TestAllCodePathsOfExampleSchema(unittest.TestCase):
def test_empty_monster_inventory_vector(self):
b = flatbuffers.Builder(0)
- MyGame.Example.Monster.MonsterStartInventoryVector(b, 0)
+ MyGame.Example.Monster.StartInventoryVector(b, 0)
inv = b.EndVector()
- MyGame.Example.Monster.MonsterStart(b)
- MyGame.Example.Monster.MonsterAddInventory(b, inv)
- mon = MyGame.Example.Monster.MonsterEnd(b)
+ MyGame.Example.Monster.Start(b)
+ MyGame.Example.Monster.AddInventory(b, inv)
+ mon = MyGame.Example.Monster.End(b)
b.Finish(mon)
- mon2 = MyGame.Example.Monster.Monster.GetRootAsMonster(b.Bytes,
+ mon2 = MyGame.Example.Monster.Monster.GetRootAs(b.Bytes,
b.Head())
self.assertFalse(mon2.InventoryIsNone())
@@ -1702,12 +1702,12 @@ class TestAllCodePathsOfExampleSchema(unittest.TestCase):
def test_nondefault_monster_color(self):
b = flatbuffers.Builder(0)
color = MyGame.Example.Color.Color.Red
- MyGame.Example.Monster.MonsterStart(b)
- MyGame.Example.Monster.MonsterAddColor(b, color)
- mon = MyGame.Example.Monster.MonsterEnd(b)
+ MyGame.Example.Monster.Start(b)
+ MyGame.Example.Monster.AddColor(b, color)
+ mon = MyGame.Example.Monster.End(b)
b.Finish(mon)
- mon2 = MyGame.Example.Monster.Monster.GetRootAsMonster(b.Bytes,
+ mon2 = MyGame.Example.Monster.Monster.GetRootAs(b.Bytes,
b.Head())
self.assertEqual(MyGame.Example.Color.Color.Red, mon2.Color())
@@ -1726,13 +1726,13 @@ class TestAllCodePathsOfExampleSchema(unittest.TestCase):
def test_empty_monster_test4_vector(self):
b = flatbuffers.Builder(0)
- MyGame.Example.Monster.MonsterStartTest4Vector(b, 0)
+ MyGame.Example.Monster.StartTest4Vector(b, 0)
test4 = b.EndVector()
- MyGame.Example.Monster.MonsterStart(b)
- MyGame.Example.Monster.MonsterAddTest4(b, test4)
- mon = MyGame.Example.Monster.MonsterEnd(b)
+ MyGame.Example.Monster.Start(b)
+ MyGame.Example.Monster.AddTest4(b, test4)
+ mon = MyGame.Example.Monster.End(b)
b.Finish(mon)
- mon2 = MyGame.Example.Monster.Monster.GetRootAsMonster(b.Bytes,
+ mon2 = MyGame.Example.Monster.Monster.GetRootAs(b.Bytes,
b.Head())
self.assertFalse(mon2.Test4IsNone())
@@ -1745,13 +1745,13 @@ class TestAllCodePathsOfExampleSchema(unittest.TestCase):
def test_empty_monster_testarrayofstring_vector(self):
b = flatbuffers.Builder(0)
- MyGame.Example.Monster.MonsterStartTestarrayofstringVector(b, 0)
+ MyGame.Example.Monster.StartTestarrayofstringVector(b, 0)
testarrayofstring = b.EndVector()
- MyGame.Example.Monster.MonsterStart(b)
- MyGame.Example.Monster.MonsterAddTestarrayofstring(b, testarrayofstring)
- mon = MyGame.Example.Monster.MonsterEnd(b)
+ MyGame.Example.Monster.Start(b)
+ MyGame.Example.Monster.AddTestarrayofstring(b, testarrayofstring)
+ mon = MyGame.Example.Monster.End(b)
b.Finish(mon)
- mon2 = MyGame.Example.Monster.Monster.GetRootAsMonster(b.Bytes,
+ mon2 = MyGame.Example.Monster.Monster.GetRootAs(b.Bytes,
b.Head())
self.assertFalse(mon2.TestarrayofstringIsNone())
@@ -1762,23 +1762,23 @@ class TestAllCodePathsOfExampleSchema(unittest.TestCase):
b = flatbuffers.Builder(0)
# make a child Monster within a vector of Monsters:
- MyGame.Example.Monster.MonsterStart(b)
- MyGame.Example.Monster.MonsterAddHp(b, 99)
- sub_monster = MyGame.Example.Monster.MonsterEnd(b)
+ MyGame.Example.Monster.Start(b)
+ MyGame.Example.Monster.AddHp(b, 99)
+ sub_monster = MyGame.Example.Monster.End(b)
# build the vector:
- MyGame.Example.Monster.MonsterStartTestarrayoftablesVector(b, 1)
+ MyGame.Example.Monster.StartTestarrayoftablesVector(b, 1)
b.PrependUOffsetTRelative(sub_monster)
vec = b.EndVector()
# make the parent monster and include the vector of Monster:
- MyGame.Example.Monster.MonsterStart(b)
- MyGame.Example.Monster.MonsterAddTestarrayoftables(b, vec)
- mon = MyGame.Example.Monster.MonsterEnd(b)
+ MyGame.Example.Monster.Start(b)
+ MyGame.Example.Monster.AddTestarrayoftables(b, vec)
+ mon = MyGame.Example.Monster.End(b)
b.Finish(mon)
# inspect the resulting data:
- mon2 = MyGame.Example.Monster.Monster.GetRootAsMonster(b.Output(), 0)
+ mon2 = MyGame.Example.Monster.Monster.GetRootAs(b.Output(), 0)
self.assertEqual(99, mon2.Testarrayoftables(0).Hp())
self.assertEqual(1, mon2.TestarrayoftablesLength())
self.assertFalse(mon2.TestarrayoftablesIsNone())
@@ -1789,13 +1789,13 @@ class TestAllCodePathsOfExampleSchema(unittest.TestCase):
def test_empty_monster_testarrayoftables_vector(self):
b = flatbuffers.Builder(0)
- MyGame.Example.Monster.MonsterStartTestarrayoftablesVector(b, 0)
+ MyGame.Example.Monster.StartTestarrayoftablesVector(b, 0)
testarrayoftables = b.EndVector()
- MyGame.Example.Monster.MonsterStart(b)
- MyGame.Example.Monster.MonsterAddTestarrayoftables(b, testarrayoftables)
- mon = MyGame.Example.Monster.MonsterEnd(b)
+ MyGame.Example.Monster.Start(b)
+ MyGame.Example.Monster.AddTestarrayoftables(b, testarrayoftables)
+ mon = MyGame.Example.Monster.End(b)
b.Finish(mon)
- mon2 = MyGame.Example.Monster.Monster.GetRootAsMonster(b.Bytes,
+ mon2 = MyGame.Example.Monster.Monster.GetRootAs(b.Bytes,
b.Head())
self.assertFalse(mon2.TestarrayoftablesIsNone())
@@ -1806,19 +1806,19 @@ class TestAllCodePathsOfExampleSchema(unittest.TestCase):
b = flatbuffers.Builder(0)
# make an Enemy object:
- MyGame.Example.Monster.MonsterStart(b)
- MyGame.Example.Monster.MonsterAddHp(b, 88)
- enemy = MyGame.Example.Monster.MonsterEnd(b)
+ MyGame.Example.Monster.Start(b)
+ MyGame.Example.Monster.AddHp(b, 88)
+ enemy = MyGame.Example.Monster.End(b)
b.Finish(enemy)
# make the parent monster and include the vector of Monster:
- MyGame.Example.Monster.MonsterStart(b)
- MyGame.Example.Monster.MonsterAddEnemy(b, enemy)
- mon = MyGame.Example.Monster.MonsterEnd(b)
+ MyGame.Example.Monster.Start(b)
+ MyGame.Example.Monster.AddEnemy(b, enemy)
+ mon = MyGame.Example.Monster.End(b)
b.Finish(mon)
# inspect the resulting data:
- mon2 = MyGame.Example.Monster.Monster.GetRootAsMonster(b.Bytes,
+ mon2 = MyGame.Example.Monster.Monster.GetRootAs(b.Bytes,
b.Head())
self.assertEqual(88, mon2.Enemy().Hp())
@@ -1831,33 +1831,33 @@ class TestAllCodePathsOfExampleSchema(unittest.TestCase):
def test_empty_monster_testnestedflatbuffer_vector(self):
b = flatbuffers.Builder(0)
- MyGame.Example.Monster.MonsterStartTestnestedflatbufferVector(b, 0)
+ MyGame.Example.Monster.StartTestnestedflatbufferVector(b, 0)
testnestedflatbuffer = b.EndVector()
- MyGame.Example.Monster.MonsterStart(b)
- MyGame.Example.Monster.MonsterAddTestnestedflatbuffer(b, testnestedflatbuffer)
- mon = MyGame.Example.Monster.MonsterEnd(b)
+ MyGame.Example.Monster.Start(b)
+ MyGame.Example.Monster.AddTestnestedflatbuffer(b, testnestedflatbuffer)
+ mon = MyGame.Example.Monster.End(b)
b.Finish(mon)
- mon2 = MyGame.Example.Monster.Monster.GetRootAsMonster(b.Bytes,
+ mon2 = MyGame.Example.Monster.Monster.GetRootAs(b.Bytes,
b.Head())
self.assertFalse(mon2.TestnestedflatbufferIsNone())
def test_nondefault_monster_testnestedflatbuffer(self):
b = flatbuffers.Builder(0)
- MyGame.Example.Monster.MonsterStartTestnestedflatbufferVector(b, 3)
+ MyGame.Example.Monster.StartTestnestedflatbufferVector(b, 3)
b.PrependByte(4)
b.PrependByte(2)
b.PrependByte(0)
sub_buf = b.EndVector()
# make the parent monster and include the vector of Monster:
- MyGame.Example.Monster.MonsterStart(b)
- MyGame.Example.Monster.MonsterAddTestnestedflatbuffer(b, sub_buf)
- mon = MyGame.Example.Monster.MonsterEnd(b)
+ MyGame.Example.Monster.Start(b)
+ MyGame.Example.Monster.AddTestnestedflatbuffer(b, sub_buf)
+ mon = MyGame.Example.Monster.End(b)
b.Finish(mon)
# inspect the resulting data:
- mon2 = MyGame.Example.Monster.Monster.GetRootAsMonster(b.Bytes,
+ mon2 = MyGame.Example.Monster.Monster.GetRootAs(b.Bytes,
b.Head())
self.assertEqual(3, mon2.TestnestedflatbufferLength())
self.assertFalse(mon2.TestnestedflatbufferIsNone())
@@ -1880,24 +1880,24 @@ class TestAllCodePathsOfExampleSchema(unittest.TestCase):
# build another monster to nest inside testnestedflatbuffer
nestedB = flatbuffers.Builder(0)
nameStr = nestedB.CreateString("Nested Monster")
- MyGame.Example.Monster.MonsterStart(nestedB)
- MyGame.Example.Monster.MonsterAddHp(nestedB, 30)
- MyGame.Example.Monster.MonsterAddName(nestedB, nameStr)
- nestedMon = MyGame.Example.Monster.MonsterEnd(nestedB)
+ MyGame.Example.Monster.Start(nestedB)
+ MyGame.Example.Monster.AddHp(nestedB, 30)
+ MyGame.Example.Monster.AddName(nestedB, nameStr)
+ nestedMon = MyGame.Example.Monster.End(nestedB)
nestedB.Finish(nestedMon)
# write the nested FB bytes
- sub_buf = MyGame.Example.Monster.MonsterMakeTestnestedflatbufferVectorFromBytes(
+ sub_buf = MyGame.Example.Monster.MakeTestnestedflatbufferVectorFromBytes(
b, nestedB.Output())
# make the parent monster and include the bytes of the nested monster
- MyGame.Example.Monster.MonsterStart(b)
- MyGame.Example.Monster.MonsterAddTestnestedflatbuffer(b, sub_buf)
- mon = MyGame.Example.Monster.MonsterEnd(b)
+ MyGame.Example.Monster.Start(b)
+ MyGame.Example.Monster.AddTestnestedflatbuffer(b, sub_buf)
+ mon = MyGame.Example.Monster.End(b)
b.Finish(mon)
# inspect the resulting data:
- mon2 = MyGame.Example.Monster.Monster.GetRootAsMonster(b.Bytes,
+ mon2 = MyGame.Example.Monster.Monster.GetRootAs(b.Bytes,
b.Head())
nestedMon2 = mon2.TestnestedflatbufferNestedRoot()
self.assertEqual(b"Nested Monster", nestedMon2.Name())
@@ -1907,19 +1907,19 @@ class TestAllCodePathsOfExampleSchema(unittest.TestCase):
b = flatbuffers.Builder(0)
# make a Stat object:
- MyGame.Example.Stat.StatStart(b)
- MyGame.Example.Stat.StatAddVal(b, 123)
- my_stat = MyGame.Example.Stat.StatEnd(b)
+ MyGame.Example.Stat.Start(b)
+ MyGame.Example.Stat.AddVal(b, 123)
+ my_stat = MyGame.Example.Stat.End(b)
b.Finish(my_stat)
# include the stat object in a monster:
- MyGame.Example.Monster.MonsterStart(b)
- MyGame.Example.Monster.MonsterAddTestempty(b, my_stat)
- mon = MyGame.Example.Monster.MonsterEnd(b)
+ MyGame.Example.Monster.Start(b)
+ MyGame.Example.Monster.AddTestempty(b, my_stat)
+ mon = MyGame.Example.Monster.End(b)
b.Finish(mon)
# inspect the resulting data:
- mon2 = MyGame.Example.Monster.Monster.GetRootAsMonster(b.Bytes,
+ mon2 = MyGame.Example.Monster.Monster.GetRootAs(b.Bytes,
b.Head())
self.assertEqual(123, mon2.Testempty().Val())
@@ -1928,13 +1928,13 @@ class TestAllCodePathsOfExampleSchema(unittest.TestCase):
def test_nondefault_monster_testbool(self):
b = flatbuffers.Builder(0)
- MyGame.Example.Monster.MonsterStart(b)
- MyGame.Example.Monster.MonsterAddTestbool(b, True)
- mon = MyGame.Example.Monster.MonsterEnd(b)
+ MyGame.Example.Monster.Start(b)
+ MyGame.Example.Monster.AddTestbool(b, True)
+ mon = MyGame.Example.Monster.End(b)
b.Finish(mon)
# inspect the resulting data:
- mon2 = MyGame.Example.Monster.Monster.GetRootAsMonster(b.Bytes,
+ mon2 = MyGame.Example.Monster.Monster.GetRootAs(b.Bytes,
b.Head())
self.assertTrue(mon2.Testbool())
@@ -1950,20 +1950,20 @@ class TestAllCodePathsOfExampleSchema(unittest.TestCase):
def test_nondefault_monster_testhashes(self):
b = flatbuffers.Builder(0)
- MyGame.Example.Monster.MonsterStart(b)
- MyGame.Example.Monster.MonsterAddTesthashs32Fnv1(b, 1)
- MyGame.Example.Monster.MonsterAddTesthashu32Fnv1(b, 2)
- MyGame.Example.Monster.MonsterAddTesthashs64Fnv1(b, 3)
- MyGame.Example.Monster.MonsterAddTesthashu64Fnv1(b, 4)
- MyGame.Example.Monster.MonsterAddTesthashs32Fnv1a(b, 5)
- MyGame.Example.Monster.MonsterAddTesthashu32Fnv1a(b, 6)
- MyGame.Example.Monster.MonsterAddTesthashs64Fnv1a(b, 7)
- MyGame.Example.Monster.MonsterAddTesthashu64Fnv1a(b, 8)
- mon = MyGame.Example.Monster.MonsterEnd(b)
+ MyGame.Example.Monster.Start(b)
+ MyGame.Example.Monster.AddTesthashs32Fnv1(b, 1)
+ MyGame.Example.Monster.AddTesthashu32Fnv1(b, 2)
+ MyGame.Example.Monster.AddTesthashs64Fnv1(b, 3)
+ MyGame.Example.Monster.AddTesthashu64Fnv1(b, 4)
+ MyGame.Example.Monster.AddTesthashs32Fnv1a(b, 5)
+ MyGame.Example.Monster.AddTesthashu32Fnv1a(b, 6)
+ MyGame.Example.Monster.AddTesthashs64Fnv1a(b, 7)
+ MyGame.Example.Monster.AddTesthashu64Fnv1a(b, 8)
+ mon = MyGame.Example.Monster.End(b)
b.Finish(mon)
# inspect the resulting data:
- mon2 = MyGame.Example.Monster.Monster.GetRootAsMonster(b.Bytes,
+ mon2 = MyGame.Example.Monster.Monster.GetRootAs(b.Bytes,
b.Head())
self.assertEqual(1, mon2.Testhashs32Fnv1())
self.assertEqual(2, mon2.Testhashu32Fnv1())
@@ -1979,15 +1979,15 @@ class TestAllCodePathsOfExampleSchema(unittest.TestCase):
def test_nondefault_monster_parent_namespace_test(self):
b = flatbuffers.Builder(0)
- MyGame.InParentNamespace.InParentNamespaceStart(b)
- parent = MyGame.InParentNamespace.InParentNamespaceEnd(b)
- MyGame.Example.Monster.MonsterStart(b)
- MyGame.Example.Monster.MonsterAddParentNamespaceTest(b, parent)
- mon = MyGame.Example.Monster.MonsterEnd(b)
+ MyGame.InParentNamespace.Start(b)
+ parent = MyGame.InParentNamespace.End(b)
+ MyGame.Example.Monster.Start(b)
+ MyGame.Example.Monster.AddParentNamespaceTest(b, parent)
+ mon = MyGame.Example.Monster.End(b)
b.Finish(mon)
# Inspect the resulting data.
- monster = MyGame.Example.Monster.Monster.GetRootAsMonster(b.Bytes,
+ monster = MyGame.Example.Monster.Monster.GetRootAs(b.Bytes,
b.Head())
self.assertTrue(isinstance(monster.ParentNamespaceTest(),
MyGame.InParentNamespace.InParentNamespace))
@@ -1996,14 +1996,14 @@ class TestAllCodePathsOfExampleSchema(unittest.TestCase):
b = flatbuffers.Builder(0)
string = b.CreateString("MyStat")
- MyGame.Example.Stat.StatStart(b)
- MyGame.Example.Stat.StatAddId(b, string)
- MyGame.Example.Stat.StatAddVal(b, 12345678)
- MyGame.Example.Stat.StatAddCount(b, 12345)
- stat = MyGame.Example.Stat.StatEnd(b)
+ MyGame.Example.Stat.Start(b)
+ MyGame.Example.Stat.AddId(b, string)
+ MyGame.Example.Stat.AddVal(b, 12345678)
+ MyGame.Example.Stat.AddCount(b, 12345)
+ stat = MyGame.Example.Stat.End(b)
b.Finish(stat)
- stat2 = MyGame.Example.Stat.Stat.GetRootAsStat(b.Bytes, b.Head())
+ stat2 = MyGame.Example.Stat.Stat.GetRootAs(b.Bytes, b.Head())
self.assertEqual(b"MyStat", stat2.Id())
self.assertEqual(12345678, stat2.Val())
@@ -2015,11 +2015,11 @@ class TestAllCodePathsOfMonsterExtraSchema(unittest.TestCase):
super(TestAllCodePathsOfMonsterExtraSchema, self).setUp(*args, **kwargs)
b = flatbuffers.Builder(0)
- MyGame.MonsterExtra.MonsterExtraStart(b)
- gen_mon = MyGame.MonsterExtra.MonsterExtraEnd(b)
+ MyGame.MonsterExtra.Start(b)
+ gen_mon = MyGame.MonsterExtra.End(b)
b.Finish(gen_mon)
- self.mon = MyGame.MonsterExtra.MonsterExtra.GetRootAsMonsterExtra(b.Bytes, b.Head())
+ self.mon = MyGame.MonsterExtra.MonsterExtra.GetRootAs(b.Bytes, b.Head())
def test_default_nan_inf(self):
self.assertTrue(math.isnan(self.mon.F1()))
@@ -2179,15 +2179,15 @@ class TestFixedLengthArrays(unittest.TestCase):
a, b, c, d_a, d_b, d_c, d_d, e, f)
# Create a table with the ArrayStruct.
- MyGame.Example.ArrayTable.ArrayTableStart(builder)
- MyGame.Example.ArrayTable.ArrayTableAddA(builder, arrayOffset)
- tableOffset = MyGame.Example.ArrayTable.ArrayTableEnd(builder)
+ MyGame.Example.ArrayTable.Start(builder)
+ MyGame.Example.ArrayTable.AddA(builder, arrayOffset)
+ tableOffset = MyGame.Example.ArrayTable.End(builder)
builder.Finish(tableOffset)
buf = builder.Output()
- table = MyGame.Example.ArrayTable.ArrayTable.GetRootAsArrayTable(buf, 0)
+ table = MyGame.Example.ArrayTable.ArrayTable.GetRootAs(buf)
# Verify structure.
nested = MyGame.Example.NestedStruct.NestedStruct()