ó
æNXc           @  s†   d  Z  d d l m Z d d l m Z d d l m Z d d l m Z d d l	 m
 Z
 d e f d	 „  ƒ  YZ d
 e f d „  ƒ  YZ d S(   sò  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.
iÿÿÿÿ(   t   print_function(   t   Configurable(   t   io(   t   Listi   (   t   publish_display_datat   DisplayPublisherc           B  s5   e  Z d  Z d d „ Z d d d „ Z e d „ Z RS(   s¤   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.
    c         C  sW   t  | t ƒ s" t d | ƒ ‚ n  | d k	 rS t  | t ƒ sS t d | ƒ ‚ qS n  d S(   sÆ   Validate the display data.

        Parameters
        ----------
        data : dict
            The formata data dictionary.
        metadata : dict
            Any metadata for the data.
        s   data must be a dict, got: %rs    metadata must be a dict, got: %rN(   t
   isinstancet   dictt	   TypeErrort   None(   t   selft   datat   metadata(    (    sO   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/displaypub.pyt   _validate_data&   s
    c         C  s*   d | k r& t  | d d t j ƒn  d S(   sa  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.
        s
   text/plaint   fileN(   t   printR   t   stdout(   R
   R   R   t   source(    (    sO   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/displaypub.pyt   publish7   s    'c         C  sP   t  d d t j d d ƒt j j ƒ  t  d d t j d d ƒt j j ƒ  d S(   s.   Clear the output of the cell receiving output.s   [2KR   t   endt    N(   R   R   R   t   flusht   stderr(   R
   t   wait(    (    sO   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/displaypub.pyt   clear_outputa   s    N(   t   __name__t
   __module__t   __doc__R	   R   R   t   FalseR   (    (    (    sO   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/displaypub.pyR      s   *t   CapturingDisplayPublisherc           B  s2   e  Z d  Z e ƒ  Z d d d „ Z e d „ Z RS(   s   A DisplayPublisher that storesc         C  s   |  j  j | | f ƒ d  S(   N(   t   outputst   append(   R
   R   R   R   (    (    sO   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/displaypub.pyR   m   s    c         C  s!   t  t |  ƒ j | ƒ |  j 2d  S(   N(   t   superR   R   R   (   R
   R   (    (    sO   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/displaypub.pyR   p   s    N(	   R   R   R   R   R   R	   R   R   R   (    (    (    sO   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/displaypub.pyR   i   s   	N(   R   t
   __future__R    t   traitlets.config.configurableR   t   IPython.utilsR   t	   traitletsR   t   displayR   R   R   (    (    (    sO   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/displaypub.pyt   <module>   s   J