AlkantarClanX12

Your IP : 3.16.135.226


Current Path : /proc/self/root/opt/alt/python39/lib64/python3.9/__pycache__/
Upload File :
Current File : //proc/self/root/opt/alt/python39/lib64/python3.9/__pycache__/traceback.cpython-39.opt-1.pyc

a

R�fT`�@sdZddlZddlZddlZddlZgd�Zd4dd�Zdd�Zd5dd	�Zd6d
d�Z	d7dd
�Z
dZdZd8dd�Z
d9dd�Zdd�Zdd�Zdd�Zd:dd�Zd;dd�Zd<dd �Zd=d!d"�Zd>d#d$�Zd?d%d&�Zd'd(�ZGd)d*�d*�Zd+d,�Zd-d.�Zd/ZGd0d1�d1e�ZGd2d3�d3�ZdS)@z@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_frames�FrameSummary�StackSummary�TracebackException�
walk_stack�walk_tbcCs4|durtj}t�|���D]}t||dd�qdS)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�	from_list�format�print)�extracted_listr�item�r �./opt/alt/python39/lib64/python3.9/traceback.py�
print_listsr"cCst�|���S)a�Format a list of tuples or FrameSummary objects for printing.

    Given a list of tuples or FrameSummary objects 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.
    )rrr)rr r r!rsrcCstt||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.
    ��limit�rN)r"r)�tbr$rr r r!r-srcCst||d���S)z5A shorthand for 'format_list(extract_tb(tb, limit))'.r#)rr�r&r$r r r!r7srcCstjt|�|d�S)a#
    Return a StackSummary object representing a list of
    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 FrameSummary object
    containing attributes filename, lineno, name, and line
    representing the information that is usually printed for a stack
    trace.  The line is a string with leading and trailing
    whitespace stripped; if the source is not available it is None.
    r#)r�extractrr'r r r!r;s
rzG
The above exception was the direct cause of the following exception:

zF
During handling of the above exception, another exception occurred:

TcCsB|durtj}tt|�|||d�j|d�D]}t||dd�q*dS)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.
    Nr#��chainrr)rrr�typerr)�etype�valuer&r$rr*�liner r r!rWs��
rcCs ttt|�|||d�j|d��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#r))�listrr+r)r,r-r&r$r*r r r!rls
��rcCstt||d����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.

    N)r/rr)r,r-r r r!r|srcCs.t|�}|dus|sd|}nd||f}|S)Nz%s
z%s: %s
)�	_some_str)r,r-�valuestrr.r r r!�_format_final_exc_line�s

r2cCs*z
t|�WSdt|�jYS0dS)Nz<unprintable %s object>)�strr+�__name__)r-r r r!r0�s
r0cCstt��|||d��dS)z>Shorthand for 'print_exception(*sys.exc_info(), limit, file)'.�r$rr*N)rr�exc_infor5r r r!r	�sr	cCsd�tt��||d���S)z%Like print_exc() but return a string.r�r$r*)�joinrrr6r7r r r!r
�sr
cCs.ttd�std��ttjtjtj|||�dS)znThis is a shorthand for 'print_exception(sys.last_type,
    sys.last_value, sys.last_traceback, limit, file)'.�	last_typezno last exceptionN)�hasattrr�
ValueErrorrr9�
last_value�last_tracebackr5r r r!r�s

�rcCs*|durt��j}tt||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().
    Nr#r%)r�	_getframe�f_backr"r)�fr$rr r r!r
�s
r
cCs"|durt��j}tt||d��S)z5Shorthand for 'format_list(extract_stack(f, limit))'.Nr#)rr>r?rr)r@r$r r r!r�s
rcCs0|durt��j}tjt|�|d�}|��|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.
    Nr#)rr>r?rr(r�reverse)r@r$�stackr r r!r�s
	
rcCs6|dur2z|j��Wnty(Yn0|j}qdS)zEClear all references to local variables in the frames of a traceback.N)�tb_frame�clear�RuntimeError�tb_next�r&r r r!r�src@sZeZdZdZdZdddd�dd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
edd��ZdS)ra,A single frame from a traceback.

    - :attr:`filename` The filename for the frame.
    - :attr:`lineno` The line within filename for the frame that was
      active when the frame was captured.
    - :attr:`name` The name of the function or method that was executing
      when the frame was captured.
    - :attr:`line` The text from the linecache module for the
      of code that was running when the frame was captured.
    - :attr:`locals` Either None if locals were not supplied, or a dict
      mapping the name to the repr() of the variable.
    )�filename�lineno�name�_line�localsTN)�lookup_linerLr.cCsB||_||_||_||_|r"|j|r8dd�|��D�nd|_dS)a�Construct a FrameSummary.

        :param lookup_line: If True, `linecache` is consulted for the source
            code line. Otherwise, the line will be looked up when first needed.
        :param locals: If supplied the frame locals, which will be captured as
            object representations.
        :param line: If provided, use this instead of looking up the line in
            the linecache.
        cSsi|]\}}|t|��qSr )�repr)�.0�k�vr r r!�
<dictcomp>�z)FrameSummary.__init__.<locals>.<dictcomp>N)rHrIrJrKr.�itemsrL)�selfrHrIrJrMrLr.r r r!�__init__�szFrameSummary.__init__cCs`t|t�r:|j|jko8|j|jko8|j|jko8|j|jkSt|t�r\|j|j|j|jf|kStS�N)	�
isinstancerrHrIrJrL�tupler.�NotImplemented�rU�otherr r r!�__eq__s

�
�
�
zFrameSummary.__eq__cCs|j|j|j|jf|SrW)rHrIrJr.)rU�posr r r!�__getitem__szFrameSummary.__getitem__cCst|j|j|j|jg�SrW)�iterrHrIrJr.�rUr r r!�__iter__szFrameSummary.__iter__cCsdj|j|j|jd�S)Nz7<FrameSummary file {filename}, line {lineno} in {name}>)rHrIrJ)rrHrIrJrar r r!�__repr__s�zFrameSummary.__repr__cCsdS)N�r rar r r!�__len__szFrameSummary.__len__cCs&|jdur t�|j|j���|_|jSrW)rK�	linecache�getlinerHrI�striprar r r!r.s
zFrameSummary.line)
r4�
__module__�__qualname__�__doc__�	__slots__rVr]r_rbrcre�propertyr.r r r r!r�s
�
rccs4|durt��jj}|dur0||jfV|j}qdS)z�Walk a stack yielding the frame and line number for each frame.

    This will follow f.f_back from the given frame. If no frame is given, the
    current stack is used. Usually used with StackSummary.extract.
    N)rr>r?�f_lineno)r@r r r!r$s
rccs"|dur|j|jfV|j}qdS)z�Walk a traceback yielding the frame and line number for each frame.

    This will follow tb.tb_next (and thus is in the opposite order to
    walk_stack). Usually used with StackSummary.extract.
    N)rC�	tb_linenorFrGr r r!r1sr�c@s:eZdZdZedddd�dd��Zedd	��Zd
d�ZdS)rzA stack of frames.NTF�r$�lookup_lines�capture_localsc

Cs�|dur(ttdd�}|dur(|dkr(d}|durV|dkrFt�||�}ntj||d�}|�}t�}|D]Z\}}|j}	|	j}
|	j	}|�
|
�t�|
|j
�|r�|j}nd}|�t|
||d|d��qf|D]}
t�|
�q�|r�|D]
}|jq�|S)a?Create a StackSummary from a traceback or stack object.

        :param frame_gen: A generator that yields (frame, lineno) tuples to
            include in the stack.
        :param limit: None to include all frames or the number of frames to
            include.
        :param lookup_lines: If True, lookup lines for each frame immediately,
            otherwise lookup is deferred until the frame is rendered.
        :param capture_locals: If True, the local variables from each frame will
            be captured as object representations into the FrameSummary.
        N�tracebacklimitr)�maxlenF)rMrL)�getattrr�	itertools�islice�collections�deque�set�f_code�co_filename�co_name�addrf�	lazycache�	f_globals�f_locals�appendr�
checkcacher.)
�klass�	frame_genr$rrrs�result�fnamesr@rI�corHrJr�r r r!r(As8

�
zStackSummary.extractc	CsLt�}|D]<}t|t�r$|�|�q
|\}}}}|�t||||d��q
|S)z�
        Create a StackSummary object from a supplied list of
        FrameSummary objects or old-style list of tuples.
        )r.)rrXrr�)r��a_listr��framerHrIrJr.r r r!rqs

zStackSummary.from_listc
Csng}d}d}d}d}|D�]}|dusT||jksT|dusT||jksT|dusT||jkr�|tkr�|t8}|�d|�d|dkr|dnd�d��|j}|j}|j}d}|d7}|tkr�qg}|�d	�|j|j|j��|jr�|�d
�|j����|j�r t	|j�
��D]\}}	|�dj||	d���q|�d�|��q|tk�rj|t8}|�d|�d|dk�r^dnd�d��|S)
aFormat the stack ready for printing.

        Returns a list of strings ready for printing.  Each string in the
        resulting list corresponds to a single frame from the stack.
        Each string ends in a newline; the strings may contain internal
        newlines as well, for those items with source text lines.

        For long sequences of the same frame and line, the first few
        repetitions are shown, followed by a summary line stating the exact
        number of further repetitions.
        Nrz  [Previous line repeated z
 more time��srz]
z  File "{}", line {}, in {}
�    {}
z    {name} = {value}
)rJr-)rHrIrJ�_RECURSIVE_CUTOFFr�rr.rhrL�sortedrTr8)
rUr��	last_file�	last_line�	last_name�countr��rowrJr-r r r!r�s^
�������
��zStackSummary.format)r4rirjrk�classmethodr(rrr r r r!r>s�/
rc@sfeZdZdZddddd�dd�Zedd	��Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�dd�ZdS)ra�An exception ready for rendering.

    The traceback module captures enough attributes from the original exception
    to this intermediary form to ensure that no references are held, while
    still being able to fully print or format it.

    Use `from_exception` to create TracebackException instances from exception
    objects, or the constructor to create TracebackException instances from
    individual components.

    - :attr:`__cause__` A TracebackException of the original *__cause__*.
    - :attr:`__context__` A TracebackException of the original *__context__*.
    - :attr:`__suppress_context__` The *__suppress_context__* value from the
      original exception.
    - :attr:`stack` A `StackSummary` representing the traceback.
    - :attr:`exc_type` The class of the original traceback.
    - :attr:`filename` For syntax errors - the filename where the error
      occurred.
    - :attr:`lineno` For syntax errors - the linenumber where the error
      occurred.
    - :attr:`text` For syntax errors - the text where the error
      occurred.
    - :attr:`offset` For syntax errors - the offset into the text where the
      error occurred.
    - :attr:`msg` For syntax errors - the compiler error message.
    NTF�r$rrrs�_seenc	Csv|durt�}|�t|��d|_z�|rd|jdurdt|j�|vrdtt|j�|j|jj|d||d�}nd}|r�|jdur�t|j�|vr�tt|j�|j|jj|d||d�}	nd}	Wn t	y�d|_d}d}	Yn0||_|	|_|r�|j
nd|_
tjt
|�|||d�|_||_t|�|_|�rdt|t��rd|j|_|j}
|
du�rFt|
�nd|_|j|_|j|_|j|_|�rr|��dS)NFr�Trq)r{r�id�
_truncated�	__cause__rr+�
__traceback__�__context__�RecursionError�__suppress_context__rr(rrB�exc_typer0�_str�
issubclass�SyntaxErrorrHrIr3�text�offset�msg�_load_lines)rUr��	exc_value�
exc_tracebackr$rrrsr��cause�context�lnor r r!rV�sl��	��	
�
�
zTracebackException.__init__cOs |t|�||jg|�Ri|��S)z.Create a TracebackException from an exception.)r+r�)�cls�exc�args�kwargsr r r!�from_exceptionsz!TracebackException.from_exceptioncCs6|jD]
}|jq|jr"|j��|jr2|j��dS)z7Private API. force all lines in the stack to be loaded.N)rBr.r�r�r�)rUr�r r r!r�s

zTracebackException._load_linescCst|t�r|j|jkStSrW)rXr�__dict__rZr[r r r!r]%s
zTracebackException.__eq__cCs|jSrW)r�rar r r!�__str__*szTracebackException.__str__ccs~|jdurtd|j�VdS|jj}|jj}|dvrNt|t�sBd}|d|}t|jt�sjt||j�Vn|�	|�EdHdS)a�Format the exception part of the traceback.

        The return value is a generator of strings, each ending in a newline.

        Normally, the generator emits a single string; however, for
        SyntaxError exceptions, it emits 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 output.
        N)�__main__�builtinsz	<unknown>�.)
r�r2r�rjrirXr3r�r��_format_syntax_error)rU�stype�smodr r r!r-s

z(TracebackException.format_exception_onlyc
cs�d}|jdur&d�|jpd|j�Vn|jdur<d�|j�}|j}|dur�|�d�}|�d�}t|�t|�}d�|�V|jp�d	d
|}|d	kr�dd�|d|�D�}d
�d�|��V|j	p�d}	d�||	|�VdS)z0Format SyntaxError exceptions (internal helper).rNz  File "{}", line {}
z<string>z ({})�
z 
r�rr�css|]}|��r|ndVqdS)� N)�isspace)rO�cr r r!�	<genexpr>arSz:TracebackException._format_syntax_error.<locals>.<genexpr>z    {}^
z<no detail available>z	{}: {}{}
)
rIrrHr��rstrip�lstrip�lenr�r8r�)
rUr��filename_suffixr��rtext�ltext�spaces�caret�
caretspacer�r r r!r�Js&
�



z'TracebackException._format_syntax_errorr)ccs�|r`|jdur*|jj|d�EdHtVn*|jdurT|jsT|jj|d�EdHtV|jr`dV|jr|dV|j��EdH|��EdHdS)a�Format the exception.

        If chain is not *True*, *__cause__* and *__context__* will not be formatted.

        The return value is a generator of strings, each ending in a newline and
        some containing internal newlines. `print_exception` is a wrapper around
        this method which just prints the lines to a file.

        The message indicating which exception occurred is always the last
        string in the output.
        Nr)zXChained exceptions have been truncated to avoid stack overflow in traceback formatting:
z#Traceback (most recent call last):
)	r�r�_cause_messager�r��_context_messager�rBr)rUr*r r r!rfs 

��zTracebackException.format)
r4rirjrkrVr�r�r�r]r�rr�rr r r r!r�s�C
	r)N)NN)N)N)NNT)NT)NNT)NT)NNT)NNN)NN)NN) rkryrwrfr�__all__r"rrrrr�r�rrrr2r0r	r
rr
rrrrrrr�r/rrr r r r!�<module>s@




��







A
z