Created
November 10, 2011 16:04
-
-
Save mentat/1355213 to your computer and use it in GitHub Desktop.
Generate Protocol Buffer definition file from Python ProtoRPC Module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Thanks to [email protected] (Rafe Kaplan) for this tip. | |
Create a .proto file from a module containing ProtoRPC Message | |
classes. | |
""" | |
import logging | |
from protorpc import descriptor | |
from protorpc import generate | |
from protorpc.generate_proto import format_proto_file | |
__all__ = ['format_proto_module'] | |
def format_proto_module(module, output, indent_space=2): | |
file_descriptor = descriptor.describe_file(module) | |
format_proto_file(file_descriptor, output, indent_space=indent_space) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment