o
    nګe	                     @   s>   d Z ddlmZ ddlZddlmZ dgZG dd deZdS )z#
An implementation of MutableAttr.
    )MappingN)MutableAttrAttrMapc                   @   sr   e Zd ZdZdefddZdd Z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 )r   z+
    An implementation of MutableAttr.
    Nc                 C   sH   |d u ri }n	t |tst|}| d| | d| | dd d S )N_sequence_type_mapping_allow_invalid_attributesF)
isinstancer   dict_setattr)selfitemssequence_type r   g/vol/project/2023/60021/g236002117/DeepSeek-Coder/venv/lib/python3.10/site-packages/attrdict/mapping.py__init__   s   
zAttrMap.__init__c                 C   s   | j S )z<
        The configuration for an attrmap instance.
        )r   r   r   r   r   _configuration   s   zAttrMap._configurationc                 C   s
   | j | S )z7
        Access a value associated with a key.
        r   r   keyr   r   r   __getitem__"      
zAttrMap.__getitem__c                 C   s   || j |< dS )z7
        Add a key-value pair to the instance.
        Nr   )r   r   valuer   r   r   __setitem__(   s   zAttrMap.__setitem__c                 C   s   | j |= dS )z)
        Delete a key-value pair
        Nr   r   r   r   r   __delitem__.   s   zAttrMap.__delitem__c                 C   
   t | jS )z2
        Check the length of the mapping.
        )lenr   r   r   r   r   __len__4   r   zAttrMap.__len__c                 C   r   )z,
        Iterated through the keys.
        )iterr   r   r   r   r   __iter__:   r   zAttrMap.__iter__c                 C   s   t djt| jdS )z?
        Return a string representation of the object.
        zAttrMap({mapping}))mapping)sixuformatreprr   r   r   r   r   __repr__@   s   zAttrMap.__repr__c                 C   s   | j | j| jfS )z'
        Serialize the object.
        )r   r   r   r   r   r   r   __getstate__I   s   zAttrMap.__getstate__c                 C   s2   |\}}}|  d| |  d| |  d| dS )z)
        Deserialize the object.
        r   r   r   N)r
   )r   stater    r   allow_invalid_attributesr   r   r   __setstate__S   s   
zAttrMap.__setstate__c                 C   s   | ||dS )z-
        A standardized constructor.
        )r   r   )clsr    configurationr   r   r   _constructor\   s   zAttrMap._constructor)__name__
__module____qualname____doc__tupler   r   r   r   r   r   r   r%   r&   r)   classmethodr,   r   r   r   r   r      s    
	
	)r0   collectionsr   r!   attrdict.mixinsr   __all__r   r   r   r   r   <module>   s    