Ë
    æØjj$  ã                  óz   — d Z ddlmZ ddlmZ ddlmZ ddlmZ dZ	e	dz  Z
dZdd	„Zdd
„Z	 	 	 	 	 	 	 	 dd„Zdd„Zy)zÑUtilities for truncating assertion output.

Current default behaviour is to truncate assertion explanations at
terminal lines, unless running with an assertions verbosity level of at least 2 or running on CI.
é    )Úannotations)Úrunning_on_ci)ÚConfig)ÚItemé   éP   zuse '-vv' to showc                óD   — t        |«      \  }}}|rt        | ||¬«      S | S )zGTruncate this assertion explanation if the given test item is eligible.)Ú	max_linesÚ	max_chars)Ú_get_truncation_parametersÚ_truncate_explanation)ÚexplanationÚitemÚshould_truncater
   r   s        ú\/opt/eval-harness/bench_task/venv/lib/python3.12/site-packages/_pytest/assertion/truncate.pyÚtruncate_if_requiredr      s4   € ä,FÀtÓ,LÑ)€O�Y 	ÙÜ$ØØØô
ð 	
ð
 Ðó    c                óZ  — | j                   j                  d«      }t        |�|nt        «      }| j                   j                  d«      }t        |�|nt        «      }| j                   j                  t        j                  «      }|dk  xr t        «        }|xr |dkD  xs |dkD  }|||fS )zgReturn the truncation parameters related to the given item, as (should truncate, max lines, max chars).Útruncation_limit_linesÚtruncation_limit_charsé   r   )	ÚconfigÚgetiniÚintÚDEFAULT_MAX_LINESÚDEFAULT_MAX_CHARSÚget_verbosityr   ÚVERBOSITY_ASSERTIONSr   )r   r
   r   Úverboser   s        r   r   r      s£   € ð —‘×"Ñ"Ð#;Ó<€IÜ Ð!6‘IÔ<MÓN€Ià—‘×"Ñ"Ð#;Ó<€IÜ Ð!6‘IÔ<MÓN€Ià�k‰k×'Ñ'¬×(CÑ(CÓD€Gà ‘kÒ9¬-«/Ð&9€OØ%ÒJ¨9°q©=Ò+I¸IÈ¹M€Oà˜I yÐ0Ð0r   c                ól  — |dz   }|dk(  st        | «      |dz   k  r|dk(  st        d„ | D «       «      |k  r| S | }n| d| }|dkD  xr t        d„ |D «       «      |kD  }|rt        ||«      }|dxx   dz  cc<   t        | «      t        |«      z
  t        |«      z   }g |¢d	‘d
|› d|dk(  rd	nd› dt        › �‘S )a  Truncate given list of strings that makes up the assertion explanation.

    Truncates to either max_lines, or max_chars - whichever the input reaches
    first, taking the truncation explanation into account. The remaining lines
    will be replaced by a usage message.

    If max_chars=0, no truncation by character count is performed.
    If max_lines=0, no truncation by line count is performed.

    When this function is launched we know max_lines > 0 or max_chars > 0
    because _get_truncation_parameters was called first.
    éF   r   r   c              3  ó2   K  — | ]  }t        |«      –— Œ y ­w©N©Úlen)Ú.0Úss     r   ú	<genexpr>z(_truncate_explanation.<locals>.<genexpr>U   s   è ø€ Ò =¨A¤ Q§Ñ =ùó   ‚Nc              3  ó2   K  — | ]  }t        |«      –— Œ y ­wr#   r$   )r&   Úes     r   r(   z(_truncate_explanation.<locals>.<genexpr>^   s   è ø€ Ò6˜1”�A—Ñ6ùr)   éÿÿÿÿz...Ú z...Full output truncated (z lineé   r'   z
 hidden), )r%   ÚsumÚ_truncate_by_char_countr   Ú	USAGE_MSG)Úinput_linesr
   r   Útolerable_max_charsÚtruncated_explanationÚneed_to_truncate_charÚtruncated_line_counts          r   r   r   4   s  € ð: 	�B‰ð ð �A‚~œ˜[Ó)¨Y¸©]Ò:Ø˜Š>œSÑ =°Ô =Ó=ÐATÒTØÐØ +Ñð !,¨J¨YÐ 7Ðð 	�A‰ò 	MÜÑ6Ð 5Ô6Ó6Ð9LÑLð ñ Ü 7Ø! 9ó!
Ðð ˜"Ó Ñ&ÓäˆKÓœ3Ð4Ó5Ñ5¼Ð<QÓ8RÑRð ðØ	ðà
ðð %Ð%9Ð$:¸%Ø%¨Ò*‰2°Ð
4°J¼y¸kð	Kðð r   c                óÀ   — d}t        | «      D ]&  \  }}|t        |«      z   |kD  r n|t        |«      z  }Œ( | d  }| |   }|r
||z
  }|d | }|j                  |«       |S )Nr   )Ú	enumerater%   Úappend)r2   r   Úiterated_char_countÚiterated_indexÚ
input_lineÚtruncated_resultÚ
final_lineÚfinal_line_truncate_points           r   r0   r0   q   sŽ   € àÐÜ&/°Ó&<ò /Ñ"ˆ˜
Ø¤ Z£Ñ0°9Ò<ÙØœs :›Ñ.Ñð/ð # ? NÐ3ÐØ˜^Ñ,€JÙØ$-Ð0CÑ$CÐ!ØÐ :Ð!:Ð;ˆ
Ø×Ñ˜JÔ'ØÐr   N)r   ú	list[str]r   r   Úreturnr@   )r   r   rA   ztuple[bool, int, int])r2   r@   r
   r   r   r   rA   r@   )r2   r@   r   r   rA   r@   )Ú__doc__Ú
__future__r   Ú_pytest.compatr   Ú_pytest.configr   Ú_pytest.nodesr   r   r   r1   r   r   r   r0   © r   r   ú<module>rH      si   ðñõ #å (Ý !Ý ð Ð Ø%¨Ñ*Ð Ø€	ó	ó1ð*:Øð:àð:ð ð:ð ó	:ôzr   