aboutsummaryrefslogtreecommitdiff
path: root/src/google/protobuf/compiler/python
diff options
context:
space:
mode:
authorKrishna <krishna.nm86@gmail.com>2014-12-11 07:45:32 +0100
committerKrishna <krishna.nm86@gmail.com>2014-12-11 07:45:32 +0100
commit060a2096a3f3d7c66a64a1a41a1d2e1e18aea82d (patch)
tree8a4536427113ce6127313c687bf69b64e332abcb /src/google/protobuf/compiler/python
parent7654f78029030238c6dff3826671393f4e6db359 (diff)
downloadprotobuf-060a2096a3f3d7c66a64a1a41a1d2e1e18aea82d.tar.gz
protobuf-060a2096a3f3d7c66a64a1a41a1d2e1e18aea82d.tar.bz2
protobuf-060a2096a3f3d7c66a64a1a41a1d2e1e18aea82d.zip
Reverted changes to cpp_helpers.cc and made code reviews to python_geenerator.cc
Diffstat (limited to 'src/google/protobuf/compiler/python')
-rw-r--r--src/google/protobuf/compiler/python/python_generator.cc16
-rw-r--r--src/google/protobuf/compiler/python/python_generator.h2
2 files changed, 13 insertions, 5 deletions
diff --git a/src/google/protobuf/compiler/python/python_generator.cc b/src/google/protobuf/compiler/python/python_generator.cc
index e4b73f94..fca94a31 100644
--- a/src/google/protobuf/compiler/python/python_generator.cc
+++ b/src/google/protobuf/compiler/python/python_generator.cc
@@ -581,8 +581,7 @@ void Generator::PrintServiceDescriptor(
}
-void Generator::PrintDescriptorKeyAndModuleName(const ServiceDescriptor& descriptor, const char* keyandmodule) const {
- printer_->Print(keyandmodule,"class_name", descriptor.name());
+void Generator::PrintDescriptorKeyAndModuleName(const ServiceDescriptor& descriptor) const {
printer_->Indent();
printer_->Print(
"$descriptor_key$ = $descriptor_name$,\n",
@@ -596,11 +595,20 @@ void Generator::PrintDescriptorKeyAndModuleName(const ServiceDescriptor& descrip
}
void Generator::PrintServiceClass(const ServiceDescriptor& descriptor) const {
- Generator::PrintDescriptorKeyAndModuleName(descriptor, "$class_name$_Stub = service_reflection.GeneratedServiceStubType('$class_name$_Stub', ($class_name$,), dict(\n");
+ // Print the service.
+ printer_->Print("$class_name$ = service_reflection.GeneratedServiceType("
+ "'$class_name$', (_service.Service,), dict(\n",
+ "class_name", descriptor.name());
+ Generator::PrintDescriptorKeyAndModuleName(descriptor);
}
void Generator::PrintServiceStub(const ServiceDescriptor& descriptor) const {
- Generator::PrintDescriptorKeyAndModuleName(descriptor, "$class_name$ = service_reflection.GeneratedServiceType('$class_name$', (_service.Service,), dict(\n");
+ // Print the service stub.
+ printer_->Print("$class_name$_Stub = "
+ "service_reflection.GeneratedServiceStubType("
+ "'$class_name$_Stub', ($class_name$,), dict(\n",
+ "class_name", descriptor.name());
+ Generator::PrintDescriptorKeyAndModuleName(descriptor);
}
// Prints statement assigning ModuleLevelDescriptorName(message_descriptor)
diff --git a/src/google/protobuf/compiler/python/python_generator.h b/src/google/protobuf/compiler/python/python_generator.h
index 6b8b76f3..ee68ad72 100644
--- a/src/google/protobuf/compiler/python/python_generator.h
+++ b/src/google/protobuf/compiler/python/python_generator.h
@@ -127,7 +127,7 @@ class LIBPROTOC_EXPORT Generator : public CodeGenerator {
void PrintServiceDescriptor(const ServiceDescriptor& descriptor) const;
void PrintServiceClass(const ServiceDescriptor& descriptor) const;
void PrintServiceStub(const ServiceDescriptor& descriptor) const;
- void PrintDescriptorKeyAndModuleName(const ServiceDescriptor& descriptor, const char* keyandmodule) const ;
+ void PrintDescriptorKeyAndModuleName(const ServiceDescriptor& descriptor) const ;
void PrintEnumValueDescriptor(const EnumValueDescriptor& descriptor) const;
string OptionsValue(const string& class_name,