Skip to content

Output _pb2.py that adheres to PEP 8 #14528

@ghost

Description

What language does this apply to?
If it's a proto syntax change, is it for proto2 or proto3? proto3
If it's about generated code change, what programming language? Python

Describe the problem you are trying to solve.

  1. Make .proto
    syntax = "proto3";
    
    package foo;
    
    message Foo {
        string foo = 1;
    }
    
  2. Compile .proto
    $ protoc --python_out=. foo.proto
    
  3. Lint
    $ flake8
    
    # Output
    # E712 comparison to False should be 'if cond is False:' or 'if not cond:'
    
    # Line in _pb2.py
    # if _descriptor._USE_C_DESCRIPTORS == False:
    

Describe the solution you'd like

  1. Use not if the expected bool value is False

Describe alternatives you've considered

  1. Edit _pb2.py file

Additional context

$ protoc --version
libprotoc 24.4

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions