Fix inconsistent Python union creator function naming (#8981)

This commit is contained in:
tmimmanuel
2026-03-19 12:36:37 +00:00
committed by GitHub
parent 21b033227e
commit 22770f7e85
10 changed files with 401 additions and 3 deletions

View File

@@ -0,0 +1,20 @@
# automatically generated by the FlatBuffers compiler, do not modify
# namespace: union_name_test
class my_test_union(object):
NONE = 0
Foo = 1
Bar = 2
def MyTestUnionCreator(unionType, table):
from flatbuffers.table import Table
if not isinstance(table, Table):
return None
if unionType == my_test_union.Foo:
import union_name_test.Foo
return union_name_test.Foo.FooT.InitFromBuf(table.Bytes, table.Pos)
if unionType == my_test_union.Bar:
import union_name_test.Bar
return union_name_test.Bar.BarT.InitFromBuf(table.Bytes, table.Pos)
return None