module documentation

Reusable value codecs for generated protobuf field dispatch.

Class ValueCodec Wire operations and ownership hooks for one protobuf value type.
Function enum_codec Build an int32 wire codec with proto2/proto3 enum validation metadata.
Constant BOOL Undocumented
Constant BYTES Undocumented
Constant DOUBLE Undocumented
Constant FIXED32 Undocumented
Constant FIXED64 Undocumented
Constant FLOAT Undocumented
Constant INT32 Undocumented
Constant INT64 Undocumented
Constant SFIXED32 Undocumented
Constant SFIXED64 Undocumented
Constant SINT32 Undocumented
Constant SINT64 Undocumented
Constant STRING Undocumented
Constant UINT32 Undocumented
Constant UINT64 Undocumented
Type Variable T Undocumented
Function _bool Undocumented
Function _bytes Undocumented
Function _float Undocumented
Function _float32 Undocumented
Function _integer_normalizer Undocumented
Function _string Undocumented
Constant _C_LONG_BITS Undocumented
def enum_codec(values: Iterable[int], *, default: int = 0, closed: bool = False, names: Mapping[str, int] | None = None, enum_type: Callable[[], type[Any]] | None = None) -> ValueCodec[Any]: (source)

Build an int32 wire codec with proto2/proto3 enum validation metadata.

Undocumented

Value
ValueCodec(WIRE_FIXED32,
           BinaryReader.read_fixed32,
           BinaryWriter.write_fixed32,
           _integer_normalizer('fixed32', 0, ((1 << 32) - 1)),
           int,
           json_kind='uint32')

Undocumented

Value
ValueCodec(WIRE_FIXED64,
           BinaryReader.read_fixed64,
           BinaryWriter.write_fixed64,
           _integer_normalizer('fixed64', 0, ((1 << 64) - 1)),
           int,
           json_kind='uint64')

Undocumented

Value
ValueCodec(WIRE_VARINT,
           BinaryReader.read_int32,
           BinaryWriter.write_int32,
           _integer_normalizer('int32', (-(1 << 31)), ((1 << 31) - 1)),
           int,
           json_kind='int32')

Undocumented

Value
ValueCodec(WIRE_VARINT,
           BinaryReader.read_int64,
           BinaryWriter.write_int64,
           _integer_normalizer('int64', (-(1 << 63)), ((1 << 63) - 1)),
           int,
           json_kind='int64')
SFIXED32 = (source)

Undocumented

Value
ValueCodec(WIRE_FIXED32,
           BinaryReader.read_sfixed32,
           BinaryWriter.write_sfixed32,
           _integer_normalizer('sfixed32', (-(1 << 31)), ((1 << 31) - 1)),
           int,
           json_kind='int32')
SFIXED64 = (source)

Undocumented

Value
ValueCodec(WIRE_FIXED64,
           BinaryReader.read_sfixed64,
           BinaryWriter.write_sfixed64,
           _integer_normalizer('sfixed64', (-(1 << 63)), ((1 << 63) - 1)),
           int,
           json_kind='int64')

Undocumented

Value
ValueCodec(WIRE_VARINT,
           BinaryReader.read_sint32,
           BinaryWriter.write_sint32,
           _integer_normalizer('sint32', (-(1 << 31)), ((1 << 31) - 1)),
           int,
           json_kind='int32')

Undocumented

Value
ValueCodec(WIRE_VARINT,
           BinaryReader.read_sint64,
           BinaryWriter.write_sint64,
           _integer_normalizer('sint64', (-(1 << 63)), ((1 << 63) - 1)),
           int,
           json_kind='int64')

Undocumented

Value
ValueCodec(WIRE_VARINT,
           BinaryReader.read_uint32,
           BinaryWriter.write_uint32,
           _integer_normalizer('uint32', 0, ((1 << 32) - 1)),
           int,
           json_kind='uint32')

Undocumented

Value
ValueCodec(WIRE_VARINT,
           BinaryReader.read_uint64,
           BinaryWriter.write_uint64,
           _integer_normalizer('uint64', 0, ((1 << 64) - 1)),
           int,
           json_kind='uint64')

Undocumented

Value
TypeVar('T')
def _bool(value: object) -> bool: (source)

Undocumented

def _bytes(value: object) -> bytes: (source)

Undocumented

def _float(value: object) -> float: (source)

Undocumented

def _float32(value: object) -> float: (source)

Undocumented

def _integer_normalizer(name: str, minimum: int, maximum: int) -> Callable[[object], int]: (source)

Undocumented

def _string(value: object) -> str: (source)

Undocumented

_C_LONG_BITS = (source)

Undocumented

Value
struct.calcsize('l') * 8