Skip to content

Several module members missing from stubs/protobuf/google/protobuf/internal/encoder.pyi #15149

@fizbin

Description

@fizbin

The module google.protobuf.internal.encoder in the protobuf package has several lines similar to this, where the programmers define multiple module members in a single line:

Int32Sizer = Int64Sizer = EnumSizer = _SimpleSizer(_SignedVarintSize)

UInt32Sizer = UInt64Sizer = _SimpleSizer(_VarintSize)

SInt32Sizer = SInt64Sizer = _ModifiedSizer(
    _SignedVarintSize, wire_format.ZigZagEncode)

Fixed32Sizer = SFixed32Sizer = FloatSizer  = _FixedSizer(4)
Fixed64Sizer = SFixed64Sizer = DoubleSizer = _FixedSizer(8)

In the stubs/protobuf/google/protobuf/internal/encoder.pyi file, only the first members on each line appear, leading to mypy claiming things like Module has no attribute "UInt64Sizer", when it does.

As far as I can tell, the .pyi file needs the following additions:

Int64Sizer: _Sizer
EnumSizer: _Sizer
UInt64Sizer: _Sizer
SInt64Sizer: _Sizer
SFixed32Sizer: _Sizer
FloatSizer: _Sizer
SFixed64Sizer: _Sizer
DoubleSizer: _Sizer

Int64Encoder: _Encoder
EnumEncoder: _Encoder
UInt64Encoder: _Encoder
SInt64Encoder: _Encoder

Metadata

Metadata

Assignees

No one assigned

    Labels

    stubs: incompleteAnnotations or sub-modules missing from an existing package or module

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions