apache_beam.utils.proto_utils module

For internal use only; no backwards-compatibility guarantees.

apache_beam.utils.proto_utils.pack_Any(msg: Message) Any[source]
apache_beam.utils.proto_utils.pack_Any(msg: None) None

Creates a protobuf Any with msg as its content.

Returns None if msg is None.

apache_beam.utils.proto_utils.unpack_Any(any_msg: Any, msg_class: Type[MessageT]) MessageT[source]
apache_beam.utils.proto_utils.unpack_Any(any_msg: Any, msg_class: None) None

Unpacks any_msg into msg_class.

Returns None if msg_class is None.

apache_beam.utils.proto_utils.parse_Bytes(serialized_bytes: bytes, msg_class: Type[MessageT]) MessageT[source]
apache_beam.utils.proto_utils.parse_Bytes(serialized_bytes: bytes, msg_class: Type[bytes] | None) bytes

Parses the String of bytes into msg_class.

Returns the input bytes if msg_class is None.

apache_beam.utils.proto_utils.pack_Struct(**kwargs) Struct[source]

Returns a struct containing the values indicated by kwargs.

apache_beam.utils.proto_utils.from_micros(cls: Type[TimeMessageT], micros: int) TimeMessageT[source]
apache_beam.utils.proto_utils.to_Timestamp(time: int | float) Timestamp[source]

Convert a float returned by time.time() to a Timestamp.

apache_beam.utils.proto_utils.from_Timestamp(timestamp: Timestamp) float[source]

Convert a Timestamp to a float expressed as seconds since the epoch.