403Webshell
Server IP : 35.80.110.71  /  Your IP : 216.73.216.170
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux ip-172-31-21-44 6.17.0-1019-aws #19~24.04.1-Ubuntu SMP Tue Jun 23 18:53:06 UTC 2026 x86_64
User : ubuntu ( 1000)
PHP Version : 8.3.31
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/IPython/core/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/IPython/core/__pycache__/display.cpython-312.pyc
�

}�e����dZddlmZmZddlZddlZddlZddlZddlZddl	Z	ddl
mZddlm
Z
ddlmZmZddlmZddlmZd	d
lmZgd�Zgd�ZeezZdd
l	mZd�Zd�ZdAd�Zd�Zd�Zd�Zd�Z d�Z!d�Z"d�Z#d�Z$d�Z%d�Z&Gd�de'�Z(Gd�de(�Z)Gd�d e)�Z*Gd!�d"e)�Z+Gd#�d$e)�Z,Gd%�d&e)�Z-Gd'�d(e)�Z.Gd)�d*e(�Z/Gd+�d,e(�Z0Gd-�d.e(�Z1d/Z2d0Z3d1Z4Gd2�d3e1�Z5Gd4�d5e)�Z6d6Z7d7Z8d8�Z9d9�Z:d:�Z;Gd;�d<e(�Z<Gd=�d>e(�Z=ed?��Z>edBd@��Z?y)CzGTop-level display functions for displaying object in different formats.�)�
b2a_base64�hexlifyN)�deepcopy)�splitext)�Path�PurePath)�cast_unicode)�skip_doctest�)�display_functions)�display_pretty�display_html�display_markdown�display_svg�display_png�display_jpeg�
display_latex�display_json�display_javascript�display_pdf�
DisplayObject�TextDisplayObject�Pretty�HTML�Markdown�Math�Latex�SVG�ProgressBar�JSON�GeoJSON�
Javascript�Image�set_matplotlib_formats�set_matplotlib_close�Video)�display�clear_output�publish_display_data�update_display�
DisplayHandle)�warnc���|tvr&td|�d�td��tt|�S|t�j
�vr
t�|Stdt�d|����)Nz
Importing z_ from IPython.core.display is deprecated since IPython 7.14, please import from IPython display���
stacklevelzmodule z has no attribute )	�_deprecated_namesr,�DeprecationWarning�getattrr�globals�keys�AttributeError�__name__)�names �6/usr/lib/python3/dist-packages/IPython/core/display.py�__getattr__r:*sr��� � ��z�$��~�
�BT�ab�	c��(�$�/�/��w�y�~�~����y�����w�x�j�0B�4�&�I�J�J�c�`�	tjj|�S#t$rYywxYw)z*Check path, but don't let exceptions raiseF)�os�path�exists�	Exception)r>s r9�_safe_existsrA9s,����w�w�~�~�d�#�#������s�!�	-�-c�p�|r||i}|r|D�cgc]}||i��}}tj||||gd��ycc}w)a�internal implementation of all display_foo methods

    Parameters
    ----------
    mimetype : str
        The mimetype to be published (e.g. 'image/png')
    *objs : object
        The Python objects to display, or if raw=True raw text data to
        display.
    raw : bool
        Are the data objects raw data or Python objects that need to be
        formatted before display? [default: False]
    metadata : dict (optional)
        Metadata to be associated with the specific mimetype output.
    )�raw�metadata�includeN)rr')�mimetype�objsrCrD�objs     r9�_display_mimetyperIAsF�� ��h�'��
�,0�2�S�(�C��2��2����t��x�(��T��3s�3c��td|fi|��y)a�Display the pretty (default) representation of an object.

    Parameters
    ----------
    *objs : object
        The Python objects to display, or if raw=True raw text data to
        display.
    raw : bool
        Are the data objects raw data or Python objects that need to be
        formatted before display? [default: False]
    metadata : dict (optional)
        Metadata to be associated with the specific mimetype output.
    �
text/plainN�rI�rG�kwargss  r9r
r
]����l�D�3�F�3r;c��td|fi|��y)aDisplay the HTML representation of an object.

    Note: If raw=False and the object does not have a HTML
    representation, no HTML will be shown.

    Parameters
    ----------
    *objs : object
        The Python objects to display, or if raw=True raw HTML data to
        display.
    raw : bool
        Are the data objects raw data or Python objects that need to be
        formatted before display? [default: False]
    metadata : dict (optional)
        Metadata to be associated with the specific mimetype output.
    �	text/htmlNrLrMs  r9rrns��"�k�4�2�6�2r;c��td|fi|��y)a�Displays the Markdown representation of an object.

    Parameters
    ----------
    *objs : object
        The Python objects to display, or if raw=True raw markdown data to
        display.
    raw : bool
        Are the data objects raw data or Python objects that need to be
        formatted before display? [default: False]
    metadata : dict (optional)
        Metadata to be associated with the specific mimetype output.
    z
text/markdownNrLrMs  r9rr�s���o�t�6�v�6r;c��td|fi|��y)a�Display the SVG representation of an object.

    Parameters
    ----------
    *objs : object
        The Python objects to display, or if raw=True raw svg data to
        display.
    raw : bool
        Are the data objects raw data or Python objects that need to be
        formatted before display? [default: False]
    metadata : dict (optional)
        Metadata to be associated with the specific mimetype output.
    z
image/svg+xmlNrLrMs  r9rr�s���o�t�6�v�6r;c��td|fi|��y)a�Display the PNG representation of an object.

    Parameters
    ----------
    *objs : object
        The Python objects to display, or if raw=True raw png data to
        display.
    raw : bool
        Are the data objects raw data or Python objects that need to be
        formatted before display? [default: False]
    metadata : dict (optional)
        Metadata to be associated with the specific mimetype output.
    �	image/pngNrLrMs  r9rr�s���k�4�2�6�2r;c��td|fi|��y)a�Display the JPEG representation of an object.

    Parameters
    ----------
    *objs : object
        The Python objects to display, or if raw=True raw JPEG data to
        display.
    raw : bool
        Are the data objects raw data or Python objects that need to be
        formatted before display? [default: False]
    metadata : dict (optional)
        Metadata to be associated with the specific mimetype output.
    �
image/jpegNrLrMs  r9rr�rOr;c��td|fi|��y)a�Display the LaTeX representation of an object.

    Parameters
    ----------
    *objs : object
        The Python objects to display, or if raw=True raw latex data to
        display.
    raw : bool
        Are the data objects raw data or Python objects that need to be
        formatted before display? [default: False]
    metadata : dict (optional)
        Metadata to be associated with the specific mimetype output.
    z
text/latexNrLrMs  r9rr�rOr;c��td|fi|��y)a�Display the JSON representation of an object.

    Note that not many frontends support displaying JSON.

    Parameters
    ----------
    *objs : object
        The Python objects to display, or if raw=True raw json data to
        display.
    raw : bool
        Are the data objects raw data or Python objects that need to be
        formatted before display? [default: False]
    metadata : dict (optional)
        Metadata to be associated with the specific mimetype output.
    zapplication/jsonNrLrMs  r9rr�s�� �(�$�9�&�9r;c��td|fi|��y)a�Display the Javascript representation of an object.

    Parameters
    ----------
    *objs : object
        The Python objects to display, or if raw=True raw javascript data to
        display.
    raw : bool
        Are the data objects raw data or Python objects that need to be
        formatted before display? [default: False]
    metadata : dict (optional)
        Metadata to be associated with the specific mimetype output.
    zapplication/javascriptNrLrMs  r9rr�s���.��?��?r;c��td|fi|��y)a�Display the PDF representation of an object.

    Parameters
    ----------
    *objs : object
        The Python objects to display, or if raw=True raw javascript data to
        display.
    raw : bool
        Are the data objects raw data or Python objects that need to be
        formatted before display? [default: False]
    metadata : dict (optional)
        Metadata to be associated with the specific mimetype output.
    zapplication/pdfNrLrMs  r9rr�s���'��8��8r;c�H��eZdZdZdZdZdZd
d�Z�fd�Zd�Z	d�Z
d	�Z�xZS)rz*An object that wraps data to be displayed.�rFNc�h�t|ttf�rt|�}|�=t|t�r-|j	d�r	|�|}d}d}nt|�r|�d}|}d}||_||_||_|�||_	n|j�i|_	|j�|j�y)a1Create a display object given raw data.

        When this object is returned by an expression or passed to the
        display function, it will result in the data being displayed
        in the frontend. The MIME type of the data should match the
        subclasses used, so the Png subclass should be used for 'image/png'
        data. If the data is a URL, the data will first be downloaded
        and then displayed.

        Parameters
        ----------
        data : unicode, str or bytes
            The raw data or a URL or file to load the data from
        url : unicode
            A URL to download the data from.
        filename : unicode
            Path to a local file to load the data from.
        metadata : dict
            Dict of metadata associated to be the object when displayed
        N�http)�
isinstancerr�str�
startswithrA�url�filename�datarD�reload�_check_data)�selfrercrdrDs     r9�__init__zDisplayObject.__init__s���*�d�T�8�,�-��t�9�D���
�4�� 5����v�&�3�;��������d�#��(8���������� ��
���	���$�D�M�
�]�]�
"��D�M����
����r;c���|js+|j}d|j�d|j�d�}|Stt
|��}|S)N�<�.z object>)�_show_mem_addr�	__class__�
__module__r7�superr�__repr__)rh�clsr]rns   �r9rqzDisplayObject.__repr__JsD����"�"��.�.�C�$'�N�N�C�L�L�A�A����m�T�3�5�A��r;c��y)z5Override in subclasses if there's something to check.N��rhs r9rgzDisplayObject._check_dataR���r;c�t�|jr!|jt|j�fS|jS)�Bshortcut for returning metadata with shape information, if defined)rDrerrus r9�_data_and_metadataz DisplayObject._data_and_metadataVs+���=�=��9�9�h�t�}�}�5�5�5��9�9�r;c�T�|j�Sd|jvrdnd}t|j|j|��5}|j�|_ddd�y|j
��$ddlm}||j
�}|j�}d}d|jvrh|jdjd�D]G}|j�}|jd	�s�%|jd
�dj�}nd|jvrTd
|jdvrCddl}ddl
m}|j||�d|xsd��5}	d}|	j�}ddd�|r|j|d�|_y||_yy#1swYyxYw#1swY�8xYw)�%Reload the raw data from file or URL.N�bzutf-8)�encodingr)�urlopenzcontent-type�;�charset�=���zcontent-encoding�gzip)�BytesIO�rt�replace)rd�_read_flags�open�readrerc�urllib.requestr~�headers�split�striprbr��ior��decode)
rhr}�fr~�responsere�subr�r��fps
          r9rfzDisplayObject.reload]s����=�=�$�"�d�&6�&6�6�t�G�H��d�m�m�T�%5�%5��I�
%�Q��F�F�H��	�
%�
%�
�X�X�
!�.��t�x�x�(�H��=�=�?�D��H���!1�!1�1�#�+�+�N�;�A�A�#�F��C��)�)�+�C��~�~�i�0�#&�9�9�S�>�"�#5�#;�#;�#=���	�
"�X�%5�%5�5��X�-�-�.@�A�A��*������
�t�h�6I�'�#��)��#'��!�w�w�y��	)�� �K�K��)�<��	� ��	�C"�
%�
%��,)�)�s�F�F�F�F'�NNNN)
r7ro�__qualname__�__doc__r�rmrDrirqrgryrf�
__classcell__�rns@r9rrs/���4��K��N��H�/�b�
��'!r;rc��eZdZdZd�Zy)ra�Create a text display object given raw data.

    Parameters
    ----------
    data : str or unicode
        The raw data or a URL or file to load the data from.
    url : unicode
        A URL to download the data from.
    filename : unicode
        Path to a local file to load the data from.
    metadata : dict
        Dict of metadata associated to be the object when displayed
    c��|j�It|jt�s.t|jj
�d|j����yy)Nz expects text, not )rer`ra�	TypeErrorrnr7rus r9rgzTextDisplayObject._check_data�sC���9�9� ��D�I�I�s�)C�����9P�9P�RV�R[�R[�\�]�]�*D� r;N)r7ror�r�rgrtr;r9rr�s
���^r;rc��eZdZd�Zy)rc�8�|j|j�S�N)�textre)rh�pp�cycles   r9�
_repr_pretty_zPretty._repr_pretty_�s���w�w�t�y�y�!�!r;N)r7ror�r�rtr;r9rr�s��"r;rc�,��eZdZd�fd�	Zd�Zd�Z�xZS)rc�x����fd�}|�rtjd�tt|��|||��y)Nc����sy�ddj�}�ddj�}|jd�xr|jd�S)NF�
i����z<iframe z	</iframe>)�lowerrb�endswith)�prefix�suffixres  �r9r,zHTML.__init__.<locals>.warn�sP������#�2�Y�_�_�&�F��#�$�Z�%�%�'�F��$�$�Z�0�Q�V�_�_�[�5Q�Qr;z-Consider using IPython.display.IFrame instead�rercrdrD)�warningsr,rprri)rhrercrdrDr,rns `    �r9riz
HTML.__init__�s6���
	R��6��M�M�I�J�
�d�D�"��#��S[�"�\r;c�"�|j�Sr��ryrus r9�_repr_html_zHTML._repr_html_�����&�&�(�(r;c�"�|j�S)z�
        This method exists to inform other HTML-using modules (e.g. Markupsafe,
        htmltag, etc) that this object is HTML and does not need things like
        special characters (<>&) escaped.
        )r�rus r9�__html__z
HTML.__html__�s�����!�!r;r�)r7ror�rir�r�r�r�s@r9rr�s���]�")�"r;rc��eZdZd�Zy)rc�"�|j�Sr�r�rus r9�_repr_markdown_zMarkdown._repr_markdown_�r�r;N)r7ror�r�rtr;r9rr����)r;rc��eZdZd�Zy)rc��d|jjd�z}|jr|t|j�fS|S)Nz$\displaystyle %s$�$)rer�rDr)rh�ss  r9�_repr_latex_zMath._repr_latex_�s9��!�D�I�I�O�O�C�$8�8���=�=��h�t�}�}�-�-�-��Hr;N�r7ror�r�rtr;r9rr�s��r;rc��eZdZd�Zy)rc�"�|j�Sr�r�rus r9r�zLatex._repr_latex_�r�r;Nr�rtr;r9rr�r�r;rc�R�eZdZdZdZdZed��Zejd��Zd�Z	y)rz�Embed an SVG into the display.

    Note if you just want to view a svg image via a URL use `:class:Image` with
    a url=URL keyword argument.
    �rbNc��|jSr���_datarus r9rezSVG.data�����z�z�r;c��|�d|_yddlm}|j|�}|j	d�}|r|dj�}n	t
|�}||_y)Nr)�minidom�svg)r��xml.domr��parseString�getElementsByTagName�toxmlr	)rhr�r��x�	found_svgs     r9rezSVG.data�s_���;��D�J��#�����$���*�*�5�1�	���A�,�$�$�&�C�
��3�����
r;c�"�|j�Sr�r�rus r9�
_repr_svg_zSVG._repr_svg_�r�r;)
r7ror�r�r�r��propertyre�setterr�rtr;r9rr�sD����K�
�E�
����
�[�[����$)r;rc�n�eZdZdZd�Zd�Zd�Zd�Zd�Ze	d��Z
e
jd��Z
d	�Zd
�Z
y)rz?Progressbar supports displaying a progressbar like element
    c��||_d|_d|_d|_t	tjd��jd�|_y)z�Creates a new progressbar

        Parameters
        ----------
        total : int
            maximum size of the progressbar
        r�60ex�<��asciiN)	�total�	_progress�
html_width�
text_widthrr=�urandomr��_display_id)rhr�s  r9rizProgressBar.__init__�s@����
���� ������"�2�:�:�a�=�1�8�8��A��r;c���|j|jz}dt||jz�z}d|jt	|�z
z}dj|||j|j�S)Nr�� z[{}{}] {}/{})�progressr��intr��len�format)rh�fraction�filled�rests    r9rqzProgressBar.__repr__sh���=�=�4�:�:�-���s�8�d�o�o�5�6�6���d�o�o��F��3�4���$�$��D��M�M�4�:�:�
�	
r;c�d�dj|j|j|j�S)Nz:<progress style='width:{}' max='{}' value='{}'></progress>)r�r�r�r�rus r9r�zProgressBar._repr_html_s(��K�R�R��O�O�T�Z�Z����8�	8r;c�F�tj||j��y)N)�
display_id�rr'r�rus r9r'zProgressBar.displays���!�!�$�4�3C�3C�Dr;c�H�tj||jd��y)NT)r��updater�rus r9r�zProgressBar.updates���!�!�$�4�3C�3C�D�Qr;c��|jSr�)r�rus r9r�zProgressBar.progresss���~�~�r;c�2�||_|j�yr�)r�r�)rh�values  r9r�zProgressBar.progress"s��������
r;c�4�|j�d|_|S)Nr�)r'r�rus r9�__iter__zProgressBar.__iter__'s����������r;c��|xjdz
c_|j|jkr|jSt��)z4Returns current value and increments display by one.r)r�r��
StopIterationrus r9�__next__zProgressBar.__next__,s2���
�
���
��=�=�4�:�:�%��=�=� ��/�!r;N)r7ror�r�rirqr�r'r�r�r�r�r�r�rtr;r9rr�sY���B�
�8�E�R������_�_�����
"r;rc�n��eZdZdZdZd	�fd�	Zd�Zed��Zejd��Zd�Z
d�Z�xZS)
r z�JSON expects a JSON-able dict or list

    not an already-serialized JSON string.

    Scalar types (None, number, string) are not allowed, only dict or list containers.
    Nc���||d�|_|r|jj|�|r|jj|�tt|�|||��y)a�Create a JSON display object given raw data.

        Parameters
        ----------
        data : dict or list
            JSON data to display. Not an already-serialized JSON string.
            Scalar types (None, number, string) are not allowed, only dict
            or list containers.
        url : unicode
            A URL to download the data from.
        filename : unicode
            Path to a local file to load the data from.
        expanded : boolean
            Metadata to control whether a JSON display component is expanded.
        metadata : dict
            Specify extra metadata to attach to the json display object.
        root : str
            The name of the root element of the JSON tree
        )�expanded�root�rercrdN)rDr�rpr ri)	rhrercrdr�rDr�rNrns	        �r9riz
JSON.__init__=sV���*!��
��
���M�M� � ��*���M�M� � ��(�
�d�D�"��#��"�Ir;c��|j�Ot|jttf�s.t	|j
j�d|j����yy)Nz$ expects JSONable dict or list, not )rer`�dict�listr�rnr7rus r9rgzJSON._check_data[sG���9�9� ��D�I�I��d�|�)L��$�.�.�Ja�Ja�cg�cl�cl�m�n�n�*M� r;c��|jSr�r�rus r9rez	JSON.data_r�r;c��t|ttf�rt|�}t|t�rB|j�!|j
�t
jd�tj|�}||_
y)Nz4JSON expects JSONable dict or list, not JSON strings)r`rrrardrcr�r,�json�loadsr�)rhres  r9rez	JSON.datacsY���d�T�8�,�-��t�9�D��d�C� ��}�}�$����)9��
�
�T�U��:�:�d�#�D���
r;c�2�|j|jfSr�)rerDrus r9ryzJSON._data_and_metadatans���y�y�$�-�-�'�'r;c�"�|j�Sr�r�rus r9�_repr_json_zJSON._repr_json_qr�r;)NNNFNr�)
r7ror�r�r�rirgr�rer�ryrr�r�s@r9r r 4sQ����
�E�J�<o�����
�[�[����(�)r;r z�var link = document.createElement("link");
	link.rel = "stylesheet";
	link.type = "text/css";
	link.href = "%s";
	document.head.appendChild(link);
z�new Promise(function(resolve, reject) {
	var script = document.createElement("script");
	script.onload = resolve;
	script.onerror = reject;
	script.src = "%s";
	document.head.appendChild(script);
}).then(() => {
z
});c�(��eZdZdZ�fd�Zd�Z�xZS)r!z�GeoJSON expects JSON-able dict

    not an already-serialized JSON string.

    Scalar types (None, number, string) are not allowed, only dict containers.
    c�,��tt|�
|i|��y)a�Create a GeoJSON display object given raw data.

        Parameters
        ----------
        data : dict or list
            VegaLite data. Not an already-serialized JSON string.
            Scalar types (None, number, string) are not allowed, only dict
            or list containers.
        url_template : string
            Leaflet TileLayer URL template: http://leafletjs.com/reference.html#url-template
        layer_options : dict
            Leaflet TileLayer options: http://leafletjs.com/reference.html#tilelayer-options
        url : unicode
            A URL to download the data from.
        filename : unicode
            Path to a local file to load the data from.
        metadata : dict
            Specify extra metadata to attach to the json display object.

        Examples
        --------
        The following will display an interactive map of Mars with a point of
        interest on frontend that do support GeoJSON display.

            >>> from IPython.display import GeoJSON

            >>> GeoJSON(data={
            ...     "type": "Feature",
            ...     "geometry": {
            ...         "type": "Point",
            ...         "coordinates": [-81.327, 296.038]
            ...     }
            ... },
            ... url_template="http://s3-eu-west-1.amazonaws.com/whereonmars.cartodb.net/{basemap_id}/{z}/{x}/{y}.png",
            ... layer_options={
            ...     "basemap_id": "celestia_mars-shaded-16k_global",
            ...     "attribution" : "Celestia/praesepe",
            ...     "minZoom" : 0,
            ...     "maxZoom" : 18,
            ... })
            <IPython.core.display.GeoJSON object>

        In the terminal IPython, you will only see the text representation of
        the GeoJSON object.

        N)rpr!ri)rh�argsrNrns   �r9rizGeoJSON.__init__�s���`	�g�t�%�t�6�v�6r;c�n�|jdd�}d|ji}tj||d��y)Nz <IPython.display.GeoJSON object>)�application/geo+jsonrKrT)rDrC)rerDrr')rh�bundlerDs   r9�_ipython_display_zGeoJSON._ipython_display_�s9��$(�I�I�<�
��

#�D�M�M�
��	�!�!�&�8��Fr;)r7ror�r�rir
r�r�s@r9r!r!�s����07�fGr;r!c�&��eZdZd�fd�	Zd�Z�xZS)r"c�>��t|t�r|g}n|�g}t|t�r|g}n|�g}t|ttf�st	d|z��t|ttf�st	d|z��||_||_tt|�'|||��y)aCreate a Javascript display object given raw data.

        When this object is returned by an expression or passed to the
        display function, it will result in the data being displayed
        in the frontend. If the data is a URL, the data will first be
        downloaded and then displayed.

        In the Notebook, the containing element will be available as `element`,
        and jQuery will be available.  Content appended to `element` will be
        visible in the output area.

        Parameters
        ----------
        data : unicode, str or bytes
            The Javascript source code or a URL to download it from.
        url : unicode
            A URL to download the data from.
        filename : unicode
            Path to a local file to load the data from.
        lib : list or str
            A sequence of Javascript library URLs to load asynchronously before
            running the source code. The full URLs of the libraries should
            be given. A single Javascript library URL can also be given as a
            string.
        css : list or str
            A sequence of css files to load before running the source code.
            The full URLs of the css files should be given. A single css URL
            can also be given as a string.
        Nzexpected sequence, got: %rr�)
r`rar��tupler��lib�cssrpr"ri)rhrercrdrrrns      �r9rizJavascript.__init__�s����<�c�3���%�C�
�[��C��c�3���%�C�
�[��C��#��U�|�,��8�3�>�?�?��#��U�|�,��8�3�>�?�?�������
�j�$�(�d��h�(�Or;c���d}|jD]}|t|zz
}�|jD]}|t|zz
}�||jz
}|t
t
|j�zz
}|S)N�)r�_css_tr�_lib_t1re�_lib_t2r�)rhr]�c�ls    r9�_repr_javascript_zJavascript._repr_javascript_�sq�������	�A�
��!��O�A�	����	�A�
��1���A�	�	�T�Y�Y���	�W�S����]�
"�"���r;)NNNNN)r7ror�rirr�r�s@r9r"r"�s���,P�\r;r"s�PNG

s��c�b�|jd�}tjd||dz|dz�S)z*read the (width, height) from a PNG headersIHDRz>ii��)�index�struct�unpack)re�ihdrs  r9�_pngxyrs0���:�:�g��D��=�=���T�!�V�D��G� 4�5�5r;c���d}	tjd|||dz�d}||z}|||dzdk(r|}n|dz
}�8tjd||dz|dz�\}}||fS)	z+read the (width, height) from a JPEG headerrz>Hr.rs��z>HH��	�rr)re�idx�
block_size�iSOF�h�ws      r9�_jpegxyr)s����C�
��]�]�4��c�#�a�%��9�!�<�
��J�����C��E�?�k�)��D��
�1�H�C���=�=���T�!�V�D��F� 3�4�D�A�q��a�4�Kr;c�4�tjd|dd�S)z*read the (width, height) from a GIF headerz<HH�r�r#)res r9�_gifxyr,$s���=�=���Q�r�
�+�+r;c���eZdZdZdZdZdZeeegZededediZ											d�fd�	Z	d	�Z
�fd
�Zd�Zdd�Z
dd
�Zd�Zd�Zd�Z�xZS)r#r��jpeg�png�gifrUrWz	image/gifc�j��t|ttf�rt|�}|�|j	|�}na|�|j	|�}nM|�td��t|t�r.|j
d�st|�r|j	|�}nd}|�v|�L|dk(s|dk(r
|j}n]|dk(r
|j}nK|dk(r
|j}n9|j�}n(t|t�r|ddtk(r|j}|�|j}|j�dk(r|j}|j�|_|�|n|du|_|jr0|j|j vrtd	|jz��|jr*|j"j%|j�|_||_||_||_|	|_||_t2t4|�o||||
�
�|j(�&|j8j%di�r
|
d|_|j*�&|j8j%di�r
|
d|_|j0�&|j8j%d
i�r
|
d
|_|r|j;�yy)a+Create a PNG/JPEG/GIF image object given raw data.

        When this object is returned by an input cell or passed to the
        display function, it will result in the image being displayed
        in the frontend.

        Parameters
        ----------
        data : unicode, str or bytes
            The raw image data or a URL or filename to load the data from.
            This always results in embedded image data.

        url : unicode
            A URL to download the data from. If you specify `url=`,
            the image data will not be embedded unless you also specify `embed=True`.

        filename : unicode
            Path to a local file to load the data from.
            Images from a file are always embedded.

        format : unicode
            The format of the image data (png/jpeg/jpg/gif). If a filename or URL is given
            for format will be inferred from the filename extension.

        embed : bool
            Should the image data be embedded using a data URI (True) or be
            loaded using an <img> tag. Set this to True if you want the image
            to be viewable later with no internet connection in the notebook.

            Default is `True`, unless the keyword argument `url` is set, then
            default value is `False`.

            Note that QtConsole is not able to display images if `embed` is set to `False`

        width : int
            Width in pixels to which to constrain the image in html

        height : int
            Height in pixels to which to constrain the image in html

        retina : bool
            Automatically set the width and height to half of the measured
            width and height.
            This only works for embedded images because it reads the width/height
            from image data.
            For non-embedded images, you can just set the desired display width
            and height directly.

        unconfined : bool
            Set unconfined=True to disable max-width confinement of the image.

        metadata : dict
            Specify extra metadata to attach to the image.

        alt : unicode
            Alternative text for the image, for use by screen readers.

        Examples
        --------
        embedded image data, works in qtconsole and notebook
        when passed positionally, the first arg can be any of raw image data,
        a URL, or a filename from which to load image data.
        The result is always embedding image data for inline images.

        >>> Image('https://www.google.fr/images/srpr/logo3w.png') # doctest: +SKIP
        <IPython.core.display.Image object>

        >>> Image('/path/to/image.jpg')
        <IPython.core.display.Image object>

        >>> Image(b'RAW_PNG_DATA...')
        <IPython.core.display.Image object>

        Specifying Image(url=...) does not embed the image data,
        it only generates ``<img>`` tag with a link to the source.
        This will not work in the qtconsole or offline.

        >>> Image(url='https://www.google.fr/images/srpr/logo3w.png')
        <IPython.core.display.Image object>

        Nz6No image data found. Expecting filename, url, or data.r_�jpgr.r/r0r.z"Cannot embed the '%s' image formatr��width�height�alt)r`rrra�	_find_ext�
ValueErrorrbrA�	_FMT_JPEG�_FMT_PNG�_FMT_GIFr��bytes�_JPEGr��embed�_ACCEPTABLE_EMBEDDINGS�
_MIMETYPES�get�	_mimetyper3r4�retina�
unconfinedr5rpr#rirD�
_retina_shape)rhrercrdr�r=r3r4rBrCrDr5�extrns             �r9rizImage.__init__6sX���~�d�T�8�,�-��t�9�D����.�.��*�C�
�_��.�.��%�C�
�\��U�V�V�
��c�
"��O�O�F�#�|�D�'9��.�.��&�C��C��>����&�=�C�7�N�!�^�^�F��F�]�!�]�]�F��F�]�!�]�]�F� �Y�Y�[�F��D�%�(����8�u�$�!�^�^�F��>��]�]�F��<�<�>�U�"��^�^�F��l�l�n���#�/�U�c�T�k��
��:�:�$�+�+�T�-H�-H�H��A�T�[�[�Q�R�R��:�:�!�_�_�0�0����=�D�N���
�������$������
�e�T�#��3��!�	$�	#��:�:��$�-�-�"3�"3�G�R�"@�!�'�*�D�J��;�;��4�=�=�#4�#4�X�r�#B�"�8�,�D�K��8�8���
�
� 1� 1�%�� <����D�H����� �r;c�t�|jsy|j|jk(rt|j�\}}ne|j|j
k(rt
|j�\}}n3|j|jk(rt|j�\}}ny|dz|_	|dz|_
y)z3load pixel-doubled width and height from image dataNr.)r=r�r9rrer8r)r:r,r3r4)rhr(r's   r9rDzImage._retina_shape�s����z�z���;�;�$�-�-�'��$�)�)�$�D�A�q�
�[�[�D�N�N�
*��4�9�9�%�D�A�q�
�[�[�D�M�M�
)��$�)�)�$�D�A�q�
��!�V��
��1�f��r;c�~��|jr0tt|��|jr|j�yyy)r{N)r=rpr#rfrBrD)rhrns �r9rfzImage.reload�s4����:�:��%��$�&��{�{��"�"�$��r;c�P�|js�dx}x}x}}|jrd|jz}|jrd|jz}|jrd}|jr"dtj|j�z}dj|j||||��Sy)Nr� width="%d"� height="%d"z class="unconfined"z	 alt="%s"z-<img src="{url}"{width}{height}{klass}{alt}/>)rcr3r4�klassr5)	r=r3r4rCr5�html�escaper�rc)rhr3r4rKr5s     r9r�zImage._repr_html_�s����z�z�+-�-�E�-�F�-�U�S��z�z�%��
�
�2���{�{�'�$�+�+�5�����-���x�x�!�D�K�K����$9�9��B�I�I��H�H�����J��
�r;c��|jr-|j}|jd��\}}|r||i}||i|fSd|j�iS)zgReturn the image as a mimebundle

        Any new mimetype support should be implemented here.
        T)�always_bothrQ)r=rAryr�)rhrE�excluderFrerDs      r9�_repr_mimebundle_zImage._repr_mimebundle_s\��
�:�:��~�~�H�!�4�4��4�F�N�D�(��$�h�/���d�#�X�-�-���!1�!1�!3�4�4r;c���	t|jd��jd�}i}|j
r|j
|j
�|jr|j|d<|jr|j|d<|jr|j|d<|jr|j|d	<|s|r||fS|S#t$r}t	d|jz�|�d}~wwxYw)
rxF��newliner�zNo such file or directory: '%s'Nr3r4rCr5)rrer�r��FileNotFoundErrorrDr�r3r4rCr5)rhrO�b64_data�e�mds     r9ryzImage._data_and_metadatas���	H�!�$�)�)�U�;�B�B�7�K�H����=�=��I�I�d�m�m�$��:�:��*�*�B�w�K��;�;��;�;�B�x�L��?�?�#���B�|���8�8����B�u�I�
���R�<���O��#�	H�#�1�T�Y�Y�?�A�FG�
H��	H�s�&C�	C.�C)�)C.c�p�|jr*|j|jk(r|j�Syyr�)r=r�r9ryrus r9�
_repr_png_zImage._repr_png_)s.���:�:�$�+�+����6��*�*�,�,�7�:r;c�p�|jr*|j|jk(r|j�Syyr�)r=r�r8ryrus r9�_repr_jpeg_zImage._repr_jpeg_-s.���:�:�$�+�+����7��*�*�,�,�8�:r;c�L�t|�\}}|s|S|ddj�S)Nr)rr�)rhr��baserEs    r9r6zImage._find_ext1s+���Q�K�	��c���K��1�2�w�}�}��r;)NNNNNNNFFNN)NN)F)r7ror�r�r8r9r:r>r?rirDrfr�rQryrZr\r6r�r�s@r9r#r#)s�����K��I��H��H�'��8�<���+��<��+��J������������a!�H� %��&5��.-�-�r;r#c�0��eZdZ		d�fd�	Zd�Zd�Z�xZS)r&c	���t|ttf�rt|�}|�&t|t�r|j	d�r|}d}n%|�#t
jj|�r|}d}|r |sdjgd��}	t|	��||_
||_||_||_
||_tt |�G|||��y)a�Create a video object given raw data or an URL.

        When this object is returned by an input cell or passed to the
        display function, it will result in the video being displayed
        in the frontend.

        Parameters
        ----------
        data : unicode, str or bytes
            The raw video data or a URL or filename to load the data from.
            Raw data will require passing ``embed=True``.

        url : unicode
            A URL for the video. If you specify ``url=``,
            the image data will not be embedded.

        filename : unicode
            Path to a local file containing the video.
            Will be interpreted as a local URL unless ``embed=True``.

        embed : bool
            Should the video be embedded using a data URI (True) or be
            loaded using a <video> tag (False).

            Since videos are large, embedding them should be avoided, if possible.
            You must confirm embedding as your intention by passing ``embed=True``.

            Local files can be displayed with URLs without embedding the content, via::

                Video('./video.mp4')

        mimetype : unicode
            Specify the mimetype for embedded videos.
            Default will be guessed from file extension, if available.

        width : int
            Width in pixels to which to constrain the video in HTML.
            If not supplied, defaults to the width of the video.

        height : int
            Height in pixels to which to constrain the video in html.
            If not supplied, defaults to the height of the video.

        html_attributes : str
            Attributes for the HTML ``<video>`` block.
            Default: ``"controls"`` to get video controls.
            Other examples: ``"controls muted"`` for muted video with controls,
            ``"loop autoplay"`` for looping autoplaying video without controls.

        Examples
        --------
        ::

            Video('https://archive.org/download/Sita_Sings_the_Blues/Sita_Sings_the_Blues_small.mp4')
            Video('path/to/video.mp4')
            Video('path/to/video.mp4', embed=True)
            Video('path/to/video.mp4', embed=True, html_attributes="controls muted autoplay")
            Video(b'raw-videodata', embed=True)
        N)zhttp:zhttps:r)z*To embed videos, you must pass embed=True z)(this may make your notebook files huge)
z!Consider passing Video(url='...')r�)r`rrrarbr=r>r?�joinr7rFr=r3r4�html_attributesrpr&ri)rhrercrdr=rFr3r4rb�msgrns          �r9rizVideo.__init__=s����z�d�T�8�,�-��t�9�D��;�:�d�C�0�T�_�_�EX�5Y��C��D�
�
�"�'�'�.�.��"6��H��D����'�'���C�
�S�/�!� ��
���
���
����.���
�e�T�#��3��#�Jr;c���dx}}|jrd|jz}|jrd|jz}|jsD|j�|jn|j}dj||j||�}|S|j}|j�T|s"tj|j�\}}t|jd�5}|j�}ddd�n|j}tt�r|}	n*t|d��j!d�j#�}	d	j|j||||	�}|S#1swY�gxYw)
NrrIrJzn<video src="{0}" {1} {2} {3}>
      Your browser does not support the <code>video</code> element.
    </video>r�FrSr�zz<video {0} {1} {2}>
 <source src="data:{3};base64,{4}" type="{3}">
 Your browser does not support the video tag.
 </video>)r3r4r=rcrdr�rbrF�	mimetypes�
guess_typer�r�rer`rarr��rstrip)
rhr3r4rc�outputrF�_r��video�	b64_videos
          r9r�zVideo._repr_html_�sH�������:�:�!�D�J�J�.�E��;�;�#�d�k�k�1�F��z�z�"�h�h�2�$�(�(��
�
�C����s�D�0�0�%��@�
��M��=�=���=�=�$��'�2�2�4�=�=�A���!��d�m�m�T�*�
!�a������
!�
!��I�I�E��e�S�!��I�"�5�%�8�?�?��H�O�O�Q�I�
��V�D�(�(�%���9�
M�	��
�
!�
!�s�E!�!E*c��yr�rtrus r9rfzVideo.reload�rvr;)NNNFNNN�controls)r7ror�rir�rfr�r�s@r9r&r&;s���AF�IS�TK�l$�L
r;r&c�X�tjdtd��ddlm}||i|��y)a�
    .. deprecated:: 7.23

       use `matplotlib_inline.backend_inline.set_matplotlib_formats()`

    Select figure formats for the inline backend. Optionally pass quality for JPEG.

    For example, this enables PNG and JPEG output with a JPEG quality of 90%::

        In [1]: set_matplotlib_formats('png', 'jpeg', quality=90)

    To set this in your config files use the following::

        c.InlineBackend.figure_formats = {'png', 'jpeg'}
        c.InlineBackend.print_figure_kwargs.update({'quality' : 90})

    Parameters
    ----------
    *formats : strs
        One or more figure formats to enable: 'png', 'retina', 'jpeg', 'svg', 'pdf'.
    **kwargs
        Keyword args will be relayed to ``figure.canvas.print_figure``.
    z�`set_matplotlib_formats` is deprecated since IPython 7.23, directly use `matplotlib_inline.backend_inline.set_matplotlib_formats()`r.r/r)r$N)r�r,r2� matplotlib_inline.backend_inliner$)�formatsrN�set_matplotlib_formats_origs   r9r$r$�s0��2
�M�M�	J���	�� ��3�F�3r;c�X�tjdtd��ddlm}||�y)a
    .. deprecated:: 7.23

        use `matplotlib_inline.backend_inline.set_matplotlib_close()`

    Set whether the inline backend closes all figures automatically or not.

    By default, the inline backend used in the IPython Notebook will close all
    matplotlib figures automatically after each cell is run. This means that
    plots in different cells won't interfere. Sometimes, you may want to make
    a plot in one cell and then refine it in later cells. This can be accomplished
    by::

        In [1]: set_matplotlib_close(False)

    To set this in your config files use the following::

        c.InlineBackend.close_figures = False

    Parameters
    ----------
    close : bool
        Should all matplotlib figures be automatically closed after each cell is
        run?
    z`set_matplotlib_close` is deprecated since IPython 7.23, directly use `matplotlib_inline.backend_inline.set_matplotlib_close()`r.r/r)r%N)r�r,r2ror%)�close�set_matplotlib_close_origs  r9r%r%�s+��6
�M�M�	H���	���e�$r;)FN)T)@r��binasciirrrLr�rer=rr��copyr�os.pathr�pathlibrr�IPython.utils.py3compatr	�IPython.testing.skipdoctestr
rr�__all__r1r,r:rArIr
rrrrrrrrr�objectrrrrrrrrrr rrrr!r"�_PNGr<rr)r,r#r&r$r%rtr;r9�<module>r~s���M�)����	�
����"�0�4����k��
�%�
%��
�K��U�84�"3�(7�$7�"3�"4�"4�":�&@�"9�,r!�F�r!�j^�
�^�$"�
�"�"��"�>)� �)����)��)�$)�-�$)�L8"�-�8"�t>)�=�>)�B
������CG�d�CG�J8�"�8�v����6��&,�
O�M�O�d@
�M�@
�F�#4��#4�J�%%��%%r;

Youez - 2016 - github.com/yon3zu
LinuXploit