
    q	h                        S r SrSSKrSSKJr  SSKrSSKrSSKrSSKrSSK	r	SSK
Jr  SSK
Jr  SSK
Jr  SSKJr  SS	KJr  SS
KJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  \R8                  rSrSrSr \RB                  r! " S S\"5      r#S r$S r%S r&S r'S r(S r)S r*S r+S r,S  r-S! r.S" r/S# r0S$ r1S% r2S& r3S' r4 " S( S)\55      r6S* r7S+ r8S, r9S- r:S. r;S/ r<S0 r=S1 r>S2 r?S3 r@S4 rAS5 rBS6 rCS7 rDS8 rES9 rFS: rGS; rHS< rIS= rJS> rKS? rLS@ rMSA rNSB rOSC rPSD rQSE rRSF rSSG rTSH rUSI rV " SJ SK\W5      rX " SL SM\X5      rYg)Na  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*.
z#robinson@google.com (Will Robinson)    N)BytesIO)
descriptor)message)text_format)api_implementation)
containers)decoder)encoder)enum_type_wrapper)extension_dict)message_listener)type_checkers)well_known_types)wire_formatzgoogle.protobuf.Anygoogle.protobuf.Structgoogle.protobuf.ListValuec                   <   ^  \ rS rSrSrSrU 4S jrU 4S jrSrU =r	$ )GeneratedProtocolMessageType;   a<  Metaclass 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 = message_factory.GetMessageClass(mydescriptor)
myproto_instance = MyProtoClass()
myproto.foo_field = 23
...

DESCRIPTORc                   > U[         R                     n[        U[        5      (       a  [	        S5      e[        USS5      nU(       a  U$ UR                  [        R                  ;   a!  U[        R                  UR                     4-  n[        XC5        [        XC5        [        [         U 5      nUR                  XX#5      nU$ )a#  Custom 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.

Raises:
  RuntimeError: Generated code only work with python cpp extension.
z\The generated code only work with python cpp extension, but it is using pure python runtime._concrete_classN)r   _DESCRIPTOR_KEY
isinstancestrRuntimeErrorgetattr	full_namer   WKTBASES&_AddClassAttributesForNestedExtensions	_AddSlotssuper__new__)clsnamebases
dictionaryr   	new_class
superclass	__class__s          Y/var/www/html/env/lib/python3.13/site-packages/google/protobuf/internal/python_message.pyr#   $GeneratedProtocolMessageType.__new__V   s    0 8HHIJ*c"" K L L 
$5t<I/888 ))**>*>?AAe*:Bj%3S9J""3e@I    c                 X  > U[         R                     n[        USS5      nU(       a  XPL d   SUR                  -  5       eg0 U l        0 U l        UR                  (       aR  UR                  5       R                  (       a3  [        R                  " U5      S4U R                  [        R                  '   UR                   H  n[        X5        M     UR                  (       aT  [        UR                   S5      (       a9  UR                   R"                  R%                  U5      nU H  n[        X5        M     Xl        [)        X@5        [+        X@5        [-        X@5        [/        X@5        [1        U 5        [3        X@5        [5        X@5        [7        [         U 5      n	U	R9                  XU5        g)ah  Here we perform the majority of our work on the class.
We add enum getters, an __init__ method, implementations
of all Message methods, and properties for all fields
in the protocol type.

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.
r   NzBDuplicate `GeneratedProtocolMessageType` created for descriptor %rpool)r   r   r   r   _message_set_decoders_by_tag_fields_by_taghas_options
GetOptionsmessage_set_wire_formatr	   MessageSetItemDecoderMESSAGE_SET_ITEM_TAGfields_AttachFieldHelpersis_extendablehasattrfiler/   FindAllExtensionsr   _AddEnumValues_AddInitMethod_AddPropertiesForFields_AddPropertiesForExtensions_AddStaticMethods_AddMessageMethods_AddPrivateHelperMethodsr"   __init__)r$   r%   r&   r'   r   existing_classfield
extensionsextr)   r*   s             r+   rD   %GeneratedProtocolMessageType.__init__   sf   " 8HHIJ Z):DAN" $
N!!#$" ')C$C77

'
'

3
Hc&&w'C'CD ""#% # GJOOV$D$D??''99*Ej#C%  "%:#:#J,
0cz'Z-3S9JZ0r-    )
__name__
__module____qualname____firstlineno____doc__r   r#   rD   __static_attributes____classcell__r*   s   @r+   r   r   ;   s    . !/3j81 81r-   r   c                     U $ )a  Returns the name of the public property attribute which
clients can use to get and (in some cases) set the value
of a protocol message field.

Args:
  proto_field_name: The protocol message field name, exactly
    as it appears (or would appear) in a .proto file.
rJ   )proto_field_names    r+   _PropertyNamerU      s
    4 
r-   c                     / SQUS'   g)a  Adds a __slots__ entry to dictionary, containing the names of all valid
attributes for this message type.

Args:
  message_descriptor: A Descriptor instance describing this message type.
  dictionary: Class dictionary to which we'll add a '__slots__' entry.
)	_cached_byte_size_cached_byte_size_dirty_fields_unknown_fields_is_present_in_parent	_listener_listener_for_children__weakref___oneofs	__slots__NrJ   )message_descriptorr'   s     r+   r!   r!      s    (*[r-   c                 :   U R                   =(       a    U R                  R                  =(       al    U R                  R                  5       R                  =(       aA    U R
                  [        R                  :H  =(       a    U R                  [        R                  :H  $ N)
is_extensioncontaining_typer2   r3   r4   type_FieldDescriptorTYPE_MESSAGElabelLABEL_OPTIONALrF   s    r+   _IsMessageSetExtensionrl      su    


 9



+
+9



*
*
,
D
D9 **(55
59 ++)88
8	:r-   c                 v    U R                   [        R                  :H  =(       a    U R                  R                  $ rc   )rf   rg   rh   message_type_is_map_entryrk   s    r+   _IsMapFieldrp     s.    
**(55
5 +



*
*,r-   c                 n    U R                   R                  S   nUR                  [        R                  :H  $ )Nvalue)rn   fields_by_namecpp_typerg   CPPTYPE_MESSAGE)rF   
value_types     r+   _IsMessageMapFieldrw     s0    !!009*			 0 @ @	@@r-   c                 B  ^ ^ TR                   [        R                  :H  n[        T5      Tl        U U4S jnU" [
        R                  TR                     S5        U(       a>  [        R                  " TR                  5      (       a  U" [        R                  S5        g g g )Nc                 j   > [         R                  " TR                  U 5      nTU4TR                  U'   g rc   )r
   TagBytesnumberr1   )wiretype	is_packed	tag_bytesr$   field_descriptors      r+   AddFieldByTag*_AttachFieldHelpers.<locals>.AddFieldByTag  s1      !1!8!8(CI%5y$ACy!r-   FT)ri   rg   LABEL_REPEATED _DefaultValueConstructorForField_default_constructorr   FIELD_TYPE_TO_WIRE_TYPErf   r   IsTypePackableWIRETYPE_LENGTH_DELIMITED)r$   r   is_repeatedr   s   ``  r+   r8   r8     s     &&*:*I*II+*J+'B ++,<,A,ABE [//0@0E0EFF +77> G[r-   c                 ~   [        US5      (       a  g UR                  [        R                  :H  n[	        U5      nUR
                  nU(       a7  [        R                  " U5      n[        R                  " U[        U5      5      nO[        U5      (       aA  [        R                  " UR                  5      n[        R                  " UR                  5      nO\[        R                  UR                      " UR                  X$5      n[        R"                  UR                      " UR                  X$5      nXal        XQl        g )N_encoder)r:   ri   rg   r   rp   r}   r
   
MapEncoderMapSizerrw   rl   MessageSetItemEncoderr{   MessageSetItemSizerr   TYPE_TO_ENCODERrf   TYPE_TO_SIZER_sizerr   )r$   r   r   is_map_entryr}   field_encodersizers          r+   _MaybeAddEncoderr   #  s   z**
!''+;+J+JJ+-.,(()&&'78M-/0@ACE.//112B2I2IJM''(8(?(?@E!112B2G2GH9M''(8(=(=>9E "+r-   c                   ^^^^ [        TS5      (       a  g TR                  [        R                  :H  m[	        T5      m0 mUUUU4S jnU" S5        T(       a-  [
        R                  " TR                  5      (       a  U" S5        TTl        g )N	_decodersc                   > TR                   nU[        R                  :X  a+  TR                  R                  (       d  [        R
                  nS nTR                  b  TnT(       a-  [        T5      n[        R                  " T[        T5      U5      nOU[        R                  :X  a?  [        R                  " TR                  TU TTR                  TR                  (       + 5      nOTR                   [        R"                  :X  a2  [$        R&                  U   " TR                  TU TTR                  5      nOA[$        R&                  U   " TR                  TU TTR                  TR                  (       + 5      nUTU '   g rc   )rf   rg   	TYPE_ENUM	enum_type	is_closed
TYPE_INT32containing_oneofrw   r	   
MapDecoder_GetInitializeDefaultForMapTYPE_STRINGStringDecoderr{   r   has_presencert   ru   r   TYPE_TO_DECODER)	r}   decode_typeoneof_descriptoris_message_mapfield_decoderr   helper_decodersr   r   s	        r+   
AddDecoder$_MaybeAddDecoder.<locals>.AddDecoderC  sP   "''K'111&&00$//k((4))*:;n((
78HI
m 
(44	4++

!
!;	
,AA++
+-m 
	"	"&6&F&F	F#33K@

!
!;	
,AACm $33K@

!
!;	
,AA++
+	-m "/OIr-   FT)	r:   ri   rg   r   rp   r   r   rf   r   )r$   r   r   r   r   r   s    ` @@@r+   _MaybeAddDecoderr   ;  s}    {++
 &&*:*I*II+-.,/ /  /D U[//0@0E0EFF t.r-   c                 d    U R                   nUR                  5        H  u  p4X1;  d   eXAU'   M     g rc   )extensions_by_nameitems)r   r'   rG   extension_nameextension_fields        r+   r    r    o  s7    ,,*)3)9)9);%n+++!0~ *<r-   c                     U R                    H`  n[        XR                  [        R                  " U5      5        UR
                   H#  n[        XR                  UR                  5        M%     Mb     g)zSets class-level attributes for all enum fields defined in this message.

Also exporting a class-level object that can name enum values.

Args:
  descriptor: Descriptor object for this message type.
  cls: Class we're constructing for this message type.
N)
enum_typessetattrr%   r   EnumTypeWrappervaluesr{   )r   r$   r   
enum_values       r+   r=   r=   v  sR     ((iC!2!B!B9!MN&&
c??J$5$56 ' )r-   c                 R  ^ ^^^ T R                   [        R                  :w  a  [        ST R                  -  5      eT R
                  R                  n[        R                  " US   5      mUS   m[        T 5      (       a
  U UU4S jnU$ [        R                  " T5      mU UU4S jnU$ )Nz&map_entry set on non-repeated field %skeyrr   c                 r   > [         R                  " U R                  TR                  TTR                  5      $ rc   )r   
MessageMapr]   rn   )r   rF   key_checkervalue_fields    r+   MakeMessageMapDefault:_GetInitializeDefaultForMap.<locals>.MakeMessageMapDefault  s2    ""

(
(+*B*BK


 r-   c                 ^   > [         R                  " U R                  TTTR                  5      $ rc   )r   	ScalarMapr]   rn   )r   rF   r   value_checkers    r+   MakePrimitiveMapDefault<_GetInitializeDefaultForMap.<locals>.MakePrimitiveMapDefault  s,    !!

(
(+}


 r-   )
ri   rg   r   
ValueErrorr%   rn   rs   r   GetTypeCheckerrw   )rF   rs   r   r   r   r   r   s   `   @@@r+   r   r     s    
[[$333
=

  %%44.,,^E-BC+w'+ ! !00=M #"r-   c                   ^ ^^ [        T 5      (       a  [        T 5      $ T R                  [        R                  :X  a  T R
                  (       a(  T R                  / :w  a  [        ST R                  -  5      eT R                  [        R                  :X  a  T R                  mU 4S jnU$ [        R                  " T 5      mU4S jnU$ T R                  [        R                  :X  a  T R                  mU U4S jnU$ U 4S jnU$ )aw  Returns a function which returns a default value for a field.

Args:
  field: FieldDescriptor object for this field.

The returned function has one argument:
  message: Message instance containing this field, or a weakref proxy
    of same.

That function in turn returns a default value for this field.  The default
  value may refer back to |message| via a weak reference.
z/Repeated field default value not empty list: %sc                 Z   > [         R                  " U R                  TR                  5      $ rc   )r   RepeatedCompositeFieldContainerr]   rn   r   rF   s    r+   MakeRepeatedMessageDefaultD_DefaultValueConstructorForField.<locals>.MakeRepeatedMessageDefault  s)    99**E,>,>@ 	@r-   c                 F   > [         R                  " U R                  T5      $ rc   )r   RepeatedScalarFieldContainerr]   )r   type_checkers    r+   MakeRepeatedScalarDefaultC_DefaultValueConstructorForField.<locals>.MakeRepeatedScalarDefault  s!    66**L: 	:r-   c                    > [        TS5      (       d  SSKJn  UR                  T5        TR	                  5       nUR                  TR                  b  [        U T5      5        U$ U R                  5        U$ )Nr   r   message_factory)	r:   google.protobufr   GetMessageClassr   _SetListenerr   _OneofListenerr]   )r   r   resultrF   rn   s      r+   MakeSubMessageDefault?_DefaultValueConstructorForField.<locals>.MakeSubMessageDefault  st    \#4553''5++-f##/ %
(/ m --/ mr-   c                    > TR                   $ rc   )default_valuer   s    r+   MakeScalarDefault;_DefaultValueConstructorForField.<locals>.MakeScalarDefault  s     r-   )rp   r   ri   rg   r   has_default_valuer   r   rt   ru   rn   r   r   )rF   r   r   r   r   rn   r   s   `    @@r+   r   r     s     &u--
[[$3335#6#6"#<H


    ~~)999 ''l@ ('"11%8l: '&
^^'777%%L
 !  
r-   c                    [         R                  " 5       S   n[        UR                  5      S:X  a1  [	        U5      [
        L a  [        [        U5      < SU < SU< 35      nUR                  [         R                  " 5       S   5      e)zCRe-raise the currently-handled TypeError with the field name added.   z for field .   )sysexc_infolenargsrf   	TypeErrorr   with_traceback)message_name
field_nameexcs      r+   _ReraiseTypeErrorWithFieldNamer     s`    q#]aDI2
CHlJO
PC 	3<<>!,--r-   c                 D   ^ ^ S mUU 4S jnSUl         SUl        X!l        g)zAdds an __init__ method to cls.c                     [        U[        5      (       a   U R                  U   R                  $ U$ ! [         a    [        SU R                  < SU< S35      ef = f)zConvert 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.)
z
Enum type z: unknown label "")r   r   values_by_namer{   KeyErrorr   r   )r   rr   s     r+   _GetIntegerEnumValue,_AddInitMethod.<locals>._GetIntegerEnumValue  sb     %)''.555 L  )( ) 	))s	   2 )Ac           
        > SU l         [        U5      S:  U l        0 U l        0 U l        SU l        SU l        [        R                  " 5       U l	        [        U 5      U l        UR                  5        GHi  u  p#[        TU5      nUc  [        TR                  < SU< S35      eUc  M7  UR                   ["        R$                  :X  Gab  UR'                  U 5      nUR(                  ["        R*                  :X  a  [-        U5      (       an  [/        U5      (       aL  U HE  nX6   n[1        U[2        5      (       a  XV   R4                  " S0 UD6  M2  XV   R7                  U5        MG     OUR9                  U5        OU HK  n[1        U[2        5      (       a  UR:                  " S0 UD6  M,  UR;                  5       R7                  U5        MM     ORUR(                  ["        R<                  :X  a#  U Vs/ s H  nT
" UR>                  U5      PM     nnURA                  U5        XPR                  U'   GM  UR(                  ["        R*                  :X  GaT  UR'                  U 5      nS n	[1        U[B        RD                  5      (       a  Un	O[1        U[2        5      (       a  URF                  RH                  [J        :X  aJ  URM                  5         [        U5      S:X  a  SU;   a   UR9                  U5        OUR9                  U5        OyURF                  RN                  " S0 UD6n	O\[Q        US5      (       a  URS                  U5        O9[        S	RU                  TR                  U[W        U5      RX                  5      5      eU	S :w  a   UR7                  U	5        XPR                  U'   GM+  UR(                  ["        R<                  :X  a  T
" UR>                  U5      n []        XU5        GMl     g s  snf !   URM                  5         URF                  RN                  " S0 UD6n	 N= f! [         a    [[        TR                  U5         Nf = f! [         a    [[        TR                  U5         GM  f = f)
Nr   rJ   Fz'() got an unexpected keyword argument "r   r   r7   _internal_assignzYMessage field {0}.{1} must be initialized with a dict or instance of same class, got {2}.)/rW   r   rX   rY   r_   rZ   r[   message_listener_modNullMessageListenerr\   	_Listenerr]   r   _GetFieldByNamer   r%   ri   rg   r   r   rt   ru   rp   rw   r   dictrD   	MergeFromupdateaddCPPTYPE_ENUMr   extendmessage_modMessagern   r   _StructFullTypeNameClearr   r:   r   formatrf   rK   r   r   )selfkwargsr   field_valuerF   
field_copyr   
item_valuevalnew_valr   ra   s             r+   init_AddInitMethod.<locals>.init  s   D#&v;?D DL DL D!&D)==?DN"+D/D#)<<>
0*=e	+00*> ? 	?			(77	7//5
>>-===!%(($#(-
j$///**8Z8/++J7 % ,"C&&%% **3/	 # ^^/<<<&13&1s 0E&1  3


K
((U>>-===//5
k;#6#677'T**))-@@;1$[)@L!!+. ,((88G;GGZ!344

%
%k
299?$)){#,,:  d?P  ) )U>>-:::,U__kJ+	N
$K
0U $2:3L  ",,<<K{K(  P*+=+B+BJOP  	N
();)@)@*
M
M	Ns6   )O!O&;PP?&.P P<;P<? Q$#Q$N)rL   rO   rD   )ra   r$   r  r   s   `  @r+   r>   r>     s%    ZNx $/$,,r-   c                 z     U R                   U   $ ! [         a    [        SU R                  < SU< S35      ef = f)zReturns 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.
Protocol message 	 has no "" field.)rs   r   r   r%   )ra   r   s     r+   r   r   S  sD    <,,Z88	 <
(--z; < <<s    ):c                     U R                    H  n[        X!5        M     U R                  (       a  [        S 5      Ul        gg)=Adds properties for all fields in this protocol message type.c                     [        U 5      $ rc   )_ExtensionDictr  s    r+   <lambda>)_AddPropertiesForFields.<locals>.<lambda>k  s	    >$+?r-   N)r7   _AddPropertiesForFieldr9   property
Extensions)r   r$   rF   s      r+   r?   r?   c  s9      e5& !  ?@CN r-   c                 T   [         R                  S:X  d   eU R                  R                  5       S-   n[	        XU R
                  5        U R                  [         R                  :X  a  [        X5        gU R                  [         R                  :X  a  [        X5        g[        X5        g)a  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.

   _FIELD_NUMBERN)rg   MAX_CPPTYPEr%   upperr   r{   ri   r   _AddPropertiesForRepeatedFieldrt   ru   *_AddPropertiesForNonRepeatedCompositeField'_AddPropertiesForNonRepeatedScalarField)rF   r$   constant_names      r+   r  r  n  s{     
	%	%	++	+**""$6-	#ell+
[[$333"5.~~)999.u:+E7r-   c                       \ rS rSrSrS rSrg)_FieldPropertyi  )r   c                 8    [         R                  XX4S9  Xl        g )Ndoc)r  rD   r   )r  r   gettersetterr*  s        r+   rD   _FieldProperty.__init__  s    dF4 Or-   N)rK   rL   rM   rN   r`   rD   rP   rJ   r-   r+   r'  r'    s    )!r-   r'  c                    ^ ^ T R                   m[        T5      nU 4S jnSUl        ST-  Ul        U4S jnST-  n[	        X[        T X4US95        g)a  Adds 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.
c                    > U R                   R                  T5      nUc-  TR                  U 5      nU R                   R                  TU5      nU$ rc   rY   getr   
setdefaultr  r  rF   s     r+   r+  ._AddPropertiesForRepeatedField.<locals>.getter  K    ,,""5)K..t4k LL++E;?kr-   NGetter for %s.c                     > [        ST-  5      e)NzIAssignment not allowed to repeated field "%s" in protocol message object.)AttributeError)r  	new_valuerT   s     r+   r,  ._AddPropertiesForRepeatedField.<locals>.setter  s     
 <>NO P Pr-   /Magic attribute generated for "%s" proto field.r)  r%   rU   rL   rO   r   r'  )rF   r$   property_namer+  r,  r*  rT   s   `     @r+   r"  r"    s\     ZZ 01- &#&66&.P 	:<LL#	#nUFLMr-   c                 H  ^ ^^^	 T R                   n[        U5      n[        R                  " T 5      m	T R                  mUU 4S jnSUl        SU-  Ul        U U	4S jmT R                  (       a  U U4S jnOTnSUl        SU-  Ul        SU-  n[        X[        T XEUS95        g)	a  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.
c                 <   > U R                   R                  TT5      $ rc   )rY   r1  )r  r   rF   s    r+   r+  7_AddPropertiesForNonRepeatedScalarField.<locals>.getter  s     <<E=11r-   Nr6  c                 t  >  TR                  U5      nTR                  (       d8  [        R
                  " U5      (       a  U R                  R                  TS 5        OXR                  T'   U R                  (       d  U R                  5         g g ! [         a  n[        STR                  X4-  5      eS nAff = f)NzCannot set %s to %.1024r: %s)

CheckValuer   r   r   r	   IsDefaultScalarValuerY   poprX   	_Modified)r  r9  erF   r   s      r+   field_setter=_AddPropertiesForNonRepeatedScalarField.<locals>.field_setter  s    L)))4i '">">y"I"I
llud#%ll5 ''
nn (  L
(EOOY+J
JL LLs   B 
B7B22B7c                 8   > T" X5        U R                  T5        g rc   )_UpdateOneofState)r  r9  rF   rG  s     r+   r,  7_AddPropertiesForNonRepeatedScalarField.<locals>.setter  s    4#
U#r-   zSetter for %s.r;  r)  )
r%   rU   r   r   r   rL   rO   r   r   r'  )
rF   r$   rT   r=  r+  r,  r*  r   rG  r   s
   `      @@@r+   r$  r$    s     ZZ 01---e4,%%-2 &#&66&.$ $ F&#&66&. 	:<LL#	#nUFLMr-   c                    ^ ^^ T R                   m[        T5      nU 4S jmSTl        ST-  Tl        U UU4S jnST-  n[	        X[        T TX4S95        g)a@  Adds 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.
c                    > U R                   R                  T5      nUc-  TR                  U 5      nU R                   R                  TU5      nU$ rc   r0  r3  s     r+   r+  :_AddPropertiesForNonRepeatedCompositeField.<locals>.getter  r5  r-   Nr6  c                   > TR                   R                  S:X  a'  T" U 5        U R                  T   R                  U5        g TR                   R                  S:X  a'  T" U 5        U R                  T   R	                  U5        g TR                   R                  [
        :X  aD  T" U 5        U R                  T   R                  5         U R                  T   R                  U5        g TR                   R                  [        :X  aD  T" U 5        U R                  T   R                  5         U R                  T   R                  U5        g [        ST-  5      e)Nzgoogle.protobuf.Timestampzgoogle.protobuf.DurationzJAssignment not allowed to composite field "%s" in protocol message object.)rn   r   rY   FromDatetimeFromTimedeltar  r  r   _ListValueFullTypeNamer   r8  )r  r9  rF   r+  rT   s     r+   r,  :_AddPropertiesForNonRepeatedCompositeField.<locals>.setter  s   ##'BBTl
ll5&&y1				%	%)C	CTl
ll5''	2				%	%)<	<Tl
ll5!
ll5  +				%	%)?	?Tl
ll5!
ll5  +-/?@ r-   r;  r)  r<  )rF   r$   r=  r,  r*  r+  rT   s   `    @@r+   r#  r#    s[     ZZ 01- &#&66&., 	:<LL#	#nUFFLMr-   c                     U R                   nUR                  5        H.  u  p4UR                  5       S-   n[        XUR                  5        M0     U R
                  b  U R
                  R                  ngg)r  r  N)r   r   r!  r   r{   r;   r/   )r   r$   rG   r   r   r%  r/   s          r+   r@   r@   0  sf    ,,*)3)9)9);%n"((*_<MC 6 67 *< __ ??D !r-   c                 2   ^  U 4S jn[        U5      T l        g )Nc                 8   > T" 5       nUR                  U 5        U$ rc   )MergeFromString)sr   r$   s     r+   
FromString%_AddStaticMethods.<locals>.FromString>  s    eGANr-   )staticmethodrY  )r$   rY  s   ` r+   rA   rA   =  s      
+#.r-   c                     U S   R                   [        R                  :X  a  [        U S   5      $ U S   R                  [        R
                  :X  a  U S   R                  $ g)zGiven a (FieldDescriptor, value) tuple from _fields, return true if the
value should be included in the list returned by ListFields().r   r   T)ri   rg   r   boolrt   ru   r[   items    r+   
_IsPresentr`  E  sU     
!W]]&555Q=Aw+;;;7(((r-   c                     S nX!l         g) Helper for _AddMessageMethods().c                     U R                   R                  5        Vs/ s H  n[        U5      (       d  M  UPM     nnUR                  S S9  U$ s  snf )Nc                      U S   R                   $ )Nr   )r{   r^  s    r+   r  :_AddListFieldsMethod.<locals>.ListFields.<locals>.<lambda>V  s    tAw~~r-   )r   )rY   r   r`  sort)r  r_  
all_fieldss      r+   
ListFields(_AddListFieldsMethod.<locals>.ListFieldsT  sG    #'<<#5#5#7L#74:d;K$#7JLOO5O6 Ms
   AAN)rh  )ra   r$   rh  s      r+   _AddListFieldsMethodrj  Q  s    
 .r-   c                   ^ ^^ 0 mT R                    HE  nUR                  [        R                  :X  a  M#  UR                  (       d  M6  UTUR
                  '   MG     T R                   H  nUTUR
                  '   M     UUU 4S jmTUl        g)rb  c                   >  TU   n[        U[        R
                  5      (       a    T" X R                  U   R                  5      $ UR                  [        R                  :X  a2  U R                  R                  U5      nUS L=(       a    UR                  $ X R                  ;   $ ! [          a$  n[        STR                  < SU< S35      UeS nAff = f! [          a     gf = f)Nr  z has no non-repeated field "z3" nor has presence is not available for this field.F)r   r   r   r   descriptor_modOneofDescriptorr_   r%   rt   rg   ru   rY   r1  r[   )r  r   rF   r   rr   HasFieldhassable_fieldsra   s        r+   ro  $_AddHasFieldMethod.<locals>.HasFieldl  s    Oj)e %7788ll516677 
+;;	;  'D @U%@%@@$$  O-77E FKNOO  s(   B% C %
C/CC
C#"C#N)r7   ri   rg   r   r   r%   oneofsro  )ra   r$   rF   oneofro  rp  s   `   @@r+   _AddHasFieldMethodrt  \  sx     /!((e{{&555"'OEJJ ) "((e"'OEJJ )%( #,r-   c                    ^  U 4S jnX!l         g)rb  c           	      L  >  TR                   U   nX R                  ;   a  [        U R                  U   S5      (       a  U R                  U   R                  5         U R                  U	 U R                  R                  UR                  S 5      UL a  U R                  UR                  	 U R                  5         g ! [         a_     TR                  U   nX R                  ;   a  U R                  U   n N g ! [         a    [	        STR
                  < SU< S35      ef = ff = f)Nr  r  r  InvalidateIterators)rs   r   oneofs_by_namer_   r   r%   rY   r:   rw  r1  r   rE  )r  r   rF   ra   s      r+   
ClearField(_AddClearFieldMethod.<locals>.ClearField  s   @ //
;e  
e$&;	<	<U//1
 ,,u
			%00$	75	@LL//0
 	NN9  	@@"11*=LL ,,u%%
 @,11:? @ 	@@	@s   B: :
D#-C66)DD#N)ry  )ra   r$   ry  s   `  r+   _AddClearFieldMethodr{    s    B .r-   c                     S nXl         g)rb  c                     [         R                  " X5        XR                  ;   a  U R                  U	 U R                  5         g rc   )r   _VerifyExtensionHandlerY   rE  )r  r   s     r+   ClearExtension0_AddClearExtensionMethod.<locals>.ClearExtension  s3    ))$A <<'
,,'
(NNr-   N)r  )r$   r  s     r+   _AddClearExtensionMethodr    s     &r-   c                     S nXl         g)rb  c                 V   [         R                  " X5        UR                  [        R                  :X  a  [        SUR                  -  5      eUR                  [        R                  :X  a2  U R                  R                  U5      nUS L=(       a    UR                  $ XR                  ;   $ )Nz"%s" is repeated.)r   r~  ri   rg   r   r   r   rt   ru   rY   r1  r[   )r  r   rr   s      r+   HasExtension,_AddHasExtensionMethod.<locals>.HasExtension  s    ))$A!1!@!@@(+;+E+EEFF  $4$D$DDll/0e$>5#>#>>--r-   N)r  )r$   r  s     r+   _AddHasExtensionMethodr    s    	. "r-   c                 2   SSK Jn  UR                  5       nU R                  nU(       d  gUR	                  S5      S   nUR
                  R                  U5      nUc  gSSK Jn  UR                  U5      nU" 5       nUR                  U R                  5        U$ )ad  Unpacks Any message and returns the unpacked message.

This internal method is different from public Any Unpack method which takes
the target message as argument. _InternalUnpackAny method does not have
target message type and need to find the message type in descriptor pool.

Args:
  msg: An Any message to be unpacked.

Returns:
  The unpacked message.
r   )symbol_databaseN/r   )r   r  Defaulttype_urlsplitr/   FindMessageTypeByNamer   r   ParseFromStringrr   )	msgr  factoryr  	type_namer   r   message_classr   s	            r+   _InternalUnpackAnyr    s    " .##%'\\(	 nnS!"%)||11)<* .!11*=-O'	#))$	.r-   c                     S nX!l         g)rb  c                    U R                   R                  [        :X  a&  [        U[        5      (       a  U R                  U5      $ U R                   R                  [        :X  a&  [        U[        5      (       a  U R                  U5      $ [        U[        R                  5      (       a  UR                   U R                   :w  a  [        $ XL a  gU R                   R                  [        :X  a(  [        U 5      n[        U5      nU(       a  U(       a  X#:H  $ U R                  5       UR                  5       :X  d  g[	        U R                  5      nUR                  5         [	        UR                  5      nUR                  5         XE:H  $ )NTF)r   r   rR  r   list_internal_comparer  r   r  r  NotImplemented_AnyFullTypeNamer  rh  rZ   rf  )r  otherany_aany_bunknown_fieldsother_unknown_fieldss         r+   __eq__ _AddEqualsMethod.<locals>.__eq__  s8     $::zt@ @ ##E**  $77Jt= = ##E**uk1122DOO+}  $44 &e 'e	5~?? 0 0 22 $../N 5 5611r-   N)r  )ra   r$   r  s      r+   _AddEqualsMethodr    s     2D *r-   c                     S nX!l         g)rb  c                 .    [         R                  " U 5      $ rc   r   MessageToStringr  s    r+   __str___AddStrMethod.<locals>.__str__      &&t,,r-   N)r  )ra   r$   r  s      r+   _AddStrMethodr    s    -+r-   c                     S nX!l         g)rb  c                 .    [         R                  " U 5      $ rc   r  r  s    r+   __repr__ _AddReprMethod.<locals>.__repr__  r  r-   N)r  )ra   r$   r  s      r+   _AddReprMethodr    s    -,r-   c                     S nX!l         g)rb  c                 J    [         R                  " U SS9R                  S5      $ )NT)as_utf8zutf-8)r   r  decoder  s    r+   __unicode__&_AddUnicodeMethod.<locals>.__unicode__&  s     &&tT:AA'JJr-   N)r  )unused_message_descriptorr$   r  s      r+   _AddUnicodeMethodr  #  s    K/r-   c                 f    U R                   S:X  a  S nOU R                   S:X  a  S nOS nX!l        g )Nr   c                     XR                   ;   $ rc   )r7   )r  r   s     r+   __contains__(_AddContainsMethod.<locals>.__contains__.  s    KKr-   r   c                 &    XR                  5       ;   $ rc   )r   )r  rr   s     r+   r  r  1  s    jjl""r-   c                 $    U R                  U5      $ rc   )ro  )r  rF   s     r+   r  r  4  s    ]]5!!r-   )r   r  )ra   r$   r  s      r+   _AddContainsMethodr  +  s7    !!%== ##'BB#" "r-   c                      [         R                  U   nU" X5      $ ! [         a    [        R                  " SU-  5      ef = f)a  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.
zUnrecognized field type: %d)r   TYPE_TO_BYTE_SIZE_FNr   r  EncodeError)rr   field_number
field_typefns       r+   _BytesForNonRepeatedElementr  :  sK    N		+	+J	7Bl""	 N

!
!"?*"L
MMNs	    $Ac                     ^ U4S jnUTl         g)rb  c                 h  > U R                   (       d  U R                  $ SnU R                  nUR                  (       ao  UR                  S   n[        T	U5        UR                  U R                  5      nUR                  S   n[        T	U5        XR                  U R                  5      -  nOgU R                  5        H$  u  pV[        T	U5        XR                  U5      -  nM&     U R                   H  u  pxU[        U5      [        U5      -   -  nM!     Xl        SU l         SU R                  l        U$ )Nr   r   rr   F)rX   rW   r   ro   rs   r   r   r   rr   rh  rZ   r   r]   dirty)
r  sizer   	key_fieldr   r   r  r~   value_bytesr$   s
            r+   ByteSize$_AddByteSizeMethod.<locals>.ByteSizeQ  s   ''###DJ++E2isI&dhh'd--g6ksK(
  ,,d+/??+<
'
./''44 ,= %)$8$8
 )I[!111 %9 "#(D (-D%Kr-   N)r  )ra   r$   r  s    ` r+   _AddByteSizeMethodr  N  s    4 #,r-   c                     S nX!l         g)rb  c           	          U R                  5       (       dO  [        R                  " SU R                  R                  < SSR                  U R                  5       5      < 35      eU R                  " S0 UD6$ )NzMessage z is missing required fields: ,rJ   )IsInitializedr  r  r   r   joinFindInitializationErrorsSerializePartialToString)r  r  s     r+   SerializeToString6_AddSerializeToStringMethod.<locals>.SerializeToStringq  sc    ##
//
#
#SXXd.K.K.M%NPQ Q ((2622r-   N)r  )ra   r$   r  s      r+   _AddSerializeToStringMethodr  n  s    3 ,r-   c                 8   ^ S nUTl         SU4S jjnUTl        g)rb  c                 p    [        5       nU R                  " UR                  40 UD6  UR                  5       $ rc   )r   _InternalSerializewritegetvalue)r  r  outs      r+   r  D_AddSerializePartialToStringMethod.<locals>.SerializePartialToString~  s,    
)CCII00<<>r-   Nc                   > Uc  [         R                  " 5       nO[        U5      nU R                  nUR                  (       ao  UR
                  S   n[        T
U5        UR                  XR                  U5        UR
                  S   n[        T
U5        UR                  XR                  U5        g U R                  5        H#  u  pg[        T
U5        UR                  XU5        M%     U R                   H  u  pU" U5        U" U	5        M     g )Nr   rr   )r   )IsPythonDefaultSerializationDeterministicr]  r   ro   rs   r   r   r   rr   rh  rZ   )r  write_bytesdeterministicr   r  r   r   r  r~   r  r$   s             r+   InternalSerialize=_AddSerializePartialToStringMethod.<locals>.InternalSerialize  s    

F
F
H  =)mJ++E2isI&hh>--g6ksK(;

MB+/??+<
'
./!!+MJ ,= %)$8$8
 )IK  %9r-   rc   )r  r  )ra   r$   r  r  s    `  r+   "_AddSerializePartialToStringMethodr  {  s!     ":#!. -#r-   c                 l   ^^^ S nUTl         TR                  mTR                  mUUU4S jnUTl        g)rb  c                 >   [        U5      n[        U5      n U R                  USU5      U:w  a  [        R                  " S5      e U$ ! [
        [        4 a    [        R                  " S5      e[        R                   a  n[        R                  " U5      eS nAff = f)Nr   zUnexpected end-group tag.zTruncated message.)	
memoryviewr   _InternalParser  DecodeError
IndexErrorr   structerror)r  
serializedlengthrF  s       r+   rW  2_AddMergeFromStringMethod.<locals>.MergeFromString  s    J'J_F	'			ZF	3v	= %%&ABB 
> M 	" :##$899<< '##A&&'s   -A 9BBBc                   > [        U[        5      (       d   eU R                  5         U R                  nX#:w  GaO  [        R
                  " X5      u  pVTR                  US5      u  pxU(       a  U" XX0U5      nME  TR                  US5      u  pUc  U R                  (       d  / U l        [        R                  " U5      u  pU
S:X  a  [        R                  " S5      e[        R                  " XX:U5      u  pUS:X  a  U$ U R                  R                  XQU[        U5      -   U R                  5       45        UnOG[        TU5        UR                   U	   nU" XX0U5      nUR"                  (       a  U R%                  U5        X#:w  a  GMO  U$ )a  Create a message from serialized bytes.

Args:
  self: Message, instance of the proto message object.
  buffer: memoryview of the serialized data.
  pos: int, position to start in the serialized data.
  end: int, end position of the serialized data.

Returns:
  Message object.
)NNr   zField number 0 is illegal.r  )r   r  rE  rY   r	   ReadTagr1  rZ   	DecodeTagr  r  _DecodeUnknownFieldappendr   tobytesr   r   r   rJ  )r  bufferposend
field_dictr~   new_posr   	field_desr}   r  	wire_typedatar$   fields_by_tagmessage_set_decoders_by_tags                r+   InternalParse0_AddMergeFromStringMethod.<locals>.InternalParse  sv    fj))))NNJ
*$__V9y!<!@!@
\"m 
FS
C*..y,Gi		##!#$
")"3"3I">1''(DE
E!55S	
 b=*##sS^3g>FFHI	
 i(!++I6FS
C%%

 
 
+; *< Jr-   N)rW  r1   r0   r  )ra   r$   rW  r  r   r  s    `  @@r+   _AddMergeFromStringMethodr    s9     (#$$- # @ @/` %#r-   c                    ^ U R                    Vs/ s H%  nUR                  [        R                  :X  d  M#  UPM'     snmSU4S jjnX1l        U4S jnXAl        gs  snf )zYAdds the IsInitialized and FindInitializationError methods to the
protocol message class.Nc                 *  > T Ht  nX R                   ;  d@  UR                  [        R                  :X  d  M2  U R                   U   R                  (       a  MR  Ub  UR                  U R                  5       5          g   [        U R                   R                  5       5       H  u  p#UR                  [        R                  :X  d  M%  UR                  [        R                  :X  ab  UR                  R                  (       a  M`  U H=  nUR                  5       (       a  M  Ub  UR                  U R                  5       5            g   M  UR                  (       d  M  UR                  5       (       a  M  Ub  UR                  U R                  5       5          g   g)zChecks 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.
FT)rY   rt   rg   ru   r[   r   r  r  r   ri   r   rn   ro   r  )r  errorsrF   rr   elementrequired_fieldss        r+   r  ._AddIsInitializedMethod.<locals>.IsInitialized  s-    !
||
#>>-===||E"888
--557
8 ! T\\//12	+;;	;;;*999  ..g((**#d;;=>	 
 (((1D1D1F1FMM$779: 3 r-   c                 |  > / nT H@  nU R                  UR                  5      (       a  M%  UR                  UR                  5        MB     U R                  5        GHN  u  p#UR                  [
        R                  :X  d  M&  UR                  (       a  SUR                  -  nOUR                  n[        U5      (       aR  [        U5      (       a@  U H8  nX5   nU< SU< S3nUR                  5       nX V	s/ s H  oU	-   PM	     sn	-  nM:     M  M  UR                  [
        R                  :X  aO  [        [        U5      5       H4  n
X:   nSXJ4-  nUR                  5       nX V	s/ s H  oU	-   PM	     sn	-  nM6     GM"  US-   nUR                  5       nX V	s/ s H  oU	-   PM	     sn	-  nGMQ     U$ s  sn	f s  sn	f s  sn	f )zFinds 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".
z(%s)[z].z%s[%d].r   )ro  r%   r  rh  rt   rg   ru   rd   r   rp   rw   r  ri   r   ranger   )r  r  rF   rr   r%   r   r  prefix
sub_errorsr  ir	  s              r+   r  9_AddIsInitializedMethod.<locals>.FindInitializationErrors  s    F ]]5::&&ejj! ! )	+;;	;%//)$$u&&
g$(#.f";;=jZ@ZE%Z@@f	  [[,;;;U$ahG$*F 99;J:>:%~:>>F	 % #:&557*
<e^<
<&5 *8 M A ? =s   4F/
"F4
F9rc   )r7   ri   rg   LABEL_REQUIREDr  r  )ra   r$   rF   r  r  r	  s        @r+   _AddIsInitializedMethodr    s`     );(A(A N(Au#kk-=-L-LL (A N/$L $*X ":oNs
   "AAc                 h    U R                   n[        U SU R                  5      nUS;   a  U$ US-   U-   $ )NrM   )Nbuiltins__builtin__r   )rL   r   rK   )klassmoduler%   s      r+   _FullyQualifiedClassNamer  D  s<    &		7$00K	#	r-   c                 h   ^ ^^ [         R                  m[         R                  mUUU 4S jnUT l        g )Nc                 j  > [        UT5      (       d0  [        S[        T5      < S[        UR                  5      < S35      eXLd   eU R	                  5         U R
                  nUR
                  R                  5        H  u  p4UR                  T:X  a<  UR                  U5      nUc  UR                  U 5      nXRU'   UR                  U5        MQ  UR                  T:X  aO  UR                  (       a<  UR                  U5      nUc  UR                  U 5      nXRU'   UR                  U5        M  M  X@R
                  U'   UR                  (       d  M  U R                  U5        M     UR                  (       a>  U R                  (       d  / U l        U R                  R!                  UR                  5        g g )NzBParameter to MergeFrom() must be instance of same class: expected z got r   )r   r   r  r*   rE  rY   r   ri   r1  r   r   rt   r[   r   rJ  rZ   r   )	r  r  r7   rF   rr   r  ru   r   r$   s	         r+   r   &_AddMergeFromMethod.<locals>.MergeFromP  sl   c3#;C#@#;CMM#JLM M
 ??NN\\F))+		&jj'2248+%-e$>>_,&&

5)+ 44T:K'5M



& ' $U!!!

 
 
'' ,* !!!
!!#"5"56 r-   )rg   r   ru   r   )r$   r   ru   r   s   ` @@r+   _AddMergeFromMethodr  L  s(    #22.$44/$7L #-r-   c                    ^  U 4S jnX!l         g )Nc                    >  TR                   U   nU R                  R	                  US5      nUb,  U R                  UR                  5      (       a  UR                  $ g! [         a    [        SU-  5      ef = f)zDReturns the name of the currently set field inside a oneof, or None.z)Protocol message has no oneof "%s" field.N)rx  r   r   r_   r1  ro  r%   )r  
oneof_namerF   nested_fieldra   s       r+   
WhichOneof(_AddWhichOneofMethod.<locals>.WhichOneofz  s    D //
;e
 <<##E40LDMM,2C2C$D$D  D
5

BD DDs   A A7)r"  )ra   r$   r"  s   `  r+   _AddWhichOneofMethodr$  y  s     .r-   c                 N    0 U l         SU l        0 U l        U R                  5         g )NrJ   )rY   rZ   r_   rE  r  s    r+   _Clearr&    s"    $,$$,..r-   c                     [        S5      e)NzbPlease use the add-on feaure unknown_fields.UnknownFieldSet(message) in unknown_fields.py instead.)NotImplementedErrorr  s    r+   _UnknownFieldsr)    s     9 	: :r-   c                    / U l         U R                  5        H  u  pUR                  [        R                  :X  d  M%  [        U5      (       a/  [        U5      (       a  U H  nX#   R                  5         M     Mb  Md  UR                  [        R                  :X  a  U H  nUR                  5         M     M  UR                  5         M     g rc   )
rZ   rh  rt   rg   ru   rp   rw   DiscardUnknownFieldsri   r   )r  rF   rr   r   sub_messages        r+   _DiscardUnknownFieldsr-    s    $oo'le~~)999	U		e$$cJ++-  % ;;*999 K

*
*
, ! 	""$ (r-   c                 L    Uc  [         R                  " 5       U l        g Xl        g rc   )r   r   r\   )r  listeners     r+   r   r     s    )==?DNNr-   c                    [        X5        [        X5        [        X5        U R                  (       a  [	        U5        [        U5        [        X5        [        X5        [        X5        [        X5        [        X5        [        X5        [        X5        [        X5        [        X5        [        X5        [!        U5        [#        X5        [$        Ul        [(        Ul        [,        Ul        g)z3Adds implementations of all Message methods to cls.N)rj  rt  r{  r9   r  r  r  r  r  r  r  r  r  r  r  r  r  r$  r&  r  r-  r+  r   )ra   r$   s     r+   rB   rB     s    )/'-)/%%S!3%+"(#)&,'-'-06$%7=.4,2c)/#)2#!#r-   c                 4    S nS nX!l         X!l        X1l        g)z5Adds implementation of private helper methods to cls.c                     U R                   (       d:  SU l         SU R                  l        SU l        U R                  R                  5         gg)zoSets the _cached_byte_size_dirty bit to true,
and propagates this to our listener iff this was a state change.
TN)rX   r]   r  r[   r\   Modifiedr  s    r+   r3  *_AddPrivateHelperMethods.<locals>.Modified  s@     ''%)d"*.d!!'#'d 
nn	 (r-   c                     U R                   R                  UR                  U5      nX!La&  U R                  U	 XR                   UR                  '   gg)zSets field as the active field in its containing oneof.

Will also delete currently active field in the oneof, if it is different
from the argument. Does not mark the message as modified.
N)r_   r2  r   rY   )r  rF   other_fields      r+   rJ  3_AddPrivateHelperMethods.<locals>._UpdateOneofState  sI     ,,))%*@*@%HK
,,{
#-2ll5))*  r-   N)rE  SetInParentrJ  )ra   r$   r3  rJ  s       r+   rC   rC     s     	3 -/+r-   c                   $    \ rS rSrSrS rS rSrg)r   i  a"  MessageListener implementation that a parent message registers with its
child message.

In order to support semantics like:

  foo.bar.baz.moo = 23
  assert foo.HasField('bar')

...child objects must have back references to their parents.
This helper class is at the heart of this support.
c                     [        U[        R                  5      (       a  Xl        O[        R                  " U5      U l        SU l        g)zqArgs:
parent_message: The message whose _Modified() method we should call when
  we receive Modified() messages.
FN)r   weakref	ProxyType_parent_message_weakrefproxyr  )r  parent_messages     r+   rD   _Listener.__init__  s7     .'"3"344%3"%,]]>%Bd"
 DJr-   c                 ~    U R                   (       a  g  U R                  R                  5         g ! [         a     g f = frc   )r  r=  rE  ReferenceErrorr  s    r+   r3  _Listener.Modified  s7    zz
"",,.  	s   / 
<<)r=  r  N)rK   rL   rM   rN   rO   rD   r3  rP   rJ   r-   r+   r   r     s    
&
r-   r   c                   8   ^  \ rS rSrSrU 4S jrU 4S jrSrU =r$ )r   i  zCSpecial listener implementation for setting composite oneof fields.c                 8   > [         [        U ]  U5        X l        g)zArgs:
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)r"   r   rD   _field)r  r?  rF   r*   s      r+   rD   _OneofListener.__init__  s     
.$(8Kr-   c                    >  U R                   R                  U R                  5        [        [        U ]  5         g! [         a     gf = f)zEAlso updates the state of the containing oneof in the parent message.N)r=  rJ  rF  r"   r   r3  rB  )r  r*   s    r+   r3  _OneofListener.Modified&  s?    
""44T[[AND*, 
s   7; 
AA)rF  )	rK   rL   rM   rN   rO   rD   r3  rP   rQ   rR   s   @r+   r   r     s    K r-   r   )ZrO   
__author__datetimeior   mathr  r   warningsr;  r   r   rm  r   r  r   google.protobuf.internalr   r   r	   r
   r   r   r   r   r   r   r   FieldDescriptorrg   r  r  rR  r  rf   r   rU   r!   rl   rp   rw   r8   r   r   r    r=   r   r   r   r>   r   r?   r  r  r'  r"  r$  r#  r@   rA   r`  rj  rt  r{  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r$  r&  r)  r-  r   rB   rC   objectr   r   rJ   r-   r+   <module>rR     s   3
     
   8 2 ' 7 / , , 6 3 M 2 5 0!11 ( . 4 ..H14 H1f:(&:,
A?(,01/h17#,7t.pf< A82!X !)NX5Np:Nz ,	$N#L	&"(V$N "N(@
, -FE%P[:|*Z$:%"4,D+ +\Y r-   