diff options
author | orivej <orivej@yandex-team.ru> | 2022-02-10 16:45:01 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:01 +0300 |
commit | 2d37894b1b037cf24231090eda8589bbb44fb6fc (patch) | |
tree | be835aa92c6248212e705f25388ebafcf84bc7a1 /contrib/libs/protoc/src/google/protobuf/compiler/python | |
parent | 718c552901d703c502ccbefdfc3c9028d608b947 (diff) | |
download | ydb-2d37894b1b037cf24231090eda8589bbb44fb6fc.tar.gz |
Restoring authorship annotation for <orivej@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/protoc/src/google/protobuf/compiler/python')
-rw-r--r-- | contrib/libs/protoc/src/google/protobuf/compiler/python/python_generator.cc | 68 | ||||
-rw-r--r-- | contrib/libs/protoc/src/google/protobuf/compiler/python/python_generator.h | 6 |
2 files changed, 37 insertions, 37 deletions
diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/python/python_generator.cc b/contrib/libs/protoc/src/google/protobuf/compiler/python/python_generator.cc index 046f1fa4aed..471cc46ef61 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/python/python_generator.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/python/python_generator.cc @@ -79,8 +79,8 @@ TProtoStringType FixEv(const TProtoStringType& filename) { // Returns the Python module name expected for a given .proto filename. TProtoStringType ModuleName(const TProtoStringType& filename) { TProtoStringType basename = StripProto(FixEv(filename)); - ReplaceCharacters(&basename, "-", '_'); - ReplaceCharacters(&basename, "/", '.'); + ReplaceCharacters(&basename, "-", '_'); + ReplaceCharacters(&basename, "/", '.'); return basename + "_pb2"; } @@ -464,10 +464,10 @@ void Generator::PrintFileDescriptor() const { module_alias); } printer_->Print("]"); - } + } } else { printer_->Print("serialized_pb=''\n"); - } + } // TODO(falk): Also print options and fix the message_type, enum_type, // service and extension later in the generation. @@ -598,14 +598,14 @@ void Generator::PrintMessageDescriptors() const { } } -void Generator::PrintServiceDescriptors() const { - for (int i = 0; i < file_->service_count(); ++i) { - PrintServiceDescriptor(*file_->service(i)); - AddServiceToFileDescriptor(*file_->service(i)); - printer_->Print("\n"); - } -} - +void Generator::PrintServiceDescriptors() const { + for (int i = 0; i < file_->service_count(); ++i) { + PrintServiceDescriptor(*file_->service(i)); + AddServiceToFileDescriptor(*file_->service(i)); + printer_->Print("\n"); + } +} + void Generator::PrintServices() const { for (int i = 0; i < file_->service_count(); ++i) { PrintServiceClass(*file_->service(i)); @@ -671,10 +671,10 @@ void Generator::PrintServiceDescriptor( } printer_->Outdent(); - printer_->Print("])\n"); - printer_->Print("_sym_db.RegisterServiceDescriptor($name$)\n", "name", - service_name); - printer_->Print("\n"); + printer_->Print("])\n"); + printer_->Print("_sym_db.RegisterServiceDescriptor($name$)\n", "name", + service_name); + printer_->Print("\n"); } void Generator::PrintDescriptorKeyAndModuleName( @@ -959,18 +959,18 @@ void Generator::AddMessageToFileDescriptor(const Descriptor& descriptor) const { printer_->Print(m, file_descriptor_template); } -void Generator::AddServiceToFileDescriptor( - const ServiceDescriptor& descriptor) const { +void Generator::AddServiceToFileDescriptor( + const ServiceDescriptor& descriptor) const { std::map<TProtoStringType, TProtoStringType> m; - m["descriptor_name"] = kDescriptorKey; - m["service_name"] = descriptor.name(); - m["service_descriptor_name"] = ModuleLevelServiceDescriptorName(descriptor); - const char file_descriptor_template[] = - "$descriptor_name$.services_by_name['$service_name$'] = " - "$service_descriptor_name$\n"; - printer_->Print(m, file_descriptor_template); -} - + m["descriptor_name"] = kDescriptorKey; + m["service_name"] = descriptor.name(); + m["service_descriptor_name"] = ModuleLevelServiceDescriptorName(descriptor); + const char file_descriptor_template[] = + "$descriptor_name$.services_by_name['$service_name$'] = " + "$service_descriptor_name$\n"; + printer_->Print(m, file_descriptor_template); +} + void Generator::AddEnumToFileDescriptor( const EnumDescriptor& descriptor) const { std::map<TProtoStringType, TProtoStringType> m; @@ -1079,10 +1079,10 @@ void Generator::FixForeignFieldsInDescriptors() const { AddExtensionToFileDescriptor(*file_->extension(i)); } - // TODO(jieluo): Move this register to PrintFileDescriptor() when - // FieldDescriptor.file is added in generated file. - printer_->Print("_sym_db.RegisterFileDescriptor($name$)\n", "name", - kDescriptorKey); + // TODO(jieluo): Move this register to PrintFileDescriptor() when + // FieldDescriptor.file is added in generated file. + printer_->Print("_sym_db.RegisterFileDescriptor($name$)\n", "name", + kDescriptorKey); printer_->Print("\n"); } @@ -1450,9 +1450,9 @@ void Generator::CopyPublicDependenciesAliases( for (int i = 0; i < file->public_dependency_count(); ++i) { TProtoStringType module_name = ModuleName(file->public_dependency(i)->name()); TProtoStringType module_alias = ModuleAlias(file->public_dependency(i)->name()); - // There's no module alias in the dependent file if it was generated by - // an old protoc (less than 3.0.0-alpha-1). Use module name in this - // situation. + // There's no module alias in the dependent file if it was generated by + // an old protoc (less than 3.0.0-alpha-1). Use module name in this + // situation. printer_->Print( "try:\n" " $alias$ = $copy_from$.$alias$\n" diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/python/python_generator.h b/contrib/libs/protoc/src/google/protobuf/compiler/python/python_generator.h index 7cf48bb27d9..83dbce951ab 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/python/python_generator.h +++ b/contrib/libs/protoc/src/google/protobuf/compiler/python/python_generator.h @@ -116,7 +116,7 @@ class PROTOC_EXPORT Generator : public CodeGenerator { void AddMessageToFileDescriptor(const Descriptor& descriptor) const; void AddEnumToFileDescriptor(const EnumDescriptor& descriptor) const; void AddExtensionToFileDescriptor(const FieldDescriptor& descriptor) const; - void AddServiceToFileDescriptor(const ServiceDescriptor& descriptor) const; + void AddServiceToFileDescriptor(const ServiceDescriptor& descriptor) const; TProtoStringType FieldReferencingExpression( const Descriptor* containing_type, const FieldDescriptor& field, const TProtoStringType& python_dict_name) const; @@ -131,12 +131,12 @@ class PROTOC_EXPORT Generator : public CodeGenerator { void FixForeignFieldsInNestedExtensions(const Descriptor& descriptor) const; void PrintServices() const; - void PrintServiceDescriptors() const; + void PrintServiceDescriptors() const; void PrintServiceDescriptor(const ServiceDescriptor& descriptor) const; void PrintServiceClass(const ServiceDescriptor& descriptor) const; void PrintServiceStub(const ServiceDescriptor& descriptor) const; void PrintDescriptorKeyAndModuleName( - const ServiceDescriptor& descriptor) const; + const ServiceDescriptor& descriptor) const; void PrintEnumValueDescriptor(const EnumValueDescriptor& descriptor) const; TProtoStringType OptionsValue(const TProtoStringType& serialized_options) const; |