%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /opt/alt/python37/lib/python3.7/site-packages/nose/__pycache__/
Upload File :
Create Path :
Current File : //opt/alt/python37/lib/python3.7/site-packages/nose/__pycache__/inspector.cpython-37.pyc

B

9�`?�@s�dZddlZddlZddlZddlZddlZddlZyddlmZWn e	k
rdddlmZYnXe�
e�Zdd�Z
d
dd�Zd	d
�ZGdd�d�ZdS)z�Simple traceback introspection. Used to add additional information to
AssertionErrors in tests, so that failure messages may be more informative.
�N)�StringIOc
Cs\t�d|�x|jr|j}qW|j}t|�\}}t||�\}}tt�d�	|���}t
|j|j�}x�|r�y"xt
�|j�D]}||�qvWWnft
jk
r�}	zFt�d|	�|�d�|d8}tt�d�	|���}t
|j|j�}wbWdd}	~	XYnXPqbWg}
|j�rR|j�d�}d}x>|D]6}
||k�r6|
�d|
�n|
�d	|
�|d7}�qWd�	|
�S)
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�linesZexc_lineZ
inspect_linesZ	mark_line�srcZexp�tok�eZpaddedZ	exp_linesZep�line�r!�?/opt/alt/python37/lib/python3.7/site-packages/nose/inspector.py�inspect_tracebacks<



r#�c	Cs|j}|j}|dkr�|d|d}t�d||�yt�|�\}}Wn tk
rddgd}}Yn�X|}t|d�}tdt|t	|�|��}||||�}|d|}t
jdkr�|dkr�x@||d���
d�r�|d8}||||�}q�Wndgd}}t�d||�||fS)	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: %sr)r%��\z'tbsource lines '''%s''' around index %s)�	tb_linenor	rr�inspectZ
findsource�IOError�max�min�len�sys�version_info�strip�endswith)	r�context�linenor�startrZdummy�indexZ	all_linesr!r!r"r
As*
r
c
Cs6t�d�}t�d�}t�d�}g}||}|�|���d}|t|dd�|�}|��||dt|dt|���}	x0|D](}
|�|
���d|kr�|�|
�q~Pq~W|��|�|�t|�d}|�	|�}xL|	D]D}
|s�|�|
���d|k�r|�	|
��s|�|
�|�	|
�}q�Pq�Wt
�d||�||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�groupsr+�reverser,r-r�searchrr)
r�posZcntZdfZindZ	toinspect�homeZhome_indentZbeforeZafterr Zhome_pos�	continuedr!r!r"rms2	







rc@s eZdZdZdd�Zdd�ZdS)rzxSimple expression expander. Uses tokenize to find the names and
    expands any that can be looked up in the frame.
    cCs||_||_d|_d|_dS)Nr)�locals�globals�lposr)�selfrArBr!r!r"�__init__�szExpander.__init__cCs>|jdk	rZ|d|jkr6|jd|d|j7_n$|d|jkrZ|jd|d7_|d|_|tjkrpn�|tjk�ry$|j|}t|�r�|}nt|�}WnRtk
r�y$|j	|}t|�r�|}nt|�}Wntk
r�|}YnXYnX|j|7_n|j|7_t
�d||dd���r:|jd7_dS)Nr� z\s+\\\nz \
)rCrr�INDENT�NAMErA�callable�repr�KeyErrorrBr8r:)rDZttyperr4�endr �valr!r!r"�__call__�s4




zExpander.__call__N)�__name__�
__module__�__qualname__�__doc__rErNr!r!r!r"r�sr)r$)rRr)Zloggingr8r.rr�ior�ImportErrorZ	getLoggerrOrr#r
rrr!r!r!r"�<module>s
/
,(

Zerion Mini Shell 1.0