gigl.common.utils.proto_utils#
Attributes#
Classes#
Functions#
|
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:
uri (gigl.common.Uri)
proto_cls (Type[T])
- Return type:
T
- read_proto_from_yaml(uri, proto_cls)[source]#
Read a YAML config into a protobuf, composing it with Hydra.
A local
.yamlfile 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
.yamlfile 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:
proto (google.protobuf.message.Message)
uri (gigl.common.Uri)
- Return type:
None
- write_proto_to_yaml(proto, uri)[source]#
- Parameters:
proto (google.protobuf.message.Message)
uri (gigl.common.Uri)
- Return type:
None