PK APOCALYPSE V1

APOCALYPSE V1

Current Path : /opt/hc_python/lib/python3.12/site-packages/nose/__pycache__/
Upload File :
Current File : //opt/hc_python/lib/python3.12/site-packages/nose/__pycache__/inspector.cpython-312.pyc

�

���g����dZddlZddlZddlZddlZddlZddlZddlZ	ddlm	Z	eje�Z
d�Zd	d�Zd�ZGd�d�Zy#e
$r	ddlm	Z	Y�4wxYw)
z�Simple traceback introspection. Used to add additional information to
AssertionErrors in tests, so that failure messages may be more informative.
�N)�StringIOc���tjd|�|jr|j}|jr�|j}t	|�\}}t||�\}}t
tjdj|���}t|j|j�}|r,	tj|j�D]}||��			g}
|j$rW|j$j'd�}d}|D]5}
||k(r|
j)d|
z�n|
j)d	|
z�|dz
}�7dj|
�S#tj $r�}	tjd|	�|j#d�|dz}t
tjdj|���}t|j|j�}Yd}	~	��6d}	~	wwxYw)
z�Inspect a traceback and its frame, returning source for the expression
    where the exception was raised, with simple variable replacement performed
    and the line on which the exception was raised marked with '>>'
    zinspect traceback %s�zTokenizer error: %sr�N�
z>>  z    )�log�debug�tb_next�tb_frame�tbsource�find_inspectable_linesr�textwrap�dedent�join�Expander�f_locals�	f_globals�tokenize�generate_tokens�readline�
TokenError�pop�expanded_source�split�append)�tb�frame�lines�exc_line�
inspect_lines�	mark_line�src�exp�tok�e�padded�	exp_lines�ep�lines              �=/opt/hc_python/lib/python3.12/site-packages/nose/inspector.py�inspect_tracebackr+s���
�I�I�$�b�)�
�*�*�
�Z�Z��
�*�*�
�K�K�E��r�l�O�E�8� 6�e�X�F��M�9�
�8�?�?�2�7�7�=�#9�:�
;�C�
�5�>�>�5�?�?�
3�C�
�	��/�/����=���S�	�>�	�
�F�
����'�'�-�-�d�3�	�
���D��Y���
�
�f�t�m�,��
�
�f�t�m�,��!�G�B���9�9�V����+�"�"�		�
�I�I�+�Q�/����a� ���N�I��8�?�?�2�7�7�=�+A�B�C�C��5�>�>�5�?�?�;�C���		�s�5)E�G-�)A9G(�(G-c	�|�|j}|j}|dkDr�|dz
|dzz
}tjd||�	t	j
|�\}}|}t
|d�}t
dt|t|�|z
��}||||z}|dz
|z
}tjdk\rc|dkDr^||dz
j�jd�r9|dz}||||z}||dz
j�jd�r�3ndgd}}tjd||�||fS#t$rdgd}}Y�+wxYw)	aGet source from  a traceback object.

    A tuple of two things is returned: a list of lines of context from
    the source code, and the index of the current line within that list.
    The optional second argument specifies the number of lines of context
    to return, which are centered around the current line.

    .. Note ::
       This is adapted from inspect.py in the python 2.4 standard library, 
       since a bug in the 2.3 version of inspect prevents it from correctly
       locating source lines in a traceback frame.
    rr�zlineno: %s start: %s)r-��\rz'tbsource lines '''%s''' around index %s)�	tb_linenorrr	�inspect�
findsource�max�min�len�sys�version_info�strip�endswith�IOError)	r�context�linenor�startr�dummy�	all_lines�indexs	         r*rrBsX���\�\�F��K�K�E���{���
�W�a�Z�'���	�	�(�&�%�8�	;�"�-�-�e�4�L�E�5��I���q�M�E���3�u�c�%�j�7�&:�;�<�E��%��g�
�.�E��Q�J��&�E����6�)�e�a�i��E�!�G�n�*�*�,�5�5�d�;��Q�J�E�%�e�E�'�M�:�E��E�!�G�n�*�*�,�5�5�d�;��t�Q�u���I�I�7���F��5�>���%�	#��4��5�E�	#�s�D*�*D;�:D;c�L�tjd�}tjd�}tjd�}g}||}|j|�j�d}|t	|dz
d�|}|j�||dzt
|dzt|��}	|D]:}
|j|
�j�d|k(r|j|
��:n|j�|j|�t|�dz
}|j|�}|	D]^}
|s%|j|
�j�d|k(r4|j|
�s#|j|
�|j|
�}�^ntjd||�||fS)	a'Find lines in home that are inspectable.
    
    Walk back from the err line up to 3 lines, but don't walk back over
    changes in indent level.

    Walk forward up to 3 lines, counting \ separated lines as 1. Don't walk
    over changes in indent level (unless part of an extended line)
    z
\\[\s\n]*$z	:[\s\n]*$z^(\s*)r�r�z#Inspecting lines '''%s''' around %s)�re�compile�match�groupsr3�reverser4r5r�searchrr	)
r�pos�cnt�df�ind�	toinspect�home�home_indent�before�afterr)�home_pos�	continueds
             r*r
r
nsy��
�*�*�]�
#�C�	���L�	!�B�
�*�*�Y�
�C��I���:�D��)�)�D�/�(�(�*�1�-�K�
�3�s�1�u�a�=��
%�F�
�N�N���#�a�%��C��E�3�u�:�.�/�E����9�9�T�?�!�!�#�A�&�+�5����T�"��	�
����
���T���9�~�a��H��
�
�4� �I���
�#�)�)�D�/�0�0�2�1�5��D��I�I�d�O����T�"��
�
�4�(�I��
��I�I�3�Y��I��h���c��eZdZdZd�Zd�Zy)rzxSimple expression expander. Uses tokenize to find the names and
    expands any that can be looked up in the frame.
    c�<�||_||_d|_d|_y)Nr)�locals�globals�lposr)�selfrXrYs   r*�__init__zExpander.__init__�s����������	�!��rUc�*�|j�h|d|jk\r)|xjd|d|jz
zz
c_n-|d|jkr|xjd|dzz
c_|d|_|tjk(rnv|tjk(rN	|j
|}t
|tj�r|}nt|�}|xj|z
c_n|xj|z
c_tjd||dd�r|xjdz
c_yy#t$rM	|j|}t
|tj�r|}nt|�}n#t$r|}YnwxYwY��wxYw)Nr� z\s+\\\nz \
)rZrr�INDENT�NAMErX�
isinstance�collections�Callable�repr�KeyErrorrYrDrF)r[�ttyper$r=�endr)�vals       r*�__call__zExpander.__call__�sk���9�9� ��Q�x�4�9�9�$��$�$��u�Q�x��	�	�/A�(B�B�$��q��D�I�I�%��$�$��e�A�h��6�$���F��	��H�O�O�#��
�h�m�m�
#�
��k�k�#�&���c�;�#7�#7�8��C��s�)�C�
� � �C�'� �� � �C�'� ��8�8�J��S��V�W�
�.�� � �G�+� �/��%�	
���,�,�s�+�C�!�#�{�';�';�<�!��"�3�i������C���	
�s6�'7D<�<	F�7E>�=F�>F�	F�F�F�FN)�__name__�
__module__�__qualname__�__doc__r\ri�rUr*rr�s���"�0,rUr)�)rmr1�loggingrDr6rrrb�ior�ImportError�	getLoggerrjrr+rr
rrnrUr*�<module>rtsn�����	�
�������g����!��,�^)�X%�P:,�:,��Q����s�A
�
A�A

if you don't want to be vaporized in a nuclear explosion, i simply have to become nuclear myself… i am atomic