ó SÉLjc@s!dZdZddlmZddlZddlZddlZddlZddlm Z ddlm Z ddlm Z ddlm Z dd lm Z dd lmZdd lmZdd lmZdd lmZddlmZddlmZddlmZejZdZdefd„ƒYZd„Zd„Zd„Z d„Z!d„Z"d„Z#d„Z$d„Z%d„Z&d„Z'd„Z(d„Z)d „Z*d!„Z+d"„Z,d#„Z-d$„Z.d%„Z/d&„Z0d'„Z1d(„Z2d)„Z3d*„Z4d+Z5d,Z6d-„Z7d.„Z8d/„Z9d0„Z:d1„Z;d2„Z<d3„Z=d4„Z>d5„Z?d6„Z@d7„ZAd8„ZBd9„ZCd:„ZDd;„ZEd<„ZFd=„ZGd>„ZHd?„ZId@„ZJdA„ZKdB„ZLdC„ZMdDeNfdE„ƒYZOdFeOfdG„ƒYZPdHeNfdI„ƒYZQdS(Js Contains a metaclass and helper functions used to create protocol message classes from Descriptor objects at runtime. Recall that a metaclass is the "type" of a class. (A class is to a metaclass what an instance is to a class.) In this case, we use the GeneratedProtocolMessageType metaclass to inject all the useful functionality into the classes output by the protocol compiler at compile-time. The upshot of all this is that the real implementation details for ALL pure-Python protocol buffers are *here in this file*. s#robinson@google.com (Will Robinson)iÿÿÿÿ(tBytesION(tapi_implementation(t containers(tdecoder(tencoder(tenum_type_wrapper(tmessage_listener(t type_checkers(twell_known_types(t wire_format(t descriptor(tmessage(t text_formatsgoogle.protobuf.AnytGeneratedProtocolMessageTypecBs&eZdZdZd„Zd„ZRS(sQMetaclass for protocol message classes created at runtime from Descriptors. We add implementations for all methods described in the Message class. We also create properties to allow getting/setting all fields in the protocol message. Finally, we create slots to prevent users from accidentally "setting" nonexistent fields in the protocol message, which then wouldn't get serialized / deserialized properly. The protocol compiler currently uses this metaclass to create protocol message classes at runtime. Clients can also manually create their own classes at runtime, as in this example: mydescriptor = Descriptor(.....) factory = symbol_database.Default() factory.pool.AddDescriptor(mydescriptor) MyProtoClass = factory.GetPrototype(mydescriptor) myproto_instance = MyProtoClass() myproto.foo_field = 23 ... t DESCRIPTORcCs~|tj}|jtjkr9|tj|jf7}nt||ƒt||ƒtt|ƒ}|j||||ƒ}|S(sCustom allocation for runtime-generated class types. We override __new__ because this is apparently the only place where we can meaningfully set __slots__ on the class we're creating(?). (The interplay between metaclasses and slots is not very well-documented). Args: name: Name of the class (ignored, but required by the metaclass protocol). bases: Base classes of the class we're constructing. (Should be message.Message). We ignore this field, but it's required by the metaclass protocol dictionary: The class dictionary of the class we're constructing. dictionary[_DESCRIPTOR_KEY] must contain a Descriptor object describing this protocol message type. Returns: Newly-allocated class. ( R t_DESCRIPTOR_KEYt full_nameRtWKTBASESt&_AddClassAttributesForNestedExtensionst _AddSlotstsupert__new__(tclstnametbasest dictionaryR t superclasst new_class((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyRis   cCsø|tj}i|_|jrP|jƒjrPtj|ƒdf|jtj tjˆjˆjˆ|ƒ}tjˆjˆjˆ|ƒ}|ˆ_|ˆ_tˆƒˆ_‡‡‡‡fd†}|tjˆjtƒˆrÈtjˆjƒrÈ|tjtƒndS(Ntproto2tpackedcsÒtjˆj|ƒ}ˆj}|tjkrHtjˆƒrHtj}nd}ˆj dk rfˆ}nˆr–t ˆƒ}t j ˆtˆƒ|ƒ}n%tj|ˆjˆ|ˆˆjƒ}||fˆj|ˆjƒ}|jˆjdk r0t|ˆƒn|jƒ|S(N(R%t _SetListenerR[R!t_OneofListenerRA(R tresult(R.RK(sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pytMakeSubMessageDefault¨s   csˆjS(N(t default_value(R (R.(sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pytMakeScalarDefault±s( RMR]RHR5Rkthas_default_valueRžR“RPRQRKRR”(R.R–R™R�RŸ((R.RKR˜sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyRx�s&    cCs€tjƒd}t|jƒdkrYt|ƒtkrYtdt|ƒ||fƒ}ntjt|ƒ|tjƒdƒdS(sCRe-raise the currently-handled TypeError with the field name added.is%s for field %s.%siN( tsystexc_infotlentargsRFt TypeErrortstrtsixtreraise(t message_namet field_nametexc((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyt_ReraiseTypeErrorWithFieldName¸s'"cs:d„‰‡‡fd†}d|_d|_||_dS(sAdds an __init__ method to cls.cSsXt|tjƒrTy|j|jSWqTtk rPtd|j|fƒ‚qTXn|S(sConvert a string or integer enum value to an integer. If the value is a string, it is converted to the enum value in enum_type with the same name. If the value is not a string, it's returned as-is. (No conversion or bounds-checking is done.) s Enum type %s: unknown label "%s"(R4R§t string_typestvalues_by_nameRWR6R“R(R‰RN((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyt_GetIntegerEnumValueÆs c sÚd|_t|ƒdk|_i|_i|_d|_t|_tj ƒ|_ t |ƒ|_ xs|j ƒD]e\}}tˆ|ƒ}|dkr°tdˆj|fƒ‚n|dkrÂqmn|jtjkrã|j|ƒ}|jtjkrŒt|ƒrFt|ƒr6x3|D]}||j||ƒqWq‰|j|ƒqÓxŠ|D]8}t|tƒrr|j|�qM|jƒj|ƒqMWnG|jtjkrÆg|D]}ˆ|j |ƒ^q¥}n|j!|ƒ||j|RmR?tmessage_listener_modtNullMessageListenerR@t _ListenerRAR�t_GetFieldByNameR!R¥RRHR5RkR_RPRQRMRSt MergeFromtupdateR4tdicttaddt CPPTYPE_ENUMR‰textendRKR%R¬R†( tselftkwargsRªt field_valueR.tcopyR‹tvaltnew_val(R¯RE(sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pytinitÕs`           %   N(R!R0R1R-(RERRÀ((R¯REsK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyR'Ãs  =  cCs@y|j|SWn*tk r;td|j|fƒ‚nXdS(sóReturns a field descriptor by field name. Args: message_descriptor: A Descriptor describing all fields in message. field_name: The name of the field to retrieve. Returns: The field descriptor associated with the field name. s&Protocol message %s has no "%s" field.N(ROR6R“R(RERª((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyR³s  cCsCx|jD]}t||ƒq W|jr?td„ƒ|_ndS(s=Adds properties for all fields in this protocol message type.cSs t|ƒS(N(t_ExtensionDict(Rº((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyt/tN(R#t_AddPropertiesForFieldt is_extendabletpropertyt Extensions(R RR.((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyR('s cCs{|jjƒd}t|||jƒ|jtjkrHt||ƒn/|jtj krjt ||ƒn t ||ƒdS(s#Adds a public property for a protocol message field. Clients can use this property to get and (in the case of non-repeated scalar fields) directly set the value of a protocol message field. Args: field: A FieldDescriptor for this field. cls: The class we're constructing. t _FIELD_NUMBERN( RtupperR†RWRHR5Rkt_AddPropertiesForRepeatedFieldRPRQt*_AddPropertiesForNonRepeatedCompositeFieldt'_AddPropertiesForNonRepeatedScalarField(R.Rt constant_name((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyRÄ2scsvˆj‰tˆƒ}‡fd†}d|_dˆ|_‡fd†}dˆ}t||t||d|ƒƒdS(sAdds a public property for a "repeated" protocol message field. Clients can use this property to get the value of the field, which will be either a _RepeatedScalarFieldContainer or _RepeatedCompositeFieldContainer (see below). Note that when clients add values to these containers, we perform type-checking in the case of repeated scalar fields, and we also set any necessary "has" bits as a side-effect. Args: field: A FieldDescriptor for this field. cls: The class we're constructing. csI|jjˆƒ}|dkrEˆj|ƒ}|jjˆ|ƒ}n|S(N(R=tgetR!R_t setdefault(RºR¼(R.(sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pytgetter\s  sGetter for %s.cstdˆƒ‚dS(NsIAssignment not allowed to repeated field "%s" in protocol message object.(tAttributeError(Rºt new_value(R2(sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pytsetteross/Magic attribute generated for "%s" proto field.tdocN(RR3R!R0R1R†RÆ(R.Rt property_nameRÐRÓRÔ((R.R2sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyRÊKs     c süˆj}t|ƒ}tjˆƒ‰ˆj‰tƒ}ˆjjdk}‡‡fd†}d |_ d||_ |o}ˆj ‰‡‡‡fd†‰ˆj r³‡‡fd†}nˆ}d |_ d||_ d|}t ||t ||d|ƒƒd S( s Adds a public property for a nonrepeated, scalar protocol message field. Clients can use this property to get and directly set the value of the field. Note that when the client sets the value of a field by using this property, all necessary "has" bits are set as a side-effect, and we also perform type-checking. Args: field: A FieldDescriptor for this field. cls: The class we're constructing. tproto3cs|jjˆˆƒS(N(R=RÎ(Rº(RžR.(sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyRЉssGetter for %s.csYˆj|ƒ}ˆr2| r2|jjˆdƒn ||jˆ<|jsU|jƒndS(N(t CheckValueR=tpopR!R<t _Modified(RºRÒ(tclear_when_set_to_defaultR.R˜(sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyt field_setter’s    csˆ||ƒ|jˆƒdS(N(t_UpdateOneofState(RºRÒ(R.RÛ(sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyRÓ¡s sSetter for %s.s/Magic attribute generated for "%s" proto field.RÔN(RR3RR”RžtsetR8RnR!R0R1R[R†RÆ( R.RR2RÕt valid_valuest is_proto3RÐRÓRÔ((RÚRžR.RÛR˜sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyRÌws$          csvˆj‰tˆƒ}‡fd†}d|_dˆ|_‡fd†}dˆ}t||t||d|ƒƒdS(sNAdds a public property for a nonrepeated, composite protocol message field. A composite field is a "group" or "message" field. Clients can use this property to get the value of the field, but cannot assign to the property directly. Args: field: A FieldDescriptor for this field. cls: The class we're constructing. csI|jjˆƒ}|dkrEˆj|ƒ}|jjˆ|ƒ}n|S(N(R=RÎR!R_RÏ(RºR¼(R.(sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyRпs  sGetter for %s.cstdˆƒ‚dS(NsJAssignment not allowed to composite field "%s" in protocol message object.(RÑ(RºRÒ(R2(sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyRÓÒss/Magic attribute generated for "%s" proto field.RÔN(RR3R!R0R1R†RÆ(R.RRÕRÐRÓRÔ((R.R2sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyR˯s     cCs‹|j}x=|jƒD]/\}}|jƒd}t|||jƒqW|jdk r‡|jj}|j||_|j ||_ ndS(s=Adds properties for all fields in this protocol message type.RÈN( R€R�RÉR†RWtfileR!tpoolt_extensions_by_numbert_extensions_by_name(R RR‚RƒR„RÍRá((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyR)Ûs  cs@‡fd†}t|ƒˆ_‡fd†}t|ƒˆ_dS(Ncs3ˆj|_ˆjjjj|ƒtˆ|ƒdS(N(RR8RàRátAddExtensionDescriptorR$(R9(R(sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pytRegisterExtensionìs csˆƒ}|j|ƒ|S(N(tMergeFromString(tsR (R(sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyt FromStringós  (t staticmethodRåRè(RRåRè((RsK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyR*êscCsM|djtjkr$t|dƒS|djtjkrE|djStSdS(sˆGiven a (FieldDescriptor, value) tuple from _fields, return true if the value should be included in the list returned by ListFields().iiN(RHR5RktboolRPRQR?R{(titem((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyt _IsPresentús  cCsd„}||_dS(s Helper for _AddMessageMethods().cSsEg|jjƒD]}t|ƒr|^q}|jdd„ƒ|S(NR‹cSs |djS(Ni(RW(Rë((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyR RÃ(R=R�Rìtsort(RºRët all_fields((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyt ListFields s.N(Rï(RERRï((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyt_AddListFieldsMethods s:Protocol message has no non-repeated submessage field "%s"s/Protocol message has no non-repeated field "%s"csÔ|jdk}|rtnt‰i‰x^|jD]S}|jtjkrOq1n|rw|jtjkrw|j rwq1n|ˆ|j Rí(Rºtothertany_atany_btunknown_fieldstother_unknown_fields((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyt__eq__§s"       N(R(RERR((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyt_AddEqualsMethod¥s cCsd„}||_dS(s Helper for _AddMessageMethods().cSs tj|ƒS(N(R tMessageToString(Rº((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyt__str__ÅsN(R(RERR((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyt _AddStrMethodÃs cCsd„}||_dS(s Helper for _AddMessageMethods().cSs tj|ƒS(N(R R(Rº((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyt__repr__ÌsN(R(RERR((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyt_AddReprMethodÊs cCsd„}||_dS(s Helper for _AddMessageMethods().cSstj|dtƒjdƒS(Ntas_utf8sutf-8(R RR{tdecode(Rº((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyt __unicode__ÔsN(R#(tunused_message_descriptorRR#((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyt_AddUnicodeMethodÑs cCsIytj|}|||ƒSWn$tk rDtjd|ƒ‚nXdS(s Returns the number of bytes needed to serialize a non-repeated element. The returned byte count includes space for tag information and any other additional space associated with serializing value. Args: value: Value we're serializing. field_number: Field number of this value. (Since the field number is stored as part of a varint-encoded tag, this has an impact on the total bytes required to serialize the value). field_type: The type of the field. One of the TYPE_* constants within FieldDescriptor. sUnrecognized field type: %dN(RtTYPE_TO_BYTE_SIZE_FNR6Rt EncodeError(RNt field_numbert field_typetfn((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyt_BytesForNonRepeatedElementÙs   cCsd„}||_dS(s Helper for _AddMessageMethods().cSsí|js|jSd}|j}|jƒjrg|jdj|jƒ}||jdj|jƒ7}ndx-|j ƒD]\}}||j|ƒ7}qtWx1|j D]&\}}|t |ƒt |ƒ7}q¡W||_t |_t |j _|S(NiR‹RN(R<R;RRRLRORwR‹RNRïR>R£RmRAtdirty(RºtsizeR RgR¼Rbt value_bytes((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pytByteSizeðs      N(R/(RERR/((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyt_AddByteSizeMethodís cCsd„}||_dS(s Helper for _AddMessageMethods().c[sPg}|jƒsCtjd|jjdj|jƒƒfƒ‚n|j|�S(Ns)Message %s is missing required fields: %st,(t IsInitializedRR'RRtjointFindInitializationErrorstSerializePartialToString(RºR»terrors((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pytSerializeToString s  (N(R7(RERR7((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyt_AddSerializeToStringMethods cCs+d„}||_dd„}||_dS(s Helper for _AddMessageMethods().c[s&tƒ}|j|j|�|jƒS(N(Rt_InternalSerializetwritetgetvalue(RºR»tout((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyR5s cSsÞ|dkrtjƒ}n t|ƒ}|j}|jƒjr||jdj||j |ƒ|jdj||j |ƒn^x-|j ƒD]\}}|j|||ƒq‰Wx+|j D] \}}||ƒ||ƒq¶WdS(NR‹RN( R!Rt)IsPythonDefaultSerializationDeterministicRêRRRLRORvR‹RNRïR>(Rºt write_bytest deterministicR RgR¼RbR.((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pytInternalSerializes      N(R5R!R9(RERR5R@((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyt"_AddSerializePartialToStringMethods   csad„}||_tj‰tj‰|j‰|jdk‰‡‡‡‡fd†}||_dS(s Helper for _AddMessageMethods().cSsŽt|ƒ}y1|j|d|ƒ|kr<tjdƒ‚nWnJttfk retjdƒ‚n%tjk r‰}tj|ƒ‚nX|S(NisUnexpected end-group tag.sTruncated message.(R£t_InternalParseRt DecodeErrort IndexErrorR¥tstructterror(Rºt serializedtlengthte((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyRæ8s RÖc s|jƒ|j}|j}xñ||krˆ||ƒ\}}ˆj|dƒ\}} |dkrÞ|} ˆ||||ƒ}|dkr�|Sˆ s¢tjƒrÕ|s¸g}|_n|j||| |!fƒn|}q||||||ƒ}| r|j| ƒqqW|S(Niÿÿÿÿ(NN( RÙR=R>RÎR!Rt&GetPythonProto3PreserveUnknownsDefaulttappendRÜ( Rºtbuffertpostendt field_dicttunknown_field_listRbtnew_posRft field_desctvalue_start_pos(tdecoders_by_tagRßt local_ReadTagtlocal_SkipField(sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyt InternalParseLs,       N(RæRtReadTagt SkipFieldRRnRB(RERRæRW((RTRßRURVsK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyt_AddMergeFromStringMethod6s    cseg|jD]}|jtjkr |^q ‰d‡fd†}||_‡fd†}||_dS(s[Adds the IsInitialized and FindInitializationError methods to the protocol message class.cs`xfˆD]^}||jks?|jtjkr|j|j r|dk ra|j|jƒƒntSqWxðt |jj ƒƒD]Ù\}}|jtjkr|j tj kr|j jrÓ|j jƒjrÓqnx|D]8}|jƒsÚ|dk r|j|jƒƒntSqÚWqX|jrX|jƒ rX|dk rQ|j|jƒƒntSqqWtS(sChecks if all required fields of a message are set. Args: errors: A list which, if provided, will be populated with the field paths of all missing required fields. Returns: True iff the specified message has all required fields set. N(R=RPR5RQR?R!R¹R4RmRR�RHRkRKRRRLR2R{(RºR6R.RNtelement(trequired_fields(sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyR2ns.  "       c sºg}x3ˆD]+}|j|jƒs |j|jƒq q Wxw|jƒD]i\}}|jtjkrI|jr€d|j}n |j}t |ƒrÿt |ƒr¯xX|D]M}||}d||f}|j ƒ}|g|D]} || ^qÞ7}q¨Wq¯q²|j tj krxx›tt|ƒƒD]M} || }d|| f}|j ƒ}|g|D]} || ^qZ7}q$Wq²|d}|j ƒ}|g|D]} || ^q˜7}qIqIW|S(sÆFinds required fields which are not initialized. Returns: A list of strings. Each string is a path to an uninitialized field from the top-level message, e.g. "foo.bar[5].baz". s(%s)s%s[%s].s%s[%d].t.(RoRRKRïRPR5RQR7RRMRSR4RHRktrangeR£( RºR6R.RNRR‹R[tprefixt sub_errorsRFti(R\(sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyR4—s6        (  (  (N(R#RHR5tLABEL_REQUIREDR!R2R4(RERR.R2R4((R\sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyt_AddIsInitializedMethodgs ' ,cs4tj‰tj‰‡‡‡fd†}|ˆ_dS(Ncszt|ˆƒs1tdˆj|jjfƒ‚n|jƒ|j}xû|jjƒD]ê\}}|jˆkr¶|j|ƒ}|dkr¦|j |ƒ}||||j|ƒ}|dkr|j |ƒ}|||qT||j|<|jrT|j|ƒqTqTW|jrv|js`g|_n|jj|jƒndS(NsLParameter to MergeFrom() must be instance of same class: expected %s got %s.(R4R¥R/t __class__RÙR=R�RHRÎR!R_R´RPR?R[RÜR>R¹(RºR R#R.RNR¼(RQRkR(sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyR´Ês6            (R5RkRQR´(RR´((RQRkRsK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyt_AddMergeFromMethodÆs  %cs‡fd†}||_dS(Ncswyˆj|}Wn!tk r4td|ƒ‚nX|jj|dƒ}|dk ro|j|jƒro|jSdSdS(sDReturns the name of the currently set field inside a oneof, or None.s)Protocol message has no oneof "%s" field.N(RûR6R“RCRÎR!RoR(Rºt oneof_nameR.t nested_field(RE(sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyt WhichOneofós (Rh(RERRh((REsK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyt_AddWhichOneofMethodòscCsd„}||_dS(NcSst|ƒd|jƒfS(N((RFt __getstate__(Rº((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyt __reduce__s(Rk(RRk((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyt_AddReduceMethods cCs)i|_d|_i|_|jƒdS(N((R=R>RCRÙ(Rº((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyt_Clear s   cCsyg|_xi|jƒD][\}}|jtjkr|jtjkrdx%|D]}|jƒqMWqq|jƒqqWdS(N(R>RïRPR5RQRHRktDiscardUnknownFields(RºR.RNt sub_message((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyt_DiscardUnknownFieldss  cCs+|dkrtjƒ|_n ||_dS(N(R!R°R±R@(Rºtlistener((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyRšs cCsüt||ƒt||ƒt||ƒ|jrGt|ƒt|ƒnt||ƒt||ƒt||ƒt ||ƒt ||ƒt ||ƒt ||ƒt ||ƒt||ƒt|ƒt||ƒt|ƒt|_t|_t|_dS(s3Adds implementations of all Message methods to cls.N(RðRùRþRÅRRRRR R%R0R8RARZRcReRiRlRmtClearRpRnRš(RER((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyR+$s*                    cCs1d„}d„}||_||_||_dS(s5Adds implementation of private helper methods to cls.cSs;|js7t|_t|j_t|_|jjƒndS(swSets the _cached_byte_size_dirty bit to true, and propagates this to our listener iff this was a state change. N(R<R{RAR,R?R@tModified(Rº((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyRsAs    cSsE|jj|j|ƒ}||k rA|j|=||j|js    R²cBs eZdZd„Zd„ZRS(s0MessageListener implementation that a parent message registers with its child message. In order to support semantics like: foo.bar.baz.qux = 23 assert foo.HasField('bar') ...child objects must have back references to their parents. This helper class is at the heart of this support. cCs=t|tjƒr||_ntj|ƒ|_t|_dS(s�Args: parent_message: The message whose _Modified() method we should call when we receive Modified() messages. N(R4tweakreft ProxyTypet_parent_message_weakreftproxyRmR,(Rºtparent_message((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyR-ns  cCs6|jr dSy|jjƒWntk r1nXdS(N(R,RxRÙtReferenceError(Rº((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyRs�s   (R/R0R1R-Rs(((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyR²`s  R›cBs eZdZd„Zd„ZRS(sCSpecial listener implementation for setting composite oneof fields.cCs#tt|ƒj|ƒ||_dS(sËArgs: parent_message: The message whose _Modified() method we should call when we receive Modified() messages. field: The descriptor of the field being set in the parent message. N(RR›R-t_field(RºRzR.((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyR-‘scCsBy*|jj|jƒtt|ƒjƒWntk r=nXdS(sEAlso updates the state of the containing oneof in the parent message.N(RxRÜR|RR›RsR{(Rº((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyRsšs  (R/R0R1R-Rs(((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyR›Žs RÁcBsVeZdZd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z RS( s«Dict-like container for supporting an indexable "Extensions" field on proto instances. Note that in all cases we expect extension handles to be FieldDescriptors. cCs ||_dS(sMextended_message: Message instance for which we are the Extensions dict. N(t_extended_message(Rºtextended_message((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyR-°scCsÎt|j|ƒ|jjj|ƒ}|dk r5|S|jtjkr\|j|jƒ}nV|j tj kr«|j j ƒ}y|j |jjƒWq²tk r§q²Xn|jS|jjj||ƒ}|S(s8Returns the current value of the given extension handle.N(R:R}R=RÎR!RHR5RkR_RPRQRKR%RšRAR{RžRÏ(RºR9Rœ((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyt __getitem__¶s     cCs‚t||jƒstS|jjƒ}|jjƒ}g|D]}|jr;|^q;}g|D]}|jr]|^q]}||kS(N(R4RdRmR}RïR7(RºRt my_fieldst other_fieldsR.((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyR×s""cCs ||k S(N((RºR((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyt__ne__äscCstdƒ‚dS(Nsunhashable object(R¥(Rº((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyt__hash__çscCsƒt|j|ƒ|jtjks4|jtjkrJtd|jƒ‚nt j |ƒ}|j |ƒ|jj |<|jj ƒdS(slIf extension_handle specifies a non-repeated, scalar extension field, sets the value of that field. sKCannot assign to extension "%s" because it is a repeated or composite type.N(R:R}RHR5RkRPRQR¥RRR”R×R=RÙ(RºR9RNR˜((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyt __setitem__îscCs|jjj|dƒS(s™Tries to find a known extension with the specified name. Args: name: Extension full name. Returns: Extension field descriptor. N(R}RãRÎR!(RºR((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyt_FindExtensionByNames cCs|jjj|dƒS(sœTries to find a known extension with the field number. Args: number: Extension field number. Returns: Extension field descriptor. N(R}RâRÎR!(RºRW((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyt_FindExtensionByNumbers ( R/R0R1R-RRR‚RƒR„R…R†(((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyRÁ§s  !    (RR1t __author__tioRRER¡RvR§tgoogle.protobuf.internalRRRRRRR°RRR RR RñR RR tFieldDescriptorR5RRFR R3R:RRJRMRSR$RR&R]RxR¬R'R³R(RÄRÊRÌRËR)R*RìRðRõRöRùRþRRRRRR R%R+R0R8RARZRcReRiRlRmRpRšR+R,tobjectR²R›RÁ(((sK/usr/lib/python2.7/site-packages/google/protobuf/internal/python_message.pyt1s�     k       C    7 T   , 8 ,    * &  (        1 _ ,      ".