o ccjf@sH ddlZddlZddlZddlZgdZd7ddZddZd8ddZd7d d Zd7d d Z d Z dZ GdddZ e Z ddZe e dddfddZe e ddfddZe fddZddZddZd9ddZd:d d!Zd9d"d#Zd;d$d%Zd8d&d'Zd8d(d)Zd*d+ZGd,d-d-Zd.d/Zd0d1Zd2ZGd3d4d4eZ Gd5d6d6Z!dS)<N) extract_stack extract_tbformat_exceptionformat_exception_only format_list format_stack format_tb print_exc format_excprint_exception print_last print_stackprint_tb clear_frames FrameSummary StackSummaryTracebackException walk_stackwalk_tbcCs6 |durtj}t|D] }t||ddqdS)Nfileend)sysstderrr from_listformatprint)extracted_listritemr j/home/lily/lilypond-2.24.1/release/binaries/dependencies/install/Python-3.10.8/lib/python3.10/traceback.py print_lists r"cCs t|SN)rrr)rr r r!rs rcCs tt||d|ddSNlimit)r)r"r)tbr&rr r r!r-srcCs t||dSNr%)rrr'r&r r r!r7srcCs tjt||dSr()rextractrr)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: c@seZdZddZdS) _SentinelcCdS)Nz r selfr r r!__repr__Xz_Sentinel.__repr__N)__name__ __module__ __qualname__r/r r r r!r+Ws r+cCsT|tu|tukr td||urtur&n||fS|dur$||jfSdS||fS)Nz-Both or neither of value and tb must be givenNN) _sentinel ValueError __traceback__)excvaluer'r r r!_parse_value_tb]s r:TcCsZ t|||\}}|durtj}tt||||dd}|j|dD] }t||ddq!dS)NTr&compactchainrr)r:rrrtyperr)r8r9r'r&rr>teliner r r!r hs r cCs8 t|||\}}tt||||dd}t|j|dS)NTr;r=)r:rr?listr)r8r9r'r&r>r@r r r!r|srcCs. |tur|}tt||ddd}t|S)NT)r<)r5rr?rBr)r8r9r@r r r!rs   rcCs0t|}|dus |sd|}|Sd||f}|S)Nz%s z%s: %s ) _some_str)Zetyper9ZvaluestrrAr r r!_format_final_exc_lines   rDcCs$zt|WSdt|jYS)Nz)strr?r1)r9r r r!rCs rCcCs tt|||ddS)Nr&rr>)r rexc_inforFr r r!r r cCs dtt||dS)Nrr&r>)joinrrrGrIr r r!r rHr cCs0 ttds tdttjtjtj|||dS)N last_typezno last exception)hasattrrr6r rK last_valueZlast_tracebackrFr r r!r s  r cCs, |dur tj}tt||d|ddSr$)r _getframef_backr"r)fr&rr r r!r s r cCs$ |dur tj}tt||dSr()rrNrOrr)rPr&r r r!rs rcCs2 |dur tj}tjt||d}||Sr()rrNrOrr*rreverse)rPr&stackr r r!rs  rcCsB |durz|jWn tyYnw|j}|dusdSdSr#)tb_frameclear RuntimeErrortb_nextr'r r r!rs rc@sXeZdZ dZddddddZddZd d Zd d Zd dZddZ e ddZ dS)r)filenamelinenoname_linelocalsTN) lookup_liner\rAcCsJ ||_||_||_||_|r|j|r dd|D|_dSd|_dS)NcSsi|] \}}|t|qSr )repr).0kvr r r! sz)FrameSummary.__init__..)rXrYrZr[rAitemsr\)r.rXrYrZr]r\rAr r r!__init__s &zFrameSummary.__init__cCs`t|tr|j|jko|j|jko|j|jko|j|jkSt|tr.|j|j|j|jf|kStSr#) isinstancerrXrYrZr\tuplerANotImplementedr.otherr r r!__eq__s      zFrameSummary.__eq__cCs|j|j|j|jf|Sr#)rXrYrZrA)r.posr r r! __getitem__ zFrameSummary.__getitem__cCst|j|j|j|jgSr#)iterrXrYrZrAr-r r r!__iter__#rmzFrameSummary.__iter__cCsdj|j|j|jdS)Nz7)rXrYrZ)rrXrYrZr-r r r!r/&s zFrameSummary.__repr__cCr,)Nr r-r r r!__len__*r0zFrameSummary.__len__cCs4|jdur|jdur dSt|j|j|_|jSr#)r[rY linecachegetlinerXstripr-r r r!rA-s   zFrameSummary.line) r1r2r3 __slots__rdrjrlror/rqpropertyrAr r r r!rs   rccsB |dur tjj}|dur||jfV|j}|dusdSdSr#)rrNrOf_lineno)rPr r r!r5s  rccs0 |dur|j|jfV|j}|dusdSdSr#)rS tb_linenorVrWr r r!rBs rc@s8eZdZ eddddddZeddZd d ZdS) rNTFr& lookup_linescapture_localsc Cs |durttdd}|dur|dkrd}|dur,|dkr$t||}ntj|| d}|}t}|D]-\}}|j} | j} | j } | | t | |j |rS|j} nd} |t| || d| dq4|D]} t | qd|rv|D]}|jqp|S)NZtracebacklimitr)maxlenF)r]r\)getattrr itertoolsislice collectionsdequesetf_code co_filenameco_nameaddrrZ lazycache f_globalsf_localsappendrZ checkcacherA) klassZ frame_genr&r{r|resultZfnamesrPrYcorXrZrr r r!r*Rs:      zStackSummary.extractc CsN t}|D]}t|tr||q|\}}}}|t||||dq|S)N)rA)rrerr)rZa_listrframerXrYrZrAr r r!rs   zStackSummary.from_listc Csf g}d}d}d}d}|D]}|dus*||jks*|dus*||jks*|dus*||jkrO|tkrD|t8}|d|d|dkr>dndd|j}|j}|j}d}|d7}|tkrXq g}|d|j|j|j|jru|d |j|jrt |j D]\}} |d j|| d q|d |q |tkr|t8}|d|d|dkrdndd|S) Nrz [Previous line repeated z more timesrz] z File "{}", line {}, in {}  {} z {name} = {value} )rZr9) rXrYrZ_RECURSIVE_CUTOFFrrrArtr\sortedrcrJ) r.rZ last_fileZ last_lineZ last_namecountrZrowrZr9r r r!rsT  zStackSummary.format)r1r2r3 classmethodr*rrr r r r!rOs/  rc@sfeZdZ ddddddddZeddZd d Zd d Zd dZddZ ddZ ddddZ dS)rNTF)r&r{r|r<_seenc Cs|du} |dur t}|t|tjt||||d|_||_t||_ |r]t |t r]|j |_ |j } | durs zTracebackException._load_linescCst|tr |j|jkStSr#)rer__dict__rgrhr r r!rjCs  zTracebackException.__eq__cCs|jSr#)rr-r r r!__str__HszTracebackException.__str__ccs |jdurtd|jVdS|jj}|jj}|dvr)t|ts#d}|d|}t|jts8t||jVdS| |EdHdS)N)__main__builtinsz .) rrDrr3r2rerErr_format_syntax_error)r.stypeZsmodr r r!rKs    z(TracebackException.format_exception_onlyc cs. d}|jdurd|jpd|jVn |jdur d|j}|j}|dur|d}|d}t|t|}d|V|jdur|j}|jdvrO|jn|}||ksY|d kr]|d }|d |} |d |} | d krd d |d| D} dd | d| | dV|j pd} d|| |VdS)Nrz File "{}", line {} zz ({}) z r>rNrrcss |] }|r |ndVqdS) N)isspace)r_cr r r! sz:TracebackException._format_syntax_error..z {}{}^zz {}: {}{} ) rYrrXrrstriplstriplenrrrJr) r.rZfilename_suffixrZrtextZltextZspacesrrZcolnoZ end_colnoZ caretspacerr r r!rhs6            z'TracebackException._format_syntax_errorr=ccs g}|}|r<|r1|jdurt}|j}n|jdur#|js#t}|j}nd}d}|||f|}n |d|fd}|st|D] \}}|durK|V|jrYdV|jEdH| EdHq@dS)Nz#Traceback (most recent call last): ) r_cause_messagerr_context_messagerreversedrRrr)r.r>outputr8Z chained_msgZ chained_excrr r r!rs:   zTracebackException.format) r1r2r3rdrrrrjrrrrr r r r!rs P $rr#r4)NNT)NT)NNN)"rrrrr__all__r"rrrrrrr+r5r:r rrrDrCr r r r rrrrrrrrBrrr r r r!sP           B  z