§
    �ŸjP  ã                   ón   — d Z ddlZddlmZ ddlmZ ddlmZ  G d„ de¦  «        Z G d	„ d
e¦  «        Z	dS )aò  An interface for publishing rich data to frontends.

There are two components of the display system:

* Display formatters, which take a Python object and compute the
  representation of the object in various formats (text, HTML, SVG, etc.).
* The display publisher that is used to send the representation data to the
  various frontends.

This module defines the logic display publishing. The display publisher uses
the ``display_data`` message type that is defined in the IPython messaging
spec.
é    N)ÚConfigurable)ÚListé   )Úpublish_display_datac                   óF   ‡ — e Zd ZdZd
ˆ fd„	Zd
d„Zddddœdd„Zdd	„Zˆ xZS )ÚDisplayPublisherz¤A traited class that publishes display data to frontends.

    Instances of this class are created by the main IPython object and should
    be accessed there.
    Nc                 óH   •— || _          t          ¦   «         j        |i |¤Ž d S ©N)ÚshellÚsuperÚ__init__)Úselfr   ÚargsÚkwargsÚ	__class__s       €úd/var/www/finuniver-perm.ru/html/student/venv/lib/python3.11/site-packages/IPython/core/displaypub.pyr   zDisplayPublisher.__init__'   s,   ø€ ØˆŒ
Ø�‰ŒÔ˜$Ð) &Ð)Ð)Ð)Ð)Ð)ó    c                 óª   — t          |t          ¦  «        st          d|z  ¦  «        ‚|�'t          |t          ¦  «        st          d|z  ¦  «        ‚dS dS )zÆValidate the display data.

        Parameters
        ----------
        data : dict
            The formata data dictionary.
        metadata : dict
            Any metadata for the data.
        zdata must be a dict, got: %rNz metadata must be a dict, got: %r)Ú
isinstanceÚdictÚ	TypeError)r   ÚdataÚmetadatas      r   Ú_validate_datazDisplayPublisher._validate_data+   sl   € õ ˜$¥Ñ%Ô%ð 	CÝÐ:¸TÑAÑBÔBÐBØÐÝ˜h­Ñ-Ô-ð KÝÐ BÀTÑ IÑJÔJÐJð  ÐðKð Kr   F©Ú	transientÚupdateÚreturnc                ó  — i }| j         �t          | j         di ¦  «        }|                     ¦   «         D ]2\  }}	||v r) |	||         |                     |d¦  «        ¦  «          dS Œ3d|v rt	          |d         ¦  «         dS dS )aê  Publish data and metadata to all frontends.

        See the ``display_data`` message in the messaging documentation for
        more details about this message type.

        The following MIME types are currently implemented:

        * text/plain
        * text/html
        * text/markdown
        * text/latex
        * application/json
        * application/javascript
        * image/png
        * image/jpeg
        * image/svg+xml

        Parameters
        ----------
        data : dict
            A dictionary having keys that are valid MIME types (like
            'text/plain' or 'image/svg+xml') and values that are the data for
            that MIME type. The data itself must be a JSON'able data
            structure. Minimally all data should have the 'text/plain' data,
            which can be displayed by all frontends. If more than the plain
            text is given, it is up to the frontend to decide which
            representation to use.
        metadata : dict
            A dictionary for metadata related to the data. This can contain
            arbitrary key, value pairs that frontends can use to interpret
            the data.  Metadata specific to each mime-type can be specified
            in the metadata dict with the same mime-type keys as
            the data itself.
        source : str, deprecated
            Unused.
        transient : dict, keyword-only
            A dictionary for transient data.
            Data in this dictionary should not be persisted as part of saving this output.
            Examples include 'display_id'.
        update : bool, keyword-only, default: False
            If True, only update existing outputs with the same display_id,
            rather than creating a new output.
        NÚmime_renderersz
text/plain)r   ÚgetattrÚitemsÚgetÚprint)
r   r   r   Úsourcer   r   r   ÚhandlersÚmimeÚhandlers
             r   ÚpublishzDisplayPublisher.publish=   sª   € ðZ ˆØŒ:Ð!Ý˜tœzÐ+;¸RÑ@Ô@ˆHà%Ÿ^š^Ñ-Ô-ð 	ð 	‰MˆD�'Ø�tˆ|ˆ|Ø�˜˜Tœ
 H§L¢L°°tÑ$<Ô$<Ñ=Ô=Ð=Ø��ð ð ˜4ÐÐÝ�$�|Ô$Ñ%Ô%Ð%Ð%Ð%ð  Ðr   c                 óÂ   — t          dd¬¦  «         t          j                             ¦   «          t          dd¬¦  «         t          j                             ¦   «          dS )z.Clear the output of the cell receiving output.z[2KÚ )ÚendN)r$   ÚsysÚstdoutÚflushÚstderr)r   Úwaits     r   Úclear_outputzDisplayPublisher.clear_outputv   sV   € åˆk˜rÐ"Ñ"Ô"Ð"ÝŒ
×ÒÑÔÐÝˆk˜rÐ"Ñ"Ô"Ð"ÝŒ
×ÒÑÔÐÐÐr   r
   ©NN)r   N©F)	Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r)   r2   Ú__classcell__©r   s   @r   r   r       sœ   ø€ € € € € ðð ð*ð *ð *ð *ð *ð *ðKð Kð Kð Kð$7&ÀTÐRWð 7&ð 7&ð 7&ð 7&ð 7&ð 7&ðrð ð ð ð ð ð ð r   r   c                   óH   ‡ — e Zd ZdZ e¦   «         Zddddœd„Zdˆ fd„	Zˆ xZS )	ÚCapturingDisplayPublisherzA DisplayPublisher that storesNFr   c                óD   — | j                              ||||dœ¦  «         d S )N)r   r   r   r   )ÚoutputsÚappend)r   r   r   r%   r   r   s         r   r)   z!CapturingDisplayPublisher.publish‚   s@   € ØŒ×Ò D°XØ)2¸VðEð Eñ 	Fô 	Fð 	Fð 	Fð 	Fr   c                 óŠ   •— t          t          | ¦  «                             |¦  «         | j                             ¦   «          d S r
   )r   r<   r2   r>   Úclear)r   r1   r   s     €r   r2   z&CapturingDisplayPublisher.clear_output†   s>   ø€ ÝÕ'¨Ñ.Ô.×;Ò;¸DÑAÔAÐAð 	Œ×ÒÑÔÐÐÐr   r3   r4   )	r5   r6   r7   r8   r   r>   r)   r2   r9   r:   s   @r   r<   r<   ~   sw   ø€ € € € € Ø(Ð(Øˆd‰fŒf€GðFÀTÐRWð Fð Fð Fð Fð Fðð ð ð ð ð ð ð ð ð r   r<   )
r8   r-   Útraitlets.config.configurabler   Ú	traitletsr   Údisplay_functionsr   r   r<   © r   r   ú<module>rF      sº   ððð ð$ €
€
€
à 6Ð 6Ð 6Ð 6Ð 6Ð 6Ø Ð Ð Ð Ð Ð ð 4Ð 3Ð 3Ð 3Ð 3Ð 3ð[ð [ð [ð [ð [�|ñ [ô [ð [ð|ð ð ð ð Ð 0ñ ô ð ð ð r   