ó
    Ñ]jË  ã                   ó‚   • S r SSKrSSKJr  SSKJr  SSKJr  SSKJ	r	  SSK
r\" 5       r " S S	\5      r " S
 S\5      rg)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_data)ÚHistoryOutputc                   ó„   ^ • \ rS rSrSrSU 4S jjrSS jrS rS rS r	S\
4SS	S
. SS jjjr\S 5       rSS jrSrU =r$ )ÚDisplayPublisheré$   z˜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                 ó�   >• Xl         SU l        SU l        U R                   (       a  U R                  5         [        TU ]  " U0 UD6  g )NF)ÚshellÚ_is_publishingÚ_in_post_executeÚ_setup_execution_trackingÚsuperÚ__init__)Úselfr   ÚargsÚkwargsÚ	__class__s       €ÚT/home/mande/repo/quber/.venv/lib/python3.13/site-packages/IPython/core/displaypub.pyr   ÚDisplayPublisher.__init__+   s=   ø€ ØŒ
Ø#ˆÔØ %ˆÔØ�:�:Ø×*Ñ*Ô,Ü‰Ò˜$Ð) &Ó)ó    c                 ó˜   • [        U[        5      (       d  [        SU-  5      eUb$  [        U[        5      (       d  [        SU-  5      egg)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_dataÚDisplayPublisher._validate_data3   sP   € ô ˜$¤×%Ñ%ÜÐ:¸TÑAÓBÐBØÑÜ˜h¬×-Ñ-ÜÐ BÀTÑ IÓJÐJð .ð  r   c                 óÄ   • U R                   R                  R                  SU R                  5        U R                   R                  R                  SU R                  5        g)z%Set up hooks to track execution stateÚpost_executeÚpre_executeN)r   ÚeventsÚregisterÚ_on_post_executeÚ_on_pre_execute©r   s    r   r   Ú*DisplayPublisher._setup_execution_trackingD   sB   € à�
‰
×Ñ×"Ñ" >°4×3HÑ3HÔIØ�
‰
×Ñ×"Ñ" =°$×2FÑ2FÕGr   c                 ó   • SU l         g)z%Called at start of post_execute phaseTN©r   r(   s    r   r&   Ú!DisplayPublisher._on_post_executeI   s
   € à $ˆÕr   c                 ó   • SU l         g)z$Called at start of pre_execute phaseFNr+   r(   s    r   r'   Ú DisplayPublisher._on_pre_executeM   s
   € à %ˆÕr   F©Ú	transientÚupdatec                óJ  • U[         La  SSKnUR                  S[        SS9  0 nU R                  b  [        U R                  S0 5      nU R                  R                  R                  n	U R                  R                  S-
  n
U R                  (       a  U R                  R                  S-
  n
Xš   R                  [        SUS	95        UR                  5        H'  u  p¼X±;   d  M  U" X   UR                  US5      5          g   S
U l        SU;   a  [        US   5        SU l        g)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.
r   Nz¡The 'source' parameter is deprecated since IPython 3.0 and will be ignored (this warning is present since 9.0). `source` parameter will be removed in the future.é   )Ú
stacklevelÚmime_renderersr   Údisplay_data)Úoutput_typeÚbundleTz
text/plainF)Ú	_sentinelÚwarningsÚwarnÚDeprecationWarningr   ÚgetattrÚhistory_managerÚoutputsÚexecution_countr   Úappendr   ÚitemsÚgetr   Úprint)r   r   r   Úsourcer0   r1   r   r:   Úhandlersr?   Útarget_execution_countÚmimeÚhandlers                r   ÚpublishÚDisplayPublisher.publishR   s  € ðl œÒ"Ûà�M‰Mðiä"Øð	 ñ ð ˆØ�:‰:Ñ!Ü˜tŸz™zÐ+;¸RÓ@ˆHà—*‘*×,Ñ,×4Ñ4ˆà!%§¡×!;Ñ!;¸aÑ!?ÐØ× × ð &*§Z¡Z×%?Ñ%?À!Ñ%CÐ"àÑ'×.Ñ.Ü n¸TÑBô	
ð &Ÿ^™^Ö-‰MˆDØ�|Ù˜™
 H§L¡L°°tÓ$<Ô=Ùñ .ð
 #ˆÔØ˜4ÓÜ�$�|Ñ$Ô%Ø#ˆÕr   c                 ó   • U R                   $ ©N)r   r(   s    r   Úis_publishingÚDisplayPublisher.is_publishing¬   s   € à×"Ñ"Ð"r   c                 ó¤   • [        SSS9  [        R                  R                  5         [        SSS9  [        R                  R                  5         g)z.Clear the output of the cell receiving output.z[2KÚ )ÚendN)rD   ÚsysÚstdoutÚflushÚstderr)r   Úwaits     r   Úclear_outputÚDisplayPublisher.clear_output°   s6   € äˆk˜rÒ"Ü�
‰
×ÑÔÜˆk˜rÒ"Ü�
‰
×ÑÕr   )r   r   r   rM   )ÚreturnN©F)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r   r   r&   r'   r9   rJ   ÚpropertyrN   rX   Ú__static_attributes__Ú__classcell__©r   s   @r   r	   r	   $   si   ø† ñ÷*ôKò"Hò
%ò&ð Øð	X$ð ØñX$ð 
öX$ðt ñ#ó ð#÷ò r   r	   c                   ó`   ^ • \ rS rSr% Sr\" 5       r\\S'    S
SSS.S jjrSU 4S jjr	S	r
U =r$ )ÚCapturingDisplayPublisheré¸   zA DisplayPublisher that storesr?   NFr/   c                óD   • U R                   R                  UUUUS.5        g )N)r   r   r0   r1   )r?   rA   )r   r   r   rE   r0   r1   s         r   rJ   Ú!CapturingDisplayPublisher.publish½   s'   € ð 	�‰×ÑàØ$Ø&Ø ñ	õ	
r   c                 ó`   >• [         [        U ]  U5        U R                  R	                  5         g rM   )r   rf   rX   r?   Úclear)r   rW   r   s     €r   rX   Ú&CapturingDisplayPublisher.clear_outputÉ   s%   ø€ ÜÔ'¨Ñ;¸DÔAð 	�‰×ÑÕr   © )NNr[   )r\   r]   r^   r_   r`   r   r?   Ú__annotations__rJ   rX   rb   rc   rd   s   @r   rf   rf   ¸   s0   ø‡ Ù(á“F€GˆTÓð +/ð

Ø=AÈ%ö

÷õ r   rf   )r`   rS   Útraitlets.config.configurabler   Ú	traitletsr   Údisplay_functionsr   Úhistoryr   ÚtypingÚtÚobjectr9   r	   rf   rm   r   r   Ú<module>rv      sE   ðñó" å 6Ý õ 4Ý "ã ñ ‹H€	ôQ�|ô QôhÐ 0õ r   