+
    ^|i                         R t ^ RIt^ RIHt ^ RIHt ^RIHt ^RIH	t	 ^ RI
t]! 4       t ! R R]4      t ! R R	]4      tR# )
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                      a a ] tR t^$t oRtRV 3R lltRR ltR tR tR t	R]
3RRR	R
/V3R lR lllt]R 4       tRR ltRtVtV ;t# )DisplayPublisherzA 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                   < Wn         R V n        R V n        V P                   '       d   V P                  4        \        SV `  ! V/ VB  R# )FN)shell_is_publishing_in_post_execute_setup_execution_trackingsuper__init__)selfr
   argskwargs	__class__s   &&*,9/usr/lib/python3/dist-packages/IPython/core/displaypub.pyr   DisplayPublisher.__init__+   s?    
# %:::**,$)&)    c                    \        V\        4      '       g   \        RV,          4      hVe+   \        V\        4      '       g   \        RV,          4      hR# R# )zValidate 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-- BT IJJ .  r   c                    V P                   P                  P                  RV P                  4       V P                   P                  P                  RV P                  4       R# )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    

"">43H3HI

""=$2F2FGr   c                    RV n         R# )z%Called at start of post_execute phaseTNr   r&   s   &r   r$   !DisplayPublisher._on_post_executeI   s
     $r   c                    RV n         R# )z$Called at start of pre_execute phaseFNr)   r&   s   &r   r%    DisplayPublisher._on_pre_executeM   s
     %r   	transientupdateFc                   < V ^8  d   QhRR/# )   returnN )format__classdict__s   "r   __annotate__DisplayPublisher.__annotate__R   s     X$ X$ 
X$r   c                  V\         Jd   ^ RIpVP                  R\        ^R7       / pV P                  e   \        V P                  R/ 4      pV P                  P                  P                  p	V P                  P                  ^,
          p
V P                  '       d   V P                  P                  ^,
          p
W,          P                  \        RVR7      4       VP                  4        F-  w  rW9   g   K  V! W,          VP                  VR4      4        R# 	  RV n        RV9   d   \        VR,          4       R	V n        R# )
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.
NzThe '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_renderersdisplay_data)output_typebundleTz
text/plainF)	_sentinelwarningswarnDeprecationWarningr
   getattrhistory_manageroutputsexecution_countr   appendr   itemsgetr   print)r   r   r   sourcer-   r.   r   r>   handlersrC   target_execution_countmimehandlers   &&&&$$,      r   publishDisplayPublisher.publishR   s   l "MMi"	   ::!tzz+;R@H**,,44!%!;!;a!?    &*ZZ%?%?!%C"'..nTB	
 &^^-MD|
HLLt$<= .
 #4$|$%#r   c                    V P                   # N)r   r&   s   &r   is_publishingDisplayPublisher.is_publishing   s    """r   c                    \        RRR7       \        P                  P                  4        \        RRR7       \        P                  P                  4        R# )z.Clear the output of the cell receiving output.z[2K )endN)rH   sysstdoutflushstderr)r   waits   &&r   clear_outputDisplayPublisher.clear_output   s6    kr"

kr"

r   )r   r   r
   rQ   F)__name__
__module____qualname____firstlineno____doc__r   r   r   r$   r%   r=   rN   propertyrR   r\   __static_attributes____classdictcell____classcell__r   r4   s   @@r   r   r   $   sn     *K"H
%& 	X$ X$ X$ X$t # # r   r   c                   j   a a ] tR t^t oRt]! 4       tR
RRRR/R lltRV 3R lltV3R lt	R	t
VtV ;t# )CapturingDisplayPublisherzA DisplayPublisher that storesNr-   r.   Fc          
     L    V P                   P                  R VRVRVRV/4       R# )r   r   r-   r.   N)rC   rE   )r   r   r   rI   r-   r.   s   &&&&$$r   rN   !CapturingDisplayPublisher.publish   s/     	HY&		
r   c                b   < \         \        V `  V4       V P                  P	                  4        R # rQ   )r   rj   r\   rC   clear)r   r[   r   s   &&r   r\   &CapturingDisplayPublisher.clear_output   s%    ';DA 	r   c                &   < V ^8  d   Qh/ S[ ;R&   # )r0   rC   r   )r3   r4   s   "r   r5   &CapturingDisplayPublisher.__annotate__   s       r   r2   )NNr^   )r_   r`   ra   rb   rc   r   rC   rN   r\   __annotate_func__re   rf   rg   rh   s   @@r   rj   rj      s0     (FG

=A

JO

#  r   rj   )rc   rW   traitlets.config.configurabler   	traitletsr   display_functionsr   historyr   typingtobjectr=   r   rj   r2   r   r   <module>rz      sE   "  6  4 "  H	Q| Qh 0 r   