bgjddlZddlZddlZddlZddlZddlZddlZddlmZddlmZddl m Z ddl m Z ddlm Z ddlmZddlmZdd lmZdd lmZdd lmZdd lmZdd lmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlm Z ddlm!Z!ddlm"Z"ddlm#Z#ddlm$Z$ddl%Z%ddl&Z&ddl'm(Z(ddl'm)Z)ddl'm*Z*ddl'm+Z+dd l,m-Z-dd!l.m/Z/dd"l.m0Z0dd#l1m2Z2dd$l1m3Z3dd%l4m5Z5dd&l6m7Z7dd'l6m8Z8e"rdd(l9m:Z:dd)l9m;Z;dd*l9mdd,d-krdd.l?m@Z@Gd/d0ZAGd1d2ZBGd3d4ZCGd5d6eeCZDe#d7eEd89ZFe2ejGGd:d;eeFZHejGGd<d=ZIejGd>?Gd@dAZJejGd>?GdBdCeJZKejGd>?GdDdEeKZLejGd>?GdFdGeKZMejGd>?GdHdIeJZNGdJdKeNZOejGd>?GdLdMeJZPejGd>?GdNdOeJZQejGd>?GdPdQeJZRejGd>?GdRdSeJZSejGd>?GdTdUeJZTdVeUdWe e$eVe feWffdXZXe e%jYZdYZ[e[j\dZkre[j]Z[e e&jYj]Z^d[eCdWe_fd\Z`dS)]N) CO_VARARGS)CO_VARKEYWORDS)StringIO)Path)format_exception_only)CodeType) FrameType) TracebackType)Any)Callable)ClassVar)Dict)Generic)Iterable)List)Mapping)Optional)overload)Pattern)Sequence)Set)Tuple)Type) TYPE_CHECKING)TypeVar)Union) findsource getrawcode)getstatementrange_ast)Source)TerminalWriter) safeformatsaferepr)final) get_real_func)check_ispytest) absolutepath) bestrelpath)Final)Literal) SupportsIndex)longshortlinenonativevalueauto) )BaseExceptionGroupceZdZdZdZdeddfdZededdfdZ dZ dZ e de fd Ze defd Ze deeeffd Ze ded fd ZddZddedeedffdZdS)Codez#Wrapper around Python code objects.rawobjreturnNc||_dSNr;)selfr=s c/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/_pytest/_code/code.py__init__z Code.__init__Cs c2|t|Sr@r)clsr=s rB from_functionzCode.from_functionFss:c??###rDc"|j|jkSr@r;)rAothers rB__eq__z Code.__eq__Jsx59$$rDc |jjdz SN)r<co_firstlinenorAs rB firstlinenozCode.firstlinenoPsx&**rDc|jjSr@)r<co_namerOs rBnamez Code.nameTs xrDc|jjsdS t|jj}|st d|S#t$r|jjcYSwxYw)zoReturn a path object pointing to source code, or an ``str`` in case of ``OSError`` / non-existing file.zpath check failed.)r< co_filenamer)existsOSError)rAps rBpathz Code.pathXsx# 2 (TX122A88:: 42333H ( ( (8' ' ' ' (s=AA'&A'r!c4t|j\}}|S)zJReturn a _pytest._code.Source object for the full source file of the code.)rr<)rAfull_s rB fullsourcezCode.fullsourceisTX&&a rDc*t|jS)zGReturn a _pytest._code.Source object for the code object's source only.)r!r<rOs rBsourcez Code.sourceosdhrDFvar.c|j}|j}|r$||jtzz }||jtzz }|jd|S)zReturn a tuple with the argument names for the code object. If 'var' is set True also return the names of the variable and keyword arguments when present. N)r< co_argcountco_flagsrr co_varnames)rArar<argcounts rBgetargsz Code.getargstsMh?  6  z1 1H  ~5 5Hyy))rDr>r!F)__name__ __module__ __qualname____doc__ __slots__rrC classmethodobjectrGrJ__hash__propertyintrPstrrSrrrZrr^r`boolrrgrDrBr:r:>sp--IH$$6$$$[$%%%H +S+++X+ c   X (eD#I&(((X( HX.X     * *4 *E#s(O * * * * * *rDr:ceZdZdZdZdeddfdZedefdZ ede e e ffdZ ede e e ffd Zedefd Zedd Zd Zdede fdZddefdZdS)FramezgWrapper around a Python frame holding f_locals and f_globals in which expressions can be evaluated.r;framer>Nc||_dSr@r;)rArys rBrCzFrame.__init__s rDc |jjdz SrL)r<f_linenorOs rBlinenoz Frame.linenosx 1$$rDc|jjSr@)r< f_globalsrOs rBrzFrame.f_globalss x!!rDc|jjSr@)r<f_localsrOs rBrzFrame.f_localss x  rDc4t|jjSr@)r:r<f_coderOs rBcodez Frame.codesDHO$$$rDr!c|jjtdS|jj|jS)zStatement this frame is at.NrU)rr^r! getstatementr}rOs rB statementzFrame.statements6 9  '":: y#00===rDc |j}||t||j|S)zEvaluate 'code' in the frame. 'vars' are optional additional local variables. Returns the result of the evaluation. )rcopyupdateevalr)rArvarsrs rBrz Frame.evals==%%''D$.(333rDrpc t|S)zCReturn a 'safe' (non-recursive, one-line) string repr for 'object'.r$)rArps rBreprz Frame.reprsrDFracg}|j|D]5} |||j|f&#t$rY2wxYw|S)zReturn a list of tuples (name, value) for all arguments. If 'var' is set True, also include the variable and keyword arguments when present. )rrgappendrKeyError)rAraretvalargs rBrgz Frame.getargsss 9$$S))  C  sDM#$678888     s"A AArhri)rjrkrlrmrnr rCrrrsr}rrtr rrr:rrrrprrurgrvrDrBrxrxsd..IiD%%%%X%"4S>"""X"!$sCx.!!!X!%d%%%X%>>>X> 4 4 4 6 c      4      rDrxceZdZdZdZ ddededddfdZdedddfd Ze de fd Z e de fd Z e de fd Zdefd Ze ddZe deeeffdZe deeeffdZde fdZ ddeeeeefejfdedfdZe eZdeddefdZdefdZe defdZ dS)TracebackEntryzA single entry in a Traceback. _rawentry _repr_styleNrawentry repr_stylezLiteral["short", "long"]r>c"||_||_dSr@r)rArrs rBrCzTracebackEntry.__init__s #+$.rDc,t|j|Sr@)rr)rArs rBwith_repr_stylezTracebackEntry.with_repr_stylesdnj999rDc |jjdz SrL)r tb_linenorOs rBr}zTracebackEntry.linenos~'!++rDc4t|jjSr@)rxrtb_framerOs rBryzTracebackEntry.framesT^,---rDc4|j|jjjz Sr@)r}ryrrPrOs rBrellinezTracebackEntry.rellines{TZ_888rDc>d|jjj|jdzfzS)NzrM)ryrrZr}rOs rB__repr__zTracebackEntry.__repr__s'4:?+?q*QQQrDr!c`|jjj}|J||jS)z6_pytest._code.Source object for the current statement.)ryrr^rr})rAr`s rBrzTracebackEntry.statements2+!!!""4;///rDc$|jjjS)zPath to the source code.)ryrrZrOs rBrZzTracebackEntry.pathsz##rDc|jjS)zLocals of underlying frame.)ryrrOs rBlocalszTracebackEntry.localssz""rDc$|jjjSr@)ryrrPrOs rBgetfirstlinesourcez!TracebackEntry.getfirstlinesourcesz**rDastcachecF|jjj}|dSdx}}|)|jjj}|||d}|} t |j||\}}}|||||<n#t$r |jdz}YnwxYw|||S)zReturn failing source code.N)astnoderM) ryrr^rZgetrr r} SyntaxError)rArr`keyrstartr]ends rB getsourcezTracebackEntry.getsources + >4g  */&C",,sD11'')) (3 VWOGQ 8#7 '  " " "+/CCC " eCi  sA??BBexcinfoExceptionInfo[BaseException]cd}|jj|jjfD]} |d}n#t$rYwxYw|rt |r ||S|S)aReturn True if the current frame has a var __tracebackhide__ resolving to True. If __tracebackhide__ is a callable, it gets called with the ExceptionInfo instance and can decide whether to hide the traceback. Mostly for internal use. F__tracebackhide__)ryrr Exceptioncallable)rArtbh maybe_ns_dcts rBishiddenzTracebackEntry.ishiddens  "Z0$*2FG  L  "#67      8C== 3w<<  s ( 55c|jjj} t|j}n#t $rt$rd}YnwxYwdt|j|j dz||fzS)N???z File %r:%d in %s %s rM) ryrrSrtrlstripKeyboardInterrupt BaseExceptionrZr})rArSr0s rB__str__zTracebackEntry.__str__-sz# t~&&--//DD        DDD  ,  NN K!O   /   s&:AAc.|jjjjS)zco_name of underlying code.)ryrr<rRrOs rBrSzTracebackEntry.name?sz"**rDr@rh)!rjrkrlrmrnr rrCrrrrsr}rxryrrtrrrrrZrr rrastASTrr`rurrrSrvrDrBrrs((,I <@///78/  ////:"#=>: :::: ,,,,X,.u...X.9999X9R#RRRR000X0 $eD#I&$$$X$#S#X###X#+C++++EI!! eCI&6&?!@A! ( !!!!4Xi F)G HT6     $+c+++X+++rDrc leZdZdZdeeeefddffd Z dde ede fde e d e e d e dddf d Z e d d defdZe d eddfdZd ed efdeedfffd ZdedeegeffddfdZde e fdZxZS) TracebackzQTraceback objects encapsulate and offer higher level access to Traceback entries.tbr>Nct|trIdtdttfd}t ||dSt |dS)z@Initialize from given python traceback object and ExceptionInfo.curr>c3JK|}|t|V|j}|dSdSr@)rtb_next)rcur_s rBfzTraceback.__init__..fOs@03&(.....z Traceback.cut..ss($F$FSVV$F$F$F$F$F$FrD) osfspathryrrZrtrrparentsr}rPrr) rArZr}rPrpath_ excludepath_xrcodepaths rBcutz Traceback.cutYs  ")D//*2tt +8N8N  * *A7>%''"5"5c":":;; ;77&&s++ +rD_excinfo_or_fnrcxttrfd}n}tt||S)aReturn a Traceback instance with certain items removed. If the filter is an `ExceptionInfo`, removes all the ``TracebackEntry``s which are hidden (see ishidden() above). Otherwise, the filter is a function that gets a single argument, a ``TracebackEntry`` instance, and should return True when the item should be added to the ``Traceback``, False when not. c0| Sr@)r)rrs rBz"Traceback.filter..sqzz.999rD)r ExceptionInforfilter)rArfns ` rBrzTraceback.filtersD" nm 4 4 9999BBBD))***rDcJi}t|D]\}}|jjjt |jjj|jf}||g}|r|j}|j}|D]}||kr|ccS| |jjdS)z~Return the index of the frame/TracebackEntry where recursion originates if appropriate, None if no recursion occurred.N) enumerateryrrZidr<r} setdefaultrr) rAcacheientryrvaluesrlocotherlocs rBrecursionindexzTraceback.recursionindexsCE!$ 0 0HAu +"'EK,<,@)A)A5<OC%%c2..F !Kj &!!H3 ' MM%+. / / / /trD)NNNN)rjrkrlrmrr rrrCrrtrsrrrrr rurr __classcell__rs@rBrrEs[[! -.!99 :! !!!!!!&:> $%)48 ""u/456" "c] " 01 "  """"H  >   X  u    X ,%/0, ~{* +,,,,,,+ * n%t+ , . + ++++. rDrET)bound covariantceZdZUdZdZeed<eee dde fed<e ed<ee ed< d:d d d eee dde fd e dee de dd f dZe d;dedee ddfdZe d;dee eee fdee ddfdZe d;dee ddfdZedd-e d.d/d0e d1ee e#dge ffd2e d3e d4e ded5fd6Z$d7ee e%e fdd8fd9Z&d S)?rzJWraps sys.exc_info() objects and offers help for navigating the traceback.zAssertionError('assert _assert_start_reprr_excinfo _striptext _tracebackrUNF _ispytestr striptext tracebackrr>cNt|||_||_||_dSr@)r(rrr)rArrrrs rBrCzExceptionInfo.__init__s+ y!!! ##rD exceptionexprinfoExceptionInfo[E]c~|js Jdt|||jf}|||S)aEReturn an ExceptionInfo for an existing exception. The exception must have a non-``None`` ``__traceback__`` attribute, otherwise this function fails with an assertion error. This means that the exception must have been raised, or added a traceback with the :py:meth:`~BaseException.with_traceback()` method. :param exprinfo: A text string helping to determine if we should strip ``AssertionError`` from the output. Defaults to the exception message/``__str__()``. .. versionadded:: 7.4 zTExceptions passed to ExcInfo.from_exception(...) must have a non-None __traceback__.) __traceback__type from_exc_info)rFrr exc_infos rBfrom_exceptionzExceptionInfo.from_exceptionsS0  # b b a b b #OOY 0GH  8444rDrcd}|gt|dtrLt|ddd}|t|d}|r||jrd}|||dS)z@Like :func:`from_exception`, but using old-style exc_info tuple.rUNrMmsgzAssertionError: Tr)rAssertionErrorgetattrr% startswithr)rFrr rs rBrzExceptionInfo.from_exc_infos   8A; G G x{E488H#HQK00 0H//0FGG 0/ s8Z48888rDrctj}|d Jd|d Jd|d Jd|d|d|df}t||S)a=Return an ExceptionInfo matching the current traceback. .. warning:: Experimental API :param exprinfo: A text string helping to determine if we should strip ``AssertionError`` from the output. Defaults to the exception message/``__str__()``. rNzno current exceptionrMr5)sysrrr)rFr tuprs rB from_currentzExceptionInfo.from_currentslnn1v!!#9!!!1v!!#9!!!1v!!#9!!!FCFCF+**8X>>>rDc|ddS)z!Return an unfilled ExceptionInfo.NTrrv)rFs rB for_laterzExceptionInfo.for_laterss44((((rDc6|j Jd||_dS)z|j Jd|jdS)zThe exception class.Nz6.type can only be used after the context manager exitsrrrOs rBr zExceptionInfo.type#s* M % % C & % %}QrDc>|j Jd|jdS)zThe exception value.Nz7.value can only be used after the context manager exitsrMrrOs rBr3zExceptionInfo.value+s* M % % D & % %}QrDc>|j Jd|jdS)zThe exception raw traceback.Nz4.tb can only be used after the context manager exitsr5rrOs rBrzExceptionInfo.tb3s* M % % A & % %}QrDc<|j Jd|jjS)zThe type name of the exception.Nz:.typename can only be used after the context manager exits)rr rjrOs rBtypenamezExceptionInfo.typename;s( M % % G & % %y!!rDcP|jt|j|_|jS)zThe traceback.)rrrrOs rBrzExceptionInfo.tracebackCs% ? "'00DOrDr3c||_dSr@)r)rAr3s rBrzExceptionInfo.tracebackJs rDc|jdSd|jjt |jdt |jS)Nz)z<{} {} tblen={}>rM)rformatrrjr%lenrrOs rBrzExceptionInfo.__repr__NsM = >>!(( N #XdmA.>%?%?T^ATAT   rDtryshortct|j|j}d|}|}|r6||jr|t|jd}|S)aReturn the exception as a string. When 'tryshort' resolves to True, and the exception is an AssertionError, only the actual exception part of the exception representation is returned (so 'AssertionError: ' is removed from the beginning). rUN)rr r3joinrstriprrr()rAr)linestexts rBexconlyzExceptionInfo.exconlyUsp&di<<wwu~~{{}}  4t// 4C00223 rDexc.c,t|j|S)zReturn True if the exception is an instance of exc. Consider using ``isinstance(excinfo.value, exc)`` instead. )rr3)rAr0s rB errisinstancezExceptionInfo.errisinstancees$*c***rDReprFileLocationc0tdt|j dz dD]m}|j|}||sI|jjjj|j}}| d}t||dz|cSndS)NrMTr)) ranger(rrryrr<rVr}r/r3)rArrrZr}r/s rB _getreprcrashzExceptionInfo._getreprcrashnsrC///!3R88 C CAN1%E>>$'' C${/3?f,,,55'fqj'BBBBB CtrDr.T showlocalsstyle_TracebackStyleabspathtbfilterfuncargstruncate_localschain)ReprExceptionInfoExceptionChainReprc 2|dkrgtttj|j|j|jr|jdjnd|St|||||||}| |S)aReturn str()able representation of this exception info. :param bool showlocals: Show locals per traceback entry. Ignored if ``style=="native"``. :param str style: long|short|line|no|native|value traceback style. :param bool abspath: If paths should be changed to absolute or left unchanged. :param tbfilter: A filter for traceback entries. * If false, don't hide any entries. * If true, hide internal entries and entries that contain a local variable ``__tracebackhide__ = True``. * If a callable, delegates the filtering to the callable. Ignored if ``style`` is ``"native"``. :param bool funcargs: Show fixtures ("funcargs" for legacy purposes) per traceback entry. :param bool truncate_locals: With ``showlocals==True``, make sure locals can be safely represented as strings. :param bool chain: If chained exceptions in Python 3 should be shown. .. versionchanged:: 3.9 Added the ``chain`` parameter. r2rN reprtraceback reprcrash)r9r:r<r=r>r?r@) rAReprTracebackNativerformat_exceptionr r3rr8FormattedExcinfo repr_excinfo) rAr9r:r<r=r>r?r@fmts rBgetreprzExceptionInfo.getreprys^ H  $1.  7;~Oq)334,,..    !+   %%%rDregexpz Literal[True]cd}t|j}d|d|}||kr|dz }tj||s J|dS)zCheck whether the regular expression `regexp` matches the string representation of the exception using :func:`python:re.search`. If it matches `True` is returned, otherwise an `AssertionError` is raised. Tz%Regex pattern did not match. Regex: z Input: z* Did you mean to `re.escape()` the regex?)rtr3research)rArMrr3rs rBmatchzExceptionInfo.matchse !DJTvTT5TT U?? @ @Cy'',,,,'trD)rUNr@)r>r ri)Fr.FTFTT)'rjrkrlrmrr __annotations__rrrr rtrrurCrorrrrrrrrr r3rr#rsetterrr/rrr2r8r rLrrQrvrDrBrrsUT#<<<<uT#Y]:;<<<<OOO#### )- $  $ $ $%S 3 =>? $ $I& $  $  $ $ $ $#' 55  5 3- 5 555[58#'99QM1293-9  999[9 '+??}? '???[?*)))[)!eDGQ ,E&F!4!!!!  d1g   X  q   X  M   X "#"""X"9X  y T     #     +m,eD4G4L.MMN+ ++++ x(:;    !#)  $D&D&D&!D& D&  (:;YFG G D&D&D&D& 8 9D&D&D&D&L E#ws|"34       rDrc eZdZUdZdZeed<dZeed<dZe ed<dZ d ed <d Z e ed <d Z e e eeegeffed <dZe ed<d Ze ed<d Ze ed<ejeddZee eefejfed<dddefdZde de!dfdZ"de de!dfdZ# d2de!ddede!eede de$ef d Z% d3deed"ed#e de$efd$Z&d%e'ee(fde!d&fd'Z) d4de!e de!eedd(fd)Z*d*e eefdefd+Z+deedd,fd-Z,d.ede-ee!effd/Z.deedd0fd1Z/dS)5rIz>Presenting information about failing Functions and Generators.> flow_markerr fail_markerFr9r.r;r:Tr<r=r>r?r@)default_factoryinitrrr`r!r>cl t|t|dz }nM#t$rt$r6 t|d}n#t$rt$rYYdSwxYwYnwxYwdt|t|z zS)NrMr5r)rtrr(rrr)rAr`ss rB _getindentzFormattedExcinfo._getindents F''F a8899AA         r OO$       qqq  CFFS__,--s325A? A A? A94A?8A99A?>A?rcf||j}||}|Sr@)rrdeindent)rArr`s rB_getentrysourcez FormattedExcinfo._getentrysources///  __&&F rD ReprFuncArgsc|jrVg}|jdD])\}}||t |f*t |SdS)NT)ra)r>ryrgrr%ra)rArargsargnameargvalues rB repr_argszFormattedExcinfo.repr_argssm = &D%*[%8%8T%8%B%B ; ;! Whx&8&89::::%% %trDr5N line_indexrr/cg}||dkr|t|z }||t|jks|dkrtd}d}d}|r6|||j|zn|jd|D]}|||z||jdz|j|z|j|dzdD]}|||z|D|rdn||}||||d |S) z,Return formatted and marked up source lines.Nrrz  rMr[T)indentmarkall) r(r-r!rstriprVr]extend get_exconly) rAr`rgrr/r- space_prefixr0rjs rB get_sourcezFormattedExcinfo.get_sourcest  *q.. #f++ %J >Z3v|+<+<<< QE]]FJ  2 LL Z(@(F(F(H(HH I I I I [j[1 2 2 \D01111 LL)E1FL4LL M M M Z!^%5%56 2 2 \D01111  z0FormattedExcinfo.repr_locals..1s!;;;CSVs]]C]]]rD __builtins__z__builtins__ = z<10 = )r9sortrr?r%r#rx)rArr-keysrSr3str_reprs rB repr_localszFormattedExcinfo.repr_locals.s ? %E;;6;;;D IIKKK = =t >))LL!<==== +5#+E??#-e#4#4LLD!;!;!;!;!;<<<< e$$ $trD ReprEntrycg}||j|jn|j}|dvr| ||}|td}d}n|j|z }|dk}|s||nd}|||||} || |r d|j z} n |r|j pd} |j } | | } t| |jdz| } ||j}t!|||| |S|d krO|r:|t#|jd t!|ddd|S|r*|||d t!|ddd|S) N)r/r.rrr/)r/zin %srUrMr3rsr[rj)rr:r`r!r}rrfrprmrSr#rZ _makepathr3rrrrtr3rtrn)rArrr-r:r`rgr/reprargsr\message entry_pathrZ reprfileloc localsreprs rBrepr_traceback_entryz%FormattedExcinfo.repr_traceback_entryHs  U%6%B     % % %%*;))%00F~ "\E,D,D,F,FF W$E49Ct~~e,,,tH G5IIA LLOOO =!UZ0!6g&6<"J>>*--D*41A7KKK))%,77JUHj+uMM M g   = S//55d;;<<<UD$e<< < B T--ga-@@AAAUD$e<<