From dbd4497fa84e493f7cf175001e7755319292f3fb Mon Sep 17 00:00:00 2001 From: Harsh Vardhan Date: Sun, 26 Feb 2017 19:25:09 +0530 Subject: remove python specific code --- build.yaml | 4 ++-- src/compiler/protobuf_plugin.h | 4 ---- src/compiler/python_generator.cc | 31 ++++++++++++------------------- src/compiler/schema_interface.h | 2 -- 4 files changed, 14 insertions(+), 27 deletions(-) diff --git a/build.yaml b/build.yaml index 5f474e2f3e..175d8ecb3e 100644 --- a/build.yaml +++ b/build.yaml @@ -1282,8 +1282,6 @@ libs: language: c++ headers: - src/compiler/config.h - - src/compiler/schema_interface.h - - src/compiler/protobuf_plugin.h - src/compiler/cpp_generator.h - src/compiler/cpp_generator_helpers.h - src/compiler/csharp_generator.h @@ -1295,6 +1293,7 @@ libs: - src/compiler/objective_c_generator_helpers.h - src/compiler/php_generator.h - src/compiler/php_generator_helpers.h + - src/compiler/protobuf_plugin.h - src/compiler/python_generator.h - src/compiler/python_generator_helpers.h - src/compiler/python_private_generator.h @@ -1302,6 +1301,7 @@ libs: - src/compiler/ruby_generator_helpers-inl.h - src/compiler/ruby_generator_map-inl.h - src/compiler/ruby_generator_string-inl.h + - src/compiler/schema_interface.h src: - src/compiler/cpp_generator.cc - src/compiler/csharp_generator.cc diff --git a/src/compiler/protobuf_plugin.h b/src/compiler/protobuf_plugin.h index 0f9f647f0e..789e4cd834 100644 --- a/src/compiler/protobuf_plugin.h +++ b/src/compiler/protobuf_plugin.h @@ -96,10 +96,6 @@ class ProtoBufMethod : public grpc_generator::Method { return !method_->client_streaming() && method_->server_streaming(); } - bool python_ClientStreaming() const { return method_->client_streaming(); } - - bool python_ServerStreaming() const { return method_->server_streaming(); } - bool BidiStreaming() const { return method_->client_streaming() && method_->server_streaming(); } diff --git a/src/compiler/python_generator.cc b/src/compiler/python_generator.cc index 523fe801d1..5d54d21ffe 100644 --- a/src/compiler/python_generator.cc +++ b/src/compiler/python_generator.cc @@ -135,7 +135,7 @@ bool PrivateGenerator::PrintBetaServicer(const grpc_generator::Service* service, for (int i = 0; i < service->method_count(); ++i) { auto method = service->method(i); grpc::string arg_name = - method->python_ClientStreaming() ? "request_iterator" : "request"; + method->ClientStreaming() ? "request_iterator" : "request"; StringMap method_dict; method_dict["Method"] = method->name(); method_dict["ArgName"] = arg_name; @@ -171,7 +171,7 @@ bool PrivateGenerator::PrintBetaStub(const grpc_generator::Service* service, for (int i = 0; i < service->method_count(); ++i) { auto method = service->method(i); grpc::string arg_name = - method->python_ClientStreaming() ? "request_iterator" : "request"; + method->ClientStreaming() ? "request_iterator" : "request"; StringMap method_dict; method_dict["Method"] = method->name(); method_dict["ArgName"] = arg_name; @@ -184,7 +184,7 @@ bool PrivateGenerator::PrintBetaStub(const grpc_generator::Service* service, PrintAllComments(method_comments, out); out->Print("raise NotImplementedError()\n"); } - if (!method->python_ServerStreaming()) { + if (!method->ServerStreaming()) { out->Print(method_dict, "$Method$.future = None\n"); } } @@ -215,10 +215,8 @@ bool PrivateGenerator::PrintBetaServerFactory( for (int i = 0; i < service->method_count(); ++i) { auto method = service->method(i); const grpc::string method_implementation_constructor = - grpc::string(method->python_ClientStreaming() ? "stream_" - : "unary_") + - grpc::string(method->python_ServerStreaming() ? "stream_" - : "unary_") + + grpc::string(method->ClientStreaming() ? "stream_" : "unary_") + + grpc::string(method->ServerStreaming() ? "stream_" : "unary_") + "inline"; grpc::string input_message_module_and_class; if (!method->get_module_and_message_path_input( @@ -324,9 +322,8 @@ bool PrivateGenerator::PrintBetaStubFactory( for (int i = 0; i < service->method_count(); ++i) { auto method = service->method(i); const grpc::string method_cardinality = - grpc::string(method->python_ClientStreaming() ? "STREAM" : "UNARY") + - "_" + - grpc::string(method->python_ServerStreaming() ? "STREAM" : "UNARY"); + grpc::string(method->ClientStreaming() ? "STREAM" : "UNARY") + "_" + + grpc::string(method->ServerStreaming() ? "STREAM" : "UNARY"); grpc::string input_message_module_and_class; if (!method->get_module_and_message_path_input( &input_message_module_and_class, generator_file_name, @@ -430,10 +427,8 @@ bool PrivateGenerator::PrintStub( for (int i = 0; i < service->method_count(); ++i) { auto method = service->method(i); grpc::string multi_callable_constructor = - grpc::string(method->python_ClientStreaming() ? "stream" - : "unary") + - "_" + - grpc::string(method->python_ServerStreaming() ? "stream" : "unary"); + grpc::string(method->ClientStreaming() ? "stream" : "unary") + "_" + + grpc::string(method->ServerStreaming() ? "stream" : "unary"); grpc::string request_module_and_class; if (!method->get_module_and_message_path_input( &request_module_and_class, generator_file_name, @@ -486,7 +481,7 @@ bool PrivateGenerator::PrintServicer(const grpc_generator::Service* service, for (int i = 0; i < service->method_count(); ++i) { auto method = service->method(i); grpc::string arg_name = - method->python_ClientStreaming() ? "request_iterator" : "request"; + method->ClientStreaming() ? "request_iterator" : "request"; StringMap method_dict; method_dict["Method"] = method->name(); method_dict["ArgName"] = arg_name; @@ -522,10 +517,8 @@ bool PrivateGenerator::PrintAddServicerToServer( for (int i = 0; i < service->method_count(); ++i) { auto method = service->method(i); grpc::string method_handler_constructor = - grpc::string(method->python_ClientStreaming() ? "stream" - : "unary") + - "_" + grpc::string(method->python_ServerStreaming() ? "stream" - : "unary") + + grpc::string(method->ClientStreaming() ? "stream" : "unary") + "_" + + grpc::string(method->ServerStreaming() ? "stream" : "unary") + "_rpc_method_handler"; grpc::string request_module_and_class; if (!method->get_module_and_message_path_input( diff --git a/src/compiler/schema_interface.h b/src/compiler/schema_interface.h index 88de1ecdf7..41e9322a0d 100644 --- a/src/compiler/schema_interface.h +++ b/src/compiler/schema_interface.h @@ -81,9 +81,7 @@ struct Method : public CommentHolder { virtual grpc::string get_output_type_name() const = 0; virtual bool NoStreaming() const = 0; virtual bool ClientStreaming() const = 0; - virtual bool python_ClientStreaming() const = 0; virtual bool ServerStreaming() const = 0; - virtual bool python_ServerStreaming() const = 0; virtual bool BidiStreaming() const = 0; }; -- cgit v1.2.3