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__/inputtransformer.cpython-312.pyc
�

}�eG��R�dZddlZddlZddlZddlZddlmZmZddlmZddl	m
Z
ddlmZdZ
dZd	Zd
ZdZdZd
ZdZdZe
eeeeeeeeg	ZGd�dej.��ZGd�de�ZGd�de�ZGd�de�ZGd�de�Zej:d��Zdedededefd �Z d!e
fd"�Z!d!e
fd#�Z"d!e
fd$�Z#d!e
fd%�Z$d!e
fd&�Z%d!e
fd'�Z&d!e
fd(�Z'e
e!ee"ee#ee#ee$ee%ee&ee'iZ(ej:d)efd*��Z)ejTd+�Z+ejTd,ejX�Z-e.�Z/e.�Z0d-�Z1d.�Z2d/�Z3ej:d)efd0��Z4ej:d>d1e5fd2��Z6d?d3�Z7ej:d4��Z8ej:d5��Z9ej:d6��Z:d7Z;ejTd8jye;�ejX�Z=d9Z>ej:d:��Z?ejTd;jye;�ejX�Z@d<ZAej:d=��ZBy)@a,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)�
untokenize�
TokenError)�StringIO)�LineInfo)�	tokenutil�!z!!�?�??�%z%%�,�;�/c�h�eZdZdZej
d��Zej
d��Zed��Z	y)�InputTransformerz6Abstract base class for line-based input transformers.c��y)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��y)z�Return, transformed any lines that the transformer has accumulated,
        and reset its internal state.

        Must be overridden by subclasses.
        Nr�rs r�resetzInputTransformer.reset:s��	
rc�F���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_factoryHs����t�&�v�&�&r)�	functools�wraps)r r!r"s`` r�wrapzInputTransformer.wrapCs(���

����	�	'�
�	'�#�"rN)
�__name__�
__module__�__qualname__�__doc__�abc�abstractmethodrr�classmethodr%rrrrr+sK��@����	
��	
�	���
��
��#��#rr)�	metaclassc�(�eZdZdZd�Zd�Zd�Zd�Zy)�StatelessInputTransformerzDWrapper for a stateless input transformer implemented as a function.c��||_yr�r!�rr!s  r�__init__z"StatelessInputTransformer.__init__Ps	����	rc�8�dj|j�S)Nz%StatelessInputTransformer(func={0!r}))�formatr!rs r�__repr__z"StatelessInputTransformer.__repr__S���6�=�=�d�i�i�H�Hrc�$�|j|�S)zQSend a line of input to the transformer, returning the
        transformed input.r1rs  rrzStatelessInputTransformer.pushVs���y�y���rc��y)z!No-op - exists for compatibility.Nrrs rrzStatelessInputTransformer.reset[s��rN�r&r'r(r)r3r6rrrrrr/r/Ns��N��I��

rr/c�(�eZdZdZd�Zd�Zd�Zd�Zy)�CoroutineInputTransformerz<Wrapper for an input transformer implemented as a coroutine.c�H�|di|��|_t|j�y)Nr)�coro�next)rr>rs   rr3z"CoroutineInputTransformer.__init__as���N�6�N��	��T�Y�Y�rc�8�dj|j�S)Nz%CoroutineInputTransformer(coro={0!r}))r5r>rs rr6z"CoroutineInputTransformer.__repr__fr7rc�8�|jj|�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.pushis��
�y�y�~�~�d�#�#rc�8�|jjd�S)zrReturn, transformed any lines that the transformer has
        accumulated, and reset its internal state.
        NrBrs rrzCoroutineInputTransformer.resetps���y�y�~�~�d�#�#rNr:rrrr<r<_s��F��
I�$�$rr<c�.�eZdZdZd�Zd�Zd�Zd�Zd�Zy)�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�@�||_g|_|j�yr)r!�buf�reset_tokenizerr2s  rr3zTokenInputTransformer.__init__|s����	�������rc�v�t|j�}tj|j�|_yr)�iterrHr�generate_tokens_catch_errors�__next__�	tokenizer)r�its  rrIz%TokenInputTransformer.reset_tokenizer�s%��
�$�(�(�^��"�?�?����L��rc���|jj|dz�td�|jD��r|j�Sg}d}	|jD]X}|j|�|d}|t
jk(s|r|t
jk(rn|t
jk(s�Wd}�Z|j|�S#t$r|j�YywxYw)N�
c3�<K�|]}|j����y�wr)�isspace)�.0�ls  r�	<genexpr>z-TokenInputTransformer.push.<locals>.<genexpr>�s����-�q�q�y�y�{�-�s�FrT)rH�append�allrrN�tokenize�NEWLINE�NL�
ERRORTOKENrrI�output)rr�tokens�
stop_at_NL�intok�ts      rrzTokenInputTransformer.push�s���������t��$��-�D�H�H�-�-��:�:�<�����
�	����
&���
�
�e�$��!�H����(�(�(�Z�A����<L���(�-�-�-�!%�J�
&��{�{�6�"�"���	�� � �"��	�s�A"C�3C�C$�#C$c��|jj�|j�t|j	|��jd�S)NrQ)rH�clearrIrr!�rstrip�rr^s  rr]zTokenInputTransformer.output�s;�������������$�)�)�F�+�,�3�3�D�9�9rc��dj|j�}|jj�|j�|r|j	d�Sy)N�rQ)�joinrHrcrIrd)rrUs  rrzTokenInputTransformer.reset�sD���G�G�D�H�H���������������8�8�D�>�!�
rN)	r&r'r(r)r3rIrr]rrrrrFrFvs!���
�
M�#�.:�
"rrFc�$��eZdZ�fd�Zd�Z�xZS)�assemble_python_linesc�,��tt|�d�yr)�superrjr3)r�	__class__s �rr3zassemble_python_lines.__init__�s���
�#�T�3�D�9rc�"�|j�Sr)rres  rr]zassemble_python_lines.output�s���z�z�|�r)r&r'r(r3r]�
__classcell__)rms@rrjrj�s
���:�rrjc#�K�d}	|��}|r|j�r�g}|�J|jd�r$t|�s|j|dd�d��}n|j|�n|��Jdj	|�}�w�w)z4Join lines following explicit line continuations (\)rgN�\���)rS�endswith�has_commentrWrh)r�partss  r�assemble_logical_linesrv�s������D�
��
���t�|�|�~�������}�}�T�"�K��,=����T�#�2�Y�'�"�
�����T�"��
���w�w�u�~���s�A(A=�+A=�target�esc�lspace�returnc��|dk(rdnd|vrdnd}dj||g�}|jd�\}}}|jt�}|�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(�, �))rh�	partition�lstrip�	ESC_MAGIC)rwrxry�method�arg�t_magic_name�_�
t_magic_arg_ss        r�_make_help_callr��sk����+�h�"%��-�Y����(�(�F�F�#�
$�C�%(�]�]�3�%7�"�L�!�]��&�&�y�1�L�����r�	line_infoc��|jj�jt�}|j�d|�d�S)zTranslate lines escaped with: !zget_ipython().system(r�)rr��	ESC_SHELL�pre�r��cmds  r�
_tr_systemr��s.��
�.�.�
�
�
!�
(�
(��
3�C�+4�=�=�#�>�>rc�`�|jj�dd}|j�d|�d�S)z Translate lines escaped with: !!�Nzget_ipython().getoutput(r�)rr�r�r�s  r�_tr_system2r��s*��
�.�.�
�
�
!�!�"�
%�C�.7�m�m�S�A�Arc�x�|jddsyt|j|j|j�S)z"Translate lines escaped with: ?/??�Nzget_ipython().show_usage())rr��ifunrxr��r�s r�_tr_helpr��s0���>�>�!�"��+��9�>�>�9�=�=�)�-�-�H�Hrc�>�d}|jjt�r|jSdj|j|j
g�j
�}|jd�\}}}|jt�}||j||fzS)zTranslate lines escaped with: %z&%sget_ipython().run_line_magic(%r, %r)r�)r�
startswith�
ESC_MAGIC2rhr��the_rest�stripr�r�r�r�)r��tplr�r�r�r�s      r�	_tr_magicr��s���
2�C��~�~� � ��,��~�~��

�(�(�I�N�N�I�$6�$6�7�
8�
>�
>�
@�C�%(�]�]�3�%7�"�L�!�]��&�&�y�1�L��)�-�-��}�=�=�=rc��|j�|j�ddj|jj	���d�S)zTranslate lines escaped with: ,�("z", "�")�r�r�rhr��splitr�s r�	_tr_quoter��s6��$�=�=�)�.�.����Y�%7�%7�%=�%=�%?�@�C�Crc�R�|j�|j�d|j�d�S)zTranslate lines escaped with: ;r�r�)r�r�r�r�s r�
_tr_quote2r��s"��$�=�=�)�.�.�$�-�-�/�/rc��|j�|j�ddj|jj	���d�S)zTranslate lines escaped with: /�(r�r�r�r�s r�	_tr_parenr�s6��"���	������9�#5�#5�#;�#;�#=�>�@�@rrc��|r|j�r|St|�}|jtvr|St|j|�S)zHTransform escaped commands - %magic, !system, ?help + various autocalls.)rSrrx�tr)r�lineinfs  r�escaped_commandsr�sA���4�<�<�>����t�n�G��{�{�"����
�g�k�k�?�7�#�#rz\s*a
(%{0,2}
                              (?!\d)[\w*]+            # Variable name
                              (\.(?!\d)[\w*]+)*       # .etc.etc
                              )
                              (\?\??)$                # ? or ??
                              c�J�t|�j}t�}	tj|�D]}|j|d��	|S#t$rG}d|jdvr|jt�n|jt�Yd}~|Sd}~wwxYw)z5Helper for has_comment and ends_in_comment_or_string.rzmulti-line stringN)
r�readline�setrrL�addr�args�_MULTILINE_STRING�_MULTILINE_STRUCTURE)rr��toktypesra�es     r�_line_tokensr�+s�����~�&�&�H��u�H�/��7�7��A�	�A��L�L��1���	��O��
�/��!�&�&��)�+��L�L�*�+��L�L�-�.���O��
/�s�.A�	B"�<B�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.
    )rY�COMMENTr�)�srcs rrtrt:s��
����S� 1�1�2rc�P�t|�}tj|vxst|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�rYr�r�)r�r�s  r�ends_in_comment_or_stringr�Ks*���C� �H�����(�L�.?�8�.K�Lrc��tj|�}|�t|�r|S|jd�}|jd�}tj|�}|�J�|jd�}t
|||�S)z$Translate lines with ?/?? at the endr��r)�_help_end_re�searchr��group�_initial_space_re�matchr�)r�mrwrxr�rys      r�help_endr�]sx��	���D�!�A��y�-�d�3���
�W�W�Q�Z�F�
�'�'�!�*�C��#�#�D�)�E�����
�[�[��^�F��6�3��/�/r�end_on_blank_linec#��K�d}tjd�}d}	|��}|s|��}|s�|jt�s
|�|��}|���-|j	|�r�?|}g}d��}|�C|j�dk7s|s.|j
|�d��}|�|j�dk7r�+|s�.|jd�\}}}|jt�}|||dj|�fz}�ͭw)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+\?rgNr�rQ)
�re�compiler�r�r�r�rWr�r�rh)r�r��cellmagic_help_rer�first�body�
magic_namer�s        r�	cellmagicr�ls����5�C��
�
�:�.��
�D�
��
����J�D�����z�*��"�"�
���"���"�"�4�(�������
����"&�*�*�,�"�"4�=N��K�K����J�D���"&�*�*�,�"�"4�=N�
 %���s�3��
�A�u��&�&�z�2�
��j�%����D�)9�:�:��7�s�'C*�C*�AC*�%C*�(AC*c#�*K�|�|}d}	|��}|��|jd|d��\}}|r|s|j|�r
|�|��}|���>|��}|��E|jd|d��\}}|��}|s|r|�#|jd|d����}|��n	|�|��}|�����w)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.
    rgr�)�count)�subnr��sub)�	prompt_re�
initial_re�
turnoff_rer�out�n1�n2s       r�_strip_promptsr��s�����(���
�
�D�
��
���<���/�/�"�d�!�/�4���R��b�����%��&�"&�J�D��&���	���<���.�.��T��.�3���R��	��
���"�'�m�m�B��A�m�>�>���"�
�"�"�
���"�C�s�AB�AB�	B�Bc��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��s>���
�
�0�1�I����L�)�J����H�%�J��)�Z��<�<rc�p�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��s.���
�
�:�;�I����F�#�J��)�
�;�;rc#�K�tjd�}d}	|��}|��|j|�}|r:|jd�}|�0|j	|�r|t|�d}|��}|��&n	|�|��}|���^�w)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]+rgNr)r�r�r�r�r��len)�space_rerr��spaces    r�leading_indentr��s������z�z�*�%�H�
�D�
��
���<���N�N�4� ����G�G�A�J�E��"��?�?�5�)���E�
��,�D�"�
���"��"�"�
���"��s�A+A9�.	A9�8A9z�(?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�f�tj|�}|�|St|jdd�zS)z<Transform assignment from system commands (e.g. files = !ls)�lhsr�)�assign_system_rer��assign_system_templater�)rr�s  r�assign_from_systemr�s4��	���t�$�A��y���!�A�G�G�E�5�$9�9�9rz{}%\s*(?P<cmd>.*)z)%s = get_ipython().run_line_magic(%r, %r)c���tj|�}|�|S|jdd�\}}|jd�\}}}|j	t
�}t|||fzS)z;Transform assignment from magic commands (e.g. a = %who_ls)r�r�r�)�assign_magic_rer�r�r�r�r��assign_magic_template)rr��m_lhs�m_cmdr�r�r�s       r�assign_from_magicr�si��	���d�#�A��y����7�7�5�%�(�L�E�5�%*�_�_�S�%9�"�L�!�]��&�&�y�1�L� �E�<��#G�G�Gr)F)NN)Cr)r*r#r�rYrr�ior�IPython.core.splitinputr�
IPython.utilsrr��
ESC_SH_CAP�ESC_HELP�	ESC_HELP2r�r��	ESC_QUOTE�
ESC_QUOTE2�	ESC_PAREN�
ESC_SEQUENCES�ABCMetarr/r<rFrjr%rv�strr�r�r�r�r�r�r�r�r�r�r�r��VERBOSEr��objectr�r�r�rtr�r��boolr�r�r�r�r��_assign_patr5r�r�r�r�r�r�rrr�<module>rs�����	��+��,�#��	�
�
�
��
�	�
�	�
�
�
�	�
�
�
�	��J���I�z��J�	�4�
�
!#����!#�F
� 0�
�"$� 0�$�.0"�,�0"�d�1������ ��*�C��c��3��3��$?�(�?�B�8�B�I��I�	>��	>�C��C�/�(�/�@��@�
�J��K��H��H��I��I��J��I� �����$�3�$� �$��B�J�J�v�&���r�z�z�"�!�j�j�
*���H���x��
�3�"M�$���0�3�0� �0����$;��$;� �$;�N9$�v���=� �=����<� �<����$� �$�8���2�:�:�2�9�9�+�F��
�
�S��;�����:� �:��"�*�*�1�8�8��E�r�z�z�R��C�����	H� �	Hr

Youez - 2016 - github.com/yon3zu
LinuXploit