mirror of
https://github.com/google/flatbuffers.git
synced 2025-04-08 09:12:14 +08:00
* Move `namer.h` and `idl_namer.h` to `include/codegen` so they can be reused from `grpc` dirqectory. * [gRPC] Update the Python generator to produce typed handlers and Python stubs if requested. * [gRPC] Document the newly added compiler flags.
59 lines
1.6 KiB
Python
59 lines
1.6 KiB
Python
# automatically generated by the FlatBuffers compiler, do not modify
|
|
|
|
# namespace: example
|
|
|
|
import flatbuffers
|
|
from typing import Any
|
|
class HelloRequest(object):
|
|
__slots__ = ['_tab']
|
|
|
|
@classmethod
|
|
def GetRootAs(cls, buf, offset: int = 0):
|
|
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
|
|
x = HelloRequest()
|
|
x.Init(buf, n + offset)
|
|
return x
|
|
|
|
@classmethod
|
|
def GetRootAsHelloRequest(cls, buf, offset=0):
|
|
"""This method is deprecated. Please switch to GetRootAs."""
|
|
return cls.GetRootAs(buf, offset)
|
|
# HelloRequest
|
|
def Init(self, buf: bytes, pos: int):
|
|
self._tab = flatbuffers.table.Table(buf, pos)
|
|
|
|
def HelloRequestStart(builder: flatbuffers.Builder):
|
|
builder.StartObject(0)
|
|
|
|
def HelloRequestEnd(builder: flatbuffers.Builder) -> int:
|
|
return builder.EndObject()
|
|
|
|
|
|
|
|
class HelloResponse(object):
|
|
__slots__ = ['_tab']
|
|
|
|
@classmethod
|
|
def GetRootAs(cls, buf, offset: int = 0):
|
|
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
|
|
x = HelloResponse()
|
|
x.Init(buf, n + offset)
|
|
return x
|
|
|
|
@classmethod
|
|
def GetRootAsHelloResponse(cls, buf, offset=0):
|
|
"""This method is deprecated. Please switch to GetRootAs."""
|
|
return cls.GetRootAs(buf, offset)
|
|
# HelloResponse
|
|
def Init(self, buf: bytes, pos: int):
|
|
self._tab = flatbuffers.table.Table(buf, pos)
|
|
|
|
def HelloResponseStart(builder: flatbuffers.Builder):
|
|
builder.StartObject(0)
|
|
|
|
def HelloResponseEnd(builder: flatbuffers.Builder) -> int:
|
|
return builder.EndObject()
|
|
|
|
|
|
|