google / google/sbsim

Protos to Dict

Open
#132 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
123
Forks
56
Avg merge
17d 18h
Merged PRs (30d)
3

Description

I would like to be able to convert any proto to a dictionary.

Ideally by passing it into the `dict()` conversion function.

However since the Protos are automatically generated we shouldn't be updating the generated Python files. And it is also an anti-pattern to sub-class these Protos.

So one option might be to add helper functions to "conversion_utils.py", such as `parse_observation_response` or `observation_response_to_dict`. Alternatively we can continue the proto parsing paradigm and add helper classes to "utils/proto_parsers" and include a property called something like `as_record` or `as_dict` for each proto parser class that does the dictionary conversion.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.