o
    }j6hi                     @   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 )MapCompositezA 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   m/var/www/html/chefvision.cloud.itp360.com/venv/lib/python3.10/site-packages/proto/marshal/collections/maps.py_pb_type   s   zMapComposite._pb_typec                C   s   || _ || _dS )zInitialize 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   