diff options
author | Max Burke <max@urbanlogiq.com> | 2023-04-25 21:38:16 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-25 21:38:16 -0700 |
commit | 56ecc1f548f4bb4143b7a01db9b01d331e468977 (patch) | |
tree | beb8a63d614f1ac27b97e7b80cc6145468874d15 /tests | |
parent | 3fda20d7c7fe1f8006210bddae8cb55bc7a74c3b (diff) | |
download | flatbuffers-56ecc1f548f4bb4143b7a01db9b01d331e468977.tar.gz flatbuffers-56ecc1f548f4bb4143b7a01db9b01d331e468977.tar.bz2 flatbuffers-56ecc1f548f4bb4143b7a01db9b01d331e468977.zip |
Optionally generate type prefixes and suffixes for python code (#7857)
* optionally generate type prefixes and suffixes for python code
* fix codegen error when qualified name is empty
* generated code updated
Diffstat (limited to 'tests')
-rw-r--r-- | tests/MyGame/Example/ArrayTable.py | 15 | ||||
-rw-r--r-- | tests/MyGame/Example/Monster.py | 419 | ||||
-rw-r--r-- | tests/MyGame/Example/NestedUnion/NestedUnionTest.py | 30 | ||||
-rw-r--r-- | tests/MyGame/Example/NestedUnion/TestSimpleTableWithEnum.py | 15 | ||||
-rw-r--r-- | tests/MyGame/Example/NestedUnion/Vec3.py | 40 | ||||
-rw-r--r-- | tests/MyGame/Example/Referrable.py | 15 | ||||
-rw-r--r-- | tests/MyGame/Example/Stat.py | 25 | ||||
-rw-r--r-- | tests/MyGame/Example/TestSimpleTableWithEnum.py | 15 | ||||
-rw-r--r-- | tests/MyGame/Example/TypeAliases.py | 80 | ||||
-rw-r--r-- | tests/MyGame/Example2/Monster.py | 10 | ||||
-rw-r--r-- | tests/MyGame/InParentNamespace.py | 10 | ||||
-rw-r--r-- | tests/MyGame/MonsterExtra.py | 70 | ||||
-rw-r--r-- | tests/monster_test_generated.py | 460 | ||||
-rw-r--r-- | tests/optional_scalars/ScalarStuff.py | 190 |
14 files changed, 1090 insertions, 304 deletions
diff --git a/tests/MyGame/Example/ArrayTable.py b/tests/MyGame/Example/ArrayTable.py index b7a3ac5b..7f4051f5 100644 --- a/tests/MyGame/Example/ArrayTable.py +++ b/tests/MyGame/Example/ArrayTable.py @@ -39,15 +39,24 @@ class ArrayTable(object): return obj return None -def ArrayTableStart(builder): builder.StartObject(1) +def ArrayTableStart(builder): + return builder.StartObject(1) + def Start(builder): return ArrayTableStart(builder) -def ArrayTableAddA(builder, a): builder.PrependStructSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(a), 0) + +def ArrayTableAddA(builder, a): + return builder.PrependStructSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(a), 0) + def AddA(builder, a): return ArrayTableAddA(builder, a) -def ArrayTableEnd(builder): return builder.EndObject() + +def ArrayTableEnd(builder): + return builder.EndObject() + def End(builder): return ArrayTableEnd(builder) + import MyGame.Example.ArrayStruct try: from typing import Optional diff --git a/tests/MyGame/Example/Monster.py b/tests/MyGame/Example/Monster.py index 03dda3b6..bde02b4a 100644 --- a/tests/MyGame/Example/Monster.py +++ b/tests/MyGame/Example/Monster.py @@ -214,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 @@ -751,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 @@ -872,63 +872,120 @@ class Monster(object): return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) return float('inf') -def MonsterStart(builder): builder.StartObject(62) +def MonsterStart(builder): + return builder.StartObject(62) + def Start(builder): return MonsterStart(builder) -def MonsterAddPos(builder, pos): builder.PrependStructSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(pos), 0) + +def MonsterAddPos(builder, pos): + return builder.PrependStructSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(pos), 0) + def AddPos(builder, pos): return MonsterAddPos(builder, pos) -def MonsterAddMana(builder, mana): builder.PrependInt16Slot(1, mana, 150) + +def MonsterAddMana(builder, mana): + return builder.PrependInt16Slot(1, mana, 150) + def AddMana(builder, mana): return MonsterAddMana(builder, mana) -def MonsterAddHp(builder, hp): builder.PrependInt16Slot(2, hp, 100) + +def MonsterAddHp(builder, hp): + return builder.PrependInt16Slot(2, hp, 100) + def AddHp(builder, hp): return MonsterAddHp(builder, hp) -def MonsterAddName(builder, name): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(name), 0) + +def MonsterAddName(builder, name): + return builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(name), 0) + def AddName(builder, name): return MonsterAddName(builder, name) -def MonsterAddInventory(builder, inventory): builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(inventory), 0) + +def MonsterAddInventory(builder, inventory): + return builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(inventory), 0) + def AddInventory(builder, inventory): return MonsterAddInventory(builder, inventory) -def MonsterStartInventoryVector(builder, numElems): return builder.StartVector(1, numElems, 1) + +def MonsterStartInventoryVector(builder, numElems): + return builder.StartVector(1, numElems, 1) + def StartInventoryVector(builder, numElems): return MonsterStartInventoryVector(builder, numElems) -def MonsterAddColor(builder, color): builder.PrependUint8Slot(6, color, 8) + +def MonsterAddColor(builder, color): + return builder.PrependUint8Slot(6, color, 8) + def AddColor(builder, color): return MonsterAddColor(builder, color) -def MonsterAddTestType(builder, testType): builder.PrependUint8Slot(7, testType, 0) + +def MonsterAddTestType(builder, testType): + return builder.PrependUint8Slot(7, testType, 0) + def AddTestType(builder, testType): return MonsterAddTestType(builder, testType) -def MonsterAddTest(builder, test): builder.PrependUOffsetTRelativeSlot(8, flatbuffers.number_types.UOffsetTFlags.py_type(test), 0) + +def MonsterAddTest(builder, test): + return builder.PrependUOffsetTRelativeSlot(8, flatbuffers.number_types.UOffsetTFlags.py_type(test), 0) + def AddTest(builder, test): return MonsterAddTest(builder, test) -def MonsterAddTest4(builder, test4): builder.PrependUOffsetTRelativeSlot(9, flatbuffers.number_types.UOffsetTFlags.py_type(test4), 0) + +def MonsterAddTest4(builder, test4): + return builder.PrependUOffsetTRelativeSlot(9, flatbuffers.number_types.UOffsetTFlags.py_type(test4), 0) + def AddTest4(builder, test4): return MonsterAddTest4(builder, test4) -def MonsterStartTest4Vector(builder, numElems): return builder.StartVector(4, numElems, 2) + +def MonsterStartTest4Vector(builder, numElems): + return builder.StartVector(4, numElems, 2) + def StartTest4Vector(builder, numElems): return MonsterStartTest4Vector(builder, numElems) -def MonsterAddTestarrayofstring(builder, testarrayofstring): builder.PrependUOffsetTRelativeSlot(10, flatbuffers.number_types.UOffsetTFlags.py_type(testarrayofstring), 0) + +def MonsterAddTestarrayofstring(builder, testarrayofstring): + return builder.PrependUOffsetTRelativeSlot(10, flatbuffers.number_types.UOffsetTFlags.py_type(testarrayofstring), 0) + def AddTestarrayofstring(builder, testarrayofstring): return MonsterAddTestarrayofstring(builder, testarrayofstring) -def MonsterStartTestarrayofstringVector(builder, numElems): return builder.StartVector(4, numElems, 4) + +def MonsterStartTestarrayofstringVector(builder, numElems): + return builder.StartVector(4, numElems, 4) + def StartTestarrayofstringVector(builder, numElems): return MonsterStartTestarrayofstringVector(builder, numElems) -def MonsterAddTestarrayoftables(builder, testarrayoftables): builder.PrependUOffsetTRelativeSlot(11, flatbuffers.number_types.UOffsetTFlags.py_type(testarrayoftables), 0) + +def MonsterAddTestarrayoftables(builder, testarrayoftables): + return builder.PrependUOffsetTRelativeSlot(11, flatbuffers.number_types.UOffsetTFlags.py_type(testarrayoftables), 0) + def AddTestarrayoftables(builder, testarrayoftables): return MonsterAddTestarrayoftables(builder, testarrayoftables) -def MonsterStartTestarrayoftablesVector(builder, numElems): return builder.StartVector(4, numElems, 4) + +def MonsterStartTestarrayoftablesVector(builder, numElems): + return builder.StartVector(4, numElems, 4) + def StartTestarrayoftablesVector(builder, numElems): return MonsterStartTestarrayoftablesVector(builder, numElems) -def MonsterAddEnemy(builder, enemy): builder.PrependUOffsetTRelativeSlot(12, flatbuffers.number_types.UOffsetTFlags.py_type(enemy), 0) + +def MonsterAddEnemy(builder, enemy): + return builder.PrependUOffsetTRelativeSlot(12, flatbuffers.number_types.UOffsetTFlags.py_type(enemy), 0) + def AddEnemy(builder, enemy): return MonsterAddEnemy(builder, enemy) -def MonsterAddTestnestedflatbuffer(builder, testnestedflatbuffer): builder.PrependUOffsetTRelativeSlot(13, flatbuffers.number_types.UOffsetTFlags.py_type(testnestedflatbuffer), 0) + +def MonsterAddTestnestedflatbuffer(builder, testnestedflatbuffer): + return builder.PrependUOffsetTRelativeSlot(13, flatbuffers.number_types.UOffsetTFlags.py_type(testnestedflatbuffer), 0) + def AddTestnestedflatbuffer(builder, testnestedflatbuffer): return MonsterAddTestnestedflatbuffer(builder, testnestedflatbuffer) -def MonsterStartTestnestedflatbufferVector(builder, numElems): return builder.StartVector(1, numElems, 1) + +def MonsterStartTestnestedflatbufferVector(builder, numElems): + return builder.StartVector(1, numElems, 1) + def StartTestnestedflatbufferVector(builder, numElems): return MonsterStartTestnestedflatbufferVector(builder, numElems) + def MonsterMakeTestnestedflatbufferVectorFromBytes(builder, bytes): builder.StartVector(1, len(bytes), 1) builder.head = builder.head - len(bytes) @@ -936,156 +993,306 @@ def MonsterMakeTestnestedflatbufferVectorFromBytes(builder, bytes): return builder.EndVector() def MakeTestnestedflatbufferVectorFromBytes(builder, bytes): return MonsterMakeTestnestedflatbufferVectorFromBytes(builder, bytes) -def MonsterAddTestempty(builder, testempty): builder.PrependUOffsetTRelativeSlot(14, flatbuffers.number_types.UOffsetTFlags.py_type(testempty), 0) +def MonsterAddTestempty(builder, testempty): + return builder.PrependUOffsetTRelativeSlot(14, flatbuffers.number_types.UOffsetTFlags.py_type(testempty), 0) + def AddTestempty(builder, testempty): return MonsterAddTestempty(builder, testempty) -def MonsterAddTestbool(builder, testbool): builder.PrependBoolSlot(15, testbool, 0) + +def MonsterAddTestbool(builder, testbool): + return builder.PrependBoolSlot(15, testbool, 0) + def AddTestbool(builder, testbool): return MonsterAddTestbool(builder, testbool) -def MonsterAddTesthashs32Fnv1(builder, testhashs32Fnv1): builder.PrependInt32Slot(16, testhashs32Fnv1, 0) + +def MonsterAddTesthashs32Fnv1(builder, testhashs32Fnv1): + return builder.PrependInt32Slot(16, testhashs32Fnv1, 0) + def AddTesthashs32Fnv1(builder, testhashs32Fnv1): return MonsterAddTesthashs32Fnv1(builder, testhashs32Fnv1) -def MonsterAddTesthashu32Fnv1(builder, testhashu32Fnv1): builder.PrependUint32Slot(17, testhashu32Fnv1, 0) + +def MonsterAddTesthashu32Fnv1(builder, testhashu32Fnv1): + return builder.PrependUint32Slot(17, testhashu32Fnv1, 0) + def AddTesthashu32Fnv1(builder, testhashu32Fnv1): return MonsterAddTesthashu32Fnv1(builder, testhashu32Fnv1) -def MonsterAddTesthashs64Fnv1(builder, testhashs64Fnv1): builder.PrependInt64Slot(18, testhashs64Fnv1, 0) + +def MonsterAddTesthashs64Fnv1(builder, testhashs64Fnv1): + return builder.PrependInt64Slot(18, testhashs64Fnv1, 0) + def AddTesthashs64Fnv1(builder, testhashs64Fnv1): return MonsterAddTesthashs64Fnv1(builder, testhashs64Fnv1) -def MonsterAddTesthashu64Fnv1(builder, testhashu64Fnv1): builder.PrependUint64Slot(19, testhashu64Fnv1, 0) + +def MonsterAddTesthashu64Fnv1(builder, testhashu64Fnv1): + return builder.PrependUint64Slot(19, testhashu64Fnv1, 0) + def AddTesthashu64Fnv1(builder, testhashu64Fnv1): return MonsterAddTesthashu64Fnv1(builder, testhashu64Fnv1) -def MonsterAddTesthashs32Fnv1a(builder, testhashs32Fnv1a): builder.PrependInt32Slot(20, testhashs32Fnv1a, 0) + +def MonsterAddTesthashs32Fnv1a(builder, testhashs32Fnv1a): + return builder.PrependInt32Slot(20, testhashs32Fnv1a, 0) + def AddTesthashs32Fnv1a(builder, testhashs32Fnv1a): return MonsterAddTesthashs32Fnv1a(builder, testhashs32Fnv1a) -def MonsterAddTesthashu32Fnv1a(builder, testhashu32Fnv1a): builder.PrependUint32Slot(21, testhashu32Fnv1a, 0) + +def MonsterAddTesthashu32Fnv1a(builder, testhashu32Fnv1a): + return builder.PrependUint32Slot(21, testhashu32Fnv1a, 0) + def AddTesthashu32Fnv1a(builder, testhashu32Fnv1a): return MonsterAddTesthashu32Fnv1a(builder, testhashu32Fnv1a) -def MonsterAddTesthashs64Fnv1a(builder, testhashs64Fnv1a): builder.PrependInt64Slot(22, testhashs64Fnv1a, 0) + +def MonsterAddTesthashs64Fnv1a(builder, testhashs64Fnv1a): + return builder.PrependInt64Slot(22, testhashs64Fnv1a, 0) + def AddTesthashs64Fnv1a(builder, testhashs64Fnv1a): return MonsterAddTesthashs64Fnv1a(builder, testhashs64Fnv1a) -def MonsterAddTesthashu64Fnv1a(builder, testhashu64Fnv1a): builder.PrependUint64Slot(23, testhashu64Fnv1a, 0) + +def MonsterAddTesthashu64Fnv1a(builder, testhashu64Fnv1a): + return builder.PrependUint64Slot(23, testhashu64Fnv1a, 0) + def AddTesthashu64Fnv1a(builder, testhashu64Fnv1a): return MonsterAddTesthashu64Fnv1a(builder, testhashu64Fnv1a) -def MonsterAddTestarrayofbools(builder, testarrayofbools): builder.PrependUOffsetTRelativeSlot(24, flatbuffers.number_types.UOffsetTFlags.py_type(testarrayofbools), 0) + +def MonsterAddTestarrayofbools(builder, testarrayofbools): + return builder.PrependUOffsetTRelativeSlot(24, flatbuffers.number_types.UOffsetTFlags.py_type(testarrayofbools), 0) + def AddTestarrayofbools(builder, testarrayofbools): return MonsterAddTestarrayofbools(builder, testarrayofbools) -def MonsterStartTestarrayofboolsVector(builder, numElems): return builder.StartVector(1, numElems, 1) + +def MonsterStartTestarrayofboolsVector(builder, numElems): + return builder.StartVector(1, numElems, 1) + def StartTestarrayofboolsVector(builder, numElems): return MonsterStartTestarrayofboolsVector(builder, numElems) -def MonsterAddTestf(builder, testf): builder.PrependFloat32Slot(25, testf, 3.14159) + +def MonsterAddTestf(builder, testf): + return builder.PrependFloat32Slot(25, testf, 3.14159) + def AddTestf(builder, testf): return MonsterAddTestf(builder, testf) -def MonsterAddTestf2(builder, testf2): builder.PrependFloat32Slot(26, testf2, 3.0) + +def MonsterAddTestf2(builder, testf2): + return builder.PrependFloat32Slot(26, testf2, 3.0) + def AddTestf2(builder, testf2): return MonsterAddTestf2(builder, testf2) -def MonsterAddTestf3(builder, testf3): builder.PrependFloat32Slot(27, testf3, 0.0) + +def MonsterAddTestf3(builder, testf3): + return builder.PrependFloat32Slot(27, testf3, 0.0) + def AddTestf3(builder, testf3): return MonsterAddTestf3(builder, testf3) -def MonsterAddTestarrayofstring2(builder, testarrayofstring2): builder.PrependUOffsetTRelativeSlot(28, flatbuffers.number_types.UOffsetTFlags.py_type(testarrayofstring2), 0) + +def MonsterAddTestarrayofstring2(builder, testarrayofstring2): + return builder.PrependUOffsetTRelativeSlot(28, flatbuffers.number_types.UOffsetTFlags.py_type(testarrayofstring2), 0) + def AddTestarrayofstring2(builder, testarrayofstring2): return MonsterAddTestarrayofstring2(builder, testarrayofstring2) -def MonsterStartTestarrayofstring2Vector(builder, numElems): return builder.StartVector(4, numElems, 4) + +def MonsterStartTestarrayofstring2Vector(builder, numElems): + return builder.StartVector(4, numElems, 4) + def StartTestarrayofstring2Vector(builder, numElems): return MonsterStartTestarrayofstring2Vector(builder, numElems) -def MonsterAddTestarrayofsortedstruct(builder, testarrayofsortedstruct): builder.PrependUOffsetTRelativeSlot(29, flatbuffers.number_types.UOffsetTFlags.py_type(testarrayofsortedstruct), 0) + +def MonsterAddTestarrayofsortedstruct(builder, testarrayofsortedstruct): + return builder.PrependUOffsetTRelativeSlot(29, flatbuffers.number_types.UOffsetTFlags.py_type(testarrayofsortedstruct), 0) + def AddTestarrayofsortedstruct(builder, testarrayofsortedstruct): return MonsterAddTestarrayofsortedstruct(builder, testarrayofsortedstruct) -def MonsterStartTestarrayofsortedstructVector(builder, numElems): return builder.StartVector(8, numElems, 4) + +def MonsterStartTestarrayofsortedstructVector(builder, numElems): + return builder.StartVector(8, numElems, 4) + def StartTestarrayofsortedstructVector(builder, numElems): return MonsterStartTestarrayofsortedstructVector(builder, numElems) -def MonsterAddFlex(builder, flex): builder.PrependUOffsetTRelativeSlot(30, flatbuffers.number_types.UOffsetTFlags.py_type(flex), 0) + +def MonsterAddFlex(builder, flex): + return builder.PrependUOffsetTRelativeSlot(30, flatbuffers.number_types.UOffsetTFlags.py_type(flex), 0) + def AddFlex(builder, flex): return MonsterAddFlex(builder, flex) -def MonsterStartFlexVector(builder, numElems): return builder.StartVector(1, numElems, 1) + +def MonsterStartFlexVector(builder, numElems): + return builder.StartVector(1, numElems, 1) + def StartFlexVector(builder, numElems): return MonsterStartFlexVector(builder, numElems) -def MonsterAddTest5(builder, test5): builder.PrependUOffsetTRelativeSlot(31, flatbuffers.number_types.UOffsetTFlags.py_type(test5), 0) + +def MonsterAddTest5(builder, test5): + return builder.PrependUOffsetTRelativeSlot(31, flatbuffers.number_types.UOffsetTFlags.py_type(test5), 0) + def AddTest5(builder, test5): return MonsterAddTest5(builder, test5) -def MonsterStartTest5Vector(builder, numElems): return builder.StartVector(4, numElems, 2) + +def MonsterStartTest5Vector(builder, numElems): + return builder.StartVector(4, numElems, 2) + def StartTest5Vector(builder, numElems): return MonsterStartTest5Vector(builder, numElems) -def MonsterAddVectorOfLongs(builder, vectorOfLongs): builder.PrependUOffsetTRelativeSlot(32, flatbuffers.number_types.UOffsetTFlags.py_type(vectorOfLongs), 0) + +def MonsterAddVectorOfLongs(builder, vectorOfLongs): + return builder.PrependUOffsetTRelativeSlot(32, flatbuffers.number_types.UOffsetTFlags.py_type(vectorOfLongs), 0) + def AddVectorOfLongs(builder, vectorOfLongs): return MonsterAddVectorOfLongs(builder, vectorOfLongs) -def MonsterStartVectorOfLongsVector(builder, numElems): return builder.StartVector(8, numElems, 8) + +def MonsterStartVectorOfLongsVector(builder, numElems): + return builder.StartVector(8, numElems, 8) + def StartVectorOfLongsVector(builder, numElems): return MonsterStartVectorOfLongsVector(builder, numElems) -def MonsterAddVectorOfDoubles(builder, vectorOfDoubles): builder.PrependUOffsetTRelativeSlot(33, flatbuffers.number_types.UOffsetTFlags.py_type(vectorOfDoubles), 0) + +def MonsterAddVectorOfDoubles(builder, vectorOfDoubles): + return builder.PrependUOffsetTRelativeSlot(33, flatbuffers.number_types.UOffsetTFlags.py_type(vectorOfDoubles), 0) + def AddVectorOfDoubles(builder, vectorOfDoubles): return MonsterAddVectorOfDoubles(builder, vectorOfDoubles) -def MonsterStartVectorOfDoublesVector(builder, numElems): return builder.StartVector(8, numElems, 8) + +def MonsterStartVectorOfDoublesVector(builder, numElems): + return builder.StartVector(8, numElems, 8) + def StartVectorOfDoublesVector(builder, numElems): return MonsterStartVectorOfDoublesVector(builder, numElems) -def MonsterAddParentNamespaceTest(builder, parentNamespaceTest): builder.PrependUOffsetTRelativeSlot(34, flatbuffers.number_types.UOffsetTFlags.py_type(parentNamespaceTest), 0) + +def MonsterAddParentNamespaceTest(builder, parentNamespaceTest): + return builder.PrependUOffsetTRelativeSlot(34, flatbuffers.number_types.UOffsetTFlags.py_type(parentNamespaceTest), 0) + def AddParentNamespaceTest(builder, parentNamespaceTest): return MonsterAddParentNamespaceTest(builder, parentNamespaceTest) -def MonsterAddVectorOfReferrables(builder, vectorOfReferrables): builder.PrependUOffsetTRelativeSlot(35, flatbuffers.number_types.UOffsetTFlags.py_type(vectorOfReferrables), 0) + +def MonsterAddVectorOfReferrables(builder, vectorOfReferrables): + return builder.PrependUOffsetTRelativeSlot(35, flatbuffers.number_types.UOffsetTFlags.py_type(vectorOfReferrables), 0) + def AddVectorOfReferrables(builder, vectorOfReferrables): return MonsterAddVectorOfReferrables(builder, vectorOfReferrables) -def MonsterStartVectorOfReferrablesVector(builder, numElems): return builder.StartVector(4, numElems, 4) + +def MonsterStartVectorOfReferrablesVector(builder, numElems): + return builder.StartVector(4, numElems, 4) + def StartVectorOfReferrablesVector(builder, numElems): return MonsterStartVectorOfReferrablesVector(builder, numElems) -def MonsterAddSingleWeakReference(builder, singleWeakReference): builder.PrependUint64Slot(36, singleWeakReference, 0) + +def MonsterAddSingleWeakReference(builder, singleWeakReference): + return builder.PrependUint64Slot(36, singleWeakReference, 0) + def AddSingleWeakReference(builder, singleWeakReference): return MonsterAddSingleWeakReference(builder, singleWeakReference) -def MonsterAddVectorOfWeakReferences(builder, vectorOfWeakReferences): builder.PrependUOffsetTRelativeSlot(37, flatbuffers.number_types.UOffsetTFlags.py_type(vectorOfWeakReferences), 0) + +def MonsterAddVectorOfWeakReferences(builder, vectorOfWeakReferences): + return builder.PrependUOffsetTRelativeSlot(37, flatbuffers.number_types.UOffsetTFlags.py_type(vectorOfWeakReferences), 0) + def AddVectorOfWeakReferences(builder, vectorOfWeakReferences): return MonsterAddVectorOfWeakReferences(builder, vectorOfWeakReferences) -def MonsterStartVectorOfWeakReferencesVector(builder, numElems): return builder.StartVector(8, numElems, 8) + +def MonsterStartVectorOfWeakReferencesVector(builder, numElems): + return builder.StartVector(8, numElems, 8) + def StartVectorOfWeakReferencesVector(builder, numElems): return MonsterStartVectorOfWeakReferencesVector(builder, numElems) -def MonsterAddVectorOfStrongReferrables(builder, vectorOfStrongReferrables): builder.PrependUOffsetTRelativeSlot(38, flatbuffers.number_types.UOffsetTFlags.py_type(vectorOfStrongReferrables), 0) + +def MonsterAddVectorOfStrongReferrables(builder, vectorOfStrongReferrables): + return builder.PrependUOffsetTRelativeSlot(38, flatbuffers.number_types.UOffsetTFlags.py_type(vectorOfStrongReferrables), 0) + def AddVectorOfStrongReferrables(builder, vectorOfStrongReferrables): return MonsterAddVectorOfStrongReferrables(builder, vectorOfStrongReferrables) -def MonsterStartVectorOfStrongReferrablesVector(builder, numElems): return builder.StartVector(4, numElems, 4) + +def MonsterStartVectorOfStrongReferrablesVector(builder, numElems): + return builder.StartVector(4, numElems, 4) + def StartVectorOfStrongReferrablesVector(builder, numElems): return MonsterStartVectorOfStrongReferrablesVector(builder, numElems) -def MonsterAddCoOwningReference(builder, coOwningReference): builder.PrependUint64Slot(39, coOwningReference, 0) + +def MonsterAddCoOwningReference(builder, coOwningReference): + return builder.PrependUint64Slot(39, coOwningReference, 0) + def AddCoOwningReference(builder, coOwningReference): return MonsterAddCoOwningReference(builder, coOwningReference) -def MonsterAddVectorOfCoOwningReferences(builder, vectorOfCoOwningReferences): builder.PrependUOffsetTRelativeSlot(40, flatbuffers.number_types.UOffsetTFlags.py_type(vectorOfCoOwningReferences), 0) + +def MonsterAddVectorOfCoOwningReferences(builder, vectorOfCoOwningReferences): + return builder.PrependUOffsetTRelativeSlot(40, flatbuffers.number_types.UOffsetTFlags.py_type(vectorOfCoOwningReferences), 0) + def AddVectorOfCoOwningReferences(builder, vectorOfCoOwningReferences): return MonsterAddVectorOfCoOwningReferences(builder, vectorOfCoOwningReferences) -def MonsterStartVectorOfCoOwningReferencesVector(builder, numElems): return builder.StartVector(8, numElems, 8) + +def MonsterStartVectorOfCoOwningReferencesVector(builder, numElems): + return builder.StartVector(8, numElems, 8) + def StartVectorOfCoOwningReferencesVector(builder, numElems): return MonsterStartVectorOfCoOwningReferencesVector(builder, numElems) -def MonsterAddNonOwningReference(builder, nonOwningReference): builder.PrependUint64Slot(41, nonOwningReference, 0) + +def MonsterAddNonOwningReference(builder, nonOwningReference): + return builder.PrependUint64Slot(41, nonOwningReference, 0) + def AddNonOwningReference(builder, nonOwningReference): return MonsterAddNonOwningReference(builder, nonOwningReference) -def MonsterAddVectorOfNonOwningReferences(builder, vectorOfNonOwningReferences): builder.PrependUOffsetTRelativeSlot(42, flatbuffers.number_types.UOffsetTFlags.py_type(vectorOfNonOwningReferences), 0) + +def MonsterAddVectorOfNonOwningReferences(builder, vectorOfNonOwningReferences): + return builder.PrependUOffsetTRelativeSlot(42, flatbuffers.number_types.UOffsetTFlags.py_type(vectorOfNonOwningReferences), 0) + def AddVectorOfNonOwningReferences(builder, vectorOfNonOwningReferences): return MonsterAddVectorOfNonOwningReferences(builder, vectorOfNonOwningReferences) -def MonsterStartVectorOfNonOwningReferencesVector(builder, numElems): return builder.StartVector(8, numElems, 8) + +def MonsterStartVectorOfNonOwningReferencesVector(builder, numElems): + return builder.StartVector(8, numElems, 8) + def StartVectorOfNonOwningReferencesVector(builder, numElems): return MonsterStartVectorOfNonOwningReferencesVector(builder, numElems) -def MonsterAddAnyUniqueType(builder, anyUniqueType): builder.PrependUint8Slot(43, anyUniqueType, 0) + +def MonsterAddAnyUniqueType(builder, anyUniqueType): + return builder.PrependUint8Slot(43, anyUniqueType, 0) + def AddAnyUniqueType(builder, anyUniqueType): return MonsterAddAnyUniqueType(builder, anyUniqueType) -def MonsterAddAnyUnique(builder, anyUnique): builder.PrependUOffsetTRelativeSlot(44, flatbuffers.number_types.UOffsetTFlags.py_type(anyUnique), 0) + +def MonsterAddAnyUnique(builder, anyUnique): + return builder.PrependUOffsetTRelativeSlot(44, flatbuffers.number_types.UOffsetTFlags.py_type(anyUnique), 0) + def AddAnyUnique(builder, anyUnique): return MonsterAddAnyUnique(builder, anyUnique) -def MonsterAddAnyAmbiguousType(builder, anyAmbiguousType): builder.PrependUint8Slot(45, anyAmbiguousType, 0) + +def MonsterAddAnyAmbiguousType(builder, anyAmbiguousType): + return builder.PrependUint8Slot(45, anyAmbiguousType, 0) + def AddAnyAmbiguousType(builder, anyAmbiguousType): return MonsterAddAnyAmbiguousType(builder, anyAmbiguousType) -def MonsterAddAnyAmbiguous(builder, anyAmbiguous): builder.PrependUOffsetTRelativeSlot(46, flatbuffers.number_types.UOffsetTFlags.py_type(anyAmbiguous), 0) + +def MonsterAddAnyAmbiguous(builder, anyAmbiguous): + return builder.PrependUOffsetTRelativeSlot(46, flatbuffers.number_types.UOffsetTFlags.py_type(anyAmbiguous), 0) + def AddAnyAmbiguous(builder, anyAmbiguous): return MonsterAddAnyAmbiguous(builder, anyAmbiguous) -def MonsterAddVectorOfEnums(builder, vectorOfEnums): builder.PrependUOffsetTRelativeSlot(47, flatbuffers.number_types.UOffsetTFlags.py_type(vectorOfEnums), 0) + +def MonsterAddVectorOfEnums(builder, vectorOfEnums): + return builder.PrependUOffsetTRelativeSlot(47, flatbuffers.number_types.UOffsetTFlags.py_type(vectorOfEnums), 0) + def AddVectorOfEnums(builder, vectorOfEnums): return MonsterAddVectorOfEnums(builder, vectorOfEnums) -def MonsterStartVectorOfEnumsVector(builder, numElems): return builder.StartVector(1, numElems, 1) + +def MonsterStartVectorOfEnumsVector(builder, numElems): + return builder.StartVector(1, numElems, 1) + def StartVectorOfEnumsVector(builder, numElems): return MonsterStartVectorOfEnumsVector(builder, numElems) -def MonsterAddSignedEnum(builder, signedEnum): builder.PrependInt8Slot(48, signedEnum, -1) + +def MonsterAddSignedEnum(builder, signedEnum): + return builder.PrependInt8Slot(48, signedEnum, -1) + def AddSignedEnum(builder, signedEnum): return MonsterAddSignedEnum(builder, signedEnum) -def MonsterAddTestrequirednestedflatbuffer(builder, testrequirednestedflatbuffer): builder.PrependUOffsetTRelativeSlot(49, flatbuffers.number_types.UOffsetTFlags.py_type(testrequirednestedflatbuffer), 0) + +def MonsterAddTestrequirednestedflatbuffer(builder, testrequirednestedflatbuffer): + return builder.PrependUOffsetTRelativeSlot(49, flatbuffers.number_types.UOffsetTFlags.py_type(testrequirednestedflatbuffer), 0) + def AddTestrequirednestedflatbuffer(builder, testrequirednestedflatbuffer): return MonsterAddTestrequirednestedflatbuffer(builder, testrequirednestedflatbuffer) -def MonsterStartTestrequirednestedflatbufferVector(builder, numElems): return builder.StartVector(1, numElems, 1) + +def MonsterStartTestrequirednestedflatbufferVector(builder, numElems): + return builder.StartVector(1, numElems, 1) + def StartTestrequirednestedflatbufferVector(builder, numElems): return MonsterStartTestrequirednestedflatbufferVector(builder, numElems) + def MonsterMakeTestrequirednestedflatbufferVectorFromBytes(builder, bytes): builder.StartVector(1, len(bytes), 1) builder.head = builder.head - len(bytes) @@ -1093,48 +1300,90 @@ def MonsterMakeTestrequirednestedflatbufferVectorFromBytes(builder, bytes): return builder.EndVector() def MakeTestrequirednestedflatbufferVectorFromBytes(builder, bytes): return MonsterMakeTestrequirednestedflatbufferVectorFromBytes(builder, bytes) -def MonsterAddScalarKeySortedTables(builder, scalarKeySortedTables): builder.PrependUOffsetTRelativeSlot(50, flatbuffers.number_types.UOffsetTFlags.py_type(scalarKeySortedTables), 0) +def MonsterAddScalarKeySortedTables(builder, scalarKeySortedTables): + return builder.PrependUOffsetTRelativeSlot(50, flatbuffers.number_types.UOffsetTFlags.py_type(scalarKeySortedTables), 0) + def AddScalarKeySortedTables(builder, scalarKeySortedTables): return MonsterAddScalarKeySortedTables(builder, scalarKeySortedTables) -def MonsterStartScalarKeySortedTablesVector(builder, numElems): return builder.StartVector(4, numElems, 4) + +def MonsterStartScalarKeySortedTablesVector(builder, numElems): + return builder.StartVector(4, numElems, 4) + def StartScalarKeySortedTablesVector(builder, numElems): return MonsterStartScalarKeySortedTablesVector(builder, numElems) -def MonsterAddNativeInline(builder, nativeInline): builder.PrependStructSlot(51, flatbuffers.number_types.UOffsetTFlags.py_type(nativeInline), 0) + +def MonsterAddNativeInline(builder, nativeInline): + return builder.PrependStructSlot(51, flatbuffers.number_types.UOffsetTFlags.py_type(nativeInline), 0) + def AddNativeInline(builder, nativeInline): return MonsterAddNativeInline(builder, nativeInline) -def MonsterAddLongEnumNonEnumDefault(builder, longEnumNonEnumDefault): builder.PrependUint64Slot(52, longEnumNonEnumDefault, 0) + +def MonsterAddLongEnumNonEnumDefault(builder, longEnumNonEnumDefault): + return builder.PrependUint64Slot(52, longEnumNonEnumDefault, 0) + def AddLongEnumNonEnumDefault(builder, longEnumNonEnumDefault): return MonsterAddLongEnumNonEnumDefault(builder, longEnumNonEnumDefault) -def MonsterAddLongEnumNormalDefault(builder, longEnumNormalDefault): builder.PrependUint64Slot(53, longEnumNormalDefault, 2) + +def MonsterAddLongEnumNormalDefault(builder, longEnumNormalDefault): + return builder.PrependUint64Slot(53, longEnumNormalDefault, 2) + def AddLongEnumNormalDefault(builder, longEnumNormalDefault): return MonsterAddLongEnumNormalDefault(builder, longEnumNormalDefault) -def MonsterAddNanDefault(builder, nanDefault): builder.PrependFloat32Slot(54, nanDefault, float('nan')) + +def MonsterAddNanDefault(builder, nanDefault): + return builder.PrependFloat32Slot(54, nanDefault, float('nan')) + def AddNanDefault(builder, nanDefault): return MonsterAddNanDefault(builder, nanDefault) -def MonsterAddInfDefault(builder, infDefault): builder.PrependFloat32Slot(55, infDefault, float('inf')) + +def MonsterAddInfDefault(builder, infDefault): + return builder.PrependFloat32Slot(55, infDefault, float('inf')) + def AddInfDefault(builder, infDefault): return MonsterAddInfDefault(builder, infDefault) -def MonsterAddPositiveInfDefault(builder, positiveInfDefault): builder.PrependFloat32Slot(56, positiveInfDefault, float('inf')) + +def MonsterAddPositiveInfDefault(builder, positiveInfDefault): + return builder.PrependFloat32Slot(56, positiveInfDefault, float('inf')) + def AddPositiveInfDefault(builder, positiveInfDefault): return MonsterAddPositiveInfDefault(builder, positiveInfDefault) -def MonsterAddInfinityDefault(builder, infinityDefault): builder.PrependFloat32Slot(57, infinityDefault, float('inf')) + +def MonsterAddInfinityDefault(builder, infinityDefault): + return builder.PrependFloat32Slot(57, infinityDefault, float('inf')) + def AddInfinityDefault(builder, infinityDefault): return MonsterAddInfinityDefault(builder, infinityDefault) -def MonsterAddPositiveInfinityDefault(builder, positiveInfinityDefault): builder.PrependFloat32Slot(58, positiveInfinityDefault, float('inf')) + +def MonsterAddPositiveInfinityDefault(builder, positiveInfinityDefault): + return builder.PrependFloat32Slot(58, positiveInfinityDefault, float('inf')) + def AddPositiveInfinityDefault(builder, positiveInfinityDefault): return MonsterAddPositiveInfinityDefault(builder, positiveInfinityDefault) -def MonsterAddNegativeInfDefault(builder, negativeInfDefault): builder.PrependFloat32Slot(59, negativeInfDefault, float('-inf')) + +def MonsterAddNegativeInfDefault(builder, negativeInfDefault): + return builder.PrependFloat32Slot(59, negativeInfDefault, float('-inf')) + def AddNegativeInfDefault(builder, negativeInfDefault): return MonsterAddNegativeInfDefault(builder, negativeInfDefault) -def MonsterAddNegativeInfinityDefault(builder, negativeInfinityDefault): builder.PrependFloat32Slot(60, negativeInfinityDefault, float('-inf')) + +def MonsterAddNegativeInfinityDefault(builder, negativeInfinityDefault): + return builder.PrependFloat32Slot(60, negativeInfinityDefault, float('-inf')) + def AddNegativeInfinityDefault(builder, negativeInfinityDefault): return MonsterAddNegativeInfinityDefault(builder, negativeInfinityDefault) -def MonsterAddDoubleInfDefault(builder, doubleInfDefault): builder.PrependFloat64Slot(61, doubleInfDefault, float('inf')) + +def MonsterAddDoubleInfDefault(builder, doubleInfDefault): + return builder.PrependFloat64Slot(61, doubleInfDefault, float('inf')) + def AddDoubleInfDefault(builder, doubleInfDefault): return MonsterAddDoubleInfDefault(builder, doubleInfDefault) -def MonsterEnd(builder): return builder.EndObject() + +def MonsterEnd(builder): + return builder.EndObject() + def End(builder): return MonsterEnd(builder) + import MyGame.Example.Ability import MyGame.Example.Any import MyGame.Example.AnyAmbiguousAliases diff --git a/tests/MyGame/Example/NestedUnion/NestedUnionTest.py b/tests/MyGame/Example/NestedUnion/NestedUnionTest.py index 9a3cbee2..33c2a441 100644 --- a/tests/MyGame/Example/NestedUnion/NestedUnionTest.py +++ b/tests/MyGame/Example/NestedUnion/NestedUnionTest.py @@ -55,24 +55,42 @@ class NestedUnionTest(object): return self._tab.Get(flatbuffers.number_types.Int16Flags, o + self._tab.Pos) return 0 -def NestedUnionTestStart(builder): builder.StartObject(4) +def NestedUnionTestStart(builder): + return builder.StartObject(4) + def Start(builder): return NestedUnionTestStart(builder) -def NestedUnionTestAddName(builder, name): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(name), 0) + +def NestedUnionTestAddName(builder, name): + return builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(name), 0) + def AddName(builder, name): return NestedUnionTestAddName(builder, name) -def NestedUnionTestAddDataType(builder, dataType): builder.PrependUint8Slot(1, dataType, 0) + +def NestedUnionTestAddDataType(builder, dataType): + return builder.PrependUint8Slot(1, dataType, 0) + def AddDataType(builder, dataType): return NestedUnionTestAddDataType(builder, dataType) -def NestedUnionTestAddData(builder, data): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(data), 0) + +def NestedUnionTestAddData(builder, data): + return builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(data), 0) + def AddData(builder, data): return NestedUnionTestAddData(builder, data) -def NestedUnionTestAddId(builder, id): builder.PrependInt16Slot(3, id, 0) + +def NestedUnionTestAddId(builder, id): + return builder.PrependInt16Slot(3, id, 0) + def AddId(builder, id): return NestedUnionTestAddId(builder, id) -def NestedUnionTestEnd(builder): return builder.EndObject() + +def NestedUnionTestEnd(builder): + return builder.EndObject() + def End(builder): return NestedUnionTestEnd(builder) + import MyGame.Example.NestedUnion.Any import MyGame.Example.NestedUnion.TestSimpleTableWithEnum import MyGame.Example.NestedUnion.Vec3 diff --git a/tests/MyGame/Example/NestedUnion/TestSimpleTableWithEnum.py b/tests/MyGame/Example/NestedUnion/TestSimpleTableWithEnum.py index 46ebc263..b3ad74f7 100644 --- a/tests/MyGame/Example/NestedUnion/TestSimpleTableWithEnum.py +++ b/tests/MyGame/Example/NestedUnion/TestSimpleTableWithEnum.py @@ -31,16 +31,25 @@ class TestSimpleTableWithEnum(object): return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) return 2 -def TestSimpleTableWithEnumStart(builder): builder.StartObject(1) +def TestSimpleTableWithEnumStart(builder): + return builder.StartObject(1) + def Start(builder): return TestSimpleTableWithEnumStart(builder) -def TestSimpleTableWithEnumAddColor(builder, color): builder.PrependUint8Slot(0, color, 2) + +def TestSimpleTableWithEnumAddColor(builder, color): + return builder.PrependUint8Slot(0, color, 2) + def AddColor(builder, color): return TestSimpleTableWithEnumAddColor(builder, color) -def TestSimpleTableWithEnumEnd(builder): return builder.EndObject() + +def TestSimpleTableWithEnumEnd(builder): + return builder.EndObject() + def End(builder): return TestSimpleTableWithEnumEnd(builder) + class TestSimpleTableWithEnumT(object): # TestSimpleTableWithEnumT diff --git a/tests/MyGame/Example/NestedUnion/Vec3.py b/tests/MyGame/Example/NestedUnion/Vec3.py index f3bb75f2..915f5801 100644 --- a/tests/MyGame/Example/NestedUnion/Vec3.py +++ b/tests/MyGame/Example/NestedUnion/Vec3.py @@ -70,30 +70,54 @@ class Vec3(object): return obj return None -def Vec3Start(builder): builder.StartObject(6) +def Vec3Start(builder): + return builder.StartObject(6) + def Start(builder): return Vec3Start(builder) -def Vec3AddX(builder, x): builder.PrependFloat64Slot(0, x, 0.0) + +def Vec3AddX(builder, x): + return builder.PrependFloat64Slot(0, x, 0.0) + def AddX(builder, x): return Vec3AddX(builder, x) -def Vec3AddY(builder, y): builder.PrependFloat64Slot(1, y, 0.0) + +def Vec3AddY(builder, y): + return builder.PrependFloat64Slot(1, y, 0.0) + def AddY(builder, y): return Vec3AddY(builder, y) -def Vec3AddZ(builder, z): builder.PrependFloat64Slot(2, z, 0.0) + +def Vec3AddZ(builder, z): + return builder.PrependFloat64Slot(2, z, 0.0) + def AddZ(builder, z): return Vec3AddZ(builder, z) -def Vec3AddTest1(builder, test1): builder.PrependFloat64Slot(3, test1, 0.0) + +def Vec3AddTest1(builder, test1): + return builder.PrependFloat64Slot(3, test1, 0.0) + def AddTest1(builder, test1): return Vec3AddTest1(builder, test1) -def Vec3AddTest2(builder, test2): builder.PrependUint8Slot(4, test2, 0) + +def Vec3AddTest2(builder, test2): + return builder.PrependUint8Slot(4, test2, 0) + def AddTest2(builder, test2): return Vec3AddTest2(builder, test2) -def Vec3AddTest3(builder, test3): builder.PrependStructSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(test3), 0) + +def Vec3AddTest3(builder, test3): + return builder.PrependStructSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(test3), 0) + def AddTest3(builder, test3): return Vec3AddTest3(builder, test3) -def Vec3End(builder): return builder.EndObject() + +def Vec3End(builder): + return builder.EndObject() + def End(builder): return Vec3End(builder) + import MyGame.Example.NestedUnion.Test try: from typing import Optional diff --git a/tests/MyGame/Example/Referrable.py b/tests/MyGame/Example/Referrable.py index 5fd1e24a..e5081e1a 100644 --- a/tests/MyGame/Example/Referrable.py +++ b/tests/MyGame/Example/Referrable.py @@ -35,16 +35,25 @@ class Referrable(object): return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos) return 0 -def ReferrableStart(builder): builder.StartObject(1) +def ReferrableStart(builder): + return builder.StartObject(1) + def Start(builder): return ReferrableStart(builder) -def ReferrableAddId(builder, id): builder.PrependUint64Slot(0, id, 0) + +def ReferrableAddId(builder, id): + return builder.PrependUint64Slot(0, id, 0) + def AddId(builder, id): return ReferrableAddId(builder, id) -def ReferrableEnd(builder): return builder.EndObject() + +def ReferrableEnd(builder): + return builder.EndObject() + def End(builder): return ReferrableEnd(builder) + class ReferrableT(object): # ReferrableT diff --git a/tests/MyGame/Example/Stat.py b/tests/MyGame/Example/Stat.py index 471bc36f..00ca1a46 100644 --- a/tests/MyGame/Example/Stat.py +++ b/tests/MyGame/Example/Stat.py @@ -49,22 +49,37 @@ class Stat(object): return self._tab.Get(flatbuffers.number_types.Uint16Flags, o + self._tab.Pos) return 0 -def StatStart(builder): builder.StartObject(3) +def StatStart(builder): + return builder.StartObject(3) + def Start(builder): return StatStart(builder) -def StatAddId(builder, id): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(id), 0) + +def StatAddId(builder, id): + return builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(id), 0) + def AddId(builder, id): return StatAddId(builder, id) -def StatAddVal(builder, val): builder.PrependInt64Slot(1, val, 0) + +def StatAddVal(builder, val): + return builder.PrependInt64Slot(1, val, 0) + def AddVal(builder, val): return StatAddVal(builder, val) -def StatAddCount(builder, count): builder.PrependUint16Slot(2, count, 0) + +def StatAddCount(builder, count): + return builder.PrependUint16Slot(2, count, 0) + def AddCount(builder, count): return StatAddCount(builder, count) -def StatEnd(builder): return builder.EndObject() + +def StatEnd(builder): + return builder.EndObject() + def End(builder): return StatEnd(builder) + class StatT(object): # StatT diff --git a/tests/MyGame/Example/TestSimpleTableWithEnum.py b/tests/MyGame/Example/TestSimpleTableWithEnum.py index 9e58cc4b..99e5c41b 100644 --- a/tests/MyGame/Example/TestSimpleTableWithEnum.py +++ b/tests/MyGame/Example/TestSimpleTableWithEnum.py @@ -35,16 +35,25 @@ class TestSimpleTableWithEnum(object): return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) return 2 -def TestSimpleTableWithEnumStart(builder): builder.StartObject(1) +def TestSimpleTableWithEnumStart(builder): + return builder.StartObject(1) + def Start(builder): return TestSimpleTableWithEnumStart(builder) -def TestSimpleTableWithEnumAddColor(builder, color): builder.PrependUint8Slot(0, color, 2) + +def TestSimpleTableWithEnumAddColor(builder, color): + return builder.PrependUint8Slot(0, color, 2) + def AddColor(builder, color): return TestSimpleTableWithEnumAddColor(builder, color) -def TestSimpleTableWithEnumEnd(builder): return builder.EndObject() + +def TestSimpleTableWithEnumEnd(builder): + return builder.EndObject() + def End(builder): return TestSimpleTableWithEnumEnd(builder) + class TestSimpleTableWithEnumT(object): # TestSimpleTableWithEnumT diff --git a/tests/MyGame/Example/TypeAliases.py b/tests/MyGame/Example/TypeAliases.py index b3020490..8fb33b9d 100644 --- a/tests/MyGame/Example/TypeAliases.py +++ b/tests/MyGame/Example/TypeAliases.py @@ -152,54 +152,102 @@ class TypeAliases(object): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(26)) return o == 0 -def TypeAliasesStart(builder): builder.StartObject(12) +def TypeAliasesStart(builder): + return builder.StartObject(12) + def Start(builder): return TypeAliasesStart(builder) -def TypeAliasesAddI8(builder, i8): builder.PrependInt8Slot(0, i8, 0) + +def TypeAliasesAddI8(builder, i8): + return builder.PrependInt8Slot(0, i8, 0) + def AddI8(builder, i8): return TypeAliasesAddI8(builder, i8) -def TypeAliasesAddU8(builder, u8): builder.PrependUint8Slot(1, u8, 0) + +def TypeAliasesAddU8(builder, u8): + return builder.PrependUint8Slot(1, u8, 0) + def AddU8(builder, u8): return TypeAliasesAddU8(builder, u8) -def TypeAliasesAddI16(builder, i16): builder.PrependInt16Slot(2, i16, 0) + +def TypeAliasesAddI16(builder, i16): + return builder.PrependInt16Slot(2, i16, 0) + def AddI16(builder, i16): return TypeAliasesAddI16(builder, i16) -def TypeAliasesAddU16(builder, u16): builder.PrependUint16Slot(3, u16, 0) + +def TypeAliasesAddU16(builder, u16): + return builder.PrependUint16Slot(3, u16, 0) + def AddU16(builder, u16): return TypeAliasesAddU16(builder, u16) -def TypeAliasesAddI32(builder, i32): builder.PrependInt32Slot(4, i32, 0) + +def TypeAliasesAddI32(builder, i32): + return builder.PrependInt32Slot(4, i32, 0) + def AddI32(builder, i32): return TypeAliasesAddI32(builder, i32) -def TypeAliasesAddU32(builder, u32): builder.PrependUint32Slot(5, u32, 0) + +def TypeAliasesAddU32(builder, u32): + return builder.PrependUint32Slot(5, u32, 0) + def AddU32(builder, u32): return TypeAliasesAddU32(builder, u32) -def TypeAliasesAddI64(builder, i64): builder.PrependInt64Slot(6, i64, 0) + +def TypeAliasesAddI64(builder, i64): + return builder.PrependInt64Slot(6, i64, 0) + def AddI64(builder, i64): return TypeAliasesAddI64(builder, i64) -def TypeAliasesAddU64(builder, u64): builder.PrependUint64Slot(7, u64, 0) + +def TypeAliasesAddU64(builder, u64): + return builder.PrependUint64Slot(7, u64, 0) + def AddU64(builder, u64): return TypeAliasesAddU64(builder, u64) -def TypeAliasesAddF32(builder, f32): builder.PrependFloat32Slot(8, f32, 0.0) + +def TypeAliasesAddF32(builder, f32): + return builder.PrependFloat32Slot(8, f32, 0.0) + def AddF32(builder, f32): return TypeAliasesAddF32(builder, f32) -def TypeAliasesAddF64(builder, f64): builder.PrependFloat64Slot(9, f64, 0.0) + +def TypeAliasesAddF64(builder, f64): + return builder.PrependFloat64Slot(9, f64, 0.0) + def AddF64(builder, f64): return TypeAliasesAddF64(builder, f64) -def TypeAliasesAddV8(builder, v8): builder.PrependUOffsetTRelativeSlot(10, flatbuffers.number_types.UOffsetTFlags.py_type(v8), 0) + +def TypeAliasesAddV8(builder, v8): + return builder.PrependUOffsetTRelativeSlot(10, flatbuffers.number_types.UOffsetTFlags.py_type(v8), 0) + def AddV8(builder, v8): return TypeAliasesAddV8(builder, v8) -def TypeAliasesStartV8Vector(builder, numElems): return builder.StartVector(1, numElems, 1) + +def TypeAliasesStartV8Vector(builder, numElems): + return builder.StartVector(1, numElems, 1) + def StartV8Vector(builder, numElems): return TypeAliasesStartV8Vector(builder, numElems) -def TypeAliasesAddVf64(builder, vf64): builder.PrependUOffsetTRelativeSlot(11, flatbuffers.number_types.UOffsetTFlags.py_type(vf64), 0) + +def TypeAliasesAddVf64(builder, vf64): + return builder.PrependUOffsetTRelativeSlot(11, flatbuffers.number_types.UOffsetTFlags.py_type(vf64), 0) + def AddVf64(builder, vf64): return TypeAliasesAddVf64(builder, vf64) -def TypeAliasesStartVf64Vector(builder, numElems): return builder.StartVector(8, numElems, 8) + +def TypeAliasesStartVf64Vector(builder, numElems): + return builder.StartVector(8, numElems, 8) + def StartVf64Vector(builder, numElems): return TypeAliasesStartVf64Vector(builder, numElems) -def TypeAliasesEnd(builder): return builder.EndObject() + +def TypeAliasesEnd(builder): + return builder.EndObject() + def End(builder): return TypeAliasesEnd(builder) + try: from typing import List except: diff --git a/tests/MyGame/Example2/Monster.py b/tests/MyGame/Example2/Monster.py index 020efef7..965c4ffd 100644 --- a/tests/MyGame/Example2/Monster.py +++ b/tests/MyGame/Example2/Monster.py @@ -28,13 +28,19 @@ class Monster(object): def Init(self, buf, pos): self._tab = flatbuffers.table.Table(buf, pos) -def MonsterStart(builder): builder.StartObject(0) +def MonsterStart(builder): + return builder.StartObject(0) + def Start(builder): return MonsterStart(builder) -def MonsterEnd(builder): return builder.EndObject() + +def MonsterEnd(builder): + return builder.EndObject() + def End(builder): return MonsterEnd(builder) + class MonsterT(object): # MonsterT diff --git a/tests/MyGame/InParentNamespace.py b/tests/MyGame/InParentNamespace.py index 0914aa46..bd10e695 100644 --- a/tests/MyGame/InParentNamespace.py +++ b/tests/MyGame/InParentNamespace.py @@ -28,13 +28,19 @@ class InParentNamespace(object): def Init(self, buf, pos): self._tab = flatbuffers.table.Table(buf, pos) -def InParentNamespaceStart(builder): builder.StartObject(0) +def InParentNamespaceStart(builder): + return builder.StartObject(0) + def Start(builder): return InParentNamespaceStart(builder) -def InParentNamespaceEnd(builder): return builder.EndObject() + +def InParentNamespaceEnd(builder): + return builder.EndObject() + def End(builder): return InParentNamespaceEnd(builder) + class InParentNamespaceT(object): # InParentNamespaceT diff --git a/tests/MyGame/MonsterExtra.py b/tests/MyGame/MonsterExtra.py index 90916523..10e380b7 100644 --- a/tests/MyGame/MonsterExtra.py +++ b/tests/MyGame/MonsterExtra.py @@ -138,48 +138,90 @@ class MonsterExtra(object): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22)) return o == 0 -def MonsterExtraStart(builder): builder.StartObject(11) +def MonsterExtraStart(builder): + return builder.StartObject(11) + def Start(builder): return MonsterExtraStart(builder) -def MonsterExtraAddD0(builder, d0): builder.PrependFloat64Slot(0, d0, float('nan')) + +def MonsterExtraAddD0(builder, d0): + return builder.PrependFloat64Slot(0, d0, float('nan')) + def AddD0(builder, d0): return MonsterExtraAddD0(builder, d0) -def MonsterExtraAddD1(builder, d1): builder.PrependFloat64Slot(1, d1, float('nan')) + +def MonsterExtraAddD1(builder, d1): + return builder.PrependFloat64Slot(1, d1, float('nan')) + def AddD1(builder, d1): return MonsterExtraAddD1(builder, d1) -def MonsterExtraAddD2(builder, d2): builder.PrependFloat64Slot(2, d2, float('inf')) + +def MonsterExtraAddD2(builder, d2): + return builder.PrependFloat64Slot(2, d2, float('inf')) + def AddD2(builder, d2): return MonsterExtraAddD2(builder, d2) -def MonsterExtraAddD3(builder, d3): builder.PrependFloat64Slot(3, d3, float('-inf')) + +def MonsterExtraAddD3(builder, d3): + return builder.PrependFloat64Slot(3, d3, float('-inf')) + def AddD3(builder, d3): return MonsterExtraAddD3(builder, d3) -def MonsterExtraAddF0(builder, f0): builder.PrependFloat32Slot(4, f0, float('nan')) + +def MonsterExtraAddF0(builder, f0): + return builder.PrependFloat32Slot(4, f0, float('nan')) + def AddF0(builder, f0): return MonsterExtraAddF0(builder, f0) -def MonsterExtraAddF1(builder, f1): builder.PrependFloat32Slot(5, f1, float('nan')) + +def MonsterExtraAddF1(builder, f1): + return builder.PrependFloat32Slot(5, f1, float('nan')) + def AddF1(builder, f1): return MonsterExtraAddF1(builder, f1) -def MonsterExtraAddF2(builder, f2): builder.PrependFloat32Slot(6, f2, float('inf')) + +def MonsterExtraAddF2(builder, f2): + return builder.PrependFloat32Slot(6, f2, float('inf')) + def AddF2(builder, f2): return MonsterExtraAddF2(builder, f2) -def MonsterExtraAddF3(builder, f3): builder.PrependFloat32Slot(7, f3, float('-inf')) + +def MonsterExtraAddF3(builder, f3): + return builder.PrependFloat32Slot(7, f3, float('-inf')) + def AddF3(builder, f3): return MonsterExtraAddF3(builder, f3) -def MonsterExtraAddDvec(builder, dvec): builder.PrependUOffsetTRelativeSlot(8, flatbuffers.number_types.UOffsetTFlags.py_type(dvec), 0) + +def MonsterExtraAddDvec(builder, dvec): + return builder.PrependUOffsetTRelativeSlot(8, flatbuffers.number_types.UOffsetTFlags.py_type(dvec), 0) + def AddDvec(builder, dvec): return MonsterExtraAddDvec(builder, dvec) -def MonsterExtraStartDvecVector(builder, numElems): return builder.StartVector(8, numElems, 8) + +def MonsterExtraStartDvecVector(builder, numElems): + return builder.StartVector(8, numElems, 8) + def StartDvecVector(builder, numElems): return MonsterExtraStartDvecVector(builder, numElems) -def MonsterExtraAddFvec(builder, fvec): builder.PrependUOffsetTRelativeSlot(9, flatbuffers.number_types.UOffsetTFlags.py_type(fvec), 0) + +def MonsterExtraAddFvec(builder, fvec): + return builder.PrependUOffsetTRelativeSlot(9, flatbuffers.number_types.UOffsetTFlags.py_type(fvec), 0) + def AddFvec(builder, fvec): return MonsterExtraAddFvec(builder, fvec) -def MonsterExtraStartFvecVector(builder, numElems): return builder.StartVector(4, numElems, 4) + +def MonsterExtraStartFvecVector(builder, numElems): + return builder.StartVector(4, numElems, 4) + def StartFvecVector(builder, numElems): return MonsterExtraStartFvecVector(builder, numElems) -def MonsterExtraEnd(builder): return builder.EndObject() + +def MonsterExtraEnd(builder): + return builder.EndObject() + def End(builder): return MonsterExtraEnd(builder) + try: from typing import List except: diff --git a/tests/monster_test_generated.py b/tests/monster_test_generated.py index b70c31a2..36bbb602 100644 --- a/tests/monster_test_generated.py +++ b/tests/monster_test_generated.py @@ -108,8 +108,12 @@ 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 InParentNamespaceStart(builder): + return builder.StartObject(0) + +def InParentNamespaceEnd(builder): + return builder.EndObject() + class InParentNamespaceT(object): @@ -169,8 +173,12 @@ 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 MonsterStart(builder): + return builder.StartObject(0) + +def MonsterEnd(builder): + return builder.EndObject() + class MonsterT(object): @@ -297,9 +305,15 @@ 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 TestSimpleTableWithEnumStart(builder): + return builder.StartObject(1) + +def TestSimpleTableWithEnumAddColor(builder, color): + return builder.PrependUint8Slot(0, color, 2) + +def TestSimpleTableWithEnumEnd(builder): + return builder.EndObject() + class TestSimpleTableWithEnumT(object): @@ -693,11 +707,21 @@ 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 StatStart(builder): + return builder.StartObject(3) + +def StatAddId(builder, id): + return builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(id), 0) + +def StatAddVal(builder, val): + return builder.PrependInt64Slot(1, val, 0) + +def StatAddCount(builder, count): + return builder.PrependUint16Slot(2, count, 0) + +def StatEnd(builder): + return builder.EndObject() + class StatT(object): @@ -775,9 +799,15 @@ 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 ReferrableStart(builder): + return builder.StartObject(1) + +def ReferrableAddId(builder, id): + return builder.PrependUint64Slot(0, id, 0) + +def ReferrableEnd(builder): + return builder.EndObject() + class ReferrableT(object): @@ -1021,7 +1051,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 @@ -1552,7 +1582,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 @@ -1671,99 +1701,265 @@ class Monster(object): return self._tab.Get(flatbuffers.number_types.Float64Flags, o + self._tab.Pos) return float('inf') -def MonsterStart(builder): builder.StartObject(62) -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 MonsterStart(builder): + return builder.StartObject(62) + +def MonsterAddPos(builder, pos): + return builder.PrependStructSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(pos), 0) + +def MonsterAddMana(builder, mana): + return builder.PrependInt16Slot(1, mana, 150) + +def MonsterAddHp(builder, hp): + return builder.PrependInt16Slot(2, hp, 100) + +def MonsterAddName(builder, name): + return builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(name), 0) + +def MonsterAddInventory(builder, inventory): + return 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): + return builder.PrependUint8Slot(6, color, 8) + +def MonsterAddTestType(builder, testType): + return builder.PrependUint8Slot(7, testType, 0) + +def MonsterAddTest(builder, test): + return builder.PrependUOffsetTRelativeSlot(8, flatbuffers.number_types.UOffsetTFlags.py_type(test), 0) + +def MonsterAddTest4(builder, test4): + return 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): + return 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): + return 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): + return builder.PrependUOffsetTRelativeSlot(12, flatbuffers.number_types.UOffsetTFlags.py_type(enemy), 0) + +def MonsterAddTestnestedflatbuffer(builder, testnestedflatbuffer): + return 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): 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 MonsterAddTestempty(builder, testempty): + return builder.PrependUOffsetTRelativeSlot(14, flatbuffers.number_types.UOffsetTFlags.py_type(testempty), 0) + +def MonsterAddTestbool(builder, testbool): + return builder.PrependBoolSlot(15, testbool, 0) + +def MonsterAddTesthashs32Fnv1(builder, testhashs32Fnv1): + return builder.PrependInt32Slot(16, testhashs32Fnv1, 0) + +def MonsterAddTesthashu32Fnv1(builder, testhashu32Fnv1): + return builder.PrependUint32Slot(17, testhashu32Fnv1, 0) + +def MonsterAddTesthashs64Fnv1(builder, testhashs64Fnv1): + return builder.PrependInt64Slot(18, testhashs64Fnv1, 0) + +def MonsterAddTesthashu64Fnv1(builder, testhashu64Fnv1): + return builder.PrependUint64Slot(19, testhashu64Fnv1, 0) + +def MonsterAddTesthashs32Fnv1a(builder, testhashs32Fnv1a): + return builder.PrependInt32Slot(20, testhashs32Fnv1a, 0) + +def MonsterAddTesthashu32Fnv1a(builder, testhashu32Fnv1a): + return builder.PrependUint32Slot(21, testhashu32Fnv1a, 0) + +def MonsterAddTesthashs64Fnv1a(builder, testhashs64Fnv1a): + return builder.PrependInt64Slot(22, testhashs64Fnv1a, 0) + +def MonsterAddTesthashu64Fnv1a(builder, testhashu64Fnv1a): + return builder.PrependUint64Slot(23, testhashu64Fnv1a, 0) + +def MonsterAddTestarrayofbools(builder, testarrayofbools): + return 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): + return builder.PrependFloat32Slot(25, testf, 3.14159) + +def MonsterAddTestf2(builder, testf2): + return builder.PrependFloat32Slot(26, testf2, 3.0) + +def MonsterAddTestf3(builder, testf3): + return builder.PrependFloat32Slot(27, testf3, 0.0) + +def MonsterAddTestarrayofstring2(builder, testarrayofstring2): + return 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): + return 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): + return 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): + return 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): + return 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): + return 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): + return builder.PrependUOffsetTRelativeSlot(34, flatbuffers.number_types.UOffsetTFlags.py_type(parentNamespaceTest), 0) + +def MonsterAddVectorOfReferrables(builder, vectorOfReferrables): + return 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): + return builder.PrependUint64Slot(36, singleWeakReference, 0) + +def MonsterAddVectorOfWeakReferences(builder, vectorOfWeakReferences): + return 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): + return 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): + return builder.PrependUint64Slot(39, coOwningReference, 0) + +def MonsterAddVectorOfCoOwningReferences(builder, vectorOfCoOwningReferences): + return 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): + return builder.PrependUint64Slot(41, nonOwningReference, 0) + +def MonsterAddVectorOfNonOwningReferences(builder, vectorOfNonOwningReferences): + return 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): + return builder.PrependUint8Slot(43, anyUniqueType, 0) + +def MonsterAddAnyUnique(builder, anyUnique): + return builder.PrependUOffsetTRelativeSlot(44, flatbuffers.number_types.UOffsetTFlags.py_type(anyUnique), 0) + +def MonsterAddAnyAmbiguousType(builder, anyAmbiguousType): + return builder.PrependUint8Slot(45, anyAmbiguousType, 0) + +def MonsterAddAnyAmbiguous(builder, anyAmbiguous): + return builder.PrependUOffsetTRelativeSlot(46, flatbuffers.number_types.UOffsetTFlags.py_type(anyAmbiguous), 0) + +def MonsterAddVectorOfEnums(builder, vectorOfEnums): + return 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): + return builder.PrependInt8Slot(48, signedEnum, -1) + +def MonsterAddTestrequirednestedflatbuffer(builder, testrequirednestedflatbuffer): + return 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): 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 MonsterAddNativeInline(builder, nativeInline): builder.PrependStructSlot(51, flatbuffers.number_types.UOffsetTFlags.py_type(nativeInline), 0) -def MonsterAddLongEnumNonEnumDefault(builder, longEnumNonEnumDefault): builder.PrependUint64Slot(52, longEnumNonEnumDefault, 0) -def MonsterAddLongEnumNormalDefault(builder, longEnumNormalDefault): builder.PrependUint64Slot(53, longEnumNormalDefault, 2) -def MonsterAddNanDefault(builder, nanDefault): builder.PrependFloat32Slot(54, nanDefault, float('nan')) -def MonsterAddInfDefault(builder, infDefault): builder.PrependFloat32Slot(55, infDefault, float('inf')) -def MonsterAddPositiveInfDefault(builder, positiveInfDefault): builder.PrependFloat32Slot(56, positiveInfDefault, float('inf')) -def MonsterAddInfinityDefault(builder, infinityDefault): builder.PrependFloat32Slot(57, infinityDefault, float('inf')) -def MonsterAddPositiveInfinityDefault(builder, positiveInfinityDefault): builder.PrependFloat32Slot(58, positiveInfinityDefault, float('inf')) -def MonsterAddNegativeInfDefault(builder, negativeInfDefault): builder.PrependFloat32Slot(59, negativeInfDefault, float('-inf')) -def MonsterAddNegativeInfinityDefault(builder, negativeInfinityDefault): builder.PrependFloat32Slot(60, negativeInfinityDefault, float('-inf')) -def MonsterAddDoubleInfDefault(builder, doubleInfDefault): builder.PrependFloat64Slot(61, doubleInfDefault, float('inf')) -def MonsterEnd(builder): return builder.EndObject() +def MonsterAddScalarKeySortedTables(builder, scalarKeySortedTables): + return builder.PrependUOffsetTRelativeSlot(50, flatbuffers.number_types.UOffsetTFlags.py_type(scalarKeySortedTables), 0) + +def MonsterStartScalarKeySortedTablesVector(builder, numElems): + return builder.StartVector(4, numElems, 4) + +def MonsterAddNativeInline(builder, nativeInline): + return builder.PrependStructSlot(51, flatbuffers.number_types.UOffsetTFlags.py_type(nativeInline), 0) + +def MonsterAddLongEnumNonEnumDefault(builder, longEnumNonEnumDefault): + return builder.PrependUint64Slot(52, longEnumNonEnumDefault, 0) + +def MonsterAddLongEnumNormalDefault(builder, longEnumNormalDefault): + return builder.PrependUint64Slot(53, longEnumNormalDefault, 2) + +def MonsterAddNanDefault(builder, nanDefault): + return builder.PrependFloat32Slot(54, nanDefault, float('nan')) + +def MonsterAddInfDefault(builder, infDefault): + return builder.PrependFloat32Slot(55, infDefault, float('inf')) + +def MonsterAddPositiveInfDefault(builder, positiveInfDefault): + return builder.PrependFloat32Slot(56, positiveInfDefault, float('inf')) + +def MonsterAddInfinityDefault(builder, infinityDefault): + return builder.PrependFloat32Slot(57, infinityDefault, float('inf')) + +def MonsterAddPositiveInfinityDefault(builder, positiveInfinityDefault): + return builder.PrependFloat32Slot(58, positiveInfinityDefault, float('inf')) + +def MonsterAddNegativeInfDefault(builder, negativeInfDefault): + return builder.PrependFloat32Slot(59, negativeInfDefault, float('-inf')) + +def MonsterAddNegativeInfinityDefault(builder, negativeInfinityDefault): + return builder.PrependFloat32Slot(60, negativeInfinityDefault, float('-inf')) + +def MonsterAddDoubleInfDefault(builder, doubleInfDefault): + return builder.PrependFloat64Slot(61, doubleInfDefault, float('inf')) + +def MonsterEnd(builder): + return builder.EndObject() + try: from typing import List, Optional, Union @@ -2455,22 +2651,54 @@ 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 TypeAliasesStart(builder): + return builder.StartObject(12) + +def TypeAliasesAddI8(builder, i8): + return builder.PrependInt8Slot(0, i8, 0) + +def TypeAliasesAddU8(builder, u8): + return builder.PrependUint8Slot(1, u8, 0) + +def TypeAliasesAddI16(builder, i16): + return builder.PrependInt16Slot(2, i16, 0) + +def TypeAliasesAddU16(builder, u16): + return builder.PrependUint16Slot(3, u16, 0) + +def TypeAliasesAddI32(builder, i32): + return builder.PrependInt32Slot(4, i32, 0) + +def TypeAliasesAddU32(builder, u32): + return builder.PrependUint32Slot(5, u32, 0) + +def TypeAliasesAddI64(builder, i64): + return builder.PrependInt64Slot(6, i64, 0) + +def TypeAliasesAddU64(builder, u64): + return builder.PrependUint64Slot(7, u64, 0) + +def TypeAliasesAddF32(builder, f32): + return builder.PrependFloat32Slot(8, f32, 0.0) + +def TypeAliasesAddF64(builder, f64): + return builder.PrependFloat64Slot(9, f64, 0.0) + +def TypeAliasesAddV8(builder, v8): + return 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): + return 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() + try: from typing import List diff --git a/tests/optional_scalars/ScalarStuff.py b/tests/optional_scalars/ScalarStuff.py index ca7c253a..b75ba22d 100644 --- a/tests/optional_scalars/ScalarStuff.py +++ b/tests/optional_scalars/ScalarStuff.py @@ -280,121 +280,235 @@ class ScalarStuff(object): return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos) return 1 -def ScalarStuffStart(builder): builder.StartObject(36) +def ScalarStuffStart(builder): + return builder.StartObject(36) + def Start(builder): return ScalarStuffStart(builder) -def ScalarStuffAddJustI8(builder, justI8): builder.PrependInt8Slot(0, justI8, 0) + +def ScalarStuffAddJustI8(builder, justI8): + return builder.PrependInt8Slot(0, justI8, 0) + def AddJustI8(builder, justI8): return ScalarStuffAddJustI8(builder, justI8) -def ScalarStuffAddMaybeI8(builder, maybeI8): builder.PrependInt8Slot(1, maybeI8, None) + +def ScalarStuffAddMaybeI8(builder, maybeI8): + return builder.PrependInt8Slot(1, maybeI8, None) + def AddMaybeI8(builder, maybeI8): return ScalarStuffAddMaybeI8(builder, maybeI8) -def ScalarStuffAddDefaultI8(builder, defaultI8): builder.PrependInt8Slot(2, defaultI8, 42) + +def ScalarStuffAddDefaultI8(builder, defaultI8): + return builder.PrependInt8Slot(2, defaultI8, 42) + def AddDefaultI8(builder, defaultI8): return ScalarStuffAddDefaultI8(builder, defaultI8) -def ScalarStuffAddJustU8(builder, justU8): builder.PrependUint8Slot(3, justU8, 0) + +def ScalarStuffAddJustU8(builder, justU8): + return builder.PrependUint8Slot(3, justU8, 0) + def AddJustU8(builder, justU8): return ScalarStuffAddJustU8(builder, justU8) -def ScalarStuffAddMaybeU8(builder, maybeU8): builder.PrependUint8Slot(4, maybeU8, None) + +def ScalarStuffAddMaybeU8(builder, maybeU8): + return builder.PrependUint8Slot(4, maybeU8, None) + def AddMaybeU8(builder, maybeU8): return ScalarStuffAddMaybeU8(builder, maybeU8) -def ScalarStuffAddDefaultU8(builder, defaultU8): builder.PrependUint8Slot(5, defaultU8, 42) + +def ScalarStuffAddDefaultU8(builder, defaultU8): + return builder.PrependUint8Slot(5, defaultU8, 42) + def AddDefaultU8(builder, defaultU8): return ScalarStuffAddDefaultU8(builder, defaultU8) -def ScalarStuffAddJustI16(builder, justI16): builder.PrependInt16Slot(6, justI16, 0) + +def ScalarStuffAddJustI16(builder, justI16): + return builder.PrependInt16Slot(6, justI16, 0) + def AddJustI16(builder, justI16): return ScalarStuffAddJustI16(builder, justI16) -def ScalarStuffAddMaybeI16(builder, maybeI16): builder.PrependInt16Slot(7, maybeI16, None) + +def ScalarStuffAddMaybeI16(builder, maybeI16): + return builder.PrependInt16Slot(7, maybeI16, None) + def AddMaybeI16(builder, maybeI16): return ScalarStuffAddMaybeI16(builder, maybeI16) -def ScalarStuffAddDefaultI16(builder, defaultI16): builder.PrependInt16Slot(8, defaultI16, 42) + +def ScalarStuffAddDefaultI16(builder, defaultI16): + return builder.PrependInt16Slot(8, defaultI16, 42) + def AddDefaultI16(builder, defaultI16): return ScalarStuffAddDefaultI16(builder, defaultI16) -def ScalarStuffAddJustU16(builder, justU16): builder.PrependUint16Slot(9, justU16, 0) + +def ScalarStuffAddJustU16(builder, justU16): + return builder.PrependUint16Slot(9, justU16, 0) + def AddJustU16(builder, justU16): return ScalarStuffAddJustU16(builder, justU16) -def ScalarStuffAddMaybeU16(builder, maybeU16): builder.PrependUint16Slot(10, maybeU16, None) + +def ScalarStuffAddMaybeU16(builder, maybeU16): + return builder.PrependUint16Slot(10, maybeU16, None) + def AddMaybeU16(builder, maybeU16): return ScalarStuffAddMaybeU16(builder, maybeU16) -def ScalarStuffAddDefaultU16(builder, defaultU16): builder.PrependUint16Slot(11, defaultU16, 42) + +def ScalarStuffAddDefaultU16(builder, defaultU16): + return builder.PrependUint16Slot(11, defaultU16, 42) + def AddDefaultU16(builder, defaultU16): return ScalarStuffAddDefaultU16(builder, defaultU16) -def ScalarStuffAddJustI32(builder, justI32): builder.PrependInt32Slot(12, justI32, 0) + +def ScalarStuffAddJustI32(builder, justI32): + return builder.PrependInt32Slot(12, justI32, 0) + def AddJustI32(builder, justI32): return ScalarStuffAddJustI32(builder, justI32) -def ScalarStuffAddMaybeI32(builder, maybeI32): builder.PrependInt32Slot(13, maybeI32, None) + +def ScalarStuffAddMaybeI32(builder, maybeI32): + return builder.PrependInt32Slot(13, maybeI32, None) + def AddMaybeI32(builder, maybeI32): return ScalarStuffAddMaybeI32(builder, maybeI32) -def ScalarStuffAddDefaultI32(builder, defaultI32): builder.PrependInt32Slot(14, defaultI32, 42) + +def ScalarStuffAddDefaultI32(builder, defaultI32): + return builder.PrependInt32Slot(14, defaultI32, 42) + def AddDefaultI32(builder, defaultI32): return ScalarStuffAddDefaultI32(builder, defaultI32) -def ScalarStuffAddJustU32(builder, justU32): builder.PrependUint32Slot(15, justU32, 0) + +def ScalarStuffAddJustU32(builder, justU32): + return builder.PrependUint32Slot(15, justU32, 0) + def AddJustU32(builder, justU32): return ScalarStuffAddJustU32(builder, justU32) -def ScalarStuffAddMaybeU32(builder, maybeU32): builder.PrependUint32Slot(16, maybeU32, None) + +def ScalarStuffAddMaybeU32(builder, maybeU32): + return builder.PrependUint32Slot(16, maybeU32, None) + def AddMaybeU32(builder, maybeU32): return ScalarStuffAddMaybeU32(builder, maybeU32) -def ScalarStuffAddDefaultU32(builder, defaultU32): builder.PrependUint32Slot(17, defaultU32, 42) + +def ScalarStuffAddDefaultU32(builder, defaultU32): + return builder.PrependUint32Slot(17, defaultU32, 42) + def AddDefaultU32(builder, defaultU32): return ScalarStuffAddDefaultU32(builder, defaultU32) -def ScalarStuffAddJustI64(builder, justI64): builder.PrependInt64Slot(18, justI64, 0) + +def ScalarStuffAddJustI64(builder, justI64): + return builder.PrependInt64Slot(18, justI64, 0) + def AddJustI64(builder, justI64): return ScalarStuffAddJustI64(builder, justI64) -def ScalarStuffAddMaybeI64(builder, maybeI64): builder.PrependInt64Slot(19, maybeI64, None) + +def ScalarStuffAddMaybeI64(builder, maybeI64): + return builder.PrependInt64Slot(19, maybeI64, None) + def AddMaybeI64(builder, maybeI64): return ScalarStuffAddMaybeI64(builder, maybeI64) -def ScalarStuffAddDefaultI64(builder, defaultI64): builder.PrependInt64Slot(20, defaultI64, 42) + +def ScalarStuffAddDefaultI64(builder, defaultI64): + return builder.PrependInt64Slot(20, defaultI64, 42) + def AddDefaultI64(builder, defaultI64): return ScalarStuffAddDefaultI64(builder, defaultI64) -def ScalarStuffAddJustU64(builder, justU64): builder.PrependUint64Slot(21, justU64, 0) + +def ScalarStuffAddJustU64(builder, justU64): + return builder.PrependUint64Slot(21, justU64, 0) + def AddJustU64(builder, justU64): return ScalarStuffAddJustU64(builder, justU64) -def ScalarStuffAddMaybeU64(builder, maybeU64): builder.PrependUint64Slot(22, maybeU64, None) + +def ScalarStuffAddMaybeU64(builder, maybeU64): + return builder.PrependUint64Slot(22, maybeU64, None) + def AddMaybeU64(builder, maybeU64): return ScalarStuffAddMaybeU64(builder, maybeU64) -def ScalarStuffAddDefaultU64(builder, defaultU64): builder.PrependUint64Slot(23, defaultU64, 42) + +def ScalarStuffAddDefaultU64(builder, defaultU64): + return builder.PrependUint64Slot(23, defaultU64, 42) + def AddDefaultU64(builder, defaultU64): return ScalarStuffAddDefaultU64(builder, defaultU64) -def ScalarStuffAddJustF32(builder, justF32): builder.PrependFloat32Slot(24, justF32, 0.0) + +def ScalarStuffAddJustF32(builder, justF32): + return builder.PrependFloat32Slot(24, justF32, 0.0) + def AddJustF32(builder, justF32): return ScalarStuffAddJustF32(builder, justF32) -def ScalarStuffAddMaybeF32(builder, maybeF32): builder.PrependFloat32Slot(25, maybeF32, None) + +def ScalarStuffAddMaybeF32(builder, maybeF32): + return builder.PrependFloat32Slot(25, maybeF32, None) + def AddMaybeF32(builder, maybeF32): return ScalarStuffAddMaybeF32(builder, maybeF32) -def ScalarStuffAddDefaultF32(builder, defaultF32): builder.PrependFloat32Slot(26, defaultF32, 42.0) + +def ScalarStuffAddDefaultF32(builder, defaultF32): + return builder.PrependFloat32Slot(26, defaultF32, 42.0) + def AddDefaultF32(builder, defaultF32): return ScalarStuffAddDefaultF32(builder, defaultF32) -def ScalarStuffAddJustF64(builder, justF64): builder.PrependFloat64Slot(27, justF64, 0.0) + +def ScalarStuffAddJustF64(builder, justF64): + return builder.PrependFloat64Slot(27, justF64, 0.0) + def AddJustF64(builder, justF64): return ScalarStuffAddJustF64(builder, justF64) -def ScalarStuffAddMaybeF64(builder, maybeF64): builder.PrependFloat64Slot(28, maybeF64, None) + +def ScalarStuffAddMaybeF64(builder, maybeF64): + return builder.PrependFloat64Slot(28, maybeF64, None) + def AddMaybeF64(builder, maybeF64): return ScalarStuffAddMaybeF64(builder, maybeF64) -def ScalarStuffAddDefaultF64(builder, defaultF64): builder.PrependFloat64Slot(29, defaultF64, 42.0) + +def ScalarStuffAddDefaultF64(builder, defaultF64): + return builder.PrependFloat64Slot(29, defaultF64, 42.0) + def AddDefaultF64(builder, defaultF64): return ScalarStuffAddDefaultF64(builder, defaultF64) -def ScalarStuffAddJustBool(builder, justBool): builder.PrependBoolSlot(30, justBool, 0) + +def ScalarStuffAddJustBool(builder, justBool): + return builder.PrependBoolSlot(30, justBool, 0) + def AddJustBool(builder, justBool): return ScalarStuffAddJustBool(builder, justBool) -def ScalarStuffAddMaybeBool(builder, maybeBool): builder.PrependBoolSlot(31, maybeBool, None) + +def ScalarStuffAddMaybeBool(builder, maybeBool): + return builder.PrependBoolSlot(31, maybeBool, None) + def AddMaybeBool(builder, maybeBool): return ScalarStuffAddMaybeBool(builder, maybeBool) -def ScalarStuffAddDefaultBool(builder, defaultBool): builder.PrependBoolSlot(32, defaultBool, 1) + +def ScalarStuffAddDefaultBool(builder, defaultBool): + return builder.PrependBoolSlot(32, defaultBool, 1) + def AddDefaultBool(builder, defaultBool): return ScalarStuffAddDefaultBool(builder, defaultBool) -def ScalarStuffAddJustEnum(builder, justEnum): builder.PrependInt8Slot(33, justEnum, 0) + +def ScalarStuffAddJustEnum(builder, justEnum): + return builder.PrependInt8Slot(33, justEnum, 0) + def AddJustEnum(builder, justEnum): return ScalarStuffAddJustEnum(builder, justEnum) -def ScalarStuffAddMaybeEnum(builder, maybeEnum): builder.PrependInt8Slot(34, maybeEnum, None) + +def ScalarStuffAddMaybeEnum(builder, maybeEnum): + return builder.PrependInt8Slot(34, maybeEnum, None) + def AddMaybeEnum(builder, maybeEnum): return ScalarStuffAddMaybeEnum(builder, maybeEnum) -def ScalarStuffAddDefaultEnum(builder, defaultEnum): builder.PrependInt8Slot(35, defaultEnum, 1) + +def ScalarStuffAddDefaultEnum(builder, defaultEnum): + return builder.PrependInt8Slot(35, defaultEnum, 1) + def AddDefaultEnum(builder, defaultEnum): return ScalarStuffAddDefaultEnum(builder, defaultEnum) -def ScalarStuffEnd(builder): return builder.EndObject() + +def ScalarStuffEnd(builder): + return builder.EndObject() + def End(builder): return ScalarStuffEnd(builder) + class ScalarStuffT(object): # ScalarStuffT |