o
    d                     @   s(   d d Z e Zdd ZG dd dZdS )c                 K   s   | |t di |dS )N)	operationlocationparams )dict)namer   kwargsr   r   P/var/www/html/visualizacion-main/env/lib/python3.10/site-packages/dash/_patch.py
_operation   s   r	   c                 C   s   t | tr	tdd S )Nz&a slice is not a valid index for patch)
isinstanceslice	TypeError)objr   r   r   validate_slice   s   
r   c                   @   s   e Zd ZdZd7d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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d+d, Zd-d. Zd/d0 Zd8d1d2Zd3d4 Zd5d6 ZdS )9Patchz
    Patch a callback output value

    Act like a proxy of the output prop value on the frontend.

    Supported prop types: Dictionaries and lists.
    Nc                 C   s>   |d ur|| _ n|r|j pg | _ |d ur|j| _d S g | _d S N	_location_operations)selfr   parentr   r   r   __init__   s   
zPatch.__init__c                 C   s   t | S r   )varsr   r   r   r   __getstate__!      zPatch.__getstate__c                 C   s   t | | d S r   )r   update)r   stater   r   r   __setstate__$   s   zPatch.__setstate__c                 C   s   t | t| j|g | dS )N)r   r   )r   r   r   r   itemr   r   r   __getitem__'   s   zPatch.__getitem__c                 C   s2   |dkrt |dkr| jS |dkr| jS | |S )Ntolistr   r   )AttributeErrorr   r   r    r   r   r   r   __getattr__+   s   
zPatch.__getattr__c                 C   s&   |dv r|| j |< d S | || d S )Nr   )__dict____setitem__r   keyvaluer   r   r   __setattr__5   s   zPatch.__setattr__c                 C   s   |  | d S r   )__delitem__r   r   r   r   __delattr__;      zPatch.__delattr__c                 C   s6   t | |tu r
d S | jtd| j|g |d d S )NAssignr(   )r   _noopr   appendr	   r   r&   r   r   r   r%   >   s   
zPatch.__setitem__c                 C   s&   t | | jtd| j|g  d S )NDelete)r   r   r0   r	   r   )r   r'   r   r   r   r*   K   s   zPatch.__delitem__c                 C   s8   t |ttfr| | tS | jtd| j|d tS )NAddr.   )	r
   listtupleextendr   r0   r	   r   r/   r   otherr   r   r   __iadd__O   s
   
zPatch.__iadd__c                 C      | j td| j|d tS )NSubr.   r   r0   r	   r   r/   r6   r   r   r   __isub__V      zPatch.__isub__c                 C   r9   )NMulr.   r;   r6   r   r   r   __imul__Z   r=   zPatch.__imul__c                 C   r9   )NDivr.   r;   r6   r   r   r   __itruediv__^   r=   zPatch.__itruediv__c                 C   s   | j |d tS )N)E)r   r/   r6   r   r   r   __ior__b   s   zPatch.__ior__c                 C      t d)Nz6Patch objects are write-only, you cannot iterate them.)r   r   r   r   r   __iter__f   r   zPatch.__iter__c                 C   s   d| j  dS )Nz!<write-only dash.Patch object at >)r   r   r   r   r   __repr__i   r,   zPatch.__repr__c                 C      | j td| j|d dS )z!Add the item to the end of a listAppendr.   Nr   r0   r	   r   r   r   r   r   r0   l      zPatch.appendc                 C   rH   )z#Add the item to the start of a listPrependr.   NrJ   r   r   r   r   prependp   rK   zPatch.prependc                 C   s   | j td| j||d dS )z#Add the item at the index of a listInsert)r(   indexNrJ   )r   rO   r   r   r   r   insertt   s   zPatch.insertc                 C      | j td| j dS )zRemove all items in a listClearNrJ   r   r   r   r   clearz      zPatch.clearc                 C   rQ   )z(Reversal of the order of items in a listReverseNrJ   r   r   r   r   reverse~   rT   zPatch.reversec                 C   s8   t |ttfst| d| jtd| j|d dS )z&Add all the items to the end of a listz should be a list or tupleExtendr.   N)r
   r3   r4   r   r   r0   r	   r   r   r   r   r   r5      s   zPatch.extendc                 C   rH   )z-filter the item out of a list on the frontendRemover.   NrJ   r   r   r   r   remove   rK   zPatch.removec                 K   s.   |pi }| | | jtd| j|d dS )z9Merge a dict or keyword arguments with another dictionaryMerger.   N)r   r   r0   r	   r   )r   rB   Fr(   r   r   r   r      s   
zPatch.updatec                 C   rD   )NzOsort is reserved for future use, use brackets to access this key on your object)KeyErrorr   r   r   r   sort   s   z
Patch.sortc                 C   s   d| j dS )N__dash_patch_update)r^   
operations)r   r   r   r   r   to_plotly_json   s   zPatch.to_plotly_json)NNr   )__name__
__module____qualname____doc__r   r   r   r    r#   r)   r+   r%   r*   r8   r<   r?   rA   rC   rE   rG   r0   rM   rP   rS   rV   r5   rY   r   r]   r`   r   r   r   r   r      s8    


r   N)r	   objectr/   r   r   r   r   r   r   <module>   s    