Package google :: Package protobuf :: Module proto_builder
[hide private]
[frames] | no frames]

Module proto_builder

source code

Dynamic Protobuf class creator.

Functions [hide private]
 
_GetMessageFromFactory(factory, full_name)
Get a proto class from the MessageFactory by name.
source code
 
MakeSimpleProtoClass(fields, full_name=None, pool=None)
Create a Protobuf class whose fields are basic types.
source code
 
_MakeFileDescriptorProto(proto_file_name, full_name, field_items)
Populate FileDescriptorProto for MessageFactory's DescriptorPool.
source code
Function Details [hide private]

_GetMessageFromFactory(factory, full_name)

source code 
Get a proto class from the MessageFactory by name.

Args:
  factory: a MessageFactory instance.
  full_name: str, the fully qualified name of the proto type.
Returns:
  A class, for the type identified by full_name.
Raises:
  KeyError, if the proto is not found in the factory's descriptor pool.

MakeSimpleProtoClass(fields, full_name=None, pool=None)

source code 
Create a Protobuf class whose fields are basic types.

Note: this doesn't validate field names!

Args:
  fields: dict of {name: field_type} mappings for each field in the proto. If
      this is an OrderedDict the order will be maintained, otherwise the
      fields will be sorted by name.
  full_name: optional str, the fully-qualified name of the proto type.
  pool: optional DescriptorPool instance.
Returns:
  a class, the new protobuf class with a FileDescriptor.