관리-도구
편집 파일: inspector.cpython-38.pyc
U )�e� � @ s� d Z ddlZddlZddlZddlZddlZddlZddlZzddlm Z W n e k rl ddlm Z Y nX e�e�Z dd� Zd 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 sR t �d| � | jr| j} q| j}t| �\}}t||�\}}tt�d� |���}t |j|j�}|r�zt �|j�D ]}||� qnW q� t jk r� } zLt �d| � |�d� |d8 }tt�d� |���}t |j|j�}W Y �q\W 5 d} ~ X Y q�X q�q\g } |j�rH|j�d�}d}|D ]6} ||k�r.| �d| � n| �d | � |d7 }�qd� | �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�e�paddedZ exp_lines�ep�line� r$ �</opt/hc_python/lib/python3.8/site-packages/nose/inspector.py�inspect_traceback s<