mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-02 12:05:50 +00:00
Bugfix: grpc python code generation location and file suffix (#8359)
* clang-format
* [Python] Replace . with _ in grpc filename suffix
Having filenames with . like `file.fb.grcp`
is not great for Python. Since dots are used for namespaces.
Replacing all of them with _ eg suffix `foo.bar.baz` will become
`foo_bar_baz`.
Restoring the previous default `_fb` suffix.
* [Python] Use namespace in path
This fixes a regression introduced with:
fb9afbafc7
And generates the grpc file in the namespace folder again.
* Sync commandline docs with web docs
This commit is contained in:
@@ -1,52 +1,54 @@
|
||||
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
|
||||
# Generated by the gRPC FlatBuffers compiler. DO NOT EDIT!
|
||||
|
||||
import flatbuffers
|
||||
import grpc
|
||||
|
||||
from models.HelloReply import HelloReply
|
||||
from models.HelloRequest import HelloRequest
|
||||
|
||||
|
||||
class GreeterStub(object):
|
||||
""" Interface exported by the server. """
|
||||
|
||||
'''Interface exported by the server.'''
|
||||
|
||||
def __init__(self, channel):
|
||||
""" Constructor.
|
||||
|
||||
Args:
|
||||
channel: A grpc.Channel.
|
||||
"""
|
||||
|
||||
'''Constructor.
|
||||
|
||||
Args:
|
||||
channel: A grpc.Channel.
|
||||
'''
|
||||
|
||||
self.SayHello = channel.unary_unary(
|
||||
"/models.Greeter/SayHello"
|
||||
)
|
||||
|
||||
method='/models.Greeter/SayHello')
|
||||
|
||||
self.SayManyHellos = channel.unary_stream(
|
||||
"/models.Greeter/SayManyHellos"
|
||||
)
|
||||
|
||||
method='/models.Greeter/SayManyHellos')
|
||||
|
||||
|
||||
class GreeterServicer(object):
|
||||
""" Interface exported by the server. """
|
||||
|
||||
'''Interface exported by the server.'''
|
||||
|
||||
def SayHello(self, request, context):
|
||||
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
||||
context.set_details('Method not implemented!')
|
||||
raise NotImplementedError('Method not implemented!')
|
||||
|
||||
|
||||
|
||||
def SayManyHellos(self, request, context):
|
||||
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
||||
context.set_details('Method not implemented!')
|
||||
raise NotImplementedError('Method not implemented!')
|
||||
|
||||
|
||||
|
||||
|
||||
def add_GreeterServicer_to_server(servicer, server):
|
||||
rpc_method_handlers = {
|
||||
'SayHello': grpc.unary_unary_rpc_method_handler(
|
||||
servicer.SayHello
|
||||
),
|
||||
servicer.SayHello),
|
||||
'SayManyHellos': grpc.unary_stream_rpc_method_handler(
|
||||
servicer.SayManyHellos
|
||||
),
|
||||
servicer.SayManyHellos),
|
||||
}
|
||||
|
||||
generic_handler = grpc.method_handlers_generic_handler(
|
||||
'models.Greeter', rpc_method_handlers)
|
||||
|
||||
server.add_generic_rpc_handlers((generic_handler,))
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user