
    F-Phi                       U d dl mZ d dlZd dlmZ d dlmZ d dlmZ d dlmZ d dlZd dl	Z	d dl	m
Z
 d dl	mZ d d	lmZ d dlZd d
lmZ d dlZd dlZd dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlm Z  d dlm!Z! d dlm"Z" d dlm#Z# d dlm$Z$ d dlm%Z% d dlm&Z& d dlm'Z' d dl(Z(d dl)Z)d dl*m+Z+ d dl*m,Z, d dl*m-Z- d d l*m.Z. d d!l/m0Z0 d d"l1m2Z2 d d#l1m3Z3 d d$l4m5Z5 d d%l6m7Z7 d d&l8m9Z9 d d'l8m:Z: ej;        d(k     rd d)l<m=Z= e"d*         Z>e'e?e@         eAe?e@         d+f         f         ZB G d, d-          ZC G d. d/          ZD G d0 d1          ZE G d2 d3eFeE                   ZG	 djdkd;ZH e&d<e@d4=          ZIe ejJ         G d> d?e!eI                                           ZKe%r$d d@lLmMZM e'eNeeKe@         geGf         f         ZOdAePdB<   ejJ         G dC dD                      ZQ ejJ        dEF           G dG dH                      ZR ejJ        dEF           G dI dJeR                      ZS ejJ        dEF           G dK dLeS                      ZT ejJ        dEF           G dM dNeS                      ZU ejJ        dEF           G dO dPeR                      ZV G dQ dReV          ZW ejJ        dEF           G dS dTeR                      ZX ejJ        dEF           G dU dVeR                      ZY ejJ        dEF           G dW dXeR                      ZZ ejJ        dEF           G dY dZeR                      Z[ ejJ        dEF           G d[ d\eR                      Z\dld`Z]da Z^ ee(j_        `                    db                    Zaeajb        dck    reajc        Za ee)j_                  jc        ZddmdeZedndiZfdS )o    )annotationsN)Callable)Iterable)Mapping)Sequence)
CO_VARARGS)CO_VARKEYWORDS)StringIO)Path)
extract_tb)format_exception)format_exception_only)FrameSummary)CodeType)	FrameType)TracebackType)Any)ClassVar)Final)final)Generic)Literal)overload)SupportsIndex)TYPE_CHECKING)TypeVar)Union)
findsource
getrawcode)getstatementrange_ast)Source)TerminalWriter)
safeformatsaferepr)get_real_func)check_ispytest)absolutepath)bestrelpath      )BaseExceptionGroup)longshortlinenonativevalueauto.c                      e Zd ZdZdZddZedd	            Zd
 ZdZ	e
dd            Ze
dd            Ze
dd            Ze
d d            Zd!dZd"d#dZdS )$Codez#Wrapper around Python code objects.rawobjr   returnNonec                    || _         d S Nr8   )selfr:   s     R/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/_pytest/_code/code.py__init__zCode.__init__B   s        objectc                2     | t          |                    S r>   r   )clsr:   s     r@   from_functionzCode.from_functionE   s    s:c??###rB   c                "    | j         |j         k    S r>   r8   )r?   others     r@   __eq__zCode.__eq__I   s    x59$$rB   Nintc                     | j         j        dz
  S N   )r9   co_firstlinenor?   s    r@   firstlinenozCode.firstlinenoO   s    x&**rB   strc                    | j         j        S r>   )r9   co_namerO   s    r@   namez	Code.nameS   s    xrB   
Path | strc                    | j         j        sdS 	 t          | j         j                  }|                                st	          d          |S # t          $ r | j         j        cY S w xY w)zoReturn a path object pointing to source code, or an ``str`` in
        case of ``OSError`` / non-existing file. zpath check failed.)r9   co_filenamer)   existsOSError)r?   ps     r@   pathz	Code.pathW   s     x# 	2		(TX122A88:: 42333H 	( 	( 	( 8''''	(s   =A A'&A'Source | Nonec                4    t          | j                  \  }}|S )zJReturn a _pytest._code.Source object for the full source file of the code.)r   r9   )r?   full_s      r@   
fullsourcezCode.fullsourceh   s     TX&&arB   r"   c                *    t          | j                  S )zGReturn a _pytest._code.Source object for the code object's source only.)r"   r9   rO   s    r@   sourcezCode.sourcen   s     dhrB   Fvarbooltuple[str, ...]c                    | j         }|j        }|r$||j        t          z  z  }||j        t          z  z  }|j        d|         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)r9   co_argcountco_flagsr   r	   co_varnames)r?   rd   r9   argcounts       r@   getargszCode.getargss   sM     h? 	6z11H~55Hyy))rB   )r:   r   r;   r<   )r:   rC   r;   r7   r;   rJ   r;   rQ   r;   rU   )r;   r]   r;   r"   F)rd   re   r;   rf   )__name__
__module____qualname____doc__	__slots__rA   classmethodrF   rI   __hash__propertyrP   rT   r\   ra   rc   rl    rB   r@   r7   r7   =   s       --I    $ $ $ [$% % % H+ + + X+       X  ( ( ( X(     X
       
* * * * * * *rB   r7   c                      e Zd ZdZdZddZedd	            Zedd            Zedd            Z	edd            Z
edd            Zd ZddZd d!dZdS )"FramezgWrapper around a Python frame holding f_locals and f_globals
    in which expressions can be evaluated.r8   framer   r;   r<   c                    || _         d S r>   r8   )r?   r}   s     r@   rA   zFrame.__init__   s    rB   rJ   c                     | j         j        dz
  S rL   )r9   f_linenorO   s    r@   linenozFrame.lineno   s    x 1$$rB   dict[str, Any]c                    | j         j        S r>   )r9   	f_globalsrO   s    r@   r   zFrame.f_globals   s    x!!rB   c                    | j         j        S r>   )r9   f_localsrO   s    r@   r   zFrame.f_locals   s    x  rB   r7   c                4    t          | j        j                  S r>   )r7   r9   f_coderO   s    r@   codez
Frame.code   s    DHO$$$rB   r"   c                    | j         j        t          d          S | j         j                            | j                  S )zStatement this frame is at.NrW   )r   ra   r"   getstatementr   rO   s    r@   	statementzFrame.statement   s6     9'"::y#00===rB   c                    | j                                         }|                    |           t          || j        |          S )zEvaluate 'code' in the frame.

        'vars' are optional additional local variables.

        Returns the result of the evaluation.
        )r   copyupdateevalr   )r?   r   varsr   s       r@   r   z
Frame.eval   s=     =%%''D$.(333rB   rC   rQ   c                     t          |          S )zCReturn a 'safe' (non-recursive, one-line) string repr for 'object'.r%   )r?   rC   s     r@   reprz
Frame.repr   s    rB   Frd   re   c                    g }| j                             |          D ]5}	 |                    || j        |         f           &# t          $ r Y 2w xY w|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.
        )r   rl   appendr   KeyError)r?   rd   retvalargs       r@   rl   zFrame.getargs   ss     9$$S)) 	 	CsDM#$678888   s   "A
AAN)r}   r   r;   r<   rm   r;   r   )r;   r7   rp   )rC   rC   r;   rQ   rq   )rd   re   )rr   rs   rt   ru   rv   rA   ry   r   r   r   r   r   r   r   rl   rz   rB   r@   r|   r|      s       . . I    % % % X% " " " X" ! ! ! X! % % % X% > > > X>	4 	4 	4             rB   r|   c                     e Zd ZdZdZ	 d.d/d
Zd0dZed1d            Zd2dZ	e
j        dk     r%ed3d            Zed3d            Zed3d            Zn$ed3d            Zed3d            Zed3d            Zed4d            Zed1d            Zd5dZed6d            Zed7d             Zed8d"            Zd1d#Z	 d.d9d'Z ee          Zd:d+Zd5d,Zed5d-            ZdS );TracebackEntryzA single entry in a Traceback.	_rawentry_repr_styleNrawentryr   
repr_styleLiteral['short', 'long'] | Noner;   r<   c                "    || _         || _        d S r>   r   )r?   r   r   s      r@   rA   zTracebackEntry.__init__   s    
 !)",rB   c                ,    t          | j        |          S r>   )r   r   )r?   r   s     r@   with_repr_stylezTracebackEntry.with_repr_style   s     dnj999rB   rJ   c                     | j         j        dz
  S rL   )r   	tb_linenorO   s    r@   r   zTracebackEntry.lineno   s    ~'!++rB   r   c                >    t          | j        d          }|d         S )NrM   )limitr   )r   r   )r?   stack_summarys     r@   get_python_framesummaryz&TracebackEntry.get_python_framesummary   s#     #4>;;;QrB   r+   
int | Nonec                    d S r>   rz   rO   s    r@   end_lineno_relativez"TracebackEntry.end_lineno_relative       4rB   c                    d S r>   rz   rO   s    r@   colnozTracebackEntry.colno   r   rB   c                    d S r>   rz   rO   s    r@   	end_colnozTracebackEntry.end_colno   r   rB   c                t    |                                  }|j        d S |j        dz
  | j        j        j        z
  S rL   )r   
end_linenor}   r   rP   )r?   frame_summarys     r@   r   z"TracebackEntry.end_lineno_relative   s;     88::M'/t +a/$*/2MMMrB   c                4    |                                  j        S )z>Starting byte offset of the expression in the traceback entry.)r   r   rO   s    r@   r   zTracebackEntry.colno   s     //1177rB   c                4    |                                  j        S )z<Ending byte offset of the expression in the traceback entry.)r   r   rO   s    r@   r   zTracebackEntry.end_colno   s     //11;;rB   r|   c                4    t          | j        j                  S r>   )r|   r   tb_framerO   s    r@   r}   zTracebackEntry.frame   s    T^,---rB   c                4    | j         | j        j        j        z
  S r>   )r   r}   r   rP   rO   s    r@   rellinezTracebackEntry.relline  s    {TZ_888rB   rQ   c                B    d| j         j        j         d| j        dz    dS )Nz<TracebackEntry :rM   >)r}   r   r\   r   rO   s    r@   __repr__zTracebackEntry.__repr__  s(    K$*/"6KKqKKKKrB   r"   c                `    | j         j        j        }|J |                    | j                  S )z6_pytest._code.Source object for the current statement.)r}   r   ra   r   r   )r?   rc   s     r@   r   zTracebackEntry.statement  s2     +!!!""4;///rB   rU   c                $    | j         j        j        S )zPath to the source code.)r}   r   r\   rO   s    r@   r\   zTracebackEntry.path  s     z##rB   r   c                    | j         j        S )zLocals of underlying frame.)r}   r   rO   s    r@   localszTracebackEntry.locals  s     z""rB   c                $    | j         j        j        S r>   )r}   r   rP   rO   s    r@   getfirstlinesourcez!TracebackEntry.getfirstlinesource  s    z**rB   astcache dict[str | Path, ast.AST] | Noner]   c                F   | j         j        j        }|dS dx}}|)| j         j        j        }||                    |d          }|                                 }	 t          | j        ||          \  }}}|||||<   n# t          $ r | j        dz   }Y nw xY w|||         S )zReturn failing source code.N)astnoderM   )	r}   r   ra   r\   getr   r!   r   SyntaxError)r?   r   rc   keyr   startr`   ends           r@   	getsourcezTracebackEntry.getsource  s     +>4g*/&C",,sD11''))	(3VW  OGQ 8#7 '	  	" 	" 	"+/CCC	"
 eCi  s   A? ?BBexcinfo#ExceptionInfo[BaseException] | Nonere   c                    d}| j         j        | j         j        fD ]}	 |d         } n# t          $ r Y w xY w|rt	          |          r ||          S |S )a  Return 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__)r}   r   r   	Exceptioncallable)r?   r   tbhmaybe_ns_dcts       r@   ishiddenzTracebackEntry.ishidden8  s     MR!Z0$*2FG 
	 
	L
"#67       	 8C== 	 3w<<
s   (
55c           	         | j         j        j        }	 t          | j                                                  }n# t          $ r  t          $ r d}Y nw xY wd| j         d| j	        dz    d| d| d	S )N???z  File 'z':rM   z in z
  
)
r}   r   rT   rQ   r   lstripKeyboardInterruptBaseExceptionr\   r   )r?   rT   r1   s      r@   __str__zTracebackEntry.__str__Q  s    z#	t~&&--//DD  	 	 	 	 	 	DDD	
 O$)NNt{QNNDNNdNNNNs   &: AAc                .    | j         j        j        j        S )zco_name of underlying code.)r}   r   r9   rS   rO   s    r@   rT   zTracebackEntry.name^  s     z"**rB   r>   )r   r   r   r   r;   r<   )r   r   r;   r   rm   )r;   r   r;   r   )r;   r|   rn   rp   ro   r   )r   r   r;   r]   )r   r   r;   re   )rr   rs   rt   ru   rv   rA   r   ry   r   r   sysversion_infor   r   r   r}   r   r   r   r\   r   r   r   rc   r   r   rT   rz   rB   r@   r   r      s       ((,I
 7;- - - - -: : : :
 , , , X,        '!!		 	 	 
	 
	 	 	 
	 
	 	 	 
	 	 
	N 	N 	N 
	N 
	8 	8 	8 
	8 
	< 	< 	< 
	< . . . X. 9 9 9 X9L L L L 0 0 0 X0 $ $ $ X$ # # # X#+ + + + <@! ! ! ! !4 Xi  F   2O O O O + + + X+ + +rB   r   c                       e Zd ZdZd fdZ	 	 	 	 dddZed d            Zed!d            Zd" fdZd#dZd$dZ	 xZ
S )%	TracebackzQTraceback objects encapsulate and offer higher level access to Traceback entries.tb(TracebackType | Iterable[TracebackEntry]r;   r<   c                    t          |t                    r0dd}t                                           ||                     dS t                                          |           dS )z@Initialize from given python traceback object and ExceptionInfo.curr   r;   Iterable[TracebackEntry]c              3  J   K   | }|t          |          V  |j        }|d S d S r>   )r   tb_next)r   cur_s     r@   fzTraceback.__init__.<locals>.fn  s@      -0&(.....<D &&&&&rB   N)r   r   r;   r   )
isinstancer   superrA   )r?   r   r   	__class__s      r@   rA   zTraceback.__init__g  sq    
 b-(( 
	!( ( ( ( GGQQrUU#####GGR     rB   Nr\   os.PathLike[str] | str | Noner   r   rP   excludepathos.PathLike[str] | Nonec                   |dnt          j        |          }|dnt          j        |          }| D ]}|j        j        }|j        }	|t          |	          |k    r+|)t          |	t                    r|d |	j        D             v rV||j	        |k    rd||j        j        j
        |k    r|t          |j                  c S | S )a  Return a Traceback instance wrapping part of this Traceback.

        By providing any combination of path, lineno and firstlineno, the
        first frame to start the to-be-returned traceback is determined.

        This allows cutting the first part of a Traceback instance e.g.
        for formatting reasons (removing some uninteresting bits that deal
        with handling of the exception/traceback).
        Nc              3  4   K   | ]}t          |          V  d S r>   )rQ   ).0r[   s     r@   	<genexpr>z Traceback.cut.<locals>.<genexpr>  s(      $F$FSVV$F$F$F$F$F$FrB   )osfspathr}   r   r\   rQ   r   r   parentsr   rP   r   r   )
r?   r\   r   rP   r   path_excludepath_xr   codepaths
             r@   cutzTraceback.cutx  s      ")D//*2tt	+8N8N 	* 	*A7<DyHCMMU$:$:'x.. ( $F$FX5E$F$F$FFF!ah&&8&8&17<+C{+R+RQ[)))))rB   r   r   r   c                    d S r>   rz   r?   r   s     r@   __getitem__zTraceback.__getitem__  s    ADrB   slicec                    d S r>   rz   r  s     r@   r  zTraceback.__getitem__  s    47CrB   SupportsIndex | sliceTracebackEntry | Tracebackc                    t          |t                    r4|                     t                                          |                    S t                                          |          S r>   )r   r  r   r   r  )r?   r   r   s     r@   r  zTraceback.__getitem__  sQ    c5!! 	,>>%''"5"5c":":;;;77&&s+++rB   excinfo_or_fn?ExceptionInfo[BaseException] | Callable[[TracebackEntry], bool]c               x    t          t                    rfd}n}t          t          ||                     S )a  Return 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.
        c                0    |                                 S r>   )r   )r   r	  s    r@   <lambda>z"Traceback.filter.<locals>.<lambda>  s    qzz-888 rB   )r   ExceptionInfor   filter)r?   r	  fns    ` r@   r  zTraceback.filter  sD     m]33 	8888BBBD))***rB   c                L   i }t          |           D ]\  }}|j        j        j        t	          |j        j        j                  |j        f}|                    |g           }t          |j        j	                  }|r|D ]}||k    r|c c S |
                    |           dS )z~Return the index of the frame/TracebackEntry where recursion originates if
        appropriate, None if no recursion occurred.N)	enumerater}   r   r\   idr9   r   
setdefaultdictr   r   )r?   cacheientryr   valueslocotherlocs           r@   recursionindexzTraceback.recursionindex  s     CE!$ 	 	HAu
 +"'EK,<,@)A)A5<OC%%c2..Fu{+,,C ! & ! !H3  'MM#trB   )r   r   r;   r<   )NNNN)
r\   r   r   r   rP   r   r   r   r;   r   )r   r   r;   r   )r   r  r;   r   )r   r  r;   r  )r	  r
  r;   r   r   )rr   rs   rt   ru   rA   r   r   r  r  r  __classcell__r   s   @r@   r   r   d  s        [[! ! ! ! ! !& /3!"&/3" " " " "H DDD XD777 X7, , , , , ,+ + + +(       rB   r   Texcr   include_subexception_msgre   r;   rQ   c                z   	 t          | dg           }nc# t          $ rV t          t          j                            dd           dd          }t          j        dk     rt          | |          rg }n Y nw xY w|st          | t                    r| j        }nt          |           }d
                    |g|          S )N	__notes__zurllib.error	HTTPErrorrz   )r,      r   )getattrr   r   modulesr   r   r   r.   messagerQ   join)r  r   notesr#  r'  s        r@   stringify_exceptionr*    s    
["--    CKOONDAA;PRSS	g%%*S)*D*D%EE  E $ 
38J(K(K +c((99	
	
  s    AA43A4E)bound	covariantc                     e Zd ZU dZdZded<   ded<   ded<   d	ed
<   	 	 dVdddWdZe	 dXdYd            Ze	 dXdZd            Z	edXd[d!            Z
ed\d"            Zd]d#Zed^d%            Zed_d&            Zed`d(            Zedad)            Zedbd+            Zej        dcd-            Zdad.Zddded0Zdfd3Zdgd5Z	 	 	 	 	 	 	 	 dhdidCZdjdGZ	 	 dkdldRZdddSdmdUZdS )nr  zJWraps sys.exc_info() objects and offers help for navigating the traceback.zAssertionError('assert r   _assert_start_repr'tuple[type[E], E, TracebackType] | None_excinforQ   
_striptextTraceback | None
_tracebackrW   NF	_ispytestr   	striptext	tracebackr6  re   r;   r<   c               N    t          |           || _        || _        || _        d S r>   )r(   r1  r2  r4  )r?   r   r7  r8  r6  s        r@   rA   zExceptionInfo.__init__  s+     	y!!!##rB   	exceptionr+  exprinfo
str | NoneExceptionInfo[E]c                ~    |j         s
J d            t          |          ||j         f}|                     ||          S )aE  Return 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)rE   r:  r;  exc_infos       r@   from_exceptionzExceptionInfo.from_exception  sU    . & 	
 	
3	
 	
 	
 OOY	0GH  8444rB   rB   tuple[type[E], E, TracebackType]c                    d}|gt          |d         t                    rLt          |d         dd          }|t          |d                   }|r|                    | j                  rd} | ||d          S )z@Like :func:`from_exception`, but using old-style exc_info tuple.rW   NrM   msgzAssertionError: Tr5  )r   AssertionErrorr%  r&   
startswithr/  )rE   rB  r;  r2  s       r@   rA  zExceptionInfo.from_exc_info%  s     

8A; G Gx{E488H#HQK00 0H//0FGG 0/
s8Z48888rB   ExceptionInfo[BaseException]c                    t          j                    }|d         
J d            |d         
J d            |d         
J d            |d         |d         |d         f}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__()``.
        r   Nzno current exceptionrM      )r   rB  r  rA  )rE   r;  tuprB  s       r@   from_currentzExceptionInfo.from_current6  s     lnn1v!!#9!!!1v!!#9!!!1v!!#9!!!FCFCF+**8X>>>rB   c                     | dd          S )z!Return an unfilled ExceptionInfo.NTr5  rz   )rE   s    r@   	for_laterzExceptionInfo.for_laterJ  s     s44((((rB   c                6    | j         
J d            || _         dS )z<Fill an unfilled ExceptionInfo created with ``for_later()``.Nz ExceptionInfo was already filledr1  )r?   rB  s     r@   fill_unfilledzExceptionInfo.fill_unfilledO  s$    }$$&H$$$ rB   type[E]c                >    | j         
J d            | j         d         S )zThe exception class.Nz6.type can only be used after the context manager exitsr   rQ  rO   s    r@   r@  zExceptionInfo.typeT  s,     }((D )(( }QrB   c                >    | j         
J d            | j         d         S )zThe exception value.Nz7.value can only be used after the context manager exitsrM   rQ  rO   s    r@   r4   zExceptionInfo.value\  s,     }((E )(( }QrB   r   c                >    | j         
J d            | j         d         S )zThe exception raw traceback.Nz4.tb can only be used after the context manager exitsrK  rQ  rO   s    r@   r   zExceptionInfo.tbd  s,     }((B )(( }QrB   c                <    | j         
J d            | j        j        S )zThe type name of the exception.Nz:.typename can only be used after the context manager exits)r1  r@  rr   rO   s    r@   typenamezExceptionInfo.typenamel  s*     }((H )(( y!!rB   r   c                P    | j         t          | j                  | _         | j         S )zThe traceback.)r4  r   r   rO   s    r@   r8  zExceptionInfo.tracebackt  s%     ?"'00DOrB   r4   c                    || _         d S r>   )r4  )r?   r4   s     r@   r8  zExceptionInfo.traceback{  s    rB   c                    | j         dS d| j        j         dt          | j         d                    dt	          | j                   dS )Nz)<ExceptionInfo for raises contextmanager>< rM   z tblen=r   )r1  r   rr   r&   lenr8  rO   s    r@   r   zExceptionInfo.__repr__  sR    = >>f4>*ffXdmA6F-G-GffPSTXTbPcPcffffrB   tryshortc                   d
fd|rKt          | j        t                    r1 | j                  x}|dt          | j                  j         dS t          | j        | j                  }d	                    |          }|                                }|r6|                    | j	                  r|t          | j	                  d         }|S )a  Return 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).
        eg!BaseExceptionGroup[BaseException]r;   BaseException | Nonec                    t          | j                  dk    rd S t          | j        d         x}t                    r |          S |S )NrM   r   )r^  
exceptionsr   r.   )ra  e_get_single_subexcs     r@   rg  z1ExceptionInfo.exconly.<locals>._get_single_subexc  sT     2=!!Q&&tr}Q//!1CDD -))!,,,HrB   Nz [single exception in ]rW   )ra  rb  r;   rc  )r   r4   r.   r@  rr   r   r(  rstriprH  r2  r^  )r?   r_  subexclinestextrg  s        @r@   exconlyzExceptionInfo.exconly  s    	 	 	 	 	 	 	S4:'9::	S .-dj999FRRd4:6F6F6ORRRR%di<<wwu~~{{}} 	4t// 4C00223rB   r  EXCEPTION_OR_MOREc                ,    t          | j        |          S )zReturn True if the exception is an instance of exc.

        Consider using ``isinstance(excinfo.value, exc)`` instead.
        )r   r4   )r?   r  s     r@   errisinstancezExceptionInfo.errisinstance  s    
 $*c***rB   ReprFileLocation | Nonec                0   t          dt          | j                   dz
  d          D ]m}| j        |         }|                    |           sI|j        j        j        j        |j        }}| 	                    d          }t          ||dz   |          c S nd S )NrM   Tr_  )ranger^  r8  r   r}   r   r9   rX   r   rm  ReprFileLocation)r?   r  r  r\   r   rm  s         r@   _getreprcrashzExceptionInfo._getreprcrash  s     rC///!3R88 	C 	CAN1%E>>$'' C${/3?f,,,55'fqj'BBBBBC trB   r/   T
showlocalsstyleTracebackStyleabspathtbfilter:bool | Callable[[ExceptionInfo[BaseException]], Traceback]funcargstruncate_localstruncate_argschain&ReprExceptionInfo | ExceptionChainReprc	           
     *   |dk    rbt          t          t          | j        | j        | j        r| j        d         j        nd                    |                                           S t          ||||||||          }	|		                    |           S )a  Return 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 truncate_args:
            With ``showargs==True``, make sure args 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.
        r3   r   Nreprtraceback	reprcrash)rx  ry  r{  r|  r~  r  r  r  )
ReprExceptionInfoReprTracebackNativer   r@  r4   r8  r   rw  FormattedExcinforepr_excinfo)
r?   rx  ry  r{  r|  r~  r  r  r  fmts
             r@   getreprzExceptionInfo.getrepr  s    b H$1$	
7;~Oq)334   ,,..	 	 	 	 !+'	
 	
 	
 %%%rB   regexpstr | re.Pattern[str]Literal[True]c                    d}t          | j                  }d|d|}||k    r|dz  }t          j        ||          s
J |            dS )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?)r*  r4   research)r?   r  r   r4   rF  s        r@   matchzExceptionInfo.match   sg     !#DJ//TvTT5TTU??@@Cy'',,,,,trB   rM   	exc_grouprb  expected_exceptionr  str | re.Pattern[str] | Nonetarget_depthr   current_depthrJ   c           	        |||k    rdS |j         D ]y}t          |t                    r|                     |||||dz             r dS |||k    r?t          ||          sP|%t	          |          }t          j        ||          sw dS dS )zFReturn `True` if a `BaseExceptionGroup` contains a matching exception.NFrM   T)re  r   r.   _group_containsr*  r  r  )r?   r  r  r  r  r  r  r4   s           r@   r  zExceptionInfo._group_contains  s     $=<+G+G5' 	 	C#122  ''+UL-RSBS     44(}/L/Lc#566  +C00y.. 44urB   )r  depthr  c                   d}t          | j        t                    s
J |            d}||dk    s
J |            |                     | j        |||          S )a  Check whether a captured exception group contains a matching exception.

        :param Type[BaseException] | Tuple[Type[BaseException]] expected_exception:
            The expected exception type, or a tuple if one of multiple possible
            exception types are expected.

        :param str | re.Pattern[str] | None match:
            If specified, a string containing a regular expression,
            or a regular expression object, that is tested against the string
            representation of the exception and its `PEP-678 <https://peps.python.org/pep-0678/>` `__notes__`
            using :func:`re.search`.

            To match a literal string that may contain :ref:`special characters
            <re-syntax>`, the pattern can first be escaped with :func:`re.escape`.

        :param Optional[int] depth:
            If `None`, will search for a matching exception at any nesting depth.
            If >= 1, will only match an exception if it's at the specified depth (depth = 1 being
            the exceptions contained within the topmost exception group).

        .. versionadded:: 8.0

        .. warning::
           This helper makes it easy to check for the presence of specific exceptions,
           but it is very bad for checking that the group does *not* contain
           *any other exceptions*.
           You should instead consider using :class:`pytest.RaisesGroup`

        z=Captured exception is not an instance of `BaseExceptionGroup`z!`depth` must be >= 1 if specifiedNrM   )r   r4   r.   r  )r?   r  r  r  rF  s        r@   group_containszExceptionInfo.group_contains-  se    H N$*&899>>3>>>15A::::::##DJ0BE5QQQrB   )rW   N)
r   r0  r7  rQ   r8  r3  r6  re   r;   r<   r>   )r:  r+  r;  r<  r;   r=  )rB  rD  r;  r<  r;   r=  )r;  r<  r;   rI  )r;   r=  )rB  rD  r;   r<   )r;   rS  )r;   r+  )r;   r   rn   )r;   r   )r4   r   r;   r<   rq   )r_  re   r;   rQ   )r  rn  r;   re   )r;   rq  )Fr/   FTFTTT)rx  re   ry  rz  r{  re   r|  r}  r~  re   r  re   r  re   r  re   r;   r  )r  r  r;   r  rL   )r  rb  r  rn  r  r  r  r   r  rJ   r;   re   )r  rn  r  r  r  r   r;   re   )rr   rs   rt   ru   r/  __annotations__rA   rw   rC  rA  rM  rO  rR  ry   r@  r4   r   rX  r8  setterr   rm  rp  rw  r  r  r  r  rz   rB   r@   r  r    s         UT#<<<<<5555OOO    
 &*	$  $ $ $ $ $ $   $5 5 5 5 [5:   $9 9 9 9 [9  ? ? ? ? [?& ) ) ) [)! ! ! !
       X        X        X  " " " X"    X        g g g g
    B+ + + +	 	 	 	 ! &OS $"G& G& G& G& G&R   ( $(    D /3 (R (R (R (R (R (R (R (RrB   r  )	TypeAliasr  TracebackFilterc                  H   e Zd ZU dZdZded<   dZded<   dZded	<   d
Zded<   dZ	ded<   dZ
ded<   dZded<   dZded<   dZded<   dZded<    ej        edd          Zded<   dLdZdMd ZdNd"Z	 	 	 	 	 	 dOdPd.ZdQd4Z	 	 dRdSd9ZdTd=Z	 dUdVd@ZdWdCZdXdEZdYdIZdZdKZd$S )[r  z>Presenting information about failing Functions and Generators.r   r   flow_markerr+  fail_markerFre   rx  r/   rz  ry  Tr{  r  r|  r~  r  r  r  )default_factoryinitr   zdict[str | Path, ast.AST]r   rc   r"   r;   rJ   c                l   	 t          |                    t          |          dz
                      }nM# t          $ r  t          $ r6 	 t          |d                   }n# t          $ r  t          $ r Y Y dS w xY wY nw xY wdt          |          t          |                                          z
  z   S )NrM   rs  r      )rQ   r   r^  r   r   r   )r?   rc   ss      r@   
_getindentzFormattedExcinfo._getindentw  s    
	F''Fa8899AA  	 	 	 	 	 	r
OO$       qqq 	 CFFS__,--s3   25 A?
A A? A94A?8A99A?>A?r  r   r]   c                f    |                     | j                  }||                                }|S r>   )r   r   deindent)r?   r  rc   s      r@   _getentrysourcez FormattedExcinfo._getentrysource  s/    //__&&FrB   ReprFuncArgs | Nonec                    | j         rqg }|j                            d          D ]D\  }}| j        rt	          |          }nt	          |d           }|                    ||f           Et          |          S d S )NT)rd   )maxsize)r~  r}   rl   r  r&   r   ReprFuncArgs)r?   r  argsargnameargvaluestr_reprs         r@   	repr_argszFormattedExcinfo.repr_args  s    = 	&D%*[%8%8T%8%B%B 1 1!% @'11HH'$???HWh/0000%%%trB   rs  N
line_indexr   r   r0   end_line_indexr   r   r   	list[str]c           
        g }||dk     r|t          |          z  }||t          |j                  k    s|dk     rt          d          }d}d}	|r|                    |	|j        |                                         z              |                    |                     |j        |         |j        |                                         ||||                     n|j        d|         D ]}
|                    |	|
z              |                    | j        dz   |j        |         z              |                    |                     |j        |         |j        |         ||||                     |j        |dz   d         D ]}
|                    |	|
z              |D|rdn| 	                    |          }|                    | 
                    ||d	
                     |S )z,Return formatted and marked up source lines.Nr   r       )raw_liner1   r   r   r   r      rM   r  T)indentmarkall)r^  rk  r"   r   stripextendget_highlight_arrows_for_line	raw_linesr  r  get_exconly)r?   rc   r  r   r0   r  r   r   rk  space_prefixr1   r  s               r@   
get_sourcezFormattedExcinfo.get_source  s$    *q..#f++%J>Z3v|+<+<<<
Q E]]FJ 	2LLZ(@(F(F(H(HHIIILL22#-j9j17799%-' 3  	 	 	 	 [j[1 2 2\D01111LL)E1FL4LLMMMLL22#-j9j1%-' 3  	 	 	 Z!^%5%56 2 2\D01111<QQT__V%<%<FLL))'&$)OOPPPrB   r1   rQ   r  r   r   c                *   ||k    rg S ||g S t          |          t          |          z
  }t          ||          }t          ||          }	|	|z
  }
|
t          |                                          k    rg S d}|d||z
  dz   z  z  }|d|
z  z  }|gS )zReturn characters highlighting a source line.

        Example with colno and end_colno pointing to the bar expression:
                   "foo() + bar()"
        returns    "        ^^^^^"
        Nr  r]  rM   ^)r^   _byte_offset_to_character_offsetr  )r?   r1   r  r   r   r   r   num_stripped_charsstart_char_offsetend_char_offset
num_carets
highlightss               r@   r  z.FormattedExcinfo.get_highlight_arrows_for_line  s     ZI=I-I ]]SYY6<XuMM:8YOO$'88
 TZZ\\****I
c.1CCaGHH
cJ&&
|rB   r  rI  r  r  c                    g }d|z  }|                     d                              d          }| j        |dd          z   }|D ]}|                    ||z              |s|}|S )Nr]  Trt  r   rM   )rm  splitr  r   )	r?   r   r  r  rk  	indentstrexlines
failindentr1   s	            r@   r  zFormattedExcinfo.get_exconly  s     &L	//4/0066t<<%	!""5
 	' 	'DLLd*+++ '&
rB   r   Mapping[str, object]ReprLocals | Nonec                J   | j         rg }d |D             }|                                 |D ]g}||         }|dk    r|                    d           &| j        rt	          |          }nt          |          }|                    |dd|            ht          |          S d S )Nc                *    g | ]}|d          dk    |S )r   @rz   )r   r  s     r@   
<listcomp>z0FormattedExcinfo.repr_locals.<locals>.<listcomp>  s!    ;;;CSVs]]C]]]rB   __builtins__z__builtins__ = <builtins>z<10 = )rx  sortr   r  r&   r$   
ReprLocals)r?   r   rk  keysrT   r4   r  s          r@   repr_localszFormattedExcinfo.repr_locals  s    ? 	%E;;6;;;DIIKKK = =t>))LL!<====
 + 5#+E??#-e#4#4LLD!;!;!;!;!;<<<<
 e$$$trB   TracebackEntry | None	ReprEntryc           	        g }||j         |j         n| j        }|dv r||                     |          }|t          d          }d}d\  }}}	n|j        }|j        }|j        }|j        }	|dk    }
|
s|                     |          nd }| 	                    ||||
|||	          }|
                    |           |
rd|j         }n|r|j        pd}|j        }|                     |          }t          ||j        d	z   |          }|                     |j                  }t'          |||||          S |d
k    rO|r:|
                    t)          |j                                      d                     t'          |d d d |          S |r*|
                    |                     |d                     t'          |d d d |          S )N)r0   r/   r   r   )NNNr0   )rc   r  r   r0   r  r   r   zin rW   rM   r4   r   r  r  )r   ry  r  r"   r   r   r   r   r  r  r  rT   rX  r\   	_makepathrv  r   r  r   r  rQ   r4   r  r  )r?   r  r   rk  ry  rc   r  r  r   r   r0   reprargsr  r'  
entry_pathr\   reprfileloc
localsreprs                     r@   repr_traceback_entryz%FormattedExcinfo.repr_traceback_entry  s   
   U%6%B  	
 %%%%*;))%00F~
3C0yy"]
!&!:!O	W$E49Ct~~e,,,tH%-#    A LLOOO ?,
,,"7w'7>BJ>>*--D*41A7KKK))%,77JUHj+uMMMg =S//55d;;<<<UD$e<<< BT--ga-@@AAAUD$e<<<rB   r\   rU   c                :   | j         st          |t                    rq	 t          t          j                    |          }n# t
          $ r t          |          cY S w xY wt          |          t          t          |                    k     r|S t          |          S r>   )r{  r   r   r*   cwdrZ   rQ   r^  )r?   r\   nps      r@   r  zFormattedExcinfo._makepathQ  s    | 	
4 6 6 	! T22 ! ! !4yy   !2wwSYY''	4yys   !A   AAReprTracebackc                    t           j                  }t          j        t                    r                     |          \  }}nd }|s2|d}                     d           g}t          || j                  S |d          j        dk    r.                               g}t          |d  j                  S  fd|D             }t          || j                  S )NzXAll traceback entries are hidden. Pass `--full-trace` to see hidden and internal frames.)ry  rs  r4   c                L    g | ] }                     ||k    rnd           !S r>   )r  )r   r  r   lastr?   s     r@   r  z3FormattedExcinfo.repr_traceback.<locals>.<listcomp>n  sE     
 
 
 %%eWW4PP
 
 
rB   )	filter_excinfo_tracebackr|  r   r4   RecursionError_truncate_recursive_tracebackr  r  ry  )r?   r   r8  	extralineentriesr  s   ``   @r@   repr_tracebackzFormattedExcinfo.repr_traceback[  s   ,T]GDD	gm^44 	#'#E#Ei#P#P IyyI 	G v	00w??@G )4:FFFF}:  00w??@G $djAAAA
 
 
 
 
 
"
 
 
 WitzBBBBrB   r8  r   tuple[Traceback, str | None]c                   	 |                                 }|d}|d|dz            }n`d}n]# t          $ rP}d}dt          |          j         d|d| dt	          |           d		}|d|         || d         z   }Y d}~nd}~ww xY w||fS )
aK  Truncate the given recursive traceback trying to find the starting
        point of the recursion.

        The detection is done by going through each traceback entry and
        finding the point in which the locals of the frame are equal to the
        locals of a previous frame (see ``recursionindex()``).

        Handle the situation where the recursion process might raise an
        exception (for example comparing numpy arrays using equality raises a
        TypeError), in which case we do our best to warn the user of the
        error and show a limited traceback.
        Nz/!!! Recursion detected (same locals & position)rM   
   z!!! Recursion error detected, but an error occurred locating the origin of recursion.
  The following exception happened when comparing locals in the stack frame:
    : z
  Displaying first and last z stack frames out of .)r  r   r@  rr   r^  )r?   r8  r  r  rf  
max_framess         r@   r  z.FormattedExcinfo._truncate_recursive_tracebackt  s	   	!&5577N )M	%&:(:&:;		 		!  
	I 
	I 
	IJbAww'b b+,b b 0:b b QTT]P^P^b b b  "+:+.J;<<1HHIIIIII
	I$ )##s   + 
BAB  BExceptionChainReprc                   g }|j         }|}d }t                      }|t          |          |vr|                    t          |                     |rt	          |t
                    rVt          | j        |          }t          t          t          |j                   |j         |d         j                            }n|                     |          }|                                }	n-t          t          t          |          |d                     }d }	|||	|fgz  }|j        4| j        r-|j        }|j        rt"                              |          nd }d}nD|j        ;|j        s4| j        r-|j        }|j        rt"                              |          nd }d}nd }|t          |          |v|                                 t-          |          S )Nr   zDThe above exception was the direct cause of the following exception:zCDuring handling of the above exception, another exception occurred:)r4   setr  addr   r.   r  r|  r  r   r@  r   r  rw  	__cause__r  r?  r  rC  __context____suppress_context__reverser  )
r?   r   
repr_chainrf  excinfo_descrseenr8  r  r  s
             r@   r  zFormattedExcinfo.repr_excinfo  s   VX
")-8?m1T 1 1HHRUUOOO !
 a!344 B 8 P PI$7( //#M%aL2 % %MM %)$7$7$A$AM$2244		 !44DT!WWaQU4V4V W W 	M9e<==J{&4:&K>?oW=77:::SW^)!2H)TZ)M>?oW=77:::SW]O m1T 1 1P 	!*---rB   )rc   r"   r;   rJ   )r  r   r;   r]   )r  r   r;   r  )rs  NFNNN)rc   r]   r  rJ   r   r   r0   re   r  r   r   r   r   r   r;   r  )r1   rQ   r  rQ   r   r   r   r   r   r   r   r   r;   r  )r  F)r   rI  r  rJ   r  re   r;   r  )r   r  r;   r  r>   )r  r  r   r   r;   r  )r\   rU   r;   rQ   )r   rI  r;   r  )r8  r   r;   r  )r   rI  r;   r  )rr   rs   rt   ru   r  r  r  rx  ry  r{  r|  r~  r  r  r  dataclassesfieldr  r   r  r  r  r  r  r  r  r  r  r  r  r  rz   rB   r@   r  r  c  s$        HH  KKJ"E""""G $H$$$$H O    ME*;+*;5u+ + +H    . . . .   
 
 
 
 7;%)  $3 3 3 3 3j# # # #P 	    "   : 8<2= 2= 2= 2= 2=h   C C C C2#$ #$ #$ #$J/. /. /. /. /. /.rB   r  F)eqc                  &    e Zd Zd
dZd
dZddZd	S )TerminalReprr;   rQ   c                    t                      }t          |          }|                     |           |                                                                S )N)file)r
   r#   
toterminalgetvaluer  )r?   iotws      r@   r   zTerminalRepr.__str__  sI     ZZ$$${{}}""$$$rB   c                :    d| j          dt          |           ddS )Nr\  z instance at 0xr   )r   r  rO   s    r@   r   zTerminalRepr.__repr__  s&    >4>>>4>>>>>rB   r  r#   r<   c                    t                      r>   )NotImplementedErrorr?   r  s     r@   r  zTerminalRepr.toterminal  s    !###rB   Nrn   r  r#   r;   r<   )rr   rs   rt   r   r   r  rz   rB   r@   r  r    sP        % % % %? ? ? ?$ $ $ $ $ $rB   r  c                  d    e Zd ZU ded<   ded<    ej        de          Zded<   dddZddZ	dS )ExceptionReprr  r  rq  r  F)r  r  zlist[tuple[str, str, str]]sections-rT   rQ   contentsepr;   r<   c                @    | j                             |||f           d S r>   )r  r   )r?   rT   r  r  s       r@   
addsectionzExceptionRepr.addsection  s%    dGS122222rB   r  r#   c                x    | j         D ]1\  }}}|                    ||           |                    |           2d S r>   )r  r  r1   )r?   r  rT   r  r  s        r@   r  zExceptionRepr.toterminal  sM    "&- 	 	D'3FF3GGG	 	rB   N)r  )rT   rQ   r  rQ   r  rQ   r;   r<   r  )
rr   rs   rt   r  r	  r
  listr  r!  r  rz   rB   r@   r  r    s          !   &&&&+<;+<D, , ,H    3 3 3 3 3     rB   r  c                  8     e Zd ZU ded<   d	 fdZd
 fdZ xZS )r  CSequence[tuple[ReprTraceback, ReprFileLocation | None, str | None]]r  r;   r<   c                    t                                          |d         d         |d         d                    || _        d S )Nrs  r   rM   r  )r   rA   r  )r?   r  r   s     r@   rA   zExceptionChainRepr.__init__  sI     	)A,Bil 	 	
 	
 	
 


rB   r  r#   c                   | j         D ]W}|d                             |           |d         2|                    d           |                    |d         d           Xt                                          |           d S )Nr   rK  rW   T)yellow)r  r  r1   r   )r?   r  elementr   s      r@   r  zExceptionChainRepr.toterminal  s~    z 	1 	1GAJ!!"%%%qz%
40002rB   )r  r%  r;   r<   r  )rr   rs   rt   r  rA   r  r  r  s   @r@   r  r    si         NNNN
 
 
 
 
 
         rB   r  c                  6     e Zd ZU ded<   ded<   d
 fd	Z xZS )r  r  r  rq  r  r  r#   r;   r<   c                ~    | j                             |           t                                          |           d S r>   )r  r  r   )r?   r  r   s     r@   r  zReprExceptionInfo.toterminal  s8    %%b)))2rB   r  )rr   rs   rt   r  r  r  r  s   @r@   r  r    sW             &&&&         rB   r  c                  D    e Zd ZU ded<   ded<   ded<   dZded	<   ddZdS )r  z%Sequence[ReprEntry | ReprEntryNative]reprentriesr<  r  rz  ry  z_ r   entrysepr  r#   r;   r<   c                   t          | j                  D ]\  }}|j        dk    r|                    d           |                    |           |t          | j                  dz
  k     rK| j        |dz            }|j        dk    s|j        dk    r%|j        dk    r|                    | j                   | j        r|                    | j                   d S d S )Nr/   rW   rM   r0   )	r  r-  ry  r1   r  r^  r  r.  r  )r?   r  r  r  
next_entrys        r@   r  zReprTraceback.toterminal  s    !$"233 		* 		*HAu{f$$R   3t'((1,,,!-a!e4
;&((K7**z/?6/I/IFF4=)))> 	$GGDN#####	$ 	$rB   Nr  )rr   rs   rt   r  r.  r  rz   rB   r@   r  r    s_         6666H$ $ $ $ $ $rB   r  c                      e Zd ZddZdS )r  tblinesSequence[str]r;   r<   c                L    t          |          g| _        d | _        d| _        d S )Nr3   )ReprEntryNativer-  r  ry  )r?   r2  s     r@   rA   zReprTracebackNative.__init__,  s'    +G445


rB   N)r2  r3  r;   r<   )rr   rs   rt   rA   rz   rB   r@   r  r  +  s(             rB   r  c                  0    e Zd ZU ded<   dZded<   dd
ZdS )r5  r3  rk  r3   zClassVar[TracebackStyle]ry  r  r#   r;   r<   c                `    |                     d                    | j                             d S )NrW   )writer(  rk  r  s     r@   r  zReprEntryNative.toterminal8  s(    
$$%%%%%rB   Nr  )rr   rs   rt   r  ry  r  rz   rB   r@   r5  r5  2  sG         &.E....& & & & & &rB   r5  c                  Z    e Zd ZU ded<   ded<   ded<   ded<   d	ed
<   ddZddZddZdS )r  r3  rk  r  reprfuncargsr  
reprlocalsrq  r  rz  ry  r  r#   r;   r<   c                f   | j         sdS | j        dk    r6| j         D ],}|                    |           |                    d           -dS t          j         d}t          |          }g }g }g }t          | j                   D ]z\  }}|                    |          }	|	r$|                    | j         |d                     n;|	                    |d|                    |	                    ||d                    {|
                    ||           |D ]}|                    |dd           dS )a  Write the source code portions of a list of traceback entries with syntax highlighting.

        Usually entries are lines like these:

            "     x = 1"
            ">    assert x == 2"
            "E    assert 1 == 2"

        This function takes care of rendering the "source" portions of it (the lines without
        the "E" prefix) using syntax highlighting, taking care to not highlighting the ">"
        character, as doing so might break line continuations.
        Nr4   r   r  Tboldred)rk  ry  r8  r  r  r^  r  rH  r  r   _write_sourcer1   )
r?   r  r1   r  indent_sizeindentssource_linesfailure_linesindexis_failure_lines
             r@   _write_entry_lineszReprEntry._write_entry_linesD  sh    z 	F:   
  F
 *5:::+&&"$#%$TZ00 	8 	8KE4"ook::O 8$$TZ%7888tL[L1222##D$67777
w/// " 	/ 	/DGGDtG....	/ 	/rB   c                (   | j         dk    r[| j        r| j                            |           |                     |           | j        r| j                            |d           d S | j        r| j                            |           |                     |           | j        r/|                    d           | j                            |           | j        r8| j        r|                    d           | j                            |           d S d S )Nr0   z        r  rW   )ry  r  r  rG  r;  r:  r1   rk  r  s     r@   r  zReprEntry.toterminalu  s   :   0 ++B///##B''' ?**2g*>>>F 	-((,,,###? 	+GGBKKKO&&r*** 	,z ''+++++	, 	,rB   rQ   c                t    d                     d                    | j                  | j        | j                  S )Nz{}
{}
{}r   )formatr(  rk  r;  r  rO   s    r@   r   zReprEntry.__str__  s4    ""IIdj!!4?D4D
 
 	
rB   Nr  rn   )rr   rs   rt   r  rG  r  r   rz   rB   r@   r  r  <  s         %%%%!!!!((((// // // //b, , , ,,
 
 
 
 
 
rB   r  c                  >    e Zd ZU ded<   ded<   ded<   ddZddZdS )rv  rQ   r\   rJ   r   r'  r;   r<   c                8    t          | j                  | _        d S r>   )rQ   r\   rO   s    r@   __post_init__zReprFileLocation.__post_init__  s    	NN			rB   r  r#   c                    | j         }|                    d          }|dk    r
|d |         }|                    | j        dd           |                    d| j         d|            d S )Nr   rs  Tr=  r   r  )r'  findr8  r\   r1   r   )r?   r  rF  r  s       r@   r  zReprFileLocation.toterminal  su     lHHTNN77bqb'C
4000
(DK((3(()))))rB   N)r;   r<   r  )rr   rs   rt   r  rM  r  rz   rB   r@   rv  rv    sY         IIIKKKLLL# # # #* * * * * *rB   rv  c                  $    e Zd ZU ded<   d
ddZd	S )r  r3  rk  rW   r  r#   r;   r<   c                J    | j         D ]}|                    ||z              d S r>   )rk  r1   )r?   r  r  r1   s       r@   r  zReprLocals.toterminal  s6    J 	# 	#DGGFTM""""	# 	#rB   N)rW   r  rr   rs   rt   r  r  rz   rB   r@   r  r    s;         # # # # # # #rB   r  c                  "    e Zd ZU ded<   d	dZdS )
r  zSequence[tuple[str, object]]r  r  r#   r;   r<   c                @   | j         rd}| j         D ]^\  }}| d| }t          |          t          |          z   dz   |j        k    r|r|                    |           |}Q|r	|d|z   z  }\|}_|r|                    |           |                    d           d S d S )NrW   r  rK  z, )r  r^  	fullwidthr1   )r?   r  	linesofarrT   r4   nss         r@   r  zReprFuncArgs.toterminal  s    9 	I#y 
' 
'e((((r77S^^+a/",>>  +	*** "II  '!TBY.		$&		 #	"""GGBKKKKK	 	rB   Nr  rR  rz   rB   r@   r  r    s6         &&&&     rB   r  r:   rC   tuple[str | Path, int]c                   t          |           } t          | d          r| j        } 	 t                              |           }n# t
          $ r~ 	 t          j        |           pt          j        |           }n# t
          $ r Y Y dS w xY w|rt          |          pd}d}|r$	 t          |           \  }}n# t          $ r Y nw xY w||fcY S w xY w|j        |j        fS )zReturn source location (path, lineno) for the given object.

    If the source cannot be determined return ("", -1).

    The line number is 0-based.
    place_as)rW   rs  rW   rs  )r'   hasattrrZ  r7   rF   	TypeErrorinspectgetsourcefilegetfiler)   r   rZ   r\   rP   )r:   r   r  r   r   r`   s         r@   getfslinenor`    s'    

CsJ l!!#&&   	&s++Cws/C/CBB 	 	 	666	 )b))0b 	&sOO	66   v~ 9d&&&sY   A 
C(A76C7
BCBC!B43C4
C>C CC
Cc                    |                      d          }t          |d|                             dd                    S )z9Converts a byte based offset in a string to a code-point.zutf-8Nreplace)errors)encoder^  decode)rQ   offsetas_utf8s      r@   r  r    s=    jj!!Gwww&&wy&AABBBrB   ocz__init__.pyr  c                    | j         j        j        j        }d|v od|v }|rdS t	          | j                  }|j        }t          |v rdS t          |v rdS dS )a   Return True if a TracebackEntry instance should be included in tracebacks.

    We hide traceback entries of:

    * dynamically generated code (no code to show up for it);
    * internal traceback from pytest or its internal libraries, py and pluggy.
    r\  r   FT)	r}   r   r9   rX   r   r\   r   _PLUGGY_DIR_PYTEST_DIR)r  raw_filenameis_generatedr[   r   s        r@   filter_tracebackrn    sr     ;#'3L,&>3,+>L u 	UZAiGgugu4rB   r|  r   rI  c                |    t          |           r | |          S | r|j                            |          S |j        S )zHFilter the exception traceback in ``excinfo`` according to ``tbfilter``.)r   r8  r  )r|  r   s     r@   r  r    sL      !x   	 ! ''000  rB   )T)r  r   r   re   r;   rQ   )r:   rC   r;   rX  )r  r   r;   re   )r|  r  r   rI  r;   r   )g
__future__r   astcollections.abcr   r   r   r   r	  r]  r   r	   r  r
   r   pathlibr   r  r   r8  r   r   r   r   typesr   r   r   typingr   r   r   r   r   r   r   r   r   r   r   pluggy_pytest_pytest._code.sourcer   r    r!   r"   _pytest._ior#   _pytest._io.safereprr$   r&   _pytest.compatr'   _pytest.deprecatedr(   _pytest.pathlibr)   r*   r   exceptiongroupr.   rz  r@  r   tuplern  r7   r|   r   r#  r   r*  r+  	dataclassr  typing_extensionsr  re   r  r  r  r  r  r  r  r  r  r5  r  rv  r  r  r`  r  __file__ri  rj  rT   parentrk  rn  r  rz   rB   r@   <module>r     s   " " " " " " " 



 $ $ $ $ $ $ $ $ $ $ $ $ # # # # # # $ $ $ $ $ $            " " " " " "       				       				 



             & & & & & & + + + + + + " " " " " "                                                                                                   + + + + + + + + + + + + 6 6 6 6 6 6 ' ' ' ' ' ' & & & & & & + + + + + + ) ) ) ) ) ) ( ( ( ( ( ( - - - - - - ( ( ( ( ( ( ' ' ' ' ' ' g111111QR$}-uT-5H#5M/NNO B* B* B* B* B* B* B* B*J; ; ; ; ; ; ; ;|a+ a+ a+ a+ a+ a+ a+ a+Hj j j j j^$ j j j\ :>    6 GC}555 dR dR dR dR dRGAJ dR dR  dRN  ++++++
 "'hm45y@AA"O    
 d. d. d. d. d. d. d. d.N %   $ $ $ $ $ $ $ ! $" %       L   ! " %          ! 0 %          !  %   $ $ $ $ $L $ $ ! $0    -    %   & & & & &l & & ! & %   Q
 Q
 Q
 Q
 Q
 Q
 Q
 ! Q
h %   * * * * *| * * ! *& %   # # # # # # # ! # %       <   ! ,' ' ' 'DC C C d6?))$//00}$$$Kd7#$$+   :	! 	! 	! 	! 	! 	!rB   