o
    éË·eÞ  ã                   @   s0   d Z ddlmZ ddlmZ G dd„ deƒZdS )zHPayload system for IPython.

Authors:

* Fernando Perez
* Brian Granger
é    )ÚConfigurable)ÚListc                   @   s.   e Zd Zeg ƒZd	dd„Zdd„ Zdd„ ZdS )
ÚPayloadManagerTc                 C   sr   t |tƒstd| ƒ‚|r1d|v r1|d }t| jƒD ]\}}d|v r0|d |kr0|| j|<  dS q| j |¡ dS )zÐInclude or update the specified `data` payload in the PayloadManager.

        If a previous payload with the same source exists and `single` is True,
        it will be overwritten with the new one.
        z*Each payload write must be a dict, got: %rÚsourceN)Ú
isinstanceÚdictÚ	TypeErrorÚ	enumerateÚ_payloadÚappend)ÚselfÚdataÚsingler   ÚiÚpl© r   úK/var/www/ideatree/venv/lib/python3.10/site-packages/IPython/core/payload.pyÚwrite_payload    s   

€zPayloadManager.write_payloadc                 C   s   | j S ©N©r
   ©r   r   r   r   Úread_payload3   s   zPayloadManager.read_payloadc                 C   s
   g | _ d S r   r   r   r   r   r   Úclear_payload6   s   
zPayloadManager.clear_payloadN)T)Ú__name__Ú
__module__Ú__qualname__r   r
   r   r   r   r   r   r   r   r      s
    
r   N)Ú__doc__Útraitlets.config.configurabler   Ú	traitletsr   r   r   r   r   r   Ú<module>   s   