403Webshell
Server IP : 217.160.0.135  /  Your IP : 216.73.217.85
Web Server : Apache
System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64
User : sws1074145052 ( 1074145052)
PHP Version : 8.3.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /usr/lib/python3/dist-packages/IPython/terminal/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3/dist-packages/IPython/terminal/__pycache__/shortcuts.cpython-311.pyc
�

�@�c�G���dZddlZddlZddlZddlZddlZddlmZddlm	Z	ddl
mZmZddl
mZmZmZmZmZmZmZddlmZddlmZdd	lmZdd
lmZmZddlm Z e ed�����Z!d
�Z"d�Z#d�Z$d�Z%d�Z&d�Z'd�Z(d�Z)d�Z*d�Z+d�Z,d�Z-e d���Z.dedfd�Z/d�Z0ej1dkrddl2m3Z3dd l4m5Z5m6Z6m7Z7e d!���Z8dSdS)"zU
Module to define and register Terminal IPython shortcuts with
:mod:`prompt_toolkit`
�N)�Callable)�get_app)�DEFAULT_BUFFER�
SEARCH_BUFFER)�	has_focus�
has_selection�	Condition�vi_insert_mode�emacs_insert_mode�has_completions�vi_mode)�!display_completions_like_readline)�KeyBindings)�named_commands)�	InputMode�ViState)�undocc�j�t��jjj}|p|���S�N)r�current_buffer�document�current_line_before_cursor�isspace)�befores �</usr/lib/python3/dist-packages/IPython/terminal/shortcuts.py�cursor_in_leading_wsrs-���Y�Y�
%�
.�
I�F��J�+�6�>�>�+�+�+�c�4�|j}|j}|j|jd�}|�d��}|d���}|j}|�)|jr"|dkr|�|j��dStj	|��dS)z1
    Apply autosuggestion if at end of line.
    N�
r�)
rr�text�cursor_position�split�strip�
suggestion�insert_text�nc�end_of_line)�event�b�d�after_cursor�lines�end_of_current_liner%s       r�_apply_autosuggestr/$s���	��A�	�
�A��6�!�+�-�-�.�L����t�$�$�E���(�.�.�*�*����J���Z�_��;N�RT�;T�;T�	�
�
�j�o�&�&�&�&�&�
��u�����rc�����t��}ttz}t�dd��r�����}nt���}|�dtt��tz|z���|���fd�}|�ddtt��tz|z���|��|�d��t��|�dttt��z���t��|�d	ttt��z���t��|�d
tt��tz���t��|�dtt�����t��|�dtt �����t"��t%d���}|�d
|���t&��|�dtt��tz|zt(z���t*��|�dtt��tz���t-�j����|�dtt�����t0��t$�fd���}ttztt��z}i�i��fd�}�fd�}	t$d���}
|�d||z|	d��z���d���}|�d||z|	d��z���d���}|�d||z|	d��z���d���}|�d||z|
z|	d��z���d���}|�d||z|
z|	d��z���d���}|�d||z|
z|d ��z���d!���}|�d||z|
z|d"��z���d#���}|�d||z|d$��z���d%���}|�d||z|d$��z���d&���}|�d||z|d$��z���d'���}|�d(||z|	d)��z���|�d*||z|	d+��z���|�d,||z|	d-��z���|�d||z|	d.��z���|�d||z|	d/��z���d0�����������}|�d1||d2��z|z|	d)��z���|�d1||d3��z|z|	d+��z���|�d1||d4��z|z|	d-��z���|�d1||d5��z|z|	d.��z���|�d1||d6��z|z|	d/��z���d7�����������}�jd8krL|�d9tt��tz|zt(z���t4��t6jd:kr@|�d;tt��t:z���t<��t$�fd<���}tt��tz}
|�d=tt��|tzz���d>���}|�d?|
|z���d@���}|�dA|
���dB���}|�ddC|
|z���dD���}t>j t>j!t>j"t>j#t>j$t>j%dE�}|�&��D](\}}|�||
|z���|���)t>j't>j't>j(t>j)t>j*t>j#t>j+t>j,t>j-t>j.dF�
}|�&��D]\}}|j|dG|
|zi�|����fdH�}dI�}�j/dJkr7�j0r0tbj2tf_4tk||��tf_6|S)Kz8Set up the prompt_toolkit keyboard shortcuts for IPython�
handle_returnN�enter)�filterc�z��t|j|jj���|j���dSr)�reformat_text_before_cursorrr�validate_and_handle)r)�shells �r�reformat_and_executez6create_ipython_shortcuts.<locals>.reformat_and_executeCs:���#�E�$8�%�:N�:W�Y^�_�_�_�
��0�0�2�2�2�2�2r�escapezc-\zc-pzc-nzc-gzc-cc�,�ttd��S)N�SIGTSTP)�hasattr�signal�rr�<lambda>z*create_ipython_shortcuts.<locals>.<lambda>[s�����)C�)C�rzc-z�tabzc-o�f2c����jSr)�
auto_match�r7s�rrCz,create_ipython_shortcuts.<locals>.auto_matchis�����rc����	�|S#t$rYnwxYwtj|����fd�}t|��}|�|<|S)Nc���t��}t��|jjj����Sr)r�bool�matchrrr��app�ms �r�_preceding_textzIcreate_ipython_shortcuts.<locals>.preceding_text.<locals>._preceding_textxs/����)�)�C������ 2� ;� V�W�W�X�X�Xr��KeyError�re�compiler	)�patternrL�	conditionrK�_preceding_text_caches   @�r�preceding_textz0create_ipython_shortcuts.<locals>.preceding_textqs�����	�(��1�1���	�	�	��D�	�����J�w����	Y�	Y�	Y�	Y�	Y��o�.�.�	�)2��g�&�����
�c����	�|S#t$rYnwxYwtj|����fd�}t|��}|�|<|S)Nc���t��}t��|jjj����Sr)rrGrHrr�current_line_after_cursorrIs �r�_following_textzIcreate_ipython_shortcuts.<locals>.following_text.<locals>._following_text�s/����)�)�C������ 2� ;� U�V�V�W�W�WrrM)rQrYrRrK�_following_text_caches   @�r�following_textz0create_ipython_shortcuts.<locals>.following_text�s�����	�(��1�1���	�	�	��D�	�����J�w����	X�	X�	X�	X�	X��o�.�.�	�)2��g�&��rUc��t��}|jjj}|�dd���dd��}tjdd|��}tjdd|��}d|vpd|vS)Nz\"r z\'z%(?:\"\"\"[\s\S]*\"\"\"|'''[\s\S]*''')z(?:"[^"]*["\n]|'[^']*['\n])�"�')rrr�text_before_cursor�replacerO�sub)rJ�ss  r�not_inside_unclosed_stringz<create_ipython_shortcuts.<locals>.not_inside_unclosed_string�sz���i�i����'�:��
�I�I�e�R� � �(�(���3�3���F�;�R��C�C���F�5�r�1�=�=���1�H�(��q��)�)r�(z	[,)}\]]|$c�l�|j�d��|j���dS)N�()�rr&�cursor_left�r)s r�_z#create_ipython_shortcuts.<locals>._��4��
��(�(��.�.�.�
��(�(�*�*�*�*�*r�[c�l�|j�d��|j���dS)N�[]rgris rrjz#create_ipython_shortcuts.<locals>._�rkr�{c�l�|j�d��|j���dS)N�{}rgris rrjz#create_ipython_shortcuts.<locals>._�rkrr]c�l�|j�d��|j���dS)Nz""rgris rrjz#create_ipython_shortcuts.<locals>._��6��	��(�(��.�.�.�
��(�(�*�*�*�*�*rr^c�l�|j�d��|j���dS)Nz''rgris rrjz#create_ipython_shortcuts.<locals>._�rsrz^.*""$c�n�|j�d��|j�d��dS)Nz""""�rgris rrjz#create_ipython_shortcuts.<locals>._��8��	��(�(��0�0�0�
��(�(��+�+�+�+�+rz^.*''$c�n�|j�d��|j�d��dS)Nz''''rvrgris rrjz#create_ipython_shortcuts.<locals>._�rwrz.*(r|R)[\"'](-*)$c�
�tjd|jjj��}|�d��pd}|j�d|z��|j�t|��dz��dS)N�.*(r|R)[\"'](-*)�r rf��	rOrHrrr�groupr&rh�len�r)�matches�dashess   rrjz#create_ipython_shortcuts.<locals>._��~���(��� �)�D�
�
�����q�!�!�'�R��
��(�(����7�7�7�
��(�(��V���q��9�9�9�9�9rc�
�tjd|jjj��}|�d��pd}|j�d|z��|j�t|��dz��dS)Nrzr{r rnr|r}r�s   rrjz#create_ipython_shortcuts.<locals>._�r�rc�
�tjd|jjj��}|�d��pd}|j�d|z��|j�t|��dz��dS)Nrzr{r rqr|r}r�s   rrjz#create_ipython_shortcuts.<locals>._�r�r�)z^\)�]z^\]�}z^\}z^"z^'c�8�|j���dSr)r�cursor_rightris rrjz#create_ipython_shortcuts.<locals>._�s��	��)�)�+�+�+�+�+r�	backspacez.*\($z.*\[$z.*\{$z.*"$z.*'$c�j�|j���|j���dSr)r�delete�delete_before_cursorris rrjz#create_ipython_shortcuts.<locals>._s5��H	��#�#�%�%�%�
��1�1�3�3�3�3�3r�readlinelikezc-i�win32zc-vc����jSr)� emacs_bindings_in_vi_insert_moderDs�r�ebivimz(create_ipython_shortcuts.<locals>.ebivim:s����5�5r�endc�$�t|��dSr�r/ris rrjz#create_ipython_shortcuts.<locals>._@����5�!�!�!�!�!r�c-ec�$�t|��dSrr�ris rrjz#create_ipython_shortcuts.<locals>._Dr�rzc-fc��|j}|j}|r|�|j��dSt	j|��dSr)rr%r&r!r'�forward_char)r)r*r%s   rrjz#create_ipython_shortcuts.<locals>._HsI��� ���\�
��	#�
�M�M�*�/�*�*�*�*�*��O�E�"�"�"�"�"r�fc���|j}|j}|rItjd|j��}|�t
d�|D��d����dStj|��dS)Nz(\S+\s+)c3�K�|]}|�|V��	dSrr>)�.0�xs  r�	<genexpr>z6create_ipython_shortcuts.<locals>._.<locals>.<genexpr>Ws'����2�2�a��2��2�2�2�2�2�2rr )	rr%rOr#r!r&�nextr'�forward_word)r)r*r%�ts    rrjz#create_ipython_shortcuts.<locals>._Qss��� ���\�
��	#����j�o�6�6�A�
�M�M�$�2�2�1�2�2�2�B�7�7�8�8�8�8�8��O�E�"�"�"�"�"r)zc-azc-bzc-kzc-wzc-yzc-_)
)�c-xr�)r��e)r9r*)r9�c)r9r+)r9�h)r9�l)r9�u)r9�y)r9�.r3c�^��t��}�j|_�j|_|jSr)r�ttimeoutlen�
timeoutlen�_input_mode)�selfrJr7s  �r�get_input_modez0create_ipython_shortcuts.<locals>.get_input_mode{s)����i�i���+����)�����rc��tjdtjdi�|d��}d�|��}t
j�|��t
j���||_	dS)Nr{��z[{} q)
r�
NAVIGATION�REPLACE�get�format�sys�stdout�write�flushr�)r��mode�shape�cursors    r�set_input_modez0create_ipython_shortcuts.<locals>.set_input_mode�sq���%�q�)�*;�Q�?�C�C�D�!�L�L���#�#�E�*�*���
���� � � ��
����������r�vi)7rr
r�getattrr1�newline_or_execute_outer�addrrr�quit�'previous_history_or_previous_completion�next_history_or_next_completionr�dismiss_completion�reset_bufferr�reset_search_bufferr	�
suspend_to_bgr�
indent_buffer�newline_autoindent_outer�input_transformer_manager�open_input_in_editor�display_completionsrr��platformr
�	win_paster'�beginning_of_line�
backward_char�	kill_line�backward_kill_word�yank�undo�items�edit_and_execute�
backward_word�capitalize_word�	kill_word�
downcase_word�uppercase_word�yank_pop�
yank_last_arg�editing_mode�modal_cursorr�INSERTrr��property�
input_mode)r7�kb�insert_mode�return_handlerr8�supports_suspendrC�focused_insertrTr[rcrjr��focused_insert_vi�key_cmd_dict�key�cmd�
keys_cmd_dict�keysr�r�rZrSs`                    @@r�create_ipython_shortcutsr�3s������
���B� �#4�4�K��u�o�t�,�,�9��,�,�U�3�3���1�%�8�8���B�F�F�7�I�n�5�5�,�n�-�)�*�F���*�+�+�+�
3�3�3�3�3�)�B�F�F�8�W�i��&?�&?�,�n�'-�)�'*�F�)�)�*>�?�?�?�
�B�F�F�6�N�N�4�����B�F�F�5�.�9�^�+D�+D�D�F���9�;�;�;��B�F�F�5�.�9�^�+D�+D�D�F���1�3�3�3��B�F�F�5�)�N�3�3�o�E�F���$�&�&�&�4�B�F�F�5��>�2�2�F�3�3�L�A�A�A�2�B�F�F�5��=�1�1�F�2�2�3F�G�G�G� �!C�!C�D�D��*�B�F�F�5�)�F�*�*�=�9�9�9��B�F�F�5�)�N�3�3�*�N�+�'�(�1�1�F���)�	*�*�*�

�B�F�F�5�)�N�3�3�6G�G�F�
�
�
%�e�&E�
F�
F�H�H�H�3�B�F�F�4�	�.�1�1�F�2�2�3G�H�H�H�� � � � ��Y� �%�'8�8�I�n�<U�<U�U�N�����
�
�
�
�
�
�
�
�
�
��	*�	*��Y�	*��V�V�C���3�n�n�\�6R�6R�R�V�S�S�+�+�T�S�+��V�V�C���3�n�n�\�6R�6R�R�V�S�S�+�+�T�S�+��V�V�C���3�n�n�\�6R�6R�R�V�S�S�+�+�T�S�+��V�V���
��
$�%��.��
&�
&�'����+�+���+��V�V���
��
$�%��.��
&�
&�'����+�+���+��V�V���
��
$�%��.��
#�
#�$����,�,���,��V�V���
��
$�%��.��
#�
#�$����,�,���,�
�V�V��N�Z�/�.�.�AU�2V�2V�V����:�:���:��V�V��N�Z�/�.�.�AU�2V�2V�V����:�:���:��V�V��N�Z�/�.�.�AU�2V�2V�V����:�:���:��V�V�C���3�n�n�V�6L�6L�L�V�M�M��V�V�C���3�n�n�V�6L�6L�L�V�M�M��V�V�C���3�n�n�V�6L�6L�L�V�M�M��V�V�C���3�n�n�T�6J�6J�J�V�K�K��V�V�C���3�n�n�T�6J�6J�J�V�K�K�,�,�L�K�L�K�N�M�N�M�N�M�
,��V�V���
�.��
"�
"�#�
���.��
 �
 �!�����V�V���
�.��
"�
"�#�
���.��
 �
 �!�����V�V���
�.��
"�
"�#�
���.��
 �
 �!�����V�V���
�.��
 �
 �!�
���.��
�
������V�V���
�.��
!�
!�"�
���.��
�
� ����4�4�����������F4�
� �N�2�2�	
������.�)�)� �.�!���(�'�(�	�	
�	
�,�	-�	-�	-��|�w���D����u�i��7�7�7�(�B��D�D�Y�O�O�O��6�6�6�6��Y�6�"�.�1�1�N�B���V�V�E�)�N�3�3�v���7O�P�V�Q�Q�"�"�R�Q�"��V�V�E�+�f�4�V�5�5�"�"�6�5�"��V�V�E�+�V�,�,�#�#�-�,�#��V�V�H�c�"3�f�"<�V�=�=�#�#�>�=�#��#����|��$��w��w�
��L�!�&�&�(�(�<�<���S�6����s�,�v�5��6�6�s�;�;�;�;�
�+��)��)��+����.��)��*����)�
�
�M�#�(�(�*�*�>�>�	��c�8�����8�.��7�8�8��=�=�=�=� � � � � � � � �
��T�!�!�e�&8�!�'�.���%�n�n�E�E���
�Irc��|�t|jd|j�����}	|�|��}|�|��dS#t$r }|�|��Yd}~dSd}~wwxYwr)r�rr!r"�reformat_handlerr&�	Exception)�bufferrr7r!�formatted_textr�s      rr5r5�s����&�&�s�8�=�9R�(�:R�9R�+S�'T�'T�U�U�D�!��/�/��5�5�����>�*�*�*�*�*���!�!�!����4� � � � � � � � � �����!���s�*A"�"
B�,B�Bc����fd�}|S)Nc�<��|j}|j}|jr:|jj}|r|�|��n|���dS|jdkr|j}n|jd|j�}�	�	|��\}}|j|jd�}d}|�
��st||�	��d}|js\|j
|j|���z
ks7�	jr|�d|z��n|�d��dS|dkr0|jr)|st||�	��|���dS�	jr|�d|z��dS|�d��dS)zCWhen the user presses return, insert a newline or execute the code.Nr|FTr�
incomplete)rr�complete_state�current_completion�apply_completion�cancel_completion�
line_countr!r"�check_completer$r5�on_last_line�cursor_position_row�empty_line_count_at_the_end�
autoindentr&�accept_handlerr6)
r)r*r+�cc�
check_text�status�indentr,�reformattedr7s
         �r�newline_or_executez4newline_or_execute_outer.<locals>.newline_or_execute�s����� ��
�J����	��!�4�B��
&��"�"�2�&�&�&�&��#�#�%�%�%��F�
�<�1�����J�J��� 2��!2� 2�3�J��-�-�j�9�9�����v�a�/�0�0�1�����!�!�#�#�	�'��1�e�4�4�4��K���	��%����8U�8U�8W�8W�)W�W�W���
$��
�
�d�V�m�,�,�,�,��
�
�d�#�#�#��F��l�"�"��(8�"��
9�+�A�q�%�8�8�8�
�!�!�#�#�#�#�#���
$��
�
�d�V�m�,�,�,�,�,��
�
�d�#�#�#�#�#rr>)r7rs` rr�r��s%���-$�-$�-$�-$�-$�\�rc�8�|j���dS)z�
    Control-P in vi edit mode on readline is history next, unlike default prompt toolkit.

    If completer is open this still select previous completion.
    N)r�auto_upris rr�r��s��
�� � �"�"�"�"�"rc�8�|j���dS)z�
    Control-N in vi edit mode on readline is history previous, unlike default prompt toolkit.

    If completer is open this still select next completion.
    N)r�	auto_downris rr�r��s��
��"�"�$�$�$�$�$rc�N�|j}|jr|���dSdSr)rr�r��r)r*s  rr�r��s7��
��A����	���������rc�v�|j}|jr|���dS|���dSr)rr�r��resetrs  rr�r��s>��
��A����	��������	���	�	�	�	�	rc��|jjjr|j���dS|jj�t��dSr)rrr!rrJ�layout�focusrris rr�r��sM����$�)�/�
��"�"�$�$�$�$�$�
�	����~�.�.�.�.�.rc�8�|j���dSr)rJ�suspend_to_backgroundris rr�r��s��	�I�#�#�%�%�%�%�%rc��ttdd��}|�!tjdtj��dStjd��dS)z�
    On platforms that support SIGQUIT, send SIGQUIT to the current process.
    On other platforms, just exit the process with a message.
    �SIGQUITNr�Quit)r�r=�os�killrr��exit)r)�sigquits  rr�r��sK��
�f�i��.�.�G���
���6�>�"�"�"�"�"��������rc�:�|j�d��dS)N�    )rr&ris rr�r�s��	��$�$�W�-�-�-�-�-rc��tjdtd���|j}|jj}|�d���|�d���|jj}||kr||z
}|�|���dSdS)	z�
    DEPRECATED since IPython 6.0

    See :any:`newline_autoindent_outer` for a replacement.

    Preserve margin and cursor position when using
    Control-O to insert a newline in EMACS mode
    z�`newline_with_copy_margin(event)` is deprecated since IPython 6.0. see `newline_autoindent_outer(shell)(event)` for a replacement.r{)�
stacklevelT)�copy_marginr|)�countN)	�warnings�warn�DeprecationWarningrr�cursor_position_col�newline�	cursor_upr�)r)r*�cursor_start_pos�cursor_end_pos�pos_diffs     r�newline_with_copy_marginr0s���
�M�H�$��4�4�4�4�	��A��z�5���I�I�$�I�����K�K�a�K�����Z�3�N��>�)�)�#�n�4��	���X��&�&�&�&�&�*�)r�return).Nc����fd�}|S)a�
    Return a function suitable for inserting a indented newline after the cursor.

    Fancier version of deprecated ``newline_with_copy_margin`` which should
    compute the correct indentation of the inserted line. That is to say, indent
    by 4 extra space after a function definition, class definition, context
    manager... And dedent by 4 space after ``pass``, ``return``, ``raise ...``.
    c���|j}|j}|jr|���|jd|j�dz}��|��\}}|�dd|pdzzd���dS)z9insert a newline after the cursor indented appropriately.Nr� rF)�move_cursor)rrr�r�r!r"rr&)r)r*r+r!rjr
�
inputsplitters      �r�newline_autoindentz4newline_autoindent_outer.<locals>.newline_autoindent&s����� ��
�J����	"�
���!�!�!��v�(�q�(�(�)�D�0��!�0�0��6�6�	��6�	�
�
�d�c�V�[�q�1�2��
�F�F�F�F�Frr>)r6r7s` rr�r�s)���	G�	G�	G�	G�	G��rc�B�|jj���dSr)rJr�open_in_editorris rr�r�4s��	�I��+�+�-�-�-�-�-rr�)�TryNext)�ClipboardEmpty�win32_clipboard_get�tkinter_clipboard_getc��	t��}nE#t$r,	t��}n#ttf$rYYdSwxYwYnt$rYdSwxYw|j�|�dd����dS)N�	r")r<r:r=r;rr&r`)r)r!s  rr�r�>s���	�&�(�(�D�D���	�	�	�
�,�.�.�����^�,�
�
�
�����
�������	�	�	��F�F�	����
��(�(����d�G�)D�)D�E�E�E�E�Es4��
A�+�A�A�A�A�A�	A�A)9�__doc__r'r=r�rOr�typingr�"prompt_toolkit.application.currentr�prompt_toolkit.enumsrr�prompt_toolkit.filtersrrr	r
rrr
�.prompt_toolkit.key_binding.bindings.completionr�prompt_toolkit.key_bindingr�#prompt_toolkit.key_binding.bindingsrr'�#prompt_toolkit.key_binding.vi_staterr�IPython.utils.decoratorsrrr/r�r5r�r�r�r�r�r�r�r�r�r0r�r�r��IPython.core.errorr:�IPython.lib.clipboardr;r<r=r�r>rr�<module>rLs���������
�
�
�
�
�
�
�
�	�	�	�	�	�	�	�	�������7�6�6�6�6�6�>�>�>�>�>�>�>�>�A�A�A�A�A�A�A�A�A�A�A�A�A�A�A�A�A�A�\�\�\�\�\�\�2�2�2�2�2�2�D�D�D�D�D�D�B�B�B�B�B�B�B�B�*�*�*�*�*�*��
�,�,�����,�
�
�
�\�\�\�~
!�!�!�0�0�0�f#�#�#�%�%�%�������/�/�/�&�&�&�	�	�	�.�.�.��'�'���'�,�x�	�/B�����0.�.�.��<�7���*�*�*�*�*�*�>�>�>�>�>�>�>�>�>�>��
F�
F��U�
F�
F�
F��r

Youez - 2016 - github.com/yon3zu
LinuXploit