관리-도구
편집 파일: inspector.cpython-37.pyc
B /�Se? � @ s� d Z ddlZddlZddlZddlZddlZddlZyddlmZ W n e k rd ddlmZ Y nX e� e�Zdd� Z d dd�Zd d � ZG dd� 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 C s\ t �d| � x| jr| j} qW | j}t| �\}}t||�\}}tt�d� |���}t |j|j�}x�|r�y"xt �|j�D ]}||� qvW W nf t jk r� } zFt �d| � |�d� |d8 }tt�d� |���}t |j|j�}wbW dd} ~ X Y nX P qbW g } |j�rR|j�d�}d}x>|D ]6} ||k�r6| �d| � n| �d | � |d7 }�qW d� | �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�src�exp�tok�eZpaddedZ exp_lines�ep�line� r# �?/opt/alt/python37/lib/python3.7/site-packages/nose/inspector.py�inspect_traceback s<