Skip to content

Commit

Permalink
Merge branch 'master' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
dbaileychess authored Apr 26, 2023
2 parents 4875239 + 56ecc1f commit 63a0cee
Show file tree
Hide file tree
Showing 29 changed files with 1,567 additions and 453 deletions.
16 changes: 12 additions & 4 deletions grpc/examples/python/greeter/models/HelloReply.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,20 @@ def Message(self):
return self._tab.String(o + self._tab.Pos)
return None

def HelloReplyStart(builder): builder.StartObject(1)
def HelloReplyStart(builder):
return builder.StartObject(1)

def Start(builder):
return HelloReplyStart(builder)
def HelloReplyAddMessage(builder, message): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(message), 0)

def HelloReplyAddMessage(builder, message):
return builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(message), 0)

def AddMessage(builder, message):
return HelloReplyAddMessage(builder, message)
def HelloReplyEnd(builder): return builder.EndObject()

def HelloReplyEnd(builder):
return builder.EndObject()

def End(builder):
return HelloReplyEnd(builder)
return HelloReplyEnd(builder)
16 changes: 12 additions & 4 deletions grpc/examples/python/greeter/models/HelloRequest.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,20 @@ def Name(self):
return self._tab.String(o + self._tab.Pos)
return None

def HelloRequestStart(builder): builder.StartObject(1)
def HelloRequestStart(builder):
return builder.StartObject(1)

def Start(builder):
return HelloRequestStart(builder)
def HelloRequestAddName(builder, name): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(name), 0)

def HelloRequestAddName(builder, name):
return builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(name), 0)

def AddName(builder, name):
return HelloRequestAddName(builder, name)
def HelloRequestEnd(builder): return builder.EndObject()

def HelloRequestEnd(builder):
return builder.EndObject()

def End(builder):
return HelloRequestEnd(builder)
return HelloRequestEnd(builder)
2 changes: 2 additions & 0 deletions include/flatbuffers/idl.h
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,7 @@ struct IDLOptions {
bool no_leak_private_annotations;
bool require_json_eof;
bool keep_proto_id;
bool python_no_type_prefix_suffix;
ProtoIdGapAction proto_id_gap_action;

// Possible options for the more general generator below.
Expand Down Expand Up @@ -806,6 +807,7 @@ struct IDLOptions {
no_leak_private_annotations(false),
require_json_eof(true),
keep_proto_id(false),
python_no_type_prefix_suffix(false),
proto_id_gap_action(ProtoIdGapAction::WARNING),
mini_reflect(IDLOptions::kNone),
require_explicit_ids(false),
Expand Down
61 changes: 48 additions & 13 deletions python/flatbuffers/reflection/Enum.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,39 +131,74 @@ def DeclarationFile(self):
return self._tab.String(o + self._tab.Pos)
return None

def EnumStart(builder): builder.StartObject(7)
def EnumStart(builder):
return builder.StartObject(7)

def Start(builder):
return EnumStart(builder)
def EnumAddName(builder, name): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(name), 0)

def EnumAddName(builder, name):
return builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(name), 0)

def AddName(builder, name):
return EnumAddName(builder, name)
def EnumAddValues(builder, values): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(values), 0)

def EnumAddValues(builder, values):
return builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(values), 0)

def AddValues(builder, values):
return EnumAddValues(builder, values)
def EnumStartValuesVector(builder, numElems): return builder.StartVector(4, numElems, 4)

def EnumStartValuesVector(builder, numElems):
return builder.StartVector(4, numElems, 4)

def StartValuesVector(builder, numElems):
return EnumStartValuesVector(builder, numElems)
def EnumAddIsUnion(builder, isUnion): builder.PrependBoolSlot(2, isUnion, 0)

def EnumAddIsUnion(builder, isUnion):
return builder.PrependBoolSlot(2, isUnion, 0)

def AddIsUnion(builder, isUnion):
return EnumAddIsUnion(builder, isUnion)
def EnumAddUnderlyingType(builder, underlyingType): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(underlyingType), 0)

def EnumAddUnderlyingType(builder, underlyingType):
return builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(underlyingType), 0)

def AddUnderlyingType(builder, underlyingType):
return EnumAddUnderlyingType(builder, underlyingType)
def EnumAddAttributes(builder, attributes): builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(attributes), 0)

def EnumAddAttributes(builder, attributes):
return builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(attributes), 0)

def AddAttributes(builder, attributes):
return EnumAddAttributes(builder, attributes)
def EnumStartAttributesVector(builder, numElems): return builder.StartVector(4, numElems, 4)

def EnumStartAttributesVector(builder, numElems):
return builder.StartVector(4, numElems, 4)

def StartAttributesVector(builder, numElems):
return EnumStartAttributesVector(builder, numElems)
def EnumAddDocumentation(builder, documentation): builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(documentation), 0)

def EnumAddDocumentation(builder, documentation):
return builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(documentation), 0)

def AddDocumentation(builder, documentation):
return EnumAddDocumentation(builder, documentation)
def EnumStartDocumentationVector(builder, numElems): return builder.StartVector(4, numElems, 4)

def EnumStartDocumentationVector(builder, numElems):
return builder.StartVector(4, numElems, 4)

def StartDocumentationVector(builder, numElems):
return EnumStartDocumentationVector(builder, numElems)
def EnumAddDeclarationFile(builder, declarationFile): builder.PrependUOffsetTRelativeSlot(6, flatbuffers.number_types.UOffsetTFlags.py_type(declarationFile), 0)

def EnumAddDeclarationFile(builder, declarationFile):
return builder.PrependUOffsetTRelativeSlot(6, flatbuffers.number_types.UOffsetTFlags.py_type(declarationFile), 0)

def AddDeclarationFile(builder, declarationFile):
return EnumAddDeclarationFile(builder, declarationFile)
def EnumEnd(builder): return builder.EndObject()

def EnumEnd(builder):
return builder.EndObject()

def End(builder):
return EnumEnd(builder)
return EnumEnd(builder)
46 changes: 36 additions & 10 deletions python/flatbuffers/reflection/EnumVal.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,30 +98,56 @@ def AttributesIsNone(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
return o == 0

def EnumValStart(builder): builder.StartObject(6)
def EnumValStart(builder):
return builder.StartObject(6)

def Start(builder):
return EnumValStart(builder)
def EnumValAddName(builder, name): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(name), 0)

def EnumValAddName(builder, name):
return builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(name), 0)

def AddName(builder, name):
return EnumValAddName(builder, name)
def EnumValAddValue(builder, value): builder.PrependInt64Slot(1, value, 0)

def EnumValAddValue(builder, value):
return builder.PrependInt64Slot(1, value, 0)

def AddValue(builder, value):
return EnumValAddValue(builder, value)
def EnumValAddUnionType(builder, unionType): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(unionType), 0)

def EnumValAddUnionType(builder, unionType):
return builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(unionType), 0)

def AddUnionType(builder, unionType):
return EnumValAddUnionType(builder, unionType)
def EnumValAddDocumentation(builder, documentation): builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(documentation), 0)

def EnumValAddDocumentation(builder, documentation):
return builder.PrependUOffsetTRelativeSlot(4, flatbuffers.number_types.UOffsetTFlags.py_type(documentation), 0)

def AddDocumentation(builder, documentation):
return EnumValAddDocumentation(builder, documentation)
def EnumValStartDocumentationVector(builder, numElems): return builder.StartVector(4, numElems, 4)

def EnumValStartDocumentationVector(builder, numElems):
return builder.StartVector(4, numElems, 4)

def StartDocumentationVector(builder, numElems):
return EnumValStartDocumentationVector(builder, numElems)
def EnumValAddAttributes(builder, attributes): builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(attributes), 0)

def EnumValAddAttributes(builder, attributes):
return builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(attributes), 0)

def AddAttributes(builder, attributes):
return EnumValAddAttributes(builder, attributes)
def EnumValStartAttributesVector(builder, numElems): return builder.StartVector(4, numElems, 4)

def EnumValStartAttributesVector(builder, numElems):
return builder.StartVector(4, numElems, 4)

def StartAttributesVector(builder, numElems):
return EnumValStartAttributesVector(builder, numElems)
def EnumValEnd(builder): return builder.EndObject()

def EnumValEnd(builder):
return builder.EndObject()

def End(builder):
return EnumValEnd(builder)
return EnumValEnd(builder)
86 changes: 68 additions & 18 deletions python/flatbuffers/reflection/Field.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,54 +155,104 @@ def Padding(self):
return self._tab.Get(flatbuffers.number_types.Uint16Flags, o + self._tab.Pos)
return 0

def FieldStart(builder): builder.StartObject(13)
def FieldStart(builder):
return builder.StartObject(13)

def Start(builder):
return FieldStart(builder)
def FieldAddName(builder, name): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(name), 0)

def FieldAddName(builder, name):
return builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(name), 0)

def AddName(builder, name):
return FieldAddName(builder, name)
def FieldAddType(builder, type): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(type), 0)

def FieldAddType(builder, type):
return builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(type), 0)

def AddType(builder, type):
return FieldAddType(builder, type)
def FieldAddId(builder, id): builder.PrependUint16Slot(2, id, 0)

def FieldAddId(builder, id):
return builder.PrependUint16Slot(2, id, 0)

def AddId(builder, id):
return FieldAddId(builder, id)
def FieldAddOffset(builder, offset): builder.PrependUint16Slot(3, offset, 0)

def FieldAddOffset(builder, offset):
return builder.PrependUint16Slot(3, offset, 0)

def AddOffset(builder, offset):
return FieldAddOffset(builder, offset)
def FieldAddDefaultInteger(builder, defaultInteger): builder.PrependInt64Slot(4, defaultInteger, 0)

def FieldAddDefaultInteger(builder, defaultInteger):
return builder.PrependInt64Slot(4, defaultInteger, 0)

def AddDefaultInteger(builder, defaultInteger):
return FieldAddDefaultInteger(builder, defaultInteger)
def FieldAddDefaultReal(builder, defaultReal): builder.PrependFloat64Slot(5, defaultReal, 0.0)

def FieldAddDefaultReal(builder, defaultReal):
return builder.PrependFloat64Slot(5, defaultReal, 0.0)

def AddDefaultReal(builder, defaultReal):
return FieldAddDefaultReal(builder, defaultReal)
def FieldAddDeprecated(builder, deprecated): builder.PrependBoolSlot(6, deprecated, 0)

def FieldAddDeprecated(builder, deprecated):
return builder.PrependBoolSlot(6, deprecated, 0)

def AddDeprecated(builder, deprecated):
return FieldAddDeprecated(builder, deprecated)
def FieldAddRequired(builder, required): builder.PrependBoolSlot(7, required, 0)

def FieldAddRequired(builder, required):
return builder.PrependBoolSlot(7, required, 0)

def AddRequired(builder, required):
return FieldAddRequired(builder, required)
def FieldAddKey(builder, key): builder.PrependBoolSlot(8, key, 0)

def FieldAddKey(builder, key):
return builder.PrependBoolSlot(8, key, 0)

def AddKey(builder, key):
return FieldAddKey(builder, key)
def FieldAddAttributes(builder, attributes): builder.PrependUOffsetTRelativeSlot(9, flatbuffers.number_types.UOffsetTFlags.py_type(attributes), 0)

def FieldAddAttributes(builder, attributes):
return builder.PrependUOffsetTRelativeSlot(9, flatbuffers.number_types.UOffsetTFlags.py_type(attributes), 0)

def AddAttributes(builder, attributes):
return FieldAddAttributes(builder, attributes)
def FieldStartAttributesVector(builder, numElems): return builder.StartVector(4, numElems, 4)

def FieldStartAttributesVector(builder, numElems):
return builder.StartVector(4, numElems, 4)

def StartAttributesVector(builder, numElems):
return FieldStartAttributesVector(builder, numElems)
def FieldAddDocumentation(builder, documentation): builder.PrependUOffsetTRelativeSlot(10, flatbuffers.number_types.UOffsetTFlags.py_type(documentation), 0)

def FieldAddDocumentation(builder, documentation):
return builder.PrependUOffsetTRelativeSlot(10, flatbuffers.number_types.UOffsetTFlags.py_type(documentation), 0)

def AddDocumentation(builder, documentation):
return FieldAddDocumentation(builder, documentation)
def FieldStartDocumentationVector(builder, numElems): return builder.StartVector(4, numElems, 4)

def FieldStartDocumentationVector(builder, numElems):
return builder.StartVector(4, numElems, 4)

def StartDocumentationVector(builder, numElems):
return FieldStartDocumentationVector(builder, numElems)
def FieldAddOptional(builder, optional): builder.PrependBoolSlot(11, optional, 0)

def FieldAddOptional(builder, optional):
return builder.PrependBoolSlot(11, optional, 0)

def AddOptional(builder, optional):
return FieldAddOptional(builder, optional)
def FieldAddPadding(builder, padding): builder.PrependUint16Slot(12, padding, 0)

def FieldAddPadding(builder, padding):
return builder.PrependUint16Slot(12, padding, 0)

def AddPadding(builder, padding):
return FieldAddPadding(builder, padding)
def FieldEnd(builder): return builder.EndObject()

def FieldEnd(builder):
return builder.EndObject()

def End(builder):
return FieldEnd(builder)
return FieldEnd(builder)
21 changes: 16 additions & 5 deletions python/flatbuffers/reflection/KeyValue.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,26 @@ def Value(self):
return self._tab.String(o + self._tab.Pos)
return None

def KeyValueStart(builder): builder.StartObject(2)
def KeyValueStart(builder):
return builder.StartObject(2)

def Start(builder):
return KeyValueStart(builder)
def KeyValueAddKey(builder, key): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(key), 0)

def KeyValueAddKey(builder, key):
return builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(key), 0)

def AddKey(builder, key):
return KeyValueAddKey(builder, key)
def KeyValueAddValue(builder, value): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(value), 0)

def KeyValueAddValue(builder, value):
return builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(value), 0)

def AddValue(builder, value):
return KeyValueAddValue(builder, value)
def KeyValueEnd(builder): return builder.EndObject()

def KeyValueEnd(builder):
return builder.EndObject()

def End(builder):
return KeyValueEnd(builder)
return KeyValueEnd(builder)
Loading

0 comments on commit 63a0cee

Please sign in to comment.