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 :  /usr/lib/python3/dist-packages/IPython/testing/plugin/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3/dist-packages/IPython/testing/plugin/__pycache__/ipdoctest.cpython-312.pyc
�

}�ei.��H�dZddlZddlZddlZddlmZeje�ZGd�dej�Z	Gd�dej�ZGd�d	ej�Z
Gd
�dej�Zej d�ZGd
�dej$e�Zy)a�Nose Plugin that supports IPython doctests.

Limitations:

- When generating examples for use as doctests, make sure that you have
  pretty-printing OFF.  This can be done either by setting the
  ``PlainTextFormatter.pprint`` option in your configuration file to  False, or
  by interactively disabling it with  %Pprint.  This is required so that IPython
  output matches that of normal Python, which is used by doctest for internal
  execution.

- Do not rely on specific prompt numbers for results (such as using
  '_34==True', for example).  For IPython tests run via an external process the
  prompt numbers may be different, and IPython tests run as normal python code
  won't even have these special _NN variables set at all.
�N)�modified_envc���eZdZ�fd�Z�xZS)�
DocTestFinderc���t�|�|||||�}tt|dd��r0|�.|jD]}d|j
tj<�!|S)N�__skip_doctest__FT)�super�	_get_test�bool�getattr�examples�options�doctest�SKIP)	�self�obj�name�module�globs�source_lines�test�example�	__class__s	        ��B/usr/lib/python3/dist-packages/IPython/testing/plugin/ipdoctest.pyr	zDocTestFinder._get_test)s]����w� ��d�F�E�<�H�����/��7�8�T�=M��=�=�
5��04�������-�
5���)�__name__�
__module__�__qualname__r	�
__classcell__�rs@rrr(s
����rrc�:�eZdZdZej
d�Zd�Zy)�IPDoctestOutputCheckerz�Second-chance checker with support for random tests.

    If the default comparison doesn't pass, this checker looks in the expected
    output string for flags that tell us to ignore the output.
    z
#\s*random\s+c��tjj||||�}|s|jj	|�ry|S)z�Check output, accepting special markers embedded in the output.

        If the output didn't pass the default validation but the special string
        '#random' is included, we accept it.T)r�
OutputChecker�check_output�	random_re�search)r�want�got�optionflags�rets     rr$z#IPDoctestOutputChecker.check_output<s?���#�#�0�0��t�S�1<�>���t�~�~�,�,�T�2���
rN)rrr�__doc__�re�compiler%r$�rrr!r!3s�����
�
�+�,�I�rr!c��eZdZy)�	IPExampleN)rrrr.rrr0r0Os�rr0c�(�eZdZdZdZdZdZdZdZe	jeeeeefze	je	jz�Z
e	jeeeeefze	je	jz�Ze	jd�Zd�Zd
d	�Zdd
�Zd�Zy)�IPDocTestParserz�
    A class used to parse strings containing doctest examples.

    Note: This is a version modified to properly recognize IPython input and
    convert any IPython examples into valid Python ones.
    z>>>z\.\.\.zIn\ \[\d+\]:z\ \ \ \.\.\.+:a]
        # Source consists of a PS1 line followed by zero or more PS2 lines.
        (?P<source>
            (?:^(?P<indent> [ ]*) (?P<ps1> %s) .*)    # PS1 line
            (?:\n           [ ]*  (?P<ps2> %s) .*)*)  # PS2 lines
        \n? # a newline
        # Want consists of any non-blank lines that do not start with PS1.
        (?P<want> (?:(?![ ]*$)    # Not a blank line
                     (?![ ]*%s)   # Not a line starting with PS1
                     (?![ ]*%s)   # Not a line starting with PS2
                     .*$\n?       # But any other line
                  )*)
                  z#\s*all-random\s+c��tjj|�}t|j	��dk(rtj|�S|S)z/Convert input IPython source into valid Python.�)�_ip�input_transformer_manager�transform_cell�len�
splitlines�	prefilter)r�source�blocks   r�ip2pyzIPDocTestParser.ip2pysB���-�-�<�<�V�D���u���!�"�a�'��=�=��'�'��Lrc���|j�}|j|�}|dkDr1dj|jd�D�cgc]}||d��	c}�}g}d\}}|jj|�rd}nd}d}	t
|jj|��}
|
rtj}n,t
|jj|��}
t}d}	|
D]�}|j|||j��||jd||j��z
}|j!||||	�\}
}}}||z
}|j#|
�s8|j||
||||t%|j'd	��z|�
��||jd|j�|j)��z
}|j)�}��|j||d�|Scc}w)a=
        Divide the given string into examples and intervening text,
        and return them as a list of alternating Examples and strings.
        Line numbers for the Examples are 0-based.  The optional
        argument `name` is a name identifying this string, and is only
        used for error messages.
        r�
N)rrz	
# random�FT�indent)�linenorAr
)�
expandtabs�_min_indent�join�split�_RANDOM_TESTr&�list�_EXAMPLE_RE_PY�finditerr�Example�_EXAMPLE_RE_IPr0�append�start�count�_parse_example�_IS_BLANK_OR_COMMENTr8�group�end)r�stringr�
min_indent�l�output�charnorB�
random_markerr=�termsrK�mr;r
r'�exc_msgs                 r�parsezIPDocTestParser.parse�s����"�"�$���%�%�f�-�
���>��Y�Y����T�8J�K�1��*�+��K�L�F����������#�#�F�+�(�M��M����T�(�(�1�1�&�9�:����o�o�G���,�,�5�5�f�=�>�E��G��E��	�A��M�M�&�����	�2�3��f�l�l�4������;�;�F��(�(��D�&��?�
-�V�W�d�G�

�M�!�D��,�,�V�4��
�
�g�f�d�G�-3�-7��A�G�G�H�<M�8N�-N�.5�7�8�

�f�l�l�4�����A�E�E�G�<�<�F��U�U�W�F�-	�0	�
�
�f�V�W�o�&��
��g Ls�G0c	��t|jd��}|jd�jd�}|jd�}|jd�}t|�}	|j|||||	�|r|j	|ddd|z|z||�dj|D�
cgc]
}
|
||	zdzd��c}
�}|r|j
|�}|jd	�}|jd�}
t|
�dkDrtjd
|
d�r|
d=|j	|
d|z||t|�z�tjdd
|
d�|
d<dj|
D�cgc]}||d��	c}�}|jj|�}|r|jd�}nd}|j|||�}||||fScc}
wcc}w)a7
        Given a regular expression match from `_EXAMPLE_RE` (`m`),
        return a pair `(source, want)`, where `source` is the matched
        example's source code (with prompts and indentation stripped);
        and `want` is the example's expected output (with indentation
        stripped).

        `name` is the string's name, and `lineno` is the line number
        where the example starts; both are used for error messages.

        Optional:
        `ip2py`: if true, filter the input via IPython to convert the syntax
        into valid python.
        rAr;r?�ps1�ps2r4N� r'z *$���zOut\[\d+\]: \s*?\n?r@r�msg)r8rRrF�_check_prompt_blank�
_check_prefixrEr=r,�match�sub�
_EXCEPTION_RE�
_find_options)rr[rrBr=rArr_r`�ps1_len�slr;r'�
want_lines�wlr\r
s                 rrPzIPDocTestParser._parse_example�s���"�Q�W�W�X�&�'���w�w�x�(�.�.�t�4���g�g�e�n���g�g�e�n���c�(��� � ��v�t�V�G�L�����|�A�B�/��V��c�1A�4��P����L�I�b�B�v�g�~�a�/�0�1�I�J����Z�Z��'�F�
�w�w�v����Z�Z��%�
��z�?�Q��2�8�8�F�J�r�N�#C��2�����:�s�6�z�4�!�C��$5�5�	7����5�b��A��G�
�1�
��y�y�
�;�"�"�V�W�+�;�<��
���$�$�T�*����g�g�e�n�G��G��$�$�V�T�6�:���w��g�-�-��?J��&<s�+G�2Gc��||z}|dz}t|�D]<\}}	t|	�|k\s�|	|dk7s�td||zdz�d|�d|	||�d|	����y)a�
        Given the lines of a source string (including prompts and
        leading indentation), check to make sure that every prompt is
        followed by a space character.  If any line is not followed by
        a space character, then raise ValueError.

        Note: IPython-modified version which takes the input prompt length as a
        parameter, so that prompts of variable length can be dealt with.
        r4razline z of the docstring for z lacks blank after z: N)�	enumerater8�
ValueError)
r�linesrArrBrj�	space_idx�min_len�i�lines
          rrdz#IPDocTestParser._check_prompt_blanksu���7�N�	��A�+�� ��'�	A�G�A�t��4�y�W�$��i��C�)?� �"(��(�1�*�d�"&�v�i�"8�$�"@�A�A�	ArN)z<string>)F)rrrr+�_PS1_PY�_PS2_PY�_PS1_IP�_PS2_IP�_RE_TPLr,r-�	MULTILINE�VERBOSErIrLrGr=r]rPrdr.rrr2r2Rs�����G��G��G��G��G� �R�Z�Z��G�G�G�G�+L�!L�!#����
�
�!:�<�N� �R�Z�Z��G�G�G�G�+L�!L�!#����
�
�!:�<�N��2�:�:�2�3�L��B�H?.�BArr2rc�$��eZdZdZd�fd�	Z�xZS)�IPDocTestRunnerzKTest runner that synchronizes the IPython namespace with test globals.
    c�x��tddd��5tt|�||||�cddd�S#1swYyxYw)N�80�24)�COLUMNS�LINES)rrr~�run)rr�compileflags�out�clear_globsrs     �rr�zIPDocTestRunner.run'sB���
�d�T�:�
;�	Q����2�4�3?��K�Q�	Q�	Q�	Q�s�0�9)NNT)rrrr+r�rrs@rr~r~#s����Q�Qrr~)r+r�loggingr,�testpathr�	getLoggerr�logrr#r!rKr0�
DocTestParserr2�register_optionflagr�
DocTestRunner�objectr~r.rr�<module>r�s����*��	�!��g����!���G�)�)���W�2�2��8'����&�KA�g�+�+�KA�\#�w�"�"�6�*��Q�g�+�+�F�Qr

Youez - 2016 - github.com/yon3zu
LinuXploit