Converting a protocol buffer enumeration to a Python enumeration

‹ Toy game about parity | A mantra for both the high times and the low ›

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