
    8!                     <    S r SSKJr  SSKJr  S r " S S\5      rg)z7Contains _ExtensionDict class to represent extensions.
    )type_checkers)FieldDescriptorc           	         [        U[        5      (       d  [        SU-  5      eUR                  (       d  [        SUR                  -  5      eUR
                  (       d  [        SUR                  -  5      eUR
                  U R                  LaJ  [        SUR                  < SUR
                  R                  < SU R                  R                  < S35      eg)	z0Verify that the given extension handle is valid.z3HasExtension() expects an extension handle, got: %sz"%s" is not an extension.z""%s" is missing a containing_type.zExtension "z" extends message type "z ", but this message is of type "z".N)
isinstancer   KeyErroris_extension	full_namecontaining_type
DESCRIPTOR)messageextension_handles     Z/root/google-cloud-sdk/lib/third_party/cloudsdk/google/protobuf/internal/extension_dict.py_VerifyExtensionHandler   &   s     
$o	6	6
H#$ % % 
	&	&
.1A1K1KK
LL		)	)
7%//0 1 1 %%W-?-??
$..$44>>&&00	2 3 3 @    c                   `    \ 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 rS rS rSrg)_ExtensionDict?   zDict-like container for Extension fields on proto instances.

Note that in all cases we expect extension handles to be
FieldDescriptors.
c                     Xl         g)zR
Args:
  extended_message: Message instance for which we are the Extensions dict.
N_extended_message)selfextended_messages     r   __init___ExtensionDict.__init__G   s
    
 .r   c                 6   [        U R                  U5        U R                  R                  R                  U5      nUb  U$ UR                  [
        R                  :X  a  UR                  U R                  5      nOUR                  [
        R                  :X  a  UR                  n[        US5      (       d  SSKJn  UR                  U5        [        UR                  SS5      (       d.   SUR                   < SUR                  R                   < S35       eUR                  R#                  5       n UR%                  U R                  R&                  5        OUR*                  $ U R                  R                  R-                  X5      nU$ ! [(         a     N3f = f)z8Returns the current value of the given extension handle.N_concrete_classr   )message_factoryz-Uninitialized concrete class found for field z (message type ))r   r   _fieldsgetlabelr   LABEL_REPEATED_default_constructorcpp_typeCPPTYPE_MESSAGEmessage_typehasattrcloudsdk.google.protobufr   GetMessageClassgetattrr	   r   _SetListener_listener_for_childrenReferenceErrordefault_value
setdefault)r   r   resultr&   r   s        r   __getitem___ExtensionDict.__getitem__N   se    4113CD##++//0@AFm!?!??44T5K5KLf		"	"o&E&E	E%22l\#455<''5%224EtLL 7''**4467L  ,,<<>fD22IIJ +++ ##++66"F M!  s   2%F 
FFc                 L   [        XR                  5      (       d  gU R                  R                  5       nUR                  R                  5       nU Vs/ s H  oDR                  (       d  M  UPM     nnU Vs/ s H  oDR                  (       d  M  UPM     nnX#:H  $ s  snf s  snf )NF)r   	__class__r   
ListFieldsr   )r   other	my_fieldsother_fieldsfields        r   __eq___ExtensionDict.__eq__x   s    e^^,,&&113I**557L %.DI51C1CIID'3J|e7I7IE|LJ$$ EJs   B,B8B!B!c                     X:X  + $ N )r   r6   s     r   __ne___ExtensionDict.__ne__   s    r   c                     U R                   R                  5       nU Vs/ s H  o"S   R                  (       d  M  UPM     nn[        U5      $ s  snf )Nr   )r   r5   r   len)r   fieldsr9   extension_fieldss       r   __len___ExtensionDict.__len__   sG    ##..0F+1K6%1X5J5J6K   Ls
   AAc                     [        S5      e)Nzunhashable object)	TypeErrorr   s    r   __hash___ExtensionDict.__hash__   s    
'
((r   c                    [        U R                  U5        UR                  [        R                  :X  d  UR
                  [        R                  :X  a  [        SUR                  -  5      e[        R                  " U5      nUR                  U5      U R                  R                  U'   U R                  R                  5         g)zdIf extension_handle specifies a non-repeated, scalar extension
field, sets the value of that field.
zKCannot assign to extension "%s" because it is a repeated or composite type.N)r   r   r!   r   r"   r$   r%   rH   r	   r   GetTypeChecker
CheckValuer   	_Modified)r   r   valuetype_checkers       r   __setitem___ExtensionDict.__setitem__   s    
 4113CD/"@"@@!!_%D%DD.889: : !//0@AL 	& 	""#34$$&r   c                 :    U R                   R                  U5        g r=   )r   ClearExtension)r   r   s     r   __delitem___ExtensionDict.__delitem__   s    ))*:;r   c                 N    U R                   R                  R                  US5      $ )zTries to find a known extension with the specified name.

Args:
  name: Extension full name.

Returns:
  Extension field descriptor.
N)r   _extensions_by_namer    )r   names     r   _FindExtensionByName#_ExtensionDict._FindExtensionByName   s#     !!5599$EEr   c                 N    U R                   R                  R                  US5      $ )zTries to find a known extension with the field number.

Args:
  number: Extension field number.

Returns:
  Extension field descriptor.
N)r   _extensions_by_numberr    )r   numbers     r   _FindExtensionByNumber%_ExtensionDict._FindExtensionByNumber   s#     !!77;;FDIIr   c                 D    S U R                   R                  5        5       $ )Nc              3   X   #    U  H   nUS    R                   (       d  M  US    v   M"     g7f)r   N)r   ).0fs     r   	<genexpr>*_ExtensionDict.__iter__.<locals>.<genexpr>   s*      "=Qt   AaD=s   **)r   r5   rI   s    r   __iter___ExtensionDict.__iter__   s"    "$00;;= " "r   c                    [        U R                  U5        XR                  R                  ;  a  gUR                  [        R
                  :X  a.  [        U R                  R                  R                  U5      5      $ UR                  [        R                  :X  a<  U R                  R                  R                  U5      nUS L=(       a    UR                  $ g)NFT)r   r   r   r!   r   r"   boolr    r$   r%   _is_present_in_parent)r   r   rP   s      r   __contains___ExtensionDict.__contains__   s    4113CD55===!?!??$((00445EFGG  O$C$CC$$,,001ABe$>5#>#>>r   r   N)__name__
__module____qualname____firstlineno____doc__r   r1   r:   r?   rE   rJ   rR   rV   r[   r`   rh   rm   __static_attributes__r>   r   r   r   r   ?   sF    .(T%!)'*<	F	J"
r   r   N)rs   !cloudsdk.google.protobuf.internalr   #cloudsdk.google.protobuf.descriptorr   r   objectr   r>   r   r   <module>rx      s%   > < ?32WV Wr   