gigl.common.utils.proto_utils#

Attributes#

Classes#

Functions#

proto_to_yaml(proto)

Serialize a protobuf message to canonical YAML.

Module Contents#

class gigl.common.utils.proto_utils.ProtoUtils(project=None)[source]#
Parameters:

project (Optional[str])

read_proto_from_binary(uri, proto_cls)[source]#
Parameters:
Return type:

T

read_proto_from_yaml(uri, proto_cls)[source]#

Read a YAML config into a protobuf, composing it with Hydra.

A local .yaml file is composed from its source path so its parent remains Hydra’s config root and relative Defaults List entries resolve against sibling files.

Any other URI is staged to a temporary local .yaml file and composed standalone; sibling fragments are not fetched with it.

Parameters:
  • uri (gigl.common.Uri) – YAML config URI.

  • proto_cls (Type[T]) – Protobuf message class to parse the composed mapping into.

Returns:

The parsed protobuf message.

Return type:

T

write_proto_to_binary(proto, uri)[source]#
Parameters:
Return type:

None

write_proto_to_yaml(proto, uri)[source]#
Parameters:
Return type:

None

gigl.common.utils.proto_utils.proto_to_yaml(proto)[source]#

Serialize a protobuf message to canonical YAML.

Parameters:

proto (google.protobuf.message.Message) – Protobuf message to serialize.

Returns:

YAML containing the protobuf JSON representation.

Return type:

str

gigl.common.utils.proto_utils.T[source]#
gigl.common.utils.proto_utils.logger[source]#