
    XiQP                    p   % S r SSKJr  SSKrSSKJr  SSKJr  SSKJr  SSKJr  SSKJ	r
  SSKrSS	KJr  SS
KJr  SSKJr  SSKJr  SSKJr  SSKrSSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SrS\S'   Sr S\S'   Sr!S\S'    " S S\5      r"S6S7S jjr#S8S jr$S9S jr%S:S jr&S;S jr'S;S  jr(S;S! jr)S;S" jr*S<S# jr+S<S$ jr,S<S% jr-S<S& jr.    S=S' jr/ S>         S?S( jjr0 S@         SAS) jjr1 S@         SBS* jjr2 S@         SCS+ jjr3 S@         SDS, jjr4 S@         SES- jjr5 S@         SES. jjr6 S@         SES/ jjr7 S@         SES0 jjr8 S@         SES1 jjr9          SFS2 jr: S@         SGS3 jjr;          SAS4 jr<S@SHS5 jjr=g)Iz"Utilities for assertion debugging.    )annotationsN)Callable)Iterable)Mapping)Sequence)Set)Any)Literal)Protocol)	normalize)outcomes)PrettyPrinter)saferepr)saferepr_unlimited)running_on_ci)Configz2Callable[[str, object, object], str | None] | None_reprcomparez&Callable[[int, str, str], None] | None_assertion_passzConfig | None_configc                  "    \ rS rSrSSS jjrSrg)_HighlightFunc)   c                    g)z'Apply highlighting to the given source.N )selfsourcelexers      I/var/www/html/venv/lib/python3.13/site-packages/_pytest/assertion/util.py__call___HighlightFunc.__call__*   s        r   Npythonr   strr   zLiteral['diff', 'python']returnr%   )__name__
__module____qualname____firstlineno__r   __static_attributes__r   r!   r   r   r   )   s    6 6r!   r   c                    U $ )zDummy highlighter that returns the text unprocessed.

Needed for _notin_text, as the diff gets post-processed to only show the "+" part.
r   )r   r   s     r   dummy_highlighterr-   .   s	    
 Mr!   c                P    [        U 5      n[        U5      nSR                  U5      $ )an  Format an explanation.

Normally all embedded newlines are escaped, however there are
three exceptions: \n{, \n} and \n~.  The first two are intended
cover nested explanations, see function and attribute explanations
for examples (.visit_Call(), visit_Attribute()).  The last one is
for when one explanation needs to span multiple lines, e.g. when
displaying diffs.

)_split_explanation_format_linesjoin)explanationlinesresults      r   format_explanationr6   6   s'     {+E5!F99Vr!   c                    U =(       d    SR                  S5      nUS   /nUSS  H6  nU(       a  US   S;   a  UR                  U5        M&  US==   SU-   -  ss'   M8     U$ )	zReturn a list of individual lines in the explanation.

This will return a list of lines split on '\n{', '\n}' and '\n~'.
Any other newlines will be escaped and appear in the line as the
literal '\n' characters.
 r/   r      N){}~>z\n)splitappend)r3   	raw_linesr4   valuess       r   r0   r0   E   sh     "))$/Iq\NEAB-fQi#77LL "I'I	  
 Lr!   c                   [        U SS 5      nS/nS/nU SS  GH:  nUR                  S5      (       au  US   (       a  SnOSnUR                  [        U5      5        US==   S-  ss'   UR                  S5        UR                  SS	[        U5      S-
  -  -   U-   USS -   5        M  UR                  S
5      (       a4  UR	                  5         UR	                  5         XS   ==   USS -  ss'   M  US   S;   d   eUS==   S-  ss'   UR                  S5      (       a  [        U5      O[        U5      S-
  nUR                  S	U-  USS -   5        GM=     [        U5      S:X  d   eU$ )zFormat the individual lines.

This will replace the '{', '}' and '~' characters of our mini formatting
language with the proper 'where ...', 'and ...' and ' + ...' text, taking
care of indentation along the way.

Return a list of formatted lines.
Nr9   r   r:   r>   zand   zwhere z +  r;   )r<   r=   r<   )list
startswithr@   lenpop)r4   r5   stackstackcntlinesindents          r   r1   r1   V   sT    %)_FCEsHab	??3|LLV%RLALOOAMM$Ua!881<tABxGH__S!!IIKLLN9ab)7j((("INI#'??3#7#7SZSZ!^FMM$-$qr(23% & u:??Mr!   c                    [        U [        R                  R                  5      =(       a    [        U [        5      (       + $ N)
isinstancecollectionsabcr   r%   xs    r   
issequencerU   y   s(    a112M:a;M7MMr!   c                "    [        U [        5      $ rO   )rP   r%   rS   s    r   istextrW   }   s    ar!   c                "    [        U [        5      $ rO   )rP   dictrS   s    r   isdictrZ      s    ar!   c                0    [        U [        [        -  5      $ rO   )rP   set	frozensetrS   s    r   issetr^      s    ay))r!   c                N    [        U [        5      =(       a    [        U SS 5      S L$ )N_fields)rP   tuplegetattrobjs    r   isnamedtuplere      s"    c5!Ogc9d&C4&OOr!   c                     [        U SS 5      S L$ )N__dataclass_fields__rb   rc   s    r   	isdataclsri      s    3.5TAAr!   c                     [        U SS 5      S L$ )N__attrs_attrs__rh   rc   s    r   isattrsrl      s    3)40<<r!   c                Z     [        U 5        [        U 5      (       + $ ! [         a     gf = f)NF)iterrW   	Exceptionrc   s    r   
isiterablerp      s,    S	#; s    
**c                    [        U R                  S5      (       a_  [        U R                  R                  S5      (       a:  U R                  R                  R                  n[	        U 5      (       a  SU;   $ US:H  $ g)a|  Check if an instance of an object contains the default eq

First, we check if the object's __eq__ attribute has __code__,
if so, we check the equally of the method code filename (__code__.co_filename)
to the default one generated by the dataclass and attr module
for dataclasses the default co_filename is <string>, for attrs class, the __eq__ should contain "attrs eq generated"
__code__co_filenamezattrs generated z<string>T)hasattr__eq__rr   rs   rl   )rd   code_filenames     r   has_default_eqrw      sb     szz:&&73::3F3F+V+V

++773<<%66
**r!   c                   U R                  [        R                  5      n[        U[        5      =(       a0    [        U[        5      =(       a    [        SU5      [        SU5      :H  nUS:  a  [        X$S9n[        X4S9nO(S[        U5      -
  S-
  S-  n[        X(US9n[        X8US9nU SU SU 3n	U R                  5       R                  n
Sn US	:X  a  [        X#X5      nGO(US
:X  a-  [        U5      (       a  [        U5      (       a  [        X#U5      nOUS:X  a$  [        U5      (       a  [        U5      (       a  S/nOUS:X  a-  [        U5      (       a  [        U5      (       a  [        X#X5      nOUS:X  a-  [        U5      (       a  [        U5      (       a  [!        X#X5      nOeUS:X  a-  [        U5      (       a  [        U5      (       a  [#        X#X5      nO2US:X  a,  [        U5      (       a  [        U5      (       a  [%        X#X5      nU(       d  gUS   S:w  a  S/UQnU	/UQ$ ! [&        R(                   a    e [*         aA    [,        R.                  R0                  R3                  5       R5                  5       nSU S3S/n Nyf = f)z<Return specialised explanations for some operators/operands.NFDr9   )	use_asciiA      )maxsizerz    Nz==znot inz!=Both sets are equalz>=z<=r=   <z<(pytest_assertion plugin: representation of details failed: .z+ Probably an object has a faulty __repr__.)r   r8   )get_verbosityr   VERBOSITY_ASSERTIONSrP   r%   r   r   rG   r   get_terminal_writer
_highlight_compare_eq_anyrW   _notin_textr^   _compare_gte_set_compare_lte_set_compare_gt_set_compare_lt_setr   Exitro   _pytest_codeExceptionInfofrom_current_getreprcrash)configopleftrightrz   verbose	left_repr
right_reprr}   summaryhighlighterr3   
repr_crashs                r   assertrepr_comparer      sP    ""6#>#>?G
 	4 	>uc"	>eT"iu&==  {&tA	'C

 c"g! TiH	e	J
1RD*.G,,.99KK
:)${LK8^d||u)$w?4ZT{{uU||454ZT{{uU||.tKQ4ZT{{uU||.tKQ3YT{{uU||-d;P3YT{{uU||-d;P 1~(K("k"" ==  
]]00==?MMO
J:,VWX9

s7   H& #2H& )H&  2H& 32H& &2H& 2H& &AJJc                T   / n[        U 5      (       a  [        U5      (       a  [        XX#5      nU$ SSKJn  [	        X5      (       d  [	        X5      (       a:  [	        X5      (       a  U OUn[	        X5      (       a  UOU nUR                  U5      nO[        U 5      [        U5      L a=  [        U 5      (       d   [        U 5      (       d  [        U 5      (       a  [        XX#5      nO[        U 5      (       a  [        U5      (       a  [        XX#5      nOY[        U 5      (       a  [        U5      (       a  [        XX#5      nO,[        U 5      (       a  [        U5      (       a  [!        XX#5      n[#        U 5      (       a-  [#        U5      (       a  [%        XX#5      nUR'                  U5        U$ )Nr   )
ApproxBase)rW   
_diff_text_pytest.python_apir   rP   _repr_comparetyperi   rl   re   _compare_eq_clsrU   _compare_eq_sequencer^   _compare_eq_setrZ   _compare_eq_dictrp   _compare_eq_iterableextend)	r   r   r   r   r3   r   approx_side
other_sideexpls	            r   r   r      sC    Kd||u kC: 7 	2d'':e+H+H",T">">$EK",T">">DJ%33J?K$Z4;&dOOwt}}T0B0B *${LK*U"3"3.tKQK4[[U5\\)${LKD\\fUmm*4MKd
5 1 1'[JDt$r!   c                   SSK Jn  / nUS:  a  Sn[        [        [	        U 5      [	        U5      5      5       H  nX   X   :w  d  M    O   US:  a  US-  nSU S3/nXS n XS n[	        U 5      [	        U5      :X  aJ  [        [	        U 5      5       H  nX*    X*    :w  d  M    O   US:  a  US-  nUSU S	3/-  nU SU*  n USU*  nS
nU R                  5       (       d  UR                  5       (       a.  [        [        U 5      5      n [        [        U5      5      nUS/-  nUR                  U" SR                  S U" UR                  U5      U R                  U5      5       5       5      SS9R                  5       5        U$ )zReturn the explanation for the diff between text.

Unless --verbose is used this will skip leading and trailing
characters which are identical to keep the diff minimal.
r   )ndiffr9   *   
   z	Skipping z5 identical leading characters in diff, use -v to showNz6 identical trailing characters in diff, use -v to showTz;Strings contain only whitespace, escaping them using repr()r/   c              3  D   #    U  H  nUR                  S 5      v   M     g7f)r/   N)strip.0rK   s     r   	<genexpr>_diff_text.<locals>.<genexpr>J  s#      XD 

4  Xs    diffr   )difflibr   rangeminrG   isspacereprr%   r   r2   
splitlines)r   r   r   r   r   r3   ikeependss           r   r   r     s    K{s3t9c%j12Aw%(" 3 r6GAA3STK 8D"IEt9E
"3t9%8uRy( & 2vRs #9 9   CaRycr
H||~~CISZ UVV II !%"2"28"<dooh>WX  	
 *, r!   c                t   US::  a  [        5       (       d  S/$ SS Kn[        5       R                  U 5      R	                  5       n[        5       R                  U5      R	                  5       nSS/nUR                  U" SR                  S UR                  Xe5       5       5      SS9R	                  5       5        U$ )	Nr   zUse -v to get more diffr8   z
Full diff:r/   c              3  B   #    U  H  nUR                  5       v   M     g 7frO   )rstripr   s     r   r   '_compare_eq_iterable.<locals>.<genexpr>g  s      LD Ls   r   r   )r   r   r   pformatr   r   r2   r   )r   r   r   r   r   left_formattingright_formattingr3   s           r   r   r   T  s     !|MOO)**#o--d3>>@O$..u5@@B|$K II #MM*:L  	
 *, r!   c                T   [        U [        5      =(       a    [        U[        5      n/ n[        U 5      n[        U5      n[        [	        Xg5      5       He  nX   X   :w  d  M  U(       a  XUS-    n	XUS-    n
OX   n	X   n
UR                  SU SU" [        U	5      5       SU" [        U
5      5       35          O   U(       a  U$ Xg-
  nU(       aW  US:  a  Sn[        X   5      nOSU-
  nSn[        X   5      nUS:X  a  UU SU" U5       3/-  nU$ UU S	U S
U" U5       3/-  nU$ )Nr9   z	At index z diff:  != r   LeftRightz contains one more item: z
 contains z more items, first extra item: )rP   bytesrG   r   r   r@   r   r   )r   r   r   r   comparing_bytesr3   len_left	len_rightr   
left_valueright_valuelen_diffdir_with_moreextras                 r   r   r   q  sz    !u-J*UE2JOK4yHE
I3x+,7eh "a!e_
#A.!W
#hA3 Z 012${4CT7U6VX + -.  #Ha<"MT_-E8|H#MU_-Eq= /!:;u;M:NO K   /H:5TU`afUgThi K r!   c                z    / nUR                  [        SXU5      5        UR                  [        SXU5      5        U$ )Nr   r   )r   _set_one_sided_diffr   r   r   r   r3   s        r   r   r     s?     K*64LM*7EMNr!   c                2    [        XU5      nU(       d  S/$ U$ Nr   )r   r   s        r   r   r     "     #4<K%&&r!   c                2    [        XU5      nU(       d  S/$ U$ r   )r   r   s        r   r   r     r   r!   c                    [        SXU5      $ )Nr   r   r   r   r   r   s       r   r   r     s     w[AAr!   c                    [        SXU5      $ )Nr   r   r   s       r   r   r     s     vtK@@r!   c                    / nX-
  nU(       a>  UR                  SU  S35        U H#  nUR                  U" [        U5      5      5        M%     U$ )NzExtra items in the z set:)r@   r   )posnset1set2r   r3   r   items          r   r   r     sR     K;D0e<=D{8D>:; r!   c                J   / n[        U 5      n[        U5      nUR                  U5      nU Vs0 s H  oU   X   :X  d  M  XU   _M     n	nU	(       a  US:  a  US[        U	5       S3/-  nO9U	(       a2  US/-  nXB" [        R                  " U	5      5      R                  5       -  nU Vs1 s H  oU   X   :w  d  M  UiM     n
nU
(       aA  US/-  nU
 H5  nUU" [        XU   05      5      S-   U" [        XU   05      5      -   /-  nM7     XV-
  n[        U5      nU(       al  UR                  SU SUS	:X  a  S
OS S35        UR                  U" [        R                  " U Vs0 s H  oX   _M	     sn5      5      R                  5       5        Xe-
  n[        U5      nU(       al  UR                  SU SUS	:X  a  S
OS S35        UR                  U" [        R                  " U Vs0 s H  oX   _M	     sn5      5      R                  5       5        U$ s  snf s  snf s  snf s  snf )Nr|   	Omitting ! identical items, use -vv to showzCommon items:zDiffering items:r   zLeft contains z
 more itemr9   r8   rL   :zRight contains )	r\   intersectionrG   pprintr   r   r   r@   r   )r   r   r   r   r3   set_left	set_rightcommonksamer   
extra_leftlen_extra_leftextra_rightlen_extra_rights                  r   r   r     sD     K4yHE
I""9-F &>1q'UX*=JAAwJD>!)CI;.OPQQ	(({6>>$#78CCEE5v!aEH!4AvD5*++AHaa\23h8}567 K  %J_N^,J^q=PrVY6ZZ[\	
 	J'GJq47
J'GHITTV	
 &K+&Oo.jRS?SY\8]]^_	
 	['I[58['IJKVVX	
 C ? 6  (H (Js#   H 	H)H;H"H$H c                   [        U 5      (       d  / $ [        U 5      (       aD  SS KnUR                  U 5      nU Vs/ s H!  ofR                  (       d  M  UR
                  PM#     nnOk[        U 5      (       a<  U R                  nU Vs/ s H"  n[        US5      (       d  M  UR
                  PM$     nnO[        U 5      (       a  U R                  nO eSn	/ n
/ nU H?  n[        X5      [        X5      :X  a  U
R                  U5        M.  UR                  U5        MA     / nU
(       d  U(       a  US/-  nU
(       a%  US:  a  UR                  S[        U
5       S35        O9U
(       a2  US/-  nX" [        R                  " U
5      5      R                  5       -  nU(       a  US	/-  nX" [        R                  " U5      5      R                  5       -  nU Ho  n[        X5      n[        X5      nUSS
U S3U	 U SU" [!        U5      5       SU" [!        U5      5       3/-  nU[#        XX#5       Vs/ s H  nX-   PM	     sn-  nMq     U$ s  snf s  snf s  snf )Nr   eqrD   r8   r|   r   r   zMatching attributes:zDiffering attributes:z$Drill down into differing attribute r   z: r   )rw   ri   dataclassesfieldscomparenamerl   rk   rb   re   r`   r@   rG   r   r   r   r   r   )r   r   r   r   r   
all_fieldsinfofields_to_checkfieldrM   r   r   r3   
field_leftfield_rightrK   s                   r   r   r      sE    $	 ''-
1;L||9499L	))
3=V:%PTAU:5:::V	d		,,uFDD 475#88KKKK	 ! Ktt!Ys4yk1RST	.//{6>>$#78CCEE/00{6>>$#78CCEEE -J!%/K6ugQ?(5'KZ0@$A#B${SWXcSdGeFfg K
 +[D  K  W M WDs   III I/Ic                   UR                  U 5      nUS U nX[        U 5      -   S  nXE-   n[        X[        U5      n[	        U SS9 S3/nU Hs  n	U	R                  S5      (       a  M  U	R                  S5      (       a  M3  U	R                  S5      (       a  UR                  SU	SS  -   5        Mb  UR                  U	5        Mu     U$ )	Nr   )r}   z is contained here:Skippingz- z+ rD   r|   )findrG   r   r-   r   rF   r@   )
termtextr   indexheadtailcorrect_textr   newdiffrK   s
             r   r   r   W  s    IIdOE<DD	!#$D;Ld*;WED4,--@ABG??:&&??4  ??4  NN4$qr(?+NN4   Nr!   r"   r$   )r3   r%   r&   r%   )r3   r%   r&   	list[str])r4   zSequence[str]r&   r	  )rT   r	   r&   bool)rd   r	   r&   r
  )rd   objectr&   r
  )F)
r   r%   r   r	   r   r	   rz   r
  r&   zlist[str] | None)r   )
r   r	   r   r	   r   r   r   intr&   r	  )
r   r%   r   r%   r   r   r   r  r&   r	  )
r   Iterable[Any]r   r  r   r   r   r  r&   r	  )
r   Sequence[Any]r   r  r   r   r   r  r&   r	  )
r   AbstractSet[Any]r   r  r   r   r   r  r&   r	  )
r   r%   r   r  r   r  r   r   r&   r	  )
r   Mapping[Any, Any]r   r  r   r   r   r  r&   r	  )r  r%   r  r%   r   r  r&   r	  )>__doc__
__future__r   collections.abcrQ   r   r   r   r   r   AbstractSetr   typingr	   r
   r   unicodedatar   r   r   _pytest._code_pytest._io.pprintr   _pytest._io.safereprr   r   _pytest.compatr   _pytest.configr   r   __annotations__r   r   r   r-   r6   r0   r1   rU   rW   rZ   r^   re   ri   rl   rp   rw   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r!   r   <module>r     s   ( "  $ $ # $ .     !   , ) 3 ( ! DH@ G ;?7 >  6X 6
" FN*PB=		, ?DC#C#C#'*C#7;C#C#N HI"
""(6"AD""L HI4
44(64AD44v 	
   	
 B 	9
99  9 	9
 9@ 		
		  	 		
 	  		
		  	 		
 	  		
		  	 		
 	  	B
BB  B 	B
 B 	A
AA  A 	A
 A

   	
 & 	+
++  + 	+
 +\4
44(64AD44nr!   