Converting a protocol buffer enumeration to a Python enumeration

‹ Toy game about parity

If you have a reference to a protobuf enumeration MyEnum you can convert it into a Python enumeration with:

MyPyEnum = enum.Enum(MyEnum.DESCRIPTOR.full_name, MyEnum.items())

(source, pypi)

Subscribe to All Posts - Wesley Tanaka