diff options
author | Jan Tattermusch <jtattermusch@users.noreply.github.com> | 2016-04-28 18:42:23 -0700 |
---|---|---|
committer | Jan Tattermusch <jtattermusch@users.noreply.github.com> | 2016-04-28 18:42:23 -0700 |
commit | 2e4bfed08209f1382f1bac82013a7481ffec3f4e (patch) | |
tree | a4f95daa527d64d134dc28360ffc3d835c369ed0 /src/compiler/python_generator.cc | |
parent | 45177c00feba428a78b98bcd5a3a402ffaaf59ce (diff) | |
parent | 832ae81b21025c415fc183b1aa18e063c44180a3 (diff) |
Merge pull request #6330 from soltanmm/6264
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.cc | 10 |
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; |