ó SÉLjc @ s› d Z y d d l m Z Wn! e k r= d d l m Z n Xd d l Z d d l Z d d l m Z d d l m Z d „ Z d d d „ Z d „ Z d S( s Dynamic Protobuf class creator.iÿÿÿÿ( t OrderedDictN( t descriptor_pb2( t message_factoryc C s% | j j | ƒ } | j | ƒ } | S( s8 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. ( t poolt FindMessageTypeByNamet GetPrototype( t factoryt full_namet proto_descriptort proto_cls( ( sA /usr/lib/python2.7/site-packages/google/protobuf/proto_builder.pyt _GetMessageFromFactory, s c C sN t j d | ƒ } | d k rL y t | | ƒ } | SWqL t k rH qL Xn | j ƒ } t | t ƒ sv t | ƒ } n t j ƒ } xF | D]> \ } } | j | j d ƒ ƒ | j t | ƒ j d ƒ ƒ q‰ W| j ƒ d } | d k r%d | j ƒ } y t | | ƒ } | SWq%t k r!q%Xn | j j t | | | ƒ ƒ t | | ƒ S( sê 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. R s utf-8s .protos6 net.proto2.python.public.proto_builder.AnonymousProto_N( R t MessageFactoryt NoneR t KeyErrort itemst isinstanceR t sortedt hashlibt sha1t updatet encodet strt hexdigestR t Addt _MakeFileDescriptorProto( t fieldsR R R R t field_itemst fields_hasht f_namet f_typet proto_file_name( ( sA /usr/lib/python2.7/site-packages/google/protobuf/proto_builder.pyt MakeSimpleProtoClass<