From 21ab7459ee43c0d5079e9f7708d453f68a5fd0e5 Mon Sep 17 00:00:00 2001 From: vyq Date: Wed, 31 Jan 2024 10:33:24 -0800 Subject: [PATCH] Adhere to PEP 8 (#15127) Fix https://github.com/protocolbuffers/protobuf/issues/14528 Closes #15127 COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/15127 from vyq:main 0c1f01c74df11adb7fde5595b36ee1131ac9fc7e PiperOrigin-RevId: 603092749 --- src/google/protobuf/compiler/python/generator.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/google/protobuf/compiler/python/generator.cc b/src/google/protobuf/compiler/python/generator.cc index 575d628a5a..fbfe5fd562 100644 --- a/src/google/protobuf/compiler/python/generator.cc +++ b/src/google/protobuf/compiler/python/generator.cc @@ -295,7 +295,7 @@ bool Generator::Generate(const FileDescriptor* file, PrintFileDescriptor(); printer_->Print("_globals = globals()\n"); if (GeneratingDescriptorProto()) { - printer_->Print("if _descriptor._USE_C_DESCRIPTORS == False:\n"); + printer_->Print("if not _descriptor._USE_C_DESCRIPTORS:\n"); printer_->Indent(); // Create enums before message descriptors PrintAllEnumsInFile(); @@ -322,7 +322,7 @@ bool Generator::Generate(const FileDescriptor* file, "_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, '$module_name$', " "_globals)\n", "module_name", module_name); - printer.Print("if _descriptor._USE_C_DESCRIPTORS == False:\n"); + printer.Print("if not _descriptor._USE_C_DESCRIPTORS:\n"); printer_->Indent(); // Descriptor options may have custom extensions. These custom options @@ -549,7 +549,7 @@ void Generator::PrintFileDescriptor() const { m["options"] = OptionsValue(proto_.options().SerializeAsString()); m["serialized_descriptor"] = absl::CHexEscape(file_descriptor_serialized_); if (GeneratingDescriptorProto()) { - printer_->Print("if _descriptor._USE_C_DESCRIPTORS == False:\n"); + printer_->Print("if not _descriptor._USE_C_DESCRIPTORS:\n"); printer_->Indent(); // Pure python's AddSerializedFile() depend on the generated // descriptor_pb2.py thus we can not use AddSerializedFile() when