Ë
    •Kêj  ã                  ó¸   — d 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Zd	e› �Zd
Z ed«       ee«      z   Zd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)ÚIterable)ÚNO_TRUNCATION_BUDGET)ÚTruncationBudget)Úrunning_on_ci)ÚConfigzuse '-vv' to showz...Full output truncated, é   ú...c                ón  — t        |«      \  }}|st        | «      S |j                  t        z   }|j                  dkD  r|j                  t
        z   dz   nd}g }d}| D ]J  }|j                  |«       |t        |«      z  }|�t        |«      |k\  r n|j                  dkD  sŒD||kD  sŒJ n |S t        ||«      S )zÏMaterialise a streaming explanation, applying truncation lazily.

    Pulls from ``lines`` only until the truncation threshold is reached;
    the rest of the iterator is dropped without being consumed.
    r   é   N)	Ú_get_truncation_parametersÚlistÚ	max_charsÚTRUNCATION_FOOTER_CHARSÚ	max_linesÚTRUNCATION_FOOTER_LINESÚappendÚlenÚ_truncate_explanation)	ÚlinesÚconfigÚshould_truncateÚbudgetÚtolerable_max_charsÚline_capÚbufferedÚ
char_countÚlines	            ú_/home/oem/CyberBrain26-unified/.venv/lib/python3.12/site-packages/_pytest/assertion/truncate.pyÚmaterialize_with_truncationr       sÔ   € ô 9¸Ó@Ñ€O�VÙÜ�E‹{Ðà ×*Ñ*Ô-DÑDÐð
 ;A×:JÑ:JÈQÒ:Nˆ×ÑÔ2Ñ2°QÒ6ÐTXð ð €HØ€JØò 	ˆØ�‰˜ÔØ”c˜$“iÑˆ
ØÐ¤C¨£M°XÒ$=ÙØ×Ñ˜aÓ JÐ1DÓ$DÙð	ð ˆä  ¨6Ó2Ð2ó    c                óÌ   — | j                  t        j                  «      }|dk\  s
t        «       rdt        fS t        | «      }|j                  dkD  xs |j                  dkD  }||fS )zUReturn the truncation parameters from the given config, as (should truncate, budget).r	   Fr   )Úget_verbosityr   ÚVERBOSITY_ASSERTIONSr   r   Ú_budget_from_configr   r   )r   Úverboser   r   s       r   r   r   =   sf   € ð ×"Ñ"¤6×#>Ñ#>Ó?€GØ�!‚|”}”ØÔ*Ð*Ð*ä  Ó(€FØ×&Ñ&¨Ñ*ÒB¨f×.>Ñ.>ÀÑ.B€OØ˜FÐ"Ð"r!   c                óÖ   — | j                  d«      }| j                  d«      }t        |€t        j                  n
t        |«      |€t        j                  ¬«      S t        |«      ¬«      S )z¥Build a budget from the ``truncation_limit_*`` ini options.

    ``getini`` returns ``None`` when an option is unset, which falls back to
    the default limit.
    Útruncation_limit_linesÚtruncation_limit_chars)r   r   )Úgetinir   ÚDEFAULT_MAX_LINESÚintÚDEFAULT_MAX_CHARS)r   r   r   s      r   r%   r%   M   sj   € ð —‘Ð6Ó7€IØ—‘Ð6Ó7€IÜà2;Ð2CÔ×.Ò.ÌÈYËð 3<Ð2CÔ×.Ñ.ôð ô
 JMÈYËôð r!   c                óš  — |j                   t        z   }|j                  dk(  st        | «      |j                  t        z   k  r)|j                   dk(  st        d„ | D «       «      |k  r| S | }n| d|j                   }|j                   dkD  r+t        d„ |D «       «      |kD  rt        ||j                   «      }|dxx   dz  cc<   g |¢d‘t        ‘S )a.  Truncate given list of strings that makes up the assertion explanation.

    Truncates to either ``budget.max_lines`` or ``budget.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.
    r   c              3  ó2   K  — | ]  }t        |«      –— Œ y ­w©N©r   )Ú.0Úss     r   ú	<genexpr>z(_truncate_explanation.<locals>.<genexpr>x   s   è ø€ Ò/˜a”3�q—6Ñ/ùó   ‚Nc              3  ó2   K  — | ]  }t        |«      –— Œ y ­wr0   r1   )r2   Úes     r   r4   z(_truncate_explanation.<locals>.<genexpr>‚   s   è ø€ Ò6˜1”�A—Ñ6ùr5   éÿÿÿÿr
   Ú )r   r   r   r   r   ÚsumÚ_truncate_by_char_countÚTRUNCATION_MSG)Úinput_linesr   r   Útruncated_explanations       r   r   r   _   sô   € ð$ !×*Ñ*Ô-DÑDÐà×Ñ˜AÒÜˆ{Ó˜v×/Ñ/Ô2IÑIÒIð ×Ñ Ò!ÜÑ/ ;Ô/Ó/Ð3FÒFàÐØ +Ñð !,Ð,>¨f×.>Ñ.>Ð ?Ðð 	×Ñ˜1ÒÜÑ6Ð 5Ô6Ó6Ð9LÒLä 7Ø! 6×#3Ñ#3ó!
Ðð ˜"Ó Ñ&ÓðØ	ðà
ðô 	ðð r!   c                óÀ   — d}t        | «      D ]&  \  }}|t        |«      z   |kD  r n|t        |«      z  }Œ( | d  }| |   }|r
||z
  }|d | }|j                  |«       |S )Nr   )Ú	enumerater   r   )r=   r   Úiterated_char_countÚiterated_indexÚ
input_lineÚtruncated_resultÚ
final_lineÚfinal_line_truncate_points           r   r;   r;   �   sŽ   € àÐÜ&/°Ó&<ò /Ñ"ˆ˜
Ø¤ Z£Ñ0°9Ò<ÙØœs :›Ñ.Ñð/ð # ? NÐ3ÐØ˜^Ñ,€JÙØ$-Ð0CÑ$CÐ!ØÐ :Ð!:Ð;ˆ
Ø×Ñ˜JÔ'ØÐr!   N)r   zIterable[str]r   r   Úreturnú	list[str])r   r   rG   ztuple[bool, TruncationBudget])r   r   rG   r   )r=   rH   r   r   rG   rH   )r=   rH   r   r,   rG   rH   )Ú__doc__Ú
__future__r   Úcollections.abcr   Ú_pytest.assertion._typingr   r   Ú_pytest.compatr   Ú_pytest.configr   Ú	USAGE_MSGr<   r   r   r   r    r   r%   r   r;   © r!   r   ú<module>rQ      s‚   ðñõ #å $å :Ý 6Ý (Ý !ð  €	Ø-¨i¨[Ð9€ð Ð Ù˜e›*¡s¨>Ó':Ñ:Ð ó3óB#ó ð$.Øð.àð.ð ó.ôbr!   