apache_beam.utils.proto_utils module

For internal use only; no backwards-compatibility guarantees.

apache_beam.utils.proto_utils.pack_Any(msg)[source]

Creates a protobuf Any with msg as its content.

Returns None if msg is None.

apache_beam.utils.proto_utils.unpack_Any(any_msg, msg_class)[source]

Unpacks any_msg into msg_class.

Returns None if msg_class is None.

apache_beam.utils.proto_utils.parse_Bytes(serialized_bytes, msg_class)[source]

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) → google.protobuf.struct_pb2.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: Union[int, float]) → google.protobuf.timestamp_pb2.Timestamp[source]

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

apache_beam.utils.proto_utils.from_Timestamp(timestamp: google.protobuf.timestamp_pb2.Timestamp) → float[source]

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