Skip to content

v1alpha8

frequenz.client.common.streaming.proto.v1alpha8 ¤

Conversion of Event from/to protobuf v1alpha8.

Functions:¤

frequenz.client.common.streaming.proto.v1alpha8.event_from_proto ¤

event_from_proto(message: ValueType) -> Event | int

Convert a protobuf Event value to a Event enum member.

PARAMETER DESCRIPTION
message

The protobuf message to convert.

TYPE: ValueType

RETURNS DESCRIPTION
Event | int

The corresponding Event enum member, or the raw int if the protobuf value is not recognized.

Source code in src/frequenz/client/common/streaming/proto/v1alpha8/_event.py
def event_from_proto(message: event_pb2.Event.ValueType) -> Event | int:
    """Convert a protobuf `Event` value to a [`Event`][....Event] enum member.

    Args:
        message: The protobuf message to convert.

    Returns:
        The corresponding [`Event`][....Event] enum member, or the raw [`int`][]
            if the protobuf value is not recognized.
    """
    return enum_from_proto(message, Event)

frequenz.client.common.streaming.proto.v1alpha8.event_to_proto ¤

event_to_proto(event: Event) -> ValueType

Convert a Event enum member to a protobuf value.

PARAMETER DESCRIPTION
event

The enum member to convert.

TYPE: Event

RETURNS DESCRIPTION
ValueType

The corresponding protobuf Event value.

Source code in src/frequenz/client/common/streaming/proto/v1alpha8/_event.py
def event_to_proto(event: Event) -> event_pb2.Event.ValueType:
    """Convert a [`Event`][....Event] enum member to a protobuf value.

    Args:
        event: The enum member to convert.

    Returns:
        The corresponding protobuf `Event` value.
    """
    return event_pb2.Event.ValueType(event.value)