summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChih-Hsuan Yen <1937689+yan12125@users.noreply.github.com>2023-05-18 04:10:51 +0800
committerGitHub <noreply@github.com>2023-05-17 13:10:51 -0700
commita352bdbc34130aea537040cd2bfe9eb73d63c74b (patch)
tree4b67fb83af3870872a8fa90590e54256fd6bc696
parentcb14043f820271287ec0a487467612c1932c80f9 (diff)
downloadflatbuffers-a352bdbc34130aea537040cd2bfe9eb73d63c74b.tar.gz
flatbuffers-a352bdbc34130aea537040cd2bfe9eb73d63c74b.tar.bz2
flatbuffers-a352bdbc34130aea537040cd2bfe9eb73d63c74b.zip
Fix python tests (#7960)
* Don't generate types unless --python-typing specified Fixes https://github.com/google/flatbuffers/issues/7944 * Fix incorrect import statements Fixes https://github.com/google/flatbuffers/issues/7951 * Fix $PYTHONPATH in PythonTest.sh Regressed from https://github.com/google/flatbuffers/pull/7529 * PythonTest: fail if something goes wrong GitHub Actions runs `bash PythonTest.sh`, and thus failures were not visible. * Build flatc for Python tests * Regenerate codes --------- Co-authored-by: Derek Bailey <derekbailey@google.com>
-rw-r--r--.github/workflows/build.yml3
-rw-r--r--grpc/examples/python/greeter/models/HelloReply.py2
-rw-r--r--grpc/examples/python/greeter/models/HelloRequest.py2
-rw-r--r--python/flatbuffers/reflection/Enum.py20
-rw-r--r--python/flatbuffers/reflection/EnumVal.py14
-rw-r--r--python/flatbuffers/reflection/Field.py32
-rw-r--r--python/flatbuffers/reflection/KeyValue.py4
-rw-r--r--python/flatbuffers/reflection/Object.py20
-rw-r--r--python/flatbuffers/reflection/RPCCall.py16
-rw-r--r--python/flatbuffers/reflection/Schema.py26
-rw-r--r--python/flatbuffers/reflection/SchemaFile.py4
-rw-r--r--python/flatbuffers/reflection/Service.py14
-rw-r--r--python/flatbuffers/reflection/Type.py12
-rw-r--r--src/idl_gen_python.cpp17
-rw-r--r--tests/MyGame/Example/ArrayStruct.py2
-rw-r--r--tests/MyGame/Example/ArrayTable.py2
-rw-r--r--tests/MyGame/Example/Monster.py150
-rw-r--r--tests/MyGame/Example/NestedUnion/Vec3.py2
-rw-r--r--tests/MyGame/Example/Referrable.py2
-rw-r--r--tests/MyGame/Example/Stat.py6
-rw-r--r--tests/MyGame/Example/TestSimpleTableWithEnum.py2
-rw-r--r--tests/MyGame/Example/TypeAliases.py24
-rwxr-xr-xtests/PythonTest.sh6
-rw-r--r--tests/monster_test_generated.py4
-rw-r--r--tests/optional_scalars/ScalarStuff.py72
25 files changed, 234 insertions, 224 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 23f4bb33..dcbf6260 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -467,6 +467,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
+ - name: flatc
+ # FIXME: make test script not rely on flatc
+ run: cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DFLATBUFFERS_BUILD_TESTS=OFF -DFLATBUFFERS_INSTALL=OFF -DFLATBUFFERS_BUILD_FLATLIB=OFF -DFLATBUFFERS_BUILD_FLATHASH=OFF -DFLATBUFFERS_STRICT_MODE=ON . && make -j
- name: test
working-directory: tests
run: bash PythonTest.sh
diff --git a/grpc/examples/python/greeter/models/HelloReply.py b/grpc/examples/python/greeter/models/HelloReply.py
index bf182fc8..b1adc8c3 100644
--- a/grpc/examples/python/greeter/models/HelloReply.py
+++ b/grpc/examples/python/greeter/models/HelloReply.py
@@ -40,7 +40,7 @@ def Start(builder):
def HelloReplyAddMessage(builder, message):
builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(message), 0)
-def AddMessage(builder: flatbuffers.Builder, message: int):
+def AddMessage(builder, message):
HelloReplyAddMessage(builder, message)
def HelloReplyEnd(builder):
diff --git a/grpc/examples/python/greeter/models/HelloRequest.py b/grpc/examples/python/greeter/models/HelloRequest.py
index 9df6b22c..db217dd2 100644
--- a/grpc/examples/python/greeter/models/HelloRequest.py
+++ b/grpc/examples/python/greeter/models/HelloRequest.py
@@ -40,7 +40,7 @@ def Start(builder):
def HelloRequestAddName(builder, name):
builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(name), 0)
-def AddName(builder: flatbuffers.Builder, name: int):
+def AddName(builder, name):
HelloRequestAddName(builder, name)
def HelloRequestEnd(builder):
diff --git a/python/flatbuffers/reflection/Enum.py b/python/flatbuffers/reflection/Enum.py
index fd4c410a..2d484c0b 100644
--- a/python/flatbuffers/reflection/Enum.py
+++ b/python/flatbuffers/reflection/Enum.py
@@ -42,7 +42,7 @@ class Enum(object):
x = self._tab.Vector(o)
x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
x = self._tab.Indirect(x)
- from .reflection.EnumVal import EnumVal
+ from reflection.EnumVal import EnumVal
obj = EnumVal()
obj.Init(self._tab.Bytes, x)
return obj
@@ -72,7 +72,7 @@ class Enum(object):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
if o != 0:
x = self._tab.Indirect(o + self._tab.Pos)
- from .reflection.Type import Type
+ from reflection.Type import Type
obj = Type()
obj.Init(self._tab.Bytes, x)
return obj
@@ -85,7 +85,7 @@ class Enum(object):
x = self._tab.Vector(o)
x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
x = self._tab.Indirect(x)
- from .reflection.KeyValue import KeyValue
+ from reflection.KeyValue import KeyValue
obj = KeyValue()
obj.Init(self._tab.Bytes, x)
return obj
@@ -140,13 +140,13 @@ def Start(builder):
def EnumAddName(builder, name):
builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(name), 0)
-def AddName(builder: flatbuffers.Builder, name: int):
+def AddName(builder, name):
EnumAddName(builder, name)
def EnumAddValues(builder, values):
builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(values), 0)
-def AddValues(builder: flatbuffers.Builder, values: int):
+def AddValues(builder, values):
EnumAddValues(builder, values)
def EnumStartValuesVector(builder, numElems):
@@ -158,19 +158,19 @@ def StartValuesVector(builder, numElems: int) -> int:
def EnumAddIsUnion(builder, isUnion):
builder.PrependBoolSlot(2, isUnion, 0)
-def AddIsUnion(builder: flatbuffers.Builder, isUnion: bool):
+def AddIsUnion(builder, isUnion):
EnumAddIsUnion(builder, isUnion)
def EnumAddUnderlyingType(builder, underlyingType):
builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(underlyingType), 0)
-def AddUnderlyingType(builder: flatbuffers.Builder, underlyingType: int):
+def AddUnderlyingType(builder, underlyingType):
EnumAddUnderlyingType(builder, underlyingType)
def EnumAddAttributes(builder, attributes):
builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(attributes), 0)
-def AddAttributes(builder: flatbuffers.Builder, attributes: int):
+def AddAttributes(builder, attributes):
EnumAddAttributes(builder, attributes)
def EnumStartAttributesVector(builder, numElems):
@@ -182,7 +182,7 @@ def StartAttributesVector(builder, numElems: int) -> int:
def EnumAddDocumentation(builder, documentation):
builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(documentation), 0)
-def AddDocumentation(builder: flatbuffers.Builder, documentation: int):
+def AddDocumentation(builder, documentation):
EnumAddDocumentation(builder, documentation)
def EnumStartDocumentationVector(builder, numElems):
@@ -194,7 +194,7 @@ def StartDocumentationVector(builder, numElems: int) -> int:
def EnumAddDeclarationFile(builder, declarationFile):
builder.PrependUOffsetTRelativeSlot(6, flatbuffers.number_types.UOffsetTFlags.py_type(declarationFile), 0)
-def AddDeclarationFile(builder: flatbuffers.Builder, declarationFile: int):
+def AddDeclarationFile(builder, declarationFile):
EnumAddDeclarationFile(builder, declarationFile)
def EnumEnd(builder):
diff --git a/python/flatbuffers/reflection/EnumVal.py b/python/flatbuffers/reflection/EnumVal.py
index 207dd843..3da936b4 100644
--- a/python/flatbuffers/reflection/EnumVal.py
+++ b/python/flatbuffers/reflection/EnumVal.py
@@ -47,7 +47,7 @@ class EnumVal(object):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
if o != 0:
x = self._tab.Indirect(o + self._tab.Pos)
- from .reflection.Type import Type
+ from reflection.Type import Type
obj = Type()
obj.Init(self._tab.Bytes, x)
return obj
@@ -80,7 +80,7 @@ class EnumVal(object):
x = self._tab.Vector(o)
x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
x = self._tab.Indirect(x)
- from .reflection.KeyValue import KeyValue
+ from reflection.KeyValue import KeyValue
obj = KeyValue()
obj.Init(self._tab.Bytes, x)
return obj
@@ -107,25 +107,25 @@ def Start(builder):
def EnumValAddName(builder, name):
builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(name), 0)
-def AddName(builder: flatbuffers.Builder, name: int):
+def AddName(builder, name):
EnumValAddName(builder, name)
def EnumValAddValue(builder, value):
builder.PrependInt64Slot(1, value, 0)
-def AddValue(builder: flatbuffers.Builder, value: int):
+def AddValue(builder, value):
EnumValAddValue(builder, value)
def EnumValAddUnionType(builder, unionType):
builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(unionType), 0)
-def AddUnionType(builder: flatbuffers.Builder, unionType: int):
+def AddUnionType(builder, unionType):
EnumValAddUnionType(builder, unionType)
def EnumValAddDocumentation(builder, documentation):
builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(documentation), 0)
-def AddDocumentation(builder: flatbuffers.Builder, documentation: int):
+def AddDocumentation(builder, documentation):
EnumValAddDocumentation(builder, documentation)
def EnumValStartDocumentationVector(builder, numElems):
@@ -137,7 +137,7 @@ def StartDocumentationVector(builder, numElems: int) -> int:
def EnumValAddAttributes(builder, attributes):
builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(attributes), 0)
-def AddAttributes(builder: flatbuffers.Builder, attributes: int):
+def AddAttributes(builder, attributes):
EnumValAddAttributes(builder, attributes)
def EnumValStartAttributesVector(builder, numElems):
diff --git a/python/flatbuffers/reflection/Field.py b/python/flatbuffers/reflection/Field.py
index 9e29e748..eb70891a 100644
--- a/python/flatbuffers/reflection/Field.py
+++ b/python/flatbuffers/reflection/Field.py
@@ -40,7 +40,7 @@ class Field(object):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
if o != 0:
x = self._tab.Indirect(o + self._tab.Pos)
- from .reflection.Type import Type
+ from reflection.Type import Type
obj = Type()
obj.Init(self._tab.Bytes, x)
return obj
@@ -102,7 +102,7 @@ class Field(object):
x = self._tab.Vector(o)
x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
x = self._tab.Indirect(x)
- from .reflection.KeyValue import KeyValue
+ from reflection.KeyValue import KeyValue
obj = KeyValue()
obj.Init(self._tab.Bytes, x)
return obj
@@ -172,61 +172,61 @@ def Start(builder):
def FieldAddName(builder, name):
builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(name), 0)
-def AddName(builder: flatbuffers.Builder, name: int):
+def AddName(builder, name):
FieldAddName(builder, name)
def FieldAddType(builder, type):
builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(type), 0)
-def AddType(builder: flatbuffers.Builder, type: int):
+def AddType(builder, type):
FieldAddType(builder, type)
def FieldAddId(builder, id):
builder.PrependUint16Slot(2, id, 0)
-def AddId(builder: flatbuffers.Builder, id: int):
+def AddId(builder, id):
FieldAddId(builder, id)
def FieldAddOffset(builder, offset):
builder.PrependUint16Slot(3, offset, 0)
-def AddOffset(builder: flatbuffers.Builder, offset: int):
+def AddOffset(builder, offset):
FieldAddOffset(builder, offset)
def FieldAddDefaultInteger(builder, defaultInteger):
builder.PrependInt64Slot(4, defaultInteger, 0)
-def AddDefaultInteger(builder: flatbuffers.Builder, defaultInteger: int):
+def AddDefaultInteger(builder, defaultInteger):
FieldAddDefaultInteger(builder, defaultInteger)
def FieldAddDefaultReal(builder, defaultReal):
builder.PrependFloat64Slot(5, defaultReal, 0.0)
-def AddDefaultReal(builder: flatbuffers.Builder, defaultReal: float):
+def AddDefaultReal(builder, defaultReal):
FieldAddDefaultReal(builder, defaultReal)
def FieldAddDeprecated(builder, deprecated):
builder.PrependBoolSlot(6, deprecated, 0)
-def AddDeprecated(builder: flatbuffers.Builder, deprecated: bool):
+def AddDeprecated(builder, deprecated):
FieldAddDeprecated(builder, deprecated)
def FieldAddRequired(builder, required):
builder.PrependBoolSlot(7, required, 0)
-def AddRequired(builder: flatbuffers.Builder, required: bool):
+def AddRequired(builder, required):
FieldAddRequired(builder, required)
def FieldAddKey(builder, key):
builder.PrependBoolSlot(8, key, 0)
-def AddKey(builder: flatbuffers.Builder, key: bool):
+def AddKey(builder, key):
FieldAddKey(builder, key)
def FieldAddAttributes(builder, attributes):
builder.PrependUOffsetTRelativeSlot(9, flatbuffers.number_types.UOffsetTFlags.py_type(attributes), 0)
-def AddAttributes(builder: flatbuffers.Builder, attributes: int):
+def AddAttributes(builder, attributes):
FieldAddAttributes(builder, attributes)
def FieldStartAttributesVector(builder, numElems):
@@ -238,7 +238,7 @@ def StartAttributesVector(builder, numElems: int) -> int:
def FieldAddDocumentation(builder, documentation):
builder.PrependUOffsetTRelativeSlot(10, flatbuffers.number_types.UOffsetTFlags.py_type(documentation), 0)
-def AddDocumentation(builder: flatbuffers.Builder, documentation: int):
+def AddDocumentation(builder, documentation):
FieldAddDocumentation(builder, documentation)
def FieldStartDocumentationVector(builder, numElems):
@@ -250,19 +250,19 @@ def StartDocumentationVector(builder, numElems: int) -> int:
def FieldAddOptional(builder, optional):
builder.PrependBoolSlot(11, optional, 0)
-def AddOptional(builder: flatbuffers.Builder, optional: bool):
+def AddOptional(builder, optional):
FieldAddOptional(builder, optional)
def FieldAddPadding(builder, padding):
builder.PrependUint16Slot(12, padding, 0)
-def AddPadding(builder: flatbuffers.Builder, padding: int):
+def AddPadding(builder, padding):
FieldAddPadding(builder, padding)
def FieldAddOffset64(builder, offset64):
builder.PrependBoolSlot(13, offset64, 0)
-def AddOffset64(builder: flatbuffers.Builder, offset64: bool):
+def AddOffset64(builder, offset64):
FieldAddOffset64(builder, offset64)
def FieldEnd(builder):
diff --git a/python/flatbuffers/reflection/KeyValue.py b/python/flatbuffers/reflection/KeyValue.py
index fb9014c9..585f99aa 100644
--- a/python/flatbuffers/reflection/KeyValue.py
+++ b/python/flatbuffers/reflection/KeyValue.py
@@ -51,13 +51,13 @@ def Start(builder):
def KeyValueAddKey(builder, key):
builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(key), 0)
-def AddKey(builder: flatbuffers.Builder, key: int):
+def AddKey(builder, key):
KeyValueAddKey(builder, key)
def KeyValueAddValue(builder, value):
builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(value), 0)
-def AddValue(builder: flatbuffers.Builder, value: int):
+def AddValue(builder, value):
KeyValueAddValue(builder, value)
def KeyValueEnd(builder):
diff --git a/python/flatbuffers/reflection/Object.py b/python/flatbuffers/reflection/Object.py
index 139e0627..33b05733 100644
--- a/python/flatbuffers/reflection/Object.py
+++ b/python/flatbuffers/reflection/Object.py
@@ -42,7 +42,7 @@ class Object(object):
x = self._tab.Vector(o)
x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
x = self._tab.Indirect(x)
- from .reflection.Field import Field
+ from reflection.Field import Field
obj = Field()
obj.Init(self._tab.Bytes, x)
return obj
@@ -88,7 +88,7 @@ class Object(object):
x = self._tab.Vector(o)
x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
x = self._tab.Indirect(x)
- from .reflection.KeyValue import KeyValue
+ from reflection.KeyValue import KeyValue
obj = KeyValue()
obj.Init(self._tab.Bytes, x)
return obj
@@ -143,13 +143,13 @@ def Start(builder):
def ObjectAddName(builder, name):
builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(name), 0)
-def AddName(builder: flatbuffers.Builder, name: int):
+def AddName(builder, name):
ObjectAddName(builder, name)
def ObjectAddFields(builder, fields):
builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(fields), 0)
-def AddFields(builder: flatbuffers.Builder, fields: int):
+def AddFields(builder, fields):
ObjectAddFields(builder, fields)
def ObjectStartFieldsVector(builder, numElems):
@@ -161,25 +161,25 @@ def StartFieldsVector(builder, numElems: int) -> int:
def ObjectAddIsStruct(builder, isStruct):
builder.PrependBoolSlot(2, isStruct, 0)
-def AddIsStruct(builder: flatbuffers.Builder, isStruct: bool):
+def AddIsStruct(builder, isStruct):
ObjectAddIsStruct(builder, isStruct)
def ObjectAddMinalign(builder, minalign):
builder.PrependInt32Slot(3, minalign, 0)
-def AddMinalign(builder: flatbuffers.Builder, minalign: int):
+def AddMinalign(builder, minalign):
ObjectAddMinalign(builder, minalign)
def ObjectAddBytesize(builder, bytesize):
builder.PrependInt32Slot(4, bytesize, 0)
-def AddBytesize(builder: flatbuffers.Builder, bytesize: int):
+def AddBytesize(builder, bytesize):
ObjectAddBytesize(builder, bytesize)
def ObjectAddAttributes(builder, attributes):
builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(attributes), 0)
-def AddAttributes(builder: flatbuffers.Builder, attributes: int):
+def AddAttributes(builder, attributes):
ObjectAddAttributes(builder, attributes)
def ObjectStartAttributesVector(builder, numElems):
@@ -191,7 +191,7 @@ def StartAttributesVector(builder, numElems: int) -> int:
def ObjectAddDocumentation(builder, documentation):
builder.PrependUOffsetTRelativeSlot(6, flatbuffers.number_types.UOffsetTFlags.py_type(documentation), 0)
-def AddDocumentation(builder: flatbuffers.Builder, documentation: int):
+def AddDocumentation(builder, documentation):
ObjectAddDocumentation(builder, documentation)
def ObjectStartDocumentationVector(builder, numElems):
@@ -203,7 +203,7 @@ def StartDocumentationVector(builder, numElems: int) -> int:
def ObjectAddDeclarationFile(builder, declarationFile):
builder.PrependUOffsetTRelativeSlot(7, flatbuffers.number_types.UOffsetTFlags.py_type(declarationFile), 0)
-def AddDeclarationFile(builder: flatbuffers.Builder, declarationFile: int):
+def AddDeclarationFile(builder, declarationFile):
ObjectAddDeclarationFile(builder, declarationFile)
def ObjectEnd(builder):
diff --git a/python/flatbuffers/reflection/RPCCall.py b/python/flatbuffers/reflection/RPCCall.py
index f78edec0..3fd7ff84 100644
--- a/python/flatbuffers/reflection/RPCCall.py
+++ b/python/flatbuffers/reflection/RPCCall.py
@@ -40,7 +40,7 @@ class RPCCall(object):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
if o != 0:
x = self._tab.Indirect(o + self._tab.Pos)
- from .reflection.Object import Object
+ from reflection.Object import Object
obj = Object()
obj.Init(self._tab.Bytes, x)
return obj
@@ -51,7 +51,7 @@ class RPCCall(object):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
if o != 0:
x = self._tab.Indirect(o + self._tab.Pos)
- from .reflection.Object import Object
+ from reflection.Object import Object
obj = Object()
obj.Init(self._tab.Bytes, x)
return obj
@@ -64,7 +64,7 @@ class RPCCall(object):
x = self._tab.Vector(o)
x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
x = self._tab.Indirect(x)
- from .reflection.KeyValue import KeyValue
+ from reflection.KeyValue import KeyValue
obj = KeyValue()
obj.Init(self._tab.Bytes, x)
return obj
@@ -111,25 +111,25 @@ def Start(builder):
def RPCCallAddName(builder, name):
builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(name), 0)
-def AddName(builder: flatbuffers.Builder, name: int):
+def AddName(builder, name):
RPCCallAddName(builder, name)
def RPCCallAddRequest(builder, request):
builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(request), 0)
-def AddRequest(builder: flatbuffers.Builder, request: int):
+def AddRequest(builder, request):
RPCCallAddRequest(builder, request)
def RPCCallAddResponse(builder, response):
builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(response), 0)
-def AddResponse(builder: flatbuffers.Builder, response: int):
+def AddResponse(builder, response):
RPCCallAddResponse(builder, response)
def RPCCallAddAttributes(builder, attributes):
builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(attributes), 0)
-def AddAttributes(builder: flatbuffers.Builder, attributes: int):
+def AddAttributes(builder, attributes):
RPCCallAddAttributes(builder, attributes)
def RPCCallStartAttributesVector(builder, numElems):
@@ -141,7 +141,7 @@ def StartAttributesVector(builder, numElems: int) -> int:
def RPCCallAddDocumentation(builder, documentation):
builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(documentation), 0)
-def AddDocumentation(builder: flatbuffers.Builder, documentation: int):
+def AddDocumentation(builder, documentation):
RPCCallAddDocumentation(builder, documentation)
def RPCCallStartDocumentationVector(builder, numElems):
diff --git a/python/flatbuffers/reflection/Schema.py b/python/flatbuffers/reflection/Schema.py
index 06df1a04..61ebb196 100644
--- a/python/flatbuffers/reflection/Schema.py
+++ b/python/flatbuffers/reflection/Schema.py
@@ -35,7 +35,7 @@ class Schema(object):
x = self._tab.Vector(o)
x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
x = self._tab.Indirect(x)
- from .reflection.Object import Object
+ from reflection.Object import Object
obj = Object()
obj.Init(self._tab.Bytes, x)
return obj
@@ -60,7 +60,7 @@ class Schema(object):
x = self._tab.Vector(o)
x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
x = self._tab.Indirect(x)
- from .reflection.Enum import Enum
+ from reflection.Enum import Enum
obj = Enum()
obj.Init(self._tab.Bytes, x)
return obj
@@ -97,7 +97,7 @@ class Schema(object):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
if o != 0:
x = self._tab.Indirect(o + self._tab.Pos)
- from .reflection.Object import Object
+ from reflection.Object import Object
obj = Object()
obj.Init(self._tab.Bytes, x)
return obj
@@ -110,7 +110,7 @@ class Schema(object):
x = self._tab.Vector(o)
x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
x = self._tab.Indirect(x)
- from .reflection.Service import Service
+ from reflection.Service import Service
obj = Service()
obj.Init(self._tab.Bytes, x)
return obj
@@ -144,7 +144,7 @@ class Schema(object):
x = self._tab.Vector(o)
x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
x = self._tab.Indirect(x)
- from .reflection.SchemaFile import SchemaFile
+ from reflection.SchemaFile import SchemaFile
obj = SchemaFile()
obj.Init(self._tab.Bytes, x)
return obj
@@ -171,7 +171,7 @@ def Start(builder):
def SchemaAddObjects(builder, objects):
builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(objects), 0)
-def AddObjects(builder: flatbuffers.Builder, objects: int):
+def AddObjects(builder, objects):
SchemaAddObjects(builder, objects)
def SchemaStartObjectsVector(builder, numElems):
@@ -183,7 +183,7 @@ def StartObjectsVector(builder, numElems: int) -> int:
def SchemaAddEnums(builder, enums):
builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(enums), 0)
-def AddEnums(builder: flatbuffers.Builder, enums: int):
+def AddEnums(builder, enums):
SchemaAddEnums(builder, enums)
def SchemaStartEnumsVector(builder, numElems):
@@ -195,25 +195,25 @@ def StartEnumsVector(builder, numElems: int) -> int:
def SchemaAddFileIdent(builder, fileIdent):
builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(fileIdent), 0)
-def AddFileIdent(builder: flatbuffers.Builder, fileIdent: int):
+def AddFileIdent(builder, fileIdent):
SchemaAddFileIdent(builder, fileIdent)
def SchemaAddFileExt(builder, fileExt):
builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(fileExt), 0)
-def AddFileExt(builder: flatbuffers.Builder, fileExt: int):
+def AddFileExt(builder, fileExt):
SchemaAddFileExt(builder, fileExt)
def SchemaAddRootTable(builder, rootTable):
builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(rootTable), 0)
-def AddRootTable(builder: flatbuffers.Builder, rootTable: int):
+def AddRootTable(builder, rootTable):
SchemaAddRootTable(builder, rootTable)
def SchemaAddServices(builder, services):
builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(services), 0)
-def AddServices(builder: flatbuffers.Builder, services: int):
+def AddServices(builder, services):
SchemaAddServices(builder, services)
def SchemaStartServicesVector(builder, numElems):
@@ -225,13 +225,13 @@ def StartServicesVector(builder, numElems: int) -> int:
def SchemaAddAdvancedFeatures(builder, advancedFeatures):
builder.PrependUint64Slot(6, advancedFeatures, 0)
-def AddAdvancedFeatures(builder: flatbuffers.Builder, advancedFeatures: int):
+def AddAdvancedFeatures(builder, advancedFeatures):
SchemaAddAdvancedFeatures(builder, advancedFeatures)
def SchemaAddFbsFiles(builder, fbsFiles):
builder.PrependUOffsetTRelativeSlot(7, flatbuffers.number_types.UOffsetTFlags.py_type(fbsFiles), 0)
-def AddFbsFiles(builder: flatbuffers.Builder, fbsFiles: int):
+def AddFbsFiles(builder, fbsFiles):
SchemaAddFbsFiles(builder, fbsFiles)
def SchemaStartFbsFilesVector(builder, numElems):
diff --git a/python/flatbuffers/reflection/SchemaFile.py b/python/flatbuffers/reflection/SchemaFile.py
index 009e7f2f..a81bcd5d 100644
--- a/python/flatbuffers/reflection/SchemaFile.py
+++ b/python/flatbuffers/reflection/SchemaFile.py
@@ -69,13 +69,13 @@ def Start(builder):
def SchemaFileAddFilename(builder, filename):
builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(filename), 0)
-def AddFilename(builder: flatbuffers.Builder, filename: int):
+def AddFilename(builder, filename):
SchemaFileAddFilename(builder, filename)
def SchemaFileAddIncludedFilenames(builder, includedFilenames):
builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(includedFilenames), 0)
-def AddIncludedFilenames(builder: flatbuffers.Builder, includedFilenames: int):
+def AddIncludedFilenames(builder, includedFilenames):
SchemaFileAddIncludedFilenames(builder, includedFilenames)
def SchemaFileStartIncludedFilenamesVector(builder, numElems):
diff --git a/python/flatbuffers/reflection/Service.py b/python/flatbuffers/reflection/Service.py
index eb8db7ef..e69e531f 100644
--- a/python/flatbuffers/reflection/Service.py
+++ b/python/flatbuffers/reflection/Service.py
@@ -42,7 +42,7 @@ class Service(object):
x = self._tab.Vector(o)
x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
x = self._tab.Indirect(x)
- from .reflection.RPCCall import RPCCall
+ from reflection.RPCCall import RPCCall
obj = RPCCall()
obj.Init(self._tab.Bytes, x)
return obj
@@ -67,7 +67,7 @@ class Service(object):
x = self._tab.Vector(o)
x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
x = self._tab.Indirect(x)
- from .reflection.KeyValue import KeyValue
+ from reflection.KeyValue import KeyValue
obj = KeyValue()
obj.Init(self._tab.Bytes, x)
return obj
@@ -122,13 +122,13 @@ def Start(builder):
def ServiceAddName(builder, name):
builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(name), 0)
-def AddName(builder: flatbuffers.Builder, name: int):
+def AddName(builder, name):
ServiceAddName(builder, name)
def ServiceAddCalls(builder, calls):
builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(calls), 0)
-def AddCalls(builder: flatbuffers.Builder, calls: int):
+def AddCalls(builder, calls):
ServiceAddCalls(builder, calls)
def ServiceStartCallsVector(builder, numElems):
@@ -140,7 +140,7 @@ def StartCallsVector(builder, numElems: int) -> int:
def ServiceAddAttributes(builder, attributes):
builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(attributes), 0)
-def AddAttributes(builder: flatbuffers.Builder, attributes: int):
+def AddAttributes(builder, attributes):
ServiceAddAttributes(builder, attributes)
def ServiceStartAttributesVector(builder, numElems):
@@ -152,7 +152,7 @@ def StartAttributesVector(builder, numElems: int) -> int:
def ServiceAddDocumentation(builder, documentation):
builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(documentation), 0)
-def AddDocumentation(builder: flatbuffers.Builder, documentation: int):
+def AddDocumentation(builder, documentation):
ServiceAddDocumentation(builder, documentation)
def ServiceStartDocumentationVector(builder, numElems):
@@ -164,7 +164,7 @@ def StartDocumentationVector(builder, numElems: int) -> int:
def ServiceAddDeclarationFile(builder, declarationFile):
builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(declarationFile), 0)
-def AddDeclarationFile(builder: flatbuffers.Builder, declarationFile: int):
+def AddDeclarationFile(builder, declarationFile):
ServiceAddDeclarationFile(builder, declarationFile)
def ServiceEnd(builder):
diff --git a/python/flatbuffers/reflection/Type.py b/python/flatbuffers/reflection/Type.py
index 76c08c48..49c78a3d 100644
--- a/python/flatbuffers/reflection/Type.py
+++ b/python/flatbuffers/reflection/Type.py
@@ -81,37 +81,37 @@ def Start(builder):
def TypeAddBaseType(builder, baseType):
builder.PrependInt8Slot(0, baseType, 0)
-def AddBaseType(builder: flatbuffers.Builder, baseType: int):
+def AddBaseType(builder, baseType):
TypeAddBaseType(builder, baseType)
def TypeAddElement(builder, element):
builder.PrependInt8Slot(1, element, 0)
-def AddElement(builder: flatbuffers.Builder, element: int):
+def AddElement(builder, element):
TypeAddElement(builder, element)
def TypeAddIndex(builder, index):
builder.PrependInt32Slot(2, index, -1)
-def AddIndex(builder: flatbuffers.Builder, index: int):
+def AddIndex(builder, index):
TypeAddIndex(builder, index)
def TypeAddFixedLength(builder, fixedLength):
builder.PrependUint16Slot(3, fixedLength, 0)
-def AddFixedLength(builder: flatbuffers.Builder, fixedLength: int):
+def AddFixedLength(builder, fixedLength):
TypeAddFixedLength(builder, fixedLength)
def TypeAddBaseSize(builder, baseSize):
builder.PrependUint32Slot(4, baseSize, 4)
-def AddBaseSize(builder: flatbuffers.Builder, baseSize: int):
+def AddBaseSize(builder, baseSize):
TypeAddBaseSize(builder, baseSize)
def TypeAddElementSize(builder, elementSize):
builder.PrependUint32Slot(5, elementSize, 0)
-def AddElementSize(builder: flatbuffers.Builder, elementSize: int):
+def AddElementSize(builder, elementSize):
TypeAddElementSize(builder, elementSize)
def TypeEnd(builder):
diff --git a/src/idl_gen_python.cpp b/src/idl_gen_python.cpp
index 1b11bbe2..ff535d15 100644
--- a/src/idl_gen_python.cpp
+++ b/src/idl_gen_python.cpp
@@ -275,7 +275,7 @@ class PythonGenerator : public BaseGenerator {
code += namer_.Method(field);
const ImportMapEntry import_entry = {
- "." + GenPackageReference(field.value.type), TypeName(field)
+ GenPackageReference(field.value.type), TypeName(field)
};
if (parser_.opts.python_typing) {
@@ -337,7 +337,7 @@ class PythonGenerator : public BaseGenerator {
code += namer_.Method(field) + "(self)";
const ImportMapEntry import_entry = {
- "." + GenPackageReference(field.value.type), TypeName(field)
+ GenPackageReference(field.value.type), TypeName(field)
};
if (parser_.opts.python_typing) {
@@ -446,7 +446,7 @@ class PythonGenerator : public BaseGenerator {
GenReceiver(struct_def, code_ptr);
code += namer_.Method(field);
const ImportMapEntry import_entry = {
- "." + GenPackageReference(field.value.type), TypeName(field)
+ GenPackageReference(field.value.type), TypeName(field)
};
if (parser_.opts.python_typing) {
@@ -570,7 +570,7 @@ class PythonGenerator : public BaseGenerator {
std::string qualified_name = NestedFlatbufferType(unqualified_name);
if (qualified_name.empty()) { qualified_name = nested->constant; }
- const ImportMapEntry import_entry = { "." + qualified_name,
+ const ImportMapEntry import_entry = { qualified_name,
unqualified_name };
auto &code = *code_ptr;
@@ -773,8 +773,13 @@ class PythonGenerator : public BaseGenerator {
if (!parser_.opts.one_file && !parser_.opts.python_no_type_prefix_suffix) {
// Generate method without struct name.
- code += "def Add" + field_method + "(builder: flatbuffers.Builder, " +
- field_var + ": " + field_ty + "):\n";
+ code += "def Add" + field_method;
+ if (parser_.opts.python_typing) {
+ code += "(builder: flatbuffers.Builder, " + field_var + ": " + field_ty;
+ } else {
+ code += "(builder, " + field_var;
+ }
+ code += "):\n";
code += Indent + namer_.Type(struct_def) + "Add" + field_method;
code += "(builder, ";
code += field_var;
diff --git a/tests/MyGame/Example/ArrayStruct.py b/tests/MyGame/Example/ArrayStruct.py
index be85ec89..a839c09f 100644
--- a/tests/MyGame/Example/ArrayStruct.py
+++ b/tests/MyGame/Example/ArrayStruct.py
@@ -5,7 +5,7 @@
import flatbuffers
from flatbuffers.compat import import_numpy
from typing import Any
-from .MyGame.Example.NestedStruct import NestedStruct
+from MyGame.Example.NestedStruct import NestedStruct
np = import_numpy()
class ArrayStruct(object):
diff --git a/tests/MyGame/Example/ArrayTable.py b/tests/MyGame/Example/ArrayTable.py
index 90fbb4a4..7d314dfd 100644
--- a/tests/MyGame/Example/ArrayTable.py
+++ b/tests/MyGame/Example/ArrayTable.py
@@ -5,7 +5,7 @@
import flatbuffers
from flatbuffers.compat import import_numpy
from typing import Any
-from .MyGame.Example.ArrayStruct import ArrayStruct
+from MyGame.Example.ArrayStruct import ArrayStruct
from typing import Optional
np = import_numpy()
diff --git a/tests/MyGame/Example/Monster.py b/tests/MyGame/Example/Monster.py
index f216f84f..1503011f 100644
--- a/tests/MyGame/Example/Monster.py
+++ b/tests/MyGame/Example/Monster.py
@@ -34,7 +34,7 @@ class Monster(object):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
if o != 0:
x = o + self._tab.Pos
- from .MyGame.Example.Vec3 import Vec3
+ from MyGame.Example.Vec3 import Vec3
obj = Vec3()
obj.Init(self._tab.Bytes, x)
return obj
@@ -118,7 +118,7 @@ class Monster(object):
if o != 0:
x = self._tab.Vector(o)
x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
- from .MyGame.Example.Test import Test
+ from MyGame.Example.Test import Test
obj = Test()
obj.Init(self._tab.Bytes, x)
return obj
@@ -165,7 +165,7 @@ class Monster(object):
x = self._tab.Vector(o)
x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
x = self._tab.Indirect(x)
- from .MyGame.Example.Monster import Monster
+ from MyGame.Example.Monster import Monster
obj = Monster()
obj.Init(self._tab.Bytes, x)
return obj
@@ -188,7 +188,7 @@ class Monster(object):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(28))
if o != 0:
x = self._tab.Indirect(o + self._tab.Pos)
- from .MyGame.Example.Monster import Monster
+ from MyGame.Example.Monster import Monster
obj = Monster()
obj.Init(self._tab.Bytes, x)
return obj
@@ -213,7 +213,7 @@ class Monster(object):
def TestnestedflatbufferNestedRoot(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(30))
if o != 0:
- from .MyGame.Example.Monster import Monster
+ from MyGame.Example.Monster import Monster
return Monster.GetRootAs(self._tab.Bytes, self._tab.Vector(o))
return 0
@@ -234,7 +234,7 @@ class Monster(object):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(32))
if o != 0:
x = self._tab.Indirect(o + self._tab.Pos)
- from .MyGame.Example.Stat import Stat
+ from MyGame.Example.Stat import Stat
obj = Stat()
obj.Init(self._tab.Bytes, x)
return obj
@@ -377,7 +377,7 @@ class Monster(object):
if o != 0:
x = self._tab.Vector(o)
x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 8
- from .MyGame.Example.Ability import Ability
+ from MyGame.Example.Ability import Ability
obj = Ability()
obj.Init(self._tab.Bytes, x)
return obj
@@ -428,7 +428,7 @@ class Monster(object):
if o != 0:
x = self._tab.Vector(o)
x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
- from .MyGame.Example.Test import Test
+ from MyGame.Example.Test import Test
obj = Test()
obj.Init(self._tab.Bytes, x)
return obj
@@ -505,7 +505,7 @@ class Monster(object):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(72))
if o != 0:
x = self._tab.Indirect(o + self._tab.Pos)
- from .MyGame.InParentNamespace import InParentNamespace
+ from MyGame.InParentNamespace import InParentNamespace
obj = InParentNamespace()
obj.Init(self._tab.Bytes, x)
return obj
@@ -518,7 +518,7 @@ class Monster(object):
x = self._tab.Vector(o)
x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
x = self._tab.Indirect(x)
- from .MyGame.Example.Referrable import Referrable
+ from MyGame.Example.Referrable import Referrable
obj = Referrable()
obj.Init(self._tab.Bytes, x)
return obj
@@ -577,7 +577,7 @@ class Monster(object):
x = self._tab.Vector(o)
x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
x = self._tab.Indirect(x)
- from .MyGame.Example.Referrable import Referrable
+ from MyGame.Example.Referrable import Referrable
obj = Referrable()
obj.Init(self._tab.Bytes, x)
return obj
@@ -750,7 +750,7 @@ class Monster(object):
def TestrequirednestedflatbufferNestedRoot(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(102))
if o != 0:
- from .MyGame.Example.Monster import Monster
+ from MyGame.Example.Monster import Monster
return Monster.GetRootAs(self._tab.Bytes, self._tab.Vector(o))
return 0
@@ -773,7 +773,7 @@ class Monster(object):
x = self._tab.Vector(o)
x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
x = self._tab.Indirect(x)
- from .MyGame.Example.Stat import Stat
+ from MyGame.Example.Stat import Stat
obj = Stat()
obj.Init(self._tab.Bytes, x)
return obj
@@ -796,7 +796,7 @@ class Monster(object):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(106))
if o != 0:
x = o + self._tab.Pos
- from .MyGame.Example.Test import Test
+ from MyGame.Example.Test import Test
obj = Test()
obj.Init(self._tab.Bytes, x)
return obj
@@ -881,31 +881,31 @@ def Start(builder):
def MonsterAddPos(builder, pos):
builder.PrependStructSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(pos), 0)
-def AddPos(builder: flatbuffers.Builder, pos: Any):
+def AddPos(builder, pos):
MonsterAddPos(builder, pos)
def MonsterAddMana(builder, mana):
builder.PrependInt16Slot(1, mana, 150)
-def AddMana(builder: flatbuffers.Builder, mana: int):
+def AddMana(builder, mana):
MonsterAddMana(builder, mana)
def MonsterAddHp(builder, hp):
builder.PrependInt16Slot(2, hp, 100)
-def AddHp(builder: flatbuffers.Builder, hp: int):
+def AddHp(builder, hp):
MonsterAddHp(builder, hp)
def MonsterAddName(builder, name):
builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(name), 0)
-def AddName(builder: flatbuffers.Builder, name: int):
+def AddName(builder, name):
MonsterAddName(builder, name)
def MonsterAddInventory(builder, inventory):
builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(inventory), 0)
-def AddInventory(builder: flatbuffers.Builder, inventory: int):
+def AddInventory(builder, inventory):
MonsterAddInventory(builder, inventory)
def MonsterStartInventoryVector(builder, numElems):
@@ -917,25 +917,25 @@ def StartInventoryVector(builder, numElems: int) -> int:
def MonsterAddColor(builder, color):
builder.PrependUint8Slot(6, color, 8)
-def AddColor(builder: flatbuffers.Builder, color: int):
+def AddColor(builder, color):
MonsterAddColor(builder, color)
def MonsterAddTestType(builder, testType):
builder.PrependUint8Slot(7, testType, 0)
-def AddTestType(builder: flatbuffers.Builder, testType: int):
+def AddTestType(builder, testType):
MonsterAddTestType(builder, testType)
def MonsterAddTest(builder, test):
builder.PrependUOffsetTRelativeSlot(8, flatbuffers.number_types.UOffsetTFlags.py_type(test), 0)
-def AddTest(builder: flatbuffers.Builder, test: int):
+def AddTest(builder, test):
MonsterAddTest(builder, test)
def MonsterAddTest4(builder, test4):
builder.PrependUOffsetTRelativeSlot(9, flatbuffers.number_types.UOffsetTFlags.py_type(test4), 0)
-def AddTest4(builder: flatbuffers.Builder, test4: int):
+def AddTest4(builder, test4):
MonsterAddTest4(builder, test4)
def MonsterStartTest4Vector(builder, numElems):
@@ -947,7 +947,7 @@ def StartTest4Vector(builder, numElems: int) -> int:
def MonsterAddTestarrayofstring(builder, testarrayofstring):
builder.PrependUOffsetTRelativeSlot(10, flatbuffers.number_types.UOffsetTFlags.py_type(testarrayofstring), 0)
-def AddTestarrayofstring(builder: flatbuffers.Builder, testarrayofstring: int):
+def AddTestarrayofstring(builder, testarrayofstring):
MonsterAddTestarrayofstring(builder, testarrayofstring)
def MonsterStartTestarrayofstringVector(builder, numElems):
@@ -959,7 +959,7 @@ def StartTestarrayofstringVector(builder, numElems: int) -> int:
def MonsterAddTestarrayoftables(builder, testarrayoftables):
builder.PrependUOffsetTRelativeSlot(11, flatbuffers.number_types.UOffsetTFlags.py_type(testarrayoftables), 0)
-def AddTestarrayoftables(builder: flatbuffers.Builder, testarrayoftables: int):
+def AddTestarrayoftables(builder, testarrayoftables):
MonsterAddTestarrayoftables(builder, testarrayoftables)
def MonsterStartTestarrayoftablesVector(builder, numElems):
@@ -971,13 +971,13 @@ def StartTestarrayoftablesVector(builder, numElems: int) -> int:
def MonsterAddEnemy(builder, enemy):
builder.PrependUOffsetTRelativeSlot(12, flatbuffers.number_types.UOffsetTFlags.py_type(enemy), 0)
-def AddEnemy(builder: flatbuffers.Builder, enemy: int):
+def AddEnemy(builder, enemy):
MonsterAddEnemy(builder, enemy)
def MonsterAddTestnestedflatbuffer(builder, testnestedflatbuffer):
builder.PrependUOffsetTRelativeSlot(13, flatbuffers.number_types.UOffsetTFlags.py_type(testnestedflatbuffer), 0)
-def AddTestnestedflatbuffer(builder: flatbuffers.Builder, testnestedflatbuffer: int):
+def AddTestnestedflatbuffer(builder, testnestedflatbuffer):
MonsterAddTestnestedflatbuffer(builder, testnestedflatbuffer)
def MonsterStartTestnestedflatbufferVector(builder, numElems):
@@ -996,67 +996,67 @@ def MakeTestnestedflatbufferVectorFromBytes(builder, bytes):
def MonsterAddTestempty(builder, testempty):
builder.PrependUOffsetTRelativeSlot(14, flatbuffers.number_types.UOffsetTFlags.py_type(testempty), 0)
-def AddTestempty(builder: flatbuffers.Builder, testempty: int):
+def AddTestempty(builder, testempty):
MonsterAddTestempty(builder, testempty)
def MonsterAddTestbool(builder, testbool):
builder.PrependBoolSlot(15, testbool, 0)
-def AddTestbool(builder: flatbuffers.Builder, testbool: bool):
+def AddTestbool(builder, testbool):
MonsterAddTestbool(builder, testbool)
def MonsterAddTesthashs32Fnv1(builder, testhashs32Fnv1):
builder.PrependInt32Slot(16, testhashs32Fnv1, 0)
-def AddTesthashs32Fnv1(builder: flatbuffers.Builder, testhashs32Fnv1: int):
+def AddTesthashs32Fnv1(builder, testhashs32Fnv1):
MonsterAddTesthashs32Fnv1(builder, testhashs32Fnv1)
def MonsterAddTesthashu32Fnv1(builder, testhashu32Fnv1):
builder.PrependUint32Slot(17, testhashu32Fnv1, 0)
-def AddTesthashu32Fnv1(builder: flatbuffers.Builder, testhashu32Fnv1: int):
+def AddTesthashu32Fnv1(builder, testhashu32Fnv1):
MonsterAddTesthashu32Fnv1(builder, testhashu32Fnv1)
def MonsterAddTesthashs64Fnv1(builder, testhashs64Fnv1):
builder.PrependInt64Slot(18, testhashs64Fnv1, 0)
-def AddTesthashs64Fnv1(builder: flatbuffers.Builder, testhashs64Fnv1: int):
+def AddTesthashs64Fnv1(builder, testhashs64Fnv1):
MonsterAddTesthashs64Fnv1(builder, testhashs64Fnv1)
def MonsterAddTesthashu64Fnv1(builder, testhashu64Fnv1):
builder.PrependUint64Slot(19, testhashu64Fnv1, 0)
-def AddTesthashu64Fnv1(builder: flatbuffers.Builder, testhashu64Fnv1: int):
+def AddTesthashu64Fnv1(builder, testhashu64Fnv1):
MonsterAddTesthashu64Fnv1(builder, testhashu64Fnv1)
def MonsterAddTesthashs32Fnv1a(builder, testhashs32Fnv1a):
builder.PrependInt32Slot(20, testhashs32Fnv1a, 0)
-def AddTesthashs32Fnv1a(builder: flatbuffers.Builder, testhashs32Fnv1a: int):
+def AddTesthashs32Fnv1a(builder, testhashs32Fnv1a):
MonsterAddTesthashs32Fnv1a(builder, testhashs32Fnv1a)
def MonsterAddTesthashu32Fnv1a(builder, testhashu32Fnv1a):
builder.PrependUint32Slot(21, testhashu32Fnv1a, 0)
-def AddTesthashu32Fnv1a(builder: flatbuffers.Builder, testhashu32Fnv1a: int):
+def AddTesthashu32Fnv1a(builder, testhashu32Fnv1a):
MonsterAddTesthashu32Fnv1a(builder, testhashu32Fnv1a)
def MonsterAddTesthashs64Fnv1a(builder, testhashs64Fnv1a):
builder.PrependInt64Slot(22, testhashs64Fnv1a, 0)
-def AddTesthashs64Fnv1a(builder: flatbuffers.Builder, testhashs64Fnv1a: int):
+def AddTesthashs64Fnv1a(builder, testhashs64Fnv1a):
MonsterAddTesthashs64Fnv1a(builder, testhashs64Fnv1a)
def MonsterAddTesthashu64Fnv1a(builder, testhashu64Fnv1a):
builder.PrependUint64Slot(23, testhashu64Fnv1a, 0)
-def AddTesthashu64Fnv1a(builder: flatbuffers.Builder, testhashu64Fnv1a: int):
+def AddTesthashu64Fnv1a(builder, testhashu64Fnv1a):
MonsterAddTesthashu64Fnv1a(builder, testhashu64Fnv1a)
def MonsterAddTestarrayofbools(builder, testarrayofbools):
builder.PrependUOffsetTRelativeSlot(24, flatbuffers.number_types.UOffsetTFlags.py_type(testarrayofbools), 0)
-def AddTestarrayofbools(builder: flatbuffers.Builder, testarrayofbools: int):
+def AddTestarrayofbools(builder, testarrayofbools):
MonsterAddTestarrayofbools(builder, testarrayofbools)
def MonsterStartTestarrayofboolsVector(builder, numElems):
@@ -1068,25 +1068,25 @@ def StartTestarrayofboolsVector(builder, numElems: int) -> int:
def MonsterAddTestf(builder, testf):
builder.PrependFloat32Slot(25, testf, 3.14159)
-def AddTestf(builder: flatbuffers.Builder, testf: float):
+def AddTestf(builder, testf):
MonsterAddTestf(builder, testf)
def MonsterAddTestf2(builder, testf2):
builder.PrependFloat32Slot(26, testf2, 3.0)
-def AddTestf2(builder: flatbuffers.Builder, testf2: float):
+def AddTestf2(builder, testf2):
MonsterAddTestf2(builder, testf2)
def MonsterAddTestf3(builder, testf3):
builder.PrependFloat32Slot(27, testf3, 0.0)
-def AddTestf3(builder: flatbuffers.Builder, testf3: float):
+def AddTestf3(builder, testf3):
MonsterAddTestf3(builder, testf3)
def MonsterAddTestarrayofstring2(builder, testarrayofstring2):
builder.PrependUOffsetTRelativeSlot(28, flatbuffers.number_types.UOffsetTFlags.py_type(testarrayofstring2), 0)
-def AddTestarrayofstring2(builder: flatbuffers.Builder, testarrayofstring2: int):
+def AddTestarrayofstring2(builder, testarrayofstring2):
MonsterAddTestarrayofstring2(builder, testarrayofstring2)
def MonsterStartTestarrayofstring2Vector(builder, numElems):
@@ -1098,7 +1098,7 @@ def StartTestarrayofstring2Vector(builder, numElems: int) -> int:
def MonsterAddTestarrayofsortedstruct(builder, testarrayofsortedstruct):
builder.PrependUOffsetTRelativeSlot(29, flatbuffers.number_types.UOffsetTFlags.py_type(testarrayofsortedstruct), 0)
-def AddTestarrayofsortedstruct(builder: flatbuffers.Builder, testarrayofsortedstruct: int):
+def AddTestarrayofsortedstruct(builder, testarrayofsortedstruct):
MonsterAddTestarrayofsortedstruct(builder, testarrayofsortedstruct)
def MonsterStartTestarrayofsortedstructVector(builder, numElems):
@@ -1110,7 +1110,7 @@ def StartTestarrayofsortedstructVector(builder, numElems: int) -> int:
def MonsterAddFlex(builder, flex):
builder.PrependUOffsetTRelativeSlot(30, flatbuffers.number_types.UOffsetTFlags.py_type(flex), 0)
-def AddFlex(builder: flatbuffers.Builder, flex: int):
+def AddFlex(builder, flex):
MonsterAddFlex(builder, flex)
def MonsterStartFlexVector(builder, numElems):
@@ -1122,7 +1122,7 @@ def StartFlexVector(builder, numElems: int) -> int:
def MonsterAddTest5(builder, test5):
builder.PrependUOffsetTRelativeSlot(31, flatbuffers.number_types.UOffsetTFlags.py_type(test5), 0)
-def AddTest5(builder: flatbuffers.Builder, test5: int):
+def AddTest5(builder, test5):
MonsterAddTest5(builder, test5)
def MonsterStartTest5Vector(builder, numElems):
@@ -1134,7 +1134,7 @@ def StartTest5Vector(builder, numElems: int) -> int:
def MonsterAddVectorOfLongs(builder, vectorOfLongs):
builder.PrependUOffsetTRelativeSlot(32, flatbuffers.number_types.UOffsetTFlags.py_type(vectorOfLongs), 0)
-def AddVectorOfLongs(builder: flatbuffers.Builder, vectorOfLongs: int):
+def AddVectorOfLongs(builder, vectorOfLongs):
MonsterAddVectorOfLongs(builder, vectorOfLongs)
def MonsterStartVectorOfLongsVector(builder, numElems):
@@ -1146,7 +1146,7 @@ def StartVectorOfLongsVector(builder, numElems: int) -> int:
def MonsterAddVectorOfDoubles(builder, vectorOfDoubles):
builder.PrependUOffsetTRelativeSlot(33, flatbuffers.number_types.UOffsetTFlags.py_type(vectorOfDoubles), 0)
-def AddVectorOfDoubles(builder: flatbuffers.Builder, vectorOfDoubles: int):
+def AddVectorOfDoubles(builder, vectorOfDoubles):
MonsterAddVectorOfDoubles(builder, vectorOfDoubles)
def MonsterStartVectorOfDoublesVector(builder, numElems):
@@ -1158,13 +1158,13 @@ def StartVectorOfDoublesVector(builder, numElems: int) -> int:
def MonsterAddParentNamespaceTest(builder, parentNamespaceTest):
builder.PrependUOffsetTRelativeSlot(34, flatbuffers.number_types.UOffsetTFlags.py_type(parentNamespaceTest), 0)
-def AddParentNamespaceTest(builder: flatbuffers.Builder, parentNamespaceTest: int):
+def AddParentNamespaceTest(builder, parentNamespaceTest):
MonsterAddParentNamespaceTest(builder, parentNamespaceTest)
def MonsterAddVectorOfReferrables(builder, vectorOfReferrables):
builder.PrependUOffsetTRelativeSlot(35, flatbuffers.number_types.UOffsetTFlags.py_type(vectorOfReferrables), 0)
-def AddVectorOfReferrables(builder: flatbuffers.Builder, vectorOfReferrables: int):
+def AddVectorOfReferrables(builder, vectorOfReferrables):
MonsterAddVectorOfReferrables(builder, vectorOfReferrables)
def MonsterStartVectorOfReferrablesVector(builder, numElems):
@@ -1176,13 +1176,13 @@ def StartVectorOfReferrablesVector(builder, numElems: int) -> int:
def MonsterAddSingleWeakReference(builder, singleWeakReference):
builder.PrependUint64Slot(36, singleWeakReference, 0)
-def AddSingleWeakReference(builder: flatbuffers.Builder, singleWeakReference: int):
+def AddSingleWeakReference(builder, singleWeakReference):
MonsterAddSingleWeakReference(builder, singleWeakReference)
def MonsterAddVectorOfWeakReferences(builder, vectorOfWeakReferences):
builder.PrependUOffsetTRelativeSlot(37, flatbuffers.number_types.UOffsetTFlags.py_type(vectorOfWeakReferences), 0)
-def AddVectorOfWeakReferences(builder: flatbuffers.Builder, vectorOfWeakReferences: int):
+def AddVectorOfWeakReferences(builder, vectorOfWeakReferences):
MonsterAddVectorOfWeakReferences(builder, vectorOfWeakReferences)
def MonsterStartVectorOfWeakReferencesVector(builder, numElems):
@@ -1194,7 +1194,7 @@ def StartVectorOfWeakReferencesVector(builder, numElems: int) -> int:
def MonsterAddVectorOfStrongReferrables(builder, vectorOfStrongReferrables):
builder.PrependUOffsetTRelativeSlot(38, flatbuffers.number_types.UOffsetTFlags.py_type(vectorOfStrongReferrables), 0)
-def AddVectorOfStrongReferrables(builder: flatbuffers.Builder, vectorOfStrongReferrables: int):
+def AddVectorOfStrongReferrables(builder, vectorOfStrongReferrables):
MonsterAddVectorOfStrongReferrables(builder, vectorOfStrongReferrables)
def MonsterStartVectorOfStrongReferrablesVector(builder, numElems):
@@ -1206,13 +1206,13 @@ def StartVectorOfStrongReferrablesVector(builder, numElems: int) -> int:
def MonsterAddCoOwningReference(builder, coOwningReference):
builder.PrependUint64Slot(39, coOwningReference, 0)
-def AddCoOwningReference(builder: flatbuffers.Builder, coOwningReference: int):
+def AddCoOwningReference(builder, coOwningReference):
MonsterAddCoOwningReference(builder, coOwningReference)
def MonsterAddVectorOfCoOwningReferences(builder, vectorOfCoOwningReferences):
builder.PrependUOffsetTRelativeSlot(40, flatbuffers.number_types.UOffsetTFlags.py_type(vectorOfCoOwningReferences), 0)
-def AddVectorOfCoOwningReferences(builder: flatbuffers.Builder, vectorOfCoOwningReferences: int):
+def AddVectorOfCoOwningReferences(builder, vectorOfCoOwningReferences):
MonsterAddVectorOfCoOwningReferences(builder, vectorOfCoOwningReferences)
def MonsterStartVectorOfCoOwningReferencesVector(builder, numElems):
@@ -1224,13 +1224,13 @@ def StartVectorOfCoOwningReferencesVector(builder, numElems: int) -> int:
def MonsterAddNonOwningReference(builder, nonOwningReference):
builder.PrependUint64Slot(41, nonOwningReference, 0)
-def AddNonOwningReference(builder: flatbuffers.Builder, nonOwningReference: int):
+def AddNonOwningReference(builder, nonOwningReference):
MonsterAddNonOwningReference(builder, nonOwningReference)
def MonsterAddVectorOfNonOwningReferences(builder, vectorOfNonOwningReferences):
builder.PrependUOffsetTRelativeSlot(42, flatbuffers.number_types.UOffsetTFlags.py_type(vectorOfNonOwningReferences), 0)
-def AddVectorOfNonOwningReferences(builder: flatbuffers.Builder, vectorOfNonOwningReferences: int):
+def AddVectorOfNonOwningReferences(builder, vectorOfNonOwningReferences):
MonsterAddVectorOfNonOwningReferences(builder, vectorOfNonOwningReferences)
def MonsterStartVectorOfNonOwningReferencesVector(builder, numElems):
@@ -1242,31 +1242,31 @@ def StartVectorOfNonOwningReferencesVector(builder, numElems: int) -> int:
def MonsterAddAnyUniqueType(builder, anyUniqueType):
builder.PrependUint8Slot(43, anyUniqueType, 0)
-def AddAnyUniqueType(builder: flatbuffers.Builder, anyUniqueType: int):
+def AddAnyUniqueType(builder, anyUniqueType):
MonsterAddAnyUniqueType(builder, anyUniqueType)
def MonsterAddAnyUnique(builder, anyUnique):
builder.PrependUOffsetTRelativeSlot(44, flatbuffers.number_types.UOffsetTFlags.py_type(anyUnique), 0)
-def AddAnyUnique(builder: flatbuffers.Builder, anyUnique: int):
+def AddAnyUnique(builder, anyUnique):
MonsterAddAnyUnique(builder, anyUnique)
def MonsterAddAnyAmbiguousType(builder, anyAmbiguousType):
builder.PrependUint8Slot(45, anyAmbiguousType, 0)
-def AddAnyAmbiguousType(builder: flatbuffers.Builder, anyAmbiguousType: int):
+def AddAnyAmbiguousType(builder, anyAmbiguousType):
MonsterAddAnyAmbiguousType(builder, anyAmbiguousType)
def MonsterAddAnyAmbiguous(builder, anyAmbiguous):
builder.PrependUOffsetTRelativeSlot(46, flatbuffers.number_types.UOffsetTFlags.py_type(anyAmbiguous), 0)
-def AddAnyAmbiguous(builder: flatbuffers.Builder, anyAmbiguous: int):
+def AddAnyAmbiguous(builder, anyAmbiguous):
MonsterAddAnyAmbiguous(builder, anyAmbiguous)
def MonsterAddVectorOfEnums(builder, vectorOfEnums):
builder.PrependUOffsetTRelativeSlot(47, flatbuffers.number_types.UOffsetTFlags.py_type(vectorOfEnums), 0)
-def AddVectorOfEnums(builder: flatbuffers.Builder, vectorOfEnums: int):
+def AddVectorOfEnums(builder, vectorOfEnums):
MonsterAddVectorOfEnums(builder, vectorOfEnums)
def MonsterStartVectorOfEnumsVector(builder, numElems):
@@ -1278,13 +1278,13 @@ def StartVectorOfEnumsVector(builder, numElems: int) -> int:
def MonsterAddSignedEnum(builder, signedEnum):
builder.PrependInt8Slot(48, signedEnum, -1)
-def AddSignedEnum(builder: flatbuffers.Builder, signedEnum: int):
+def AddSignedEnum(builder, signedEnum):
MonsterAddSignedEnum(builder, signedEnum)
def MonsterAddTestrequirednestedflatbuffer(builder, testrequirednestedflatbuffer):
builder.PrependUOffsetTRelativeSlot(49, flatbuffers.number_types.UOffsetTFlags.py_type(testrequirednestedflatbuffer), 0)
-def AddTestrequirednestedflatbuffer(builder: flatbuffers.Builder, testrequirednestedflatbuffer: int):
+def AddTestrequirednestedflatbuffer(builder, testrequirednestedflatbuffer):
MonsterAddTestrequirednestedflatbuffer(builder, testrequirednestedflatbuffer)
def MonsterStartTestrequirednestedflatbufferVector(builder, numElems):
@@ -1303,7 +1303,7 @@ def MakeTestrequirednestedflatbufferVectorFromBytes(builder, bytes):
def MonsterAddScalarKeySortedTables(builder, scalarKeySortedTables):
builder.PrependUOffsetTRelativeSlot(50, flatbuffers.number_types.UOffsetTFlags.py_type(scalarKeySortedTables), 0)
-def AddScalarKeySortedTables(builder: flatbuffers.Builder, scalarKeySortedTables: int):
+def AddScalarKeySortedTables(builder, scalarKeySortedTables):
MonsterAddScalarKeySortedTables(builder, scalarKeySortedTables)
def MonsterStartScalarKeySortedTablesVector(builder, numElems):
@@ -1315,67 +1315,67 @@ def StartScalarKeySortedTablesVector(builder, numElems: int) -> int:
def MonsterAddNativeInline(builder, nativeInline):
builder.PrependStructSlot(51, flatbuffers.number_types.UOffsetTFlags.py_type(nativeInline), 0)
-def AddNativeInline(builder: flatbuffers.Builder, nativeInline: Any):
+def AddNativeInline(builder, nativeInline):
MonsterAddNativeInline(builder, nativeInline)
def MonsterAddLongEnumNonEnumDefault(builder, longEnumNonEnumDefault):
builder.PrependUint64Slot(52, longEnumNonEnumDefault, 0)
-def AddLongEnumNonEnumDefault(builder: flatbuffers.Builder, longEnumNonEnumDefault: int):
+def AddLongEnumNonEnumDefault(builder, longEnumNonEnumDefault):
MonsterAddLongEnumNonEnumDefault(builder, longEnumNonEnumDefault)
def MonsterAddLongEnumNormalDefault(builder, longEnumNormalDefault):
builder.PrependUint64Slot(53, longEnumNormalDefault, 2)
-def AddLongEnumNormalDefault(builder: flatbuffers.Builder, longEnumNormalDefault: int):
+def AddLongEnumNormalDefault(builder, longEnumNormalDefault):
MonsterAddLongEnumNormalDefault(builder, longEnumNormalDefault)
def MonsterAddNanDefault(builder, nanDefault):
builder.PrependFloat32Slot(54, nanDefault, float('nan'))
-def AddNanDefault(builder: flatbuffers.Builder, nanDefault: float):
+def AddNanDefault(builder, nanDefault):
MonsterAddNanDefault(builder, nanDefault)
def MonsterAddInfDefault(builder, infDefault):
builder.PrependFloat32Slot(55, infDefault, float('inf'))
-def AddInfDefault(builder: flatbuffers.Builder, infDefault: float):
+def AddInfDefault(builder, infDefault):
MonsterAddInfDefault(builder, infDefault)
def MonsterAddPositiveInfDefault(builder, positiveInfDefault):
builder.PrependFloat32Slot(56, positiveInfDefault, float('inf'))
-def AddPositiveInfDefault(builder: flatbuffers.Builder, positiveInfDefault: float):
+def AddPositiveInfDefault(builder, positiveInfDefault):
MonsterAddPositiveInfDefault(builder, positiveInfDefault)
def MonsterAddInfinityDefault(builder, infinityDefault):
builder.PrependFloat32Slot(57, infinityDefault, float('inf'))
-def AddInfinityDefault(builder: flatbuffers.Builder, infinityDefault: float):
+def AddInfinityDefault(builder, infinityDefault):
MonsterAddInfinityDefault(builder, infinityDefault)
def MonsterAddPositiveInfinityDefault(builder, positiveInfinityDefault):
builder.PrependFloat32Slot(58, positiveInfinityDefault, float('inf'))
-def AddPositiveInfinityDefault(builder: flatbuffers.Builder, positiveInfinityDefault: float):
+def AddPositiveInfinityDefault(builder, positiveInfinityDefault):
MonsterAddPositiveInfinityDefault(builder, positiveInfinityDefault)
def MonsterAddNegativeInfDefault(builder, negativeInfDefault):
builder.PrependFloat32Slot(59, negativeInfDefault, float('-inf'))
-def AddNegativeInfDefault(builder: flatbuffers.Builder, negativeInfDefault: float):
+def AddNegativeInfDefault(builder, negativeInfDefault):
MonsterAddNegativeInfDefault(builder, negativeInfDefault)
def MonsterAddNegativeInfinityDefault(builder, negativeInfinityDefault):
builder.PrependFloat32Slot(60, negativeInfinityDefault, float('-inf'))
-def AddNegativeInfinityDefault(builder: flatbuffers.Builder, negativeInfinityDefault: float):
+def AddNegativeInfinityDefault(builder, negativeInfinityDefault):
MonsterAddNegativeInfinityDefault(builder, negativeInfinityDefault)
def MonsterAddDoubleInfDefault(builder, doubleInfDefault):
builder.PrependFloat64Slot(61, doubleInfDefault, float('inf'))
-def AddDoubleInfDefault(builder: flatbuffers.Builder, doubleInfDefault: float):
+def AddDoubleInfDefault(builder, doubleInfDefault):
MonsterAddDoubleInfDefault(builder, doubleInfDefault)
def MonsterEnd(builder):
diff --git a/tests/MyGame/Example/NestedUnion/Vec3.py b/tests/MyGame/Example/NestedUnion/Vec3.py
index 11feab11..d0f8676f 100644
--- a/tests/MyGame/Example/NestedUnion/Vec3.py
+++ b/tests/MyGame/Example/NestedUnion/Vec3.py
@@ -5,7 +5,7 @@
import flatbuffers
from flatbuffers.compat import import_numpy
from typing import Any
-from .MyGame.Example.NestedUnion.Test import Test
+from MyGame.Example.NestedUnion.Test import Test
from typing import Optional
np = import_numpy()
diff --git a/tests/MyGame/Example/Referrable.py b/tests/MyGame/Example/Referrable.py
index 203c9341..9cc5f572 100644
--- a/tests/MyGame/Example/Referrable.py
+++ b/tests/MyGame/Example/Referrable.py
@@ -44,7 +44,7 @@ def Start(builder):
def ReferrableAddId(builder, id):
builder.PrependUint64Slot(0, id, 0)
-def AddId(builder: flatbuffers.Builder, id: int):
+def AddId(builder, id):
ReferrableAddId(builder, id)
def ReferrableEnd(builder):
diff --git a/tests/MyGame/Example/Stat.py b/tests/MyGame/Example/Stat.py
index 4f175574..ec6b9d9a 100644
--- a/tests/MyGame/Example/Stat.py
+++ b/tests/MyGame/Example/Stat.py
@@ -58,19 +58,19 @@ def Start(builder):
def StatAddId(builder, id):
builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(id), 0)
-def AddId(builder: flatbuffers.Builder, id: int):
+def AddId(builder, id):
StatAddId(builder, id)
def StatAddVal(builder, val):
builder.PrependInt64Slot(1, val, 0)
-def AddVal(builder: flatbuffers.Builder, val: int):
+def AddVal(builder, val):
StatAddVal(builder, val)
def StatAddCount(builder, count):
builder.PrependUint16Slot(2, count, 0)
-def AddCount(builder: flatbuffers.Builder, count: int):
+def AddCount(builder, count):
StatAddCount(builder, count)
def StatEnd(builder):
diff --git a/tests/MyGame/Example/TestSimpleTableWithEnum.py b/tests/MyGame/Example/TestSimpleTableWithEnum.py
index 856442c8..520d257f 100644
--- a/tests/MyGame/Example/TestSimpleTableWithEnum.py
+++ b/tests/MyGame/Example/TestSimpleTableWithEnum.py
@@ -44,7 +44,7 @@ def Start(builder):
def TestSimpleTableWithEnumAddColor(builder, color):
builder.PrependUint8Slot(0, color, 2)
-def AddColor(builder: flatbuffers.Builder, color: int):
+def AddColor(builder, color):
TestSimpleTableWithEnumAddColor(builder, color)
def TestSimpleTableWithEnumEnd(builder):
diff --git a/tests/MyGame/Example/TypeAliases.py b/tests/MyGame/Example/TypeAliases.py
index 27c6c4f9..00f90ed5 100644
--- a/tests/MyGame/Example/TypeAliases.py
+++ b/tests/MyGame/Example/TypeAliases.py
@@ -161,67 +161,67 @@ def Start(builder):
def TypeAliasesAddI8(builder, i8):
builder.PrependInt8Slot(0, i8, 0)
-def AddI8(builder: flatbuffers.Builder, i8: int):
+def AddI8(builder, i8):
TypeAliasesAddI8(builder, i8)
def TypeAliasesAddU8(builder, u8):
builder.PrependUint8Slot(1, u8, 0)
-def AddU8(builder: flatbuffers.Builder, u8: int):
+def AddU8(builder, u8):
TypeAliasesAddU8(builder, u8)
def TypeAliasesAddI16(builder, i16):
builder.PrependInt16Slot(2, i16, 0)
-def AddI16(builder: flatbuffers.Builder, i16: int):
+def AddI16(builder, i16):
TypeAliasesAddI16(builder, i16)
def TypeAliasesAddU16(builder, u16):
builder.PrependUint16Slot(3, u16, 0)
-def AddU16(builder: flatbuffers.Builder, u16: int):
+def AddU16(builder, u16):
TypeAliasesAddU16(builder, u16)
def TypeAliasesAddI32(builder, i32):
builder.PrependInt32Slot(4, i32, 0)
-def AddI32(builder: flatbuffers.Builder, i32: int):
+def AddI32(builder, i32):
TypeAliasesAddI32(builder, i32)
def TypeAliasesAddU32(builder, u32):
builder.PrependUint32Slot(5, u32, 0)
-def AddU32(builder: flatbuffers.Builder, u32: int):
+def AddU32(builder, u32):
TypeAliasesAddU32(builder, u32)
def TypeAliasesAddI64(builder, i64):
builder.PrependInt64Slot(6, i64, 0)
-def AddI64(builder: flatbuffers.Builder, i64: int):
+def AddI64(builder, i64):
TypeAliasesAddI64(builder, i64)
def TypeAliasesAddU64(builder, u64):
builder.PrependUint64Slot(7, u64, 0)
-def AddU64(builder: flatbuffers.Builder, u64: int):
+def AddU64(builder, u64):
TypeAliasesAddU64(builder, u64)
def TypeAliasesAddF32(builder, f32):
builder.PrependFloat32Slot(8, f32, 0.0)
-def AddF32(builder: flatbuffers.Builder, f32: float):
+def AddF32(builder, f32):
TypeAliasesAddF32(builder, f32)
def TypeAliasesAddF64(builder, f64):
builder.PrependFloat64Slot(9, f64, 0.0)
-def AddF64(builder: flatbuffers.Builder, f64: float):
+def AddF64(builder, f64):
TypeAliasesAddF64(builder, f64)
def TypeAliasesAddV8(builder, v8):
builder.PrependUOffsetTRelativeSlot(10, flatbuffers.number_types.UOffsetTFlags.py_type(v8), 0)
-def AddV8(builder: flatbuffers.Builder, v8: int):
+def AddV8(builder, v8):
TypeAliasesAddV8(builder, v8)
def TypeAliasesStartV8Vector(builder, numElems):
@@ -233,7 +233,7 @@ def StartV8Vector(builder, numElems: int) -> int:
def TypeAliasesAddVf64(builder, vf64):
builder.PrependUOffsetTRelativeSlot(11, flatbuffers.number_types.UOffsetTFlags.py_type(vf64), 0)
-def AddVf64(builder: flatbuffers.Builder, vf64: int):
+def AddVf64(builder, vf64):
TypeAliasesAddVf64(builder, vf64)
def TypeAliasesStartVf64Vector(builder, numElems):
diff --git a/tests/PythonTest.sh b/tests/PythonTest.sh
index 925bd95e..fc64e9f5 100755
--- a/tests/PythonTest.sh
+++ b/tests/PythonTest.sh
@@ -1,4 +1,4 @@
-#!/bin/bash -eu
+#!/bin/bash
#
# Copyright 2014 Google Inc. All rights reserved.
#
@@ -14,10 +14,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+set -eu
+
pushd "$(dirname $0)" >/dev/null
test_dir="$(pwd)"
gen_code_path=${test_dir}
-runtime_library_dir=${test_dir}/../../python
+runtime_library_dir=${test_dir}/../python
# Emit Python code for the example schema in the test dir:
${test_dir}/../flatc -p -o ${gen_code_path} -I include_test monster_test.fbs --gen-object-api
diff --git a/tests/monster_test_generated.py b/tests/monster_test_generated.py
index 2acdf6ce..f2b62cb2 100644
--- a/tests/monster_test_generated.py
+++ b/tests/monster_test_generated.py
@@ -1050,7 +1050,7 @@ class Monster(object):
def TestnestedflatbufferNestedRoot(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(30))
if o != 0:
- from .MyGame.Example.Monster import Monster
+ from MyGame.Example.Monster import Monster
return Monster.GetRootAs(self._tab.Bytes, self._tab.Vector(o))
return 0
@@ -1581,7 +1581,7 @@ class Monster(object):
def TestrequirednestedflatbufferNestedRoot(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(102))
if o != 0:
- from .MyGame.Example.Monster import Monster
+ from MyGame.Example.Monster import Monster
return Monster.GetRootAs(self._tab.Bytes, self._tab.Vector(o))
return 0
diff --git a/tests/optional_scalars/ScalarStuff.py b/tests/optional_scalars/ScalarStuff.py
index 07737d29..dda052f3 100644
--- a/tests/optional_scalars/ScalarStuff.py
+++ b/tests/optional_scalars/ScalarStuff.py
@@ -289,217 +289,217 @@ def Start(builder):
def ScalarStuffAddJustI8(builder, justI8):
builder.PrependInt8Slot(0, justI8, 0)
-def AddJustI8(builder: flatbuffers.Builder, justI8: int):
+def AddJustI8(builder, justI8):
ScalarStuffAddJustI8(builder, justI8)
def ScalarStuffAddMaybeI8(builder, maybeI8):
builder.PrependInt8Slot(1, maybeI8, None)
-def AddMaybeI8(builder: flatbuffers.Builder, maybeI8: int):
+def AddMaybeI8(builder, maybeI8):
ScalarStuffAddMaybeI8(builder, maybeI8)
def ScalarStuffAddDefaultI8(builder, defaultI8):
builder.PrependInt8Slot(2, defaultI8, 42)
-def AddDefaultI8(builder: flatbuffers.Builder, defaultI8: int):
+def AddDefaultI8(builder, defaultI8):
ScalarStuffAddDefaultI8(builder, defaultI8)
def ScalarStuffAddJustU8(builder, justU8):
builder.PrependUint8Slot(3, justU8, 0)
-def AddJustU8(builder: flatbuffers.Builder, justU8: int):
+def AddJustU8(builder, justU8):
ScalarStuffAddJustU8(builder, justU8)
def ScalarStuffAddMaybeU8(builder, maybeU8):
builder.PrependUint8Slot(4, maybeU8, None)
-def AddMaybeU8(builder: flatbuffers.Builder, maybeU8: int):
+def AddMaybeU8(builder, maybeU8):
ScalarStuffAddMaybeU8(builder, maybeU8)
def ScalarStuffAddDefaultU8(builder, defaultU8):
builder.PrependUint8Slot(5, defaultU8, 42)
-def AddDefaultU8(builder: flatbuffers.Builder, defaultU8: int):
+def AddDefaultU8(builder, defaultU8):
ScalarStuffAddDefaultU8(builder, defaultU8)
def ScalarStuffAddJustI16(builder, justI16):
builder.PrependInt16Slot(6, justI16, 0)
-def AddJustI16(builder: flatbuffers.Builder, justI16: int):
+def AddJustI16(builder, justI16):
ScalarStuffAddJustI16(builder, justI16)
def ScalarStuffAddMaybeI16(builder, maybeI16):
builder.PrependInt16Slot(7, maybeI16, None)
-def AddMaybeI16(builder: flatbuffers.Builder, maybeI16: int):
+def AddMaybeI16(builder, maybeI16):
ScalarStuffAddMaybeI16(builder, maybeI16)
def ScalarStuffAddDefaultI16(builder, defaultI16):
builder.PrependInt16Slot(8, defaultI16, 42)
-def AddDefaultI16(builder: flatbuffers.Builder, defaultI16: int):
+def AddDefaultI16(builder, defaultI16):
ScalarStuffAddDefaultI16(builder, defaultI16)
def ScalarStuffAddJustU16(builder, justU16):
builder.PrependUint16Slot(9, justU16, 0)
-def AddJustU16(builder: flatbuffers.Builder, justU16: int):
+def AddJustU16(builder, justU16):
ScalarStuffAddJustU16(builder, justU16)
def ScalarStuffAddMaybeU16(builder, maybeU16):
builder.PrependUint16Slot(10, maybeU16, None)
-def AddMaybeU16(builder: flatbuffers.Builder, maybeU16: int):
+def AddMaybeU16(builder, maybeU16):
ScalarStuffAddMaybeU16(builder, maybeU16)
def ScalarStuffAddDefaultU16(builder, defaultU16):
builder.PrependUint16Slot(11, defaultU16, 42)
-def AddDefaultU16(builder: flatbuffers.Builder, defaultU16: int):
+def AddDefaultU16(builder, defaultU16):
ScalarStuffAddDefaultU16(builder, defaultU16)
def ScalarStuffAddJustI32(builder, justI32):
builder.PrependInt32Slot(12, justI32, 0)
-def AddJustI32(builder: flatbuffers.Builder, justI32: int):
+def AddJustI32(builder, justI32):
ScalarStuffAddJustI32(builder, justI32)
def ScalarStuffAddMaybeI32(builder, maybeI32):
builder.PrependInt32Slot(13, maybeI32, None)
-def AddMaybeI32(builder: flatbuffers.Builder, maybeI32: int):
+def AddMaybeI32(builder, maybeI32):
ScalarStuffAddMaybeI32(builder, maybeI32)
def ScalarStuffAddDefaultI32(builder, defaultI32):
builder.PrependInt32Slot(14, defaultI32, 42)
-def AddDefaultI32(builder: flatbuffers.Builder, defaultI32: int):
+def AddDefaultI32(builder, defaultI32):
ScalarStuffAddDefaultI32(builder, defaultI32)
def ScalarStuffAddJustU32(builder, justU32):
builder.PrependUint32Slot(15, justU32, 0)
-def AddJustU32(builder: flatbuffers.Builder, justU32: int):
+def AddJustU32(builder, justU32):
ScalarStuffAddJustU32(builder, justU32)
def ScalarStuffAddMaybeU32(builder, maybeU32):
builder.PrependUint32Slot(16, maybeU32, None)
-def AddMaybeU32(builder: flatbuffers.Builder, maybeU32: int):
+def AddMaybeU32(builder, maybeU32):
ScalarStuffAddMaybeU32(builder, maybeU32)
def ScalarStuffAddDefaultU32(builder, defaultU32):
builder.PrependUint32Slot(17, defaultU32, 42)
-def AddDefaultU32(builder: flatbuffers.Builder, defaultU32: int):
+def AddDefaultU32(builder, defaultU32):
ScalarStuffAddDefaultU32(builder, defaultU32)
def ScalarStuffAddJustI64(builder, justI64):
builder.PrependInt64Slot(18, justI64, 0)
-def AddJustI64(builder: flatbuffers.Builder, justI64: int):
+def AddJustI64(builder, justI64):
ScalarStuffAddJustI64(builder, justI64)
def ScalarStuffAddMaybeI64(builder, maybeI64):
builder.PrependInt64Slot(19, maybeI64, None)
-def AddMaybeI64(builder: flatbuffers.Builder, maybeI64: int):
+def AddMaybeI64(builder, maybeI64):
ScalarStuffAddMaybeI64(builder, maybeI64)
def ScalarStuffAddDefaultI64(builder, defaultI64):
builder.PrependInt64Slot(20, defaultI64, 42)
-def AddDefaultI64(builder: flatbuffers.Builder, defaultI64: int):
+def AddDefaultI64(builder, defaultI64):
ScalarStuffAddDefaultI64(builder, defaultI64)
def ScalarStuffAddJustU64(builder, justU64):
builder.PrependUint64Slot(21, justU64, 0)
-def AddJustU64(builder: flatbuffers.Builder, justU64: int):
+def AddJustU64(builder, justU64):
ScalarStuffAddJustU64(builder, justU64)
def ScalarStuffAddMaybeU64(builder, maybeU64):
builder.PrependUint64Slot(22, maybeU64, None)
-def AddMaybeU64(builder: flatbuffers.Builder, maybeU64: int):
+def AddMaybeU64(builder, maybeU64):
ScalarStuffAddMaybeU64(builder, maybeU64)
def ScalarStuffAddDefaultU64(builder, defaultU64):
builder.PrependUint64Slot(23, defaultU64, 42)
-def AddDefaultU64(builder: flatbuffers.Builder, defaultU64: int):
+def AddDefaultU64(builder, defaultU64):
ScalarStuffAddDefaultU64(builder, defaultU64)
def ScalarStuffAddJustF32(builder, justF32):
builder.PrependFloat32Slot(24, justF32, 0.0)
-def AddJustF32(builder: flatbuffers.Builder, justF32: float):
+def AddJustF32(builder, justF32):
ScalarStuffAddJustF32(builder, justF32)
def ScalarStuffAddMaybeF32(builder, maybeF32):
builder.PrependFloat32Slot(25, maybeF32, None)
-def AddMaybeF32(builder: flatbuffers.Builder, maybeF32: float):
+def AddMaybeF32(builder, maybeF32):
ScalarStuffAddMaybeF32(builder, maybeF32)
def ScalarStuffAddDefaultF32(builder, defaultF32):
builder.PrependFloat32Slot(26, defaultF32, 42.0)
-def AddDefaultF32(builder: flatbuffers.Builder, defaultF32: float):
+def AddDefaultF32(builder, defaultF32):
ScalarStuffAddDefaultF32(builder, defaultF32)
def ScalarStuffAddJustF64(builder, justF64):
builder.PrependFloat64Slot(27, justF64, 0.0)
-def AddJustF64(builder: flatbuffers.Builder, justF64: float):
+def AddJustF64(builder, justF64):
ScalarStuffAddJustF64(builder, justF64)
def ScalarStuffAddMaybeF64(builder, maybeF64):
builder.PrependFloat64Slot(28, maybeF64, None)
-def AddMaybeF64(builder: flatbuffers.Builder, maybeF64: float):
+def AddMaybeF64(builder, maybeF64):
ScalarStuffAddMaybeF64(builder, maybeF64)
def ScalarStuffAddDefaultF64(builder, defaultF64):
builder.PrependFloat64Slot(29, defaultF64, 42.0)
-def AddDefaultF64(builder: flatbuffers.Builder, defaultF64: float):
+def AddDefaultF64(builder, defaultF64):
ScalarStuffAddDefaultF64(builder, defaultF64)
def ScalarStuffAddJustBool(builder, justBool):
builder.PrependBoolSlot(30, justBool, 0)
-def AddJustBool(builder: flatbuffers.Builder, justBool: bool):
+def AddJustBool(builder, justBool):
ScalarStuffAddJustBool(builder, justBool)
def ScalarStuffAddMaybeBool(builder, maybeBool):
builder.PrependBoolSlot(31, maybeBool, None)
-def AddMaybeBool(builder: flatbuffers.Builder, maybeBool: bool):
+def AddMaybeBool(builder, maybeBool):
ScalarStuffAddMaybeBool(builder, maybeBool)
def ScalarStuffAddDefaultBool(builder, defaultBool):
builder.PrependBoolSlot(32, defaultBool, 1)
-def AddDefaultBool(builder: flatbuffers.Builder, defaultBool: bool):
+def AddDefaultBool(builder, defaultBool):
ScalarStuffAddDefaultBool(builder, defaultBool)
def ScalarStuffAddJustEnum(builder, justEnum):
builder.PrependInt8Slot(33, justEnum, 0)
-def AddJustEnum(builder: flatbuffers.Builder, justEnum: int):
+def AddJustEnum(builder, justEnum):
ScalarStuffAddJustEnum(builder, justEnum)
def ScalarStuffAddMaybeEnum(builder, maybeEnum):
builder.PrependInt8Slot(34, maybeEnum, None)
-def AddMaybeEnum(builder: flatbuffers.Builder, maybeEnum: int):
+def AddMaybeEnum(builder, maybeEnum):
ScalarStuffAddMaybeEnum(builder, maybeEnum)
def ScalarStuffAddDefaultEnum(builder, defaultEnum):
builder.PrependInt8Slot(35, defaultEnum, 1)
-def AddDefaultEnum(builder: flatbuffers.Builder, defaultEnum: int):
+def AddDefaultEnum(builder, defaultEnum):
ScalarStuffAddDefaultEnum(builder, defaultEnum)
def ScalarStuffEnd(builder):