
    @R<i                      <    d Z ddlmZ ddlmZ d Z G d de      Zy)z7Contains _ExtensionDict class to represent extensions.
    )type_checkers)FieldDescriptorc           	         t        |t              st        d|z        |j                  st        d|j                  z        |j
                  st        d|j                  z        |j
                  | j                  urGt        d|j                  d|j
                  j                  d| j                  j                  d      y)	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     h/var/www/html/delta-backend/venv/lib/python3.12/site-packages/google/protobuf/internal/extension_dict.py_VerifyExtensionHandler   &   s     
$o	6
H#$ % % 
	&	&
.1A1K1KK
LL		)	)
7%//0 1 1 %%W-?-??
$..$44>>&&00	2 3 3 @    c                   X    e 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y)_ExtensionDictzDict-like container for Extension fields on proto instances.

  Note that in all cases we expect extension handles to be
  FieldDescriptors.
  c                     || _         y)z^
    Args:
      extended_message: Message instance for which we are the Extensions dict.
    N)_extended_message)selfextended_messages     r   __init__z_ExtensionDict.__init__G   s    
 .Dr   c                 4   t        | j                  |       | j                  j                  j                  |      }||S |j                  t
        j                  k(  r|j                  | j                        }n|j                  t
        j                  k(  r|j                  }t        |d      s%| j                  j                  j                  |       t        |j                  dd      s,J d|j                  d|j                  j                  d       |j                  j!                         }	 |j#                  | j                  j$                         n|j(                  S | j                  j                  j+                  ||      }|S # t&        $ r Y 3w xY w)z8Returns the current value of the given extension handle.N_concrete_classz-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_FACTORYGetPrototypegetattrr	   r   _SetListener_listener_for_childrenReferenceErrordefault_value
setdefault)r   r   resultr"   s       r   __getitem__z_ExtensionDict.__getitem__N   sj    4113CD##++//0@AFm!?!??44T5K5KLf		"	"o&E&E	E%22l\#45''44\B%224EtL 7''**4467L  ,,<<>fD22IIJ +++ ##++66&"F M!  s   1%F 	FFc                 &   t        || j                        sy| j                  j                         }|j                  j                         }|D cg c]  }|j                  s| }}|D cg c]  }|j                  s| }}||k(  S c c}w c c}w )NF)r   	__class__r   
ListFieldsr   )r   other	my_fieldsother_fieldsfields        r   __eq__z_ExtensionDict.__eq__w   s    eT^^,&&113I**557L %.D51C1CDID'3Jeu7I7IEJLJ$$ EJs   B	"B	,B>Bc                     | |k(   S N )r   r1   s     r   __ne__z_ExtensionDict.__ne__   s    u}r   c                     | j                   j                         }|D cg c]  }|d   j                  s| }}t        |      S c c}w )Nr   )r   r0   r   len)r   fieldsr4   extension_fieldss       r   __len__z_ExtensionDict.__len__   sH    ##..0F+1K%U1X5J5JKK   Ls
   AAc                     t        d      )Nzunhashable object)	TypeErrorr   s    r   __hash__z_ExtensionDict.__hash__   s    
'
((r   c                    t        | j                  |       |j                  t        j                  k(  s|j
                  t        j                  k(  rt        d|j                  z        t        j                  |      }|j                  |      | j                  j                  |<   | j                  j                          y)zlIf 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!   r@   r	   r   GetTypeChecker
CheckValuer   	_Modified)r   r   valuetype_checkers       r   __setitem__z_ExtensionDict.__setitem__   s    
 4113CD/"@"@@!!_%D%DD.889: : !//0@AL 	& 	""#34$$&r   c                 :    | j                   j                  |       y r7   )r   ClearExtension)r   r   s     r   __delitem__z_ExtensionDict.__delitem__   s    ))*:;r   c                 N    | j                   j                  j                  |d      S )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   _FindExtensionByNamez#_ExtensionDict._FindExtensionByName   s#     !!5599$EEr   c                 N    | j                   j                  j                  |d      S )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   _FindExtensionByNumberz%_ExtensionDict._FindExtensionByNumber   s#     !!77;;FDIIr   c                 D    d | j                   j                         D        S )Nc              3   D   K   | ]  }|d    j                   r|d      yw)r   N)r   ).0fs     r   	<genexpr>z*_ExtensionDict.__iter__.<locals>.<genexpr>   s(      "Qt   aD "s    )r   r0   rA   s    r   __iter__z_ExtensionDict.__iter__   s"    "$00;;= " "r   c                    t        | j                  |       || j                  j                  vry|j                  t        j
                  k(  r.t        | j                  j                  j                  |            S |j                  t        j                  k(  r7| j                  j                  j                  |      }|d uxr |j                  S y)NFT)r   r   r   r   r   r   boolr   r    r!   _is_present_in_parent)r   r   rG   s      r   __contains__z_ExtensionDict.__contains__   s    4113CDt55===!?!??$((00445EFGG  O$C$CC$$,,001ABe$>5#>#>>r   N)__name__
__module____qualname____doc__r   r-   r5   r9   r>   rB   rI   rL   rP   rT   rZ   r^   r8   r   r   r   r   ?   sF    .'R%!)'*<	F	J"
r   r   N)rb   google.protobuf.internalr   google.protobuf.descriptorr   r   objectr   r8   r   r   <module>rf      s%   > 3 632VV Vr   