o
    =j=  ã                   @   s,   d dl Z d dlmZ G dd„ de jjƒZdS )é    N)Úcached_propertyc                   @   s`   e Zd ZdZedd„ ƒZdd„ Zdd„ Zdd	„ Zd
d„ Z	dd„ Z
dd„ Zdd„ Zedd„ ƒZdS )ÚMapCompositez½A view around a mutable sequence in protocol buffers.

    This implements the full Python MutableMapping interface, but all methods
    modify the underlying field container directly.
    c                 C   s   t | j ¡ ƒ jƒS )z2Return the protocol buffer type for this sequence.N)ÚtypeÚpbZGetEntryClassÚvalue©Úself© r	   úhC:\Users\psant\Downloads\Anu Raj Backend\school\venv\Lib\site-packages\proto/marshal/collections/maps.pyÚ_pb_type   s   zMapComposite._pb_typec                C   s   || _ || _dS )zöInitialize a wrapper around a protobuf map.

        Args:
            sequence: A protocol buffers map.
            marshal (~.MarshalRegistry): An instantiated marshal, used to
                convert values going to and from this map.
        N)Ú_pbÚ_marshal)r   ÚsequenceÚmarshalr	   r	   r
   Ú__init__!   s   
zMapComposite.__init__c                 C   s   |t |  ¡ ƒv S ©N)ÚtupleÚkeys©r   Úkeyr	   r	   r
   Ú__contains__,   s   zMapComposite.__contains__c                 C   s&   || vrt |ƒ‚| j | j| j| ¡S r   )ÚKeyErrorr   Z	to_pythonr   r   r   r	   r	   r
   Ú__getitem__4   s   zMapComposite.__getitem__c                 C   s6   | j j| j|dd�}| j|  ¡  | j|  |¡ d S )NT)Ústrict)r   Zto_protor   r   ZClearZ	MergeFrom)r   r   r   Zpb_valuer	   r	   r
   Ú__setitem__;   s   zMapComposite.__setitem__c                 C   s   | j  |¡ d S r   )r   Úpopr   r	   r	   r
   Ú__delitem__F   s   zMapComposite.__delitem__c                 C   ó
   t | jƒS r   )Úlenr   r   r	   r	   r
   Ú__len__I   ó   
zMapComposite.__len__c                 C   r   r   )Úiterr   r   r	   r	   r
   Ú__iter__L   r    zMapComposite.__iter__c                 C   s   | j S r   )r   r   r	   r	   r
   r   O   s   zMapComposite.pbN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r   r   r   r"   Úpropertyr   r	   r	   r	   r
   r      s    
r   )ÚcollectionsZproto.utilsr   ÚabcÚMutableMappingr   r	   r	   r	   r
   Ú<module>   s   