Python 3.9.13 (tags/v3.9.13:6de2ca5, May 17 2022, 16:36:42) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from google.protobuf.internal import encoder
>>> encoder.FloatEncoder
<function _FloatingPointEncoder.<locals>.SpecificEncoder at 0x0000023D876F3EE0>
>>> import inspect
>>> inspect.signature(encoder.FloatEncoder)
<Signature (field_number, is_repeated, is_packed)>
>>> inner_encoder = encoder.FloatEncoder(1, False, False)
>>> inner_encoder
<function _FloatingPointEncoder.<locals>.SpecificEncoder.<locals>.EncodeField at 0x0000023D8721F0D0>
>>> inspect.signature(inner_encoder)
<Signature (write, value, unused_deterministic=None)>
Here's the levels of code:
FloatEncoder = _FloatingPointEncoder(wire_format.WIRETYPE_FIXED32, '<f')`
def _FloatingPointEncoder(wire_type, format):
...
def SpecificEncoder(field_number, is_repeated, is_packed): ...
...
return SpecificEncoder
This shows that FloatEncoder should be typed the same as, e.g. BoolEncoder, which is
def BoolEncoder(field_number: int, is_repeated: bool, is_packed: bool) -> _Encoder
The same applies for
Int32Encoder: _Encoder
UInt32Encoder: _Encoder
SInt32Encoder: _Encoder
Fixed32Encoder: _Encoder
Fixed64Encoder: _Encoder
SFixed32Encoder: _Encoder
SFixed64Encoder: _Encoder
FloatEncoder: _Encoder
DoubleEncoder: _Encoder
Here's the levels of code:
This shows that FloatEncoder should be typed the same as, e.g. BoolEncoder, which is
The same applies for