§
    s
Êj$  ã                  ól   — 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dS )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 showÚexplanationú	list[str]Úitemr   Úreturnc                óT   — 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)r	   r   Úshould_truncater   r   s        úJC:\Projects\Muse2API\.venv\Lib\site-packages\_pytest/assertion/truncate.pyÚtruncate_if_requiredr      sF   € å,FÀtÑ,LÔ,LÑ)€O�Y 	Øð 
Ý$ØØØð
ñ 
ô 
ð 	
ð
 Ðó    útuple[bool, int, int]c                ób  — | j                              d¦  «        }t          |�|nt          ¦  «        }| j                              d¦  «        }t          |�|nt          ¦  «        }| j                              t          j        ¦  «        }|dk     ot          ¦   «          }|o|dk    p|dk    }|||fS )zgReturn the truncation parameters related to the given item, as (should truncate, max lines, max chars).Útruncation_limit_linesNÚ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�IÕ<MÑNÔN€Ià”×"Ò"Ð#;Ñ<Ô<€IÝ Ð!6�I�IÕ<MÑNÔN€IàŒk×'Ò'­Ô(CÑDÔD€Gà ’kÐ9­-©/¬/Ð&9€OØ%ÐJ¨9°qª=Ð+I¸IÈºM€Oà˜I yÐ0Ð0r   Úinput_linesr   r   r   c                óÌ  — |dz   }|dk    st          | ¦  «        |dz   k    r(|dk    st          d„ | D ¦   «         ¦  «        |k    r| S | }n
| d|…         }|dk    ot          d„ |D ¦   «         ¦  «        |k    }|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  ó4   K  — | ]}t          |¦  «        V — Œd S ©N©Úlen)Ú.0Úss     r   ú	<genexpr>z(_truncate_explanation.<locals>.<genexpr>U   s(   è è € Ð =Ð =¨A¥ Q¡¤Ð =Ð =Ð =Ð =Ð =Ð =r   Nc              3  ó4   K  — | ]}t          |¦  «        V — Œd S r'   r(   )r*   Úes     r   r,   z(_truncate_explanation.<locals>.<genexpr>^   s(   è è € Ð6Ð6˜1•�A‘”Ð6Ð6Ð6Ð6Ð6Ð6r   éÿÿÿÿz...Ú z...Full output truncated (z lineé   r+   z
 hidden), )r)   ÚsumÚ_truncate_by_char_countr   Ú	USAGE_MSG)r#   r   r   Útolerable_max_charsÚtruncated_explanationÚneed_to_truncate_charÚtruncated_line_counts          r   r   r   4   sz  € ð: 	�B‰ð ð �A‚~€~�˜[Ñ)Ô)¨Y¸©]Ò:Ð:Ø˜Š>ˆ>�SÐ =Ð =°Ð =Ñ =Ô =Ñ=Ô=ÐATÒTÐTØÐØ +ÐÐð !,¨J¨Y¨JÔ 7Ðð 	�AŠð 	MÝÐ6Ð6Ð 5Ð6Ñ6Ô6Ñ6Ô6Ð9LÒLð ð ð 
Ý 7Ø! 9ñ!
ô !
Ðð ˜"ÐÐÔ Ñ&ÐÐÑåˆKÑÔ�3Ð4Ñ5Ô5Ñ5½Ð<QÑ8RÔ8RÑRð ðØ	ðà
ðð	KÐ%9ð 	Kð 	KØ%¨Ò*Ð*ˆ2ˆ2°ð	Kð 	KÝ?Hð	Kð 	Kðð r   c                óø   — d}t          | ¦  «        D ]/\  }}|t          |¦  «        z   |k    r n|t          |¦  «        z  }Œ0| d |…         }| |         }|r||z
  }|d |…         }|                     |¦  «         |S )Nr   )Ú	enumerater)   Úappend)r#   r   Úiterated_char_countÚiterated_indexÚ
input_lineÚtruncated_resultÚ
final_lineÚfinal_line_truncate_points           r   r3   r3   q   s­   € àÐÝ&/°Ñ&<Ô&<ð /ð /Ñ"ˆ˜
Ø¥ Z¡¤Ñ0°9Ò<Ð<ØˆEØ�s :™œÑ.ÐÐð # ? N ?Ô3ÐØ˜^Ô,€JØð <Ø$-Ð0CÑ$CÐ!ØÐ :Ð!:Ð :Ô;ˆ
Ø×Ò˜JÑ'Ô'Ð'ØÐr   N)r	   r
   r   r   r   r
   )r   r   r   r   )r#   r
   r   r   r   r   r   r
   )r#   r
   r   r   r   r
   )Ú__doc__Ú
__future__r   Ú_pytest.compatr   Ú_pytest.configr   Ú_pytest.nodesr   r   r   r4   r   r   r   r3   © r   r   ú<module>rH      sÌ   ððð ð #Ð "Ð "Ð "Ð "Ð "à (Ð (Ð (Ð (Ð (Ð (Ø !Ð !Ð !Ð !Ð !Ð !Ø Ð Ð Ð Ð Ð ð Ð Ø%¨Ñ*Ð Ø€	ð	ð 	ð 	ð 	ð1ð 1ð 1ð 1ð*:ð :ð :ð :ðzð ð ð ð ð r   