Your IP : 3.129.216.248


Current Path : /opt/alt/python34/lib64/python3.4/__pycache__/
Upload File :
Current File : //opt/alt/python34/lib64/python3.4/__pycache__/traceback.cpython-34.pyo

�
i f�+�@s�dZddlZddlZddlZddddddd	d
ddd
dddgZdd�Zddd�Zdd�Zdd�Zdd�Z	dddd�Z
ddd	�Zddd�ZdZ
dZdddd �Zd!d"�Zddd#d$d�Zdd#d%d�Zd&d�Zd'd(�Zd)d*�Zd+d,�Zddd#d-d
�Zdd#d.d�Zddd#d/d
�Zdd0d1�Zd2d3�Zdddd4d�Zddd5d�Zddd6d�Zd7d�ZdS)8z@Extract, format and print information about Python stack traces.�N�
extract_stack�
extract_tb�format_exception�format_exception_only�format_list�format_stack�	format_tb�	print_exc�
format_exc�print_exception�
print_last�print_stack�print_tb�clear_framesccs]xV|D]N\}}}}dj|||�}|rP|dj|j��}n|VqWdS)Nz  File "{}", line {}, in {}
z    {}
)�format�strip)�extracted_list�filename�lineno�name�line�item�r�./opt/alt/python34/lib64/python3.4/traceback.py�_format_list_iters
rcCsI|dkrtj}nx*t|�D]}t|d|dd�q%WdS)zyPrint the list of tuples as returned by extract_tb() or
    extract_stack() as a formatted stack trace to the given file.N�file�end�)�sys�stderrr�print)rrrrrr�
print_listsr!cCstt|��S)a�Format a list of traceback entry tuples for printing.

    Given a list of tuples as returned by extract_tb() or
    extract_stack(), return a list of strings ready for printing.
    Each string in the resulting list corresponds to the item with the
    same index in the argument list.  Each string ends in a newline;
    the strings may contain internal newlines as well, for those items
    whose source text line is not None.
    )�listr)rrrrr s
ccs�|dkr!ttdd�}nd}x�|dk	r�|dksN||kr�||�\}}}|j}|j}|j}	tj|�tj|||j�}
|
r�|
j	�}
nd}
|||	|
fV|}|d7}q*WdS)N�tracebacklimitr�)
�getattrr�f_code�co_filename�co_name�	linecache�
checkcache�getline�	f_globalsr)�curr�limit�	extractor�n�fr�	next_item�corrrrrr�_extract_tb_or_stack_iter5s '			
r4cCst||tjddd��S)N�tb_frame�	tb_lineno�tb_next)r4�operator�
attrgetter)�tbr.rrr�_extract_tb_iterLsr;cCs tt|d|�d|�dS)aPrint up to 'limit' stack trace entries from the traceback 'tb'.

    If 'limit' is omitted or None, all entries are printed.  If 'file'
    is omitted or None, the output goes to sys.stderr; otherwise
    'file' should be an open file or file-like object with a write()
    method.
    r.rN)r!r)r:r.rrrrrQscCstt|d|��S)z5A shorthand for 'format_list(extract_tb(tb, limit))'.r.)rr)r:r.rrrr[scCstt|d|��S)a�Return list of up to limit pre-processed entries from traceback.

    This is useful for alternate formatting of stack traces.  If
    'limit' is omitted or None, all entries are extracted.  A
    pre-processed stack trace entry is a quadruple (filename, line
    number, function name, text) representing the information that is
    usually printed for a stack trace.  The text is a string with
    leading and trailing whitespace stripped; if the source is not
    available it is None.
    r.)r"r;)r:r.rrrr_szF
The above exception was the direct cause of the following exception:
zE
During handling of the above exception, another exception occurred:
ccs|dkrt�}n|j|�g}|j}|j}|dk	r�||kr�|jt|d|��|jtdfg�nT|dk	r�|jr�||kr�|jt|d|��|jtdfg�n|j||p�|j	fg�x|D]}|DdHqWdS)NF)
�set�add�__context__�	__cause__�append�_iter_chain�_cause_message�__suppress_context__�_context_message�
__traceback__)�exc�	custom_tb�seen�its�context�cause�itrrrrAxs"
		

rAccs�|rt||�}n||fg}xs|D]k\}}t|t�rX|dVq.n|r�dVtt|d|��DdHntt|�|�DdHq.WdS)N�
z#Traceback (most recent call last):
r.)rA�
isinstance�strrr;�_format_exception_only_iter�type)�etype�valuer:r.�chain�valuesrrr�_format_exception_iter�s	rVTcCsU|dkrtj}nx6t|||||�D]}t|d|dd�q1WdS)a�Print exception up to 'limit' stack trace entries from 'tb' to 'file'.

    This differs from print_tb() in the following ways: (1) if
    traceback is not None, it prints a header "Traceback (most recent
    call last):"; (2) it prints the exception type and value after the
    stack trace; (3) if type is SyntaxError and value has the
    appropriate format, it prints the line where the syntax error
    occurred with a caret on the next line indicating the approximate
    position of the error.
    Nrrr)rrrVr )rRrSr:r.rrTrrrrr�scCstt|||||��S)azFormat a stack trace and the exception information.

    The arguments have the same meaning as the corresponding arguments
    to print_exception().  The return value is a list of strings, each
    ending in a newline and some containing internal newlines.  When
    these lines are concatenated and printed, exactly the same text is
    printed as does print_exception().
    )r"rV)rRrSr:r.rTrrrr�s	cCstt||��S)aFormat the exception part of a traceback.

    The arguments are the exception type and value such as given by
    sys.last_type and sys.last_value. The return value is a list of
    strings, each ending in a newline.

    Normally, the list contains a single string; however, for
    SyntaxError exceptions, it contains several lines that (when
    printed) display detailed information about where the syntax
    error occurred.

    The message indicating which exception occurred is always the last
    string in the list.

    )r"rP)rRrSrrrr�sc
css|dkrt||�VdS|j}|j}|dkrM|d|}nt|t�snt||�VdS|jpzd}t|j�p�d}dj||�V|j	}|j
}|dk	rOdj|j��V|dk	rO|jd�}t
t|�|�d	}|d|�j�}d
d�|D�}djd
j|��VqOn|jp[d}	dj||	�VdS)N�__main__�builtins�.z<string>�?z  File "{}", line {}
z    {}
rMr$css'|]}|j�r|pdVqdS)� N)�isspace)�.0�crrr�	<genexpr>�sz._format_exception_only_iter.<locals>.<genexpr>z    {}^
rz<no detail available>z{}: {}
)z__main__zbuiltins)�_format_final_exc_line�__name__�
__module__�
issubclass�SyntaxErrorrrOrr�text�offsetr�rstrip�min�len�lstrip�join�msg)
rRrS�stype�smodrr�badlinerf�
caretspacerlrrrrP�s2				rPcCs@t|�}|dks|r,d|}nd||f}|S)Nz%s
z%s: %s
)�	_some_str)rRrS�valuestrrrrrr`�s

r`c	Cs.yt|�SWndt|�jSYnXdS)Nz<unprintable %s object>)rOrQra)rSrrrrq�srqcCs&td|d|d|tj��dS)z>Shorthand for 'print_exception(*sys.exc_info(), limit, file)'.r.rrTN)rr�exc_info)r.rrTrrrr	�scCs%djtd|d|tj���S)z%Like print_exc() but return a string.rr.rT)rkrrrs)r.rTrrrr
�scCsDttd�std��nttjtjtj|||�dS)znThis is a shorthand for 'print_exception(sys.last_type,
    sys.last_value, sys.last_traceback, limit, file)'.�	last_typezno last exceptionN)�hasattrr�
ValueErrorrrt�
last_value�last_traceback)r.rrTrrrrscCst||dd��S)NcSs||j|jfS)N)�f_lineno�f_back)r1rrr�<lambda>sz%_extract_stack_iter.<locals>.<lambda>)r4)r1r.rrr�_extract_stack_itersr|cCs%|dkr!tj�jj}n|S)N)r�	_getframerz)r1rrr�
_get_stacksr~cCs&ttt|�d|�d|�dS)z�Print a stack trace from its invocation point.

    The optional 'f' argument can be used to specify an alternate
    stack frame at which to start. The optional 'limit' and 'file'
    arguments have the same meaning as for print_exception().
    r.rN)r!rr~)r1r.rrrrr
scCsttt|�d|��S)z5Shorthand for 'format_list(extract_stack(f, limit))'.r.)rrr~)r1r.rrrr scCs,ttt|�d|��}|j�|S)asExtract the raw traceback from the current stack frame.

    The return value has the same format as for extract_tb().  The
    optional 'f' and 'limit' arguments have the same meaning as for
    print_stack().  Each item in the list is a quadruple (filename,
    line number, function name, text), and the entries are in order
    from oldest to newest stack frame.
    r.)r"r|r~�reverse)r1r.�stackrrrr$s	
cCsFx?|dk	rAy|jj�Wntk
r4YnX|j}qWdS)zEClear all references to local variables in the frames of a traceback.N)r5�clear�RuntimeErrorr7)r:rrrr1s
) �__doc__r)rr8�__all__rr!rr4r;rrrrBrDrArVrrrrPr`rqr	r
rr|r~r
rrrrrrr�<module>sF				
#	

?>