aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/compiler/python_generator.cc
diff options
context:
space:
mode:
authorGravatar Masood Malekghassemi <atash@google.com>2016-04-27 18:38:54 -0700
committerGravatar Masood Malekghassemi <atash@google.com>2016-04-27 18:42:31 -0700
commit832ae81b21025c415fc183b1aa18e063c44180a3 (patch)
tree0fd5aee2eb0928c7baf2c85c843c07e5897acbcc /src/compiler/python_generator.cc
parentcec42984a0374465de9b2626f16b0efa960a66d0 (diff)
Allow additive changes to protos w/o forcing user implementation
Diffstat (limited to 'src/compiler/python_generator.cc')
-rw-r--r--src/compiler/python_generator.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/compiler/python_generator.cc b/src/compiler/python_generator.cc
index 02c032800b..59137e1c92 100644
--- a/src/compiler/python_generator.cc
+++ b/src/compiler/python_generator.cc
@@ -190,7 +190,7 @@ bool PrintBetaServicer(const ServiceDescriptor* service,
"Documentation", doc,
});
out->Print("\n");
- out->Print(dict, "class Beta$Service$Servicer(six.with_metaclass(abc.ABCMeta, object)):\n");
+ out->Print(dict, "class Beta$Service$Servicer(object):\n");
{
IndentScope raii_class_indent(out);
out->Print(dict, "\"\"\"$Documentation$\"\"\"\n");
@@ -198,12 +198,11 @@ bool PrintBetaServicer(const ServiceDescriptor* service,
auto meth = service->method(i);
grpc::string arg_name = meth->client_streaming() ?
"request_iterator" : "request";
- out->Print("@abc.abstractmethod\n");
out->Print("def $Method$(self, $ArgName$, context):\n",
"Method", meth->name(), "ArgName", arg_name);
{
IndentScope raii_method_indent(out);
- out->Print("raise NotImplementedError()\n");
+ out->Print("context.code(beta_interfaces.StatusCode.UNIMPLEMENTED)\n");
}
}
}
@@ -218,7 +217,7 @@ bool PrintBetaStub(const ServiceDescriptor* service,
"Documentation", doc,
});
out->Print("\n");
- out->Print(dict, "class Beta$Service$Stub(six.with_metaclass(abc.ABCMeta, object)):\n");
+ out->Print(dict, "class Beta$Service$Stub(object):\n");
{
IndentScope raii_class_indent(out);
out->Print(dict, "\"\"\"$Documentation$\"\"\"\n");
@@ -227,7 +226,6 @@ bool PrintBetaStub(const ServiceDescriptor* service,
grpc::string arg_name = meth->client_streaming() ?
"request_iterator" : "request";
auto methdict = ListToDict({"Method", meth->name(), "ArgName", arg_name});
- out->Print("@abc.abstractmethod\n");
out->Print(methdict, "def $Method$(self, $ArgName$, timeout):\n");
{
IndentScope raii_method_indent(out);
@@ -450,6 +448,8 @@ bool PrintPreamble(const FileDescriptor* file,
out->Print("import six\n");
out->Print("from $Package$ import implementations as beta_implementations\n",
"Package", config.beta_package_root);
+ out->Print("from $Package$ import interfaces as beta_interfaces\n",
+ "Package", config.beta_package_root);
out->Print("from grpc.framework.common import cardinality\n");
out->Print("from grpc.framework.interfaces.face import utilities as face_utilities\n");
return true;