Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions python/flatbuffers/reflection/Enum.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def Values(self, j):
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 flatbuffers.reflection.EnumVal import EnumVal
obj = EnumVal()
obj.Init(self._tab.Bytes, x)
return obj
Expand Down Expand Up @@ -72,7 +72,7 @@ def UnderlyingType(self):
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 flatbuffers.reflection.Type import Type
obj = Type()
obj.Init(self._tab.Bytes, x)
return obj
Expand All @@ -85,7 +85,7 @@ def Attributes(self, j):
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 flatbuffers.reflection.KeyValue import KeyValue
obj = KeyValue()
obj.Init(self._tab.Bytes, x)
return obj
Expand Down
4 changes: 2 additions & 2 deletions python/flatbuffers/reflection/EnumVal.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def UnionType(self):
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 flatbuffers.reflection.Type import Type
obj = Type()
obj.Init(self._tab.Bytes, x)
return obj
Expand Down Expand Up @@ -80,7 +80,7 @@ def Attributes(self, j):
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 flatbuffers.reflection.KeyValue import KeyValue
obj = KeyValue()
obj.Init(self._tab.Bytes, x)
return obj
Expand Down
4 changes: 2 additions & 2 deletions python/flatbuffers/reflection/Field.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def Type(self):
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 flatbuffers.reflection.Type import Type
obj = Type()
obj.Init(self._tab.Bytes, x)
return obj
Expand Down Expand Up @@ -102,7 +102,7 @@ def Attributes(self, j):
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 flatbuffers.reflection.KeyValue import KeyValue
obj = KeyValue()
obj.Init(self._tab.Bytes, x)
return obj
Expand Down
4 changes: 2 additions & 2 deletions python/flatbuffers/reflection/Object.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def Fields(self, j):
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 flatbuffers.reflection.Field import Field
obj = Field()
obj.Init(self._tab.Bytes, x)
return obj
Expand Down Expand Up @@ -88,7 +88,7 @@ def Attributes(self, j):
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 flatbuffers.reflection.KeyValue import KeyValue
obj = KeyValue()
obj.Init(self._tab.Bytes, x)
return obj
Expand Down
6 changes: 3 additions & 3 deletions python/flatbuffers/reflection/RPCCall.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def Request(self):
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 flatbuffers.reflection.Object import Object
obj = Object()
obj.Init(self._tab.Bytes, x)
return obj
Expand All @@ -51,7 +51,7 @@ def Response(self):
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 flatbuffers.reflection.Object import Object
obj = Object()
obj.Init(self._tab.Bytes, x)
return obj
Expand All @@ -64,7 +64,7 @@ def Attributes(self, j):
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 flatbuffers.reflection.KeyValue import KeyValue
obj = KeyValue()
obj.Init(self._tab.Bytes, x)
return obj
Expand Down
10 changes: 5 additions & 5 deletions python/flatbuffers/reflection/Schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def Objects(self, j):
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 flatbuffers.reflection.Object import Object
obj = Object()
obj.Init(self._tab.Bytes, x)
return obj
Expand All @@ -60,7 +60,7 @@ def Enums(self, j):
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 flatbuffers.reflection.Enum import Enum
obj = Enum()
obj.Init(self._tab.Bytes, x)
return obj
Expand Down Expand Up @@ -97,7 +97,7 @@ def RootTable(self):
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 flatbuffers.reflection.Object import Object
obj = Object()
obj.Init(self._tab.Bytes, x)
return obj
Expand All @@ -110,7 +110,7 @@ def Services(self, j):
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 flatbuffers.reflection.Service import Service
obj = Service()
obj.Init(self._tab.Bytes, x)
return obj
Expand Down Expand Up @@ -144,7 +144,7 @@ def FbsFiles(self, j):
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 flatbuffers.reflection.SchemaFile import SchemaFile
obj = SchemaFile()
obj.Init(self._tab.Bytes, x)
return obj
Expand Down
4 changes: 2 additions & 2 deletions python/flatbuffers/reflection/Service.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def Calls(self, j):
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 flatbuffers.reflection.RPCCall import RPCCall
obj = RPCCall()
obj.Init(self._tab.Bytes, x)
return obj
Expand All @@ -67,7 +67,7 @@ def Attributes(self, j):
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 flatbuffers.reflection.KeyValue import KeyValue
obj = KeyValue()
obj.Init(self._tab.Bytes, x)
return obj
Expand Down
4 changes: 2 additions & 2 deletions python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from setuptools import setup
from setuptools import setup, find_packages

setup(
name='flatbuffers',
Expand All @@ -26,7 +26,7 @@
'`Flatbuffers <https://google.github.io/flatbuffers/>`_ '
'serialization format.'
),
packages=['flatbuffers'],
packages=find_packages(),
include_package_data=True,
requires=[],
description='The FlatBuffers serialization format for Python',
Expand Down
17 changes: 17 additions & 0 deletions tests/py_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3029,6 +3029,23 @@ def test_nested_union_tables(self):
)


class TestReflectionImport(unittest.TestCase):

def test_import_reflection(self):
"""Test that flatbuffers.reflection module can be imported."""
try:
import flatbuffers.reflection
# Some example imports to test
from flatbuffers.reflection.Schema import Schema
from flatbuffers.reflection.Object import Object
from flatbuffers.reflection.Field import Field
from flatbuffers.reflection.Type import Type
from flatbuffers.reflection.Enum import Enum
# If we got here, the import was successful
except ImportError as e:
self.fail(f"Failed to import flatbuffers.reflection: {e}")


class TestBuilderClear(unittest.TestCase):

def test_consistency(self):
Expand Down