o
    ýÞhi  ã                   @   s8   d dl Z d dlmZ d dlmZ G dd„ de jjƒZdS )é    N)Úcached_property)ÚMessagec                   @   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.)ÚtypeÚpbÚGetEntryClassÚvalue©Úself© r   ú^/var/www/html/premium_crap/venv/lib/python3.10/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   Ú	to_pythonr   r   r   r   r   r   Ú__getitem__5   s   zMapComposite.__getitem__c                 C   s6   | j j| j|dd�}| j|  ¡  | j|  |¡ d S )NT)Ústrict)r   Úto_protor   r   ÚClearÚ	MergeFrom)r
   r   r   Úpb_valuer   r   r   Ú__setitem__<   s   zMapComposite.__setitem__c                 C   s   | j  |¡ d S r   )r   Úpopr   r   r   r   Ú__delitem__G   s   zMapComposite.__delitem__c                 C   ó
   t | jƒS r   )Úlenr   r	   r   r   r   Ú__len__J   ó   
zMapComposite.__len__c                 C   r$   r   )Úiterr   r	   r   r   r   Ú__iter__M   r'   zMapComposite.__iter__c                 C   s   | j S r   )r   r	   r   r   r   r   P   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   )ÚcollectionsÚproto.utilsr   Úgoogle.protobuf.messager   ÚabcÚMutableMappingr   r   r   r   r   Ú<module>   s   